/* ──────────────────────────────────────────────────────────────────────
   Codex Flash Signup — Claude-inspired UI System
   Light: warm cream paper · Dark: warm charcoal
   Brand accent: Claude coral (#C96442)
   ────────────────────────────────────────────────────────────────────── */

/* ── 1. Design tokens ── */
:root {
    color-scheme: light dark;

    /* Palette — light (default) */
    --paper:            #FAF9F5;
    --paper-soft:       #F5F4EE;
    --paper-sunken:     #EFEEE6;
    --surface:          #FFFFFF;
    --surface-1:        #FCFBF7;
    --surface-2:        #F7F6F0;
    --surface-hover:    #F1EFE7;
    --surface-active:   #E9E6D9;
    --surface-input:    #FBFAF5;
    --line:             #E8E4D6;
    --line-soft:        #EFEBDD;
    --line-strong:      #D7D2C0;

    --ink:              #1A1915;
    --ink-soft:         #2C2B26;
    --ink-mute:         #6B6A60;
    --ink-faint:        #97958A;

    --brand:            #C96442;
    --brand-strong:     #B5512F;
    --brand-soft:       #E8A688;
    --brand-tint:       rgba(201, 100, 66, 0.10);
    --brand-tint-2:     rgba(201, 100, 66, 0.18);

    --info:             #3F6FB1;
    --info-tint:        rgba(63, 111, 177, 0.12);
    --success:          #4F8A5B;
    --success-tint:     rgba(79, 138, 91, 0.13);
    --warning:          #C28A2A;
    --warning-tint:     rgba(194, 138, 42, 0.14);
    --danger:           #B84A3D;
    --danger-tint:      rgba(184, 74, 61, 0.13);
    --purple:           #6F5FB0;
    --purple-tint:      rgba(111, 95, 176, 0.14);

    /* Map legacy variable names to new tokens (compat with inline styles) */
    --bg-base: var(--paper);
    --bg-surface: var(--surface);
    --bg-surface-hover: var(--surface-hover);
    --bg-card: var(--surface);
    --bg-input: var(--surface-input);
    --border: var(--line);
    --border-strong: var(--line-strong);
    --text-primary: var(--ink);
    --text-secondary: var(--ink-soft);
    --text-muted: var(--ink-mute);
    --primary: var(--brand);
    --primary-hover: var(--brand-strong);
    --primary-light: var(--brand-tint);
    --success-bg: var(--success-tint);
    --warning-bg: var(--warning-tint);
    --danger-bg: var(--danger-tint);
    --info-bg: var(--info-tint);
    --accent-purple: var(--purple);
    --accent-purple-light: var(--purple-tint);

    /* Shadows */
    --shadow-1: 0 1px 2px rgba(40, 32, 18, 0.04);
    --shadow-2: 0 6px 24px -10px rgba(40, 32, 18, 0.18), 0 2px 6px rgba(40, 32, 18, 0.06);
    --shadow-3: 0 24px 60px -24px rgba(40, 32, 18, 0.32), 0 8px 16px rgba(40, 32, 18, 0.08);
    --shadow-glow: 0 0 0 4px var(--brand-tint);
    --shadow-sm: var(--shadow-1);
    --shadow-md: var(--shadow-2);
    --shadow-lg: var(--shadow-3);

    /* Radii */
    --r-2:  4px;
    --r-3:  6px;
    --r-4:  8px;
    --r-5:  10px;
    --r-6:  12px;
    --r-8:  16px;
    --r-10: 20px;
    --r-pill: 9999px;
    --radius-sm: var(--r-3);
    --radius:    var(--r-4);
    --radius-lg: var(--r-6);
    --radius-full: var(--r-pill);

    /* Spacing scale */
    --s-2xs: 2px;
    --s-xs:  4px;
    --s-sm:  8px;
    --s-md:  12px;
    --s-lg:  16px;
    --s-xl:  24px;
    --s-2xl: 32px;
    --s-3xl: 48px;
    --spacing-2xs: var(--s-2xs);
    --spacing-xs:  var(--s-xs);
    --spacing-sm:  var(--s-sm);
    --spacing-md:  var(--s-md);
    --spacing-lg:  var(--s-lg);
    --spacing-xl:  var(--s-xl);
    --spacing-2xl: var(--s-2xl);
    --spacing-3xl: var(--s-3xl);

    /* Type */
    --font-sans: 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Source Serif 4', 'Source Serif Pro', ui-serif, Georgia, serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Cascadia Code', Consolas, monospace;

    --text-xs:   0.75rem;
    --text-sm:   0.84rem;
    --text-base: 0.92rem;
    --text-md:   1.0rem;
    --text-lg:   1.15rem;
    --text-xl:   1.4rem;
    --text-2xl:  1.75rem;
    --text-3xl:  2.25rem;
    --text-display: 2.75rem;

    /* Motion */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 0.15s;
    --duration-base: 0.22s;
    --duration-slow: 0.35s;
    --transition: var(--duration-base) var(--ease-out);

    /* Layout tokens */
    --sidebar-w: 240px;
    --sidebar-w-collapsed: 64px;
    --topbar-h: 64px;
    --content-max: 1320px;

    /* Z-index */
    --z-sidebar: 50;
    --z-topbar: 40;
    --z-dropdown: 60;
    --z-modal: 100;
    --z-toast: 200;
}

[data-theme="dark"] {
    color-scheme: dark;
    --paper:            #1F1E1B;
    --paper-soft:       #232220;
    --paper-sunken:     #1A1917;
    --surface:          #262624;
    --surface-1:        #2A2A28;
    --surface-2:        #2F2F2D;
    --surface-hover:    #34332F;
    --surface-active:   #3A3935;
    --surface-input:    #1B1A18;
    --line:             #393734;
    --line-soft:        #2D2C29;
    --line-strong:      #4A4844;

    --ink:              #F5F2E8;
    --ink-soft:         #DDD9CC;
    --ink-mute:         #A8A597;
    --ink-faint:        #797668;

    --brand:            #E37953;
    --brand-strong:     #D86839;
    --brand-soft:       #F0A487;
    --brand-tint:       rgba(227, 121, 83, 0.14);
    --brand-tint-2:     rgba(227, 121, 83, 0.24);

    --info:             #6E9DD8;
    --info-tint:        rgba(110, 157, 216, 0.18);
    --success:          #74B086;
    --success-tint:     rgba(116, 176, 134, 0.16);
    --warning:          #E2B065;
    --warning-tint:     rgba(226, 176, 101, 0.18);
    --danger:           #E27968;
    --danger-tint:      rgba(226, 121, 104, 0.18);
    --purple:           #9A8DCB;
    --purple-tint:      rgba(154, 141, 203, 0.18);

    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-2: 0 8px 28px rgba(0, 0, 0, 0.45);
    --shadow-3: 0 24px 60px rgba(0, 0, 0, 0.55);
}

/* ── 2. Reset / global ── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html, body { height: 100%; }
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.55;
    color: var(--ink);
    background: var(--paper);
    background-image:
        radial-gradient(at 0% 0%, rgba(201, 100, 66, 0.05) 0%, transparent 40%),
        radial-gradient(at 100% 100%, rgba(63, 111, 177, 0.04) 0%, transparent 40%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    min-height: 100vh;
}
[data-theme="dark"] body {
    background-image:
        radial-gradient(at 0% 0%, rgba(227, 121, 83, 0.06) 0%, transparent 45%),
        radial-gradient(at 100% 100%, rgba(110, 157, 216, 0.05) 0%, transparent 45%);
}

img, svg, video { max-width: 100%; display: block; }

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }

input, textarea, select { font: inherit; color: inherit; }
input::placeholder, textarea::placeholder { color: var(--ink-faint); }

a { color: var(--brand); text-decoration: none; transition: color var(--duration-fast) var(--ease-out); }
a:hover { color: var(--brand-strong); }

h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.25; color: var(--ink); }
h1 { font-size: var(--text-2xl); letter-spacing: -0.01em; }
h2 { font-size: var(--text-xl); letter-spacing: -0.01em; }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }
h5, h6 { font-size: var(--text-base); }

p { color: var(--ink-soft); }
small { font-size: var(--text-xs); color: var(--ink-mute); }
code, pre { font-family: var(--font-mono); }
hr { border: none; border-top: 1px solid var(--line); margin: var(--s-lg) 0; }

/* Selection */
::selection { background: var(--brand-tint-2); color: var(--ink); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 8px;
    border: 2px solid var(--paper);
}
::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }
[data-theme="dark"] ::-webkit-scrollbar-thumb { border-color: var(--paper); }

