:root {
  --bg: #F6F7F5;
  --surface: #FFFFFF;
  --ink: #16201C;
  --muted: #5B6761;
  --line: #E3E7E4;
  --line-strong: #C9D1CC;
  --accent: #0B7A5B;
  --accent-soft: #E3F4EC;
  --accent-ink: #0B5F46;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

button, input { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }

#app {
  max-width: 560px;
  height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-top: env(safe-area-inset-top);
}

.page { padding: 28px 20px 20px; display: flex; flex-direction: column; gap: 20px; }
.page.flush { padding-left: 0; padding-right: 0; }
.pad { padding: 0 20px; }

h1 { margin: 0; font-size: 26px; font-weight: 700; line-height: 1.2; }
h2 { margin: 0; font-size: 20px; font-weight: 700; }
.sub { font-size: 14px; color: var(--muted); }
.small { font-size: 12px; color: var(--muted); line-height: 1.5; }
.center { text-align: center; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.stat span { font-size: 12px; color: var(--muted); }
.stat b { font-size: 28px; font-weight: 600; line-height: 1.1; }

.list { display: flex; flex-direction: column; gap: 10px; }

.card {
  width: 100%;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.avatar {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
}
.grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line1 { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.time { flex: 0 0 auto; font-size: 12px; color: var(--muted); }
.preview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-tag { font-size: 12px; color: var(--accent-ink); font-weight: 600; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; align-self: flex-start; }
.chip i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.chip.ok  { background: #E3F4EC; color: #0B5F46; } .chip.ok i  { background: #0B7A5B; }
.chip.qr  { background: #FCEFD6; color: #7A4B00; } .chip.qr i  { background: #B7791F; }
.chip.off { background: #FBE4E1; color: #8A2A1E; } .chip.off i { background: #C0392B; }

.badge { flex: 0 0 auto; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; }

.btn { min-height: 52px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; padding: 0 20px; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); min-height: 44px; width: auto; font-size: 14px; padding: 0 18px; align-self: center; }
.btn.danger { background: var(--surface); color: #8A2A1E; border: 1px solid #E8C2BC; min-height: 44px; font-size: 14px; }
.btn:disabled { opacity: 0.6; cursor: default; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 20px; }
.pill { flex: 0 0 auto; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); padding: 0 16px; font-size: 13px; font-weight: 600; }
.pill[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.rows { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.row { width: 100%; border: 0; border-top: 1px solid var(--line); background: transparent; display: flex; align-items: center; gap: 12px; padding: 14px 20px; text-align: left; }
.row:first-child { border-top: 0; }
.empty { padding: 24px 20px; font-size: 14px; color: var(--muted); }

.tabs { flex: 0 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.tab { min-height: 52px; border: 0; border-radius: 12px; background: transparent; font-size: 13px; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.tab[aria-pressed="true"] { background: var(--accent-soft); }
.tab svg { width: 22px; height: 22px; stroke: var(--ink); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.topbar { display: flex; align-items: center; gap: 4px; padding: 12px 20px 0; }
.iconbtn { width: 44px; height: 44px; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; margin-left: -12px; }
.iconbtn svg { width: 22px; height: 22px; stroke: var(--ink); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; }
.input { min-height: 48px; border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 14px; background: var(--surface); width: 100%; }
.input:focus-visible, .btn:focus-visible, .pill:focus-visible, .tab:focus-visible, .row:focus-visible, .card:focus-visible, .iconbtn:focus-visible { outline: 3px solid #7CC3AA; outline-offset: 2px; }

.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; padding: 4px; background: #E8ECE9; border-radius: 12px; }
.seg button { min-height: 44px; border: 0; border-radius: 9px; background: transparent; font-size: 14px; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--surface); }

.qrbox { align-self: center; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 14px; width: 260px; height: 260px; display: flex; align-items: center; justify-content: center; }
.qrbox img { width: 100%; height: 100%; display: block; }
.codebox { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px 20px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.codebox b { font-size: 32px; letter-spacing: 0.12em; }
ol.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.5; }

.done { flex: 1 1 auto; padding: 40px 24px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; }
.done .ok-ring { width: 72px; height: 72px; border-radius: 50%; background: var(--accent-soft); display: flex; align-items: center; justify-content: center; }
.done svg { width: 36px; height: 36px; stroke: var(--accent-ink); fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.err { background: #FBE4E1; color: #8A2A1E; border-radius: 10px; padding: 10px 14px; font-size: 14px; }

/* Sohbet */
.chat-head { display: flex; align-items: center; gap: 8px; padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: var(--surface); border-bottom: 1px solid var(--line); }
.chat-head .iconbtn { margin-left: 0; }
.msgs { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 82%; padding: 8px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); border: 1px solid var(--line); align-self: flex-start; }
.bubble.me { align-self: flex-end; background: var(--accent-soft); border-color: #BFE3D1; }
.bubble small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; text-align: right; }
.composer { flex: 0 0 auto; display: flex; gap: 8px; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
.composer .input { flex: 1 1 auto; }
.composer .btn { width: auto; min-height: 48px; padding: 0 18px; }

.notif { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.btnrow { display: flex; gap: 8px; flex-wrap: wrap; }
.btnrow .btn { align-self: auto; }
.notif .btn.secondary { align-self: flex-start; }

.login { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; gap: 20px; padding: 24px; }
