:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --surface-subtle: #fcfcfd;
    --text: #121826;
    --text-secondary: #344054;
    --text-muted: #667085;
    --text-subtle: #98a2b3;
    --nav-text: #475467;
    --border: #e4e7ec;
    --border-strong: #d0d5dd;
    --border-hover: #b9c0ca;
    --primary: #3157d5;
    --primary-hover: #2849b8;
    --primary-soft: #eef2ff;
    --primary-soft-border: #dfe5ff;
    --danger: #c4323b;
    --danger-soft: #fff1f2;
    --danger-border: #fecdca;
    --success: #217a4f;
    --success-soft: #ecfdf3;
    --warning: #9a6700;
    --warning-soft: #fffaeb;
    --neutral-soft: #f2f4f7;
    --auth-aside: #111827;
    --auth-aside-text: #ffffff;
    --auth-aside-muted: #c7cedb;
    --auth-aside-subtle: #98a2b3;
    --topbar-bg: rgba(244, 246, 248, .92);
    --overlay: rgba(17, 24, 39, .46);
    --focus-ring: rgba(49, 87, 213, .22);
    --input-focus-ring: rgba(49, 87, 213, .12);
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-md: 0 14px 36px rgba(16, 24, 40, .08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --sidebar-width: 264px;
    --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0d1117;
    --surface: #151b24;
    --surface-muted: #1b2330;
    --surface-subtle: #171e28;
    --text: #f3f6fb;
    --text-secondary: #d6deea;
    --text-muted: #9aa8ba;
    --text-subtle: #748196;
    --nav-text: #aeb9c8;
    --border: #273142;
    --border-strong: #364258;
    --border-hover: #4b5a73;
    --primary: #718cff;
    --primary-hover: #89a0ff;
    --primary-soft: rgba(113, 140, 255, .14);
    --primary-soft-border: rgba(113, 140, 255, .28);
    --danger: #ff7e88;
    --danger-soft: rgba(255, 126, 136, .1);
    --danger-border: rgba(255, 126, 136, .28);
    --success: #59d59a;
    --success-soft: rgba(89, 213, 154, .12);
    --warning: #f2c563;
    --warning-soft: rgba(242, 197, 99, .12);
    --neutral-soft: #202a38;
    --auth-aside: #101722;
    --auth-aside-text: #f7f9fc;
    --auth-aside-muted: #b7c1d0;
    --auth-aside-subtle: #8190a5;
    --topbar-bg: rgba(13, 17, 23, .9);
    --overlay: rgba(0, 0, 0, .62);
    --focus-ring: rgba(113, 140, 255, .34);
    --input-focus-ring: rgba(113, 140, 255, .2);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
    --shadow-md: 0 18px 44px rgba(0, 0, 0, .34);
}

*, *::before, *::after { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); font-family: var(--font); font-size: 15px; -webkit-font-smoothing: antialiased; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--bg); color: var(--text); line-height: 1.5; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }
svg { display: block; }

.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; }
.stack { display: grid; gap: 20px; }
.section-label { color: var(--text-muted); font-size: 12px; font-weight: 650; }

/* Shared brand and controls */
.brand { display: inline-flex; align-items: center; gap: 11px; min-width: 0; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { position: relative; display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border-radius: 10px; background: var(--text); color: var(--surface); }
.brand-mark span { position: absolute; left: 10px; width: 12px; height: 2px; border-radius: 2px; background: currentColor; transform: rotate(-48deg); }
.brand-mark span:first-child { top: 12px; }
.brand-mark span:last-child { top: 19px; }
.brand-copy { display: grid; line-height: 1.05; }
.brand-copy strong { font-size: 15px; font-weight: 760; }
.brand-copy small { margin-top: 5px; color: var(--text-subtle); font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

.icon-button { display: inline-grid; width: 38px; height: 38px; place-items: center; padding: 0; color: var(--text-muted); border: 1px solid var(--border); border-radius: 9px; background: var(--surface); cursor: pointer; transition: 150ms ease; }
.icon-button:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-muted); }
.icon-button:focus-visible, .button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible, .log-tab:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus-ring); }
.icon-button svg, .theme-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
:root[data-theme="light"] .theme-icon-light, :root[data-theme="dark"] .theme-icon-dark { display: none; }