/* Focus styles */
:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}
button:focus-visible, a:focus-visible, [role="button"]:focus-visible {
    outline-offset: 3px;
}

.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ── 3. Utility classes (compat layer) ── */
.flex          { display: flex; }
.inline-flex   { display: inline-flex; }
.flex-col      { flex-direction: column; }
.flex-wrap     { flex-wrap: wrap; }
.flex-1        { flex: 1 1 0; min-width: 0; }
.flex-shrink-0 { flex-shrink: 0; }
.grid          { display: grid; }
.block         { display: block; }
.inline-block  { display: inline-block; }
.hidden        { display: none !important; }

.items-center  { align-items: center; }
.items-start   { align-items: flex-start; }
.items-end     { align-items: flex-end; }
.justify-center{ justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end   { justify-content: flex-end; }
.self-start    { align-self: flex-start; }

.gap-0  { gap: 0; }
.gap-xs { gap: var(--s-xs); }
.gap-sm { gap: var(--s-sm); }
.gap-md { gap: var(--s-md); }
.gap-lg { gap: var(--s-lg); }
.gap-xl { gap: var(--s-xl); }

.w-full   { width: 100%; }
.w-auto   { width: auto; }
.max-w-sm { max-width: 320px; }
.max-w-md { max-width: 480px; }
.max-w-lg { max-width: 640px; }
.min-w-0  { min-width: 0; }

.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mt-xs { margin-top: var(--s-xs); }
.mt-sm { margin-top: var(--s-sm); }
.mt-md { margin-top: var(--s-md); }
.mt-lg { margin-top: var(--s-lg); }
.mt-xl { margin-top: var(--s-xl); }
.mt-2xl { margin-top: var(--s-2xl); }
.mb-sm { margin-bottom: var(--s-sm); }
.mb-md { margin-bottom: var(--s-md); }
.mb-lg { margin-bottom: var(--s-lg); }
.ml-auto { margin-left: auto; }
.mr-sm { margin-right: var(--s-sm); }
.mr-md { margin-right: var(--s-md); }

.p-0   { padding: 0; }
.p-sm  { padding: var(--s-sm); }
.p-md  { padding: var(--s-md); }
.p-lg  { padding: var(--s-lg); }
.px-0  { padding-left: 0; padding-right: 0; }
.px-sm { padding-left: var(--s-sm); padding-right: var(--s-sm); }
.py-md { padding-top: var(--s-md); padding-bottom: var(--s-md); }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-xs   { font-size: var(--text-xs); }
.text-sm   { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg   { font-size: var(--text-lg); }
.text-xl   { font-size: var(--text-xl); }
.text-2xl  { font-size: var(--text-2xl); }
.text-muted     { color: var(--ink-mute); }
.text-secondary { color: var(--ink-soft); }
.text-danger    { color: var(--danger); }
.font-mono     { font-family: var(--font-mono); }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.whitespace-nowrap { white-space: nowrap; }
.whitespace-pre-wrap { white-space: pre-wrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.overflow-auto   { overflow: auto; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }

.relative { position: relative; }
.absolute { position: absolute; }
.sticky   { position: sticky; }
.top-0    { top: 0; }

.border         { border: 1px solid var(--line); }
.border-b       { border-bottom: 1px solid var(--line); }
.border-strong  { border-color: var(--line-strong); }
.rounded-sm     { border-radius: var(--r-3); }
.rounded        { border-radius: var(--r-4); }
.rounded-lg     { border-radius: var(--r-6); }
.rounded-full   { border-radius: var(--r-pill); }
.bg-surface     { background: var(--surface); }
.bg-card        { background: var(--surface); }
.bg-input       { background: var(--surface-input); }
.bg-hover       { background: var(--surface-hover); }
.bg-primary-light { background: var(--brand-tint); }
.shadow-sm      { box-shadow: var(--shadow-1); }
.shadow-md      { box-shadow: var(--shadow-2); }
.shadow-glow    { box-shadow: var(--shadow-glow); }
.transition     { transition: var(--transition); }

.cursor-pointer { cursor: pointer; }
.pointer-events-none { pointer-events: none; }
.opacity-50 { opacity: 0.5; }
.opacity-70 { opacity: 0.7; }

/* ── 4. Application shell ── */
.app-page {
    min-height: 100vh;
}

.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

.app-sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: var(--s-lg);
    padding: var(--s-lg) var(--s-md);
    background: var(--paper-soft);
    border-right: 1px solid var(--line);
    z-index: var(--z-sidebar);
}

.app-sidebar__brand {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    padding: var(--s-sm) var(--s-md);
    color: var(--ink);
    text-decoration: none;
    border-radius: var(--r-4);
    transition: background var(--duration-fast) var(--ease-out);
}
.app-sidebar__brand:hover { background: var(--surface-hover); color: var(--ink); }

.brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--r-4);
    background: linear-gradient(135deg, var(--brand) 0%, var(--brand-strong) 100%);
    color: #FFFFFF;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: -0.02em;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(201, 100, 66, 0.25);
}

.brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    min-width: 0;
}
.brand-text strong {
    font-family: var(--font-display);
    font-size: 0.98rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
}
.brand-text small {
    font-size: 0.7rem;
    color: var(--ink-mute);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.app-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 auto;
    overflow-y: auto;
    padding-right: 2px;
}

.app-nav__item {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    padding: 9px var(--s-md);
    border-radius: var(--r-4);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--ink-soft);
    text-decoration: none;
    transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
    position: relative;
    min-width: 0;
}
.app-nav__item i { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.app-nav__item > span:not(.nav-badge) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.app-nav__item:hover { background: var(--surface-hover); color: var(--ink); }
.app-nav__item.active {
    background: var(--surface);
    color: var(--brand);
    box-shadow: var(--shadow-1);
}
.app-nav__item.active i { opacity: 1; }
.app-nav__item.active::before {
    content: '';
    position: absolute;
    left: -2px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    background: var(--brand);
    border-radius: 0 3px 3px 0;
}

.nav-badge {
    margin-left: auto;
    padding: 1px 7px;
    font-size: 0.68rem;
    font-weight: 600;
    background: var(--brand-tint);
    color: var(--brand);
    border-radius: var(--r-pill);
    flex-shrink: 0;
    white-space: nowrap;
}

.app-sidebar__footer {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: var(--s-md);
    border-top: 1px solid var(--line-soft);
}

.sidebar-action {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    padding: 9px var(--s-md);
    border: none;
    border-radius: var(--r-4);
    background: transparent;
    color: var(--ink-soft);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
    text-align: left;
    width: 100%;
    min-width: 0;
}
.sidebar-action i { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.sidebar-action span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-action:hover { background: var(--surface-hover); color: var(--ink); }

/* ── Topbar / page shell ── */
.page-shell {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

.app-topbar {
    position: sticky;
    top: 0;
    z-index: var(--z-topbar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-md);
    padding: var(--s-md) var(--s-2xl);
    background: rgba(250, 249, 245, 0.85);
    backdrop-filter: saturate(140%) blur(12px);
    -webkit-backdrop-filter: saturate(140%) blur(12px);
    border-bottom: 1px solid var(--line-soft);
    min-height: var(--topbar-h);
}
[data-theme="dark"] .app-topbar { background: rgba(31, 30, 27, 0.85); }

.page-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1 1 auto;
}
.page-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
    line-height: 1.15;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-content {
    padding: var(--s-2xl);
    max-width: var(--content-max);
    width: 100%;
    margin: 0 auto;
    flex: 1 1 auto;
}

/* Mobile menu toggle (used by base.html) */
.mobile-menu-toggle {
    display: none;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    padding: 6px 10px;
    border-radius: var(--r-4);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out);
}
.mobile-menu-toggle:hover { background: var(--surface-hover); }
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(20, 18, 13, 0.55);
    z-index: 49;
}

