:root {
  color-scheme: dark;
  --bg: #031225;
  --bg-deep: #020b16;
  --surface: #071b31;
  --surface-raised: #0a213a;
  --border: #29435d;
  --border-soft: #18324c;
  --text: #f3f7fb;
  --muted: #9fb0c3;
  --accent: #65d9ae;
  --accent-strong: #8ae8c5;
  --danger: #ff8f97;
  --focus: #b8f5df;
  --radius: 10px;
  --sidebar: 238px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; overflow-x: clip; }
body { margin: 0; min-width: 320px; min-height: 100vh; overflow-x: clip; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button, a, input, select { outline: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { box-shadow: 0 0 0 3px rgba(184,245,223,.35); border-color: var(--focus); }
button { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; left: 12px; top: -60px; background: var(--accent); color: #00170f; padding: 10px 14px; border-radius: 6px; }
.skip-link:focus { top: 12px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); display: flex; flex-direction: column; border-right: 1px solid var(--border); background: var(--bg-deep); }
.brand { min-height: 112px; display: flex; align-items: center; gap: 13px; padding: 28px 30px; font-size: 30px; letter-spacing: -.03em; }
.brand--centered { justify-content: center; min-height: auto; padding: 0; }
.brand__mark { width: 37px; height: 37px; fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; opacity: .92; }
.navigation { display: grid; gap: 4px; padding: 12px 0; }
.navigation__item { min-height: 62px; display: flex; align-items: center; gap: 17px; padding: 0 28px; border-left: 4px solid transparent; color: var(--text); text-decoration: none; font-size: 15px; }
.navigation__item:hover { background: rgba(255,255,255,.035); }
.navigation__item.is-active { border-left-color: var(--accent); background: rgba(255,255,255,.06); }
.navigation__item svg, h2 svg, .button svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sidebar__footer { margin-top: auto; padding: 20px 28px 28px; border-top: 1px solid var(--border-soft); display: grid; gap: 22px; }
.apple-account { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.apple-account__icon { color: var(--text); font-size: 12px; }
.text-button { border: 0; background: transparent; padding: 0; text-align: left; color: var(--muted); cursor: pointer; font-size: 14px; }
.text-button:hover { color: var(--text); }

.main-content { grid-column: 2; width: min(100%, 1080px); padding: 46px 54px 80px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 30px; margin-bottom: 50px; }
h1 { margin: 0; font-size: clamp(30px, 4vw, 40px); letter-spacing: -.035em; line-height: 1.08; }
.page-header p { margin: 11px 0 0; color: var(--muted); font-size: 16px; }
.button { min-height: 45px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--border); border-radius: 5px; padding: 0 17px; background: transparent; color: var(--text); cursor: pointer; font-size: 14px; font-weight: 550; }
.button:hover { border-color: var(--accent); }
.button--outline { border-color: var(--accent); color: var(--accent-strong); }
.button--primary { background: var(--accent); border-color: var(--accent); color: #002117; }
.button--primary:hover { background: var(--accent-strong); color: #001a12; }
.button--quiet { background: rgba(255,255,255,.025); }
.button--danger { border-color: rgba(255,143,151,.5); color: var(--danger); }
.button:disabled { opacity: .45; cursor: not-allowed; }

.section { scroll-margin-top: 24px; margin-bottom: 52px; }
.section__header { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
h2 { margin: 0; display: flex; align-items: center; gap: 13px; font-size: 21px; letter-spacing: -.02em; }
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.data-table th { height: 46px; padding: 0 10px; border-bottom: 1px solid var(--border); color: var(--muted); text-align: left; font-size: 12px; font-weight: 500; white-space: nowrap; }
.data-table td { min-height: 72px; padding: 15px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; font-size: 14px; }
.data-table th:first-child, .data-table td:first-child { padding-left: 0; }
.data-table th:last-child, .data-table td:last-child { padding-right: 0; text-align: right; }
.accounts-table th:nth-child(1) { width: 25%; }.accounts-table th:nth-child(2) { width: 21%; }.accounts-table th:nth-child(3) { width: 18%; }.accounts-table th:nth-child(4) { width: 27%; }.accounts-table th:nth-child(5) { width: 9%; }
.rooms-table th:nth-child(1) { width: 23%; }.rooms-table th:nth-child(2) { width: 17%; }.rooms-table th:nth-child(3),.rooms-table th:nth-child(4),.rooms-table th:nth-child(5) { width: 11%; text-align: center; }.rooms-table th:nth-child(6) { width: 17%; }.rooms-table th:nth-child(7) { width: 10%; }
.rooms-table td:nth-child(3),.rooms-table td:nth-child(4),.rooms-table td:nth-child(5) { text-align: center; }
.primary-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.account-avatar, .room-avatar { width: 39px; height: 39px; border: 1px solid var(--accent); border-radius: 50%; display: grid; place-items: center; color: var(--accent); flex: none; }
.room-avatar { border-color: var(--border); color: var(--muted); font-size: 18px; }
.cell-stack { display: grid; gap: 4px; min-width: 0; }
.cell-stack strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-stack small { color: var(--muted); font-size: 12px; }
.status { display: inline-flex; align-items: center; gap: 8px; }
.status::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); box-shadow: 0 0 0 3px rgba(159,176,195,.13); }
.status--ready::before { background: var(--accent); box-shadow: 0 0 0 3px rgba(101,217,174,.14); }
.storage { display: grid; gap: 7px; }
.storage__label { color: var(--muted); font-size: 12px; }
.progress { height: 6px; background: #20384f; border-radius: 9px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.row-actions { display: inline-flex; gap: 4px; }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 5px; display: inline-grid; place-items: center; background: transparent; color: var(--muted); cursor: pointer; font-size: 26px; }
.icon-button:hover { color: var(--text); background: rgba(255,255,255,.05); }
.empty-state { margin: 0; padding: 28px 0; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 14px; }

.toggle { position: relative; display: inline-flex; width: 42px; height: 24px; }
.toggle input, .permission-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { width: 42px; height: 24px; border-radius: 999px; background: #132a41; border: 1px solid #577087; position: relative; transition: .16s ease; cursor: pointer; }
.switch::after { content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; border-radius: 50%; background: #f5f8fb; transition: transform .16s ease; }
input:checked + .switch { background: var(--accent); border-color: var(--accent); }
input:checked + .switch::after { transform: translateX(18px); }
input:focus-visible + .switch { box-shadow: 0 0 0 3px rgba(184,245,223,.35); }
.retention-select { min-height: 38px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); color: var(--text); padding: 0 28px 0 10px; font-size: 13px; }

.access-section > h2 { margin-bottom: 23px; }
.access-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 17px; padding: 0 0 26px; border-bottom: 1px solid var(--border); }
.access-row__indicator { width: 52px; height: 52px; border: 1px solid var(--border); border-radius: 50%; position: relative; }
.access-row__indicator::after { content: ""; position: absolute; inset: 17px; border-radius: 50%; background: var(--muted); }
.access-row.is-active .access-row__indicator { border-color: var(--accent); }.access-row.is-active .access-row__indicator::after { background: var(--accent); }
.access-row strong { color: var(--muted); }.access-row.is-active strong { color: var(--accent); }
.access-row p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.security-note { scroll-margin-top: 24px; padding-top: 4px; color: var(--muted); }
.security-note h2 { color: var(--text); font-size: 18px; }.security-note p { max-width: 680px; line-height: 1.6; font-size: 13px; }

.private-access { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 30%, #0a2845 0, var(--bg) 46%, var(--bg-deep) 100%); }
.private-access__panel { width: min(100%, 430px); padding: 42px; border: 1px solid var(--border); background: rgba(3,18,37,.94); border-radius: var(--radius); text-align: center; }
.private-access h1 { margin-top: 35px; font-size: 30px; }.private-access p { color: var(--muted); line-height: 1.6; }
.apple-button { min-height: 48px; margin-top: 24px; display: flex; align-items: center; justify-content: center; gap: 10px; border-radius: 6px; background: #fff; color: #050505; text-decoration: none; font-weight: 650; }
.apple-button svg { width: 20px; height: 20px; fill: currentColor; }

.dialog { width: min(92vw, 520px); padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.dialog::backdrop { background: rgba(0,6,14,.78); }
.dialog form, .dialog__body { padding: 28px; }
.dialog__header, .drawer__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.dialog__header h2, .drawer__header h2 { font-size: 24px; }.dialog__header p, .drawer__header p { margin: 8px 0 0; color: var(--muted); line-height: 1.5; font-size: 13px; }
.dialog label, .drawer label:not(.permission-row) { display: block; margin: 26px 0 8px; color: var(--muted); font-size: 13px; }
input, select { width: 100%; min-height: 46px; border: 1px solid var(--border); border-radius: 5px; background: #06182a; color: var(--text); padding: 0 13px; }
.dialog__actions, .drawer__actions { margin-top: 26px; display: flex; justify-content: flex-end; gap: 12px; }
.account-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; }
.account-connect { min-height: 34px; padding: 0 10px; border: 1px solid var(--border); border-radius: 5px; background: transparent; color: var(--accent-strong); cursor: pointer; font: inherit; font-size: 12px; }
.account-connect:hover { border-color: var(--accent); }
.device-code { margin-top: 26px; padding: 22px; display: grid; gap: 8px; justify-items: center; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); }
.device-code span, .device-code small { color: var(--muted); font-size: 12px; }
.device-code strong { color: var(--accent-strong); font-size: clamp(28px, 7vw, 40px); letter-spacing: .18em; font-variant-numeric: tabular-nums; }
.dialog--wide { width: min(94vw, 680px); }
.verification-devices { margin-top: 22px; display: grid; gap: 9px; }
.verification-device { width: 100%; padding: 14px 16px; display: flex; justify-content: space-between; gap: 16px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text); cursor: pointer; text-align: left; }
.verification-device:hover { border-color: var(--accent); }.verification-device small { color: var(--muted); }
.verification-wait { min-height: 150px; display: grid; place-content: center; justify-items: center; gap: 18px; color: var(--muted); text-align: center; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.verification-warning { margin: 24px 0 18px; color: var(--muted); text-align: center; }
.sas-emojis { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.sas-emoji { min-width: 0; padding: 12px 5px; display: grid; gap: 7px; justify-items: center; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); }
.sas-emoji strong { font-size: 28px; }.sas-emoji small { color: var(--muted); font-size: 10px; text-align: center; overflow-wrap: anywhere; }
.sas-decimals { margin-top: 16px; display: flex; justify-content: center; gap: 16px; color: var(--accent-strong); font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.form-error { min-height: 20px; margin: 9px 0 0; color: var(--danger); font-size: 12px; }

.drawer-backdrop { position: fixed; z-index: 30; inset: 0; background: rgba(0,6,14,.55); }
.drawer { position: fixed; z-index: 31; inset: 0 0 0 auto; width: min(100%, 430px); padding: 30px; overflow-y: auto; border-left: 1px solid var(--border); background: var(--surface); transform: translateX(100%); transition: transform .2s ease; }
.drawer.is-open { transform: translateX(0); }
.room-picker { max-height: 240px; margin-top: 12px; overflow-y: auto; border: 1px solid var(--border); border-radius: 5px; }
.room-picker__item { width: 100%; min-height: 58px; display: flex; align-items: center; gap: 11px; border: 0; border-bottom: 1px solid var(--border-soft); padding: 9px 12px; background: transparent; color: var(--text); text-align: left; cursor: pointer; }
.room-picker__item:last-child { border-bottom: 0; }.room-picker__item:hover,.room-picker__item.is-selected { background: rgba(101,217,174,.08); }
.permission-fieldset { margin: 28px 0 0; padding: 0; border: 0; border-top: 1px solid var(--border); }
.permission-fieldset legend { padding: 25px 0 8px; font-weight: 650; }
.permission-row { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 18px; cursor: pointer; }
.permission-row span:first-child { display: grid; gap: 5px; }.permission-row small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.drawer__actions { position: sticky; bottom: -30px; margin: 30px -30px -30px; padding: 20px 30px 30px; background: var(--surface); border-top: 1px solid var(--border); }
.toast { position: fixed; z-index: 50; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(90vw, 560px); padding: 12px 17px; border: 1px solid var(--accent); border-radius: 6px; background: #082238; box-shadow: 0 12px 40px rgba(0,0,0,.35); font-size: 13px; }

.consent-page { min-height: 100vh; background: radial-gradient(circle at 50% 18%, #0a2b49 0, var(--bg) 46%, var(--bg-deep) 100%); }
.consent-shell { width: min(100% - 32px, 620px); margin: 0 auto; padding: 42px 0 70px; }
.consent-shell > .brand { min-height: auto; margin-bottom: 28px; padding: 0; justify-content: center; }
.consent-card { padding: clamp(24px, 6vw, 42px); border: 1px solid var(--border); border-radius: var(--radius); background: rgba(3,18,37,.96); box-shadow: 0 24px 80px rgba(0,0,0,.28); }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.consent-card h1 { margin: 0; font-size: clamp(26px, 5vw, 36px); letter-spacing: -.035em; }
.consent-intro { margin: 14px 0 26px; color: var(--muted); line-height: 1.55; }
.consent-client { display: flex; align-items: center; gap: 14px; padding: 17px; border: 1px solid var(--border); border-radius: 7px; background: var(--surface-2); }
.consent-client__mark { width: 42px; height: 42px; display: grid; place-items: center; flex: none; border: 1px solid var(--accent); border-radius: 50%; color: var(--accent); font-size: 22px; }
.consent-client > span:last-child { min-width: 0; display: grid; gap: 4px; }
.consent-client strong, .consent-client small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.consent-client small { color: var(--muted); font-size: 11px; }
.consent-permissions { margin-top: 28px; }
.consent-permissions h2 { font-size: 16px; }
.consent-permissions ul { margin: 14px 0 0; padding-left: 22px; color: var(--muted); line-height: 1.6; font-size: 13px; }
.consent-accounts { margin: 28px 0 0; padding: 0; border: 0; }
.consent-accounts legend { margin-bottom: 12px; font-weight: 650; }
#account-list { display: grid; gap: 9px; }
.consent-account { min-height: 64px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); cursor: pointer; }
.consent-account:hover { border-color: var(--accent); }
.consent-account input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.consent-account__radio { width: 18px; height: 18px; flex: none; border: 1px solid #7590a7; border-radius: 50%; box-shadow: inset 0 0 0 4px var(--surface-2); }
.consent-account input:checked + .consent-account__radio { background: var(--accent); border-color: var(--accent); }
.consent-account input:focus-visible + .consent-account__radio { outline: 3px solid rgba(184,245,223,.35); }
.consent-account > span:last-child { display: grid; gap: 4px; }
.consent-account small { color: var(--muted); font-size: 12px; }
.consent-notice { margin: 24px 0 0; padding: 14px 16px; border-left: 3px solid var(--accent); background: rgba(101,217,174,.06); color: var(--muted); font-size: 12px; line-height: 1.55; }
.consent-actions { margin-top: 25px; display: flex; justify-content: flex-end; gap: 12px; }

@media (max-width: 920px) {
  :root { --sidebar: 76px; }
  .brand { padding: 22px 19px; }.brand span,.navigation__item:not(.is-active) span { display: none; }
  .brand__mark { width: 36px; }.navigation__item { justify-content: center; padding: 0; font-size: 0; }.navigation__item svg { width: 24px; height: 24px; }
  .sidebar__footer { padding: 20px; }.apple-account span:not(.apple-account__icon),.text-button { font-size: 0; }.text-button::before { content: "↪"; font-size: 22px; }
  .main-content { padding-inline: 30px; }
}

@media (max-width: 680px) {
  :root { --sidebar: 0px; }
  .app-shell { display: block; }.sidebar { position: static; width: 100%; height: auto; border-right: 0; border-bottom: 1px solid var(--border); }.brand { min-height: 72px; padding: 16px 20px; }.brand span { display: inline; font-size: 24px; }
  .navigation { grid-template-columns: repeat(5, 1fr); padding: 0; }.navigation__item { min-height: 52px; border-left: 0; border-bottom: 3px solid transparent; }.navigation__item.is-active { border-bottom-color: var(--accent); }.sidebar__footer { display: none; }
  .main-content { width: 100%; padding: 28px 18px 60px; }.page-header { display: grid; margin-bottom: 36px; }.page-header .button { width: 100%; }
  .section__header { align-items: flex-start; flex-direction: column; }.section__header .button { width: 100%; }
  .table-wrap { width: 100%; max-width: 100%; margin-inline: 0; padding-inline: 0; overflow-x: auto; overflow-y: hidden; }.data-table { min-width: 760px; }
  .access-row { grid-template-columns: auto 1fr; }.access-row .button { grid-column: 1 / -1; width: 100%; }
  .private-access__panel { padding: 30px 22px; }.drawer { width: 100%; }
  .consent-shell { padding-top: 26px; }.consent-actions { display: grid; grid-template-columns: 1fr 1fr; }.consent-actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) { *,*::before,*::after { scroll-behavior: auto !important; transition: none !important; } }