/* Authentication */
.auth-page { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-theme-toggle { position: fixed; z-index: 5; top: 24px; right: 24px; }
.auth-shell { width: min(100%, 1040px); min-height: 650px; display: grid; grid-template-columns: minmax(300px, .9fr) minmax(420px, 1.1fr); overflow: hidden; border: 1px solid var(--border); border-radius: 24px; background: var(--surface); box-shadow: var(--shadow-md); }
.auth-aside { position: relative; display: flex; min-height: 100%; flex-direction: column; justify-content: space-between; padding: 42px; overflow: hidden; background: var(--auth-aside); color: var(--auth-aside-text); }
.auth-aside::before, .auth-aside::after { position: absolute; content: ""; border: 1px solid rgba(255, 255, 255, .08); border-radius: 50%; pointer-events: none; }
.auth-aside::before { width: 340px; height: 340px; right: -165px; bottom: -88px; }
.auth-aside::after { width: 220px; height: 220px; right: -84px; bottom: -28px; }
.auth-brand { position: relative; z-index: 1; display: inline-flex; width: fit-content; align-items: center; gap: 11px; font-size: 15px; font-weight: 750; }
.auth-brand-mark { display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid rgba(255,255,255,.18); border-radius: 10px; background: rgba(255,255,255,.08); font-size: 13px; font-weight: 800; }
.auth-aside-content { position: relative; z-index: 1; max-width: 335px; }
.auth-kicker { display: inline-block; margin-bottom: 14px; color: var(--auth-aside-subtle); font-size: 11px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.auth-aside h2 { margin: 0 0 16px; font-size: clamp(28px, 3vw, 40px); line-height: 1.12; letter-spacing: -.045em; }
.auth-aside p { margin: 0; color: var(--auth-aside-muted); font-size: 16px; line-height: 1.6; }
.auth-aside-footer { position: relative; z-index: 1; color: var(--auth-aside-subtle); font-size: 12px; }
.auth-main { display: grid; align-items: center; padding: 54px clamp(34px, 6vw, 72px); background: var(--surface); }
.auth-card { width: min(100%, 470px); margin: 0 auto; }
.auth-card-head { margin-bottom: 30px; }
.auth-card-head .eyebrow { display: none; }
.auth-card-head h1 { margin: 0; font-size: 30px; font-weight: 730; line-height: 1.15; letter-spacing: -.035em; }
.auth-card-head p { margin: 10px 0 0; color: var(--text-muted); font-size: 14px; line-height: 1.55; }
.auth-switch { margin: 26px 0 0; color: var(--text-muted); font-size: 13px; text-align: center; }
.auth-switch a, .field-label-row a, .back-link { color: var(--primary); font-weight: 650; }
.auth-switch a:hover, .field-label-row a:hover, .back-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Forms */
.form-stack { display: grid; gap: 18px; }
.form-row, .field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 7px; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field label, .field-label-row label { color: var(--text-secondary); font-size: 13px; font-weight: 650; }
.field-label-row a { font-size: 12px; }
input, select { width: 100%; height: 46px; padding: 10px 12px; color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); transition: 150ms ease; }
input::placeholder { color: var(--text-subtle); }
input:hover, select:hover { border-color: var(--border-hover); }
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--input-focus-ring); }
.password-field { position: relative; }
.password-field input { padding-right: 48px; }
.password-reveal { position: absolute; top: 50%; right: 6px; display: grid; width: 34px; height: 34px; place-items: center; padding: 0; color: var(--text-subtle); border: 0; border-radius: 7px; background: transparent; cursor: pointer; transform: translateY(-50%); }
.password-reveal:hover { color: var(--text); background: var(--surface-muted); }
.password-icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.password-icon-hide, .password-reveal[aria-pressed="true"] .password-icon-show { display: none; }
.password-reveal[aria-pressed="true"] .password-icon-hide { display: block; }
.field-optional { margin-left: 6px; color: var(--text-subtle); font-size: 10px; font-weight: 560; }
.field-hint, .field-error { font-size: 12px; line-height: 1.45; }
.field-hint { color: var(--text-subtle); }
.field-error { color: var(--danger); }
.field-error:empty { display: none; }
.form-errors { padding: 11px 13px; color: var(--danger); border: 1px solid var(--danger-border); border-radius: var(--radius-sm); background: var(--danger-soft); font-size: 13px; line-height: 1.45; }
.form-errors:empty, .validation-summary-valid { display: none; }
.form-errors ul { margin: 0; padding-left: 18px; }
.form-actions, .card-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.form-actions.align-start { justify-content: flex-start; }
.card-form-actions { padding-top: 2px; }
.form-note { padding: 12px 14px; color: var(--text-muted); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-muted); font-size: 12px; line-height: 1.5; }
.read-only-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.read-only-field { display: grid; gap: 5px; padding: 13px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-muted); }
.read-only-field span { color: var(--text-muted); font-size: 11px; }
.read-only-field strong { overflow-wrap: anywhere; font-size: 13px; font-weight: 600; }

