/* ==========================================================================
   Yönetim Paneli — evrensel admin arayüzü
   Tema: html[data-theme="light" | "dark"]   (varsayılan: light)
   Vurgu rengi: --accent değişkenini değiştirmen yeterli.
   ========================================================================== */

:root {
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --accent: #2f5bea;
  --accent-ink: #ffffff;

  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --surface-3: #eef0f3;
  --border: #e2e5ea;
  --border-strong: #cfd4db;
  --text: #15181d;
  --text-2: #545d69;
  --text-3: #858d98;

  --success: #15803d;
  --warning: #b45309;
  --danger: #dc2626;
  --info: #0369a1;

  --success-soft: #e8f6ed;
  --warning-soft: #fdf3e3;
  --danger-soft: #fdecec;
  --info-soft: #e6f2fa;
  --neutral-soft: #eef0f3;

  --accent-soft: color-mix(in srgb, var(--accent) 11%, var(--surface));
  --accent-hover: color-mix(in srgb, var(--accent) 86%, #000);
  --focus: color-mix(in srgb, var(--accent) 45%, transparent);

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .18), 0 4px 8px -4px rgba(16, 24, 40, .06);

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;

  --sidebar-w: 256px;
  --sidebar-w-mini: 72px;
  --topbar-h: 64px;
  --bottomnav-h: 64px;

  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);

  color-scheme: light;
}

html[data-theme="dark"] {
  --accent: #6d8cff;
  --accent-ink: #0b1020;

  --bg: #0e1014;
  --surface: #161920;
  --surface-2: #1b1f27;
  --surface-3: #232833;
  --border: #282d37;
  --border-strong: #363c48;
  --text: #e9ebef;
  --text-2: #a7aeb9;
  --text-3: #767e8a;

  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #38bdf8;

  --success-soft: rgba(74, 222, 128, .12);
  --warning-soft: rgba(251, 191, 36, .12);
  --danger-soft: rgba(248, 113, 113, .13);
  --info-soft: rgba(56, 189, 248, .12);
  --neutral-soft: #232833;

  --accent-hover: color-mix(in srgb, var(--accent) 85%, #fff);

  --shadow-sm: none;
  --shadow: 0 0 0 1px rgba(255, 255, 255, .02);
  --shadow-lg: 0 16px 40px -8px rgba(0, 0, 0, .6);

  color-scheme: dark;
}

html[data-density="compact"] { --topbar-h: 56px; }
html[data-density="compact"] .card-body { padding: 14px 16px; }
html[data-density="compact"] .table td,
html[data-density="compact"] .table th { padding-top: 8px; padding-bottom: 8px; }

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0; }
[hidden] { display: none !important; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ico-sm { width: 15px; height: 15px; }
.ico-lg { width: 22px; height: 22px; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 14px; border-radius: var(--r-sm); }
.skip-link:focus { top: 12px; }

/* ==========================================================================
   Layout
   ========================================================================== */
.app { min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--sidebar-w);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  transition: width .2s ease, transform .25s ease;
}
.sidebar-brand {
  height: var(--topbar-h); flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 32px; height: 32px; flex: none; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--accent); color: var(--accent-ink);
  font-weight: 750; font-size: 15px;
}
.brand-name { font-weight: 700; font-size: 15px; white-space: nowrap; }
.brand-sub { font-size: 11.5px; color: var(--text-3); white-space: nowrap; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 10px 16px; overscroll-behavior: contain; }
.nav-group + .nav-group { margin-top: 14px; }
.nav-label {
  padding: 6px 10px; font-size: 11px; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3); white-space: nowrap;
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  min-height: 40px; padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 500; white-space: nowrap;
  position: relative;
}
.nav-link:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
.nav-link.active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent);
}
.nav-text { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-count {
  min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px;
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 600;
  background: var(--surface-3); color: var(--text-2);
}
.nav-link.active .nav-count { background: var(--accent); color: var(--accent-ink); }

.sidebar-foot { border-top: 1px solid var(--border); padding: 12px; }
.storage-meter { padding: 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
.storage-meter .row { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 8px; }

/* mini (collapsed) sidebar on desktop */
html[data-sidebar="mini"] .sidebar { width: var(--sidebar-w-mini); }
html[data-sidebar="mini"] .sidebar .nav-text,
html[data-sidebar="mini"] .sidebar .nav-count,
html[data-sidebar="mini"] .sidebar .nav-label,
html[data-sidebar="mini"] .sidebar .brand-text,
html[data-sidebar="mini"] .sidebar-foot { display: none; }
html[data-sidebar="mini"] .sidebar .nav-link { justify-content: center; }
html[data-sidebar="mini"] .sidebar-brand { justify-content: center; padding: 0; }
html[data-sidebar="mini"] .main { margin-left: var(--sidebar-w-mini); }

.main { margin-left: var(--sidebar-w); min-width: 0; transition: margin-left .2s ease; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: calc(var(--topbar-h) + var(--safe-t)); padding-top: var(--safe-t);
  display: flex; align-items: center; gap: 8px;
  padding-left: 20px; padding-right: 20px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  -webkit-backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 650; font-size: 15px; display: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-search {
  position: relative; flex: 1; max-width: 420px; margin-left: 4px;
}
.top-search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.top-search input {
  width: 100%; height: 40px; padding: 0 56px 0 38px;
  border-radius: var(--r); border: 1px solid var(--border);
  background: var(--surface-2); outline: none;
}
.top-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); background: var(--surface); }
.kbd {
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--surface);
}
.top-search .kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 6px; max-height: 360px; overflow: auto;
}
.search-results a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--r-sm); color: var(--text); }
.search-results a:hover, .search-results a.hl { background: var(--surface-3); text-decoration: none; }
.search-results .muted { padding: 10px; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }

.icon-btn {
  position: relative;
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  border: 0; border-radius: var(--r); background: transparent; color: var(--text-2);
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot {
  position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--surface);
}
.theme-toggle .moon { display: none; }
html[data-theme="dark"] .theme-toggle .sun { display: none; }
html[data-theme="dark"] .theme-toggle .moon { display: block; }

.profile-btn {
  display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 8px 0 4px; margin-left: 4px;
  border: 0; background: transparent; border-radius: var(--r);
}
.profile-btn:hover { background: var(--surface-3); }
.profile-meta { text-align: left; line-height: 1.2; }
.profile-meta b { display: block; font-size: 13px; font-weight: 600; }
.profile-meta span { font-size: 12px; color: var(--text-3); }

.content {
  padding: 24px;
  padding-bottom: 40px;
  max-width: 1440px; margin: 0 auto;
}

.scrim { position: fixed; inset: 0; z-index: 35; background: rgba(10, 12, 16, .45); opacity: 0; pointer-events: none; transition: opacity .2s; }

.bottom-nav { display: none; }

/* only one visible at a time */
.only-mobile { display: none !important; }

/* ==========================================================================
   Page structure
   ========================================================================== */
.page { display: none; animation: pageIn .18s ease; }
.page.active { display: block; }
@keyframes pageIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.page-head h1 { font-size: 22px; }
.page-head p { color: var(--text-2); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-3); margin-bottom: 6px; }
.breadcrumb a { color: var(--text-3); }

.grid { display: grid; gap: 16px; }
.grid + .grid, .grid + .card, .card + .grid, .card + .card { margin-top: 16px; }
.grid > .card + .card, .grid > .grid { margin-top: 0; }
.stack > .card + .card { margin-top: 0; }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }

/* ==========================================================================
   Card
   ========================================================================== */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); min-width: 0;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.card-head h2, .card-head h3 { font-size: 15px; }
.card-head p { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.card-body { padding: 20px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-flush .card-body { padding: 0; }

/* KPI */
.kpi { padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { color: var(--text-2); font-weight: 500; font-size: 13px; }
.kpi-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text-3); }
.kpi-spark { width: 96px; height: 30px; color: var(--accent); }

.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 12.5px; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--r);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 550; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.95); background: var(--danger); }
html[data-theme="dark"] .btn-danger { color: #1a0b0b; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-soft { border-color: transparent; background: var(--accent-soft); color: var(--accent); }
.btn-soft:hover { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: var(--r-sm); }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; }
.btn-icon { width: 40px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-block { width: 100%; }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r) 0 0 var(--r); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }
.btn-group .btn.is-active { background: var(--surface-3); color: var(--text); }

