/* ============ Tema ============ */
:root {
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #eef0f6;
  --text: #1c2030;
  --text-dim: #6b7285;
  --accent: #5b5bd6;
  --accent-soft: #e4e4fb;
  --danger: #d64545;
  --success: #2e9e63;
  --warning: #c98a06;
  --border: #dfe2ec;
  --shadow: 0 2px 10px rgba(20, 24, 45, 0.08);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12141c;
    --surface: #1c1f2b;
    --surface-2: #262a3a;
    --text: #e8eaf2;
    --text-dim: #9aa1b5;
    --accent: #8484f0;
    --accent-soft: #2c2c54;
    --border: #30354a;
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 130px; /* komut çubuğu payı */
}

/* ============ Üst bar ============ */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 8px;
  max-width: 860px;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { font-size: 30px; }
.brand h1 { font-size: 20px; }
.brand p { font-size: 12px; color: var(--text-dim); }
.header-actions { display: flex; gap: 8px; }
.icon-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  padding: 7px 10px;
  cursor: pointer;
}
.icon-btn.off { opacity: 0.4; filter: grayscale(1); }

/* ============ Sekmeler ============ */
.tabs {
  display: flex;
  gap: 6px;
  padding: 8px 18px;
  max-width: 860px;
  margin: 0 auto;
  overflow-x: auto;
}
.tab {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 13px;
  border-radius: 999px;
  font-size: 13.5px;
  cursor: pointer;
  white-space: nowrap;
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.badge {
  background: rgba(255,255,255,0.25);
  border-radius: 999px;
  padding: 0 6px;
  font-size: 11px;
}
.tab:not(.active) .badge { background: var(--surface-2); }

main { max-width: 860px; margin: 0 auto; padding: 10px 18px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============ Asistan sekmesi ============ */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: var(--shadow);
}
.stat-value { font-size: 22px; font-weight: 700; }
.stat-value.big { font-size: 28px; }
.stat-label { font-size: 12px; color: var(--text-dim); }

.examples p { font-size: 13px; color: var(--text-dim); margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.chip {
  background: var(--accent-soft);
  color: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 13px;
  cursor: pointer;
}

.section-title { font-size: 15px; margin: 14px 0 10px; color: var(--text-dim); font-weight: 600; }

.feed { display: flex; flex-direction: column; gap: 8px; }
.feed-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px 13px;
}
.feed-item .fi-icon { font-size: 18px; }
.feed-item .fi-body { flex: 1; min-width: 0; }
.feed-item .fi-text { font-size: 14px; word-wrap: break-word; }
.feed-item .fi-meta { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; }
.feed-item img { max-width: 72px; border-radius: 8px; }
.empty {
  text-align: center;
  color: var(--text-dim);
  padding: 30px 10px;
  font-size: 14px;
}

/* ============ Kart listeleri ============ */
.cards { display: flex; flex-direction: column; gap: 10px; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 13px 15px;
  box-shadow: var(--shadow);
}
.card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.card-text { font-size: 14.5px; flex: 1; word-wrap: break-word; white-space: pre-wrap; }
.card-meta { font-size: 12px; color: var(--text-dim); margin-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card img.note-img { max-width: 100%; max-height: 260px; border-radius: 10px; margin-top: 10px; }
.card-actions { display: flex; gap: 6px; }
.mini-btn {
  background: var(--surface-2);
  border: none;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--text);
}
.mini-btn.danger { color: var(--danger); }
.mini-btn.success { color: var(--success); }

/* Grup */
.panel-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.group-filter { display: flex; gap: 6px; flex-wrap: wrap; }
.gchip {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  cursor: pointer;
  color: var(--text);
}
.gchip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ghost-btn {
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-dim);
  border-radius: 10px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.toolbar-title { font-size: 13.5px; color: var(--text-dim); }
.toolbar-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.sound-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-dim);
}
.sound-label select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 13.5px;
}
.group-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 999px;
  color: #fff;
}
select.group-select {
  background: var(--surface-2);
  color: var(--text);
  border: none;
  border-radius: 8px;
  padding: 4px 6px;
  font-size: 12px;
}