/* Buttons */
.button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 13px; font-weight: 650; line-height: 1; cursor: pointer; transition: 150ms ease; }
.button:active { transform: translateY(1px); }
.button-block { width: 100%; min-height: 44px; }
.button-small { min-height: 36px; padding: 8px 12px; font-size: 12px; }
.button-primary { color: #fff; background: var(--primary); }
.button-primary:hover { background: var(--primary-hover); }
.button-secondary { color: var(--text-secondary); border-color: var(--border-strong); background: var(--surface); }
.button-secondary:hover { color: var(--text); border-color: var(--border-hover); background: var(--surface-muted); }
.button-danger { color: #fff; background: #c4323b; }
.button-danger:hover { background: #aa2c34; }
.button-danger-quiet { color: var(--danger); border-color: var(--danger-border); background: transparent; }
.button-danger-quiet:hover { background: var(--danger-soft); }

/* Modal */
body.modal-open { overflow: hidden; }
.modal-backdrop { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 20px; background: var(--overlay); }
.modal-backdrop[hidden] { display: none; }
.modal-card { width: min(100%, 480px); overflow: hidden; border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); box-shadow: 0 24px 64px rgba(16, 24, 40, .24); }
.modal-content { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 15px; padding: 24px; }
.modal-content h2 { margin: 1px 0 6px; font-size: 17px; font-weight: 700; line-height: 1.25; letter-spacing: -.02em; }
.modal-content p { margin: 0; color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.modal-icon { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 10px; }
.modal-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.modal-icon-danger { color: var(--danger); border: 1px solid var(--danger-border); background: var(--danger-soft); }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 24px 20px; border-top: 1px solid var(--border); background: var(--surface-subtle); }

/* Application layout */
.app-layout { min-height: 100vh; }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; display: flex; width: var(--sidebar-width); flex-direction: column; border-right: 1px solid var(--border); background: var(--surface); }
.sidebar-header { display: flex; min-height: 78px; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid var(--border); }
.sidebar-close, .sidebar-open { display: none; }
.sidebar-nav { display: grid; gap: 25px; padding: 24px 14px; }
.nav-section { display: grid; gap: 4px; }
.nav-section-label { padding: 0 12px 7px; color: var(--text-subtle); font-size: 10px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.nav-link { display: flex; min-height: 42px; align-items: center; gap: 11px; padding: 0 12px; color: var(--nav-text); border-radius: 9px; font-size: 13px; font-weight: 560; transition: 150ms ease; }
.nav-icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.nav-link:hover { color: var(--text); background: var(--surface-muted); }
.nav-link.active { color: var(--primary); background: var(--primary-soft); font-weight: 650; }
.avatar { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; color: var(--primary); border: 1px solid var(--primary-soft-border); border-radius: 50%; background: var(--primary-soft); font-size: 12px; font-weight: 750; }
.avatar-small { width: 32px; height: 32px; font-size: 11px; }
.main-shell { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; min-height: 70px; align-items: center; justify-content: space-between; padding: 0 30px; border-bottom: 1px solid var(--border); background: var(--topbar-bg); backdrop-filter: blur(12px); }
.topbar-left, .topbar-user { display: flex; align-items: center; gap: 10px; }
.topbar-user { min-width: 0; padding: 6px 8px 6px 12px; border-radius: 10px; transition: background 150ms ease; }
.topbar-user:hover { background: var(--surface); }
.topbar-user-copy { display: grid; min-width: 0; text-align: right; line-height: 1.15; }
.topbar-user-copy strong { max-width: 180px; overflow: hidden; font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user-copy small { margin-top: 4px; color: var(--text-subtle); font-size: 10px; }
.sidebar-backdrop { display: none; }

/* Page system */
.page { width: min(100%, 1180px); margin: 0 auto; padding: 34px 34px 64px; }
.page-heading, .page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading-actions, .page-header-actions { align-items: center; }
.page-heading h1, .page-header h1 { margin: 0; font-size: 26px; font-weight: 720; line-height: 1.15; letter-spacing: -.035em; }
.page-heading p, .page-header p { max-width: 650px; margin: 7px 0 0; color: var(--text-muted); font-size: 13px; }
.eyebrow { margin: 0 0 7px !important; color: var(--text-subtle) !important; font-size: 10px !important; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.back-link { display: inline-block; margin-bottom: 10px; font-size: 12px; }
.content-grid { display: grid; gap: 20px; }
.account-info-grid, .content-grid-main { grid-template-columns: minmax(0, 1.55fr) minmax(280px, .8fr); }
.account-side-stack { align-self: start; }

.card, .panel { overflow: visible; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.card-header, .panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--border); }
.card-header-compact { padding-top: 18px; padding-bottom: 18px; }
.card-header h2, .panel-head h2 { margin: 0; font-size: 14px; font-weight: 680; letter-spacing: -.01em; }
.card-header p, .panel-head p { margin: 5px 0 0; color: var(--text-muted); font-size: 12px; line-height: 1.45; }
.card-body { padding: 22px; }
.compact-body { padding-top: 12px; padding-bottom: 12px; }
.panel { padding: 0; }
.panel-head { margin: 0; }
.panel > .form-stack { padding: 22px; }
.panel-muted { background: var(--surface-muted); }

.profile-block { display: flex; align-items: center; gap: 14px; padding-bottom: 2px; }
.profile-avatar { display: grid; width: 54px; height: 54px; flex: 0 0 auto; place-items: center; color: var(--primary); border: 1px solid var(--primary-soft-border); border-radius: 14px; background: var(--primary-soft); font-size: 16px; font-weight: 760; }
.profile-meta h3 { margin: 0; font-size: 15px; font-weight: 680; }
.profile-meta p { margin: 4px 0 0; color: var(--text-muted); font-size: 12px; }
.detail-list { display: grid; margin: 0; }
.detail-list > div { display: grid; min-height: 46px; grid-template-columns: 110px minmax(0, 1fr); align-items: center; gap: 14px; border-top: 1px solid var(--border); }
.detail-list > div:first-child { border-top: 0; }
.detail-list dt { color: var(--text-muted); font-size: 11px; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; font-size: 12px; font-weight: 600; text-align: right; }
.action-list { display: grid; }
.action-row { display: flex; min-height: 48px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 22px; border-top: 1px solid var(--border); font-size: 12px; font-weight: 620; transition: background 150ms ease; }
.action-row:first-child { border-top: 0; }
.action-row:hover { background: var(--surface-muted); }
.action-row svg { width: 16px; height: 16px; fill: none; stroke: var(--text-subtle); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Notices, badges, quota */
.alert, .notice { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-secondary); background: var(--surface-muted); font-size: 12px; line-height: 1.5; }
.alert { margin-bottom: 20px; }
.alert-success { color: var(--success); border-color: color-mix(in srgb, var(--success), transparent 70%); background: var(--success-soft); }
.alert-error { color: var(--danger); border-color: var(--danger-border); background: var(--danger-soft); }
.alert-neutral { background: var(--surface-muted); }
.notice-primary { margin-bottom: 20px; color: var(--text-secondary); border-color: var(--primary-soft-border); background: var(--primary-soft); }
.badge, .status-pill { display: inline-flex; min-height: 26px; align-items: center; padding: 0 9px; color: var(--text-muted); border: 1px solid var(--border-strong); border-radius: 999px; background: var(--neutral-soft); font-size: 10px; font-weight: 680; white-space: nowrap; }
.badge-success, .status-pill-success { color: var(--success); border-color: color-mix(in srgb, var(--success), transparent 70%); background: var(--success-soft); }
.status-pill-warning { color: var(--warning); border-color: color-mix(in srgb, var(--warning), transparent 68%); background: var(--warning-soft); }
.badge-danger, .status-pill-danger { color: var(--danger); border-color: var(--danger-border); background: var(--danger-soft); }
.quota-card { margin-bottom: 18px; }
.quota-card-body { display: grid; gap: 13px; padding: 17px 20px; }
.quota-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.quota-heading > div { display: grid; gap: 3px; }
.quota-heading strong { font-size: 12px; font-weight: 650; }
.quota-heading span { color: var(--text-muted); font-size: 11px; }
.quota-summary { display: grid; gap: 12px; }
.quota-track { height: 6px; overflow: hidden; border-radius: 999px; background: var(--border); }
.quota-track span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }

/* Tables and account actions */
.data-table-wrap { overflow: visible; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 14px 20px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.data-table th { color: var(--text-muted); background: var(--surface-muted); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.data-table td { color: var(--text-secondary); font-size: 12px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover td { background: color-mix(in srgb, var(--surface-muted), transparent 25%); }
.data-table .account-name { color: var(--text); font-weight: 650; }
.table-action-column { width: 58px; }
.table-action-cell { position: relative; text-align: right !important; }
.account-menu { position: relative; display: inline-block; }
.account-menu summary { list-style: none; }
.account-menu summary::-webkit-details-marker { display: none; }
.menu-button svg { width: 17px; height: 17px; fill: currentColor; stroke: none; }
.account-menu-popover { position: absolute; z-index: 15; top: calc(100% + 7px); right: 0; width: 190px; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-md); text-align: left; }
.account-menu-popover a, .account-menu-popover button { display: flex; width: 100%; min-height: 40px; align-items: center; padding: 0 13px; color: var(--text-secondary); border: 0; background: transparent; font-size: 12px; text-align: left; cursor: pointer; }
.account-menu-popover a:hover, .account-menu-popover button:hover { background: var(--surface-muted); color: var(--text); }
.account-menu-popover form { margin: 0; border-top: 1px solid var(--border); }
.account-menu-popover .danger-menu-action { color: var(--danger); }
.page-support-card { margin-top: 18px; }

/* Empty and pending states */
.empty-state { display: grid; min-height: 310px; place-items: center; align-content: center; padding: 36px; text-align: center; }
.empty-state-icon { display: grid; width: 48px; height: 48px; margin-bottom: 16px; place-items: center; color: var(--primary); border: 1px solid var(--primary-soft-border); border-radius: 13px; background: var(--primary-soft); }
.empty-state-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.empty-state h3, .notice-state h2, .table-empty h2 { margin: 0; font-size: 14px; font-weight: 680; }
.empty-state p, .notice-state p, .table-empty p { max-width: 440px; margin: 7px auto 18px; color: var(--text-muted); font-size: 12px; line-height: 1.55; }
.notice-state { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-muted); text-align: center; }
.notice-state .badge, .notice-state .status-pill { margin-bottom: 12px; }

/* Security */
.security-list { display: grid; }
.security-item { display: grid; min-height: 82px; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 15px; padding: 15px 22px; border-top: 1px solid var(--border); }
.security-item:first-child { border-top: 0; }
.security-icon { display: grid; width: 40px; height: 40px; place-items: center; color: var(--primary); border: 1px solid var(--primary-soft-border); border-radius: 10px; background: var(--primary-soft); }
.security-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.security-copy h3 { margin: 0; font-size: 13px; font-weight: 660; }
.security-copy p { margin: 4px 0 0; color: var(--text-muted); font-size: 11px; line-height: 1.4; }

/* Logs */
.log-tabs { display: flex; width: fit-content; gap: 3px; margin-bottom: 14px; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-muted); }
.log-tab { min-height: 34px; padding: 0 12px; color: var(--text-muted); border: 0; border-radius: 7px; background: transparent; font-size: 11px; font-weight: 620; cursor: pointer; }
.log-tab.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); }
.log-panel { display: none; }
.log-panel.active { display: block; }
.table-head { display: grid; grid-template-columns: 1.1fr .8fr 1fr; gap: 16px; padding: 13px 18px; color: var(--text-muted); border-bottom: 1px solid var(--border); background: var(--surface-muted); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.table-head-game { grid-template-columns: 1fr 1fr .8fr 1fr; }
.table-row { display: grid; grid-template-columns: 1.1fr .8fr 1fr; gap: 16px; padding: 13px 18px; border-bottom: 1px solid var(--border); font-size: 11px; align-items: center; }
.table-row:last-child { border-bottom: 0; }
.table-row-game { grid-template-columns: 1fr 1fr .8fr 1fr; }
.table-empty { min-height: 260px; display: grid; place-items: center; align-content: center; padding: 30px; text-align: center; }

/* Legacy aliases still used by a few pages */
.page-shell { width: min(100%, 1180px); margin: 0 auto; padding: 34px 34px 64px; }
.account-list { display: grid; gap: 10px; }
.game-account-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.game-account-identity { display: flex; align-items: center; gap: 12px; }
.account-glyph { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-muted); font-weight: 700; }
.game-account-identity h2 { margin: 0; font-size: 13px; }
.game-account-identity p { margin: 3px 0 0; color: var(--text-muted); font-size: 11px; }
.game-account-actions { display: flex; gap: 8px; }
.scope-row { display: grid; gap: 4px; padding: 13px 0; border-top: 1px solid var(--border); font-size: 12px; }
.scope-row span { color: var(--text-muted); }