/* ── 5. Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-sm);
    padding: 9px 16px;
    min-height: 38px;
    border-radius: var(--r-4);
    border: 1px solid transparent;
    background: var(--surface);
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: 500;
    line-height: 1.3;
    cursor: pointer;
    user-select: none;
    transition:
        background var(--duration-fast) var(--ease-out),
        border-color var(--duration-fast) var(--ease-out),
        color var(--duration-fast) var(--ease-out),
        box-shadow var(--duration-fast) var(--ease-out),
        transform var(--duration-fast) var(--ease-out);
    white-space: nowrap;
    text-decoration: none;
}
.btn i, .btn svg {
    width: 16px; height: 16px;
    flex-shrink: 0;
}
.btn:disabled, .btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-sm {
    padding: 6px 12px;
    min-height: 32px;
    font-size: var(--text-xs);
}
.btn-sm i, .btn-sm svg { width: 14px; height: 14px; }
.btn-lg {
    padding: 12px 22px;
    min-height: 44px;
    font-size: var(--text-md);
    border-radius: var(--r-5);
}

.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #FFFFFF;
    box-shadow: 0 1px 2px rgba(178, 80, 47, 0.18);
}
.btn-primary:hover:not(:disabled) {
    background: var(--brand-strong);
    border-color: var(--brand-strong);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -4px rgba(178, 80, 47, 0.32);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: var(--surface);
    border-color: var(--line-strong);
    color: var(--ink);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: var(--ink-mute);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--ink-soft);
}
.btn-ghost:hover:not(:disabled) {
    background: var(--surface-hover);
    color: var(--ink);
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #FFFFFF;
}
.btn-success:hover:not(:disabled) { background: #437A4D; border-color: #437A4D; }

.btn-warning {
    background: var(--warning);
    border-color: var(--warning);
    color: #FFFFFF;
}
.btn-warning:hover:not(:disabled) { background: #A47422; border-color: #A47422; }

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #FFFFFF;
}
.btn-danger:hover:not(:disabled) { background: #9B3F33; border-color: #9B3F33; }

.btn-info {
    background: var(--info);
    border-color: var(--info);
    color: #FFFFFF;
}
.btn-info:hover:not(:disabled) { background: #355C97; border-color: #355C97; }

.btn-outline {
    background: transparent;
    border-color: var(--brand);
    color: var(--brand);
}
.btn-outline:hover:not(:disabled) { background: var(--brand-tint); }

.btn.is-busy {
    pointer-events: none;
    opacity: 0.85;
}
.btn.loading { pointer-events: none; opacity: 0.85; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink-mute);
    border-radius: var(--r-3);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.icon-btn:hover { background: var(--surface-hover); color: var(--ink); }
.icon-btn svg { width: 14px; height: 14px; }

/* Loading spinner */
.loading-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
    vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.inline-icon {
    width: 14px;
    height: 14px;
    vertical-align: -2px;
    margin-right: 4px;
}

/* ── 6. Cards ── */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-6);
    box-shadow: var(--shadow-1);
    overflow: hidden;
    transition: box-shadow var(--duration-base) var(--ease-out), border-color var(--duration-base) var(--ease-out);
}
.card + .card { margin-top: var(--s-lg); }
.card.shadow-md { box-shadow: var(--shadow-2); }

.sticky-card {
    position: sticky;
    top: calc(var(--topbar-h) + var(--s-md));
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-md);
    padding: var(--s-md) var(--s-lg);
    border-bottom: 1px solid var(--line-soft);
    background: var(--surface-1);
    min-width: 0;
}
.card-header > div { min-width: 0; }
.card-header h3 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.card-header h3 i, .card-header h3 svg { width: 18px; height: 18px; color: var(--ink-mute); flex-shrink: 0; }
.card-header .hint, .card-header p {
    color: var(--ink-mute);
    font-size: var(--text-xs);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-body {
    padding: var(--s-lg);
}
.card-body.p-0 { padding: 0; }

/* ── 7. Forms ── */
.form-group {
    display: block;
    margin-bottom: var(--s-md);
}
.form-group:last-child { margin-bottom: 0; }
.form-group > label, .form-label {
    display: flex;
    align-items: center;
    gap: var(--s-xs);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--ink);
    margin-bottom: 6px;
}
.form-group > label i, .form-group > label svg { width: 14px; height: 14px; opacity: 0.7; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="url"], input[type="search"], input[type="tel"], input[type="date"],
textarea, select, .form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-4);
    background: var(--surface);
    color: var(--ink);
    font-size: var(--text-sm);
    line-height: 1.4;
    transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out);
    appearance: none;
    -webkit-appearance: none;
}
textarea {
    resize: vertical;
    min-height: 86px;
    line-height: 1.5;
    font-family: var(--font-sans);
}
input:hover:not(:disabled):not([readonly]),
textarea:hover:not(:disabled):not([readonly]),
select:hover:not(:disabled),
.form-control:hover:not(:disabled):not([readonly]) {
    border-color: var(--line-strong);
}
input:focus, textarea:focus, select:focus, .form-control:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-tint);
    background: var(--surface);
}
input:disabled, textarea:disabled, select:disabled, .form-control:disabled,
input[readonly], textarea[readonly] {
    background: var(--paper-sunken);
    color: var(--ink-mute);
    cursor: not-allowed;
}

/* Select with chevron */
select, .form-select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%236B6A60'%3e%3cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.83a.75.75 0 011.08 1.04l-4.25 4.39a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 36px;
}
[data-theme="dark"] select, [data-theme="dark"] .form-select {
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23A8A597'%3e%3cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.06l3.71-3.83a.75.75 0 011.08 1.04l-4.25 4.39a.75.75 0 01-1.08 0L5.21 8.27a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3e%3c/svg%3e");
}
select[multiple] {
    background-image: none;
    padding-right: 12px;
    min-height: 120px;
}

input[type="checkbox"], input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
    cursor: pointer;
    margin: 0;
}

/* form rows */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--s-md);
    margin-bottom: var(--s-md);
}
.form-row > .form-group { margin-bottom: 0; }

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-sm);
    margin-top: var(--s-lg);
}
.form-actions.justify-end { justify-content: flex-end; }

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: var(--s-sm);
    font-size: var(--text-sm);
    color: var(--ink);
    cursor: pointer;
    user-select: none;
    line-height: 1.4;
}
.checkbox-label input { flex-shrink: 0; }
.checkbox-label span { line-height: 1.4; }

/* hint text */
.hint, small.hint {
    display: block;
    margin-top: 6px;
    font-size: var(--text-xs);
    color: var(--ink-mute);
    line-height: 1.55;
}
.hint i, .hint svg { width: 12px; height: 12px; vertical-align: -1px; margin-right: 3px; opacity: 0.8; }

/* Password field with toggle */
.password-field {
    position: relative;
    display: flex;
}
.password-field input { padding-right: 64px; }
.password-toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--ink-mute);
    font-size: var(--text-xs);
    padding: 4px 10px;
    border-radius: var(--r-3);
    cursor: pointer;
    transition: color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out);
}
.password-toggle:hover { color: var(--ink); background: var(--surface-hover); }

.password-wrapper {
    display: inline-flex;
    align-items: center;
    gap: var(--s-xs);
}
.password-text {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--ink);
    cursor: pointer;
    user-select: text;
}

/* ── 8. Status badges ── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.01em;
    border-radius: var(--r-pill);
    border: 1px solid transparent;
    background: var(--surface-2);
    color: var(--ink-soft);
    white-space: nowrap;
}
.status-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.8;
}
.status-badge.active,
.status-badge.success,
.status-badge.running,
.status-badge.completed { background: var(--success-tint); color: var(--success); }
.status-badge.plus { background: var(--purple-tint); color: var(--purple); }
.status-badge.expired,
.status-badge.sold,
.status-badge.warning { background: var(--warning-tint); color: var(--warning); }
.status-badge.temporary,
.status-badge.info { background: var(--info-tint); color: var(--info); }
.status-badge.failed,
.status-badge.banned,
.status-badge.error { background: var(--danger-tint); color: var(--danger); }
.status-badge.pending,
.status-badge.waiting { background: var(--warning-tint); color: var(--warning); }
.status-badge.team-parent {
    background: rgba(15, 118, 110, 0.12);
    color: #0f766e;
}
.status-badge.team-child {
    background: rgba(29, 78, 216, 0.12);
    color: #1d4ed8;
}

/* ── 9. Tables ── */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--text-sm);
}
.data-table th,
.data-table td {
    min-width: 0;
}
.data-table thead th {
    position: sticky;
    top: 0;
    background: var(--surface-1);
    color: var(--ink-mute);
    font-size: var(--text-xs);
    font-weight: 600;
    text-align: left;
    padding: 10px 14px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    z-index: 1;
}
.data-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line-soft);
    color: var(--ink);
    vertical-align: middle;
    white-space: nowrap;
}
.data-table tbody tr {
    transition: background var(--duration-fast) var(--ease-out);
}
.data-table tbody tr:hover {
    background: var(--surface-hover);
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table.compact tbody td { padding: 8px 10px; font-size: var(--text-xs); }
.data-table input[type="checkbox"] { vertical-align: middle; }

.data-table td .truncate { max-width: 100%; }

/* ── 10. Skeleton / Empty ── */
.skeleton {
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-hover) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--r-3);
}
.skeleton-text { height: 12px; margin-bottom: 8px; }
.skeleton-text:last-child { margin-bottom: 0; }
.skeleton-row td { padding: 14px !important; }
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.empty-state {
    text-align: center;
    padding: var(--s-2xl) var(--s-lg);
    color: var(--ink-mute);
}
.empty-state__icon {
    font-size: 2rem;
    margin-bottom: var(--s-sm);
    opacity: 0.7;
}
.empty-state__title {
    font-size: var(--text-md);
    font-weight: 500;
    color: var(--ink-soft);
    margin-bottom: 4px;
}
.empty-state__desc { font-size: var(--text-sm); }

