/* Boofi Cloud — Daftar design language.
   Every colour is a light/dark pair. Tints are alpha over the surface, never
   fixed pastels; colour marks meaning only (state, direction, kind). */

@font-face { font-family: "IRANSansX"; src: url("/fonts/IRANSansXFaNum-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IRANSansX"; src: url("/fonts/IRANSansXFaNum-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "IRANSansXFigure"; src: url("/fonts/IRANSansXFaNum-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --bg: #f5f4f8;
  --surface: #ffffff;
  --raised: #efedf4;        /* surfaceContainerHighest */
  --zebra: rgba(96, 78, 148, .025);
  --ink: #1c1b1f;
  --muted: #616161;
  --faint: #8d8a94;
  --line: rgba(121, 116, 126, .26);
  --line-soft: rgba(121, 116, 126, .14);
  --accent: #604e94;        /* deepViolet */
  --on-accent: #ffffff;
  --inflow: #2e7d32;
  --outflow: #c62828;
  --warning: #e65100;
  --amber: #9e7026;
  --teal: #00796b;
  --blue: #1e6fa8;
  --rose: #b23a48;
  --shadow: 0 1px 2px rgba(28, 27, 31, .05), 0 6px 18px rgba(28, 27, 31, .05);
  --radius: 14px;
  --radius-sm: 10px;
  --speed: .16s;
  --font-ui: "IRANSansX", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-figure: "IRANSansXFigure", "IRANSansX", ui-sans-serif, system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121016; --surface: #1b1920; --raised: #26232d; --zebra: rgba(196, 184, 232, .025);
    --ink: #e7e3ee; --muted: #bdbdbd; --faint: #8c8796;
    --line: rgba(147, 143, 153, .30); --line-soft: rgba(147, 143, 153, .15);
    --accent: #c4b8e8; --on-accent: #1d1638;
    --inflow: #81c784; --outflow: #e57373; --warning: #ffb74d; --amber: #ffd54f;
    --teal: #80cbc4; --blue: #8cc4f0; --rose: #f28b96;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .28);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121016; --surface: #1b1920; --raised: #26232d; --zebra: rgba(196, 184, 232, .025);
  --ink: #e7e3ee; --muted: #bdbdbd; --faint: #8c8796;
  --line: rgba(147, 143, 153, .30); --line-soft: rgba(147, 143, 153, .15);
  --accent: #c4b8e8; --on-accent: #1d1638;
  --inflow: #81c784; --outflow: #e57373; --warning: #ffb74d; --amber: #ffd54f;
  --teal: #80cbc4; --blue: #8cc4f0; --rose: #f28b96;
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .28);
  color-scheme: dark;
}

/* English uses the system face: IRANSansX FaNum would draw Persian digits. */
:root[lang="en"] { --font-ui: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; --font-figure: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 13.5px/1.65 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
button, a, input, select, textarea, .card, .row-link, .side a, .tab {
  transition: background var(--speed), color var(--speed), border-color var(--speed), box-shadow var(--speed), opacity var(--speed);
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
.mono, code, kbd { font-family: var(--font-mono); font-size: .92em; direction: ltr; unicode-bidi: isolate; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.figure { font-family: var(--font-figure); font-weight: 700; }
.hidden { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 24px; height: 24px; }

/* --------------------------------------------------------------- shell --- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  padding: 0 20px; height: 60px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; color: var(--ink); white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent);
}
.services { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; flex: 1; }
.services::-webkit-scrollbar { display: none; }
.services a {
  display: flex; align-items: center; gap: 8px; padding: 7px 12px; border-radius: 10px;
  color: var(--muted); white-space: nowrap; position: relative;
}
.services a:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); color: var(--ink); text-decoration: none; }
.services a.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 11%, transparent); font-weight: 700; }
.services .count {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 11px; line-height: 18px; text-align: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); font-family: var(--font-figure);
}
.services .count.ok { display: inline-flex; align-items: center; gap: 4px; background: color-mix(in srgb, var(--inflow) 16%, transparent); color: var(--inflow); }
.services .count.ok i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.services .count.warn { background: color-mix(in srgb, var(--warning) 18%, transparent); color: var(--warning); }
.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--ink); }
.lang-btn { width: auto; padding: 0 10px; font-weight: 700; font-size: 12px; }

main { max-width: 1320px; margin: 0 auto; padding: 22px 20px 60px; }
.layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 22px; align-items: start; }
.side {
  position: sticky; top: 82px; background: var(--surface); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 10px; box-shadow: var(--shadow);
}
.side .side-title { padding: 6px 10px 10px; font-weight: 700; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; overflow: hidden; }
.side .side-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--muted); }
.side a:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); color: var(--ink); text-decoration: none; }
.side a.on { background: color-mix(in srgb, var(--accent) 13%, transparent); color: var(--accent); font-weight: 700; }
.side .back { font-size: 12px; margin-top: 6px; border-top: 1px solid var(--line-soft); padding-top: 12px; border-radius: 0 0 10px 10px; }

/* -------------------------------------------------------------- header --- */
.head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.tile {
  width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--tone, var(--accent)) 13%, transparent); color: var(--tone, var(--accent));
}
.tile svg.i { width: 24px; height: 24px; }
.head .titles { flex: 1; min-width: 180px; }
.head h1 { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.3; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.head p { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  display: inline-flex; flex-direction: column; align-items: center; padding: 6px 16px; border-radius: 14px;
  background: color-mix(in srgb, var(--tone, var(--accent)) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone, var(--accent)) 28%, transparent);
}
.pill small { font-size: 10.5px; color: var(--muted); }
.pill b { font-family: var(--font-figure); font-size: 21px; line-height: 1.2; color: var(--tone, var(--accent)); }

/* --------------------------------------------------------------- stats --- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat {
  display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 12px;
  background: color-mix(in srgb, var(--raised) 60%, transparent); border: 1px solid var(--line-soft);
}
.stat .chip {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--tone, var(--accent)) 14%, transparent); color: var(--tone, var(--accent));
}
.stat small { display: block; font-size: 11px; color: var(--muted); }
.stat b { font-family: var(--font-figure); font-size: 16.5px; color: var(--tone, var(--ink)); line-height: 1.35; }
.stat b .unit { font-family: var(--font-ui); font-weight: 400; font-size: 11px; color: var(--muted); margin-inline-start: 4px; }

/* --------------------------------------------------------------- cards --- */
.card {
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
}
.card.flush { padding: 0; overflow: hidden; }
.card h2 { margin: 0 0 4px; font-size: 14.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card > .sub { margin: 0 0 14px; color: var(--muted); font-size: 12.5px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.card-head h2 { margin: 0; flex: 1; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.accent-card {
  background: linear-gradient(135deg, color-mix(in srgb, var(--tone, var(--accent)) 12%, var(--surface)), var(--surface) 70%);
  border: 1px solid color-mix(in srgb, var(--tone, var(--accent)) 30%, transparent);
}

/* definition rows (like Liara's info table) */
.kv { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; border: 1px solid var(--line-soft); border-radius: 12px; overflow: hidden; }
.kv > div { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); min-width: 0; overflow-wrap: anywhere; }
.kv > div:nth-child(odd) { color: var(--muted); background: color-mix(in srgb, var(--raised) 50%, transparent); font-size: 12.5px; }
.kv > div:nth-last-child(-n+2) { border-bottom: 0; }

/* -------------------------------------------------------------- tables --- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
thead th {
  text-align: start; font-weight: 400; font-size: 12px; color: var(--muted);
  background: var(--raised); padding: 10px 14px; white-space: nowrap;
}
tbody td { padding: 11px 14px; border-top: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:nth-child(even) td { background: var(--zebra); }
tbody tr.row-link { cursor: pointer; }
tbody tr.row-link:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
td.num, th.num { text-align: end; }
td .name { display: flex; align-items: center; gap: 10px; font-weight: 700; }
td .name .tile { width: 34px; height: 34px; border-radius: 10px; }
td .name .tile svg.i { width: 18px; height: 18px; }
td .name small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty .tile { margin: 0 auto 12px; width: 54px; height: 54px; }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* -------------------------------------------------------------- badges --- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 20px; font-size: 11.5px; white-space: nowrap;
  color: var(--tone, var(--muted)); background: color-mix(in srgb, var(--tone, var(--muted)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--tone, var(--muted)) 26%, transparent);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.pulse .dot { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.t-ok { --tone: var(--inflow); } .t-bad { --tone: var(--outflow); } .t-warn { --tone: var(--warning); }
.t-amber { --tone: var(--amber); } .t-teal { --tone: var(--teal); } .t-blue { --tone: var(--blue); }
.t-rose { --tone: var(--rose); } .t-accent { --tone: var(--accent); } .t-muted { --tone: var(--muted); }

/* -------------------------------------------------------------- meters --- */
.meter { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); min-width: 170px; }
.meter + .meter { margin-top: 3px; }
.meter .bar { height: 6px; border-radius: 4px; background: color-mix(in srgb, var(--muted) 16%, transparent); overflow: hidden; }
.meter .bar i { display: block; height: 100%; border-radius: 4px; background: var(--tone, var(--accent)); min-width: 2px; transition: width .6s ease; }
.meter span:last-child { font-family: var(--font-mono); font-size: 10.5px; direction: ltr; min-width: 58px; text-align: end; }

/* ------------------------------------------------------------- buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); white-space: nowrap;
}
.btn:hover:not([disabled]) { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); background: color-mix(in srgb, var(--accent) 5%, var(--surface)); text-decoration: none; }
.btn[disabled] { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; font-weight: 700; }
.btn.primary:hover:not([disabled]) { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.btn.danger { color: var(--outflow); border-color: color-mix(in srgb, var(--outflow) 35%, transparent); }
.btn.danger:hover:not([disabled]) { background: color-mix(in srgb, var(--outflow) 9%, transparent); border-color: var(--outflow); }
.btn.solid-danger { background: var(--outflow); color: #fff; border-color: transparent; font-weight: 700; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover:not([disabled]) { color: var(--ink); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.icon { width: 32px; padding: 0; height: 32px; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 7px 14px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.seg button + button { border-inline-start: 1px solid var(--line); }
.seg button.on { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 700; }
.seg button:hover { color: var(--ink); background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* --------------------------------------------------------------- forms --- */
.field { margin-bottom: 14px; }
.field > label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12.5px; }
.field .hint { margin: 5px 0 0; color: var(--faint); font-size: 11.5px; }
.field .hint.err { color: var(--outflow); }
.input.invalid { border-color: var(--outflow); }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); outline: none;
}
textarea.input { height: auto; min-height: 90px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.input.mono { font-family: var(--font-mono); }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-start-end-radius: 0; border-end-end-radius: 0; }
.input-group .addon { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-inline-start: 0; border-radius: 0 10px 10px 0; color: var(--muted); background: var(--raised); white-space: nowrap; font-family: var(--font-mono); font-size: 12px; direction: ltr; }
[dir="rtl"] .input-group .addon { border-radius: 10px 0 0 10px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 14px; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: 10px; cursor: pointer; margin-bottom: 10px; }
.check:hover { border-color: var(--line); }
.check input { margin-top: 4px; accent-color: var(--accent); }
.check small { display: block; color: var(--muted); font-size: 11.5px; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 14px; }
.choice {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 8px; text-align: center; background: var(--surface);
  display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px;
}
.choice .tile { width: 38px; height: 38px; border-radius: 11px; }
.choice:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); }
.choice.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent); font-weight: 700; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type=range] { flex: 1; accent-color: var(--accent); }
.range-row b { min-width: 72px; text-align: end; font-family: var(--font-figure); }

