/* ==========================================================================
   FaturaPay Kurumsal v6.0 — B2C Vitrin + Gişe ERP + Alt Bayi Otomasyon Sistemi
   12 Sütunlu Kurumsal Veri ve Muhasebe Arayüz Katmanı
   ========================================================================== */

:root,
:root[data-world-theme="framed-sheet"] {
  --ground: #f4f7f8;
  --surface: #ffffff;
  --raised: #eef2f4;
  --active: #e4eaed;
  --border: #dfe4e8;
  --rule: #edf0f2;
  --control: #c3c9cf;
  --text: #121417;
  --muted: #4f555c;
  --faint: #5c626a;
  --accent: #145e70;
  --accent-pale: #e3f1f5;
  --primary: #121417;
  --primary-ink: #ffffff;
  --positive: #16653e;
  --negative: #b42329;
  --warning: #854d0e;
  --pill-positive-bg: #dcfae5;
  --pill-positive-ink: #063b1c;
  --pill-negative-bg: #ffedea;
  --pill-negative-ink: #7a181b;
  --pill-warning-bg: #fef3c7;
  --pill-warning-ink: #78350f;
  --pill-neutral-bg: #e7ebee;
  --pill-neutral-ink: #25292e;
  --chart-1: #145e70;
  --chart-2: #2463a6;
  --chart-3: #94620a;
  --chart-muted: #c8cfd6;
  --chart-mark: var(--text);
  --chart-span: 0.07;
  --grid: #e6eaee;
  --axis-ink: #555b62;
  --ink: var(--text);
}

/* 2. Tema: Finansal Muhasebe */
:root[data-world-theme="achromatic-ledger"] {
  --ground: #f7f8f9;
  --surface: #ffffff;
  --raised: #f0f2f4;
  --active: #e6e8eb;
  --border: #e2e5e8;
  --rule: #eff1f3;
  --control: #c6cbd1;
  --text: #111111;
  --muted: #52555a;
  --faint: #5e6268;
  --accent: #1a56b0;
  --accent-pale: #e6effc;
  --primary: #111111;
  --primary-ink: #ffffff;
  --chart-1: #1a56b0;
  --chart-2: #4b5563;
  --chart-3: #8a5a0a;
}

/* 3. Tema: Kurumsal Fintech Yeşili */
:root[data-world-theme="wise-fintech"] {
  --ground: #eff3ed;
  --surface: #ffffff;
  --raised: #e6ece3;
  --active: #dbe4d7;
  --border: #d8e0d4;
  --rule: #ebf0e8;
  --control: #b9c4b4;
  --text: #0e140c;
  --muted: #454d42;
  --faint: #555e52;
  --accent: #166534;
  --accent-pale: #dcfce7;
  --primary: #163300;
  --primary-ink: #ffffff;
  --positive: #166534;
  --chart-1: #166534;
  --chart-2: #2f6f4e;
  --chart-3: #854d0e;
}

/* 4. Tema: Minimalist Monokrom */
:root[data-world-theme="vercel-geist"] {
  --ground: #fafafa;
  --surface: #ffffff;
  --raised: #f2f2f2;
  --active: #e8e8e8;
  --border: #e5e5e5;
  --rule: #f0f0f0;
  --control: #c7c7c7;
  --text: #171717;
  --muted: #525252;
  --faint: #616161;
  --accent: #005cc5;
  --accent-pale: #e5f0ff;
  --primary: #171717;
  --primary-ink: #ffffff;
  --chart-1: #005cc5;
  --chart-2: #404040;
  --chart-3: #8f5708;
}