@media (max-width: 960px) {
    .auth-shell { grid-template-columns: 1fr; max-width: 620px; min-height: auto; }
    .auth-aside { min-height: 250px; padding: 32px; }
    .auth-aside-content { margin: 48px 0 24px; }
    .auth-aside h2 { font-size: 30px; }
    .auth-main { padding: 42px 34px; }
    .account-info-grid, .content-grid-main { grid-template-columns: 1fr; }
    .account-side-stack { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .account-side-stack > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
    .data-table-wrap { overflow-x: auto; }
    .sidebar { transform: translateX(-100%); transition: transform 180ms ease; }
    .sidebar-visible .sidebar { transform: translateX(0); }
    .sidebar-close, .sidebar-open { display: inline-grid; }
    .sidebar-backdrop { position: fixed; z-index: 25; inset: 0; background: var(--overlay); }
    .sidebar-visible .sidebar-backdrop { display: block; }
    .main-shell { margin-left: 0; }
    .topbar { padding: 0 18px; }
    .page, .page-shell { padding: 28px 18px 48px; }
    .page-heading, .page-header { align-items: stretch; flex-direction: column; }
    .page-heading-actions, .page-header-actions { align-items: stretch; }
    .page-heading-actions > .button, .page-header-actions > .button { width: 100%; }
    .account-side-stack { grid-template-columns: 1fr; }
    .account-side-stack > :last-child { grid-column: auto; }
    .form-row, .field-grid, .read-only-grid { grid-template-columns: 1fr; }
    .security-item { grid-template-columns: auto minmax(0, 1fr); }
    .security-item > :last-child { grid-column: 1 / -1; margin-left: 55px; justify-self: start; }
    .quota-heading { align-items: flex-start; flex-direction: column; }
    .table-head { display: none; }
}

@media (max-width: 620px) {
    .auth-page { padding: 0; place-items: stretch; }
    .auth-theme-toggle { top: 16px; right: 16px; }
    .auth-shell { width: 100%; min-height: 100vh; border: 0; border-radius: 0; box-shadow: none; }
    .auth-aside { min-height: 210px; padding: 26px 24px; }
    .auth-aside-content { margin: 36px 0 14px; }
    .auth-aside h2 { max-width: 390px; font-size: 26px; }
    .auth-aside p { display: none; }
    .auth-aside-footer { display: none; }
    .auth-main { padding: 34px 24px 46px; }
    .auth-card-head h1 { font-size: 27px; }
    .topbar-user-copy { display: none; }
    .card-header, .panel-head { padding: 18px; }
    .card-body, .panel > .form-stack { padding: 18px; }
    .data-table th, .data-table td { padding: 13px 15px; }
    .modal-backdrop { padding: 14px; }
    .modal-content { padding: 20px; }
    .modal-actions { flex-direction: column-reverse; padding: 14px 20px 18px; }
    .modal-actions .button { width: 100%; }
}

/* v11 page compatibility: visual-only refactor keeps page content and behavior unchanged. */
.panel-head.compact { padding-top: 18px; padding-bottom: 18px; }
.account-profile-panel { max-width: none; }
.account-summary-panel, .security-summary { align-self: start; }
.account-quota-block { display: grid; gap: 12px; margin: 0 22px 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.account-detail-list { padding: 0 22px; }
.quota-value { display: flex; align-items: baseline; gap: 8px; }
.quota-value strong { color: var(--text); font-size: 24px; font-weight: 700; letter-spacing: -.03em; }
.quota-value span, .quota-label { color: var(--text-muted); font-size: 11px; }
.quota-bar { display: grid; grid-template-columns: auto minmax(160px, 1fr) auto; align-items: center; gap: 18px; margin-bottom: 18px; padding: 16px 18px; }
.quota-bar > div:first-child { display: grid; gap: 3px; }
.quota-bar strong { color: var(--text); font-size: 12px; font-weight: 650; }
.quota-track-inline { width: 100%; }
.empty-icon { display: grid; width: 48px; height: 48px; margin-bottom: 16px; place-items: center; color: var(--primary); border: 1px solid var(--primary-soft-border); border-radius: 13px; background: var(--primary-soft); }
.empty-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.security-summary .panel-head { border-bottom: 0; }
.security-summary .scope-row { margin: 0 22px; }
.security-summary .scope-row:last-child { padding-bottom: 20px; }

@media (max-width: 760px) {
    .quota-bar { grid-template-columns: 1fr auto; }
    .quota-track-inline { grid-column: 1 / -1; grid-row: 2; }
    .game-account-card { align-items: stretch; flex-direction: column; }
    .game-account-actions { width: 100%; flex-wrap: wrap; }
    .game-account-actions .button, .game-account-actions form, .game-account-actions form .button { width: 100%; }
}

/* Account Info */
.alert-warning, .notice-warning { color: var(--warning); border-color: color-mix(in srgb, var(--warning), transparent 68%); background: var(--warning-soft); }
.badge-warning { color: var(--warning); border-color: color-mix(in srgb, var(--warning), transparent 68%); background: var(--warning-soft); }
.account-content { width: 100%; display: grid; gap: 20px; }
.account-details-card, .account-personal-card { overflow: hidden; }
.account-info-list, .account-personal-list { padding-top: 4px; padding-bottom: 4px; }
.account-info-row { min-height: 58px; display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 24px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--border); }
.account-info-row:last-child { border-bottom: 0; }
.account-info-label { color: var(--text-muted); font-size: 12px; font-weight: 600; }
.account-info-value { min-width: 0; color: var(--text); font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.account-info-empty { color: var(--text-muted); font-weight: 560; }
.account-info-email { display: flex; align-items: center; gap: 9px; }
.account-info-email > strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 760px) {
    .account-info-row { grid-template-columns: 1fr; gap: 5px; padding: 14px 0; }
    .account-info-email { align-items: flex-start; flex-direction: column; gap: 6px; }
    .account-info-email > strong { white-space: normal; }
}

/* Account menu and account presentation refinement */
.topbar-user-menu { position: relative; }
.topbar-user-menu > summary { list-style: none; cursor: pointer; }
.topbar-user-menu > summary::-webkit-details-marker { display: none; }
.topbar-user-menu[open] .topbar-user { background: var(--surface); }
.topbar-user-chevron { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: var(--text-subtle); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform 150ms ease; }
.topbar-user-menu[open] .topbar-user-chevron { transform: rotate(180deg); }
.topbar-user-popover { position: absolute; z-index: 40; top: calc(100% + 8px); right: 0; width: 238px; overflow: hidden; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); box-shadow: var(--shadow-md); }
.topbar-user-popover nav { display: grid; padding: 6px; }
.topbar-user-popover nav a, .topbar-user-popover form button { display: flex; width: 100%; min-height: 38px; align-items: center; gap: 9px; padding: 0 10px; color: var(--text-secondary); border: 0; border-radius: 7px; background: transparent; font-size: 12px; font-weight: 560; text-align: left; cursor: pointer; }
.topbar-user-popover nav a:hover { color: var(--text); background: var(--surface-muted); }
.topbar-user-popover form { margin: 0; padding: 6px; border-top: 1px solid var(--border); }
.topbar-user-popover form button { color: var(--danger); }
.topbar-user-popover form button:hover { background: var(--danger-soft); }
.topbar-user-popover form svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

