/* Xyphros Studios account UI. Requires theme.css (design tokens). */

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg);
  font-family: var(--font); font-size: 14px; line-height: 1.5; font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
.grain { position: fixed; inset: 0; z-index: 0; pointer-events: none; opacity: var(--grain-opacity); background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.22'/%3E%3C/svg%3E"); }
::selection { background: var(--accent-soft); color: var(--ink); }
a { color: var(--accent-ink); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent-line); outline-offset: 2px; border-radius: var(--radius-sm); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--font-mono); letter-spacing: .1em; text-transform: uppercase; font-size: 10.5px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
code { font-family: var(--font-mono); font-size: .92em; }

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 700; letter-spacing: .1em; }
.brand img { width: 28px; height: 28px; }
.brand small { font-family: var(--font-mono); font-weight: 400; color: var(--muted); font-size: 9.5px; letter-spacing: .18em; margin-left: 5px; }
.eyebrow { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 0 0 12px; }
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--accent); }

/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font: 500 13px/1 var(--font); text-decoration: none; white-space: nowrap;
  cursor: pointer; box-shadow: var(--shadow-sm); transition: background .12s ease, border-color .12s ease, color .12s ease, opacity .12s ease;
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:hover { background: var(--surface-hover); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-contrast); box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, .12); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 40%, var(--line-strong)); }
.modal-actions .btn-danger { background: var(--danger); color: #fff; border-color: transparent; }
.modal-actions .btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--ink); }
.btn-block { width: 100%; height: 40px; font-size: 14px; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn[aria-busy="true"] { color: transparent !important; pointer-events: none; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); border-color: var(--ink) var(--ink) transparent transparent; animation: spin .7s linear infinite; }
.btn-primary[aria-busy="true"]::after, .modal-actions .btn-danger[aria-busy="true"]::after { border-color: #fff #fff transparent transparent; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; position: relative; transition: background .12s ease, color .12s ease; }
.icon-btn:hover { background: var(--surface-hover); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- forms ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; align-content: start; }
.field > label, .label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field .row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.field .row a { font-size: 12.5px; text-decoration: none; }
.input {
  width: 100%; height: 36px; padding: 0 11px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--input);
  color: var(--ink); font: 400 14px var(--font); box-shadow: var(--shadow-sm); transition: border-color .12s ease, box-shadow .12s ease;
}
.input::placeholder { color: var(--faint); }
.input:hover { border-color: color-mix(in srgb, var(--ink) 22%, var(--line-strong)); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--danger-soft); }
.input[readonly] { background: var(--surface-2); color: var(--muted); }
.input-code { font-family: var(--font-mono); font-size: 18px; letter-spacing: .32em; text-align: center; height: 42px; }
.field-error { color: var(--danger); font-size: 12.5px; min-height: 0; }
.field-error:empty { display: none; }
.field-hint { color: var(--muted); font-size: 12.5px; }
.field-hint.ok { color: var(--success); }
.password-wrap { position: relative; }
.password-wrap .input { padding-right: 40px; }
.password-toggle { position: absolute; right: 4px; top: 4px; width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: var(--radius-sm); display: grid; place-items: center; }
.password-toggle:hover { color: var(--ink); background: var(--surface-2); }
.password-toggle svg { width: 16px; height: 16px; }
.requirements { list-style: none; padding: 0; margin: 2px 0 0; display: grid; gap: 4px; font-size: 12.5px; color: var(--muted); }
.requirements li { display: flex; gap: 8px; align-items: center; }
.requirements li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); flex: none; transition: background .2s ease; }
.requirements li.met { color: var(--ink-2); }
.requirements li.met::before { background: var(--success); }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- alerts ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font-size: 13px; line-height: 1.55; }
.alert svg { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.alert-error { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 28%, transparent); color: var(--danger); }
.alert-success { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 28%, transparent); color: var(--success); }
.alert-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 28%, transparent); color: var(--warn); }
.alert-info { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 24%, transparent); color: var(--ink-2); }
.alert-info svg { color: var(--accent-ink); }
.alert a, .alert button.link { color: inherit; font-weight: 600; }
button.link { background: none; border: 0; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; color: var(--accent-ink); }

