:root {
    color-scheme: light;
    --background: #f6f7fb;
    --surface: #fff;
    --surface-soft: #f0f2f8;
    --ink: #192132;
    --muted: #525d71;
    --line: #dce1eb;
    --input-line: #8a96aa;
    --accent: #393eaa;
    --accent-hover: #2b308c;
    --accent-soft: #ededfc;
    --focus: #333ec7;
    --radius: .8rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    line-height: 1.55;
    color: var(--ink);
    background: var(--background);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.75rem, 4vw, 2.25rem); line-height: 1.16; letter-spacing: -.035em; }
h2 { font-size: 1.12rem; line-height: 1.35; letter-spacing: -.012em; margin-bottom: .55rem; }
p + p { margin-top: .6rem; }
.muted, .description, .panel > p { color: var(--muted); }
.small, .field-help { font-size: .875rem; }
.field-help { color: var(--muted); margin-top: -.65rem; }
.description { margin-bottom: 1.45rem; }
.visually-hidden, .skip:not(:focus) {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip:focus { position: fixed; top: .7rem; left: .7rem; z-index: 1; padding: .5rem .9rem; background: #fff; }

.brand {
    display: inline-flex; gap: .65rem; align-items: center; width: fit-content;
    color: var(--ink); text-decoration: none; font-weight: 750; letter-spacing: -.025em;
}
.brand-mark {
    position: relative; display: inline-block; width: 1.95rem; height: 1.95rem;
    border-radius: .53rem; background: var(--accent); flex: none;
}
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; }
.brand-mark::before {
    width: .45rem; height: .45rem; left: .49rem; top: .66rem;
    border: solid #fff; border-width: 2px 2px 0 0; transform: rotate(45deg);
}
.brand-mark::after { width: .37rem; height: 2px; top: 1.17rem; left: 1.08rem; background: #fff; }

.guest { display: grid; place-items: center; }
.guest-shell { width: min(100% - 2rem, 33rem); margin: 2rem auto; }
.guest-brand { margin: 0 0 1.15rem .2rem; }
.guest-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) + .2rem);
    box-shadow: 0 10px 40px #1a23410d; padding: clamp(1.2rem, 5vw, 2.3rem);
}
.page-header { margin-bottom: 1rem; }
.guest-card .page-header { margin-bottom: .65rem; }
.back-form { margin-top: .9rem; text-align: center; }

.stack { display: grid; gap: 1rem; }
.stack > .button, .stack > button { justify-self: start; }
fieldset { min-width: 0; margin: 0; padding: .9rem 0 .35rem; border: 0; border-top: 1px solid var(--line); display: grid; gap: .85rem; }
legend { font-weight: 700; padding: 0 .45rem 0 0; }
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(5rem, .45fr); gap: .85rem; }
label { display: grid; gap: .35rem; font-size: .93rem; font-weight: 600; }
input:not([type="hidden"]), select {
    width: 100%; min-height: 2.7rem; padding: .55rem .7rem;
    border: 1px solid var(--input-line); border-radius: .45rem;
    background: var(--surface); color: var(--ink); font: inherit; font-size: 1rem; font-weight: 400;
}
input.code-input, code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
button, .button {
    display: inline-flex; justify-content: center; align-items: center;
    min-height: 2.65rem; padding: .52rem .88rem; border: 1px solid transparent;
    border-radius: .48rem; background: transparent; color: var(--ink);
    text-align: center; text-decoration: none; font: inherit; font-size: .93rem; font-weight: 650; cursor: pointer;
}
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-hover); color: #fff; }
.secondary { background: var(--surface); border-color: var(--input-line); }
.secondary:hover, .quiet:hover { background: var(--surface-soft); color: var(--ink); }
.full { width: 100%; }
.notice { padding: .7rem .85rem; margin: 0 0 1rem; border-radius: .5rem; background: #ebf4ff; color: #193c73; }
.notice.error { background: #fcecef; color: #8a2139; }
ul.notice { padding-left: 2rem; }
.stack .notice { margin-bottom: 0; }

.signed-in { display: grid; grid-template-columns: 15rem minmax(0, 1fr); }
.sidebar {
    display: flex; flex-direction: column; gap: 1.9rem; position: sticky; top: 0;
    min-width: 0; height: 100vh; overflow: auto; padding: 1.55rem 1.05rem;
    border-right: 1px solid var(--line); background: var(--surface);
}
.sidebar > .brand { margin-left: .4rem; }
.sidebar nav { display: grid; gap: .2rem; }
.sidebar nav a { padding: .56rem .74rem; border-radius: .45rem; font-weight: 600; color: var(--muted); text-decoration: none; }
.sidebar nav a:hover { background: var(--surface-soft); color: var(--ink); }
.sidebar nav [aria-current="page"] { color: var(--accent-hover); background: var(--accent-soft); }
.sidebar-account { margin-top: auto; padding-top: 1rem; border-top: 1px solid var(--line); }
.account-email { font-weight: 650; font-size: .92rem; overflow-wrap: anywhere; }
.sidebar-account button { padding-left: 0; margin-top: .25rem; }
.workspace { min-width: 0; padding: clamp(1rem, 4vw, 3rem); }
.workspace-content { max-width: 72rem; margin-inline: auto; }
.workspace .page-header { padding-bottom: .95rem; border-bottom: 1px solid var(--line); margin-bottom: 1.15rem; }

.panel { padding: clamp(1rem, 2.3vw, 1.55rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.panel > p { margin-bottom: 1rem; }
.empty { padding-block: clamp(2rem, 6vw, 4rem); text-align: center; }
.category-grid, .settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; align-items: start; }
.category { align-self: stretch; display: flex; flex-direction: column; }
.category details { margin-top: auto; }
details { border-top: 1px solid var(--line); padding-top: .65rem; }
summary { cursor: pointer; font-weight: 650; color: var(--accent); }
details ul { padding-left: 1.55rem; margin: .65rem 0 0; font-size: .9rem; }
details form { margin-top: .85rem; }
details form + form { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: .85rem; }
.count { color: var(--muted); margin-left: .25rem; font-size: .8rem; }
.setup-key { overflow-wrap: anywhere; background: var(--surface-soft); border-radius: .45rem; padding: .75rem; }
.recovery-codes { padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: .65rem; }
.recovery-codes li { padding: .5rem .7rem; background: var(--surface-soft); border-radius: .45rem; font-size: .87rem; overflow-wrap: anywhere; }
.user-row { display: grid; gap: .55rem; border-top: 1px solid var(--line); padding-top: .75rem; margin-top: .75rem; }
.user-row p { margin: .14rem 0 0; }
.user-identity { overflow-wrap: anywhere; }

@media (max-width: 57rem) {
    .signed-in { grid-template-columns: 12.5rem minmax(0, 1fr); }
    .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 43rem) {
    .signed-in { display: block; }
    .sidebar { position: static; height: auto; gap: .7rem; padding: .85rem 1rem; border-right: 0; border-bottom: 1px solid var(--line); }
    .sidebar > .brand { margin-left: 0; }
    .sidebar nav { display: flex; flex-wrap: wrap; }
    .sidebar nav a { font-size: .9rem; padding-inline: .57rem; }
    .sidebar-account { display: flex; flex-wrap: wrap; gap: 0 .55rem; align-items: center; padding-top: .45rem; }
    .sidebar-account form { margin-left: auto; }
    .sidebar-account button { margin-top: 0; padding-left: .65rem; }
}
@media (max-width: 31rem) { .category-grid { grid-template-columns: 1fr; } }
