/* Gravity shell — XcutIQ brand tokens (brand/xcutiq.css). Gold is reserved for authority cues. */
:root {
  --font: Inter, "Segoe UI", system-ui, -apple-system, "Noto Sans Arabic", "Noto Sans", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --radius-card: 24px;
  --radius-button: 14px;
  --fast: 160ms;
  --standard: 260ms;
}
:root[data-theme="dark"] {
  --bg: var(--xcutiq-navy);
  --surface: var(--xcutiq-indigo);
  --surface-2: #17223f;
  --border: #24314f;
  --text: var(--xcutiq-soft-white);
  --muted: var(--xcutiq-muted-slate);
  --accent: #5b84ff;
  --accent-strong: var(--xcutiq-blue);
  --danger: #f87171;
  --success: #4ade80;
  --gold: var(--xcutiq-gold);
}
:root[data-theme="light"] {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --border: #d8deea;
  --text: #0d1730;
  --muted: #4f5d78;
  --accent: var(--xcutiq-blue);
  --accent-strong: #1a47d6;
  --danger: #c4314b;
  --success: #12805c;
  --gold: #9a650c;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
.skip-link { position: absolute; inset-inline-start: 8px; top: -48px; padding: 8px 12px; background: var(--surface); border-radius: 8px; z-index: 10; }
.skip-link:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.boot { padding: 24px; color: var(--muted); }

/* ---------- auth pages (setup, sign-in) */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 80% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 60%), var(--bg); }
.auth-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  padding: 32px 28px; box-shadow: var(--xcutiq-glass-shadow); }
.auth-brand { display: grid; gap: 6px; margin-bottom: 22px; }
.auth-brand img { width: auto; height: 48px; }
.auth-brand span { color: var(--muted); font-size: 13px; padding-inline-start: 2px; }
.auth h1 { font-size: 22px; margin: 0 0 6px; }
.auth p.lead { margin: 0 0 20px; color: var(--muted); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); }
input, select { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; min-height: 42px; width: 100%; }
input:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn { font: inherit; font-weight: 600; border-radius: var(--radius-button); border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  padding: 9px 16px; min-height: 40px; cursor: pointer; transition: background var(--fast), border-color var(--fast); }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; width: 100%; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent-strong) 85%, #000); }
.btn[disabled] { opacity: .6; cursor: progress; }
.error { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.ok { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); border-radius: 10px; padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.auth-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 18px; color: var(--muted); font-size: 13px; }
.link-btn { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 4px; }

/* ---------- application frame */
.frame { display: grid; grid-template-rows: 56px auto 1fr; height: 100vh; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 12px; padding-inline: 14px; background: var(--surface); border-bottom: 1px solid var(--border); min-width: 0; }
.topbar .logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; white-space: nowrap; }
.topbar .logo img.logo-full { width: auto; height: 28px; }
.topbar .logo img.logo-mark { display: none; width: 30px; height: 30px; }
.topbar nav { display: flex; gap: 4px; margin-inline-start: 12px; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a { color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.topbar nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--gold); }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.topbar .btn { min-height: 34px; padding: 5px 12px; white-space: nowrap; flex-shrink: 0; }
.role-chip { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--gold); border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent); border-radius: 999px; padding: 2px 8px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live.on { color: var(--success); }
.live.on::before { background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 25%, transparent); }
main { min-height: 0; overflow: auto; }
#designer { height: 100%; --wfd-primary: var(--accent-strong); --wfd-primary-hover: color-mix(in srgb, var(--accent-strong) 85%, #000); --wfd-font: var(--font); --wfd-mono: var(--mono); }

/* ---------- administration */
.page { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; }
.page h1 { font-size: 22px; margin: 0 0 4px; }
.page > p { color: var(--muted); margin: 0 0 20px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px; margin-bottom: 18px; }
.card h2 { font-size: 16px; margin: 0 0 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: start; padding: 10px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.form-grid { display: grid; gap: 4px 12px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: start; }
.form-grid > .btn { grid-column: 1 / -1; justify-self: start; }
.form-grid .btn { width: auto; }
.status { font-size: 12px; font-weight: 700; }
.status.on { color: var(--success); }
.status.off { color: var(--danger); }


.topbar .btn .short { display: none; }
@media (max-width: 900px) {

  .topbar .btn .long { display: none; }
  .topbar .btn .short { display: inline; }
  .live { font-size: 0; gap: 0; }
}
@media (max-width: 720px) {
  .context .role-chip { display: none; }
  .topbar .logo img.logo-full { display: none; }
  .topbar .logo img.logo-mark { display: block; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- context bar (organization, workspace, role) */
.context { display: flex; align-items: center; gap: 16px; padding: 6px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 13px; flex-wrap: wrap; }
.context .ctx { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.context .ctx-label { color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; font-size: 11px; }
.context select { min-height: 30px; padding: 4px 8px; width: auto; max-width: 240px; font-size: 13px; background: var(--surface); }
.context .spacer { flex: 1; }
.context .who { color: var(--text); font-weight: 600; text-decoration: none; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.context .who::before { content: "◉ "; color: var(--accent); }
.context .who:hover { text-decoration: underline; }

/* ---------- tabs, tables, misc */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 8px 0 18px; overflow-x: auto; }
.tabs .tab { padding: 8px 14px; color: var(--muted); text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs .tab[aria-current="page"] { color: var(--text); border-bottom-color: var(--gold); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.card > p.muted, .card-head p.muted { margin: 0 0 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.card-head select { width: auto; }
td select { width: auto; min-height: 34px; padding: 4px 8px; }
td.actions { display: flex; gap: 6px; }
td.details code { white-space: normal; word-break: break-all; font-size: 12px; color: var(--muted); }
code { font-family: var(--mono); font-size: 12.5px; }
.more { display: flex; justify-content: center; padding-top: 12px; }