/* ---------- auth pages (keep the brand artwork) ---------- */
.auth-shell { position: relative; z-index: 1; min-height: 100svh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: radial-gradient(ellipse at 85% 20%, var(--bg-glow), transparent 50%); }
.auth-main { display: flex; flex-direction: column; padding: 32px 48px; }
.auth-top { display: flex; justify-content: space-between; align-items: center; }
.auth-top a.back { color: var(--muted); text-decoration: none; font-size: 13px; }
.auth-top a.back:hover { color: var(--ink); }
.auth-body { flex: 1; display: grid; place-items: center; padding: 48px 0; }
.auth-card { width: min(100%, 380px); animation: rise .4s cubic-bezier(.2, .8, .2, 1) both; }
.auth-card h1 { font-size: clamp(30px, 3.4vw, 38px); line-height: 1.08; letter-spacing: -.035em; font-weight: 600; margin: 0 0 10px; }
.auth-card h1 span { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.auth-card .lead { color: var(--muted); margin: 0 0 26px; font-size: 14px; line-height: 1.65; }
.auth-switch { margin-top: 22px; text-align: center; color: var(--muted); font-size: 13px; }
.auth-switch a { font-weight: 600; text-decoration: none; }
.auth-foot { color: var(--faint); font-size: 11.5px; display: flex; justify-content: space-between; }
.auth-art { position: sticky; top: 0; align-self: start; height: 100svh; overflow: hidden; border-left: 1px solid var(--line); background: radial-gradient(ellipse at 50% 50%, rgba(194, 27, 223, .14), transparent 60%), var(--sidebar); }
.auth-art picture { display: contents; }
/* Orb and orbit rings share one exact centre: the middle of the panel. */
.auth-art .orb, .auth-art .orbit { position: absolute; top: 50%; left: 50%; translate: -50% -50%; }
.auth-art .orb { z-index: 1; display: block; width: min(56%, 360px, 48svh); height: auto; aspect-ratio: 1 / 1; animation: float 7s ease-in-out infinite; filter: drop-shadow(0 25px 70px rgba(192, 25, 222, .2)); }
.auth-art .orbit { width: min(78%, 500px); height: 160px; border: 1px solid rgba(223, 84, 245, .24); border-radius: 50%; transform: rotate(-28deg); }
.auth-art .orbit + .orbit { width: min(66%, 420px); height: 110px; transform: rotate(38deg); border-color: var(--line); }
.auth-art .caption { position: absolute; left: 44px; bottom: 36px; right: 44px; color: var(--muted); }
.auth-art .caption strong { display: block; color: var(--ink); font-size: 19px; letter-spacing: -.02em; font-weight: 600; margin-bottom: 6px; }
.otp-hint { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--faint); margin: 6px 0; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.turnstile-box { min-height: 65px; }
.state-icon { width: 44px; height: 44px; border-radius: var(--radius-lg); display: grid; place-items: center; background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--accent-ink); margin-bottom: 20px; }
.state-icon svg { width: 20px; height: 20px; }

@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-main { padding: 20px 16px; }
  .auth-body { padding: 32px 0; }
}