/* ---------------------------------------------------------------- tabs --- */
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px var(--line-soft); margin-bottom: 16px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 9px 14px; border: 0; background: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; display: flex; gap: 7px; align-items: center; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }

/* ---------------------------------------------------------------- logs --- */
.console {
  background: #121016; color: #ddd8e8; border-radius: 12px; font: 12px/1.7 var(--font-mono);
  padding: 12px 0; height: 520px; overflow: auto; direction: ltr; text-align: left; border: 1px solid var(--line-soft);
}
.console.short { height: 360px; }
.console .ln { padding: 0 14px; white-space: pre-wrap; word-break: break-all; }
.console .ln:hover { background: rgba(255, 255, 255, .04); }
.console .ts { color: #7f7a8c; margin-right: 10px; user-select: none; }
.console.no-ts .ts { display: none; }
.console .err { color: #f0a0a0; }
.console .ok { color: #9ad7a0; }
.console .step { color: #c4b8e8; }
.console .dim { color: #7f7a8c; }
.console-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.console-bar .input { max-width: 260px; height: 32px; }

/* ------------------------------------------------------------ releases --- */
.release { border: 1px solid var(--line-soft); border-radius: 12px; margin-bottom: 10px; background: var(--surface); overflow: hidden; }
.release > .rhead { display: flex; align-items: center; gap: 12px; padding: 11px 14px; cursor: pointer; flex-wrap: wrap; }
.release > .rhead:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.release .ver { font-family: var(--font-mono); font-weight: 700; border: 1px solid var(--line); border-radius: 8px; padding: 1px 8px; font-size: 12px; direction: ltr; }
.release .rbody { border-top: 1px solid var(--line-soft); padding: 14px; background: color-mix(in srgb, var(--raised) 35%, transparent); }
.release.live { border-color: color-mix(in srgb, var(--inflow) 40%, transparent); }
.chev { transition: transform var(--speed); color: var(--muted); }
.open .chev { transform: rotate(180deg); }

/* -------------------------------------------------------------- upload --- */
.drop {
  display: block;
  border: 1.5px dashed var(--line); border-radius: 14px; padding: 34px 20px; text-align: center; color: var(--muted);
  background: color-mix(in srgb, var(--raised) 35%, transparent); cursor: pointer;
}
.drop:hover, .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); color: var(--ink); }
.drop .tile { margin: 0 auto 10px; }
.drop > b { display: block; font-size: 14.5px; color: var(--ink); }
.site-drop { padding: 30px 20px 24px; }
.site-drop .progress { max-width: 420px; margin-inline: auto; }
.progress { height: 8px; border-radius: 6px; background: color-mix(in srgb, var(--muted) 16%, transparent); overflow: hidden; margin-top: 12px; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
pre.code {
  background: var(--raised); border: 1px solid var(--line-soft); border-radius: 10px; padding: 12px 14px; margin: 8px 0 14px;
  font: 12px/1.7 var(--font-mono); overflow-x: auto; direction: ltr; text-align: left; white-space: pre;
}
.copy-line { display: flex; align-items: center; gap: 8px; background: var(--raised); border: 1px solid var(--line-soft); border-radius: 10px; padding: 6px 6px 6px 12px; direction: ltr; }
.copy-line code { flex: 1; overflow-x: auto; white-space: nowrap; scrollbar-width: thin; }
.secret { filter: blur(5px); transition: filter var(--speed); cursor: pointer; }
.secret.shown { filter: none; }

/* ---------------------------------------------------------- file browser --- */
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13px; }
.crumbs button { border: 0; background: none; padding: 3px 7px; border-radius: 7px; color: var(--muted); }
.crumbs button:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--ink); }
.crumbs button:last-child { color: var(--ink); font-weight: 700; }
.fname { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fname span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; unicode-bidi: plaintext; }
.fname .ficon { color: var(--blue); }
.fname .ficon.dir { color: var(--amber); }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: .75; }
tr:hover .row-actions { opacity: 1; }
.dragging-over { outline: 2px dashed var(--accent); outline-offset: -8px; }