/* ── 11. Modals ── */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
    padding: var(--s-lg);
    background: rgba(28, 24, 14, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    overflow-y: auto;
}
[data-theme="dark"] .modal { background: rgba(0, 0, 0, 0.55); }
.modal.show, .modal.active { display: flex; animation: modal-fade var(--duration-base) var(--ease-out); }
@keyframes modal-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal__content {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-8);
    box-shadow: var(--shadow-3);
    width: 100%;
    max-width: 540px;
    max-height: calc(100vh - var(--s-2xl) * 2);
    display: flex;
    flex-direction: column;
    margin: auto;
    animation: modal-pop var(--duration-base) var(--ease-out);
}
@keyframes modal-pop {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-md);
    padding: var(--s-lg) var(--s-xl);
    border-bottom: 1px solid var(--line-soft);
}
.modal__header h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink);
    display: flex;
    align-items: center;
    gap: var(--s-sm);
}
.modal__close {
    background: transparent;
    border: none;
    color: var(--ink-mute);
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-3);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.modal__close:hover { background: var(--surface-hover); color: var(--ink); }
.modal__body {
    padding: var(--s-xl);
    overflow-y: auto;
    flex: 1 1 auto;
}
.modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--s-sm);
    padding: var(--s-md) var(--s-xl);
    border-top: 1px solid var(--line-soft);
    background: var(--surface-1);
    flex-wrap: wrap;
}

/* ── 12. Toasts ── */
.toast-container {
    position: fixed;
    top: var(--s-lg);
    right: var(--s-lg);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--s-sm);
    max-width: min(360px, calc(100vw - 32px));
    pointer-events: none;
}
.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: var(--s-sm);
    padding: 11px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--info);
    border-radius: var(--r-5);
    box-shadow: var(--shadow-2);
    color: var(--ink);
    font-size: var(--text-sm);
    line-height: 1.5;
    min-width: 240px;
    animation: toast-in var(--duration-base) var(--ease-out);
}
.toast--success { border-left-color: var(--success); }
.toast--warning { border-left-color: var(--warning); }
.toast--error,
.toast--danger { border-left-color: var(--danger); }
.toast--info { border-left-color: var(--info); }
.toast--exiting {
    animation: toast-out var(--duration-base) var(--ease-out) forwards;
}
@keyframes toast-in {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(20px); }
}
.toast__message { flex: 1 1 auto; word-break: break-word; }
.toast-close {
    background: transparent;
    border: none;
    color: var(--ink-mute);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0;
    width: 22px;
    height: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-3);
    flex-shrink: 0;
}
.toast-close:hover { background: var(--surface-hover); color: var(--ink); }

/* ── 13. Dropdown ── */
.dropdown {
    position: relative;
    display: inline-block;
}
.dropdown__menu, .dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: var(--z-dropdown);
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-5);
    box-shadow: var(--shadow-2);
    padding: 4px;
}
.dropdown__menu.is-floating,
.dropdown-menu.is-floating {
    display: block;
    position: fixed;
    top: var(--dropdown-layer-top, 0);
    left: var(--dropdown-layer-left, 0);
    right: auto;
    z-index: 1000;
    max-width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    overflow-y: auto;
}
.dropdown.show .dropdown__menu,
.dropdown.show .dropdown-menu,
.dropdown__menu.active,
.dropdown-menu.active {
    display: block;
    animation: dropdown-in var(--duration-fast) var(--ease-out);
}
@keyframes dropdown-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.dropdown__item, .dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--ink-soft);
    font-size: var(--text-sm);
    text-align: left;
    cursor: pointer;
    border-radius: var(--r-3);
    transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
    text-decoration: none;
}
.dropdown__item:hover, .dropdown-item:hover {
    background: var(--surface-hover);
    color: var(--ink);
}
.dropdown__item i, .dropdown__item svg,
.dropdown-item i, .dropdown-item svg {
    width: 14px; height: 14px; flex-shrink: 0;
}

/* Multi-select dropdown (custom) */
.msd {
    position: relative;
}
.msd-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-4);
    background: var(--surface);
    cursor: pointer;
    font-size: var(--text-sm);
    text-align: left;
}
.msd-trigger:hover { border-color: var(--line-strong); }
.msd-list {
    display: none;
    max-height: 220px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-4);
    box-shadow: var(--shadow-2);
    padding: 4px;
    margin-top: 4px;
    position: absolute;
    left: 0; right: 0;
    z-index: var(--z-dropdown);
}
.msd.open .msd-list { display: block; }
.msd-item {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    padding: 8px 10px;
    border-radius: var(--r-3);
    font-size: var(--text-sm);
    cursor: pointer;
}
.msd-item:hover { background: var(--surface-hover); }
.msd-label { color: var(--ink-soft); }

/* ── 14. Stat cards / outcomes ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--s-md);
}
.dashboard-overview { margin-bottom: var(--s-xl); }

.stat-card {
    display: flex;
    align-items: center;
    gap: var(--s-md);
    padding: var(--s-md) var(--s-lg);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-6);
    transition: box-shadow var(--duration-base) var(--ease-out), border-color var(--duration-base) var(--ease-out);
}
.stat-card:hover { box-shadow: var(--shadow-1); border-color: var(--line-strong); }

.stat-icon {
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-5);
    background: var(--surface-2);
    color: var(--ink-soft);
    font-size: 0.78rem;
    font-weight: 600;
    flex-shrink: 0;
}
.stat-icon i, .stat-icon svg { width: 18px; height: 18px; }
.stat-icon.info       { background: var(--info-tint);    color: var(--info); }
.stat-icon.primary    { background: var(--brand-tint);   color: var(--brand); }
.stat-icon.success    { background: var(--success-tint); color: var(--success); }
.stat-icon.warning    { background: var(--warning-tint); color: var(--warning); }
.stat-icon.danger     { background: var(--danger-tint);  color: var(--danger); }
.stat-icon.purple     { background: var(--purple-tint);  color: var(--purple); }

.stat-content { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.stat-label   {
    font-size: var(--text-xs);
    color: var(--ink-mute);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.stat-value   {
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: -0.01em;
    line-height: 1.1;
}
.stat-meta    { font-size: var(--text-xs); color: var(--ink-mute); }
.stat-value-lg { font-size: 1.6rem; }

/* Outcome grid (registration progress) */
.outcome-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--s-sm);
    margin-top: var(--s-md);
}
.outcome-card {
    padding: var(--s-md);
    text-align: center;
    background: var(--surface-1);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-5);
}
.outcome-card.success      { border-color: var(--success); background: var(--success-tint); }
.outcome-card.failed       { border-color: var(--danger);  background: var(--danger-tint);  }
.outcome-card.success-rate { border-color: var(--info);    background: var(--info-tint);    }
.outcome-card.remaining    { border-color: var(--warning); background: var(--warning-tint); }
.outcome-card.success-speed{ border-color: var(--success); background: var(--success-tint); }
.outcome-card.total-speed  { border-color: var(--purple);  background: var(--purple-tint);  }
.outcome-label { font-size: var(--text-xs); color: var(--ink-mute); margin-bottom: 4px; letter-spacing: 0.04em; }
.outcome-value { font-family: var(--font-display); font-size: 1.25rem; font-weight: 600; color: var(--ink); }