/* 5. Tema: Kurumsal Gece */
:root[data-world-theme="mercury-night"] {
  --ground: #111217;
  --surface: #181a21;
  --raised: #21242e;
  --active: #282c38;
  --border: #2a2e3b;
  --rule: #222530;
  --control: #454b5e;
  --text: #f0f1f5;
  --muted: #b3b7c4;
  --faint: #989dab;
  --accent: #6699ff;
  --accent-pale: #1f2b47;
  --primary: #f0f1f5;
  --primary-ink: #111217;
  --positive: #4ade80;
  --negative: #f87171;
  --warning: #fbbf24;
  --pill-positive-bg: #142e20;
  --pill-positive-ink: #6ee7a0;
  --pill-negative-bg: #33181c;
  --pill-negative-ink: #fca5a5;
  --pill-warning-bg: #2e2412;
  --pill-warning-ink: #fcd34d;
  --pill-neutral-bg: #262a36;
  --pill-neutral-ink: #e5e7ef;
  --chart-1: #6699ff;
  --chart-2: #5eead4;
  --chart-3: #fbbf24;
  --chart-muted: #4b5162;
  --grid: #272b36;
  --axis-ink: #a3a8b8;
  --chart-span: 0.14;
}

/* 6. Tema: Obsidyen Operasyon */
:root[data-world-theme="linear-obsidian"] {
  --ground: #08090a;
  --surface: #111214;
  --raised: #1a1c1f;
  --active: #222529;
  --border: #24272c;
  --rule: #1b1d21;
  --control: #3f434c;
  --text: #f7f8f8;
  --muted: #b4b9c2;
  --faint: #959ba6;
  --accent: #38bdf8;
  --accent-pale: #132a38;
  --primary: #f7f8f8;
  --primary-ink: #08090a;
  --positive: #4ade80;
  --negative: #f87171;
  --warning: #fbbf24;
  --pill-positive-bg: #132a1c;
  --pill-positive-ink: #6ee7a0;
  --pill-negative-bg: #31171b;
  --pill-negative-ink: #fca5a5;
  --pill-warning-bg: #2c2210;
  --pill-warning-ink: #fcd34d;
  --pill-neutral-bg: #22252a;
  --pill-neutral-ink: #eceef0;
  --chart-1: #38bdf8;
  --chart-2: #94a3b8;
  --chart-3: #fbbf24;
  --chart-muted: #454952;
  --grid: #22252a;
  --axis-ink: #a1a7b3;
  --chart-span: 0.14;
}

/* 7. Tema: Karbon Veri Terminali */
:root[data-world-theme="revolut-carbon"] {
  --ground: #000000;
  --surface: #111111;
  --raised: #1c1c1c;
  --active: #242424;
  --border: #292929;
  --rule: #1c1c1c;
  --control: #474747;
  --text: #ffffff;
  --muted: #b8b8b8;
  --faint: #999999;
  --accent: #2dd4bf;
  --accent-pale: #112e2a;
  --primary: #ffffff;
  --primary-ink: #000000;
  --positive: #4ade80;
  --negative: #fb7185;
  --warning: #fbbf24;
  --pill-positive-bg: #132b1d;
  --pill-positive-ink: #6ee7a0;
  --pill-negative-bg: #32161c;
  --pill-negative-ink: #fda4af;
  --pill-warning-bg: #2b2211;
  --pill-warning-ink: #fcd34d;
  --pill-neutral-bg: #242424;
  --pill-neutral-ink: #f0f0f0;
  --chart-1: #2dd4bf;
  --chart-2: #579bf2;
  --chart-3: #fbbf24;
  --chart-muted: #4a4a4a;
  --grid: #262626;
  --axis-ink: #a6a6a6;
  --chart-span: 0.14;
}

/* 8. Tema: Telekom Kırmızı Gişe */
:root[data-world-theme="telekom-counter"] {
  --ground: #f4f4f6;
  --surface: #ffffff;
  --raised: #ededf0;
  --active: #e3e3e8;
  --border: #dedee3;
  --rule: #ededf0;
  --control: #c2c2ca;
  --text: #18191c;
  --muted: #52545c;
  --faint: #5f626b;
  --accent: #b91c1c;
  --accent-pale: #fee2e2;
  --primary: #18191c;
  --primary-ink: #ffffff;
  --chart-1: #b91c1c;
  --chart-2: #374151;
  --chart-3: #92400e;
}