/* -------------------------------------------------------------- modals --- */
.overlay { position: fixed; inset: 0; background: rgba(12, 10, 16, .5); display: grid; place-items: center; z-index: 50; padding: 16px; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line-soft); border-radius: 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); animation: rise .18s ease; }
.modal.wide { width: min(760px, 100%); }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }
.modal .mhead { display: flex; align-items: center; gap: 12px; padding: 18px 20px 6px; }
.modal .mhead h3 { margin: 0; font-size: 16px; flex: 1; }
.modal .mbody { padding: 12px 20px; }
.modal .mfoot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px 18px; }
.alert { display: flex; gap: 10px; padding: 11px 13px; border-radius: 11px; margin-bottom: 14px; font-size: 12.5px;
  color: var(--ink); background: color-mix(in srgb, var(--tone, var(--warning)) 10%, transparent); border: 1px solid color-mix(in srgb, var(--tone, var(--warning)) 30%, transparent); }
.alert svg.i { color: var(--tone, var(--warning)); margin-top: 2px; }

/* -------------------------------------------------------------- toasts --- */
.toasts { position: fixed; bottom: 18px; inset-inline-start: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { display: flex; gap: 10px; align-items: center; min-width: 240px; max-width: 420px; padding: 11px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); animation: rise .2s ease; }
.toast svg.i { color: var(--tone, var(--inflow)); }

