:root {
    --ink: #1a1424;
    --muted: #6b6478;
    --paper: #f7f6f9;
    --sheet: #ffffff;
    --line: #e6e2ee;
    --seal: #6d3bb5;
    --seal-deep: #2a1644;
    --gold: #f4ecfb;
    --gold-ink: #5c3488;
    --danger: #9f1239;
    --ok: #1f6b4a;
    --shadow-line: rgba(42, 22, 68, 0.06);
    font-family: "IBM Plex Sans Thai", Thonburi, sans-serif;
    color: var(--ink);
    background: var(--paper);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-size: 16px; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--seal); }
::selection { background: #e8dcf4; }

.auth-body {
    background:
        radial-gradient(1200px 480px at 85% -10%, rgba(109, 59, 181, 0.08), transparent 60%),
        var(--paper);
}

.auth {
    display: grid;
    grid-template-columns: minmax(320px, 0.95fr) 1.05fr;
    min-height: 100vh;
}

.brand {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(720px 420px at 12% 18%, rgba(244, 236, 251, 0.18), transparent 55%),
        radial-gradient(520px 360px at 88% 88%, rgba(42, 22, 68, 0.45), transparent 60%),
        linear-gradient(160deg, #5a2fa0 0%, var(--seal) 42%, var(--seal-deep) 100%);
    color: #fbfaff;
    padding: 48px 48px 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    animation: brand-in 0.45s ease both;
}
.brand::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), transparent 28%),
        repeating-linear-gradient(
            -18deg,
            transparent 0 18px,
            rgba(255, 255, 255, 0.025) 18px 19px
        );
    pointer-events: none;
}
.brand::after {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, #f4ecfb, rgba(244, 236, 251, 0.35));
}
.brand > * { position: relative; z-index: 1; }
.brand-top { display: grid; gap: 0; }
.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    margin-bottom: 22px;
    background: rgba(251, 250, 255, 0.12);
    border: 1px solid rgba(251, 250, 255, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
}
.brand-name {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}
.kicker {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--gold);
}
.brand h1 {
    margin: 14px 0 0;
    font-size: 34px;
    font-weight: 600;
    line-height: 1.22;
    letter-spacing: -0.03em;
    color: rgba(251, 250, 255, 0.96);
}
.brand-lead { margin: 14px 0 0; font-size: 17px; color: rgba(251, 250, 255, 0.84); }
.principles { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.principles li {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: 12px;
    align-items: start;
    padding: 14px 14px;
    border-radius: 14px;
    background: rgba(251, 250, 255, 0.06);
    border: 1px solid rgba(251, 250, 255, 0.1);
}
.principles span { color: var(--gold); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; padding-top: 2px; }
.principles p { margin: 0; color: rgba(251, 250, 255, 0.92); font-size: 15px; line-height: 1.55; }
.brand-foot { margin: 0; font-size: 13px; color: rgba(251, 250, 255, 0.68); }

.auth-main {
    display: flex;
    align-items: safe center;
    justify-content: center;
    padding: 48px 28px;
    overflow: auto;
}
.auth-card {
    width: min(420px, 100%);
    padding: 28px 28px 26px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(230, 226, 238, 0.95);
    border-radius: 22px;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.8) inset,
        0 18px 40px rgba(42, 22, 68, 0.07);
    animation: card-in 0.4s ease both;
}
.auth-card h2 {
    margin: 6px 0 0;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}