/* Structural & Typographic Tokens */
:root {
  --font: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-code: "IBM Plex Mono", Consolas, monospace;
  --fs-title: 22px;
  --fs-section: 16px;
  --fs-kpi: 28px;
  --fs-body: 14px;
  --fs-small: 12px;

  --sidebar-width: 228px;
  --topbar-height: 48px;
  --sheet-inset: 8px;
  --radius-sheet: 16px;
  --radius-card: 8px;
  --radius-control: 6px;
  --pad: 24px;
  --gap: 16px;
  --card-pad: 20px;
  --control-height: 34px;
  --row-height: 46px;
  --nav-row: 34px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-press: 120ms;
  --t-hover: 150ms;
  --t-ui: 200ms;
  --chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M4.5 2.5 8 6l-3.5 3.5' fill='none' stroke='black' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Density & Shell Modifiers */
:root[data-density="compact"] {
  --pad: 18px;
  --gap: 12px;
  --card-pad: 16px;
  --row-height: 38px;
  --control-height: 30px;
  --nav-row: 30px;
}

:root[data-shell="open-plane"] {
  --sheet-inset: 0px;
  --radius-sheet: 0px;
}

/* ---------- Browser Surfaces & Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; color-scheme: light dark; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--text);
  font: 400 var(--fs-body)/20px var(--font);
  -webkit-font-smoothing: antialiased;
  caret-color: var(--accent);
}
::selection { background: var(--accent-pale); color: var(--text); }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--ground); }
::-webkit-scrollbar-thumb { background: var(--control); border-radius: 4px; }

h1, h2, h3, h4, p, figure, ul, ol, dl, dd { margin: 0; }
ul[class], ol[class] { padding: 0; list-style: none; }
img, svg, canvas { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; text-underline-offset: 3px; }
code, pre { font-family: var(--font-code); font-size: 12.5px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.num, table, .kpi-value, .money { font-variant-numeric: tabular-nums; }

/* ---------- Framed-Sheet Shell (Top Bar + Sidebar + Inset White Sheet) ---------- */
.topbar {
  height: var(--topbar-height);
  background: var(--ground);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px 0 14px;
  position: sticky;
  top: 0;
  z-index: 15;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 214px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  letter-spacing: -0.01em;
}

.brand-symbol {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--accent-pale);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 12px;
  flex: none;
  overflow: hidden;
}
.brand-symbol svg { width: 16px; height: 16px; }
.brand-symbol img { width: 100%; height: 100%; object-fit: cover; }

.topbar-center {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: center;
  max-width: 720px;
}

.cmd-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 310px;
  max-width: 100%;
  height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--t-hover) ease, color var(--t-hover) ease;
}
.cmd-trigger:hover { border-color: var(--control); color: var(--text); }
.cmd-trigger span { display: inline-flex; align-items: center; gap: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmd-trigger svg { width: 14px; height: 14px; flex: none; }
.cmd-kbd {
  font-size: 12px;
  color: var(--muted);
  background: var(--raised);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.balance-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-control);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
  line-height: 18px;
  white-space: nowrap;
}
.balance-chip .lbl { color: var(--muted); }
.balance-chip strong { font-weight: 600; color: var(--text); }

/* App body layout below 48px topbar */
.shell-body {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: calc(100svh - var(--topbar-height));
}

:root[data-shell="topnav"] .shell-body {
  grid-template-columns: minmax(0, 1fr);
}
:root[data-shell="topnav"] .sidebar {
  position: static;
  height: auto;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  padding: 6px 16px;
  gap: 4px;
}
:root[data-shell="topnav"] .sidebar .group-label,
:root[data-shell="topnav"] .sidebar-scope,
:root[data-shell="topnav"] .sidebar .bottom {
  display: none;
}
:root[data-shell="topnav"] .sheet {
  margin-left: var(--sheet-inset);
}

.sidebar {
  position: sticky;
  top: var(--topbar-height);
  height: calc(100svh - var(--topbar-height));
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px 14px;
  background: var(--ground);
  overflow-y: auto;
}