/* Detail grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--s-md);
}
.detail-item {
    padding: var(--s-md);
    background: var(--surface-1);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-5);
}
.detail-item__label {
    font-size: var(--text-xs);
    color: var(--ink-mute);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}
.detail-item__value {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--ink);
    word-break: break-all;
    line-height: 1.4;
}

/* ── 15. Two-column layouts ── */
.two-col-layout {
    display: grid;
    grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
    gap: var(--s-2xl);
    align-items: start;
}
.two-col-layout > .left-panel { min-width: 0; }
.two-col-layout > .right-panel { min-width: 0; display: flex; flex-direction: column; gap: var(--s-lg); }

.settings-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: var(--s-2xl);
    align-items: start;
}
.settings-layout > .left-panel { position: sticky; top: calc(var(--topbar-h) + var(--s-md)); }

/* ── 16. Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--s-md);
    padding: var(--s-md) var(--s-lg);
    border-top: 1px solid var(--line-soft);
    background: var(--surface-1);
}
.pagination__nav {
    display: flex;
    align-items: center;
    gap: var(--s-xs);
    flex-wrap: wrap;
}
.pagination__pages {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
.pagination__page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--r-3);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
}
.pagination__page:hover { background: var(--surface-hover); border-color: var(--line-strong); color: var(--ink); }
.pagination__page.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #FFFFFF;
}
.pagination__page.dots { border: none; cursor: default; background: transparent; }
.pagination__jump {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    font-size: var(--text-sm);
    color: var(--ink-mute);
    flex-wrap: wrap;
}
.pagination__jump input,
.pagination-jump-input { width: 64px; padding: 6px 10px; }
.pagination__jump select { width: auto; padding: 6px 28px 6px 10px; }

/* ── 17. Filter toolbar ── */
.filter-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-sm);
}
.filter-toolbar__search {
    flex: 1 1 220px;
    max-width: 360px;
    position: relative;
}
.filter-toolbar__search input { padding-left: 36px; }
.filter-toolbar__search-icon {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--ink-mute);
    font-size: var(--text-sm);
}

.accounts-toolbar-card {
    position: relative;
    z-index: 2;
    overflow: visible;
}
.accounts-toolbar-card:has(.dropdown.show),
.accounts-toolbar-card:has(.dropdown__menu.active),
.accounts-toolbar-card:has(.dropdown-menu.active) {
    z-index: 1001;
}
.accounts-toolbar-card .card-body {
    padding: var(--s-md) var(--s-lg);
    overflow: visible;
}
.accounts-toolbar-card .dropdown__menu { z-index: 1000; }

/* ── 18. Tabs ── */
.tabs {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: var(--surface-2);
    border-radius: var(--r-5);
    padding: 3px;
    border: 1px solid var(--line-soft);
}
.tab-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: var(--ink-mute);
    border-radius: var(--r-3);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
    white-space: nowrap;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: var(--shadow-1);
}

.tabs--vertical {
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: transparent;
    border: none;
    padding: 0;
    width: 100%;
}
.tabs--vertical .tab-btn {
    padding: 9px 12px;
    text-align: left;
    width: 100%;
    border-radius: var(--r-4);
    font-weight: 500;
    color: var(--ink-soft);
}
.tabs--vertical .tab-btn:hover { background: var(--surface-hover); color: var(--ink); }
.tabs--vertical .tab-btn.active {
    background: var(--brand-tint);
    color: var(--brand);
    box-shadow: none;
    font-weight: 600;
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fade-up var(--duration-base) var(--ease-out); }
@keyframes fade-up {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── 19. Console / Log ── */
.console-toolbar {
    display: flex;
    align-items: center;
    gap: var(--s-md);
    padding: 8px var(--s-md);
    background: var(--paper-sunken);
    color: var(--ink-mute);
    font-family: var(--font-mono);
    font-size: 0.74rem;
    border-top: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.console-log {
    background: var(--surface-input);
    color: var(--ink);
    padding: var(--s-md);
    max-height: 380px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.6;
}
[data-theme="dark"] .console-log { background: #161513; }
.log-line {
    display: grid;
    grid-template-columns: 76px 60px 1fr;
    gap: var(--s-sm);
    padding: 3px 0;
    align-items: baseline;
}
.log-line .timestamp { color: var(--ink-faint); flex-shrink: 0; }
.log-line .log-tag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 18px;
    padding: 0 6px;
    border-radius: var(--r-2);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}
.log-line .log-message { color: var(--ink-soft); word-break: break-word; }
.log-line.info    .log-tag { background: var(--info-tint);    color: var(--info); }
.log-line.success .log-tag { background: var(--success-tint); color: var(--success); }
.log-line.warning .log-tag { background: var(--warning-tint); color: var(--warning); }
.log-line.error   .log-tag { background: var(--danger-tint);  color: var(--danger); }
.log-line.system  .log-tag { background: var(--surface-2);    color: var(--ink-mute); }

/* ── 20. Login / auth shell ── */
.app-page--auth {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--s-xl);
    background: var(--paper);
    background-image:
        radial-gradient(at 20% 30%, var(--brand-tint) 0%, transparent 45%),
        radial-gradient(at 80% 70%, var(--purple-tint) 0%, transparent 50%);
}

.app-background {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}
.glow {
    position: absolute;
    width: 460px;
    height: 460px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.35;
}
.glow-1 { background: var(--brand); }
.glow-2 { background: var(--purple); }

.auth-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    display: flex;
    justify-content: center;
}
.auth-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--s-xl);
}
.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--s-sm);
    color: var(--ink);
}
.auth-logo .brand-logo {
    width: 56px;
    height: 56px;
    font-size: 1.6rem;
    border-radius: var(--r-6);
}
.auth-logo h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    color: var(--ink);
}

.login-card {
    border-radius: var(--r-8);
    box-shadow: var(--shadow-3);
    border: 1px solid var(--line);
}
.login-form { display: flex; flex-direction: column; gap: var(--s-md); }
.login-error {
    background: var(--danger-tint);
    color: var(--danger);
    border: 1px solid var(--danger);
    border-radius: var(--r-4);
    padding: 10px 14px;
    font-size: var(--text-sm);
    margin-bottom: var(--s-sm);
}

/* ── 21. Plan cards (payment) ── */
.plan-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--s-md);
    margin-bottom: var(--s-xl);
}
.plan-card {
    padding: var(--s-xl);
    border-radius: var(--r-6);
    border: 2px solid var(--line);
    background: var(--surface);
    cursor: pointer;
    transition: border-color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out), transform var(--duration-fast) var(--ease-out);
    text-align: left;
}
.plan-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.plan-card.selected {
    border-color: var(--brand);
    background: var(--brand-tint);
}
.plan-card h3 {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    margin-bottom: 4px;
    color: var(--ink);
}
.plan-card.selected h3 { color: var(--brand); }
.plan-card p { color: var(--ink-soft); font-size: var(--text-sm); margin: 0; }

.team-options { display: none; }
.team-options.show { display: block; animation: fade-up var(--duration-base) var(--ease-out); }

.link-box {
    display: none;
    margin-top: var(--s-xl);
    padding: var(--s-lg);
    background: var(--surface-1);
    border: 1px dashed var(--brand);
    border-radius: var(--r-6);
}
.link-box.show { display: block; animation: fade-up var(--duration-base) var(--ease-out); }
.link-box__label {
    font-size: var(--text-xs);
    color: var(--ink-mute);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--s-sm);
}
.link-box__textarea {
    width: 100%;
    min-height: 92px;
    padding: var(--s-sm) var(--s-md);
    background: var(--surface-input);
    border: 1px solid var(--line);
    border-radius: var(--r-4);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--success);
    resize: vertical;
}

/* ── 22. Modern progress bar ── */
.progress-overview {
    display: flex;
    flex-direction: column;
    gap: var(--s-sm);
}
.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}
.progress-count {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--ink);
}
.progress-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--r-pill);
    font-size: var(--text-xs);
    font-weight: 600;
    background: var(--brand-tint);
    color: var(--brand);
}
.modern-progress-container {
    width: 100%;
    height: 8px;
    background: var(--surface-2);
    border-radius: var(--r-pill);
    overflow: hidden;
}
.modern-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--brand) 0%, var(--brand-strong) 100%);
    border-radius: var(--r-pill);
    transition: width 0.4s var(--ease-out);
}