.lede { margin: 8px 0 0; color: var(--muted); line-height: 1.55; }
.auth-card .kicker {
    color: var(--seal);
    letter-spacing: 0.04em;
}
.auth-form { margin-top: 22px; gap: 16px; }
.auth-form .btn-primary {
    margin-top: 4px;
    height: 48px;
    border-radius: 14px;
    font-weight: 600;
    transition: background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
    box-shadow: 0 10px 20px rgba(109, 59, 181, 0.18);
}
.auth-form .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 24px rgba(109, 59, 181, 0.22);
}
.auth-form .btn-primary:active { transform: translateY(0); }
.auth-form .btn-primary[disabled] {
    opacity: 0.72;
    cursor: wait;
    transform: none;
    box-shadow: none;
}
.field-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}
.field-link {
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}
.field-link:hover { text-decoration: underline; }
.auth-context {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--gold);
    border: 1px solid #e6dcf2;
    display: grid;
    gap: 2px;
}
.auth-context-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--gold-ink);
}
.auth-context strong {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
}
.auth-note {
    margin: 20px 0 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: #f3f1f6;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}
.auth-register {
    margin: 18px 0 0;
    text-align: center;
    font-size: 14px;
    color: var(--muted);
}
.auth-register a {
    font-weight: 600;
    text-decoration: none;
}
.auth-register a:hover { text-decoration: underline; }
.auth-card:has(.register-name) {
    width: min(520px, 100%);
}
.auth-form .register-name {
    grid-template-columns: 100px minmax(0, 1fr) minmax(0, 1fr);
}
.auth-form select {
    height: 48px;
    border-radius: 14px;
    padding: 0 14px;
    background: #fff;
}
.verify-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    padding: 12px 20px;
    background: #fff7ed;
    border-bottom: 1px solid #f0d7b4;
    color: #9a3412;
}
.verify-bar-text {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.verify-bar-text strong {
    font-size: 14px;
    font-weight: 600;
}
.verify-bar-text span {
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
}
.verify-bar form { margin: 0; }
.verify-bar .btn-primary {
    background: #c2410c;
    box-shadow: none;
}
.verify-bar .btn-primary:hover { background: #9a3412; }
.verify-debug {
    display: block;
    margin-top: 4px;
    font-size: 13px;
}
.verify-debug a {
    color: #9a3412;
    font-weight: 700;
}

.settings-summary {
    margin-bottom: 18px;
}
.settings-summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.settings-summary-row h2 {
    margin: 0 0 4px;
    font-size: 17px;
}
.settings-summary-row .meta { margin: 0; }
.settings-form { margin: 0; }
.settings-sheet .form-block { padding-left: 0; padding-right: 0; }
.settings-actions { margin-top: 8px; padding-top: 18px; border-top: 1px solid var(--line); }
.toggle-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #faf9fc;
    cursor: pointer;
}
.toggle-row:hover { border-color: #d9d0e6; background: #f6f3fb; }
.toggle {
    position: relative;
    width: 48px;
    height: 28px;
    flex: none;
    margin-top: 2px;
}
.toggle input {
    position: absolute;
    opacity: 0;
    inset: 0;
    margin: 0;
    cursor: pointer;
}
.toggle-ui {
    display: block;
    width: 48px;
    height: 28px;
    border-radius: 999px;
    background: #d9d4e2;
    transition: background 0.18s ease;
}
.toggle-ui::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 3px rgba(42, 22, 68, 0.18);
    transition: transform 0.18s ease;
}
.toggle input:checked + .toggle-ui { background: var(--seal); }
.toggle input:checked + .toggle-ui::after { transform: translateX(20px); }
.toggle input:focus-visible + .toggle-ui {
    outline: 2px solid var(--seal);
    outline-offset: 2px;
}
.toggle-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}
.toggle-copy strong {
    font-size: 14px;
    font-weight: 600;
}
.toggle-copy .meta { margin: 0; }
.help-link {
    display: inline-block;
    margin-top: 2px;
    font-size: 13px;
    color: var(--seal);
    text-decoration: none;
}
.help-link:hover { text-decoration: underline; }
.settings-readonly {
    display: grid;
    gap: 12px;
    margin: 0;
}
.settings-readonly > div {
    display: grid;
    gap: 2px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #faf9fc;
    border: 1px solid var(--line);
}
.settings-readonly dt {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}
.settings-readonly dd {
    margin: 0;
    font-size: 14px;
    word-break: break-all;
}
.auth-card .flash { margin-top: 16px; margin-bottom: 0; }
.auth-card .flash + .form,
.auth-card .lede + .form,
.auth-card .auth-context + .form { margin-top: 18px; }
.auth-card .flash + .flash { margin-top: 10px; }

@keyframes brand-in {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: none; }
}
@keyframes card-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .brand, .auth-card, .auth-form .btn-primary { animation: none; transition: none; }
}

