/* Table Project — ortak arayüz stilleri
   Saf CSS, font yükleme yok, internetsiz çalışır.
   Görsel dil: krem zemin, mürekkep yeşili, tek aksan. */

:root {
  --bg: #F6F2EA;
  --card: #FFFFFF;
  --ink: #12211B;
  --ink-soft: #3A4A42;
  --muted: #7C7568;
  --muted-2: #9A9184;
  --line: #E8E1D5;
  --line-2: #F0EBE1;
  --chip: #F0EBE1;
  --chip-line: #E3DBCC;
  --accent: #18493A;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3EDE7;
  --dark: #12211B;
  --dark-ink: #F6F2EA;
  --dark-muted: #9FB3A8;
  --ok: #1F7A4D;
  --ok-soft: #E1F2E8;
  --warn: #9A6410;
  --warn-soft: #FBEFD6;
  --danger: #B3261E;
  --danger-soft: #FBE4E1;
  --info: #1D3A8A;
  --info-soft: #E3E8F7;
  --radius: 16px;
  --radius-s: 12px;
  --shadow: 0 1px 0 rgba(18,33,27,0.04);
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-head: Georgia, "Times New Roman", Times, serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1A15;
    --card: #182620;
    --ink: #F1EDE4;
    --ink-soft: #C8D0CB;
    --muted: #A5AFA8;
    --muted-2: #7F8A83;
    --line: #26362E;
    --line-2: #1F2E27;
    --chip: #1F2E27;
    --chip-line: #2E3F36;
    --accent: #7CC4A4;
    --accent-ink: #0F1A15;
    --accent-soft: #1D3A2E;
    --dark: #F1EDE4;
    --dark-ink: #0F1A15;
    --dark-muted: #4F6459;
    --ok: #7CC4A4;
    --ok-soft: #1B3328;
    --warn: #E5B25D;
    --warn-soft: #3A2E15;
    --danger: #F08C84;
    --danger-soft: #3D1E1B;
    --info: #9BB0EE;
    --info-soft: #1E2740;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2, h3 { margin: 0; font-family: var(--font-head); font-weight: 400; letter-spacing: -0.01em; }
h1 { font-size: 30px; line-height: 1.1; }
h2 { font-size: 22px; line-height: 1.15; }
h3 { font-size: 18px; }
p { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.strong { font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Sayfa kolonu: mobilde tam, masaüstünde ortalı 420px */
.app {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
@media (min-width: 640px) {
  body { background: color-mix(in srgb, var(--bg) 88%, var(--ink) 12%); }
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
.app--wide { max-width: 1100px; }
@media (min-width: 640px) {
  .app--wide { border: none; background: transparent; }
}

/* Üst çubuk */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar__logo {
  width: 32px; height: 32px; border-radius: 9px; background: var(--dark); color: var(--dark-ink);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-family: var(--font-head); font-size: 17px;
}
.topbar__title { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.topbar__name { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar__sub { font-size: 11px; color: var(--muted); letter-spacing: 0.02em; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--chip); border: 1px solid var(--chip-line); font-size: 12px; color: var(--muted);
  white-space: nowrap;
}
.pill strong { color: var(--ink); font-size: 14px; font-weight: 800; }

/* İçerik */
.content { flex: 1; display: flex; flex-direction: column; gap: 18px; padding: 22px 20px 28px; }
.section-head { display: flex; flex-direction: column; gap: 3px; }
.section-head .sub { font-size: 12px; color: var(--muted); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card--pad { padding: 16px 18px; }
.row { display: flex; align-items: center; gap: 12px; }
.row--between { justify-content: space-between; }
.row--baseline { align-items: baseline; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.grid-5 { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }

/* Kalem listesi */
.items { display: flex; flex-direction: column; }
.item {
  display: flex; align-items: baseline; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--line-2); min-height: 48px;
}
.item:last-child { border-bottom: none; }
.item__qty { font-size: 12px; font-weight: 700; color: var(--muted); width: 26px; flex-shrink: 0; }
.item__name { font-size: 14px; font-weight: 600; flex: 1; min-width: 0; }
.item__price { font-size: 14px; font-weight: 600; white-space: nowrap; }
.item--claimed { color: var(--muted-2); }
.item--claimed .item__name, .item--claimed .item__price { color: var(--muted-2); font-weight: 500; }
.item__note { display: block; font-size: 11px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.item--select { cursor: pointer; align-items: center; }
.item--select input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.item--select.item--claimed { cursor: not-allowed; }

/* Toplam bloğu */
.total-block {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px;
  padding: 22px 20px; border-radius: var(--radius); background: var(--dark); color: var(--dark-ink);
}
.total-block__label { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dark-muted); padding-bottom: 5px; }
.total-block__amount { font-family: var(--font-head); font-size: 36px; line-height: 1; white-space: nowrap; }
.kv { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; font-size: 13px; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; }

/* Butonlar */
.btn {
  appearance: none; -webkit-appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 18px; border-radius: 14px;
  border: 1px solid transparent; background: var(--chip); color: var(--ink);
  font-family: inherit; font-size: 15px; font-weight: 700; letter-spacing: -0.01em;
  cursor: pointer; text-decoration: none; touch-action: manipulation;
}
.btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover:not(:disabled) { filter: brightness(0.96); }
.btn--outline { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn--ghost { background: transparent; color: var(--muted); font-weight: 600; }
.btn--danger { background: var(--danger-soft); color: var(--danger); }
.btn--block { width: 100%; }
.btn--lg { min-height: 56px; font-size: 16px; }
.btn--sm { min-height: 40px; padding: 0 14px; font-size: 13px; border-radius: 10px; }
.btn--icon { width: 48px; padding: 0; }

/* Seçim kartları (radio benzeri) */
.choice {
  display: flex; flex-direction: column; gap: 0;
  border-radius: 15px; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
}
.choice__head {
  display: flex; align-items: center; gap: 13px; padding: 15px 18px; min-height: 56px; cursor: pointer;
  width: 100%; border: none; background: none; color: inherit; font: inherit; text-align: left; border-radius: 15px;
}
.choice__head:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.choice__radio {
  width: 22px; height: 22px; border-radius: 999px; border: 2px solid var(--chip-line);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.choice__radio::after { content: ""; width: 11px; height: 11px; border-radius: 999px; background: transparent; }
.choice__label { font-size: 15px; font-weight: 600; flex: 1; }
.choice__meta { font-size: 13px; color: var(--muted); white-space: nowrap; }
.choice--on { border: 2px solid var(--accent); }
.choice--on .choice__label { font-weight: 700; }
.choice--on .choice__radio { border-color: var(--accent); }
.choice--on .choice__radio::after { background: var(--accent); }
.choice--on .choice__meta { color: var(--ink); font-weight: 700; }
.choice__body { padding: 0 18px 16px 18px; border-top: 1px solid var(--line-2); padding-top: 14px; }

/* Stepper */
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--chip-line); border-radius: 12px; overflow: hidden; }
.stepper button {
  width: 48px; height: 48px; border: none; background: var(--chip); color: var(--ink); cursor: pointer;
  font-size: 22px; font-weight: 600; font-family: inherit;
}
.stepper button:disabled { opacity: 0.4; cursor: not-allowed; }
.stepper button:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.stepper__val { width: 72px; text-align: center; font-size: 14px; font-weight: 700; }

/* Numpad */
.numpad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.numpad button {
  min-height: 52px; border-radius: 12px; border: 1px solid var(--chip-line); background: var(--chip);
  color: var(--ink); font-size: 20px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.numpad button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.amount-display {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-radius: 12px; background: var(--chip); border: 1px solid var(--chip-line);
  margin-bottom: 10px;
}
.amount-display .val { font-family: var(--font-head); font-size: 28px; }
.amount-display--bad { border-color: var(--danger); }
.amount-display--bad .val { color: var(--danger); }

/* Bahşiş çipleri */
.tip-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.tip {
  position: relative; min-height: 56px; border-radius: 13px; border: 1px solid var(--chip-line); background: var(--card);
  color: var(--ink); font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; padding: 0 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
}
.tip:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tip small { font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent); }
.tip--suggested { border: 1.5px dashed var(--accent); }
.tip[aria-checked="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); border-style: solid; }
.tip[aria-checked="true"] small { color: var(--accent-ink); opacity: 0.85; }

/* Girdi */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.input {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--chip-line);
  background: var(--card); color: var(--ink); font: inherit; font-size: 16px;
}
.input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
textarea.input { min-height: 72px; resize: vertical; }
select.input { appearance: auto; }

/* Alt sabit çubuk */
.footbar {
  position: sticky; bottom: 0; z-index: 4;
  display: flex; flex-direction: column; gap: 10px; padding: 12px 20px 20px;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: max(20px, env(safe-area-inset-bottom));
}
.footbar__sum { display: flex; align-items: baseline; justify-content: space-between; }
.footbar__sum .amt { font-family: var(--font-head); font-size: 26px; }

/* Bildirimler / durum */
.notice { padding: 12px 14px; border-radius: 12px; font-size: 13px; line-height: 1.45; border: 1px solid transparent; }
.notice--info { background: var(--info-soft); color: var(--info); }
.notice--ok { background: var(--ok-soft); color: var(--ok); }
.notice--warn { background: var(--warn-soft); color: var(--warn); }
.notice--danger { background: var(--danger-soft); color: var(--danger); }
.notice--muted { background: var(--chip); color: var(--muted); border-color: var(--chip-line); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em; white-space: nowrap;
}
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--muted { background: var(--chip); color: var(--muted); }
.badge--info { background: var(--info-soft); color: var(--info); }

.spinner {
  width: 22px; height: 22px; border-radius: 999px; border: 3px solid var(--chip-line); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* Toast */
.toasts {
  position: fixed; left: 0; right: 0; bottom: 16px; z-index: 50;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px; pointer-events: none;
}
.toast {
  pointer-events: auto; max-width: 420px; width: 100%;
  background: var(--dark); color: var(--dark-ink); border-radius: 14px; padding: 12px 16px;
  font-size: 14px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  display: flex; align-items: center; gap: 10px;
}
.toast--ok { border-left: 4px solid var(--ok); }
.toast--danger { border-left: 4px solid var(--danger); }
.toast .t-sub { display: block; font-size: 12px; font-weight: 500; color: var(--dark-muted); }

/* Modal / overlay */
.overlay {
  position: fixed; inset: 0; z-index: 40; background: rgba(18,33,27,0.55);
  display: flex; align-items: flex-end; justify-content: center; padding: 0;
}
@media (min-width: 640px) { .overlay { align-items: center; padding: 20px; } }
.sheet {
  width: 100%; max-width: 420px; max-height: 92dvh; overflow: auto;
  background: var(--bg); border-radius: 20px 20px 0 0; padding: 20px 20px 24px;
  display: flex; flex-direction: column; gap: 14px;
}
@media (min-width: 640px) { .sheet { border-radius: 20px; } }
.sheet--wide { max-width: 640px; }

/* Onay ekranı */
.confirm-hero {
  display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 48px 24px 32px;
  background: var(--accent); color: var(--accent-ink); text-align: center;
}
.confirm-hero__tick {
  width: 68px; height: 68px; border-radius: 999px; background: rgba(255,255,255,0.18);
  display: flex; align-items: center; justify-content: center;
}
.confirm-hero__label { font-size: 13px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.8; }
.confirm-hero__amount { font-family: var(--font-head); font-size: 44px; line-height: 1.05; }
.confirm-hero--pending { background: var(--warn-soft); color: var(--warn); }
.confirm-hero--pending .confirm-hero__tick { background: rgba(0,0,0,0.06); }
.confirm-hero--fail { background: var(--danger-soft); color: var(--danger); }
.confirm-hero--fail .confirm-hero__tick { background: rgba(0,0,0,0.06); }
.klist { padding: 4px 16px; }
.klist .kv { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.klist .kv:last-child { border-bottom: none; }
.thumbs { display: flex; gap: 12px; justify-content: center; }
.thumbs button { width: 64px; height: 56px; font-size: 26px; border-radius: 14px; border: 1px solid var(--chip-line); background: var(--card); cursor: pointer; }
.thumbs button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.thumbs button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Personel: masa ızgarası */
.table-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .table-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 900px) { .table-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.tbl {
  min-height: 92px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 6px;
  padding: 12px; cursor: pointer; font-family: inherit; text-align: left;
}
.tbl:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.tbl__label { font-family: var(--font-head); font-size: 24px; line-height: 1; }
.tbl__state { font-size: 11px; font-weight: 700; letter-spacing: 0.02em; }
.tbl__amt { font-size: 12px; font-weight: 600; color: var(--muted); }
.tbl--empty { background: transparent; border-style: dashed; color: var(--muted); }
.tbl--open { border-color: var(--info); border-width: 2px; }
.tbl--open .tbl__state { color: var(--info); }
.tbl--partial { border-color: var(--warn); border-width: 2px; background: var(--warn-soft); }
.tbl--partial .tbl__state { color: var(--warn); }
.tbl--paid { border-color: var(--ok); border-width: 2px; background: var(--ok-soft); }
.tbl--paid .tbl__state { color: var(--ok); }
.tbl:disabled { opacity: 0.45; cursor: not-allowed; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 11px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; border: 1px solid var(--line); }
.legend .l-empty::before { border-style: dashed; }
.legend .l-open::before { border: 2px solid var(--info); }
.legend .l-partial::before { border: 2px solid var(--warn); background: var(--warn-soft); }
.legend .l-paid::before { border: 2px solid var(--ok); background: var(--ok-soft); }

/* Stat kartları */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { padding: 14px 16px; }
.stat__k { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.stat__v { font-family: var(--font-head); font-size: 26px; margin-top: 4px; line-height: 1.1; }
.stat__s { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Tablolar */
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
table.data th { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
table.data td.num, table.data th.num { text-align: right; }
table.data tr:last-child td { border-bottom: none; }
.diff-bad { color: var(--danger); font-weight: 700; }

/* Sekmeler */
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.tab {
  min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--chip-line); background: var(--card);
  color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.tab[aria-selected="true"] { background: var(--dark); color: var(--dark-ink); border-color: var(--dark); }
.tab:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Anahtar (switch) */
.switch { position: relative; width: 52px; height: 32px; border-radius: 999px; background: var(--chip-line); border: none; cursor: pointer; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 999px; background: var(--card); transition: left 0.15s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { left: 24px; }
.switch:disabled { opacity: 0.5; cursor: not-allowed; }
.switch:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Aktivasyon kartları */
.gate { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.gate:last-child { border-bottom: none; }
.gate__dot { width: 12px; height: 12px; border-radius: 999px; margin-top: 5px; flex-shrink: 0; }
.gate--pass .gate__dot { background: var(--ok); }
.gate--fail .gate__dot { background: var(--danger); }
.gate--blocked_external .gate__dot { background: var(--muted-2); }
.gate__body { flex: 1; min-width: 0; }
.gate__key { font-size: 13px; font-weight: 700; }
.gate__detail { font-size: 12px; color: var(--muted); margin-top: 1px; overflow-wrap: anywhere; }
.step-num {
  width: 30px; height: 30px; border-radius: 999px; background: var(--dark); color: var(--dark-ink);
  display: flex; align-items: center; justify-content: center; font-family: var(--font-head); font-size: 15px; flex-shrink: 0;
}
.duty { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 640px) { .duty { grid-template-columns: 1fr 1fr; } }
.duty__box { padding: 10px 12px; border-radius: 10px; background: var(--chip); font-size: 12.5px; line-height: 1.45; }
.duty__box b { display: block; font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 3px; }

.fineprint { text-align: center; font-size: 11px; line-height: 1.55; color: var(--muted-2); }
.brand-foot { padding: 4px 20px 22px; text-align: center; font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-2); }