/* Step indicator (fastlane phases) */
.step-indicator {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: var(--s-md);
    margin-bottom: var(--s-md);
}
.step-indicator__item {
    text-align: center;
    padding: var(--s-md);
    background: var(--surface-1);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-5);
}
.step-indicator__label {
    font-size: var(--text-xs);
    color: var(--ink-mute);
    margin-bottom: 4px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.step-indicator__value {
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 700;
    color: var(--ink);
}

/* Resource grid (fastlane stats) */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: var(--s-sm);
    margin-top: var(--s-md);
}
.resource-item {
    text-align: center;
    padding: var(--s-md);
    background: var(--surface-1);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-5);
}
.resource-item__label {
    display: block;
    font-size: var(--text-xs);
    color: var(--ink-mute);
    margin-bottom: 4px;
    letter-spacing: 0.04em;
}
.resource-item__value {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--ink);
}

/* Section card (used inside settings) */
.section-card {
    padding: var(--s-md);
    background: var(--surface-1);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-5);
    margin-bottom: var(--s-md);
}

/* ── 23. Aether pool monitor ── */
.aether-pool-tabs { margin-bottom: var(--s-md); }
.aether-pool-stats { margin-bottom: var(--s-lg); }
.aether-pool-workbench {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--s-lg);
    align-items: stretch;
}
.aether-pool-workbench > .card { margin-top: 0; }
.aether-pool-control-card .card-body { padding-top: var(--s-md); }
.aether-pool-form {
    display: flex;
    flex-direction: column;
    gap: var(--s-md);
}
.aether-pool-section {
    border: 1px solid var(--line);
    border-radius: var(--r-5);
    background: var(--surface-1);
    overflow: hidden;
    transition: border-color var(--duration-fast) var(--ease-out);
}
.aether-pool-section[open] {
    border-color: var(--line-strong);
    background: var(--surface);
}
.aether-pool-section > summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    padding: 11px 14px;
    cursor: pointer;
    user-select: none;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--ink);
    transition: background var(--duration-fast) var(--ease-out);
}
.aether-pool-section > summary:hover { background: var(--surface-hover); }
.aether-pool-section > summary::-webkit-details-marker,
.aether-pool-section > summary::marker { display: none; content: ''; }
.aether-pool-section__title {
    display: inline-flex;
    align-items: center;
    gap: var(--s-xs);
    flex: 0 0 auto;
}
.aether-pool-section__icon {
    width: 16px;
    height: 16px;
    color: var(--ink-mute);
}
.aether-pool-section__meta {
    flex: 1 1 auto;
    min-width: 0;
    font-size: var(--text-xs);
    color: var(--ink-mute);
    padding: 2px 10px;
    border-radius: var(--r-pill);
    background: var(--surface-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
}
.aether-pool-section__caret {
    width: 14px;
    height: 14px;
    flex: 0 0 auto;
    color: var(--ink-mute);
    transition: transform var(--duration-fast) var(--ease-out);
}
.aether-pool-section[open] .aether-pool-section__caret {
    transform: rotate(180deg);
}
.aether-pool-section__body {
    padding: var(--s-sm) var(--s-md) var(--s-md);
    border-top: 1px solid var(--line-soft);
}
.aether-pool-section__body > .form-group + .aether-pool-form-grid,
.aether-pool-section__body > .form-group { margin-top: var(--s-sm); }
.aether-pool-form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: var(--s-md);
    margin-top: var(--s-md);
}
.aether-pool-toggle-grid {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-md);
    padding: var(--s-sm) var(--s-md);
    background: var(--surface-1);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-5);
}
.aether-pool-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--s-sm);
    font-size: var(--text-sm);
    color: var(--ink-soft);
    cursor: pointer;
    user-select: none;
}
.aether-pool-advanced-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: var(--s-md);
}
.aether-pool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--s-sm);
    margin-top: var(--s-xs);
}
.aether-pool-log-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.aether-pool-log-meta {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
}
.aether-pool-log {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
}
.aether-pool-summary-group th {
    background: var(--surface-2);
    font-weight: 600;
    border-bottom: 1px solid var(--line-soft);
}

/* ── 24. Team spaces ── */
.team-workbench-shell {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: var(--s-lg);
    align-items: start;
    position: relative;
}
.team-workbench-shell--loading { opacity: 0.6; pointer-events: none; }

.team-ambient-orb {
    position: absolute;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.18;
    pointer-events: none;
    z-index: 0;
}
.team-ambient-orb--one { top: -60px; left: 30%; background: var(--brand); }
.team-ambient-orb--two { bottom: -60px; right: 5%; background: var(--purple); }
@keyframes teamFloat {
    0%, 100% { transform: translate3d(0, 0, 0); }
    50% { transform: translate3d(0, -10px, 0); }
}

.team-workspace-rail { position: sticky; top: calc(var(--topbar-h) + var(--s-md)); z-index: 1; }
.team-rail-card { max-height: calc(100vh - var(--topbar-h) - var(--s-2xl)); display: flex; flex-direction: column; }
.team-rail-header { padding: var(--s-md) var(--s-lg); }
.team-rail-body { padding: var(--s-sm); overflow-y: auto; flex: 1 1 auto; }

.team-workspaces-list { display: flex; flex-direction: column; gap: 4px; }
.team-workspace-list__item {
    padding: var(--s-md);
    border: 1px solid transparent;
    border-radius: var(--r-5);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}
.team-workspace-list__item:hover { background: var(--surface-hover); }
.team-workspace-list__item.active {
    background: var(--brand-tint);
    border-color: var(--brand);
}

.team-workspace-main { position: relative; z-index: 1; }

.team-overview-card { overflow: hidden; }
.team-overview-hero {
    padding: var(--s-xl);
    background: linear-gradient(135deg, var(--brand-tint) 0%, var(--paper-soft) 100%);
    border-bottom: 1px solid var(--line-soft);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--s-lg);
    flex-wrap: wrap;
}
.team-hero-copy { display: flex; flex-direction: column; gap: var(--s-sm); flex: 1 1 280px; }
.team-hero-copy h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    letter-spacing: -0.015em;
    color: var(--ink);
}
.team-hero-copy p { font-size: var(--text-sm); color: var(--ink-soft); max-width: 56ch; }
.team-hero-metrics {
    display: flex;
    gap: var(--s-lg);
    flex-wrap: wrap;
}
.team-hero-metric {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.team-hero-metric__label {
    font-size: var(--text-xs);
    color: var(--ink-mute);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.team-hero-metric strong {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--ink);
}
.team-workspace-header-actions {
    display: flex;
    gap: var(--s-sm);
    align-items: center;
    flex-wrap: wrap;
}
.team-overview-body { padding: var(--s-lg) var(--s-xl); display: flex; flex-direction: column; gap: var(--s-lg); }
.team-stats-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.team-detail-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

.team-invite-card .card-body { padding-top: var(--s-md); }
.team-invite-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: var(--s-lg);
    align-items: start;
}
.team-invite-form-group { margin: 0; }
.team-invite-sidebar { display: flex; flex-direction: column; gap: var(--s-md); }
.team-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--s-sm);
}
.team-form-row .form-group { margin: 0; }
.team-local-search-group { margin: 0; }
.team-local-account-results {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: var(--s-xs);
    max-height: 220px;
    overflow-y: auto;
}
.team-local-account-results > * {
    padding: 6px 10px;
    border-radius: var(--r-3);
    background: var(--surface-1);
    font-size: var(--text-xs);
    cursor: pointer;
    border: 1px solid var(--line-soft);
}
.team-local-account-results > *:hover { background: var(--surface-hover); }

.team-operations-card .card-body { padding: var(--s-lg); }
.team-table-header { flex-wrap: wrap; gap: var(--s-md); }
.team-tabs { gap: 2px; }
.team-section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-sm);
    margin-bottom: var(--s-sm);
}
.team-section-state {
    display: inline-flex;
    align-items: center;
    gap: var(--s-xs);
    font-size: var(--text-xs);
    color: var(--ink-mute);
}
.team-section-state.active { color: var(--brand); }
.team-workspace-alert {
    padding: 10px 14px;
    background: var(--info-tint);
    border-left: 3px solid var(--info);
    color: var(--info);
    border-radius: var(--r-4);
    font-size: var(--text-sm);
}