.sidebar-scope {
  padding: 10px 10px;
  margin-bottom: 6px;
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--border);
}
.sidebar-scope .branch-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-scope .branch-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.sidebar .group-label {
  margin: 16px 10px 4px;
  font-size: var(--fs-small);
  color: var(--muted);
  font-weight: 400;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  height: var(--nav-row);
  padding: 0 10px;
  border-radius: var(--radius-control);
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  color: var(--muted);
  cursor: pointer;
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease;
}
.nav-item .nav-lbl {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.nav-item .nav-lbl span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-item svg {
  width: 16px;
  height: 16px;
  flex: none;
  stroke-width: 1.5;
}
.nav-item:hover {
  background: var(--raised);
  color: var(--text);
}
.nav-item[aria-current="page"] {
  background: var(--active);
  color: var(--text);
  font-weight: 500;
}
.nav-count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--raised);
  color: var(--text);
  border: 1px solid var(--border);
  flex: none;
}

.sidebar .bottom {
  margin-top: auto;
  padding-top: 12px;
}
.api-health-box {
  padding: 10px;
  border-radius: var(--radius-card);
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
}
.api-health-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--positive);
  flex: none;
}
.status-dot.warn { background: var(--warning); }
.api-health-row {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  padding: 2px 0;
  font-variant-numeric: tabular-nums;
}

/* The Inset White Sheet (the signature move of framed-sheet) */
.sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sheet);
  margin: 0 var(--sheet-inset) var(--sheet-inset) 0;
  padding: var(--pad);
  min-width: 0;
}

/* ---------- Views & Title Row ---------- */
.app-view { display: none; }
.app-view.active { display: block; }

.title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.title-row h1 {
  font-size: var(--fs-title);
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
}
.title-row .sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  max-width: 72ch;
}
.title-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: none;
}

/* ---------- Grid & Panels ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--gap);
}
.grid + .grid,
.kpis + .grid,
.kpis + .panel,
.panel + .grid,
.panel + .panel,
.filter-cards + .panel {
  margin-top: var(--gap);
}
.col-12 { grid-column: span 12; }
.col-8  { grid-column: span 8; }
.col-7  { grid-column: span 7; }
.col-6  { grid-column: span 6; }
.col-5  { grid-column: span 5; }
.col-4  { grid-column: span 4; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: var(--card-pad);
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.panel.toned {
  background: var(--raised);
  border-color: transparent;
}
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.panel-head h2 {
  font-size: var(--fs-section);
  line-height: 1.3;
  font-weight: 600;
  color: var(--text);
}
.panel-head .meta {
  color: var(--muted);
  font-size: var(--fs-small);
}
.panel-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.card-link::after {
  content: "";
  width: 12px;
  height: 12px;
  flex: none;
  background: currentColor;
  -webkit-mask: var(--chevron) center / 12px no-repeat;
  mask: var(--chevron) center / 12px no-repeat;
}
.card-link:hover { text-decoration: underline; }

/* ---------- Divided KPI Strip (No Icons, No Sparklines, Pure Type) ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}
.kpis.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.kpi {
  padding: 16px var(--card-pad);
  min-width: 0;
}
.kpi + .kpi {
  border-left: 1px solid var(--border);
}
.kpi-label {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.kpi-value {
  margin-top: 6px;
  font-size: var(--fs-kpi);
  line-height: 1.15;
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--text);
}
.kpi-value small {
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 4px;
}
.delta {
  margin-top: 5px;
  font-size: var(--fs-small);
  color: var(--muted);
}
.delta .up { color: var(--positive); font-weight: 500; }
.delta .down { color: var(--negative); font-weight: 500; }

/* KPIs acting as Chart Series Tabs (framed-sheet overview blueprint) */
.panel-FlushKpis {
  padding: 0;
}
.panel-FlushKpis .kpis {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
}
.kpis[role="tablist"] .kpi {
  position: relative;
  cursor: pointer;
  background: transparent;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  text-align: left;
  transition: background-color var(--t-hover) ease;
}
.kpis[role="tablist"] .kpi:hover {
  background: var(--raised);
}
.kpis[role="tablist"] .kpi[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}
.kpis[role="tablist"] .kpi[aria-selected="true"] .kpi-label {
  color: var(--text);
  font-weight: 600;
}
.kpis[role="tablist"] .kpi[aria-selected="true"] .kpi-value {
  font-weight: 500;
}
.chart-body {
  padding: 18px var(--card-pad) var(--card-pad);
}
.chart-stage {
  width: 100%;
  min-height: 210px;
  position: relative;
}