.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.workspace { display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.side {
    background: var(--seal-deep);
    box-shadow: inset 0 3px 0 var(--gold);
    color: #fbfaff;
    display: flex;
    flex-direction: column;
    padding: 22px 14px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.topbar {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    box-shadow: inset 0 3px 0 var(--seal);
    border-bottom: 1px solid var(--line);
}
.topbar-start, .topbar-actions { display: flex; align-items: center; min-width: 0; }
.topbar-start { gap: 12px; flex: 1; }
.topbar-actions { gap: 8px; flex: none; }
.topbar-title {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.02em;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar form { margin: 0; display: flex; }
.notify { position: relative; }
.bell, .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
}
.bell { position: relative; width: 40px; padding: 0; }
.bell:hover, .bell[aria-expanded="true"], .menu-btn:hover { border-color: #d9d0e6; background: #f6f3fb; }
.bell:focus-visible, .menu-btn:focus-visible {
    outline: 2px solid var(--seal);
    outline-offset: 2px;
}
.bell-count {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    line-height: 16px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}
.account-menu { position: relative; margin-left: 4px; }
.account {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    max-width: 280px;
    height: 40px;
    padding: 0 10px 0 4px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
}
.account:hover, .account[aria-expanded="true"] { background: #f6f3fb; }
.account:focus-visible { outline: 2px solid var(--seal); outline-offset: 2px; }
.account-mark {
    width: 32px;
    height: 32px;
    flex: none;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--seal);
    color: #fbfaff;
    font-size: 14px;
    font-weight: 600;
}
.account-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.account-meta strong {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.25;
}
.account-role {
    flex: none;
    padding: 2px 8px;
    border-radius: 999px;
    background: #f3eaf8;
    color: var(--gold-ink);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}
.account-caret { flex: none; color: var(--muted); }
.account[aria-expanded="true"] .account-caret { transform: rotate(180deg); }
.account-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 8;
    width: min(260px, calc(100vw - 24px));
    background: var(--sheet);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(26, 20, 36, 0.12);
    padding: 8px;
}
.account-panel[hidden] { display: none; }
.account-panel-name, .account-panel-role { margin: 0 8px; }
.account-panel-name { font-size: 14px; font-weight: 600; }
.account-panel-role { margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.account-links { display: grid; padding-top: 8px; border-top: 1px solid var(--line); }
.account-links a, .account-logout {
    display: flex;
    align-items: center;
    width: 100%;
    min-height: 40px;
    padding: 0 10px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}
.account-links a:hover { background: #f4f0f8; }
.account-panel form { display: block; margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--line); }
.account-logout { color: var(--danger); }
.account-logout:hover { background: #fdf6f7; }
.notify-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 8;
    width: min(320px, calc(100vw - 24px));
    background: var(--sheet);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(28, 25, 21, 0.12);
    padding: 8px;
}
.notify-panel[hidden] { display: none; }
.notify-head { margin: 4px 8px 8px; font-size: 14px; font-weight: 600; }
.notify-empty { margin: 4px 8px 8px; color: var(--muted); font-size: 14px; }
.notice-list { list-style: none; margin: 0; padding: 0; }
.notice-list a {
    display: block;
    padding: 10px 8px;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
}
.notice-list a:hover { background: #f4f0f8; }
.notice-list strong, .notice-list span { display: block; }
.notice-list strong { font-weight: 500; }
.notice-list span { color: var(--muted); font-size: 13px; }
.menu-btn {
    display: none;
    width: 40px;
    flex: none;
    border-radius: 12px;
    padding: 0;
}
.menu-icon, .menu-icon::before, .menu-icon::after {
    display: block;
    width: 16px;
    height: 2px;
    background: var(--ink);
    border-radius: 1px;
    position: relative;
}
.menu-icon::before, .menu-icon::after { content: ""; position: absolute; left: 0; }
.menu-icon::before { top: -5px; }
.menu-icon::after { top: 5px; }
.nav-backdrop { display: none; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}
.side-brand {
    display: flex;
    gap: 12px;
    align-items: center;
    text-decoration: none;
    color: inherit;
    margin: 0 6px 8px;
    padding: 4px 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.side-brand strong, .side-brand em { display: block; font-style: normal; }
.side-brand strong { font-size: 16px; font-weight: 600; }
.side-brand em { margin-top: 1px; font-size: 12px; color: rgba(251, 250, 255, 0.72); }
.seal {
    width: 42px; height: 42px; flex: none;
    border: 1.5px solid var(--gold);
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 11px; letter-spacing: 0.08em; color: var(--gold);
}
.nav {
    display: grid;
    align-content: start;
    gap: 2px;
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding-top: 8px;
}
.nav-label {
    margin: 18px 12px 8px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(244, 236, 251, 0.58);
}
.nav-label:first-child { margin-top: 4px; }
.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    color: rgba(251, 250, 255, 0.82);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
}
.nav a span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nav a svg { flex: none; opacity: 0.8; }
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav a:hover svg { opacity: 1; }
.nav a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.nav a.active {
    background: #432866;
    color: #fff;
    box-shadow: inset 3px 0 0 var(--gold);
}
.nav a.active svg { opacity: 1; color: var(--gold); }
.side-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding: 14px 8px 2px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    text-decoration: none;
    color: inherit;
}
.side-user strong, .side-user > span span { display: block; }
.side-user strong {
    font-size: 14px;
    font-weight: 500;
    max-width: 168px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.side-user > span span { color: rgba(251, 250, 255, 0.82); font-size: 12px; }
.side-avatar {
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--seal);
    color: #f7f4fb;
    font-size: 14px;
    font-weight: 600;
}
.side-user:hover .side-avatar { background: #7d4cb8; }
.site-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 28px;
    padding: 16px 24px;
    background: var(--sheet);
    color: var(--muted);
    font-size: 13px;
    border-top: 1px solid var(--line);
}
.site-footer p { margin: 0; }
.footer-brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.footer-brand strong, .footer-brand > span span { display: block; }
.footer-brand strong { color: var(--ink); font-size: 14px; font-weight: 600; }
.footer-mark {
    width: 34px;
    height: 34px;
    flex: none;
    border: 1.5px solid var(--seal);
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: var(--seal);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.06em;
}
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-left: auto; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--seal); }
.footer-links a:focus-visible { outline: 2px solid var(--seal); outline-offset: 3px; }
.footer-year { font-variant-numeric: tabular-nums; }

.page { flex: 1; width: 100%; padding: 24px 24px 40px; }
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 22px;
}
.page-head h1, .sheet h1 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -0.03em; line-height: 1.25; }
.page-head p, .sub { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.eyebrow { margin: 0 0 4px; font-size: 13px; font-weight: 500; color: var(--seal); }
.back { display: inline-block; margin-bottom: 8px; color: var(--muted); text-decoration: none; font-size: 14px; }
.back:hover { color: var(--seal); }

.note {
    border-left: 3px solid var(--seal);
    background: #f6f3fb;
    padding: 12px 14px;
    margin-bottom: 22px;
    color: #2a2433;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}
a.stat, .stat {
    text-decoration: none;
    color: inherit;
    padding: 16px 18px;
    background: var(--sheet);
    border: 1px solid var(--line);
    border-radius: 16px;
}
a.stat:hover { border-color: var(--seal); background: #fff; }
.stat b, a.stat b { display: block; margin-top: 8px; font-size: 32px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.stat span, a.stat span { color: var(--muted); font-size: 14px; }
.stat small, a.stat small { display: block; margin-top: 8px; color: var(--muted); font-size: 13px; }
.stat.is-warn b { color: var(--danger); }
.stat.is-warn { background:#fdf6f7; border-color:#f0d5dc; }
.stat-text { font-size: 22px !important; letter-spacing: -0.02em; }

.portal-hero {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 20px;
    margin-bottom: 18px;
    padding: 24px 26px;
    border-radius: 20px;
    color: #fbfaff;
    background:
        radial-gradient(520px 220px at 12% 20%, rgba(244, 236, 251, 0.18), transparent 55%),
        linear-gradient(135deg, #5a2fa0 0%, var(--seal) 48%, var(--seal-deep) 100%);
    box-shadow: 0 14px 32px rgba(42, 22, 68, 0.14);
    animation: card-in 0.4s ease both;
}
.portal-hero-copy { min-width: 0; }
.portal-hero .eyebrow { color: rgba(244, 236, 251, 0.92); }
.portal-hero h1 {
    margin: 6px 0 0;
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
}
.portal-hero p {
    margin: 8px 0 0;
    color: rgba(251, 250, 255, 0.88);
    line-height: 1.55;
}
.portal-hero-meta {
    display: grid;
    align-content: center;
    gap: 6px;
    min-width: 180px;
    padding: 16px 18px;
    border-radius: 16px;
    background: rgba(251, 250, 255, 0.1);
    border: 1px solid rgba(251, 250, 255, 0.16);
}
.portal-hero-meta span {
    font-size: 12px;
    color: rgba(251, 250, 255, 0.72);
}
.portal-hero-meta strong {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
}
.portal-hero-meta .btn {
    margin-top: 6px;
    justify-self: start;
    color: #fbfaff;
    border-color: rgba(251, 250, 255, 0.28);
    background: rgba(251, 250, 255, 0.08);
}
.portal-hero-meta .btn:hover {
    background: rgba(251, 250, 255, 0.16);
}
.portal-stats { margin-bottom: 18px; }
.portal-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
    gap: 16px;
    align-items: start;
}
.portal-apps .portal-list,
.portal-activity .activity-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    display: grid;
    gap: 10px;
}
.portal-app {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fcfbfd;
}
.portal-app-main {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}
.portal-app-main h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}
.portal-app-main .meta,
.portal-app-main .help { margin: 4px 0 0; }
.portal-app .btn { flex: none; }
.activity-list li {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: start;
    padding: 12px 0;
    border-top: 1px solid var(--line);
}
.activity-list li:first-child { border-top: 0; padding-top: 4px; }
.activity-main { min-width: 0; display: grid; gap: 2px; }
.activity-main strong { font-size: 14px; font-weight: 600; }

.bento { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; align-items:stretch; }
.bento > .block-mix { grid-column:1 / span 2; grid-row:1; }
.bento > .block-apps { grid-column:3 / span 2; grid-row:1; }
.bento > .block-people { grid-column:1 / span 2; grid-row:2; }
.bento > .block-logs { grid-column:3 / span 2; grid-row:2; }
.bento > .panel, .bento > .people-panel { margin:0; }
.bento > .panel { min-width:0; }
a.stat:focus-visible { outline:2px solid var(--seal); outline-offset:3px; }

.columns { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 18px; }
.account-columns { align-items: start; }
.account-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 4px 0 8px;
}
.account-columns .person-form { margin-top: 14px; gap: 16px; }
.account-columns .actions { margin-top: 4px; }
.sheet, .panel {
    background: var(--sheet);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 20px 22px;
}
.panel h2, .sheet h2 { margin: 0; font-size: 17px; font-weight: 600; }
.panel-head, .link-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}
.panel-head a, .link-row a { font-size: 14px; text-decoration: none; }
.panel-head a:hover, .link-row a:hover { text-decoration: underline; }
.section-title { margin: 22px 0 12px; font-size: 16px; font-weight: 600; }

.people, .app-list { list-style: none; margin: 0; padding: 0; }
.people li, .app-list > li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid #e6e2ee;
}
.people li:first-child, .app-list > li:first-child { border-top: 0; padding-top: 6px; }
.people strong, .app-list strong { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 500; }
.person-main, .app-main { min-width: 0; flex: 1; }
.person-main .meta, .app-main .meta { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { color: var(--muted); font-size: 13px; line-height: 1.45; }
.cell-title { display: block; font-size: 14px; font-weight: 500; line-height: 1.4; }
.role-note { margin-left: 8px; color: var(--gold-ink); font-size: 12px; }
.avatar, .app-mark {
    width: 40px;
    height: 40px;
    flex: none;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #f0e6f8;
    color: var(--seal);
    font-weight: 600;
}
.app-mark { background: #f3eaf8; color: var(--gold-ink); font-size: 12px; }
.pill {
    display: inline-flex;
    align-items: center;
    flex: none;
    white-space: nowrap;
    padding: 1px 8px;
    border-radius: 999px;
    background: #f3eaf8;
    color: var(--gold-ink);
    font-size: 12px;
    font-weight: 500;
}
.pill.warn { background: #f8ecec; color: var(--danger); margin-top: 6px; }
.btn-sm { height: 36px; padding: 0 12px; border-radius: 10px; }

.filters { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-bottom: 14px; }
.filters a { color: var(--muted); text-decoration: none; }
.filters a.active { color: var(--ink); border-bottom: 1px solid var(--seal); }
.search { display: flex; gap: 8px; margin-left: auto; }
.search input { height: 40px; }

.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;
}
.dt { display: grid; gap: 12px; }
.dt-bar, .dt-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.dt-size {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 400;
}
.dt-bar select {
    width: auto;
    height: 36px;
    min-width: 72px;
    padding: 0 28px 0 12px;
    border-radius: 10px;
    font-size: 14px;
}
.dt-meta { color: var(--muted); font-size: 14px; }
.dt-gap { color: var(--muted); font-size: 14px; padding: 0 2px; }
.dt-pager { justify-content: flex-end; }
.dt-pages { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dt-nav, .dt-page {
    height: 36px;
    min-width: 36px;
    padding: 0 12px;
    border: 1px solid #ddd6e8;
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    cursor: pointer;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}
.dt-page { padding: 0 10px; font-weight: 500; }
.dt-nav:hover, .dt-page:hover { border-color: var(--seal); color: var(--seal); }
.dt-page.is-current { background: var(--seal); border-color: var(--seal); color: #fbfaff; }
.dt-nav:disabled, .dt-page:disabled { opacity: 0.4; cursor: default; color: var(--muted); border-color: #ddd6e8; }
.dt-nav:focus-visible, .dt-page:focus-visible, .dt-sort:focus-visible {
    outline: 2px solid var(--seal);
    outline-offset: 2px;
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
.data-table { font-size: 14px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid #e6e2ee; vertical-align: middle; }
th { font-size: 13px; font-weight: 500; color: var(--muted); padding: 0; white-space: nowrap; }
th:not(:has(.dt-sort)) { padding: 12px 10px; }
tr:hover td { background: #f8f6fb; }
.col-index {
    width: 1%;
    min-width: 44px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    text-align: right;
    padding-right: 6px;
}
th.col-index { text-align: right; }
.col-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.col-ip {
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
}
.col-actions {
    width: 1%;
    white-space: nowrap;
    text-align: right;
    padding-right: 6px;
}
th.col-actions { text-align: right; }
.row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}
.row-actions form { margin: 0; display: inline-flex; }
.icon-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 1px solid #ddd6e8;
    background: #fff;
    color: var(--muted);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.icon-btn svg {
    width: 17px;
    height: 17px;
    display: block;
}
.icon-btn:hover {
    color: var(--seal);
    border-color: #d0c4e4;
    background: #f6f3fb;
    transform: translateY(-1px);
}
.icon-btn:active { transform: translateY(0); }
.icon-btn:focus-visible {
    outline: 2px solid var(--seal);
    outline-offset: 2px;
}
.icon-btn.is-danger:hover {
    color: var(--danger);
    border-color: #e7cccc;
    background: #fdf6f7;
}
.icon-btn.is-danger:focus-visible { outline-color: var(--danger); }
.dt-sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    margin: 0;
    padding: 12px 10px;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
}
.dt-sort:hover { color: var(--ink); }
.dt-icon { width: 14px; height: 14px; flex: none; opacity: 0.45; }
.dt-icon path { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
th[aria-sort="ascending"] .dt-sort, th[aria-sort="descending"] .dt-sort { color: var(--seal); }
th[aria-sort="ascending"] .dt-icon, th[aria-sort="descending"] .dt-icon { opacity: 1; }
th[aria-sort="ascending"] .dt-down, th[aria-sort="descending"] .dt-up { display: none; }
.status::before {
    content: "";
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--ok);
    margin-right: 6px;
}
.status.off::before { background: #b7b1a8; }
.event {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    padding: 5px 10px;
    border-radius: 999px;
    background: #f3f1f6;
    color: #4a4456;
}
.event::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted);
    flex: none;
}
.event.ok { background: #e7f3ec; color: #145c38; }
.event.ok::before { background: var(--ok); }
.event.bad { background: #f8ecec; color: var(--danger); }
.event.bad::before { background: var(--danger); }
.event.app { background: #f3eaf8; color: var(--gold-ink); }
.event.app::before { background: var(--seal); }
.log-list { list-style: none; margin: 0; padding: 0; }
.log-list li {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid #e6e2ee;
}
.log-list li:first-child { border-top: 0; padding-top: 0; }
.log-list .meta, td .meta { display: block; }
.chart-panel { margin-bottom: 18px; }
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 4px 0 14px;
    padding: 0;
}
.chart-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 6px 12px 6px 10px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #faf9fc;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.2;
}
.chart-chip-label { color: var(--muted); }
.chart-chip-value {
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}
.chart-chip.login { background: #f6f3fb; border-color: #e4daf2; }
.chart-chip.app { background: #f8f5ff; border-color: #e8dffb; }
.chart-chip.fail { background: #fdf6f7; border-color: #f0d5dc; }
.chart-chip.fail .chart-chip-value { color: var(--danger); }
.swatch {
    width: 9px;
    height: 9px;
    border-radius: 99px;
    flex: none;
    box-shadow: 0 0 0 3px rgba(109, 59, 181, 0.1);
}
.swatch.login { background: #6d3bb5; box-shadow: 0 0 0 3px rgba(109, 59, 181, 0.12); }
.swatch.app { background: #8b5cf6; box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.12); }
.swatch.fail { background: #be123c; box-shadow: 0 0 0 3px rgba(190, 18, 60, 0.1); }
.chart-frame {
    margin: 0 -4px;
    padding: 8px 4px 2px;
    border-radius: 16px;
    background:
        radial-gradient(520px 180px at 8% 0%, rgba(109, 59, 181, 0.05), transparent 60%),
        linear-gradient(180deg, #fcfbfd 0%, #fff 55%);
    border: 1px solid #efeaf6;
}
.daily-chart {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}
.daily-chart .chart-grid {
    stroke: #ebe6f2;
    stroke-width: 1;
    stroke-dasharray: 3 5;
}
.daily-chart .chart-y,
.daily-chart .chart-x,
.daily-chart .chart-value {
    font-family: "IBM Plex Sans Thai", Thonburi, sans-serif;
}
.daily-chart .chart-y {
    fill: #9a93a8;
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}
.daily-chart .chart-x {
    fill: #6b6478;
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.daily-chart .chart-x.is-today {
    fill: #1a1424;
    font-weight: 600;
}
.daily-chart .chart-value {
    font-size: 11px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    opacity: 0.92;
}
.daily-chart .chart-today {
    fill: rgba(109, 59, 181, 0.06);
}
.daily-chart .chart-hit {
    fill: transparent;
    cursor: default;
}
.daily-chart .chart-dot {
    transform-box: fill-box;
    transform-origin: center;
    transition: transform 0.15s ease;
}
.daily-chart .chart-day:hover .chart-dot {
    transform: scale(1.25);
}
.daily-chart .chart-line {
    filter: drop-shadow(0 2px 4px rgba(42, 22, 68, 0.08));
}
.daily-chart .chart-area,
.daily-chart .chart-line,
.daily-chart .chart-dot,
.daily-chart .chart-value {
    animation: chart-in 0.55s ease both;
}
.daily-chart .series-app { animation-delay: 0.06s; }
.daily-chart .series-fail { animation-delay: 0.12s; }
@keyframes chart-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
    .daily-chart .chart-area,
    .daily-chart .chart-line,
    .daily-chart .chart-dot,
    .daily-chart .chart-value { animation: none; }
}
.daily-chart + .log-list { margin-top: 8px; }
.chart-frame + .log-list { margin-top: 12px; }

.form { display: grid; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.field { display: grid; gap: 6px; }
.field.span-2 { grid-column: 1 / -1; }
label { font-size: 14px; font-weight: 500; }
input, select, textarea {
    width: 100%;
    background: #fff;
    border: 1px solid #ddd6e8;
    border-radius: 12px;
    padding: 12px 14px;
    outline: none;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--seal); box-shadow: 0 0 0 3px rgba(109, 59, 181, 0.16); }
input[type="checkbox"], input[type="radio"] {
    width: 18px;
    height: 18px;
    padding: 0;
    flex: none;
    accent-color: var(--seal);
}
.is-invalid { border-color: var(--danger); background: #fbf4f6; }
.help { margin: 0; color: var(--muted); font-size: 13px; }
.help-gap { margin-top: 18px; }
.help-danger { color: var(--danger); }
.help-ok { color: var(--ok); }
.help-muted { color: var(--muted); }
.help-check { min-height: 1.2em; }
.choice-set { border: 0; padding: 0; margin: 0; min-width: 0; }
.choice-set legend { font-size: 14px; font-weight: 500; padding: 0; margin-bottom: 8px; }
.choices { display: flex; flex-wrap: wrap; gap: 16px; }
.person-form { gap: 0; }
.form-block { display: grid; gap: 14px; padding: 18px 0; border-top: 1px solid #e6e2ee; }
.form-block:first-of-type { border-top: 0; padding-top: 0; }
.form-block h2 { margin: 0; font-size: 16px; font-weight: 600; }
.form-block-head { display: grid; gap: 2px; }
.name-row, .pair { display: grid; gap: 14px 12px; }
.name-row { grid-template-columns: 120px minmax(0, 1fr) minmax(0, 1fr); }
.pair { grid-template-columns: 1fr 1fr; }
.segments { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segments-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.segment {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    font-weight: 500;
}
.segment input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}
.segment:has(input:checked) {
    border-color: var(--seal);
    background: #f0e6f8;
    color: var(--seal);
}
.segment:has(input:focus-visible) { outline: 2px solid var(--seal); outline-offset: 2px; }
.app-picks { display: grid; gap: 8px; }
.app-pick, .admin-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
    font-weight: 400;
}
.app-pick strong, .admin-card strong { display: block; font-weight: 500; }
.app-pick small, .admin-card small { display: block; color: var(--muted); font-weight: 400; }
.app-pick > span:not(.app-mark):not(.pill), .admin-card > span { min-width: 0; flex: 1; }
.app-pick.is-auto { background: #f6f2fa; }
.app-pick:has(input:checked), .admin-card:has(input:checked) {
    border-color: var(--seal);
    background: #f0e6f8;
}
.app-pick .pill, .admin-card .pill { margin-left: auto; }
.form-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 4px -22px -20px;
    padding: 14px 22px;
    background: #f7f4fb;
    border-top: 1px solid var(--line);
    border-radius: 0 0 16px 16px;
}
.choices label, .check label, .admin-flag { font-weight: 400; display: flex; gap: 8px; align-items: center; }
.check-list { display: grid; gap: 8px; }
.check-list label {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    font-weight: 400;
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}
.check-list small { display: block; color: var(--muted); }
.secret-input { position: relative; }
.secret-input input { padding-right: 72px; }
.reveal, .copy {
    border: 0;
    background: transparent;
    color: var(--seal);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}
.reveal {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.reveal-icon {
    width: 22px;
    height: 22px;
    display: block;
    fill: currentColor;
}
.reveal:hover { background: #f4ecfb; color: var(--seal-deep); }
.reveal:focus-visible { outline: 2px solid var(--seal); outline-offset: 1px; }
.auth-form input {
    height: 48px;
    padding: 0 14px;
    border-radius: 14px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.secret-input input { padding-right: 52px; }
.auth-form .secret-input input { padding-right: 52px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
}
.btn-primary { background: var(--seal); color: #fbfaff; }
.btn-primary:hover { background: #552f8c; }
.btn-ghost { background: transparent; border-color: #ddd6e8; color: var(--ink); }
.btn-ghost:hover { background: #fff; }
.btn-danger { background: transparent; border-color: #e7cccc; color: var(--danger); }
.btn-block { width: 100%; }
.danger { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.danger p { color: var(--muted); }

.flash { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; }
.flash p { margin: 0; }
.flash p + p { margin-top: 4px; }
.flash-ok { background: #e7f3ec; color: #145c38; }
.flash-error { background: #f8ecec; color: var(--danger); }

.cred {
    display: grid;
    grid-template-columns: 120px 1fr auto;
    gap: 8px 12px;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid #e6e2ee;
}
.cred span { color: var(--muted); font-size: 13px; }
.cred code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 13px;
    word-break: break-all;
}
.empty { padding: 8px 0 4px; }
.empty strong { display: block; margin-bottom: 4px; }

.connect {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    background: var(--sheet);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px 18px;
    margin-bottom: 18px;
}
.connect strong { display: block; font-weight: 600; }
.connect .meta { margin-top: 2px; }
.people-panel { margin-top: 18px; }
.stack-chart { display: block; width: 100%; height: 14px; margin: 14px 0 16px; border-radius: 999px; overflow: hidden; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.bar-label { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
.bar-label b { font-weight: 600; }
.bar-chart { display: block; width: 100%; height: 8px; margin-top: 6px; border-radius: 999px; overflow: hidden; }

@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; }
    .brand {
        min-height: auto;
        padding: 22px 20px 20px;
        gap: 14px;
        animation: none;
    }
    .brand-mark { width: 40px; height: 40px; border-radius: 12px; margin-bottom: 14px; font-size: 12px; }
    .brand-name { font-size: 22px; }
    .brand h1 { font-size: 24px; margin-top: 8px; }
    .brand-lead { margin-top: 8px; font-size: 15px; }
    .principles, .brand-foot { display: none; }
    .auth-main { padding: 20px 16px 32px; align-items: flex-start; }
    .auth-card {
        width: 100%;
        padding: 22px 18px 20px;
        border-radius: 18px;
        animation: card-in 0.4s ease both;
    }
    .auth-card h2 { font-size: 26px; }
    .auth-form .btn-primary { box-shadow: none; }
    .auth-form .btn-primary:hover { transform: none; }
    .shell { grid-template-columns: 1fr; }
    .side {
        position: fixed;
        z-index: 20;
        top: 0;
        left: 0;
        width: min(280px, 86vw);
        transform: translateX(-105%);
        transition: transform 0.18s ease;
        box-shadow: none;
    }
    body.nav-open .side { transform: none; box-shadow: 0 12px 40px rgba(26, 20, 36, 0.28); }
    body.nav-open { overflow: hidden; }
    .nav-backdrop {
        position: fixed;
        z-index: 15;
        inset: 0;
        border: 0;
        padding: 0;
        background: rgba(26, 20, 36, 0.42);
        cursor: pointer;
    }
    body.nav-open .nav-backdrop { display: block; }
    .menu-btn { display: inline-flex; }
    .account { max-width: 280px; }
    .page, .topbar, .site-footer { padding-left: 16px; padding-right: 16px; }
    .page { padding-top: 18px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .portal-hero { flex-direction: column; padding: 20px; }
    .portal-hero h1 { font-size: 28px; }
    .portal-hero-meta { min-width: 0; }
    .portal-layout { grid-template-columns: 1fr; }
    .portal-app { flex-direction: column; align-items: stretch; }
    .portal-app .btn { width: 100%; }
    .bento { grid-template-columns:1fr; }
    .bento > .block-mix, .bento > .block-apps, .bento > .block-people, .bento > .block-logs { grid-column:1 / -1; grid-row:auto; }
    .columns, .grid-2, .cred, .search { grid-template-columns: 1fr; display: grid; }
    .page-head, .connect { align-items: stretch; flex-direction: column; }
    .connect .btn { align-self: flex-start; width: auto; }
    .search { margin-left: 0; }
}
@media (max-width: 640px) {
    .account-meta { display: none; }
    .account { width: 40px; padding: 0; justify-content: center; }
    .bento { grid-template-columns:1fr; }
    .bento > .block-mix, .bento > .block-apps, .bento > .block-people, .bento > .block-logs { grid-column:1 / -1; grid-row:auto; }
    .page-head h1 { font-size: 24px; line-height: 1.3; }
    .name-row, .pair, .auth-form .register-name { grid-template-columns: 1fr; }
    .segments-3 { grid-template-columns: 1fr; }
    .settings-summary-row { flex-direction: column; align-items: stretch; }
    .settings-summary-row .btn { align-self: flex-start; }
    .verify-bar { padding: 12px 16px; }
    .verify-bar .btn { width: 100%; }
    .footer-links { margin-left: 0; }
    .site-footer .footer-year { margin-left: auto; }
}