/* ==========================================================================
   Badges / avatar / misc
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--neutral-soft); color: var(--text-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.accent { background: var(--accent-soft); color: var(--accent); }

.avatar {
  width: 36px; height: 36px; flex: none; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 650;
  color: #fff; background: var(--accent); text-transform: uppercase; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-lg { width: 64px; height: 64px; font-size: 22px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who-text { min-width: 0; }
.who-text b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-text span { display: block; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.thumb { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; flex: none; background: var(--surface-3); }

.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.strong { font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.divider { height: 1px; background: var(--border); margin: 16px 0; border: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row-flex { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.space-between { justify-content: space-between; }

.progress { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.progress.success > span { background: var(--success); }
.progress.warning > span { background: var(--warning); }
.progress.danger > span { background: var(--danger); }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-weight: 550; font-size: 13px; color: var(--text); }
.field .hint { font-size: 12.5px; color: var(--text-3); }
.field .error-text { font-size: 12.5px; color: var(--danger); display: none; }
.field.has-error .error-text { display: block; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger); }
.req { color: var(--danger); }

.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r);
  background: var(--surface); color: var(--text); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23858d98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:disabled, .select:disabled { background: var(--surface-3); color: var(--text-3); }
.input-sm, .select-sm { min-height: 34px; padding-top: 5px; padding-bottom: 5px; font-size: 13px; }

.input-group { display: flex; align-items: stretch; }
.input-group .addon {
  display: grid; place-items: center; padding: 0 12px;
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2);
}
.input-group .addon:first-child { border-right: 0; border-radius: var(--r) 0 0 var(--r); }
.input-group .addon:last-child { border-left: 0; border-radius: 0 var(--r) var(--r) 0; }
.input-group .input:not(:first-child) { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.input-group .input:not(:last-child) { border-top-right-radius: 0; border-bottom-right-radius: 0; }

.input-icon { position: relative; }
.input-icon .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 38px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: 1 / -1; }

.check, .radio {
  display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; line-height: 1.35; min-height: 24px;
}
.check input, .radio input {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none;
  width: 18px; height: 18px; border: 1.5px solid var(--border-strong); background: var(--surface);
  display: grid; place-items: center; cursor: pointer; transition: all .15s;
}
.check input { border-radius: 5px; }
.radio input { border-radius: 50%; }
.check input:checked, .radio input:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after {
  content: ""; width: 10px; height: 6px; border: 2px solid var(--accent-ink); border-top: 0; border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}
.check input:indeterminate { background: var(--accent); border-color: var(--accent); }
.check input:indeterminate::after { content: ""; width: 9px; height: 2px; background: var(--accent-ink); }
.radio input:checked::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-ink); }
.check input:focus-visible, .radio input:focus-visible { box-shadow: 0 0 0 3px var(--focus); outline: 0; }
.check small, .radio small { display: block; color: var(--text-3); font-size: 12.5px; margin-top: 2px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  width: 38px; height: 22px; border-radius: 99px; background: var(--border-strong); position: relative; flex: none;
  transition: background .2s;
}
.switch .track::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .2s;
}
.switch input:checked + .track { background: var(--success); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px var(--focus); }

.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: 0; padding-bottom: 0; }
.setting-row:first-child { padding-top: 0; }
.setting-row b { display: block; font-weight: 600; }
.setting-row span { color: var(--text-3); font-size: 13px; }

.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
  padding: 28px 16px; text-align: center; background: var(--surface-2); cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .ico { margin: 0 auto 10px; width: 28px; height: 28px; color: var(--accent); }
.dropzone b { display: block; }
.preview-list { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.preview-list .pv { position: relative; width: 72px; height: 72px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.preview-list .pv img { width: 100%; height: 100%; object-fit: cover; }
.preview-list .pv button { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; }

.sticky-actions {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; margin-top: 16px;
  background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(6px);
  border: 1px solid var(--border); border-radius: var(--r-lg);
}

/* ==========================================================================
   Toolbar / tabs / pills
   ========================================================================== */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.toolbar .input-icon { flex: 1; min-width: 200px; max-width: 340px; }
