/* ==========================================================================
   Kafe Yönetim Sistemi — Tasarım Sistemi
   Apple / iOS 17 esintili: sade, ferah, yumuşak. Light + Dark.
   ========================================================================== */

:root {
  color-scheme: light;

  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "Inter", system-ui, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  /* Yüzeyler */
  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --card: #ffffff;
  --card-2: #fbfbfd;
  --sidebar: rgba(250, 250, 252, 0.82);
  --header: rgba(245, 245, 247, 0.72);
  --overlay: rgba(0, 0, 0, 0.28);
  --fill: rgba(120, 120, 128, 0.10);
  --fill-strong: rgba(120, 120, 128, 0.16);

  /* Metin */
  --text: #1d1d1f;
  --text-2: #55555a;
  --text-3: #86868b;
  --text-inv: #ffffff;

  /* Çizgiler */
  --line: rgba(0, 0, 0, 0.09);
  --line-strong: rgba(0, 0, 0, 0.16);

  /* Aksan renkleri (iOS sistem renkleri) */
  --blue: #0071e3;
  --blue-soft: rgba(0, 113, 227, 0.12);
  --green: #34a853;
  --green-soft: rgba(52, 168, 83, 0.13);
  --orange: #f08c00;
  --orange-soft: rgba(240, 140, 0, 0.14);
  --red: #e02f2f;
  --red-soft: rgba(224, 47, 47, 0.12);
  --purple: #8250df;
  --purple-soft: rgba(130, 80, 223, 0.12);
  --teal: #0a9396;
  --teal-soft: rgba(10, 147, 150, 0.13);

  --accent: var(--blue);

  /* Ölçüler */
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-full: 999px;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.03);
  --shadow-2: 0 4px 16px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-3: 0 18px 48px rgba(0, 0, 0, 0.18), 0 4px 12px rgba(0, 0, 0, 0.08);

  --sidebar-w: 266px;
  --ease: cubic-bezier(0.32, 0.72, 0, 1);
}

html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --card: #1c1c1e;
  --card-2: #232326;
  --sidebar: rgba(22, 22, 24, 0.82);
  --header: rgba(0, 0, 0, 0.66);
  --overlay: rgba(0, 0, 0, 0.55);
  --fill: rgba(120, 120, 128, 0.20);
  --fill-strong: rgba(120, 120, 128, 0.32);

  --text: #f5f5f7;
  --text-2: #c7c7cc;
  --text-3: #8e8e93;

  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.18);

  --blue: #0a84ff;
  --blue-soft: rgba(10, 132, 255, 0.20);
  --green: #30d158;
  --green-soft: rgba(48, 209, 88, 0.18);
  --orange: #ff9f0a;
  --orange-soft: rgba(255, 159, 10, 0.18);
  --red: #ff453a;
  --red-soft: rgba(255, 69, 58, 0.18);
  --purple: #bf5af2;
  --purple-soft: rgba(191, 90, 242, 0.18);
  --teal: #64d2ff;
  --teal-soft: rgba(100, 210, 255, 0.18);

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 4px 18px rgba(0, 0, 0, 0.5);
  --shadow-3: 0 22px 56px rgba(0, 0, 0, 0.7);
}

/* --------------------------------------------------------------------- Base */
* { box-sizing: border-box; }
*::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overscroll-behavior-y: none;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.47;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.022em; }
h1 { font-size: 28px; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }
p  { margin: 0 0 10px; }
a  { color: var(--accent); text-decoration: none; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--fill-strong); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

.hidden { display: none !important; }
.spacer { flex: 1; }

/* ------------------------------------------------------------------ Giriş */
#login {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1000px 600px at 12% -10%, var(--blue-soft), transparent 60%),
    radial-gradient(900px 520px at 105% 110%, var(--orange-soft), transparent 60%),
    var(--bg);
  z-index: 100;
  overflow-y: auto;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 34px 30px 28px;
  box-shadow: var(--shadow-3);
  animation: rise .5s var(--ease) both;
}

@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }

.login-logo {
  width: 60px; height: 60px;
  border-radius: 16px;
  display: grid; place-items: center;
  margin: 0 auto 18px;
  background: linear-gradient(160deg, #3a3a3c, #1c1c1e);
  color: #fff;
  box-shadow: var(--shadow-2);
}
.login-logo svg { width: 32px; height: 32px; }

.login-card h1 { font-size: 24px; text-align: center; }
.login-card .sub { text-align: center; color: var(--text-3); font-size: 14px; margin: 6px 0 24px; }

.demo-accounts {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.demo-accounts summary {
  cursor: pointer;
  font-size: 13px;
  color: var(--text-3);
  list-style: none;
  text-align: center;
}
.demo-accounts summary::-webkit-details-marker { display: none; }
.demo-chip {
  display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left;
  padding: 9px 12px; margin-top: 8px;
  background: var(--fill); border: none; border-radius: var(--r-sm);
  font-size: 13px; color: var(--text-2);
  transition: background .15s;
}
.demo-chip:hover { background: var(--fill-strong); }
.demo-chip b { color: var(--text); font-weight: 600; }

/* ------------------------------------------------------------------ Shell */
#app { display: none; min-height: 100%; }
#app.ready { display: block; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--sidebar);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  backdrop-filter: saturate(180%) blur(22px);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 16px 12px 12px;
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 6px 8px 16px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(160deg, #3a3a3c, #1c1c1e);
  color: #fff; display: grid; place-items: center; flex: none;
}
html[data-theme="dark"] .brand-mark { background: linear-gradient(160deg, #f5f5f7, #c7c7cc); color: #000; }
html[data-theme="dark"] .login-logo { background: linear-gradient(160deg, #f5f5f7, #c7c7cc); color: #000; }
.brand-mark svg { width: 19px; height: 19px; }
.brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.02em; }
.brand-sub { font-size: 11.5px; color: var(--text-3); margin-top: -2px; }

.branch-switch {
  display: flex; gap: 3px; padding: 3px;
  background: var(--fill); border-radius: var(--r-sm);
  margin: 0 4px 14px;
}
.branch-switch button {
  flex: 1; border: none; background: transparent;
  padding: 7px 4px; border-radius: 7px;
  font-size: 11.5px; font-weight: 500; color: var(--text-2);
  transition: all .18s var(--ease);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.branch-switch button[data-br="all"] { flex: 0 0 auto; padding: 7px 10px; }
.branch-switch button.on {
  background: var(--bg-elevated); color: var(--text);
  box-shadow: var(--shadow-1); font-weight: 600;
}

.nav { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; flex: 1; }
.nav-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-3);
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: var(--r-sm);
  border: none; background: transparent; width: 100%;
  font-size: 14px; font-weight: 500; color: var(--text-2);
  text-align: left; transition: background .14s, color .14s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-item:hover { background: var(--fill); color: var(--text); }
.nav-item.on { background: var(--fill-strong); color: var(--text); font-weight: 600; }
.nav-item .badge {
  margin-left: auto; background: var(--red); color: #fff;
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: var(--r-full);
}

.nav-foot { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 8px; }
.user-chip {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px; border: none; background: transparent; border-radius: var(--r-sm);
  text-align: left; transition: background .14s;
}
.user-chip:hover { background: var(--fill); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--accent); color: #fff;
  font-size: 12.5px; font-weight: 600;
}
.user-chip .nm { font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.user-chip .rl { font-size: 11.5px; color: var(--text-3); }

/* Ana alan */
.main { margin-left: var(--sidebar-w); min-height: 100vh; padding-bottom: 40px; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 28px;
  background: var(--header);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 20px; }
.topbar .sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.view { padding: 24px 28px; max-width: 1240px; animation: fade .28s var(--ease) both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

.section { margin-bottom: 30px; }
.section-head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.section-head h2 { font-size: 17px; }
.section-head .hint { font-size: 12.5px; color: var(--text-3); }
.section-head .actions { margin-left: auto; display: flex; gap: 8px; }

/* ------------------------------------------------------------------ Butonlar */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 8px 15px; border-radius: var(--r-full);
  border: 1px solid transparent; background: var(--fill);
  color: var(--text); font-size: 13.5px; font-weight: 550;
  transition: transform .12s var(--ease), background .15s, opacity .15s;
  white-space: nowrap;
}
.btn:active { transform: scale(.965); }
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--fill-strong); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.danger:hover { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--fill); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }
.btn.icon { padding: 8px; width: 34px; height: 34px; border-radius: 50%; }
.btn.icon.sm { width: 28px; height: 28px; padding: 5px; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.block { width: 100%; }
.btn.lg { padding: 12px 20px; font-size: 15px; border-radius: var(--r-md); }

/* ------------------------------------------------------------------ Kartlar */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: 18px; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(298px, 1fr)); }

.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 16px 17px;
  box-shadow: var(--shadow-1);
  position: relative; overflow: hidden;
}
.stat .lbl { font-size: 12.5px; color: var(--text-3); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat .val { font-size: 26px; font-weight: 650; letter-spacing: -0.03em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .dlt { font-size: 12px; margin-top: 4px; color: var(--text-3); }
.stat .dlt.up { color: var(--green); }
.stat .dlt.down { color: var(--red); }
.stat .ic { position: absolute; top: 14px; right: 14px; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; }
.stat .ic svg { width: 16px; height: 16px; }

/* ------------------------------------------------------------------ Listeler */
.list { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  transition: background .13s;
}
.row:last-child { border-bottom: none; }
.row.click { cursor: pointer; }
.row.click:hover { background: var(--card-2); }
html[data-theme="dark"] .row.click:hover { background: rgba(255,255,255,.045); }
.row .t { font-size: 14.5px; font-weight: 550; }
.row .s { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.row .right { margin-left: auto; text-align: right; display: flex; align-items: center; gap: 8px; }

.empty {
  text-align: center; padding: 46px 20px; color: var(--text-3);
}
.empty svg { width: 34px; height: 34px; opacity: .4; margin-bottom: 10px; }
.empty .t { font-weight: 600; color: var(--text-2); font-size: 15px; }
.empty .s { font-size: 13px; margin-top: 4px; }

/* ------------------------------------------------------------------ Rozet */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  background: var(--fill); color: var(--text-2);
  white-space: nowrap;
}
.tag.blue   { background: var(--blue-soft); color: var(--blue); }
.tag.green  { background: var(--green-soft); color: var(--green); }
.tag.orange { background: var(--orange-soft); color: var(--orange); }
.tag.red    { background: var(--red-soft); color: var(--red); }
.tag.purple { background: var(--purple-soft); color: var(--purple); }
.tag.teal   { background: var(--teal-soft); color: var(--teal); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* ------------------------------------------------------------------ Form */
.field { margin-bottom: 14px; }
.field > label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--text-2); margin-bottom: 6px;
}
.field .help { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }

.input, .select, .textarea {
  width: 100%; padding: 10px 13px;
  background: var(--bg-elevated);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  font-size: 14.5px;
  transition: border-color .15s, box-shadow .15s;
  appearance: none;
}
html[data-theme="dark"] .input,
html[data-theme="dark"] .select,
html[data-theme="dark"] .textarea { background: #2c2c2e; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3.5px var(--blue-soft);
}
.textarea { min-height: 82px; resize: vertical; line-height: 1.5; }
.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2386868b' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 15px;
  padding-right: 34px;
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.search {
  position: relative; flex: 1; max-width: 340px;
}
.search input {
  width: 100%; padding: 8px 12px 8px 34px;
  background: var(--fill); border: 1px solid transparent;
  border-radius: var(--r-full); font-size: 13.5px;
}
.search input:focus { outline: none; background: var(--bg-elevated); border-color: var(--accent); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-3); pointer-events: none; }

.segmented {
  display: inline-flex; gap: 2px; padding: 2px;
  background: var(--fill); border-radius: var(--r-sm);
}
.segmented button {
  border: none; background: transparent; padding: 6px 14px;
  border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--text-2);
  transition: all .18s var(--ease);
}
.segmented button.on { background: var(--bg-elevated); color: var(--text); font-weight: 600; box-shadow: var(--shadow-1); }

