@font-face { font-family: 'Plex Arabic'; font-weight: 400; font-display: swap; src: url('/vendor/fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Plex Arabic'; font-weight: 500; font-display: swap; src: url('/vendor/fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Plex Arabic'; font-weight: 700; font-display: swap; src: url('/vendor/fonts/ibm-plex-sans-arabic-arabic-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Plex Arabic'; font-weight: 400; font-display: swap; src: url('/vendor/fonts/ibm-plex-sans-arabic-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Plex Arabic'; font-weight: 700; font-display: swap; src: url('/vendor/fonts/ibm-plex-sans-arabic-latin-700-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }

:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7f6; --card: #ffffff; --card-2: #f8fbfa; --input: #ffffff; --th: #f2f6f5;
  --ink: #1d2826; --ink-2: #4b5a57; --ink-3: #7c8a87; --line: #e1e8e6; --line-2: #cddbd7;
  --brand: #054239; --brand-2: #126E70; --brand-50: #eef6f4; --brand-100: #dfeeea; --on-brand: #fff;
  --gold: #988561; --gold-300: #C9A94B; --gold-100: #f5efe2; --gold-ink: #7a6640;
  --danger: #b3261e; --danger-50: #fdecea; --ok: #1e7a4c; --ok-50: #e3f3ea; --warn: #8a5a00; --warn-50: #fff4dc;
  --topbar: #054239; --topbar-ink: #d4e4e0; --overlay: rgba(3,44,38,.45);
  --shadow: 0 1px 2px rgba(5,66,57,.05), 0 4px 16px rgba(5,66,57,.06); --shadow-lg: 0 10px 30px rgba(5,66,57,.14);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c1513; --card: #131f1c; --card-2: #172521; --input: #0f1a17; --th: #1a2925;
  --ink: #e3ebe8; --ink-2: #b2c1bd; --ink-3: #7f918c; --line: #23332f; --line-2: #2f453f;
  --brand: #1a7d72; --brand-2: #3fb3a6; --brand-50: #172a26; --brand-100: #1d3832; --on-brand: #fff;
  --gold: #c9a94b; --gold-300: #d9bc62; --gold-100: #2f2a1b; --gold-ink: #e2c97f;
  --danger: #ff8a80; --danger-50: #3a1e1c; --ok: #6fd3a0; --ok-50: #173326; --warn: #f0c060; --warn-50: #33291a;
  --topbar: #08110f; --topbar-ink: #a9bdb8; --overlay: rgba(0,0,0,.6);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25); --shadow-lg: 0 10px 30px rgba(0,0,0,.45);
}
:root { --radius: 12px; --font: 'Plex Arabic', 'Segoe UI', Tahoma, sans-serif; --pad: 18px; --gap: 14px; }
[data-density="compact"] { --pad: 12px; --gap: 10px; }
[data-density="compact"] body { font-size: 13.5px; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 14.5px; line-height: 1.6; transition: background .2s, color .2s; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand-2); text-decoration: none; }
.boot { display: grid; place-items: center; height: 100vh; color: var(--ink-3); }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card); padding: 7px 14px; border-radius: 9px; cursor: pointer; font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s; text-decoration: none; color: var(--ink); }
.btn:hover { background: var(--brand-50); border-color: var(--line-2); }
.btn:focus-visible, .input:focus-visible, select:focus-visible, .seg button:focus-visible { outline: 2px solid var(--gold-300); outline-offset: 1px; }
.btn.primary { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.gold { background: var(--gold); color: #fff; border-color: var(--gold); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-50); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--brand-50); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.icon { padding: 6px; width: 32px; height: 32px; justify-content: center; }
.btn.on { color: var(--gold); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.input, select.input, textarea.input { width: 100%; border: 1px solid var(--line); background: var(--input); border-radius: 9px; padding: 8px 11px; }
textarea.input { resize: vertical; min-height: 70px; }
textarea.code, input.code { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 13px; direction: ltr; text-align: left; }
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13px; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13.5px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; background: var(--card-2); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: 7px; cursor: pointer; color: var(--ink-2); font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.seg button.active { background: var(--card); color: var(--brand-2); box-shadow: var(--shadow); }
details.adv > summary { cursor: pointer; color: var(--brand-2); font-weight: 500; margin: 6px 0 10px; }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-hero { background: linear-gradient(160deg, #054239, #032c26); color: #fff; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-hero::after { content: ''; position: absolute; inset: auto -120px -120px auto; width: 420px; height: 420px; border-radius: 50%; border: 1px solid rgba(201,169,75,.25); box-shadow: 0 0 0 60px rgba(201,169,75,.05), 0 0 0 120px rgba(201,169,75,.04); }
.auth-hero .wordmark { font-size: 46px; font-weight: 700; letter-spacing: -.5px; line-height: 1.1; direction: ltr; display: inline-block; }
.auth-hero .wordmark span { color: #C9A94B; }
.auth-hero h2 { font-size: 22px; font-weight: 500; margin: 6px 0 12px; color: #e7f0ed; }
.auth-hero p { color: #c8dbd6; max-width: 460px; }
.auth-hero .feat { display: grid; gap: 10px; margin-top: 26px; }
.auth-hero .feat div { display: flex; gap: 10px; align-items: center; color: #e7f0ed; }
.auth-hero .feat i { width: 8px; height: 8px; border-radius: 50%; background: #C9A94B; display: inline-block; flex: none; }
.auth-form { display: grid; place-items: center; padding: 40px; position: relative; }
.auth-form .corner { position: absolute; top: 18px; inset-inline-end: 18px; display: flex; gap: 6px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { margin: 0 0 4px; font-size: 24px; }
.err { background: var(--danger-50); color: var(--danger); padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; font-size: 13.5px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: inherit; }
.brand img { width: 36px; height: 36px; }
.brand .wm { font-size: 19px; letter-spacing: -.2px; direction: ltr; }
.brand .wm span { color: #C9A94B; }
.brand small { display: block; font-weight: 400; font-size: 11.5px; opacity: .75; }

/* ---------- Shell ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--topbar); color: #fff; height: 58px; display: flex; align-items: center; padding: 0 20px; gap: 18px; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.topbar nav { display: flex; gap: 2px; }
.topbar nav a { color: var(--topbar-ink); padding: 7px 11px; border-radius: 8px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.topbar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.topbar nav a.active { background: rgba(255,255,255,.13); color: #fff; box-shadow: inset 0 -2px 0 #C9A94B; }
.topbar .spacer { flex: 1; }
.topbar .tb-btn { background: rgba(255,255,255,.08); border: 0; color: #fff; width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: grid; place-items: center; }
.topbar .tb-btn:hover { background: rgba(255,255,255,.16); }
.topbar .lang-btn { width: auto; padding: 0 12px; border-radius: 17px; font-size: 13px; font-weight: 700; }
.usermenu { position: relative; }
.usermenu > button { background: rgba(255,255,255,.1); border: 0; color: #fff; padding: 5px 12px 5px 6px; border-radius: 20px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.dropdown { position: absolute; inset-inline-end: 0; top: calc(100% + 6px); background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 200px; padding: 6px; z-index: 50; }
.dropdown button, .dropdown a { display: flex; gap: 8px; align-items: center; width: 100%; text-align: start; padding: 8px 10px; border: 0; background: none; border-radius: 7px; cursor: pointer; color: var(--ink); }
.dropdown button:hover, .dropdown a:hover { background: var(--brand-50); }
.dropdown hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.page { max-width: 1480px; margin: 0 auto; padding: 24px 24px 60px; }
.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; margin: 0; }
.page-head .sub { color: var(--ink-3); margin-top: 2px; max-width: 760px; }
.crumbs { font-size: 13px; color: var(--ink-3); margin-bottom: 4px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: var(--pad); }
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty h3 { color: var(--ink); margin: 12px 0 6px; }
.empty > svg { color: var(--brand-2); opacity: .8; }

/* ---------- Home ---------- */
.home-hero { display: flex; gap: 16px; align-items: center; padding: 22px 24px; margin-bottom: 16px; background: linear-gradient(120deg, var(--brand-50), var(--card) 70%); position: relative; overflow: hidden; }
.home-hero h1 { margin: 0; font-size: 24px; }
.home-hero > * { position: relative; z-index: 1; }
.home-hero .pulse-deco { position: absolute; inset-inline-end: 180px; top: 50%; transform: translateY(-50%); width: 260px; line-height: 0; opacity: .12; color: var(--brand-2); pointer-events: none; z-index: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { padding: 14px 16px; display: flex; gap: 12px; align-items: center; }
.stat .ic { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-100); color: var(--brand-2); display: grid; place-items: center; flex: none; }
.stat .v { font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.stat .l { color: var(--ink-3); font-size: 12.5px; }
.home-cols { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-top: 16px; }
.list { display: grid; }
.list-item { display: flex; gap: 10px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--ink-3); }
.dot.ok { background: var(--ok); } .dot.err { background: var(--danger); } .dot.warn { background: var(--gold); }
.section-head { display: flex; align-items: center; gap: 10px; margin: 6px 0 12px; }
.section-head h2 { font-size: 17px; margin: 0; flex: 1; }

/* ---------- Model cards ---------- */
.models { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: var(--gap); }
.model-card { padding: var(--pad); display: flex; flex-direction: column; gap: 8px; cursor: pointer; transition: transform .12s, box-shadow .12s; position: relative; overflow: hidden; }
.model-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--brand-2), var(--gold-300)); }
.model-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.model-card h3 { margin: 0; font-size: 16.5px; }
.model-card .desc { color: var(--ink-2); font-size: 13.5px; min-height: 22px; }
.model-card .meta { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-3); flex-wrap: wrap; }
.model-card .acts { display: flex; gap: 6px; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--line); }
.model-card.new { border: 2px dashed var(--line-2); box-shadow: none; background: var(--brand-50); align-items: center; justify-content: center; color: var(--brand-2); font-weight: 700; min-height: 160px; }
.model-card.new::before { display: none; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { background: none; border: 0; padding: 10px 16px; cursor: pointer; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.active { color: var(--brand-2); border-bottom-color: var(--gold); }
.badge { background: var(--brand-100); color: var(--brand-2); border-radius: 10px; padding: 0 7px; font-size: 12px; margin-inline-start: 4px; }

/* ---------- Data tab ---------- */
.import-row { display: grid; grid-template-columns: 2fr 1fr; gap: var(--gap); }
.dropzone { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 26px; text-align: center; background: var(--card-2); cursor: pointer; transition: background .15s, border-color .15s; }
.dropzone.over { background: var(--brand-50); border-color: var(--brand-2); }
.dropzone strong { color: var(--brand-2); }
.api-tile { border: 2px solid var(--line); border-radius: var(--radius); padding: 22px; text-align: center; background: var(--card); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; transition: border-color .15s, background .15s; }
.api-tile:hover { border-color: var(--gold); background: var(--gold-100); }
.api-tile strong { color: var(--gold-ink); }
.datasets { display: grid; gap: 12px; margin-top: 16px; }
.ds { padding: 14px 16px; }
.ds-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ds-head h4 { margin: 0; font-size: 15.5px; }
.ds-icon { width: 40px; height: 40px; border-radius: 9px; background: var(--brand-100); color: var(--brand-2); display: grid; place-items: center; font-weight: 700; font-size: 11px; flex: none; }
.ds-icon.api { background: var(--gold-100); color: var(--gold-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { font-size: 12px; padding: 2px 9px; border-radius: 12px; background: var(--th); color: var(--ink-2); border: 1px solid transparent; }
.chip.number { background: var(--brand-100); color: var(--brand-2); }
.chip.date { background: var(--gold-100); color: var(--gold-ink); }
.chip b { font-weight: 700; margin-inline-end: 4px; font-size: 10.5px; opacity: .75; }
.sync-bar { display: flex; gap: 10px; align-items: center; margin-top: 10px; padding: 8px 10px; background: var(--card-2); border-radius: 8px; font-size: 12.5px; flex-wrap: wrap; }
.sync-bar select { width: auto; padding: 3px 8px; font-size: 12.5px; }

/* ---------- Tables ---------- */
.tbl-wrap { overflow: auto; max-height: 60vh; border: 1px solid var(--line); border-radius: 10px; }
table.tbl { border-collapse: collapse; width: 100%; font-size: 13px; }
table.tbl th, table.tbl td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: start; white-space: nowrap; }
table.tbl th { position: sticky; top: 0; background: var(--th); font-weight: 700; color: var(--ink-2); z-index: 1; }
table.tbl th.sortable { cursor: pointer; }
table.tbl tr:hover td { background: var(--card-2); }
table.tbl td.n { font-variant-numeric: tabular-nums; text-align: end; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; font-size: 13px; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.pill.ok { background: var(--ok-50); color: var(--ok); }
.pill.off { background: var(--th); color: var(--ink-3); }
.pill.admin { background: var(--gold-100); color: var(--gold-ink); }
.pill.warn { background: var(--warn-50); color: var(--warn); }
.pill.err { background: var(--danger-50); color: var(--danger); }

/* ---------- Sources ---------- */
.sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: var(--gap); }
.src { padding: var(--pad); display: flex; flex-direction: column; gap: 10px; }
.src-head { display: flex; gap: 12px; align-items: center; }
.src-logo { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.src-logo.erpnext { background: #e8f0fe; color: #1a5fd0; }
[data-theme="dark"] .src-logo.erpnext { background: #1b2a44; color: #8db4ff; }
.src-logo.rest { background: var(--gold-100); color: var(--gold-ink); }
.src .url { font-size: 12.5px; color: var(--ink-3); direction: ltr; text-align: start; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; unicode-bidi: plaintext; }
.src .acts { display: flex; gap: 6px; padding-top: 10px; border-top: 1px solid var(--line); margin-top: auto; flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: 1fr 1fr 32px; gap: 6px; margin-bottom: 6px; }
.kind-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.kind-pick button { border: 2px solid var(--line); background: var(--card); border-radius: 12px; padding: 14px; cursor: pointer; text-align: start; display: flex; gap: 10px; align-items: center; color: var(--ink); }
.kind-pick button.active { border-color: var(--brand-2); background: var(--brand-50); }
.preview-box { margin-top: 12px; }

/* ---------- Dashboard ---------- */
.dash-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: var(--gap); }
.w { grid-column: span 6; display: flex; flex-direction: column; min-height: 340px; position: relative; }
.w.s { grid-column: span 3; min-height: 170px; }
.w.m { grid-column: span 6; }
.w.l { grid-column: span 8; }
.w.xl { grid-column: span 12; min-height: 420px; }
.w.s.chart-tall { min-height: 300px; }
.w-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 0; }
.w-head h4 { margin: 0; font-size: 14.5px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w.s .w-head h4 { white-space: normal; line-height: 1.4; }
.w-head .handle { cursor: grab; color: var(--ink-3); padding: 2px 4px; user-select: none; letter-spacing: -2px; }
.w-head .acts { opacity: 0; transition: opacity .15s; display: flex; gap: 2px; }
.w:hover .w-head .acts, .w:focus-within .w-head .acts { opacity: 1; }
.w-head .pin-on { opacity: 1; color: var(--gold); }
.w-sub { font-size: 12px; color: var(--ink-3); padding: 0 14px; }
.w-src { font-size: 11.5px; color: var(--ink-3); padding: 0 14px; }
.w-body { flex: 1; min-height: 0; position: relative; padding: 4px 8px 8px; }
.w-body .chart { position: absolute; inset: 4px 8px 8px; }
.w.dragging { opacity: .4; }
.w.drop-target { outline: 2px dashed var(--gold); outline-offset: 2px; }
.w-err { color: var(--danger); font-size: 13px; padding: 14px; }
.kpi { height: 100%; display: flex; flex-direction: column; justify-content: center; padding: 4px 14px 12px; }
.kpi .v { font-size: 34px; font-weight: 700; color: var(--brand-2); line-height: 1.2; }
.kpi .l { color: var(--ink-3); font-size: 13px; }
.kpi .bar { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--gold-300), var(--brand-2)); width: 40px; margin-top: 10px; }
.w-table { position: absolute; inset: 4px 8px 8px; overflow: auto; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: var(--overlay); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.3); width: 100%; max-width: 480px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal.wide { max-width: 1180px; }
.modal.mid { max-width: 820px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.modal-head h3 { margin: 0; flex: 1; font-size: 17px; }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }

/* ---------- Widget editor ---------- */
.editor { display: grid; grid-template-columns: 380px 1fr; gap: 18px; align-items: start; }
.editor-form { border-inline-end: 1px solid var(--line); padding-inline-end: 18px; }
.editor-preview { display: flex; flex-direction: column; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; height: min(560px, calc(100vh - 220px)); position: sticky; top: 0; }
.editor-preview .w-body { flex: 1; min-height: 0; }
.types { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin-bottom: 14px; }
.types button { border: 1px solid var(--line); background: var(--card); border-radius: 9px; padding: 8px 2px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: var(--ink-2); }
.types button svg { color: var(--brand-2); }
.types button:hover { border-color: var(--line-2); background: var(--brand-50); }
.types button.active { border-color: var(--brand-2); background: var(--brand-50); color: var(--brand-2); box-shadow: inset 0 0 0 1px var(--brand-2); font-weight: 700; }
.section-t { font-size: 12px; font-weight: 700; color: var(--gold); letter-spacing: .3px; margin: 16px 0 8px; }
.measure { display: grid; grid-template-columns: 1fr 110px 32px; gap: 6px; margin-bottom: 6px; }
.filter { display: grid; grid-template-columns: 1fr 96px 1fr 32px; gap: 6px; margin-bottom: 6px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.three { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ---------- Settings ---------- */
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); align-items: start; }
.setting { display: flex; gap: 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.setting:last-child { border-bottom: 0; }
.setting .lbl { flex: 1; min-width: 160px; font-weight: 500; }
.setting .lbl small { display: block; color: var(--ink-3); font-weight: 400; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 200; display: grid; gap: 8px; }
.toast { background: #1d2826; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); animation: fade .2s; max-width: 440px; }
.toast.err { background: #b3261e; }
.toast.ok { background: #054239; }

.spinner { width: 22px; height: 22px; border: 3px solid var(--brand-100); border-top-color: var(--brand-2); border-radius: 50%; animation: spin .8s linear infinite; position: absolute; inset: 0; margin: auto; }
.spinner.inline { position: static; display: inline-block; width: 16px; height: 16px; border-width: 2px; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1100px) {
  .w.s { grid-column: span 6; } .w.m, .w.l { grid-column: span 12; }
  .editor, .home-cols, .settings, .import-row { grid-template-columns: 1fr; } .editor-form { border: 0; padding: 0; }
  .editor-preview { position: static; }
  .topbar nav a span { display: none; }
}
@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; } .auth-hero { display: none; }
  .w, .w.s { grid-column: span 12; } .brand small { display: none; }
  .types { grid-template-columns: repeat(4, 1fr); }
}
@media print {
  .topbar, .dash-toolbar, .tabs, .w-head .acts, .w-head .handle, .page-head .btn { display: none !important; }
  body { background: #fff; } .card { box-shadow: none; } .w { break-inside: avoid; }
}