.slot-summary { display: flex; min-height: 58px; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; padding: 13px 16px; }
.slot-summary > div { display: flex; align-items: baseline; gap: 10px; }
.slot-summary > div > span { color: var(--text-muted); font-size: 12px; font-weight: 600; }
.slot-summary > div > strong { color: var(--text); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 620px) {
    .topbar-user { padding-left: 7px; }
    .topbar-user-chevron { display: none; }
    .topbar-user-popover { right: -2px; width: min(238px, calc(100vw - 28px)); }
}

/* Compact dismissible alerts */
.flash-stack {
    position: fixed;
    z-index: 1200;
    top: 86px;
    right: 18px;
    display: grid;
    width: min(420px, calc(100vw - 36px));
    gap: 10px;
}

.flash-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
    width: 100%;
    border: 1px solid var(--border-strong);
    border-left-width: 4px;
    border-radius: var(--radius-md);
    background: var(--surface);
    padding: 14px 14px 14px 16px;
    box-shadow: var(--shadow-md);
}

.flash-item-success { border-left-color: var(--success); }
.flash-item-error { border-left-color: var(--danger); }
.flash-item-warning { border-left-color: var(--warning); }
.flash-item-info { border-left-color: var(--primary); }

.flash-item-body {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.flash-item-body strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 680;
}