/* ============ Harcamalar ============ */
.expense-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.expense-total { display: flex; flex-direction: column; margin-bottom: 12px; }
.category-bars { display: flex; flex-direction: column; gap: 7px; }
.cat-bar-row { display: grid; grid-template-columns: 90px 1fr 70px; align-items: center; gap: 8px; font-size: 12.5px; }
.cat-bar-track { background: var(--surface-2); height: 9px; border-radius: 999px; overflow: hidden; }
.cat-bar-fill { height: 100%; border-radius: 999px; background: var(--accent); }
.cat-amount { text-align: right; color: var(--text-dim); }
.expense-amount { font-weight: 700; font-size: 16px; white-space: nowrap; }

.inline-form { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.inline-form input, .inline-form select {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
  flex: 1;
  min-width: 110px;
}
.primary-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 14px;
  cursor: pointer;
}

/* ============ Hatırlatmalar ============ */
.card.overdue { border-color: var(--danger); }
.card.done { opacity: 0.55; }
.due-tag { font-weight: 600; }
.due-tag.overdue { color: var(--danger); }
.due-tag.soon { color: var(--warning); }

/* ============ Komut çubuğu ============ */
.command-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
.command-row {
  display: flex;
  gap: 8px;
  align-items: center;
  max-width: 860px;
  margin: 0 auto;
}
#commandInput {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 11px 16px;
  font-size: 15px;
  min-width: 0;
}
#commandInput:focus { outline: 2px solid var(--accent); }
.round-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  font-size: 17px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
}
.round-btn.send { background: var(--accent); border-color: var(--accent); color: #fff; }
.round-btn.mic.listening {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  animation: pulse 1.2s infinite;
}
.round-btn:disabled { opacity: 0.4; cursor: not-allowed; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(214, 69, 69, 0.5); }
  70% { box-shadow: 0 0 0 12px rgba(214, 69, 69, 0); }
  100% { box-shadow: 0 0 0 0 rgba(214, 69, 69, 0); }
}
.interim {
  max-width: 860px;
  margin: 0 auto 8px;
  font-size: 13.5px;
  color: var(--text-dim);
  font-style: italic;
  padding: 0 4px;
}
.pending-image {
  max-width: 860px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pending-image img { height: 54px; border-radius: 8px; border: 1px solid var(--border); }
.pending-image button {
  background: var(--surface-2);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  color: var(--text);
}
.hidden { display: none !important; }

/* ============ Modal ============ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  width: 100%;
  max-width: 480px;
}
.modal-box h3 { margin-bottom: 12px; }
.modal-box video { width: 100%; border-radius: 10px; background: #000; min-height: 240px; }
.modal-actions { display: flex; gap: 10px; margin-top: 14px; justify-content: flex-end; }

/* ============ Toast ============ */
.toasts {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 420px);
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 14px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 10px;
  align-items: center;
  animation: slideDown 0.25s ease;
  cursor: pointer;
}
.toast.success { border-left-color: var(--success); }
.toast.warn { border-left-color: var(--warning); }
.toast.danger { border-left-color: var(--danger); }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 560px) {
  .stats-row { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .stat-value { font-size: 17px; }
  .cat-bar-row { grid-template-columns: 72px 1fr 62px; }
}

/* ============ Yazdırma raporu ============ */
#printReport { display: none; }
@media print {
  body { padding: 0; background: #fff; }
  body > *:not(#printReport) { display: none !important; }
  #printReport {
    display: block !important;
    color: #000;
    font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 12px;
    padding: 8px;
  }
  #printReport h1 { font-size: 21px; margin-bottom: 3px; }
  #printReport h2 { font-size: 14px; margin: 16px 0 5px; }
  #printReport .rep-sub { color: #555; margin-bottom: 8px; }
  #printReport table { width: 100%; border-collapse: collapse; margin: 6px 0 10px; }
  #printReport th, #printReport td { border: 1px solid #bbb; padding: 5px 8px; text-align: left; }
  #printReport th { background: #eee; }
  #printReport th.num, #printReport td.num { text-align: right; white-space: nowrap; }
  #printReport tr.rep-total td { font-weight: 700; background: #f3f3f3; }
}
