/* Radiant Core portal — aliases the shared design system (/portal/brand). */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.55 var(--rc-sans); color: var(--rc-ink); background: var(--rc-bg); -webkit-font-smoothing: antialiased; }
a { color: var(--rc-primary); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--rc-primary); outline-offset: 2px; }
.mono { font-family: var(--rc-mono); }
.muted { color: var(--rc-muted); }
.small { font-size: 13px; }
h1, h2, h3 { margin: 0; letter-spacing: -0.02em; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.boot { height: 100vh; display: grid; place-items: center; }
.mark { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; letter-spacing: -0.03em;
        color: var(--rc-primary-ink); background: linear-gradient(140deg, var(--rc-primary), oklch(0.40 0.15 270)); flex: none; }
.lockup { display: flex; align-items: center; gap: 11px; }
.lockup b { display: block; font-weight: 800; letter-spacing: -0.03em; font-size: 16px; }
.lockup small { display: block; font-size: 12px; opacity: .75; }

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: var(--rc-radius-sm);
       border: 1px solid var(--rc-border-str); background: var(--rc-surface); font-weight: 600; cursor: pointer; text-decoration: none; color: var(--rc-ink);
       transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--rc-surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--rc-primary); border-color: var(--rc-primary); color: var(--rc-primary-ink); }
.btn.primary:hover { background: var(--rc-primary-600); }
.btn.danger { color: var(--rc-danger-ink); border-color: oklch(0.80 0.08 22); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
.field { display: grid; gap: 5px; }
.field label { font-size: 13px; font-weight: 600; color: var(--rc-ink-2); }
.field input, .field select, .field textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--rc-border-str); border-radius: var(--rc-radius-sm);
       background: var(--rc-surface); }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--rc-primary); outline-offset: 0; border-color: var(--rc-primary); }
.field .hint { font-size: 12px; color: var(--rc-muted); }
.pw { position: relative; }
.pw input { padding-right: 64px; }
.pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--rc-primary-700);
             font-size: 12px; font-weight: 700; cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.alert { padding: 10px 12px; border-radius: var(--rc-radius-sm); font-size: 14px; background: var(--rc-danger-tint); color: var(--rc-danger-ink); }
.alert.ok { background: var(--rc-ok-tint); color: var(--rc-ok-ink); }
.alert.info { background: var(--rc-tint); color: var(--rc-primary-700); }

/* ── Sign-in ───────────────────────────────────────────────────────────── */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, 0.9fr); }
.auth-brand { position: relative; overflow: hidden; color: var(--rc-primary-ink); padding: 44px 56px; display: flex; flex-direction: column; gap: 36px;
              background: radial-gradient(90% 70% at 100% 0%, oklch(0.62 0.13 215 / .45), transparent 60%),
                          radial-gradient(70% 60% at 0% 100%, oklch(0.50 0.16 300 / .45), transparent 60%),
                          linear-gradient(155deg, oklch(0.36 0.15 288), oklch(0.24 0.10 286)); }
.auth-brand::after { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: .14;
                     background-image: linear-gradient(oklch(1 0 0 / .5) 1px, transparent 1px), linear-gradient(90deg, oklch(1 0 0 / .5) 1px, transparent 1px);
                     background-size: 44px 44px; mask-image: radial-gradient(80% 70% at 60% 40%, #000, transparent); }
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand .mark { background: oklch(1 0 0 / .14); border: 1px solid oklch(1 0 0 / .25); }
.auth-hero { margin-top: auto; display: grid; gap: 14px; max-width: 560px; }
.auth-hero .eyebrow { font: 600 12px var(--rc-mono); letter-spacing: .1em; text-transform: uppercase; color: oklch(0.86 0.09 215); }
.auth-hero h1 { font-size: clamp(30px, 3.6vw, 46px); font-weight: 800; letter-spacing: -0.035em; }
.auth-hero p { font-size: 17px; color: oklch(0.90 0.03 288); }
.app-strip { display: grid; gap: 10px; max-width: 560px; }
.app-chip { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--rc-radius);
            background: oklch(1 0 0 / .07); border: 1px solid oklch(1 0 0 / .14); backdrop-filter: blur(4px); }
.app-chip .ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: oklch(1 0 0 / .12); }
.app-chip .ic svg { width: 20px; height: 20px; }
.app-chip b { display: block; font-size: 15px; }
.app-chip small { color: oklch(0.86 0.03 288); font-size: 13px; }
.auth-foot { font-size: 12px; color: oklch(0.82 0.03 288); display: flex; gap: 16px; flex-wrap: wrap; }
.auth-foot span::before { content: '●'; color: oklch(0.80 0.12 160); margin-right: 6px; font-size: 9px; vertical-align: 2px; }

