:root {
  --bg: #f4f2ee; --surface: #ffffff; --surface-2: #ece8e1; --text: #1b1d22; --muted: #6b6f78;
  --line: #ddd8cf; --accent: #9a7a3c; --accent-ink: #ffffff; --me: #263247; --me-ink: #f5f3ef;
  --ok: #3d7a52; --warn: #b07a1e; --bad: #b2453a; --notify: #f7efe0;
  --radius: 14px; --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f131b; --surface: #171c26; --surface-2: #202634; --text: #ece9e3; --muted: #959aa6;
    --line: #2a3140; --accent: #c9a45c; --accent-ink: #15130f; --me: #c9a45c; --me-ink: #15130f;
    --ok: #6fbf8a; --warn: #e0ad55; --bad: #e07a6e; --notify: #221f17;
  }
}
:root[data-theme="dark"] {
  --bg: #0f131b; --surface: #171c26; --surface-2: #202634; --text: #ece9e3; --muted: #959aa6;
  --line: #2a3140; --accent: #c9a45c; --accent-ink: #15130f; --me: #c9a45c; --me-ink: #15130f;
  --ok: #6fbf8a; --warn: #e0ad55; --bad: #e07a6e; --notify: #221f17;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.45 var(--font); -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: 14px; margin: 4px 0 10px; }
.err { color: var(--bad); font-size: 14px; min-height: 1.2em; margin: 8px 0 0; }

/* Giriş */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 340px; text-align: center; }
.login-logo { width: 84px; height: 84px; border-radius: 20px; }
.login h1 { margin: 12px 0 4px; font-size: 28px; letter-spacing: .02em; }
.login form { display: grid; gap: 10px; margin-top: 16px; }
.login input { padding: 13px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); }

/* Uygulama iskeleti */
.app { height: 100dvh; display: flex; flex-direction: column; }
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: calc(env(safe-area-inset-top) + 10px) 16px 8px; background: var(--bg); border-bottom: 1px solid var(--line); }
.top h1 { margin: 0; font-size: 20px; letter-spacing: .03em; }
.status { font-size: 13px; color: var(--muted); }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view.scroll { overflow-y: auto; padding: 12px 16px 24px; display: block; -webkit-overflow-scrolling: touch; }

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); background: var(--surface); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { background: none; border: 0; padding: 8px 0 6px; display: grid; justify-items: center; gap: 2px; font-size: 11px; color: var(--muted); cursor: pointer; }
.tabs svg { width: 24px; height: 24px; }
.tabs button.active { color: var(--accent); }

/* Sohbet */
.hint { margin: 10px 16px 0; padding: 10px 12px; border-radius: 12px; background: var(--notify); font-size: 14px; }
.messages { list-style: none; margin: 0; padding: 12px 16px; flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; -webkit-overflow-scrolling: touch; }
.msg { max-width: 84%; padding: 9px 13px; border-radius: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { align-self: flex-end; background: var(--me); color: var(--me-ink); border-bottom-right-radius: 6px; }
.msg.assistant { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg.notify { background: var(--notify); }
.msg .meta { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.msg.user .meta { color: inherit; opacity: .7; text-align: right; }
.day-sep { align-self: center; font-size: 12px; color: var(--muted); padding: 6px 0 2px; }
.typing { align-self: flex-start; color: var(--muted); font-size: 14px; padding: 4px 6px; }
.typing span { animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; } .typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .typing span { animation: none; } }

.composer { border-top: 1px solid var(--line); background: var(--bg); padding: 8px 12px 10px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 14px; cursor: pointer; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea { flex: 1; resize: none; max-height: 140px; padding: 10px 14px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); outline: none; line-height: 1.35; font-size: 16px; }
.chat-form textarea:focus { border-color: var(--accent); }
.send { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; cursor: pointer; }
.send:disabled { opacity: .5; }

/* Kartlar ve satırlar */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.card h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 2px 0 8px; font-weight: 600; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row .main { flex: 1; min-width: 0; }
.row .title { display: block; }
.row .sub { display: block; font-size: 13px; color: var(--muted); }
.row .empty { color: var(--muted); font-size: 14px; }
.check { flex: none; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); background: none; cursor: pointer; padding: 0; }
.check:hover { border-color: var(--accent); }
.bar { height: 5px; border-radius: 3px; background: var(--surface-2); margin-top: 5px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ok); }
.bar i.warn { background: var(--warn); } .bar i.bad { background: var(--bad); }
.pill { flex: none; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); } .pill.ok { color: var(--ok); }

.btn { border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 9px 14px; cursor: pointer; font-size: 15px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 5px 10px; font-size: 13px; flex: none; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.quick { display: flex; gap: 8px; margin-top: 8px; }
.quick input { flex: 1; min-width: 0; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); }
.secret { margin-top: 10px; padding: 10px; border-radius: 10px; background: var(--surface-2); font: 13px/1.4 ui-monospace, Menlo, monospace; overflow-wrap: anywhere; user-select: all; }
.meter { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.meter div { height: 100%; background: var(--accent); width: 0; }
.toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 76px); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 8px 14px; border-radius: 10px; font-size: 14px; z-index: 9; max-width: calc(100% - 32px); }