/* ---------- dashboard shell ---------- */
.app-shell { position: relative; z-index: 1; display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100svh; }
.sidebar { position: sticky; top: 0; height: 100svh; display: flex; flex-direction: column; gap: 18px; padding: 14px 12px 12px; border-right: 1px solid var(--line); background: var(--sidebar); overflow-y: auto; }
.sidebar .brand { height: 36px; padding: 0 8px; }
.nav { display: grid; gap: 1px; }
.nav a { display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 10px; border-radius: var(--radius); color: var(--muted); text-decoration: none; font-weight: 500; font-size: 13.5px; transition: background .12s ease, color .12s ease; }
.nav a svg { width: 16px; height: 16px; flex: none; }
.nav a:hover { color: var(--ink); background: var(--surface-hover); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.nav a[aria-current="page"] svg { color: var(--accent-ink); }
.subnav { display: grid; gap: 1px; margin: 2px 0 8px 17px; padding-left: 10px; border-left: 1px solid var(--line); }
.subnav a { height: 30px; padding: 0 10px; font-size: 13px; font-weight: 400; }
.subnav a[aria-current="page"] { color: var(--ink); font-weight: 500; background: transparent; box-shadow: inset 2px 0 0 var(--accent); border-radius: 0 var(--radius) var(--radius) 0; margin-left: -11px; padding-left: 21px; }
.sidebar-foot { margin-top: auto; display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.sidebar-foot .btn-ghost { justify-content: flex-start; height: 32px; padding: 0 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius); }
.user-chip .avatar { width: 28px; height: 28px; font-size: 12px; }
.user-chip .who { min-width: 0; flex: 1; }
.user-chip .who strong { display: block; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .who span { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 22%, var(--surface)); color: var(--accent-ink); border: 1px solid var(--accent-line); font-weight: 600; font-size: 13px; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-lg { width: 56px; height: 56px; font-size: 21px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; padding: 0 32px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); }
.topbar .crumbs { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; min-width: 0; }
.topbar .crumbs .mono { font: 400 13.5px var(--font); letter-spacing: 0; text-transform: none; }
.topbar .crumbs b { color: var(--ink); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
#user-btn .avatar { width: 32px; height: 32px; border: 0; }
.menu-btn { display: none; }
.badge-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
.content { width: 100%; max-width: 1180px; margin: 0 auto; padding: 32px 32px 72px; }
.content:focus { outline: none; } /* focused programmatically after navigation, for screen readers */
.page-head { margin-bottom: 24px; }
.page-head .eyebrow { display: none; } /* the breadcrumb already shows the section */
.page-head h1 { margin: 0; font-size: 24px; letter-spacing: -.025em; line-height: 1.2; font-weight: 600; }
.page-head h1 span { color: inherit; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 660px; line-height: 1.6; }
.page-head p code { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1px 5px; }
.hello { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.hello h1 { margin: 0; font-size: 24px; letter-spacing: -.025em; line-height: 1.2; font-weight: 600; }
.hello p { margin: 4px 0 0; color: var(--muted); }
.hello .greet { margin: 0 0 2px; font-size: 13px; color: var(--muted); }
.view { animation: fade .16s ease both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- cards & grids ---------- */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { --pad: 20px; position: relative; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: var(--pad); box-shadow: var(--shadow-sm); transition: border-color .12s ease, background .12s ease; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.card-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.card-foot { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.card > .card-foot:last-child { margin: 20px calc(-1 * var(--pad)) calc(-1 * var(--pad)); padding: 12px var(--pad); border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card + .card { margin-top: 16px; }
.grid > .card { margin-top: 0; }
.welcome { overflow: hidden; }
.welcome-row { display: flex; align-items: center; gap: 16px; }
.welcome h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; font-weight: 600; }
.welcome p { margin: 3px 0 0; color: var(--muted); }
.kv { display: grid; grid-template-columns: minmax(140px, 190px) minmax(0, 1fr); gap: 0; margin: 0; font-size: 13.5px; }
.kv dt, .kv dd { padding: 10px 0; border-top: 1px solid var(--line); }
.kv dt { padding-right: 16px; }
.kv dt:first-of-type, .kv dt:first-of-type + dd { border-top: 0; padding-top: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.kv code, code.id { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px; border-radius: var(--radius-sm); }
.stat { display: flex; align-items: center; gap: 12px; }
.stat-icon { width: 34px; height: 34px; flex: none; border-radius: var(--radius); display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.stat-icon svg { width: 16px; height: 16px; }
.stat-icon.ok { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 25%, transparent); color: var(--success); }
.stat-icon.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 25%, transparent); color: var(--warn); }
.stat-icon.accent { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 25%, transparent); color: var(--accent-ink); }
.stat strong { display: block; font-size: 13.5px; font-weight: 600; }
.stat span { color: var(--muted); font-size: 12.5px; }
a.card { transition: border-color .12s ease, background .12s ease; }
a.card:hover { border-color: var(--line-strong); background: var(--surface-hover); }

/* status badge (sharp, sentence case) */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--radius-sm); font: 500 12px/1 var(--font); letter-spacing: 0; text-transform: none; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--success-soft); color: var(--success); border-color: color-mix(in srgb, var(--success) 25%, transparent); }
.pill.warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.pill.accent { background: var(--accent-soft); color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 25%, transparent); }
.pill.off { color: var(--muted); }
.pill.off::before { background: var(--faint); }