.auth-panel { display: grid; place-items: center; padding: 40px 28px; background: var(--rc-bg); }
.auth-card { width: 100%; max-width: 420px; display: grid; gap: 18px; }
.auth-card h2 { font-size: 26px; font-weight: 800; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 12px; background: var(--rc-surface-3); }
.tabs button { border: 0; background: none; padding: 9px; border-radius: 9px; font-weight: 600; cursor: pointer; color: var(--rc-ink-2); }
.tabs button[aria-selected="true"] { background: var(--rc-surface); color: var(--rc-ink); box-shadow: var(--rc-shadow-sm); }
.auth-form { display: grid; gap: 14px; }
.captcha { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--rc-border); border-radius: var(--rc-radius); background: var(--rc-surface); }
.captcha-row { display: flex; gap: 8px; align-items: center; }
.captcha img { height: 56px; width: auto; border-radius: 8px; border: 1px solid var(--rc-border); background: var(--rc-surface-2); flex: none; max-width: 70%; }
.captcha .btn { flex: none; }
.captcha label { font-size: 13px; font-weight: 600; color: var(--rc-ink-2); display: flex; justify-content: space-between; }
.meter { height: 6px; border-radius: 99px; background: var(--rc-surface-3); overflow: hidden; }
.meter i { display: block; height: 100%; width: 0; background: var(--rc-danger); transition: width .2s, background .2s; }
.fine { font-size: 12px; color: var(--rc-muted); text-align: center; }

/* ── Launcher ──────────────────────────────────────────────────────────── */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 28px;
          background: oklch(1 0 0 / .86); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rc-border); }
.topbar .lockup small { color: var(--rc-muted); opacity: 1; }
.who { display: flex; align-items: center; gap: 10px; }
.who .sep { width: 1px; height: 28px; background: var(--rc-border); margin: 0 4px; }
.who .btn svg { width: 15px; height: 15px; flex: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px;
          background: var(--rc-tint-2); color: var(--rc-primary-700); text-transform: uppercase; }
.who .name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.who .name small { display: block; color: var(--rc-muted); font-weight: 500; font-size: 12px; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; letter-spacing: .02em;
        background: var(--rc-tint); color: var(--rc-primary-700); }
.chip.chip-admin { background: oklch(0.955 0.03 215); color: var(--rc-accent-ink); }
.page { max-width: 1180px; margin: 0 auto; padding: 36px 28px 64px; }
.greet { display: grid; gap: 6px; margin-bottom: 26px; }
.greet h1 { font-size: 30px; font-weight: 800; }
.greet p { color: var(--rc-muted); font-size: 16px; }
.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.appcard { position: relative; display: grid; grid-template-rows: auto auto 1fr auto; gap: 14px; padding: 22px; border-radius: var(--rc-radius-lg);
           background: var(--rc-surface); border: 1px solid var(--rc-border); box-shadow: var(--rc-shadow-sm); overflow: hidden;
           transition: box-shadow .2s, transform .2s, border-color .2s; }