.toolbar .select { width: auto; min-width: 140px; }
.toolbar .spacer { flex: 1; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 10px;
  border: 0; background: none; color: var(--text-2); font-weight: 550; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab .nav-count { height: 19px; }
.tab.active .nav-count { background: var(--accent-soft); color: var(--accent); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: var(--r); }
.segmented button { height: 32px; padding: 0 12px; border: 0; border-radius: 7px; background: none; color: var(--text-2); font-weight: 550; font-size: 13px; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.bulkbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--accent-soft); border-bottom: 1px solid var(--border);
  color: var(--accent); font-weight: 600;
}

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { overflow-x: auto; position: relative; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .04em;
  padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr.selected td { background: var(--accent-soft); }
.table .col-check { width: 44px; padding-right: 0; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.th-sort { border: 0; background: none; padding: 0; display: inline-flex; align-items: center; gap: 4px; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
.th-sort:hover { color: var(--text); }
.th-sort .ico { width: 13px; height: 13px; opacity: .35; }
.th-sort[aria-sort] .ico { opacity: 1; color: var(--accent); }
.th-sort[aria-sort="descending"] .ico { transform: rotate(180deg); }

.pagination { display: flex; align-items: center; gap: 4px; }
.pagination button {
  min-width: 34px; height: 34px; padding: 0 8px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 550;
}
.pagination button:hover:not(:disabled) { background: var(--surface-3); }
.pagination button.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pagination button:disabled { opacity: .45; cursor: default; }

.empty { padding: 48px 16px; text-align: center; color: var(--text-2); }
.empty .ico { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--text-3); stroke-width: 1.5; }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* ==========================================================================
   Lists, feeds, timelines
   ========================================================================== */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }

.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 20px 32px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: 11px; top: 26px; bottom: 2px; width: 1.5px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.tl-dot {
  position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface-3); color: var(--text-2);
}
.tl-dot .ico { width: 13px; height: 13px; }
.tl-dot.success { background: var(--success-soft); color: var(--success); }
.tl-dot.danger { background: var(--danger-soft); color: var(--danger); }
.tl-dot.warning { background: var(--warning-soft); color: var(--warning); }
.tl-dot.accent { background: var(--accent-soft); color: var(--accent); }
.timeline .when { font-size: 12px; color: var(--text-3); }

.task { display: flex; align-items: center; gap: 12px; padding: 10px 20px; }
.task.done .task-text { text-decoration: line-through; color: var(--text-3); }

/* ==========================================================================
   Charts
   ========================================================================== */
.chart { width: 100%; height: 260px; color: var(--accent); }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis-text { fill: var(--text-3); font-size: 11px; font-family: var(--font); }
.chart .line { fill: none; stroke: currentColor; stroke-width: 2.25; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-2 { fill: none; stroke: var(--text-3); stroke-width: 1.75; stroke-dasharray: 4 4; }
.chart .area { fill: currentColor; opacity: .1; }
.chart .bar { fill: currentColor; }
.chart .bar-2 { fill: currentColor; opacity: .3; }
.chart .hover-dot { fill: var(--surface); stroke: currentColor; stroke-width: 2.5; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--text); color: var(--surface); font-size: 12px; padding: 7px 10px; border-radius: 8px;
  white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); box-shadow: var(--shadow-lg);
}
.chart-wrap { position: relative; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; justify-content: center; }
.donut { width: 160px; height: 160px; flex: none; position: relative; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut-center b { display: block; font-size: 22px; }
.donut-legend { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 10px; }
.donut-legend div { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.donut-legend span { flex: 1; color: var(--text-2); }

/* ==========================================================================
   Dropdowns, modal, drawer, toast, tooltip
   ========================================================================== */
.dropdown { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; min-width: 220px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 6px; display: none;
}
.menu.open { display: block; animation: pop .14s ease; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--r-sm);
  background: none; color: var(--text); text-align: left; font-size: 13.5px;
}
.menu-item:hover { background: var(--surface-3); text-decoration: none; }
.menu-item.danger { color: var(--danger); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }
.menu-head { padding: 10px 10px 8px; }

.notif-menu { width: 360px; max-width: calc(100vw - 24px); padding: 0; }
.notif-menu .menu-top { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif { display: flex; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif.unread { background: var(--accent-soft); }
.notif p { font-size: 13px; }
.notif small { color: var(--text-3); font-size: 12px; }
.notif-menu .menu-bottom { padding: 8px; text-align: center; }

.modal {
  position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; padding: 16px;
}
.modal.open { display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(10, 12, 16, .5); animation: fade .15s ease; }
.modal-dialog {
  position: relative; width: 100%; max-width: 560px; max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  animation: pop .18s ease;
}
.modal-dialog.sm { max-width: 420px; }
.modal-dialog.lg { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
@keyframes fade { from { opacity: 0; } }

.confirm-icon { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--danger-soft); color: var(--danger); margin-bottom: 14px; }

.toasts { position: fixed; z-index: 90; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; width: 360px; max-width: calc(100vw - 32px); }
.toast {
  display: flex; gap: 12px; align-items: flex-start; padding: 14px 14px 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--r); box-shadow: var(--shadow-lg); animation: toastIn .22s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.success .ico { color: var(--success); }
.toast.danger { border-left-color: var(--danger); }
.toast.danger .ico { color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.warning .ico { color: var(--warning); }
.toast .grow { flex: 1; }
.toast b { display: block; font-size: 13.5px; }
.toast p { font-size: 13px; color: var(--text-2); }
.toast.out { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--surface); font-size: 12px; font-weight: 500; padding: 5px 9px; border-radius: 6px;
  white-space: nowrap; z-index: 70; pointer-events: none;
}

.alert { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--r); border: 1px solid; }
.alert b { display: block; }
.alert p { font-size: 13px; }
.alert.info { background: var(--info-soft); border-color: color-mix(in srgb, var(--info) 30%, transparent); color: var(--info); }
.alert.success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 30%, transparent); color: var(--success); }
.alert.warning { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 30%, transparent); color: var(--warning); }
.alert.danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.alert p, .alert b { color: var(--text); }
.alert p { color: var(--text-2); }