/* ---------- Count Cards That Filter (framed-sheet list blueprint) ---------- */
.filter-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.filter-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 62px;
  padding: 12px 14px;
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--t-hover) ease, background-color var(--t-hover) ease;
}
.filter-card:hover { border-color: var(--control); }
.filter-card[aria-pressed="true"] {
  border: 1.5px solid var(--accent);
  background: var(--accent-pale);
}
.filter-card .fc-lbl { font-size: 13px; color: var(--muted); }
.filter-card[aria-pressed="true"] .fc-lbl { color: var(--text); font-weight: 500; }
.filter-card .fc-val { font-size: 17px; font-weight: 600; color: var(--text); margin-top: 4px; font-variant-numeric: tabular-nums; }

/* ---------- Tables & Lists (Sentence-case 12px headers, Right-aligned tabular figures) ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  height: 36px;
  padding: 0 10px;
  text-align: left;
  font-weight: 400;
  font-size: var(--fs-small);
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--rule);
  vertical-align: middle;
  font-size: 13.5px;
}
tbody tr:last-child td { border-bottom: 0; }
th.n, td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .cell-title { font-weight: 500; color: var(--text); display: block; }
td .cell-sub { font-size: var(--fs-small); color: var(--muted); display: block; margin-top: 2px; }
.pos-num { color: var(--positive); font-weight: 500; }

/* Status Pills (Pale tint + dark same-hue ink, 4.5:1+ contrast) */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: var(--fs-small);
  font-weight: 500;
  background: var(--pill-neutral-bg);
  color: var(--pill-neutral-ink);
  white-space: nowrap;
  flex: none;
}
.pill.pos { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.neg { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill.warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }

/* ---------- Controls, Tabs, Segmented, Forms ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--control-height);
  padding: 0 13px;
  border-radius: var(--radius-control);
  border: 1px solid var(--control);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--t-hover) ease, border-color var(--t-hover) ease, transform var(--t-press) var(--ease-out);
}
.btn svg { width: 15px; height: 15px; flex: none; stroke-width: 1.6; }
.btn:hover { background: var(--raised); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--primary);
  color: var(--primary-ink);
  border-color: var(--primary);
}
.btn.primary:hover { opacity: 0.92; background: var(--primary); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.full { width: 100%; height: 38px; }

.tabs {
  display: flex;
  gap: 22px;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--gap);
  overflow-x: auto;
}
.tab-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--t-hover) ease;
}
.tab-btn svg { width: 15px; height: 15px; stroke-width: 1.5; }
.tab-btn:hover { color: var(--text); }
.tab-btn[aria-selected="true"] { color: var(--text); }
.tab-btn[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
}

.segmented {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  padding: 4px;
  border-radius: var(--radius-control);
  background: var(--raised);
}
.segmented button {
  padding: 5px 11px;
  border: 0;
  border-radius: calc(var(--radius-control) - 2px);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 18px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--t-hover) ease, color var(--t-hover) ease;
}
.segmented button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
}

.field { display: grid; gap: 6px; }
.field + .field { margin-top: 14px; }
.field label { font-size: 13px; font-weight: 500; color: var(--text); }
.field .hint { font-size: var(--fs-small); color: var(--muted); }
.input, select.input, textarea.input {
  height: 38px;
  padding: 0 11px;
  border: 1px solid var(--control);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--text);
  width: 100%;
  font-size: 14px;
  transition: border-color var(--t-hover) ease;
}
textarea.input { height: auto; padding: 9px 11px; line-height: 1.45; }
.input::placeholder, textarea.input::placeholder { color: var(--faint); }
.input:focus { border-color: var(--accent); outline: none; }
.joined-row { display: flex; gap: 8px; align-items: center; }

/* ---------- Terminal Selection Tiles (Operators, GSM Packages, Invoices) ---------- */
.srv-pane { display: none; }
.srv-pane.active { display: block; }

.op-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.op-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--t-hover) ease, background-color var(--t-hover) ease;
}
.op-tile:hover { border-color: var(--control); }
.op-tile[aria-pressed="true"] {
  border: 1.5px solid var(--accent);
  background: var(--accent-pale);
}
.op-tile-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.op-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.op-name { font-size: 13.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-rate { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }

.pkg-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 330px;
  overflow-y: auto;
  padding-right: 2px;
}
.pkg-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--t-hover) ease, background-color var(--t-hover) ease;
}
.pkg-item:hover { border-color: var(--control); }
.pkg-item[aria-pressed="true"] {
  border: 1.5px solid var(--accent);
  background: var(--accent-pale);
}
.pkg-title { font-size: 13.5px; font-weight: 500; color: var(--text); margin-top: 2px; }
.pkg-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.pkg-price { font-size: 15px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Key-Value Accounting Well (app-screens.md §7.9) */
.kv-well {
  background: var(--raised);
  border-radius: var(--radius-card);
  padding: 10px 14px;
}
.kv-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 13px;
  color: var(--muted);
}
.kv-row + .kv-row { border-top: 1px solid var(--border); }
.kv-row strong { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.kv-row.total { font-size: 14px; color: var(--text); font-weight: 600; padding: 10px 0 6px; }
.kv-row.total strong { font-size: 16px; font-weight: 600; }

.invoice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  cursor: pointer;
}
.invoice-row + .invoice-row { margin-top: 8px; }
.invoice-row:hover { border-color: var(--control); }
.invoice-left { display: flex; align-items: flex-start; gap: 10px; }
.invoice-left input { margin-top: 3px; accent-color: var(--accent); width: 15px; height: 15px; }

