/* ERNASA ESNAF 360 — Arayüz stilleri (Ajan 3 – Frontend)
 * Dış bağımlılık yok, sistem yazı tipleri. Açık/koyu tema CSS değişkenleriyle.
 * Kolay Mod: html.easy  — Koyu tema: html[data-theme="koyu"] */

:root {
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "DejaVu Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "DejaVu Sans Mono", monospace;

  --bg: #f5f4ef;
  --bg-soft: #ecebe4;
  --surface: #ffffff;
  --surface-2: #f8f8f5;
  --border: #dcdad1;
  --border-strong: #b9b6aa;
  --text: #17222d;
  --text-soft: #4c5865;
  --text-mute: #5e6873;          /* ≥5:1 açık zeminde (WCAG AA) */

  --primary: #0f3a5a;          /* koyu lacivert */
  --primary-hover: #0b2d47;
  --primary-soft: #e3edf4;
  --on-primary: #ffffff;
  --accent: #08736f;           /* turkuaz — beyaz yazıyla 5,7:1 (WCAG AA) */
  --accent-hover: #065f5c;
  --accent-soft: #dcf2f0;
  --on-accent: #ffffff;

  --ok: #1f7a43;   --ok-soft: #e1f3e7;
  --warn: #9a5b00; --warn-soft: #fdf1da;
  --bad: #b3261e;  --bad-soft: #fbe5e3;
  --info: #1b5e9c; --info-soft: #e2eef9;

  --focus: #f0a500;
  --shadow-sm: 0 1px 2px rgba(15, 30, 45, .06), 0 1px 3px rgba(15, 30, 45, .06);
  --shadow: 0 4px 14px rgba(15, 30, 45, .08), 0 1px 3px rgba(15, 30, 45, .06);
  --shadow-lg: 0 18px 48px rgba(15, 30, 45, .22);

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;

  --fs: 16px;
  --tap: 44px;
  --gap: 16px;
  --sidebar-w: 264px;
  --topbar-h: 64px;
  --bottomnav-h: 68px;
  color-scheme: light;
}

html[data-theme="koyu"] {
  --bg: #0e1620;
  --bg-soft: #131e2a;
  --surface: #16222f;
  --surface-2: #1b2938;
  --border: #2a3a4b;
  --border-strong: #3d5266;
  --text: #e8eef4;
  --text-soft: #b6c3cf;
  --text-mute: #8fa0b0;

  --primary: #5fb3d9;
  --primary-hover: #7dc4e4;
  --primary-soft: #183247;
  --on-primary: #08131c;
  --accent: #3cc6bf;
  --accent-hover: #5ad6cf;
  --accent-soft: #123a3a;
  --on-accent: #06201f;

  --ok: #5fd08a;   --ok-soft: #143222;
  --warn: #f0b75a; --warn-soft: #3a2b10;
  --bad: #ff8a80;  --bad-soft: #3d1a18;
  --info: #8cc4f5; --info-soft: #14304a;
  --focus: #ffcc4d;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 4px 14px rgba(0, 0, 0, .35);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

html.easy {
  --fs: 19px;
  --tap: 56px;
  --gap: 20px;
  --sidebar-w: 300px;
  --topbar-h: 72px;
  --bottomnav-h: 78px;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--fs); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.5;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.08rem; } h4 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--primary); }
small, .small { font-size: .875rem; }
.muted { color: var(--text-mute); }
.soft { color: var(--text-soft); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hidden, [hidden] { display: none !important; }

/* ---------- Odak halkası ---------- */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 1000; padding: 12px 18px;
  background: var(--primary); color: var(--on-primary); border-radius: var(--radius-sm); text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* ---------- Düğmeler ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: var(--tap); padding: .55rem 1.1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; line-height: 1.2; cursor: pointer; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-mute); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 1.2em; height: 1.2em; flex: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