.list { display: grid; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; padding-top: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row strong { display: block; font-size: 13.5px; font-weight: 500; }
.list-row span.sub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; overflow-wrap: anywhere; }

/* ---------- app cards ---------- */
.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.app-card { display: flex; flex-direction: column; gap: 14px; text-decoration: none; color: inherit; cursor: pointer; }
.app-card:hover { border-color: var(--line-strong); background: var(--surface-hover); }
.app-card .top { display: flex; align-items: flex-start; justify-content: space-between; }
.app-icon { width: 40px; height: 40px; border-radius: var(--radius-lg); display: grid; place-items: center; background: var(--accent); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16); overflow: hidden; flex: none; }
.app-icon svg { width: 20px; height: 20px; }
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-card h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.app-card p { margin: 4px 0 0; color: var(--muted); line-height: 1.55; font-size: 13px; }
.app-card .meta { color: var(--muted); font-size: 12.5px; }
.app-card .actions { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.app-mini { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); text-decoration: none; color: inherit; transition: border-color .12s ease, background .12s ease; }
.app-mini:hover { border-color: var(--line-strong); background: var(--surface-hover); }
.app-mini .app-icon { width: 32px; height: 32px; border-radius: var(--radius); }
.app-mini .app-icon svg { width: 16px; height: 16px; }
.app-mini strong { display: block; font-size: 13.5px; font-weight: 500; }
.app-mini span { color: var(--muted); font-size: 12.5px; }
.app-mini .go { margin-left: auto; color: var(--faint); display: grid; }
.app-mini .go svg { width: 16px; height: 16px; }
.future-note { border-style: dashed; box-shadow: none; display: flex; align-items: center; gap: 14px; color: var(--muted); background: transparent; font-size: 13px; }