/* Quota Progress Bar (app-screens.md §6.4: 8px rounded track, true ratio) */
.quota-track {
  width: 140px;
  height: 7px;
  border-radius: 999px;
  background: var(--raised);
  overflow: hidden;
  margin-top: 5px;
}
.quota-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

/* ---------- Storefront View (Persuade Mode inside the shared design system) ---------- */
.sf-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 32px;
  align-items: start;
  padding: 16px 0 36px;
  border-bottom: 1px solid var(--border);
}
.sf-hero h1 {
  font-size: 38px;
  line-height: 1.12;
  letter-spacing: -0.025em;
  font-weight: 600;
  color: var(--text);
  max-width: 18ch;
}
.sf-lead {
  margin-top: 18px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--muted);
  max-width: 54ch;
}
.sf-cta-row {
  margin-top: 24px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.sf-facts {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--border);
  padding-top: 18px;
  gap: 16px;
}
.sf-fact-val {
  font-size: 24px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.sf-fact-lbl {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
}
.sf-section {
  padding: 36px 0;
  border-bottom: 1px solid var(--border);
}
.sf-section:last-child { border-bottom: 0; padding-bottom: 8px; }
.sf-sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.sf-sec-head h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.015em;
}
.sf-sec-head p {
  color: var(--muted);
  font-size: 14px;
  max-width: 58ch;
}

/* ---------- Settings Two-Column Blueprint (framed-sheet settings) ---------- */
.settings-row {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.settings-row:first-child { padding-top: 4px; }
.settings-row:last-child { border-bottom: 0; }
.settings-info h2 { font-size: 15px; font-weight: 600; color: var(--text); }
.settings-info p { font-size: 13.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.settings-box {
  background: var(--raised);
  border-radius: 12px;
  padding: 18px;
}
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
}
.switch-row + .switch-row { border-top: 1px solid var(--border); }
.switch {
  appearance: none;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--control);
  position: relative;
  cursor: pointer;
  flex: none;
  transition: background-color var(--t-ui) ease;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  transition: transform var(--t-ui) var(--ease-out);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(14px); }