/* ---------------------------------------------------------------- auth --- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth .card { width: min(400px, 100%); padding: 28px; }
.auth h1 { margin: 12px 0 2px; font-size: 20px; }
.auth p { color: var(--muted); margin: 0 0 20px; }
.auth .tools { display: flex; justify-content: flex-end; gap: 6px; margin: -10px -10px 0 0; }
.err-text { color: var(--outflow); min-height: 1.5em; margin: 8px 0 0; font-size: 12.5px; }

/* -------------------------------------------------------------- events --- */
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); align-items: flex-start; }
.events li:last-child { border-bottom: 0; }
.events .chip { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--tone, var(--muted)) 13%, transparent); color: var(--tone, var(--muted)); }
.events .chip svg.i { width: 15px; height: 15px; }
.events .what { flex: 1; min-width: 0; }
.events .what small { display: block; color: var(--muted); overflow-wrap: anywhere; }
.events time { color: var(--faint); font-size: 11.5px; white-space: nowrap; }

.note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; margin-top: 18px; justify-content: center; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--raised), color-mix(in srgb, var(--raised) 40%, var(--surface)), var(--raised)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Chevrons: "forward" points toward the reading end, "back" toward the start. */
[dir="rtl"] .fwd { transform: scaleX(-1); }
[dir="ltr"] .side .back svg { transform: scaleX(-1); }