.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 6px; height: 12px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.accordion details { border-bottom: 1px solid var(--border); }
.accordion details:last-child { border-bottom: 0; }
.accordion summary { list-style: none; cursor: pointer; padding: 16px 20px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary .ico { transition: transform .2s; color: var(--text-3); }
.accordion details[open] summary .ico { transform: rotate(180deg); }
.accordion .acc-body { padding: 0 20px 18px; color: var(--text-2); }

/* ==========================================================================
   Messages (inbox)
   ========================================================================== */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr); height: calc(100dvh - var(--topbar-h) - 160px); min-height: 480px; overflow: hidden; }
.inbox-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-height: 0; }
.inbox-list .toolbar { padding: 12px; }
.inbox-list .toolbar .input-icon { max-width: none; min-width: 0; }
.threads { overflow-y: auto; flex: 1; }
.thread { display: flex; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); cursor: pointer; width: 100%; border-left: 0; border-right: 0; border-top: 0; background: none; text-align: left; }
.thread:hover { background: var(--surface-2); }
.thread.active { background: var(--accent-soft); }
.thread .grow { flex: 1; min-width: 0; }
.thread .top { display: flex; justify-content: space-between; gap: 8px; }
.thread .top b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread .top small { color: var(--text-3); white-space: nowrap; font-size: 12px; }
.thread p { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread.unread .top b::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: 2px; }
.convo { display: flex; flex-direction: column; min-height: 0; }
.convo-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.convo-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.bubble { max-width: min(72%, 520px); padding: 10px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); font-size: 13.5px; }
.bubble small { display: block; font-size: 11px; color: var(--text-3); margin-top: 4px; }
.bubble.me { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); border-bottom-right-radius: 4px; }
.bubble.me small { color: color-mix(in srgb, var(--accent-ink) 70%, transparent); }
.bubble.them { border-bottom-left-radius: 4px; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.composer .input { flex: 1; }

/* ==========================================================================
   Files
   ========================================================================== */
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.file-card { border: 1px solid var(--border); border-radius: var(--r); padding: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; transition: border-color .15s; }
.file-card:hover { border-color: var(--border-strong); }
.file-ico { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; }
.file-ico.pdf { background: var(--danger-soft); color: var(--danger); }
.file-ico.img { background: var(--info-soft); color: var(--info); }
.file-ico.doc { background: var(--accent-soft); color: var(--accent); }
.file-ico.xls { background: var(--success-soft); color: var(--success); }
.file-ico.zip { background: var(--warning-soft); color: var(--warning); }
.file-card b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.file-card small { color: var(--text-3); font-size: 12px; }

/* ==========================================================================
   Settings layout
   ========================================================================== */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 20px; align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--topbar-h) + 24px); }
.settings-nav button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text-2); font-weight: 550; text-align: left; white-space: nowrap; }
.settings-nav button:hover { background: var(--surface-3); color: var(--text); }
.settings-nav button.active { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); border: 1px solid var(--border); }
.settings-panel { display: none; }
.settings-panel.active { display: block; }