.appcard:hover { box-shadow: var(--rc-shadow-md); transform: translateY(-2px); border-color: var(--rc-border-str); }
.appcard::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--band, var(--rc-primary)); }
.appcard.c-customer { --band: linear-gradient(90deg, var(--rc-primary), oklch(0.55 0.15 280)); }
.appcard.c-accounts { --band: linear-gradient(90deg, oklch(0.55 0.13 200), var(--rc-accent)); }
.appcard.c-llm { --band: linear-gradient(90deg, oklch(0.55 0.17 320), oklch(0.62 0.15 290)); }
.appcard .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.appicon { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; color: var(--rc-primary-ink); }
.appicon svg { width: 24px; height: 24px; }
.c-customer .appicon { background: linear-gradient(140deg, var(--rc-primary), oklch(0.40 0.15 275)); }
.c-accounts .appicon { background: linear-gradient(140deg, oklch(0.52 0.12 210), oklch(0.42 0.11 225)); }
.c-llm .appicon { background: linear-gradient(140deg, oklch(0.52 0.18 320), oklch(0.44 0.16 295)); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--rc-muted); }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--rc-faint); }
.status.up { color: var(--rc-ok-ink); } .status.up::before { background: var(--rc-ok); box-shadow: 0 0 0 3px var(--rc-ok-tint); }
.status.down { color: var(--rc-danger-ink); } .status.down::before { background: var(--rc-danger); }
.appcard h2 { font-size: 21px; font-weight: 800; }
.appcard .desc { color: var(--rc-ink-2); font-size: 14.5px; }
.appcard ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; align-content: start; }
.appcard li { font-size: 13.5px; color: var(--rc-ink-2); display: grid; grid-template-columns: 16px 1fr; gap: 6px; }
.appcard li::before { content: ''; width: 6px; height: 6px; border-radius: 2px; background: var(--band-dot, var(--rc-primary)); margin-top: 7px; }
.c-accounts li::before { background: var(--rc-accent); }
.c-llm li::before { background: oklch(0.55 0.17 320); }
.appcard .go { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 6px; border-top: 1px solid var(--rc-border); }

/* Role chooser */
.roles { display: grid; gap: 10px; max-height: 60vh; overflow-y: auto; }
.role { display: grid; grid-template-columns: 42px 1fr auto; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 12px 14px;
        border: 1px solid var(--rc-border); border-radius: var(--rc-radius); background: var(--rc-surface); cursor: pointer; transition: border-color .15s, background .15s; }
.role:hover, .role:focus-visible { border-color: var(--rc-primary); background: var(--rc-tint); }
.role .av { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; font-weight: 800; background: var(--rc-tint-2); color: var(--rc-primary-700); }
.role b { display: block; }
.role small { display: block; color: var(--rc-muted); font-size: 12.5px; }
.role .arrow { color: var(--rc-faint); font-size: 18px; }