/* ── 25. Email services & service tables specifics ── */
.email-services-table {
    table-layout: fixed;
    min-width: 960px;
}
.email-services-table thead th { background: var(--surface-1); }
.email-services-table th:nth-child(1) { width: 180px; }
.email-services-table th:nth-child(2) { width: 130px; }
.email-services-table th:nth-child(4) { width: 90px; }
.email-services-table th:nth-child(5) { width: 80px; }
.email-services-table th:nth-child(6) { width: 150px; }
.email-services-table th:nth-child(7) { width: 220px; }

.data-table td.email-service-summary-cell {
    min-width: 0;
    white-space: normal;
}

.service-config-summary {
    display: grid;
    gap: var(--s-sm);
    min-width: 0;
}

.service-config-primary {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    min-width: 0;
}

.service-config-url {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-mono);
    color: var(--ink);
}

.service-config-count {
    flex: 0 0 auto;
    color: var(--ink-mute);
    font-size: var(--text-xs);
    white-space: nowrap;
}

.service-domain-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 58px;
    overflow: hidden;
    min-width: 0;
}

.domain-chip {
    display: inline-flex;
    align-items: center;
    max-width: 180px;
    min-height: 24px;
    padding: 2px 8px;
    border: 1px solid var(--line);
    border-radius: var(--r-3);
    background: var(--surface-input);
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.domain-chip--more {
    font-family: var(--font-sans);
    color: var(--brand);
    background: var(--brand-tint);
    border-color: var(--brand-soft);
}

.domain-chip--empty {
    font-family: var(--font-sans);
    color: var(--ink-mute);
}

/* Proxy list */
.proxy-list-card .card-body.p-0 { padding: 0; }
.proxy-list-table-container {
    min-height: 480px;
    max-height: 68vh;
    overflow: auto;
}
.proxy-list-table { min-width: 980px; }
.proxy-list-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Service table action cell */
.data-table .actions-cell {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    flex-wrap: nowrap;
    white-space: nowrap;
}

/* Dynamic content compatibility: account rows, detail modals, and Team tables */
.id-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: var(--r-3);
    background: var(--surface-2);
    color: var(--ink-mute);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    white-space: nowrap;
}

.email-wrapper,
.password-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.email-text,
.password-text {
    display: inline-block;
    min-width: 0;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    user-select: text;
}

.password-text.hidden,
.password-text.password-hidden {
    display: inline-block !important;
    filter: blur(4px);
    cursor: pointer;
    user-select: none;
    transition: filter var(--duration-base) var(--ease-out);
}
.password-text.hidden:hover,
.password-text.password-hidden:hover { filter: blur(2px); }

.badge,
.service-tag {
    display: inline-flex;
    align-items: center;
    max-width: 140px;
    min-width: 0;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--ink-soft);
    font-size: var(--text-xs);
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.action-buttons,
.team-row-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    white-space: nowrap;
}
.action-buttons .dropdown,
.team-row-actions .dropdown { flex: 0 0 auto; }
.action-btn.danger:hover {
    background: var(--danger-tint);
    color: var(--danger);
}

.page-number-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: var(--r-3);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out);
    white-space: nowrap;
}
.page-number-btn:hover:not(:disabled) {
    background: var(--surface-hover);
    border-color: var(--line-strong);
    color: var(--ink);
}
.page-number-btn.active {
    background: var(--brand);
    border-color: var(--brand);
    color: #FFFFFF;
    cursor: default;
}
.page-number-btn:disabled { opacity: 1; }
.page-number-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    color: var(--ink-mute);
    font-weight: 600;
}

.code-box {
    display: flex;
    align-items: center;
    gap: var(--s-md);
    max-width: 100%;
    min-width: 0;
    padding: var(--s-sm) var(--s-md);
    border: 1px solid var(--line);
    border-radius: var(--r-4);
    background: var(--surface-input);
    color: var(--ink-soft);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
}
.code-content {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
}
.copy-btn-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    border: 1px solid var(--line);
    border-radius: var(--r-3);
    background: var(--surface);
    color: var(--brand);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out), color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}
.copy-btn-small:hover {
    background: var(--brand-tint);
    border-color: var(--brand);
    color: var(--brand-strong);
}
.detail-cookie-box {
    align-items: flex-start;
    gap: var(--s-sm);
    padding: var(--s-sm);
}
.detail-cookie-input {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 72px;
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    font: inherit;
    line-height: 1.5;
    resize: vertical;
    outline: none;
}
.detail-cookie-input::placeholder {
    color: var(--ink-faint);
}
.detail-cookie-save-btn {
    flex: 0 0 auto;
    width: auto;
    min-width: 44px;
    padding: 0 10px;
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 600;
}

.detail-container {
    display: flex;
    flex-direction: column;
    gap: var(--s-lg);
    min-width: 0;
}
.detail-section {
    padding: var(--s-lg);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-5);
    background: var(--surface-1);
    min-width: 0;
}
.detail-section-title {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    margin-bottom: var(--s-md);
    color: var(--ink);
    font-weight: 600;
    min-width: 0;
    white-space: nowrap;
}
.detail-section-title svg { flex-shrink: 0; }
.detail-label {
    display: block;
    margin-bottom: 4px;
    color: var(--ink-mute);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.detail-value {
    display: block;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ink);
    font-size: var(--text-sm);
}
.detail-value .code-box,
.detail-value .team-parent-annotation {
    white-space: normal;
}

.team-parent-annotation {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 220px;
    min-width: 0;
    margin-top: 6px;
    color: var(--ink-soft);
    font-size: var(--text-xs);
    line-height: 1.2;
    vertical-align: middle;
}
.team-parent-annotation svg {
    width: 13px;
    height: 13px;
    flex: 0 0 auto;
}
.team-parent-annotation span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-workspace-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    text-align: left;
    background: transparent;
    color: var(--ink);
    min-width: 0;
    position: relative;
    overflow: hidden;
}
.team-workspace-item__main {
    flex: 1 1 auto;
    min-width: 0;
}
.team-workspace-item__title {
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.team-workspace-item__meta {
    margin-top: 4px;
    color: var(--ink-mute);
    font-size: var(--text-xs);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.team-workspace-item__badges {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    flex: 0 0 auto;
}
.team-workspace-item__pulse {
    position: absolute;
    right: 12px;
    bottom: 10px;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--brand);
    box-shadow: 0 0 0 0 var(--brand-tint-2);
    animation: teamPulse 2s infinite;
}

.team-entity-title,
.team-entity-subtitle {
    max-width: 260px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.team-entity-title {
    color: var(--ink);
    font-size: var(--text-sm);
    font-weight: 600;
}
.team-entity-subtitle {
    margin-top: 4px;
    color: var(--ink-mute);
    font-size: var(--text-xs);
}
.team-local-match {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.team-local-account-result {
    width: 100%;
    text-align: left;
    border: 1px solid var(--line);
    border-radius: var(--r-3);
    background: var(--surface-1);
    color: var(--ink);
    padding: 8px 10px;
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out);
}
.team-local-account-result:hover {
    background: var(--surface-hover);
    border-color: var(--line-strong);
}
.team-action-hint {
    color: var(--ink-mute);
    font-size: var(--text-xs);
    white-space: nowrap;
}

.team-skeleton-card {
    min-height: 96px;
    display: grid;
    gap: 10px;
    align-content: center;
    padding: var(--s-md);
}
.team-skeleton-line {
    height: 12px;
    width: 54%;
    border-radius: var(--r-pill);
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-hover) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: teamShimmer 1.6s linear infinite;
}
.team-skeleton-line--medium { width: 70%; }
.team-skeleton-line--wide { width: 92%; }

@keyframes teamPulse {
    0% { box-shadow: 0 0 0 0 var(--brand-tint-2); opacity: 1; }
    70% { box-shadow: 0 0 0 8px transparent; opacity: 0.75; }
    100% { box-shadow: 0 0 0 0 transparent; opacity: 1; }
}

@keyframes teamShimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

.team-workspace-alert--success {
    background: var(--success-tint);
    border-left-color: var(--success);
    color: var(--success);
}
.team-workspace-alert--warning {
    background: var(--warning-tint);
    border-left-color: var(--warning);
    color: var(--warning);
}
.team-workspace-alert--error {
    background: var(--danger-tint);
    border-left-color: var(--danger);
    color: var(--danger);
}

.aether-pool-target-table,
.aether-pool-summary-table { min-width: 980px; }
.aether-pool-summary-table td,
.aether-pool-summary-table th { text-align: center; }

#overview-service,
#overview-service-meta,
.stat-label,
.stat-value,
.stat-meta {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Toolbar card */
.toolbar-card .card-body {
    display: flex;
    flex-direction: column;
    gap: var(--s-sm);
}

/* ── 26. Misc ── */
.upload-section {
    padding: var(--s-md);
    background: var(--surface-1);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-5);
}
.upload-section .form-group { margin-bottom: var(--s-sm); }
.upload-section .form-group:last-child { margin-bottom: 0; }

/* ── 26b. Task orchestration form (registration workbench) ── */
.task-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}
.task-form__section {
    display: flex;
    flex-direction: column;
    gap: var(--s-md);
    padding: var(--s-md) 0 var(--s-lg);
    border-bottom: 1px dashed var(--line-soft);
}
.task-form__section:first-child { padding-top: 4px; }
.task-form__section:last-of-type { border-bottom: none; }
.task-form__section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 2px;
}
.task-form__section-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--brand-tint);
    color: var(--brand);
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1;
}
.task-form__section-title {
    font-size: 0.86rem;
    font-weight: 600;
    color: var(--ink);
    letter-spacing: 0.01em;
    line-height: 1.2;
}
.task-form .form-group { margin-bottom: 0; }
.task-form .form-row { margin-bottom: 0; }
.task-form .form-row > .form-group { margin-bottom: 0; }