.theme-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.theme-card { border: 1.5px solid var(--border); border-radius: var(--r); padding: 10px; cursor: pointer; background: var(--surface); text-align: left; }
.theme-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.theme-card .mini { height: 70px; border-radius: 7px; margin-bottom: 8px; display: grid; grid-template-columns: 26% 1fr; overflow: hidden; border: 1px solid var(--border); }
.theme-card .mini.l { background: #f3f4f6; }
.theme-card .mini.l i { background: #fff; border-right: 1px solid #e2e5ea; }
.theme-card .mini.d { background: #0e1014; }
.theme-card .mini.d i { background: #161920; border-right: 1px solid #282d37; }
.theme-card .mini.s { background: linear-gradient(90deg, #f3f4f6 50%, #0e1014 50%); }
.theme-card .mini.s i { background: #fff; }
.theme-card .mini u { display: block; margin: 10px; height: 10px; border-radius: 3px; background: var(--accent); width: 50%; text-decoration: none; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--border-strong); cursor: pointer; }
.swatch.active { box-shadow: 0 0 0 2.5px var(--text); }

/* roles */
.perm-table td:not(:first-child), .perm-table th:not(:first-child) { text-align: center; }
.perm-table .check { justify-content: center; }
.role-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.role-card .row-flex { justify-content: space-between; }

/* ==========================================================================
   Auth screen
   ========================================================================== */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--surface); }
.auth-side {
  position: relative; overflow: hidden; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: #111827; color: #f3f4f6;
}
.auth-side img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.auth-side::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(17,24,39,.2), rgba(17,24,39,.85)); }
.auth-side > * { position: relative; z-index: 1; }
.auth-side blockquote { margin: 0; font-size: 22px; line-height: 1.4; font-weight: 550; max-width: 480px; }
.auth-side cite { display: block; margin-top: 14px; font-style: normal; font-size: 14px; opacity: .8; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-box { width: 100%; max-width: 380px; }
.auth-box h1 { font-size: 26px; margin: 24px 0 6px; }
.auth-box .sub { color: var(--text-2); margin-bottom: 24px; }
.or { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12.5px; margin: 18px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* 404 */
.nf { text-align: center; padding: 72px 16px; }
.nf .code { font-size: 88px; font-weight: 800; letter-spacing: -.04em; color: var(--accent); line-height: 1; }

/* UI kit swatches */
.kit-section + .kit-section { margin-top: 16px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1280px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-meta { display: none; }
}

@media (max-width: 1100px) {
  .g-2-1, .g-1-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .inbox { grid-template-columns: 280px minmax(0, 1fr); }
}

/* Tablet & phone: off-canvas sidebar */
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); width: min(300px, 86vw); box-shadow: var(--shadow-lg); }
  html[data-sidebar="mini"] .sidebar { width: min(300px, 86vw); }
  html[data-sidebar="mini"] .sidebar .nav-text,
  html[data-sidebar="mini"] .sidebar .nav-count,
  html[data-sidebar="mini"] .sidebar .nav-label,
  html[data-sidebar="mini"] .sidebar .brand-text { display: revert; }
  html[data-sidebar="mini"] .sidebar-foot { display: block; }
  html[data-sidebar="mini"] .sidebar .nav-link { justify-content: flex-start; }
  html[data-sidebar="mini"] .sidebar-brand { justify-content: flex-start; padding: 0 18px; }
  .main, html[data-sidebar="mini"] .main { margin-left: 0; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .only-desktop { display: none !important; }
  .only-mobile { display: grid !important; }
  .settings { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 6px; padding-bottom: 2px; }
  .settings-nav::-webkit-scrollbar { display: none; }
}

/* Phone */
@media (max-width: 767px) {
  body { font-size: 15px; }
  .topbar { padding-left: 8px; padding-right: 8px; gap: 2px; }
  .topbar-title { display: block; flex: 1; padding-left: 4px; }
  .top-search { display: none; }
  .top-search.open { display: block; position: absolute; left: 8px; right: 8px; top: calc(var(--safe-t) + 12px); max-width: none; margin: 0; z-index: 2; }
  .topbar-spacer { display: none; }
  .content { padding: 16px 14px calc(var(--bottomnav-h) + var(--safe-b) + 24px); }

  .page-head { align-items: stretch; flex-direction: column; margin-bottom: 16px; }
  .page-head h1 { font-size: 20px; }
  .page-actions .btn { flex: 1; }

  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .g-2 { grid-template-columns: minmax(0, 1fr); }
  .grid { gap: 12px; }
  .grid + .grid, .grid + .card, .card + .grid, .card + .card { margin-top: 12px; }
  .grid > .card + .card, .stack > .card + .card { margin-top: 0; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 21px; }
  .kpi-spark { display: none; }
  .kpi-icon { width: 30px; height: 30px; }
  .kpi-label { font-size: 12.5px; }

  .card-head { padding: 14px 16px; }
  .card-body { padding: 16px; }
  .card-foot { padding: 12px 16px; }
  .chart { height: 210px; }

  .toolbar { padding: 12px; }
  .toolbar .input-icon { max-width: none; flex-basis: 100%; }
  .toolbar .select { flex: 1; min-width: 0; }
  .toolbar .spacer { display: none; }

  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .input, .select, .textarea { font-size: 16px; } /* iOS zoom önlenir */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }

  /* Responsive tables -> cards */
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { position: relative; padding: 14px 16px; border-bottom: 1px solid var(--border); }
  .table-cards tbody tr:last-child { border-bottom: 0; }
  .table-cards td { border: 0; padding: 4px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; }
  .table-cards tbody tr:hover td { background: none; }
  .table-cards tr.selected { background: var(--accent-soft); }
  .table-cards tr.selected td { background: none; }
  .table-cards td::before { content: attr(data-label); font-size: 12.5px; color: var(--text-3); font-weight: 500; text-align: left; flex: none; }
  .table-cards td.cell-main { justify-content: flex-start; text-align: left; padding: 0 44px 8px 0; }
  .table-cards td.cell-main::before, .table-cards td.col-check::before, .table-cards td.col-actions::before { display: none; }
  .table-cards td.col-check { position: absolute; top: 18px; right: 16px; width: auto; padding: 0; }
  .table-cards tr.has-check td.cell-main { padding-right: 44px; }
  .table-cards td.col-actions { width: 100%; justify-content: flex-end; padding-top: 10px; margin-top: 6px; border-top: 1px dashed var(--border); }
  .table-cards td.col-actions .btn { min-height: 36px; }

  .card-foot.pager { justify-content: center; }
  .card-foot.pager .muted { width: 100%; text-align: center; }

  .inbox { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - var(--topbar-h) - var(--bottomnav-h) - 150px); min-height: 420px; }
  .inbox .convo { display: none; }
  .inbox.show-convo .inbox-list { display: none; }
  .inbox.show-convo .convo { display: flex; }
  .bubble { max-width: 86%; }

  .theme-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .theme-card .mini { height: 52px; }
  .file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

  .modal { align-items: flex-end; padding: 0; }
  .modal-dialog, .modal-dialog.sm, .modal-dialog.lg { max-width: none; border-radius: 18px 18px 0 0; max-height: 92dvh; padding-bottom: var(--safe-b); animation: sheetUp .22s ease; }
  .modal-foot .btn { flex: 1; }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } }

  .toasts { left: 16px; right: 16px; width: auto; max-width: none; bottom: calc(var(--bottomnav-h) + var(--safe-b) + 12px); }
  .sticky-actions { bottom: calc(var(--bottomnav-h) + var(--safe-b) + 8px); padding: 10px; }
  .sticky-actions .btn { flex: 1; }

  .notif-menu { position: fixed; left: 8px; right: 8px; top: calc(var(--topbar-h) + var(--safe-t) + 4px); width: auto; max-width: none; }
  .menu { max-width: calc(100vw - 16px); }

  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--bottomnav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    border: 0; background: none; color: var(--text-3); font-size: 11px; font-weight: 550; text-decoration: none;
  }
  .bottom-nav .ico { width: 22px; height: 22px; }
  .bottom-nav .active { color: var(--accent); }

  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { display: none; }

  [data-tip]:hover::after { display: none; }
}

@media (max-width: 767px) {
  .kpi-foot { flex-wrap: wrap; }
  .kpi-foot > span { line-height: 1.35; }
}
@media (max-width: 340px) {
  .g-4 { grid-template-columns: minmax(0, 1fr); }
  .theme-cards { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media print {
  .sidebar, .topbar, .bottom-nav, .page-actions, .toasts { display: none !important; }
  .main { margin: 0 !important; }
  .card { break-inside: avoid; box-shadow: none; }
}