/* Dialog */
dialog { border: 0; border-radius: var(--rc-radius-lg); padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: var(--rc-shadow-lg); color: var(--rc-ink); }
dialog::backdrop { background: oklch(0.2 0.03 288 / .45); backdrop-filter: blur(2px); }
dialog form { padding: 22px; display: grid; gap: 14px; }
dialog h3 { font-size: 19px; font-weight: 800; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

#toast { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: grid; gap: 8px; }
#toast div { max-width: 420px; padding: 11px 14px; border-radius: var(--rc-radius-sm); background: var(--rc-ink); color: var(--rc-surface); box-shadow: var(--rc-shadow-md); font-size: 14px; }
#toast div.err { background: var(--rc-danger); }

/* ── Admin ─────────────────────────────────────────────────────────────── */
.admin { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: calc(100vh - 59px); }
.side { border-right: 1px solid var(--rc-border); background: var(--rc-surface); padding: 18px 12px; position: sticky; top: 59px; height: calc(100vh - 59px); overflow-y: auto; }
.side h4 { margin: 14px 10px 6px; font: 600 11px var(--rc-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--rc-faint); }
.side a { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: var(--rc-radius-sm); color: var(--rc-ink-2); text-decoration: none; font-size: 14px; }
.side a:hover { background: var(--rc-surface-2); }
.side a.on { background: var(--rc-tint); color: var(--rc-primary-700); font-weight: 600; }
.side .count { background: var(--rc-warn-tint); color: var(--rc-warn-ink); border-radius: 99px; padding: 0 7px; font-size: 11px; font-weight: 700; }
.content { padding: 26px 30px 64px; min-width: 0; display: grid; gap: 18px; align-content: start; }
.content > h1 { font-size: 24px; font-weight: 800; }
.content > .sub { color: var(--rc-muted); margin-top: -10px; }
.panel { background: var(--rc-surface); border: 1px solid var(--rc-border); border-radius: var(--rc-radius); padding: 16px 18px; min-width: 0; }
.panel h2 { font-size: 15px; font-weight: 700; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--rc-surface); border: 1px solid var(--rc-border); border-radius: var(--rc-radius); padding: 14px 16px; }
.kpi span { font-size: 12.5px; color: var(--rc-muted); }
.kpi b { display: block; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi.warn b { color: var(--rc-warn-ink); } .kpi.bad b { color: var(--rc-danger-ink); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 18px; }
.svc { display: grid; gap: 8px; }
.svc div { display: flex; justify-content: space-between; align-items: center; padding: 9px 12px; border: 1px solid var(--rc-border); border-radius: var(--rc-radius-sm); font-size: 14px; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font: 600 11px var(--rc-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--rc-muted);
     padding: 8px 10px; border-bottom: 1px solid var(--rc-border); white-space: nowrap; background: var(--rc-surface-2); }
td { padding: 8px 10px; border-bottom: 1px solid var(--rc-border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td code, .cell-json { font-family: var(--rc-mono); font-size: 12px; color: var(--rc-ink-2); word-break: break-word; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--rc-surface-2); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.b-ok { background: var(--rc-ok-tint); color: var(--rc-ok-ink); } .b-warn { background: var(--rc-warn-tint); color: var(--rc-warn-ink); }
.b-bad { background: var(--rc-danger-tint); color: var(--rc-danger-ink); } .b-info { background: var(--rc-tint); color: var(--rc-primary-700); }
.b-plain { background: var(--rc-surface-2); color: var(--rc-ink-2); border: 1px solid var(--rc-border); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.toolbar .field { min-width: 180px; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--rc-border); border-radius: 99px; font-size: 13px; cursor: pointer; }
.checks input { accent-color: var(--rc-primary); }
.empty { color: var(--rc-muted); padding: 14px 2px; font-size: 14px; }
.chart svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--rc-muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.dbx { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; align-items: start; }
.dbx .list { max-height: 70vh; overflow-y: auto; display: grid; gap: 2px; }
.dbx .list button { display: flex; justify-content: space-between; gap: 8px; width: 100%; text-align: left; border: 0; background: none; padding: 7px 9px;
                    border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.dbx .list button:hover { background: var(--rc-surface-2); }
.dbx .list button.on { background: var(--rc-tint); color: var(--rc-primary-700); font-weight: 600; }
.dbx .list small { color: var(--rc-faint); font-family: var(--rc-mono); font-size: 11px; }
.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rc-border); margin-bottom: 12px; overflow-x: auto; }
.subtabs button { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--rc-muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.subtabs button.on { color: var(--rc-primary-700); border-bottom-color: var(--rc-primary); font-weight: 600; }
textarea.sql { font-family: var(--rc-mono); font-size: 13px; min-height: 110px; resize: vertical; }
pre.def { margin: 0; white-space: pre-wrap; word-break: break-word; font: 12px/1.5 var(--rc-mono); color: var(--rc-ink-2); }

@media (max-width: 980px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 28px 22px; gap: 20px; }
  .app-strip { display: none; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .admin { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; display: flex; flex-wrap: wrap; gap: 4px; }
  .side h4 { display: none; }
  .grid2, .dbx { grid-template-columns: minmax(0, 1fr); }
  .topbar { padding: 10px 16px; }
  .page, .content { padding-inline: 16px; }
}

.home-link { text-decoration: none; color: inherit; }
.legend .lg-login { background: var(--rc-primary); } .legend .lg-launch { background: var(--rc-accent); } .legend .lg-fail { background: var(--rc-danger); }
.panel h2.mt { margin-top: 18px; }
.db-pick { text-align: left; cursor: pointer; font: inherit; color: inherit; }
.db-pick b { font-size: 18px; }
.db-pick.on { border-color: var(--rc-primary); background: var(--rc-tint); }
input.filter, textarea.field-like { width: 100%; padding: 8px 10px; border: 1px solid var(--rc-border-str); border-radius: var(--rc-radius-sm); background: var(--rc-surface); margin-bottom: 8px; }
.captcha input { width: 100%; padding: 10px 12px; border: 1px solid var(--rc-border-str); border-radius: var(--rc-radius-sm);
                 background: var(--rc-surface); font-family: var(--rc-mono); letter-spacing: .2em; text-transform: uppercase; }
.captcha input:focus { outline: 2px solid var(--rc-primary); outline-offset: 0; border-color: var(--rc-primary); }
@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 8px; }
  .topbar .lockup small, .who .name, .who .sep, #pwchange { display: none; }
  .who { gap: 6px; }
}
.content { grid-template-columns: minmax(0, 1fr); }
#body { min-width: 0; display: grid; gap: 18px; align-content: start; }
#body > *, .content > * { min-width: 0; }