/* ---------------------------------------------------------- responsive --- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; display: flex; overflow-x: auto; gap: 2px; padding: 6px; }
  .side .side-title, .side .back { display: none; }
  .side a { white-space: nowrap; }
  .services a span.lbl { display: none; }
  .services a { padding: 8px 10px; }
}
@media (max-width: 600px) {
  main { padding: 16px 16px 60px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .brand .name { display: none; }
  .kv { grid-template-columns: 1fr; }
  .kv > div:nth-child(odd) { border-bottom: 0; padding-bottom: 2px; }
  .card { padding: 14px; }
}

/* Database connection details (Liara-style rows). */
.conn-rows { display: flex; flex-direction: column; }
.conn-row { display: grid; grid-template-columns: minmax(150px, 30%) 1fr auto; align-items: center; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--line-soft); }
.conn-label { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.conn-value { direction: ltr; text-align: start; overflow-wrap: anywhere; min-width: 0; }
[dir="rtl"] .conn-value { text-align: end; }
.conn-cmd { display: block; font-size: 12.5px; margin: 16px 0 6px; }
.conn-closed { display: flex; gap: 14px; align-items: flex-start; padding: 6px 0; color: var(--muted); }
.conn-closed b { color: var(--ink); }
@media (max-width: 640px) {
  .conn-row { grid-template-columns: 1fr auto; padding: 10px 14px; }
  .conn-label { grid-column: 1 / -1; }
}

.tz-clock { font-size: 22px; font-weight: 700; color: var(--ink); direction: ltr; text-align: start; }
[dir="rtl"] .tz-clock { direction: rtl; }

/* Usage charts. Series colors are validated for CVD and contrast on both surfaces. */
.viz-grid-cards, .viz-bar, .viz-card { --series-1: #2a78d6; --series-2: #eb6834; --series-one: var(--accent); }
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .viz-grid-cards { --series-1: #3987e5; --series-2: #d95926; }
}
:root[data-theme="dark"] .viz-grid-cards { --series-1: #3987e5; --series-2: #d95926; }
.viz-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.viz-grid-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.viz-grid-cards .card { margin: 0; }
.viz-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.viz-head h2 { margin: 0; }
.viz-now { font-family: var(--font-figure); color: var(--ink); white-space: nowrap; }
.viz-now b { font-size: 18px; }
.viz-now small { color: var(--muted); font-size: 12px; }
.viz-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-legend b { color: var(--ink); font-family: var(--font-figure); font-weight: 600; }
.viz-key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; background: var(--c); }
.viz-box { position: relative; margin-top: 10px; direction: ltr; }
.viz-svg { display: block; width: 100%; overflow: visible; }
.s-one { --c: var(--series-one); } .s-1 { --c: var(--series-1); } .s-2 { --c: var(--series-2); }
.viz-grid { stroke: var(--line-soft); stroke-width: 1; }
.viz-axis { fill: var(--faint); font: 10.5px var(--font-figure); }
.viz-limit { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 4 4; }
.viz-line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-area { fill: var(--c); opacity: .12; stroke: none; }
.viz-dot { fill: var(--c); }
.viz-cross { stroke: var(--muted); stroke-width: 1; }
.viz-mark { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
.viz-hit { fill: transparent; cursor: crosshair; touch-action: pan-y; }
.viz-tip {
  position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 8px 10px; font-size: 12px; min-width: 140px; z-index: 2;
}
.viz-tip-time { color: var(--muted); margin-bottom: 4px; }
.viz-tip-row { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.viz-tip-row b { margin-inline-start: auto; color: var(--ink); font-family: var(--font-figure); }
.viz-table { margin-top: 16px; }
.viz-table summary { cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.viz-table .table-wrap { margin-top: 12px; }
@media (max-width: 760px) { .viz-grid-cards { grid-template-columns: 1fr; } }

/* Page changes: the old page stays (dimmed) until the new one is ready, new
   content fades in once, and a thin bar shows a slow load. */
#page { transition: opacity .15s ease; }
body.nav-busy #page { opacity: .55; pointer-events: none; }
body.nav-busy::before, body.nav-bar::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 50; background: var(--accent);
  transform-origin: 0 50%; animation: nav-bar 1.2s ease-in-out infinite;
}
[dir="rtl"] body.nav-busy::before, [dir="rtl"] body.nav-bar::before { transform-origin: 100% 50%; }
@keyframes nav-bar { 0% { transform: scaleX(0); } 60% { transform: scaleX(.8); } 100% { transform: scaleX(1); opacity: .2; } }
.entering > *, .entering #tab > * { animation: page-in .18s ease-out both; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
/* A placeholder only shows up when loading actually takes a moment. */
.sk-card { animation: sk-in .2s ease .25s both; }
@keyframes sk-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .entering > *, .entering #tab > *, .sk-card, body.nav-busy::before, body.nav-bar::before { animation: none; }
  #page { transition: none; }
}