.flash-item-body span {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.flash-item-close {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    margin: -4px -4px 0 0;
    padding: 0;
    color: var(--text-subtle);
    border: 0;
    border-radius: 6px;
    background: transparent;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.flash-item-close:hover {
    color: var(--text);
    background: var(--surface-muted);
}

.flash-item-close:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--focus-ring);
}

/* Shared panel forms */
.settings-form-card {
    width: 100%;
    overflow: hidden;
}

.settings-form-body {
    padding: 0 22px;
}

.settings-form-body > .form-errors:not(:empty) {
    margin: 20px 0 0;
}

.settings-form-row {
    display: grid;
    grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
    gap: 36px;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--border);
}

.settings-form-row:last-child {
    border-bottom: 0;
}

.settings-form-copy label {
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
}

.settings-form-copy p {
    max-width: 220px;
    margin: 5px 0 0;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.45;
}

.settings-form-control {
    display: grid;
    width: min(100%, 620px);
    gap: 6px;
}

.settings-form-support {
    display: grid;
    gap: 3px;
    padding: 15px 22px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--surface-subtle);
    font-size: 11px;
    line-height: 1.5;
}

.settings-form-support strong {
    color: var(--text);
    font-size: 12px;
    font-weight: 680;
}

.settings-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 17px 22px;
    border-top: 1px solid var(--border);
    background: var(--surface-muted);
}

.settings-form-actions-split {
    justify-content: space-between;
}


@media (max-width: 760px) {
    .flash-stack {
        top: 82px;
        right: 14px;
        width: min(420px, calc(100vw - 28px));
    }

    .settings-form-row {
        grid-template-columns: 1fr;
        gap: 10px;
        align-items: start;
        padding: 18px 0;
    }

    .settings-form-copy p {
        max-width: none;
    }

    .settings-form-control {
        width: 100%;
    }
}