/* Inline checkbox row (two side-by-side toggles) */
.task-form__toggles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--s-md);
    padding: var(--s-md);
    background: var(--surface-1);
    border: 1px solid var(--line-soft);
    border-radius: var(--r-5);
}
.task-form__toggles .form-group { margin: 0; }
.task-form__toggles .checkbox-label { font-weight: 500; }

/* Collapsible upload section using <details> */
details.task-form__collapsible {
    border: 1px solid var(--line);
    border-radius: var(--r-5);
    background: var(--surface-1);
    overflow: hidden;
    transition: border-color var(--duration-fast) var(--ease-out);
}
details.task-form__collapsible[open] {
    border-color: var(--line-strong);
    background: var(--surface);
}
details.task-form__collapsible > summary {
    list-style: none;
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    padding: 11px 14px;
    cursor: pointer;
    user-select: none;
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--ink);
    transition: background var(--duration-fast) var(--ease-out);
}
details.task-form__collapsible > summary:hover { background: var(--surface-hover); }
details.task-form__collapsible > summary::-webkit-details-marker,
details.task-form__collapsible > summary::marker { display: none; content: ''; }
.task-form__collapsible-caret {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    color: var(--ink-mute);
    transition: transform var(--duration-fast) var(--ease-out);
}
details.task-form__collapsible[open] .task-form__collapsible-caret {
    transform: rotate(90deg);
}
.task-form__collapsible-title {
    flex: 1 1 auto;
    min-width: 0;
}
.task-form__collapsible-body {
    padding: 4px var(--s-md) var(--s-md);
    border-top: 1px solid var(--line-soft);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px var(--s-md);
}
.task-form__collapsible-body .form-group { margin: 0; padding-top: 8px; }

/* Action bar */
.task-form__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--s-sm);
    margin-top: var(--s-lg);
    padding-top: var(--s-lg);
    border-top: 1px solid var(--line);
}
.task-form__actions .btn-primary {
    flex: 1 1 160px;
    min-height: 42px;
}
.task-form__actions .btn-secondary {
    flex: 0 1 auto;
    min-height: 42px;
}
.task-form__actions .btn-ghost {
    margin-left: auto;
    min-height: 42px;
    color: var(--ink-mute);
}
.task-form__actions .btn-ghost:hover {
    color: var(--danger);
    background: var(--danger-tint);
}

@media (max-width: 480px) {
    .task-form__actions .btn-ghost { margin-left: 0; flex: 1 1 100%; order: 99; }
    .task-form__actions .btn-secondary { flex: 1 1 100%; }
    .task-form__collapsible-body { grid-template-columns: 1fr; }
}

/* Progress badge in card header */
.progress-badge { font-family: var(--font-mono); }

/* Page-level shells */
.app-page--index .page-content,
.app-page--accounts .page-content,
.app-page--team-spaces .page-content,
.app-page--aether-pool-monitor .page-content,
.app-page--email-services .page-content,
.app-page--payment .page-content,
.app-page--settings .page-content {
    padding: var(--s-xl) var(--s-2xl);
}

/* ── 27. Responsive ── */
@media (max-width: 1280px) {
    .two-col-layout { grid-template-columns: 1fr; }
    .two-col-layout > .left-panel .sticky-card { position: static; }
    .team-workbench-shell { grid-template-columns: 1fr; }
    .team-workspace-rail { position: static; }
    .team-rail-card { max-height: none; }
    .aether-pool-workbench { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
    .settings-layout { grid-template-columns: 1fr; }
    .settings-layout > .left-panel { position: static; }
    .team-invite-grid { grid-template-columns: 1fr; }
    .team-form-row { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    :root { --sidebar-w: 220px; }
    .page-content,
    .app-page--index .page-content,
    .app-page--accounts .page-content,
    .app-page--team-spaces .page-content,
    .app-page--aether-pool-monitor .page-content,
    .app-page--email-services .page-content,
    .app-page--payment .page-content,
    .app-page--settings .page-content {
        padding: var(--s-lg);
    }
    .app-topbar { padding: var(--s-md) var(--s-lg); }
    .aether-pool-form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: min(280px, 86vw);
        transform: translateX(-100%);
        transition: transform var(--duration-base) var(--ease-out);
        box-shadow: var(--shadow-3);
        z-index: 60;
    }
    .app-shell.sidebar-open .app-sidebar { transform: translateX(0); }
    .app-shell.sidebar-open .sidebar-backdrop { display: block; }
    .mobile-menu-toggle { display: inline-flex; }
    .app-topbar {
        padding: var(--s-sm) var(--s-md);
        gap: var(--s-sm);
    }
    .page-title { font-size: 1.15rem; }
    .page-content,
    .app-page--index .page-content,
    .app-page--accounts .page-content,
    .app-page--team-spaces .page-content,
    .app-page--aether-pool-monitor .page-content,
    .app-page--email-services .page-content,
    .app-page--payment .page-content,
    .app-page--settings .page-content {
        padding: var(--s-md);
    }
    .stat-card { padding: var(--s-sm) var(--s-md); }
    .stat-value { font-size: 1.2rem; }
    .modal__header, .modal__footer, .modal__body { padding-left: var(--s-lg); padding-right: var(--s-lg); }
    .filter-toolbar > * { flex: 1 1 100%; max-width: 100%; }
    .filter-toolbar__search { flex-basis: 100%; max-width: 100%; }
    .pagination { flex-direction: column; align-items: stretch; }
    .pagination__nav { justify-content: center; }
    .pagination__jump { justify-content: center; }
    .data-table { font-size: var(--text-xs); }
    .data-table thead th, .data-table tbody td { padding: 8px 10px; }
    .toast-container { left: var(--s-sm); right: var(--s-sm); top: var(--s-sm); max-width: none; }
    .team-overview-hero { padding: var(--s-lg); }
    .team-hero-copy h2 { font-size: 1.4rem; }
    .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .btn { padding: 8px 12px; min-height: 36px; }
    .btn-sm { padding: 5px 9px; min-height: 28px; }
    .card-header { padding: var(--s-sm) var(--s-md); }
    .card-body { padding: var(--s-md); }
    .modal__content { border-radius: var(--r-6); }
    .stats-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .outcome-grid { grid-template-columns: repeat(2, 1fr); }
    .step-indicator { grid-template-columns: 1fr 1fr; }
    .auth-logo h2 { font-size: 1.4rem; }
    .login-card .card-body, .login-card .modal__body { padding: var(--s-lg); }
}

/* ── 28. Print & motion preferences ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    .app-sidebar, .app-topbar, .modal, .toast-container { display: none !important; }
    .app-shell { grid-template-columns: 1fr; }
    .page-content { padding: 0; max-width: none; }
    .card { border: 1px solid #ccc; box-shadow: none; }
}