/* ---------- theme chooser ---------- */
.theme-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.theme-option { position: relative; border: 1px solid var(--line-strong); border-radius: var(--radius-lg); padding: 8px; background: var(--surface); cursor: pointer; text-align: left; color: var(--ink); font: inherit; transition: border-color .12s ease, box-shadow .12s ease; }
.theme-option:hover { border-color: color-mix(in srgb, var(--ink) 25%, var(--line-strong)); }
.theme-option[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-preview { height: 88px; border-radius: var(--radius); overflow: hidden; display: grid; grid-template-columns: 28% 1fr; border: 1px solid rgba(128, 128, 128, .22); }
.theme-preview i { display: block; }
.tp-dark .s { background: #0c0c0f; border-right: 1px solid #222228; } .tp-dark .m { background: #0a0a0c; position: relative; }
.tp-light .s { background: #f6f6f7; border-right: 1px solid #e6e6e9; } .tp-light .m { background: #fafafa; position: relative; }
.tp-system .s { background: linear-gradient(135deg, #f6f6f7 50%, #0c0c0f 50%); } .tp-system .m { background: linear-gradient(135deg, #fafafa 50%, #0a0a0c 50%); position: relative; }
.theme-preview .m::after { content: ""; position: absolute; left: 10px; top: 12px; width: 44%; height: 7px; border-radius: 2px; background: #9333d6; box-shadow: 0 16px 0 -1px rgba(128, 128, 128, .4), 0 29px 0 -1px rgba(128, 128, 128, .28); }
.theme-option .name { display: flex; justify-content: space-between; align-items: center; padding: 10px 4px 2px; font-weight: 500; font-size: 13.5px; }
.theme-option .check { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; }
.theme-option[aria-checked="true"] .check { background: var(--accent); border-color: var(--accent); color: #fff; }
.theme-option .check svg { width: 10px; height: 10px; }

/* ---------- discord ---------- */
.discord-card { display: flex; align-items: center; gap: 14px; }
.discord-avatar { width: 48px; height: 48px; border-radius: 50%; background: #5865f2; display: grid; place-items: center; color: #fff; overflow: hidden; flex: none; }
.discord-avatar img { width: 100%; height: 100%; object-fit: cover; }
.discord-avatar svg { width: 24px; height: 24px; }
.discord-mark { width: 36px; height: 36px; border-radius: var(--radius-lg); background: #5865f2; color: #fff; display: grid; place-items: center; flex: none; }
.discord-mark svg { width: 20px; height: 20px; }

/* ---------- 2FA ---------- */
.setup-steps { display: grid; gap: 20px; counter-reset: step; }
.setup-step { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 14px; }
.setup-step::before { counter-increment: step; content: counter(step); width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--ink-2); font: 500 12px var(--font-mono); }
.setup-step h4 { margin: 2px 0 4px; font-size: 14px; font-weight: 600; }
.setup-step p { margin: 0 0 10px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.qr { width: 176px; height: 176px; padding: 10px; border-radius: var(--radius-lg); background: #fff; border: 1px solid var(--line); }
.qr svg { width: 100%; height: 100%; display: block; }
.secret { font-family: var(--font-mono); font-size: 13px; letter-spacing: .12em; word-break: break-all; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink-2); }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 16px; max-width: 460px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-2); }
.codes code { font-family: var(--font-mono); font-size: 13.5px; letter-spacing: .06em; padding: 4px 0; color: var(--ink); }

/* ---------- skeleton / empty / misc ---------- */
.skeleton { position: relative; overflow: hidden; background: var(--skeleton); border-radius: var(--radius); }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 12px; margin: 8px 0; }
.sk-block { height: 120px; border-radius: var(--radius-lg); }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); font-size: 13px; }
.empty .empty-icon { width: 36px; height: 36px; margin: 0 auto 12px; border-radius: var(--radius-lg); display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.empty .empty-icon svg { width: 17px; height: 17px; }
.empty strong { display: block; color: var(--ink); font-weight: 500; font-size: 13.5px; margin-bottom: 2px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 28px 0 12px; }
.section-title h2 { margin: 0; font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.section-title a { font-size: 13px; text-decoration: none; font-weight: 500; }
.avatar-edit { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.avatar-edit .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* popover */
.popover { position: absolute; right: 0; top: calc(100% + 8px); width: 320px; max-width: calc(100vw - 32px); border-radius: var(--radius-lg); border: 1px solid var(--line-strong); background: var(--panel); box-shadow: var(--shadow); padding: 4px; z-index: 30; animation: fade .12s ease both; }
.popover header { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.popover header strong { font-size: 13px; font-weight: 600; }
.popover .empty { padding: 22px 12px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; height: 32px; padding: 0 10px; border-radius: var(--radius); color: var(--ink-2); text-decoration: none; background: none; border: 0; font: 500 13px var(--font); cursor: pointer; text-align: left; }
.menu-item:hover { background: var(--surface-hover); color: var(--ink); }
.menu-item svg { width: 15px; height: 15px; color: var(--muted); }
.menu-item.danger, .menu-item.danger svg { color: var(--danger); }
.anchor { position: relative; }

/* dialog */
dialog.modal { border: 1px solid var(--line-strong); border-radius: var(--radius-xl); padding: 0; width: min(440px, calc(100vw - 32px)); background: var(--panel); color: var(--ink); box-shadow: var(--shadow); overflow: hidden; }
dialog.modal::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: pop .16s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-body { padding: 20px; }
.modal-body h3 { margin: 0 0 6px; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.modal-body p { margin: 0 0 16px; color: var(--muted); line-height: 1.6; font-size: 13.5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--surface-2); }

/* toasts */
.toasts { position: fixed; z-index: 60; bottom: 20px; right: 20px; display: grid; gap: 8px; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-lg); background: var(--panel); border: 1px solid var(--line-strong); box-shadow: var(--shadow); font-size: 13px; font-weight: 500; animation: pop .18s ease both; }
.toast svg { width: 16px; height: 16px; flex: none; }
.toast.ok svg { color: var(--success); }
.toast.err svg { color: var(--danger); }

.scrim { display: none; }

/* ---------- roles & admin area ---------- */
.role-badge { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; height: 20px; padding: 0 7px 0 6px; border-radius: var(--radius-sm); font: 600 11.5px/1 var(--font); letter-spacing: .01em; color: var(--accent-ink); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.role-badge svg { width: 12px; height: 12px; }
.role-founder { color: #fff; background: var(--accent); border-color: transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16); }
h1 .role-badge, h2 .role-badge, strong .role-badge { margin-left: 8px; position: relative; top: -2px; }
.chip-role { font-weight: 600; color: var(--accent-ink); }
.metric { display: flex; flex-direction: column; gap: 4px; }
.metric-label { font: 500 12.5px var(--font); letter-spacing: 0; text-transform: none; color: var(--muted); }
.metric strong { font-size: 26px; font-weight: 600; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.metric-sub { color: var(--muted); font-size: 12.5px; }
.metric-warn strong { color: var(--warn); }
.metric-inline { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--line); }
.metric-inline span { font: 500 12px var(--font); letter-spacing: 0; text-transform: none; color: var(--muted); }
.metric-inline strong { font-size: 17px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.search { position: relative; flex: 1 1 260px; max-width: 420px; }
.search svg { position: absolute; left: 10px; top: 50%; width: 15px; height: 15px; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .input { padding-left: 32px; height: 34px; }
.chips { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.chip { height: 28px; border: 0; background: transparent; color: var(--muted); border-radius: var(--radius-sm); padding: 0 10px; font: 500 12.5px/1 var(--font); cursor: pointer; transition: background .12s ease, color .12s ease; }
.chip:hover { color: var(--ink); }
.chip[aria-checked="true"] { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
a.row-link { color: inherit; text-decoration: none; border-radius: var(--radius); margin: 0 -8px; padding-left: 8px; padding-right: 8px; transition: background .12s ease; }
a.row-link:hover { background: var(--surface-hover); }
a.row-link:first-child { padding-top: 12px; }
a.row-link:hover + a.row-link, a.row-link:hover { border-top-color: transparent; }
.list-row .go { color: var(--faint); display: grid; }
.list-row .go svg, .row-icon { width: 16px; height: 16px; flex: none; color: var(--muted); }
.list-row .app-icon { width: 32px; height: 32px; border-radius: var(--radius); }
.list-row .app-icon svg { width: 16px; height: 16px; }
.table-wrap { margin: 0 calc(-1 * var(--pad)); overflow-x: auto; border-top: 1px solid var(--line); }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--muted); padding: 9px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table th:first-child, .table td:first-child { padding-left: var(--pad); }
.table th:last-child, .table td:last-child { padding-right: var(--pad); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr[data-href] { cursor: pointer; transition: background .1s ease; }
.table tbody tr[data-href]:hover { background: var(--surface-hover); }
.table .user-cell { display: flex; align-items: center; gap: 10px; }
.table .user-cell .avatar { width: 28px; height: 28px; font-size: 12px; }
.table .user-cell strong { display: block; font-weight: 500; }
.table .user-cell span { display: block; color: var(--muted); font-size: 12.5px; }
.table a.cell-link { color: inherit; text-decoration: none; }
.table .muted-cell { color: var(--muted); }
.table .go { color: var(--faint); width: 32px; }
.table .go svg { width: 16px; height: 16px; display: block; }
.table-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; padding: 12px var(--pad) 0; margin: 0 calc(-1 * var(--pad)); border-top: 1px solid var(--line); }
.pager { display: flex; align-items: center; gap: 8px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 500; }
.back-link:hover { color: var(--ink); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 32%, var(--line)); }
.danger-zone .card-head { margin-bottom: 0; align-items: center; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: 272px; transform: translateX(-102%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
  .app-shell.nav-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .app-shell.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .5); }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 24px 16px 56px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .theme-options { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .kv dd { border-top: 0; padding-top: 0; }
  .kv dt:first-of-type + dd { padding-top: 0; }
  .codes { grid-template-columns: 1fr; }
  .card { --pad: 16px; }
  .welcome-row { align-items: flex-start; }
  .list-row { flex-wrap: wrap; }
  .topbar .crumbs .mono { display: none; }
  .metric strong { font-size: 22px; }
  .danger-zone .card-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .hello .avatar-lg { width: 44px; height: 44px; font-size: 17px; }
  .table .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ---------- maintenance ---------- */
.mt-shell { min-height: 100svh; display: grid; grid-template-rows: auto 1fr auto; gap: 24px; padding: 28px 32px; background: radial-gradient(ellipse at 50% 35%, var(--bg-glow), transparent 55%); }
.mt-card { align-self: center; justify-self: center; width: min(100%, 560px); text-align: center; animation: rise .4s cubic-bezier(.2, .8, .2, 1) both; }
.mt-status { display: inline-flex; align-items: center; gap: 8px; height: 26px; padding: 0 10px; border-radius: var(--radius); border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); background: var(--warn-soft); color: var(--warn); font-size: 12.5px; font-weight: 500; }
.mt-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; animation: mt-pulse 1.8s ease-out infinite; }
@keyframes mt-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--warn) 55%, transparent); } 100% { box-shadow: 0 0 0 8px transparent; } }
.mt-card h1 { margin: 18px 0 8px; font-size: clamp(34px, 5vw, 48px); font-weight: 600; letter-spacing: -.035em; line-height: 1.05; }
.mt-lead { margin: 0 auto; max-width: 420px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.mt-countdown { display: flex; justify-content: center; align-items: flex-start; gap: 10px; margin: 22px 0 10px; }
.mt-countdown i { font-style: normal; font: 500 28px/56px var(--font-mono); color: var(--faint); }
.mt-unit { display: grid; gap: 8px; justify-items: center; }
.mt-unit b { display: grid; place-items: center; min-width: 72px; height: 64px; padding: 0 10px; border-radius: var(--radius-lg); border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow-sm); font: 600 32px/1 var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.mt-unit span { color: var(--muted); font-size: 12px; }
.mt-until { margin: 6px 0 0; color: var(--faint); font-size: 12.5px; }
.mt-message { margin: 22px auto 0; max-width: 460px; padding: 12px 14px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font-size: 13.5px; line-height: 1.6; }
.mt-foot { display: flex; justify-content: space-between; color: var(--faint); font-size: 12.5px; }
.mt-foot a { color: var(--muted); text-decoration: none; }
.mt-foot a:hover { color: var(--ink); }
.mt-banner { display: flex; align-items: center; gap: 10px; padding: 9px 32px; background: var(--warn-soft); border-bottom: 1px solid color-mix(in srgb, var(--warn) 28%, transparent); color: var(--warn); font-size: 13px; }
.mt-banner svg { width: 15px; height: 15px; flex: none; }
.mt-banner span { flex: 1; }
.mt-banner a { color: inherit; font-weight: 600; }
.mt-row { display: flex; align-items: center; gap: 14px; }
.mt-row .grow { flex: 1; min-width: 0; }
.mt-row strong { display: block; font-size: 14px; font-weight: 600; }
.mt-row .sub { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.mt-clock { font: 500 13px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 2px 6px; }
.mt-icon { width: 40px; height: 40px; border-radius: var(--radius-lg); display: grid; place-items: center; flex: none; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.mt-icon svg { width: 18px; height: 18px; }
.mt-icon img { width: 26px; height: 26px; }
.mt-on .mt-icon { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
@media (max-width: 920px) { .mt-banner { padding: 9px 16px; } }
@media (max-width: 560px) {
  .mt-shell { padding: 20px 16px; }
  .mt-countdown { gap: 6px; }
  .mt-countdown i { font-size: 20px; line-height: 50px; }
  .mt-unit b { min-width: 0; width: 62px; height: 52px; font-size: 24px; padding: 0; }
  .mt-row { flex-wrap: wrap; }
}
.modal-body .form:has(.field-inline) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.modal-body .form:has(.field-inline) .field:not(.field-inline) { grid-column: 1 / -1; }
.mt-notify { margin-top: 26px; }
.mt-notify-form { width: min(100%, 420px); margin: 0 auto; }
.mt-notify-row { display: flex; gap: 8px; }
.mt-notify-row .input { flex: 1; min-width: 0; }
.mt-notify-hint { margin: 8px 0 0; color: var(--faint); font-size: 12.5px; }
.mt-notify-hint.err { color: var(--danger); }
.mt-notify-done { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 9px 12px; border-radius: var(--radius-lg); border: 1px solid color-mix(in srgb, var(--success) 28%, transparent); background: var(--success-soft); color: var(--success); font-size: 13.5px; }
@media (max-width: 560px) { .mt-notify-row { flex-direction: column; } }
.check-field { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.check-field:hover { border-color: var(--line-strong); }
.check-field:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.check-field input { width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--accent); flex: none; }
.check-field strong { display: block; font-size: 13.5px; font-weight: 500; }
.check-field small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 1px; }
.mt-link { display: inline-flex; align-items: center; gap: 6px; }
.mt-link svg { width: 14px; height: 14px; color: var(--accent-ink); }