.switch { position: relative; width: 46px; height: 28px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; }
.switch .track {
  position: absolute; inset: 0; background: var(--fill-strong);
  border-radius: var(--r-full); transition: background .22s var(--ease);
}
.switch .knob {
  position: absolute; top: 2px; left: 2px; width: 24px; height: 24px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .22s var(--ease);
}
.switch input:checked ~ .track { background: var(--green); }
.switch input:checked ~ .knob { transform: translateX(18px); }

.upload {
  display: block; border: 1.6px dashed var(--line-strong);
  border-radius: var(--r-md); padding: 22px; text-align: center;
  color: var(--text-3); font-size: 13.5px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.upload:hover { border-color: var(--accent); background: var(--blue-soft); color: var(--accent); }
.upload svg { width: 22px; height: 22px; display: block; margin: 0 auto 8px; }

.thumb {
  position: relative; border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--line); background: var(--card-2);
}
.thumb img { display: block; width: 100%; height: 130px; object-fit: cover; }
.thumb .x {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px; border-radius: 50%; border: none;
  background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center;
}
.thumb .cap { padding: 7px 9px; font-size: 11.5px; color: var(--text-3); }

/* ------------------------------------------------------------------ Modal */
.modal-bg {
  position: fixed; inset: 0; background: var(--overlay);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fade .2s ease both;
}
.modal {
  width: 100%; max-width: 560px; max-height: 88vh;
  background: var(--bg-elevated); border-radius: var(--r-xl);
  box-shadow: var(--shadow-3); display: flex; flex-direction: column;
  animation: pop .34s var(--ease) both; overflow: hidden;
}
.modal.wide { max-width: 820px; }
@keyframes pop { from { opacity: 0; transform: translateY(18px) scale(.97); } }
.modal-head {
  display: flex; align-items: center; gap: 12px;
  padding: 17px 20px; border-bottom: 1px solid var(--line); flex: none;
}
.modal-head h3 { font-size: 17px; }
.modal-head .btn.icon { margin-left: auto; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-foot {
  display: flex; gap: 9px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--line);
  background: var(--card-2); flex: none;
}
html[data-theme="dark"] .modal-foot { background: rgba(255,255,255,.03); }