html[data-theme="koyu"] .btn-danger { color: #2a0a08; }
.btn-danger:hover { filter: brightness(1.08); background: var(--bad); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-soft); border-color: transparent; }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn-soft:hover { background: var(--primary-soft); filter: brightness(.97); border-color: transparent; }
.btn-sm { min-height: 36px; padding: .3rem .7rem; font-size: .9rem; }
html.easy .btn-sm { min-height: 48px; }
.btn-lg { min-height: calc(var(--tap) + 12px); padding: .8rem 1.4rem; font-size: 1.1rem; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: var(--tap); height: var(--tap); border-radius: 50%; border: 1px solid transparent;
  background: transparent; color: inherit; cursor: pointer; font: inherit;
}
.icon-btn:hover { background: var(--bg-soft); }
.icon-btn svg { width: 24px; height: 24px; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.btn-row.end { justify-content: flex-end; }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.field > label, .field-label { font-weight: 600; font-size: .92rem; color: var(--text-soft); }
.field .req { color: var(--bad); margin-left: 2px; }
.field .hint { font-size: .82rem; color: var(--text-mute); }
.field .err { font-size: .86rem; color: var(--bad); font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; min-height: var(--tap); padding: .55rem .8rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; line-height: 1.3;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus-visible { outline: 3px solid var(--focus); outline-offset: 0; border-color: var(--primary); }
.input[aria-invalid="true"] { border-color: var(--bad); background: var(--bad-soft); }
.input.money { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .suffix { position: absolute; right: .8rem; color: var(--text-mute); pointer-events: none; font-weight: 600; }
.input-wrap .input.money { padding-right: 2.2rem; }
.check { display: flex; align-items: center; gap: .6rem; min-height: var(--tap); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
html.easy .check input { width: 28px; height: 28px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.form-error { background: var(--bad-soft); color: var(--bad); padding: .7rem .9rem; border-radius: var(--radius-sm); font-weight: 600; }
.picker { display: flex; flex-direction: column; gap: 6px; }
.picker-row { display: flex; gap: 6px; }
.picker-row .input { flex: 1; }

/* rows (satır editörü) */
.rows-editor { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; background: var(--surface-2); }
.rows-editor .row-line { display: grid; gap: 6px; align-items: end; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.rows-editor .row-line:last-of-type { border-bottom: 0; }
.rows-editor .row-line .field > label { font-size: .78rem; }
@media (max-width: 640px) { .rows-editor .row-line { grid-template-columns: 1fr 1fr !important; } }

/* ---------- Kartlar ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 18px;
}
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-title h2, .card-title h3 { margin: 0; font-size: 1.05rem; }
.card.flush { padding: 0; overflow: hidden; }
.grid { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .grid-4 { grid-template-columns: 1fr 1fr; gap: 10px; } }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }

/* İstatistik kartı */
.stat {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.stat::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--tone, var(--primary)); }
.stat .stat-label { color: var(--text-soft); font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: 6px; }
.stat .stat-label svg { width: 18px; height: 18px; color: var(--tone, var(--primary)); }
.stat .stat-value { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; overflow-wrap: anywhere; }
.stat .stat-hint { color: var(--text-mute); font-size: .82rem; }
.stat .stat-how { align-self: flex-start; background: none; border: 0; padding: 0; color: var(--primary); font: inherit; font-size: .8rem; cursor: pointer; text-decoration: underline; min-height: 24px; }
.tone-ok { --tone: var(--ok); } .tone-warn { --tone: var(--warn); } .tone-bad { --tone: var(--bad); }
.tone-accent { --tone: var(--accent); } .tone-info { --tone: var(--info); }
@media (max-width: 420px) { .stat { padding: 12px; } .stat .stat-value { font-size: 1.2rem; } }

/* Rozetler */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--bg-soft); color: var(--text-soft); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.notice { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--info-soft); color: var(--text); border-left: 4px solid var(--info); }
.notice.warn { background: var(--warn-soft); border-color: var(--warn); }
.notice.bad { background: var(--bad-soft); border-color: var(--bad); }
.notice.ok { background: var(--ok-soft); border-color: var(--ok); }

/* ---------- Uygulama kabuğu ---------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; background: linear-gradient(to right, var(--primary) var(--sidebar-w), transparent 0); }
html[data-theme="koyu"] .shell { background: linear-gradient(to right, #0a1219 var(--sidebar-w), transparent 0); }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; background: var(--primary);
  color: #e6eff6; display: flex; flex-direction: column; z-index: 40;
}
html[data-theme="koyu"] .sidebar { background: #0a1219; border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 18px; min-height: var(--topbar-h); border-bottom: 1px solid rgba(255,255,255,.1); }
.brand svg { width: 38px; height: 38px; flex: none; }
.brand-name { font-weight: 800; letter-spacing: .02em; font-size: 1rem; line-height: 1.1; color: #fff; }
.brand-sub { font-size: .72rem; opacity: .75; letter-spacing: .08em; text-transform: uppercase; }
.nav { padding: 10px 10px 24px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { margin-top: 12px; }
.nav-group-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .1em; opacity: .62; padding: 4px 12px 6px; font-weight: 700; }
.nav-link {
  display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 8px 12px; border-radius: 10px;
  color: #dfe9f1; text-decoration: none; font-weight: 600; font-size: .95rem;
}
.nav-link svg { width: 20px; height: 20px; flex: none; opacity: .9; }
.nav-link:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link[aria-current="page"] { background: rgba(255,255,255,.16); color: #fff; box-shadow: inset 3px 0 0 #5fd6cf; }
.nav-link:focus-visible { outline-color: #ffcc4d; }
.nav-foot { padding: 12px 18px 18px; font-size: .78rem; opacity: .7; border-top: 1px solid rgba(255,255,255,.1); }
.nav-foot a { color: inherit; }
.nav-more { margin: 10px 12px 0; color: #fff; border-color: rgba(255,255,255,.3); background: transparent; }
.nav-more:hover { background: rgba(255,255,255,.08); }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px;
  min-height: var(--topbar-h); padding: 8px 20px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border);
}
.topbar .menu-btn { display: none; }
.topbar-title { min-width: 0; flex: 1; }
.topbar-title .biz { font-size: .78rem; color: var(--text-mute); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title .page { font-size: 1.12rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); min-height: var(--tap); cursor: pointer; font: inherit; color: inherit; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: .9rem; flex: none; }
.user-chip .uname { font-weight: 600; font-size: .9rem; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toggle-on { background: var(--accent-soft); color: var(--accent); }

.content { padding: 24px; width: 100%; max-width: 1400px; margin: 0 auto; flex: 1; }
.content:focus { outline: none; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-header h1 { margin: 0; }
.page-header .sub { color: var(--text-soft); margin: 4px 0 0; }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.bottom-nav { display: none; }
.scrim { display: none; }
.banner { padding: 10px 20px; background: var(--warn-soft); color: var(--text); border-bottom: 1px solid var(--border); font-weight: 600; }

@media (max-width: 899px) {
  .shell, html[data-theme="koyu"] .shell { grid-template-columns: 1fr; background: none; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); transform: translateX(-105%);
    transition: transform .22s ease; box-shadow: var(--shadow-lg); visibility: hidden;
  }
  .shell.drawer-open .sidebar { transform: none; visibility: visible; }
  .shell.drawer-open .scrim { display: block; position: fixed; inset: 0; background: rgba(5, 12, 20, .5); z-index: 35; }
  .topbar { padding: 8px 10px; }
  .topbar .menu-btn { display: inline-flex; }
  .user-chip .uname { display: none; }
  .user-chip { padding: 4px; }
  .content { padding: 14px 12px calc(var(--bottomnav-h) + 24px); }
  .hide-mobile { display: none !important; }
  .bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 14px rgba(0,0,0,.06);
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--text-soft); text-decoration: none; font: inherit; font-size: .72rem; font-weight: 700;
    background: none; border: 0; cursor: pointer; min-height: var(--tap);
  }
  .bottom-nav svg { width: 24px; height: 24px; }
  .bottom-nav [aria-current="page"] { color: var(--accent); }
  .bottom-nav .pos-tab span.pill { background: var(--accent); color: var(--on-accent); border-radius: 14px; padding: 6px 14px; display: grid; place-items: center; }
  .bottom-nav .pos-tab [aria-current] {}
  h1 { font-size: 1.35rem; }
}
@media (min-width: 900px) { .show-mobile { display: none !important; } }

/* ---------- Tablo ---------- */
.table-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.table-tools .search { flex: 1 1 220px; max-width: 420px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.dt { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.dt th, table.dt td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.dt th { background: var(--surface-2); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-soft); font-weight: 700; white-space: nowrap; position: sticky; top: 0; }
table.dt th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; min-height: 28px; }
table.dt th button:focus-visible { outline: 3px solid var(--focus); border-radius: 4px; }
table.dt tbody tr:last-child td { border-bottom: 0; }
table.dt tbody tr:hover { background: var(--surface-2); }
table.dt tbody tr.clickable { cursor: pointer; }
table.dt td.money, table.dt th.money, table.dt td.number, table.dt th.number, table.dt td.percent, table.dt th.percent { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.dt tfoot td { font-weight: 800; background: var(--surface-2); border-top: 2px solid var(--border-strong); }
table.dt .actions-cell { text-align: right; white-space: nowrap; }
table.dt .actions-cell .btn { margin-left: 4px; }
tr.row-muted td { color: var(--text-mute); text-decoration: line-through; }
.dt-count { color: var(--text-mute); font-size: .85rem; }
@media (max-width: 700px) {
  table.dt.responsive thead { display: none; }
  table.dt.responsive, table.dt.responsive tbody, table.dt.responsive tr, table.dt.responsive td { display: block; width: 100%; }
  table.dt.responsive tr { padding: 10px 12px; border-bottom: 1px solid var(--border); }
  table.dt.responsive td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  table.dt.responsive td::before { content: attr(data-label); font-weight: 600; color: var(--text-mute); text-align: left; font-size: .85rem; }
  table.dt.responsive td.actions-cell { justify-content: flex-end; padding-top: 8px; }
  table.dt.responsive td.actions-cell::before { content: none; }
  table.dt.responsive tfoot { display: block; }
  table.dt.responsive tfoot tr { display: block; }
}

/* Boş durum */
.empty { text-align: center; padding: 36px 18px; color: var(--text-soft); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty .empty-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.empty .empty-icon svg { width: 30px; height: 30px; }
.empty h3 { margin: 6px 0 0; color: var(--text); }
.empty p { margin: 0; max-width: 420px; }

/* ---------- Diyalog ---------- */
dialog.dlg {
  border: 0; padding: 0; border-radius: var(--radius-lg); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg); width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px);
}
dialog.dlg.wide { width: min(980px, calc(100vw - 24px)); }
dialog.dlg.narrow { width: min(440px, calc(100vw - 24px)); }
dialog.dlg::backdrop { background: rgba(6, 14, 22, .55); }
.dlg-inner { display: flex; flex-direction: column; max-height: calc(100dvh - 24px); }
.dlg-head { display: flex; align-items: center; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.dlg-head h2 { margin: 0; flex: 1; font-size: 1.15rem; }
.dlg-body { padding: 18px 20px; overflow-y: auto; }
.dlg-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); flex-wrap: wrap; }
@media (max-width: 640px) {
  dialog.dlg, dialog.dlg.wide { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
  .dlg-inner { height: 100dvh; max-height: 100dvh; }
  .dlg-body { flex: 1; }
  .dlg-foot { border-radius: 0; }
  .dlg-foot .btn { flex: 1; }
  dialog.dlg.narrow { height: auto; border-radius: var(--radius-lg); width: calc(100vw - 24px); margin: auto; }
  dialog.dlg.narrow .dlg-inner { height: auto; }
}

/* ---------- Toast ---------- */
.toasts { position: fixed; z-index: 2000; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg); font-weight: 600; animation: toast-in .2s ease; }
.toast svg { width: 22px; height: 22px; flex: none; }
.toast.ok { background: var(--ok); color: #fff; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.warn { background: #7a4a00; color: #fff; }
html[data-theme="koyu"] .toast.ok, html[data-theme="koyu"] .toast.bad { color: #0b1015; }
.toast .t-msg { flex: 1; }
.toast button { background: none; border: 0; color: inherit; cursor: pointer; font-size: 1.2rem; line-height: 1; padding: 0 4px; min-height: 28px; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }
@media (max-width: 899px) { .toasts { bottom: calc(var(--bottomnav-h) + 12px); left: 12px; right: 12px; max-width: none; } }

/* ---------- Grafik ---------- */
.chart { width: 100%; }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .bar { fill: var(--accent); }
.chart .bar.alt { fill: var(--primary); }
.chart .bar:hover { filter: brightness(1.1); }
.chart .axis { stroke: var(--border); }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 4; }
.chart text { fill: var(--text-mute); font-size: 12px; font-family: var(--font); }
.chart text.val { fill: var(--text); font-weight: 700; font-size: 11px; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--accent); opacity: .12; }
.chart .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }

/* ---------- Ana panel ---------- */
.hero { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.hero h1 { margin: 0; }
.hero .date { color: var(--text-soft); font-weight: 600; }
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.qa {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 10px;
  min-height: 96px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 700; text-align: left; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: transform .08s, box-shadow .15s, border-color .15s;
}
.qa:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.qa .qa-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.qa .qa-icon svg { width: 22px; height: 22px; }
.qa.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.qa.primary .qa-icon { background: rgba(255,255,255,.16); color: inherit; }
html.easy .quick-actions { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
html.easy .qa { min-height: 120px; font-size: 1.1rem; }
@media (max-width: 420px) { .quick-actions { grid-template-columns: 1fr 1fr; gap: 10px; } .qa { min-height: 84px; padding: 12px; } }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); min-height: var(--tap); }
.list li:last-child { border-bottom: 0; }
.list .l-main { min-width: 0; }
.list .l-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.list .l-sub { color: var(--text-mute); font-size: .85rem; }

/* ---------- POS ---------- */
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: var(--gap); align-items: start; }
.pos-left { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pos-search { display: flex; gap: 8px; }
.pos-search .input { font-size: 1.1rem; min-height: calc(var(--tap) + 8px); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.chip { flex: none; min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
html.easy .chip { min-height: 52px; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.p-tile {
  display: flex; flex-direction: column; justify-content: space-between; gap: 6px; min-height: 92px; padding: 12px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text);
  text-align: left; font: inherit; cursor: pointer; box-shadow: var(--shadow-sm);
}
.p-tile:hover { border-color: var(--accent); }
.p-tile .p-name { font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.p-tile .p-price { font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.p-tile .p-stock { font-size: .75rem; color: var(--text-mute); }
.p-tile.low .p-stock { color: var(--bad); font-weight: 700; }
html.easy .product-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
html.easy .p-tile { min-height: 120px; font-size: 1.05rem; }
.cart { position: sticky; top: calc(var(--topbar-h) + 12px); display: flex; flex-direction: column; max-height: calc(100dvh - var(--topbar-h) - 36px); padding: 0; overflow: hidden; }
.cart-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.cart-lines { flex: 1; overflow-y: auto; padding: 4px 16px; min-height: 120px; }
.cart-line { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.cart-line .cl-name { font-weight: 700; overflow-wrap: anywhere; }
.cart-line .cl-total { font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.cart-line .cl-ctrl { grid-column: 1 / -1; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.qty-ctrl { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.qty-ctrl button { width: 40px; height: 40px; border: 0; background: var(--surface-2); color: var(--text); font: inherit; font-size: 1.2rem; font-weight: 700; cursor: pointer; }
.qty-ctrl input { width: 64px; height: 40px; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); text-align: center; font: inherit; font-weight: 700; background: var(--surface); color: var(--text); }
html.easy .qty-ctrl button, html.easy .qty-ctrl input { height: 52px; } html.easy .qty-ctrl button { width: 52px; }
.cart-foot { padding: 14px 16px; border-top: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.sum-row { display: flex; justify-content: space-between; gap: 10px; font-variant-numeric: tabular-nums; }
.sum-row.total { font-size: 1.5rem; font-weight: 800; }
.pay-methods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pay-methods .btn { min-height: calc(var(--tap) + 10px); }
.pay-lines { display: flex; flex-direction: column; gap: 10px; }
.pay-line { display: grid; grid-template-columns: 120px 1fr auto; gap: 8px; align-items: center; }
.change-box { font-size: 1.3rem; font-weight: 800; padding: 12px; border-radius: var(--radius-sm); background: var(--ok-soft); color: var(--ok); text-align: center; }
.pos-mobile-bar { display: none; }
@media (max-width: 1100px) { .pos { grid-template-columns: minmax(0, 1fr) 340px; } }
@media (max-width: 899px) {
  .pos { grid-template-columns: 1fr; }
  .cart { position: static; max-height: none; }
  .pos-mobile-bar {
    display: flex; position: fixed; left: 0; right: 0; bottom: calc(var(--bottomnav-h) + env(safe-area-inset-bottom, 0px)); z-index: 29;
    gap: 8px; padding: 8px 10px; background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 14px rgba(0,0,0,.08);
  }
  .pos-mobile-bar .btn-ghost { flex: 1; justify-content: flex-start; font-weight: 800; }
  .screen[data-screen-id="satis"] { padding-bottom: 72px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ---------- Takvim ---------- */
.cal { display: grid; border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; background: var(--surface); }
.cal-head { position: sticky; top: 0; background: var(--surface-2); font-weight: 700; padding: 8px; text-align: center; border-bottom: 1px solid var(--border); border-left: 1px solid var(--border); font-size: .9rem; z-index: 1; }
.cal-head.today { color: var(--accent); }
.cal-time { font-size: .75rem; color: var(--text-mute); padding: 2px 6px; text-align: right; border-top: 1px solid var(--border); }
.cal-col { position: relative; border-left: 1px solid var(--border); }
.cal-slot { border-top: 1px solid var(--border); height: 48px; }
.cal-ev { position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 4px 6px; font-size: .78rem; background: var(--accent-soft); border-left: 4px solid var(--accent); color: var(--text); overflow: hidden; cursor: pointer; text-align: left; font-family: inherit; border-top: 0; border-right: 0; border-bottom: 0; }
.cal-ev.st-iptal, .cal-ev.st-gelmedi { opacity: .5; text-decoration: line-through; }
.cal-ev.st-tamam { background: var(--ok-soft); border-left-color: var(--ok); }
.cal-ev strong { display: block; }

/* ---------- Kurulum & giriş ---------- */
.onboard { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(280px, 420px) minmax(0, 1fr); }
.onboard-side { background: linear-gradient(160deg, #0f3a5a 0%, #0b5f6b 60%, #0b8a86 100%); color: #fff; padding: 40px 36px; display: flex; flex-direction: column; gap: 22px; }
.onboard-side .brand { padding: 0; border: 0; min-height: 0; }
.onboard-side .brand svg { width: 52px; height: 52px; }
.onboard-side .brand-name { font-size: 1.3rem; }
.onboard-side h2 { font-size: 1.7rem; margin-top: 18px; }
.onboard-side ul { padding-left: 1.2rem; margin: 0; opacity: .92; line-height: 1.9; }
.onboard-side .slogan { margin-top: auto; opacity: .85; font-style: italic; }
.onboard-main { padding: 40px clamp(16px, 5vw, 64px); display: flex; flex-direction: column; max-width: 900px; width: 100%; }
.steps { display: flex; gap: 6px; margin-bottom: 26px; list-style: none; padding: 0; }
.steps li { flex: 1; height: 6px; border-radius: 3px; background: var(--border); }
.steps li.done { background: var(--accent); }
.steps li.cur { background: var(--primary); }
.step-title { font-size: 1.6rem; margin-bottom: 4px; }
.step-sub { color: var(--text-soft); margin-bottom: 22px; }
.wizard-nav { display: flex; gap: 10px; margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); }
.wizard-nav .spacer { flex: 1; }
.sector-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; max-height: 46vh; overflow-y: auto; padding: 4px; }
.sector-group-title { grid-column: 1 / -1; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--text-mute); margin-top: 8px; }
.opt-card { display: flex; align-items: center; gap: 10px; min-height: var(--tap); padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.opt-card:hover { border-color: var(--accent); }
.opt-card[aria-pressed="true"], .opt-card[aria-checked="true"], .opt-card.selected { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 700; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.module-grid .check { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 12px; background: var(--surface); }
.module-grid .check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.module-grid .check .core-tag { margin-left: auto; }
@media (max-width: 860px) {
  .onboard { grid-template-columns: 1fr; }
  .onboard-side { padding: 20px; gap: 8px; }
  .onboard-side h2, .onboard-side ul, .onboard-side .slogan { display: none; }
  .onboard-main { padding: 20px 14px 40px; }
}

.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #0f3a5a 0%, #0b5f6b 60%, #0b8a86 100%); }
.login-card { width: min(440px, 100%); background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 28px; }
.login-card .brand { color: var(--text); border: 0; padding: 0 0 12px; min-height: 0; }
.login-card .brand-name { color: var(--text); }
.user-pick { display: grid; gap: 8px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0; }
.pin-dots span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--primary); }
.pin-dots span.on { background: var(--primary); }
.pinpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pinpad button { min-height: 64px; font-size: 1.5rem; font-weight: 700; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer; font-family: inherit; }
.pinpad button:hover { background: var(--bg-soft); }

/* ---------- Sekmeler ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; scrollbar-width: thin; }
.tab { flex: none; min-height: var(--tap); padding: 8px 14px; border: 0; background: none; color: var(--text-soft); font: inherit; font-weight: 700; cursor: pointer; border-bottom: 3px solid transparent; }
.tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--accent); }
.tab:hover { color: var(--text); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.kv dt { color: var(--text-mute); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

.legal { max-width: 820px; }
.legal h2 { margin-top: 1.4rem; }
.legal li { margin-bottom: .4rem; }

.barcode-label { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px; background: #fff; color: #000; border: 1px dashed #999; border-radius: 6px; }
.barcode-label svg { width: 220px; height: auto; }
.video-box { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; }
.video-box video { width: 100%; height: 100%; object-fit: cover; }
.video-box .scanline { position: absolute; left: 10%; right: 10%; top: 50%; height: 2px; background: #ff3b30; box-shadow: 0 0 8px #ff3b30; }

/* ---------- Yazdırma ---------- */
#print-root { display: none; }
@media print {
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; color: #000; background: #fff; font-size: 11pt; }
  @page { margin: 12mm; }
}
.print-doc { font-family: var(--font); color: #000; }
.print-doc h1 { font-size: 16pt; margin-bottom: 2mm; }
.print-doc table { width: 100%; border-collapse: collapse; margin: 4mm 0; }
.print-doc th, .print-doc td { border-bottom: 1px solid #bbb; padding: 4px 6px; text-align: left; font-size: 10pt; }
.print-doc th { border-bottom: 2px solid #000; }
.print-doc td.r, .print-doc th.r { text-align: right; }
.print-doc .foot-note { margin-top: 6mm; font-size: 9pt; color: #333; border-top: 1px solid #999; padding-top: 2mm; }
.print-doc.receipt { width: 72mm; font-size: 10pt; }
.print-doc.receipt h1 { font-size: 13pt; text-align: center; }
.print-doc.receipt .c { text-align: center; }
