:root {
  --accent: #6D28D9;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #4B5563;
  --line: #E5E7EB;
  --line-2: #D1D5DB;
  --bg: #F6F7F9;
  --panel: #FFFFFF;
  --ok: #166534;
  --bad: #991B1B;
  --bad-bg: #FEE2E2;
  --star: #D97706;
  --radius: 14px;
  font-family: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #F3F4F6; --ink-2: #D1D5DB; --muted: #9CA3AF; --line: #2A2F3A; --line-2: #3A404C;
    --bg: #0F1218; --panel: #171B23; --ok: #4ADE80; --bad: #FCA5A5; --bad-bg: #3B1518; --star: #FBBF24;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-size: 14px; min-height: 100vh; }
button, input, select { font: inherit; color: inherit; }
.boot { padding: 40px; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; font-weight: 500; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.wide { width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 500; font-size: 13px; color: var(--ink-2); }
.field input, .field select { height: 42px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel); font-weight: 400; font-size: 14px; color: var(--ink); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ink-2); }
.sub { color: var(--muted); margin: 0; }
.small { font-size: 12px; color: var(--muted); }
.err { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: 10px; font-size: 13px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

/* sign in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 32px 28px;
  display: flex; flex-direction: column; gap: 16px; box-shadow: 0 20px 50px rgba(15, 23, 42, .08); }
.login-card h1 { margin: 0; font-size: 24px; }
.logo { width: 44px; height: 44px; border-radius: 12px; background: var(--accent); color: #fff; display: grid; place-items: center; }
.logo.sm { width: 30px; height: 30px; border-radius: 9px; }

/* shell */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 10px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.search { flex: 1; max-width: 520px; margin: 0 auto; display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--bg); color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--ink); }
.avatar { width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; flex: none; }
.page { max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px; }
.hello { margin: 0; font-size: 26px; font-weight: 600; }
.date { margin: 4px 0 20px; color: var(--muted); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 10px 16px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.sec { margin-bottom: 28px; }
.sec h2 { font-size: 15px; margin: 0 0 12px; color: var(--ink-2); }
.empty, .hint { color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }

/* tiles */
.tile { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 12px 16px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 8px; transition: box-shadow .15s, transform .15s, border-color .15s; }
.tile:hover { border-color: var(--line-2); box-shadow: 0 8px 22px rgba(15, 23, 42, .08); transform: translateY(-1px); }
.tile.off { opacity: .65; }
.tile-top { align-self: stretch; display: flex; justify-content: space-between; }
.star, .more { width: 30px; height: 30px; border: 0; background: none; border-radius: 8px; cursor: pointer; color: var(--muted); display: grid; place-items: center; }
.star:hover, .more:hover { background: var(--bg); }
.star.on { color: var(--star); }
.art-img { width: 52px; height: 52px; object-fit: contain; }
.art-sym { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.art-sym.desk { color: #0369A1; background: color-mix(in srgb, #0369A1 12%, transparent); }
.tile-name { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.tile-sub { font-size: 12px; color: var(--muted); }
.st.ok { color: var(--ok); } .st.bad { color: var(--bad); }

/* menus, modals, toasts */
.menu { position: absolute; z-index: 30; min-width: 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px; box-shadow: 0 16px 40px rgba(15, 23, 42, .18); display: flex; flex-direction: column; }
.menu button { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 9px 10px; border-radius: 8px; text-align: left; cursor: pointer; }
.menu button:hover:not(:disabled) { background: var(--bg); }
.menu button:disabled { opacity: .45; cursor: default; }
.modal-back { position: fixed; inset: 0; z-index: 40; background: rgba(15, 23, 42, .45); display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; background: var(--panel); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.modal h2 { margin: 0; font-size: 18px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.steps pre { margin: 0; padding: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100% - 32px); background: #111827; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.toast.bad { background: #7F1D1D; }
.toast a { color: #C4B5FD; }

/* HTML5 session page */
body.session { background: #000; overflow: hidden; min-height: 0; height: 100vh; }
#display { position: fixed; inset: 0; display: grid; place-items: center; outline: none; }
#display > div { cursor: default; }
.overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: center; background: rgba(0, 0, 0, .78); color: #fff; padding: 16px; }
.overlay[hidden] { display: none; }
.ov-box { text-align: center; max-width: 440px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ov-box p { margin: 0; font-size: 16px; line-height: 1.5; }
#ov-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
#ov-actions .btn:not(.primary) { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .4); }
.spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: spin 0.9s linear infinite; }
.spin[hidden] { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .top { flex-wrap: wrap; padding: 10px 16px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .brand { flex: 1; }
  .page { padding: 20px 16px 48px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
}
.sbar { position: fixed; z-index: 20; top: 0; left: 50%; transform: translateX(-50%); display: flex; gap: 4px; padding: 6px; background: rgba(17, 24, 39, .92); border-radius: 0 0 12px 12px; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }
.sbar[hidden] { display: none; }
.sb { border: 0; background: transparent; color: #fff; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.sb:hover { background: rgba(255, 255, 255, .12); }
.sb.end { color: #FCA5A5; }
.sb[hidden] { display: none; }
.sfiles { position: fixed; z-index: 21; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.sfile { display: flex; justify-content: space-between; gap: 12px; background: rgba(17, 24, 39, .92); color: #fff; border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.sfile span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sfile.ok b { color: #86EFAC; } .sfile.bad b { color: #FCA5A5; }
.drop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(109, 40, 217, .35); border: 3px dashed #fff; color: #fff; font-size: 18px; font-weight: 600; }
.drop[hidden] { display: none; }

/* sign-in: single sign-on, second factor */
.sso { display: flex; flex-direction: column; gap: 14px; }
.sso[hidden] { display: none; }
.sso a.btn { text-decoration: none; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.btn.link { border: 0; background: none; color: var(--muted); min-height: 32px; text-decoration: underline; }
input.code { letter-spacing: .4em; font-size: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.enrol { display: flex; flex-direction: column; gap: 10px; }
.qr-wrap { display: grid; place-items: center; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.qr { display: block; }
code.key { display: block; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; font-size: 14px; letter-spacing: .06em; overflow-wrap: anywhere; }
.banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 18px; padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); border-radius: 12px; }
.login { grid-template-columns: minmax(0, 1fr); justify-items: center; }
[hidden] { display: none !important; }

/* tenant branding */
.brand-logo { max-height: 56px; max-width: 220px; object-fit: contain; display: block; margin: 0 auto 10px; }
.brand-logo.sm { max-height: 28px; max-width: 120px; margin: 0; display: inline-block; vertical-align: middle; }
.brand-msg { text-align: center; margin: 4px 0 10px; }
.support { text-align: center; margin-top: 14px; }

/* session: toolbar handle, clipboard panel, on-screen keyboard */
.shandle { position: fixed; z-index: 19; top: 0; left: 50%; transform: translateX(-50%); width: 64px; height: 10px; border: 0; border-radius: 0 0 8px 8px; background: rgba(124, 58, 237, .85); cursor: pointer; padding: 0; }
.shandle[hidden] { display: none; }
@media (pointer: coarse) { .shandle { height: 22px; width: 88px; } }
.sb.sel { display: inline-flex; align-items: center; gap: 6px; cursor: default; }
.sb.sel select { background: rgba(255, 255, 255, .12); color: #fff; border: 0; border-radius: 6px; padding: 3px 6px; font-size: 12px; }
.sb.sel option { color: #111827; }
.spanel { position: fixed; z-index: 22; top: 56px; left: 50%; transform: translateX(-50%); width: min(460px, calc(100vw - 32px)); background: rgba(17, 24, 39, .95); color: #E5E7EB;
  border-radius: 12px; padding: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .45); display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.spanel[hidden] { display: none; }
.spanel p { margin: 0; color: #CBD5E1; }
.spanel textarea { width: 100%; border-radius: 8px; border: 1px solid #374151; background: #0B1220; color: #F9FAFB; padding: 8px; font: 13px/1.4 ui-monospace, Consolas, monospace; resize: vertical; }
.spanel .row { display: flex; gap: 8px; justify-content: flex-end; }
.osk { position: fixed; left: -1000px; top: 0; width: 10px; height: 10px; opacity: 0; }

/* session: connection health */
.cbars { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.cbars i { width: 3px; background: rgba(255,255,255,.25); border-radius: 1px; }
.cbars i:nth-child(1) { height: 4px; } .cbars i:nth-child(2) { height: 7px; } .cbars i:nth-child(3) { height: 10px; } .cbars i:nth-child(4) { height: 14px; }
.cbars.b1 i:nth-child(-n+1), .cbars.b2 i:nth-child(-n+2), .cbars.b3 i:nth-child(-n+3), .cbars.b4 i:nth-child(-n+4) { background: #34D399; }
.cbars.s-warn i:nth-child(-n+4) { } .cbars.s-warn.b1 i:nth-child(-n+1), .cbars.s-warn.b2 i:nth-child(-n+2), .cbars.s-warn.b3 i:nth-child(-n+3), .cbars.s-warn.b4 i:nth-child(-n+4) { background: #FBBF24; }
.cbars.s-bad.b1 i:nth-child(-n+1), .cbars.s-bad.b2 i:nth-child(-n+2), .cbars.s-bad.b3 i:nth-child(-n+3), .cbars.s-bad.b4 i:nth-child(-n+4) { background: #FB7185; }
.sb.conn { display: inline-flex; align-items: center; gap: 8px; }
.shandle.s-warn { background: rgba(245, 158, 11, .95); } .shandle.s-bad { background: rgba(244, 63, 94, .95); } .shandle.s-good { background: rgba(16, 185, 129, .9); }
.conn-panel { width: min(520px, calc(100vw - 32px)); }
.conn-head { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #F9FAFB; }
.conn-checks { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow: auto; }
.conn-row { display: grid; grid-template-columns: 12px 1fr; gap: 10px; padding: 7px 2px; border-bottom: 1px solid rgba(255,255,255,.08); }
.conn-row > i { width: 9px; height: 9px; border-radius: 50%; margin-top: 5px; background: #64748B; }
.conn-row.s-good > i { background: #34D399; } .conn-row.s-warn > i { background: #FBBF24; } .conn-row.s-bad > i { background: #FB7185; }
.conn-t { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; } .conn-t span { color: #94A3B8; font-size: 12px; min-width: 150px; } .conn-t b { color: #F3F4F6; font-size: 13px; }
.conn-d { color: #CBD5E1; font-size: 12px; } .conn-a { color: #C4B5FD; font-size: 12px; margin-top: 2px; }
.conn-local { color: #94A3B8; font-size: 12px; }

/* portal: your connection */
.conn-cards { display: flex; flex-direction: column; gap: 10px; }
.conn-card { background: var(--panel, #fff); border: 1px solid var(--line, #E5E7EB); border-left: 4px solid #10B981; border-radius: 14px; overflow: hidden; }
.conn-card.s-warn { border-left-color: #F59E0B; } .conn-card.s-bad { border-left-color: #F43F5E; } .conn-card.s-unknown { border-left-color: #94A3B8; }
.conn-sum { width: 100%; display: flex; align-items: center; gap: 14px; padding: 12px 16px; background: none; border: 0; text-align: left; cursor: pointer; }
.conn-sum .grow { flex: 1; } .conn-sum .link { color: var(--accent); font-weight: 600; }
.conn-card .cbars i { background: #E5E7EB; }
.conn-list { padding: 0 16px 12px; display: flex; flex-direction: column; }
.conn-item { display: grid; grid-template-columns: 12px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line, #E5E7EB); }
.conn-item > i { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; background: #94A3B8; }
.conn-item.s-good > i { background: #10B981; } .conn-item.s-warn > i { background: #F59E0B; } .conn-item.s-bad > i { background: #F43F5E; }
.conn-item .advice { color: var(--accent); margin-top: 2px; }