/* ------------------------------------------------------------------ Toast */
#toasts {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 17px; border-radius: var(--r-full);
  background: rgba(28,28,30,.95); color: #fff; font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-3);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  animation: toastIn .34s var(--ease) both;
}
html[data-theme="dark"] .toast { background: rgba(240,240,245,.96); color: #000; }
.toast svg { width: 16px; height: 16px; }
.toast.err { background: var(--red); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px) scale(.94); } }

/* ------------------------------------------------------------------ Tablo */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-3);
  padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--card-2); }
html[data-theme="dark"] .tbl tbody tr:hover { background: rgba(255,255,255,.04); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ------------------------------------------------------------------ İlerleme */
.bar { height: 8px; border-radius: var(--r-full); background: var(--fill-strong); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: var(--r-full); background: var(--accent); transition: width .6s var(--ease); }
.bar.green > i { background: var(--green); }
.bar.orange > i { background: var(--orange); }
.bar.red > i { background: var(--red); }

.ring { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-linecap: round; }

/* ------------------------------------------------------------------ Grafik */
.chart { width: 100%; height: 210px; display: block; overflow: visible; }
.chart-x { display: flex; margin-top: 7px; font-size: 11px; color: var(--text-3); }
.chart-x span { flex: 1; text-align: center; white-space: nowrap; overflow: hidden; }
.chart-x span:first-child { text-align: left; }
.chart-x span:last-child { text-align: right; }
@media (max-width: 760px) { .chart { height: 158px; } .chart-x { font-size: 10px; } }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); margin-top: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* ------------------------------------------------------------------ Mobil */
.mobile-only { display: none; }
.tabbar { display: none; }

@media (max-width: 1000px) {
  .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
}

@media (max-width: 760px) {
  body { font-size: 15px; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .34s var(--ease);
    box-shadow: var(--shadow-3);
  }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .topbar { padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); }
  .topbar h1 { font-size: 18px; }
  .view { padding: 16px; }
  .mobile-only { display: inline-flex; }
  .g2, .g3, .g4, .g-auto { grid-template-columns: 1fr; }
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .search { max-width: none; }

  .scrim {
    position: fixed; inset: 0; background: var(--overlay); z-index: 39;
    animation: fade .2s ease both;
  }

  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    display: flex; justify-content: space-around;
    padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
    background: var(--header);
    -webkit-backdrop-filter: saturate(180%) blur(22px);
    backdrop-filter: saturate(180%) blur(22px);
    border-top: 1px solid var(--line);
  }
  .tabbar button {
    flex: 1; border: none; background: transparent;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 4px 2px; color: var(--text-3); font-size: 10.5px; font-weight: 550;
    border-radius: var(--r-sm);
  }
  .tabbar button svg { width: 22px; height: 22px; }
  .tabbar button.on { color: var(--accent); }

  .modal { max-height: 92vh; border-radius: var(--r-xl) var(--r-xl) 0 0; align-self: flex-end; }
  .modal-bg { padding: 0; align-items: flex-end; }
  @keyframes pop { from { opacity: .6; transform: translateY(100%); } }
  .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}

@media print {
  .sidebar, .tabbar, .topbar-actions, .btn { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; }
}