/* ---------- Modals, Command Palette & White-Label Theme Studio Drawer ---------- */
.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 14, 18, 0.48);
  z-index: 40;
  display: none;
  place-items: center;
  padding: 16px;
}
.backdrop.open { display: grid; }

.dialog-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
}
.dialog-card.thermal {
  max-width: 340px;
  font-family: var(--font-code);
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.dialog-head h2 { font-size: 16px; font-weight: 600; }

/* White-Label Studio Right Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 14, 18, 0.36);
  z-index: 45;
  display: none;
  justify-content: flex-end;
}
.drawer-backdrop.open { display: flex; }
.drawer-panel {
  width: 100%;
  max-width: 420px;
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.14);
}
.theme-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.theme-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 11px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--t-hover) ease, background-color var(--t-hover) ease;
}
.theme-card:hover { border-color: var(--control); }
.theme-card[aria-pressed="true"] {
  border: 1.5px solid var(--accent);
  background: var(--accent-pale);
}
.theme-swatches { display: flex; align-items: center; gap: 5px; }
.sw-dot { width: 14px; height: 14px; border-radius: 50%; border: 1px solid rgba(128,128,128,0.35); }
.theme-name { font-size: 13px; font-weight: 600; color: var(--text); }
.theme-origin { font-size: 12px; color: var(--muted); }

/* Toast Notification */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  background: var(--primary);
  color: var(--primary-ink);
  padding: 10px 14px;
  border-radius: var(--radius-control);
  font-size: 13px;
  font-weight: 500;
  max-width: 380px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity var(--t-ui) ease, transform var(--t-ui) var(--ease-out);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ---------- Responsive: Tablet & Phone (Masaüstü, Tablet ve Mobil Uyum) ---------- */
.menu-toggle { display: none; }
.mobile-close-row { display: none; }

@media (max-width: 1060px) {
  .col-8, .col-7, .col-6, .col-5, .col-4 { grid-column: span 12; }
  .sf-hero { grid-template-columns: minmax(0, 1fr); }
  .settings-row { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .cmd-trigger { width: 200px; }
}

@media (max-width: 860px) {
  .menu-toggle { display: inline-flex; }
  .topbar-left { min-width: 0; }
  .cmd-trigger { display: none; }
  .balance-chip .lbl { display: none; }
  .shell-body { grid-template-columns: minmax(0, 1fr); }

  /* Sidebar folds completely off-canvas into a full-screen sheet */
  .sidebar {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    background: var(--surface);
    padding: 16px;
    transform: translateX(-100%);
    transition: transform var(--t-ui) var(--ease-out);
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-close-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
  }

  /* Frame disappears on phone: sheet becomes the screen */
  .sheet {
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    padding: 16px;
  }

  .kpis, .kpis.cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi + .kpi { border-left: 0; }
  .kpi:nth-child(2n) { border-left: 1px solid var(--border); }
  .kpi:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .kpi:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .kpis[role="tablist"] .kpi[aria-selected="true"] { background: var(--active); }
  .kpis[role="tablist"] .kpi[aria-selected="true"]::after { content: none; }

  .filter-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .op-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pkg-grid { grid-template-columns: minmax(0, 1fr); }
  .sf-hero h1 { font-size: 28px; }
  .sf-facts { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .title-row { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 640px) {
  :root {
    --fs-kpi: 20px;
    --card-pad: 14px;
  }
  .topbar { padding: 0 16px; gap: 6px; }
  .brand-lockup .js-brand-name { display: none; }
  .topbar-center .segmented { padding: 3px; }
  .topbar-center .segmented button { padding: 4px 8px; font-size: 12px; }
  .balance-chip { display: none; }
  .studio-btn-lbl { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}
