/* ============================================================
   Backlink Panel — Design System v3
   Neutral gray & white theme
   ============================================================ */


/* ---------- 1. Design Tokens ---------- */

:root {
    color-scheme: light;

    --font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI Variable', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;

    /* Neutral gray & white palette */
    --bg:             #f5f6f8;
    --surface:        #ffffff;
    --surface-2:      #f3f4f6;
    --surface-3:      #e7e9ed;
    --surface-inset:  #fafbfc;

    --border:         #e4e7ec;
    --border-strong:  #d0d5dd;
    --border-focus:   rgba(215, 25, 32, 0.45);

    --text:           #12151b;
    --text-secondary: #475467;
    --text-tertiary:  #566377;

    --accent:         #d71920;
    --accent-hover:   #b5141a;
    --accent-text:    #b4151b;
    --on-accent:      #ffffff;
    --accent-soft:    rgba(215, 25, 32, 0.07);
    --accent-soft-strong: rgba(215, 25, 32, 0.16);
    --accent-glow:    rgba(215, 25, 32, 0.16);

    --hover:          rgba(16, 24, 40, 0.04);
    --hover-strong:   rgba(16, 24, 40, 0.08);

    --success:        #16a34a;
    --success-text:   #166534;
    --success-soft:   rgba(22, 163, 74, 0.1);
    --warning:        #d97706;
    --warning-text:   #92400e;
    --warning-soft:   rgba(217, 119, 6, 0.1);
    --danger:         #dc2626;
    --danger-text:    #b91c1c;
    --danger-soft:    rgba(220, 38, 38, 0.08);
    --danger-solid:   #b91c1c;
    --success-solid:  #15803d;
    --on-success:     #ffffff;

    --gradient-accent:  var(--accent);
    --gradient-glow:    var(--accent-soft);
    --gradient-surface: var(--surface);

    --shadow-xs:  0 1px 2px rgba(16,24,40,0.05);
    --shadow-sm:  0 1px 3px rgba(16,24,40,0.08), 0 1px 2px rgba(16,24,40,0.04);
    --shadow-md:  0 6px 16px rgba(16,24,40,0.08), 0 2px 4px rgba(16,24,40,0.04);
    --shadow-lg:  0 8px 24px rgba(0,0,0,0.1), 0 2px 6px rgba(0,0,0,0.05);
    --shadow-xl:  0 16px 40px rgba(0,0,0,0.14), 0 4px 12px rgba(0,0,0,0.06);
    --shadow-glow: 0 0 0 0 transparent;

    --glass-bg:   var(--surface);
    --glass-blur: none;

    --chart-line: #d71920;
    --chart-fill: rgba(215, 25, 32, 0.07);
    --chart-grid: rgba(16, 24, 40, 0.08);

    --r-xs:  6px;
    --r-sm:  8px;
    --r-md:  10px;
    --r-lg:  12px;
    --r-xl:  16px;
    --r-full: 9999px;

    --transition: 0.15s ease;
    --transition-fast: 0.1s ease;
    --transition-slow: 0.25s ease;

    --sidebar-w: 248px;
    --sidebar-collapsed-w: 64px;
    --topbar-h: 56px;
    --content-max: 1200px;
}

/* Neutral dark variant (opt-in via the theme toggle or OS preference when set to "system") */
[data-theme="dark"] {
    color-scheme: dark;
    --bg:             #0d0f13;
    --surface:        #161920;
    --surface-2:      #1d2129;
    --surface-3:      #272c36;
    --surface-inset:  #11141a;
    --border:         #262b35;
    --border-strong:  #384050;
    --border-focus:   rgba(255, 107, 111, 0.6);
    --text:           #f4f5f7;
    --text-secondary: #a3adbd;
    --text-tertiary:  #94a0b3;
    --accent:         #d71920;
    --accent-hover:   #ee2b33;
    --accent-text:    #ff7478;
    --on-accent:      #ffffff;
    --accent-soft:    rgba(255, 107, 111, 0.1);
    --accent-soft-strong: rgba(255, 107, 111, 0.2);
    --accent-glow:    rgba(255, 107, 111, 0.2);
    --hover:          rgba(250, 250, 250, 0.05);
    --hover-strong:   rgba(250, 250, 250, 0.09);
    --success:        #22c55e;
    --success-text:   #4ade80;
    --success-soft:   rgba(34, 197, 94, 0.12);
    --warning:        #eab308;
    --warning-text:   #facc15;
    --warning-soft:   rgba(234, 179, 8, 0.12);
    --danger:         #ef4444;
    --danger-text:    #f87171;
    --danger-soft:    rgba(239, 68, 68, 0.12);
    --danger-solid:   #dc2626;
    --success-solid:  #22c55e;
    --on-success:     #052e16;
    --shadow-xs:  0 1px 2px rgba(0,0,0,0.4);
    --shadow-sm:  0 2px 6px rgba(0,0,0,0.4);
    --shadow-md:  0 4px 14px rgba(0,0,0,0.45);
    --shadow-lg:  0 8px 28px rgba(0,0,0,0.5);
    --shadow-xl:  0 16px 44px rgba(0,0,0,0.55);
    --chart-line: #ff6b6f;
    --chart-fill: rgba(255, 107, 111, 0.1);
    --chart-grid: rgba(250, 250, 250, 0.08);
}

/* ---------- 2. Reset & Base ---------- */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    scroll-behavior: smooth;
    tab-size: 4;
}

body {
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--bg);
}

a { color: var(--accent-text); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

img, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
strong { font-weight: 600; }
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

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

.skip-link {
    position: fixed; top: -100%; left: 16px; z-index: 9999;
    padding: 8px 16px; background: var(--accent); color: var(--on-accent);
    border-radius: var(--r-sm); font-weight: 600; font-size: 13px;
}
.skip-link:focus { top: 16px; }

/* ---------- 3. Typography ---------- */

h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; color: var(--text); }
.mono { font-family: var(--mono); font-size: 0.92em; }
.muted { color: var(--text-secondary); }
.faint { color: var(--text-tertiary); }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12.5px; }
.text-md { font-size: 14px; }
.text-lg { font-size: 16px; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metric-value { font-variant-numeric: tabular-nums; font-weight: 500; }

/* ---------- 4. Utility ---------- */

.flex { display: flex; align-items: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }

/* ---------- 5. Layout Shell ---------- */

.app {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    z-index: 30;
    display: flex;
    flex-direction: column;
    background: var(--glass-bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-right: 1px solid var(--border);
    transition: width var(--transition-slow), transform var(--transition-slow);
    overflow: hidden;
}

.sidebar-header {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    padding: 0 16px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 600;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
}

.brand:hover { color: var(--text); text-decoration: none; }

.brand-mark {
    width: 32px;
    height: 32px;
    border-radius: var(--r-sm);
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--on-accent);
    flex-shrink: 0;
    box-shadow: 0 2px 8px var(--accent-soft-strong);
}

.brand-name { overflow: hidden; text-overflow: ellipsis; transition: opacity var(--transition); }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 12px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.nav-group { margin-bottom: 8px; }

.nav-group-label {
    padding: 6px 20px 6px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    margin: 1px 8px;
    border-radius: var(--r-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 450;
    white-space: nowrap;
    transition: all var(--transition);
    position: relative;
}

.nav-item:hover {
    color: var(--text);
    background: var(--hover);
    text-decoration: none;
}

.nav-item.is-active {
    color: var(--text);
    background: var(--accent-soft);
    font-weight: 500;
}

.nav-item.is-active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--gradient-accent);
    border-radius: 0 3px 3px 0;
}

.nav-item .icon { flex-shrink: 0; color: var(--text-tertiary); transition: color var(--transition); }
.nav-item:hover .icon { color: var(--text-secondary); }
.nav-item.is-active .icon { color: var(--accent-text); }

.nav-label { overflow: hidden; text-overflow: ellipsis; transition: opacity var(--transition); }

.nav-count {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: var(--r-full);
    background: var(--accent-soft);
    color: var(--accent-text);
    font-size: 10.5px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    flex-shrink: 0;
}

.sidebar-scrim {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 29;
    background: rgba(0,0,0,0.6);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

/* Collapsed sidebar */
.app[data-sidebar="collapsed"] .sidebar { width: var(--sidebar-collapsed-w); }
.app[data-sidebar="collapsed"] .brand-name,
.app[data-sidebar="collapsed"] .nav-group-label,
.app[data-sidebar="collapsed"] .nav-label,
.app[data-sidebar="collapsed"] .nav-count { opacity: 0; pointer-events: none; width: 0; }
.app[data-sidebar="collapsed"] .nav-item { justify-content: center; padding: 10px; margin: 1px 8px; }
.app[data-sidebar="collapsed"] .main { margin-left: var(--sidebar-collapsed-w); }

/* ---------- 6. Main & Topbar ---------- */

.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    transition: margin-left var(--transition-slow);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    background: var(--glass-bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.icon-btn {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--r-sm);
    cursor: pointer;
    position: relative;
    transition: all var(--transition);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }

.icon-btn.has-dot::after {
    content: '';
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
}

.only-mobile { display: none; }
.only-desktop { display: inline-flex; }

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    min-width: 0;
    overflow: hidden;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: color var(--transition);
}

.breadcrumb-item:hover { color: var(--text); text-decoration: none; }
.breadcrumb-item.current { color: var(--text); font-weight: 500; }
.breadcrumb-sep { color: var(--text-tertiary); font-size: 12px; margin: 0 2px; }

/* Search trigger */
.search-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 34px;
    padding: 0 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-tertiary);
    font-size: 12.5px;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.search-trigger:hover { border-color: var(--border-strong); color: var(--text-secondary); }

.kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 20px;
    padding: 0 5px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 10.5px;
    font-family: var(--font);
    color: var(--text-tertiary);
    line-height: 1;
}

/* Account button */
.topbar-user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 4px;
    border-radius: var(--r-sm);
    transition: background var(--transition);
}
.topbar-user:hover { background: var(--hover); }
.nav-user { color: var(--text-secondary); }

/* Avatar */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
    color: var(--text);
    background: var(--surface-3);
    border: 1px solid var(--border);
    flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-md { width: 34px; height: 34px; font-size: 13px; }
.avatar-lg { width: 44px; height: 44px; font-size: 16px; }

/* ---------- 7. Content Area ---------- */

.content {
    flex: 1;
    padding: 24px 24px 40px;
    max-width: var(--content-max);
    width: 100%;
    margin: 0 auto;
}

/* Page head */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 22px;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.page-sub {
    font-size: 13.5px;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.5;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ---------- 8. Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    height: 36px;
    padding: 0 16px;
    border-radius: var(--r-sm);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--transition);
    line-height: 1;
    text-decoration: none;
    position: relative;
    overflow: visible;
}

.btn:hover { text-decoration: none; }
.btn:disabled, .btn.is-loading { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.98); }

.btn-primary {
    background: var(--accent);
    color: var(--on-accent);
    border: 1px solid var(--accent);
    box-shadow: var(--shadow-xs);
}
.btn-primary:hover {
    color: var(--on-accent);
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn-secondary {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text);
}
.btn-secondary:hover {
    background: var(--surface-3);
    border-color: var(--hover-strong);
    color: var(--text);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--hover); color: var(--text); }

.btn-danger {
    background: var(--danger-soft);
    border-color: rgba(239,68,68,0.2);
    color: var(--danger-text);
}
.btn-danger:hover {
    background: rgba(239,68,68,0.15);
    border-color: rgba(239,68,68,0.3);
}

.btn-accent {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--on-accent);
}
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-sm { height: 30px; padding: 0 11px; font-size: 12px; border-radius: var(--r-xs); }
.btn-xs { height: 26px; padding: 0 8px; font-size: 11.5px; border-radius: var(--r-xs); }

.btn-link {
    background: none;
    border: none;
    color: var(--accent-text);
    cursor: pointer;
    padding: 0;
    font-size: inherit;
}
.btn-link:hover { color: var(--accent-hover); text-decoration: underline; }

.btn .icon { flex-shrink: 0; }
.btn .spinner { animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 9. Forms ---------- */

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-width: 400px;
}

.field-label {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
}

.field-hint {
    font-size: 11.5px;
    color: var(--text-tertiary);
    line-height: 1.5;
}

.input, .select, .textarea {
    height: 38px;
    padding: 0 12px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    color: var(--text);
    font-size: 13.5px;
    transition: all var(--transition);
    width: 100%;
}

.input::placeholder, .textarea::placeholder { color: var(--text-tertiary); }

.input:hover, .select:hover, .textarea:hover { border-color: var(--hover-strong); }

.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.textarea { height: auto; min-height: 80px; padding: 10px 12px; resize: vertical; line-height: 1.6; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%235d6274' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; cursor: pointer; }
.input-sm { height: 30px; padding: 0 9px; font-size: 12.5px; }
.select-sm { height: 30px; padding: 0 28px 0 9px; font-size: 12.5px; }
.checkbox, .radio { accent-color: var(--accent); }

.field-error { display: none; color: var(--danger-text); font-size: 12px; margin-top: 2px; }

/* ---------- 10. Cards ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover { border-color: var(--border-strong); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}
.card-header > * { min-width: 0; }
.card-header > .card-actions { margin-left: auto; }
@media (max-width: 640px) {
    .card-header { padding: 14px 16px; }
    .card-header > .card-actions,
    .card-header > div:last-child:not(:first-child) { margin-left: 0; width: 100%; }
}

.card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; }

/* Grid */
.grid { display: grid; gap: 16px; }
.grid-12 { grid-template-columns: repeat(12, 1fr); }
.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.kpi::before { display: none; }

.kpi:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.kpi:hover::before { opacity: 1; }

.kpi-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kpi-label .icon { color: var(--text-tertiary); }

.kpi-value {
    font-size: 26px;
    font-weight: 650;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
    color: var(--text);
}

.kpi-foot {
    font-size: 12px;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.kpi-foot a { color: var(--accent-text); font-weight: 500; }

/* ---------- 11. Data Tables ---------- */

.table-wrap { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th:first-child, .data-table td:first-child { padding-left: 16px; }
.data-table th:last-child, .data-table td:last-child { padding-right: 16px; }

.data-table th {
    padding: 10px 10px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: var(--surface-inset);
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table th[data-sort] { cursor: pointer; user-select: none; }
.data-table th[data-sort]:hover { color: var(--text-secondary); }

.data-table td {
    padding: 10px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    max-width: 340px;
    overflow-wrap: break-word;
}
.data-table td.nowrap,
.data-table td.mono,
.data-table td.metric-value,
.data-table td .nowrap { white-space: nowrap; }
.data-table .cell-secondary { overflow: hidden; text-overflow: ellipsis; }
.data-table td .truncate { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.data-table tbody tr { transition: background var(--transition-fast); }
.data-table tbody tr:hover { background: var(--hover); }
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table th.cell-actions,
.data-table td.cell-actions {
    width: 1%;
    text-align: right;
    white-space: nowrap;
    overflow: visible;
}
.data-table td.cell-actions > * { vertical-align: middle; }
.data-table td.cell-actions > * + * { margin-left: 4px; }

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-tertiary);
    flex-wrap: wrap;
}

.table-meta { font-size: 12px; color: var(--text-tertiary); }

.pagination { display: flex; align-items: center; gap: 2px; }

.page-btn {
    min-width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--r-xs);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
    border: none;
    background: none;
    cursor: pointer;
    text-decoration: none;
    padding: 0 4px;
}

.page-btn:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.page-btn.is-active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.page-btn[aria-disabled="true"] { opacity: 0.3; cursor: default; pointer-events: none; }

.url-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-cell a {
    display: block;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}

.data-table td.mono.text-xs {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* ---------- 12. Dropdowns ---------- */

.dropdown { position: relative; display: inline-flex; }

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 50;
    min-width: 200px;
    margin-top: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    padding: 6px;
    display: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.dropdown-menu.is-open { display: block; animation: dropdown-in 0.18s cubic-bezier(0.21,0.9,0.35,1); }

@keyframes dropdown-in {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-secondary);
    border-radius: var(--r-xs);
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: all var(--transition-fast);
}

.dropdown-item:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.dropdown-item.is-danger { color: var(--danger-text); }
.dropdown-item.is-danger:hover { background: var(--danger-soft); }

.dropdown-label {
    padding: 6px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.dropdown-sep { height: 1px; background: var(--border); margin: 4px 0; }

.dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px 8px;
}

.dropdown-header .title { font-size: 13px; font-weight: 600; color: var(--text); }

.dropdown-panel { min-width: 340px; max-height: 420px; overflow-y: auto; right: -12px; }

/* Notification items in dropdown */
.notif-empty { padding: 28px 16px; text-align: center; color: var(--text-tertiary); font-size: 13px; }

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    transition: background var(--transition-fast);
}
.notif-item:hover { background: var(--hover); }
.notif-item.is-unread { background: var(--surface-inset); box-shadow: inset 3px 0 0 var(--accent); }

.notif-item .notif-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-tertiary);
}

.notif-item .notif-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.notif-item .notif-title { display: block; font-size: 12.5px; font-weight: 500; color: var(--text); line-height: 1.4; }
.notif-item .notif-desc,
.notif-item .notif-text { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-item .notif-time { display: block; font-size: 11px; color: var(--text-tertiary); margin-top: 0; }

/* ---------- 13. Modals ---------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(0,0,0,0.6);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    animation: fade-in 0.2s ease;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modal-in 0.25s cubic-bezier(0.21,0.9,0.35,1);
}

@keyframes modal-in {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: none; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 16px; font-weight: 600; }
.modal-body { padding: 20px; overflow-y: auto; min-height: 0; flex: 1 1 auto; overscroll-behavior: contain; }
.modal-header, .modal-footer { flex-shrink: 0; }
.modal-body .field { max-width: none; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }

/* ---------- 14. Toasts ---------- */

.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    max-width: 380px;
    width: 100%;
}

.toast {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    color: var(--text);
    animation: toast-in 0.35s cubic-bezier(0.21,0.9,0.35,1);
    position: relative;
    overflow: hidden;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    background: var(--accent);
    animation: toast-progress linear forwards;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(30px) scale(0.96); }
    to { opacity: 1; transform: none; }
}

@keyframes toast-out {
    to { opacity: 0; transform: translateX(30px) scale(0.96); }
}

@keyframes toast-progress {
    from { width: 100%; }
    to { width: 0%; }
}

.toast.tone-success { border-left: 3px solid var(--success); }
.toast.tone-success::after { background: var(--success); }
.toast.tone-danger { border-left: 3px solid var(--danger); }
.toast.tone-danger::after { background: var(--danger); }
.toast.tone-warning { border-left: 3px solid var(--warning); }
.toast.tone-warning::after { background: var(--warning); }
.toast.tone-info { border-left: 3px solid var(--accent); }
.toast.tone-info::after { background: var(--accent); }

.toast .toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast .toast-body { flex: 1; min-width: 0; line-height: 1.5; }
.toast .toast-close {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition);
}
.toast .toast-close:hover { background: var(--hover); color: var(--text-secondary); }

/* ---------- 15. Status Badges ---------- */

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    padding: 3px 10px 3px 8px;
    border-radius: var(--r-full);
    white-space: nowrap;
    line-height: 1;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-success { background: var(--success-soft); color: var(--success-text); }
.status-success .status-dot { background: var(--success); }

.status-warning { background: var(--warning-soft); color: var(--warning-text); }
.status-warning .status-dot { background: var(--warning); }

.status-danger { background: var(--danger-soft); color: var(--danger-text); }
.status-danger .status-dot { background: var(--danger); }

.status-accent { background: var(--accent-soft); color: var(--accent-text); }
.status-accent .status-dot { background: var(--accent); }

.notif-unread-dot { display: inline-block; width: 7px; height: 7px; margin: 0 7px 1px 0; border-radius: 50%; background: var(--accent); vertical-align: middle; }

.status-neutral { background: var(--hover); color: var(--text-secondary); }
.status-neutral .status-dot { background: var(--text-tertiary); }

.status-dot.is-pulsing { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.5); } }

/* Tags */
.tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--r-xs);
    background: var(--hover);
    color: var(--text-secondary);
}

.tag-dofollow { background: var(--success-soft); color: var(--success-text); text-transform: uppercase; letter-spacing: 0.04em; font-size: 10.5px; }
.tag-nofollow { background: var(--warning-soft); color: var(--warning-text); text-transform: uppercase; letter-spacing: 0.04em; font-size: 10.5px; }

/* ---------- 16. Command Palette ---------- */

.cmd-backdrop {
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(0,0,0,0.5);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    display: flex;
    justify-content: center;
    padding-top: 15vh;
    animation: fade-in 0.15s ease;
}

.cmd-dialog {
    width: 560px;
    max-height: 420px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modal-in 0.2s cubic-bezier(0.21,0.9,0.35,1);
}

.cmd-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.cmd-input {
    flex: 1;
    border: none;
    background: none;
    color: var(--text);
    font-size: 15px;
    outline: none;
}

.cmd-input::placeholder { color: var(--text-tertiary); }

.cmd-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    scrollbar-width: thin;
}

.cmd-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 13.5px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.cmd-item:hover, .cmd-item.is-active { background: var(--accent-soft); color: var(--text); }
.cmd-item .icon { color: var(--text-tertiary); flex-shrink: 0; }
.cmd-item .cmd-desc { font-size: 12px; color: var(--text-tertiary); margin-left: auto; }
.cmd-empty { padding: 32px 16px; text-align: center; color: var(--text-tertiary); font-size: 13px; }
.cmd-footer { padding: 8px 16px; border-top: 1px solid var(--border); display: flex; gap: 14px; font-size: 11.5px; color: var(--text-tertiary); }

/* ---------- 17. Empty States ---------- */

.empty-state {
    padding: 48px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.empty-title { font-size: 14px; font-weight: 600; color: var(--text); }
.empty-text { font-size: 13px; color: var(--text-secondary); max-width: 340px; line-height: 1.6; }
.empty-actions { margin-top: 8px; }

/* ---------- 18. Activity List ---------- */

.activity-list { display: flex; flex-direction: column; }

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
}

.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--hover); }

.activity-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.activity-icon.tone-success { background: var(--success-soft); border-color: rgba(34,197,94,0.2); color: var(--success-text); }
.activity-icon.tone-neutral { background: var(--surface-2); color: var(--text-tertiary); }
.activity-icon.tone-danger { background: var(--danger-soft); border-color: rgba(239,68,68,0.2); color: var(--danger-text); }
.activity-icon.tone-accent { background: var(--accent-soft); border-color: var(--accent-soft-strong); color: var(--accent-text); }

.activity-body { flex: 1; min-width: 0; }
.activity-title { font-size: 13px; font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-desc { font-size: 12px; color: var(--text-tertiary); margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.money { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 13px; white-space: nowrap; }
.money-credit { color: var(--success-text); }
.money-debit { color: var(--text-secondary); }

/* ---------- 19. Callout ---------- */

.callout {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--r-md);
    font-size: 13px;
    line-height: 1.6;
    border: 1px solid;
}

.callout-info { background: var(--accent-soft); border-color: var(--accent-soft-strong); color: var(--accent-text); }
.callout-info .icon { color: var(--accent-text); }
.callout-success { background: var(--success-soft); border-color: rgba(34,197,94,0.2); }
.callout-warning { background: var(--warning-soft); border-color: rgba(234,179,8,0.2); }
.callout-danger { background: var(--danger-soft); border-color: rgba(239,68,68,0.2); }
.callout a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 20. Progress Bars ---------- */

.progress {
    height: 6px;
    border-radius: var(--r-full);
    background: var(--hover);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: var(--r-full);
    background: var(--gradient-accent);
    transition: width 0.8s cubic-bezier(0.22,0.9,0.3,1);
}

.progress-fill.tone-success { background: var(--success); }
.progress-fill.tone-warning { background: var(--warning); }
.progress-fill.tone-danger { background: var(--danger); }

/* ---------- 21. Charts ---------- */

.chart-container { padding: 16px 20px 20px; }
.chart-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; }
.chart-header .value { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-header .change { font-size: 12px; font-weight: 500; }
.chart-header .change.up { color: var(--success-text); }
.chart-header .change.down { color: var(--danger-text); }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); margin-top: 10px; }
.chart-legend-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }

/* ---------- 22. Stepper ---------- */

.stepper {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 14px 20px;
    margin-bottom: 20px;
}

.stepper .step {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.stepper .step-index {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
    display: grid;
    place-items: center;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-tertiary);
    background: var(--surface);
    transition: all var(--transition);
}

.stepper .step.is-active .step-index { border-color: var(--accent); color: var(--on-accent); background: var(--accent); box-shadow: none; }
.stepper .step.is-done .step-index { border-color: var(--success-solid); color: var(--on-success); background: var(--success-solid); }

.step-label { font-size: 13px; font-weight: 500; color: var(--text-tertiary); white-space: nowrap; }
.step.is-active .step-label { color: var(--text); }
.step.is-done .step-label { color: var(--text-secondary); }

.stepper .step-connector {
    flex: 1;
    height: 2px;
    min-width: 24px;
    margin: 0 14px;
    border-radius: 2px;
    background: var(--border);
    transition: background var(--transition);
}

.stepper .step.is-done + .step-connector { background: var(--success); }
.stepper .step.is-active + .step-connector { background: var(--accent); }

/* ---------- 23. Auth Pages ---------- */

.auth-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
    background: var(--bg);
    position: relative;
    overflow: hidden;
}

.auth-body::before { display: none; }

@keyframes auth-bg-drift {
    from { transform: translate(-2%, -1%) rotate(0deg); }
    to { transform: translate(2%, 1%) rotate(3deg); }
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--glass-bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-xl);
    padding: 32px;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
    animation: card-in 0.5s cubic-bezier(0.21,0.9,0.35,1);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    color: var(--text);
}
.auth-brand:hover { color: var(--text); text-decoration: none; }

.auth-title { font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.auth-sub { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form .field { max-width: none; }

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--r-sm);
    background: var(--danger-soft);
    border: 1px solid rgba(239,68,68,0.2);
    color: var(--danger-text);
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.auth-alert .icon { flex-shrink: 0; margin-top: 1px; }

.auth-tabs {
    display: flex;
    gap: 2px;
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 3px;
    margin-bottom: 20px;
}

.auth-tab {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 12px;
    border-radius: var(--r-xs);
    cursor: pointer;
    transition: all var(--transition);
}

.auth-tab:hover { color: var(--text); }
.auth-tab.is-active { background: var(--surface-3); color: var(--text); box-shadow: var(--shadow-xs); }

/* ---------- 24. Landing Page ---------- */

.landing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

.landing-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--glass-bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-bottom: 1px solid var(--border);
}

.landing-nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.landing-actions { display: flex; align-items: center; gap: 8px; }

.landing-main { flex: 1; }

.landing-container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

/* Hero */
.hero {
    padding: 100px 0 80px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: none;
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 600px;
    background: none;
    pointer-events: none;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    padding: 6px 16px;
    margin-bottom: 24px;
}

.eyebrow .icon { color: var(--accent-text); }

.hero h1 {
    font-size: 48px;
    line-height: 1.1;
    letter-spacing: -0.035em;
    font-weight: 700;
    max-width: 800px;
    margin: 0 auto 20px;
    color: var(--text);
    position: relative;
    z-index: 1;
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}

.hero-sub {
    font-size: 17px;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 640px;
    margin: 0 auto 32px;
    position: relative;
    z-index: 1;
}

.hero-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 56px;
    margin-top: 64px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.hero-stat .v {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.hero-stat .l {
    font-size: 12.5px;
    color: var(--text-tertiary);
    margin-top: 4px;
    font-weight: 500;
}

/* Sections */
.section {
    padding: 80px 0;
    border-top: 1px solid var(--border);
}

.section-head { text-align: center; margin-bottom: 48px; }

.section-kicker {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent-text);
    margin-bottom: 12px;
}

.section-title {
    font-size: 30px;
    font-weight: 650;
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.section-sub {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    max-width: 620px;
    margin: 14px auto 0;
}

/* Features */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.feature-card {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all var(--transition);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
}

.feature-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    transform: none;
}

.feature-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm);
    background: var(--gradient-glow);
    border: 1px solid var(--accent-soft-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-text);
    margin-bottom: 8px;
}

.feature-title { font-size: 15px; font-weight: 600; }
.feature-text { font-size: 13.5px; line-height: 1.65; color: var(--text-secondary); }

/* Steps */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.step-card {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    transition: all var(--transition);
}

.step-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }

.step-card .step-index {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--gradient-accent);
    color: var(--on-accent);
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    box-shadow: 0 2px 8px var(--accent-soft-strong);
}

.step-card .step-title { font-size: 14.5px; font-weight: 600; }
.step-card .step-text { font-size: 13px; line-height: 1.6; color: var(--text-secondary); }

/* Pricing */
.pricing-wrap { display: flex; justify-content: center; }

.pricing-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-xl);
    padding: 36px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
}

.pricing-card::before { display: none; }

.pricing-card:hover { box-shadow: var(--shadow-lg); }

.pricing-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-text);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.pricing-price {
    font-size: 44px;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 10px 0 20px;
    font-variant-numeric: tabular-nums;
}

.pricing-price .unit {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-tertiary);
    letter-spacing: 0;
    margin-left: 6px;
}

.pricing-list {
    list-style: none;
    margin: 0 0 24px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pricing-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    color: var(--text-secondary);
}

.pricing-list li .icon { color: var(--success-text); flex-shrink: 0; }

/* FAQ */
.faq-list {
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    transition: border-color var(--transition);
}

.faq-item:hover { border-color: var(--border-strong); }

.faq-item summary {
    cursor: pointer;
    list-style: none;
    padding: 16px 20px;
    font-size: 14.5px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: background var(--transition);
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
    content: "+";
    font-size: 20px;
    color: var(--text-tertiary);
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--surface-2);
    transition: all var(--transition);
}

.faq-item[open] summary::after { content: "\2013"; background: var(--accent-soft); color: var(--accent-text); }
.faq-item summary:hover { background: var(--hover); }

.faq-body {
    padding: 0 20px 18px;
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--text-secondary);
}

/* CTA Band */
.cta-band {
    text-align: center;
    padding: 80px 0;
    border-top: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.cta-band::before {
    content: none;
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 400px;
    background: none;
    pointer-events: none;
}

/* Footer */
.landing-footer {
    border-top: 1px solid var(--border);
    padding: 28px 0 40px;
    font-size: 12.5px;
    color: var(--text-tertiary);
}

.landing-footer a { color: var(--text-secondary); }
.landing-footer a:hover { color: var(--text); }

.footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.footer-fineprint {
    margin-top: 16px;
    line-height: 1.7;
}

/* ---------- 25. Service Cards ---------- */

.service-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
}

.service-card:last-child { border-bottom: none; }
.service-card:hover { background: var(--hover); }

.service-card .service-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.service-card .service-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.service-card .service-price {
    display: block;
    text-align: right;
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 1px;
}

.service-card .service-desc {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.55;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.service-card .service-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--text-tertiary);
    flex-wrap: wrap;
}

.service-card .service-meta .item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* ---------- 26. Timeline ---------- */

.timeline { display: flex; flex-direction: column; padding: 6px 0; }

.timeline-item {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 10px 18px 10px 30px;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: 19px;
    top: 22px;
    bottom: -6px;
    width: 1px;
    background: var(--border);
}

.timeline-item:last-child::before { display: none; }

.timeline-dot {
    position: absolute;
    left: 14px;
    top: 16px;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid var(--bg);
    background: var(--text-tertiary);
}

.timeline-dot.tone-success { background: var(--success); box-shadow: 0 0 8px rgba(34,197,94,0.3); }
.timeline-dot.tone-danger { background: var(--danger); }
.timeline-dot.tone-accent { background: var(--accent); box-shadow: none; }
.timeline-dot.tone-warning { background: var(--warning); }

.timeline-body { flex: 1; min-width: 0; }
.timeline-title { font-size: 13px; color: var(--text); line-height: 1.4; }
.timeline-note { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; line-height: 1.5; }
.timeline-meta { font-size: 11.5px; color: var(--text-tertiary); margin-top: 3px; }

/* ---------- 27. Support Thread ---------- */

.thread { display: flex; flex-direction: column; gap: 14px; padding: 18px; }

.thread-item { display: flex; gap: 10px; align-items: flex-start; }
.thread-item.is-admin { flex-direction: row-reverse; }

.thread-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.thread-bubble {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 12px 16px;
    max-width: 75%;
    min-width: 0;
}

.thread-item.is-admin .thread-bubble {
    background: var(--accent-soft);
    border-color: var(--accent-soft-strong);
}

.thread-bubble.is-internal {
    background: var(--warning-soft);
    border-color: rgba(234,179,8,0.25);
}

.thread-meta { font-size: 11.5px; color: var(--text-tertiary); margin-bottom: 4px; }
.thread-body { font-size: 13.5px; line-height: 1.6; color: var(--text); white-space: pre-wrap; word-break: break-word; }

.thread-files { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.file-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    padding: 4px 10px;
    transition: all var(--transition);
}

.file-chip:hover { color: var(--text); text-decoration: none; border-color: var(--border-strong); }

/* ---------- 28. Announcements ---------- */

.announcement-item {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    border-left: 3px solid transparent;
    transition: background var(--transition-fast);
}

.announcement-item:last-child { border-bottom: none; }
.announcement-item:hover { background: var(--hover); }
.announcement-item.type-info { border-left-color: var(--accent); }
.announcement-item.type-success { border-left-color: var(--success); }
.announcement-item.type-warning { border-left-color: var(--warning); }
.announcement-item.type-danger { border-left-color: var(--danger); }
.announcement-item.is-unread { background: var(--surface-inset); box-shadow: inset 3px 0 0 var(--accent); }

.announcement-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.announcement-title { font-size: 14px; font-weight: 600; color: var(--text); }
a.announcement-title:hover { color: var(--accent-text); text-decoration: none; }
.announcement-meta { font-size: 12px; color: var(--text-tertiary); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.announcement-body {
    margin-top: 8px;
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

.announcement-body.is-clamped {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---------- 29. Summary Box ---------- */

.summary-box {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface-inset);
    padding: 16px 18px;
}

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13.5px;
    padding: 8px 0;
}

.summary-row + .summary-row { border-top: 1px dashed var(--border); }
.summary-row .label { color: var(--text-secondary); }
.summary-row .value { font-variant-numeric: tabular-nums; font-weight: 500; }
.summary-row.is-total { font-size: 15px; font-weight: 600; }
.summary-row.is-total .value { font-size: 16px; }

/* ---------- 30. Filter Bar ---------- */

.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.filter-bar .field { max-width: none; gap: 4px; }
.filter-bar .field-label { font-size: 11.5px; }
.filter-bar .spacer { flex: 1; }

/* ---------- 31. Notification Page ---------- */

.notification-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
}

.notification-row:last-child { border-bottom: none; }
.notification-row.is-unread { background: var(--surface-inset); box-shadow: inset 3px 0 0 var(--accent); }
.notification-row:hover { background: var(--hover); }
.notification-row .notif-body { flex: 1; min-width: 0; }
.notification-row .notif-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* ---------- 32. Balance Card ---------- */

.balance-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
}

.balance-card::before { display: none; }

.balance-value {
    font-size: 34px;
    font-weight: 700;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
    color: var(--text);
}

.balance-sub {
    display: flex;
    gap: 18px;
    font-size: 12.5px;
    color: var(--text-tertiary);
    flex-wrap: wrap;
}

.balance-sub strong { color: var(--text-secondary); font-weight: 500; }

/* ---------- 33. Quick Actions ---------- */

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.quick-action {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
}

.quick-action:hover {
    border-color: var(--border-strong);
    color: var(--text);
    text-decoration: none;
    background: var(--surface-2);
    box-shadow: var(--shadow-sm);
    transform: none;
}

.quick-action .icon { color: var(--accent-text); }

/* ---------- 34. Role Matrix ---------- */

.matrix-table td .yes { color: var(--success-text); }
.matrix-table td .no { color: var(--text-tertiary); }

/* ---------- 35. Site Cards ---------- */

.stat-row-cards {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
}

.site-card {
    transition: all var(--transition);
}

.site-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
}

.site-card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.site-card-domain {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--r-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    background: var(--surface-3);
    border: 1px solid var(--border);
    flex: none;
    text-transform: uppercase;
}

.site-avatar-sm { width: 22px; height: 22px; border-radius: 6px; font-size: 11px; }

.site-cell {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    max-width: 100%;
}

/* ---------- 36. Order Detail ---------- */

.order-hero { padding: 20px 24px; }

.order-hero-progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.order-hero-progress-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-weight: 600;
    font-size: 14px;
}

.order-progress {
    height: 8px;
    border-radius: var(--r-full);
    background: var(--hover);
    overflow: hidden;
}

.order-progress-fill {
    display: block;
    height: 100%;
    border-radius: var(--r-full);
    background: var(--gradient-accent);
    transition: width 1s cubic-bezier(0.22,0.9,0.3,1);
}

.order-progress-fill.is-complete {
    background: var(--success);
}

.order-hero-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: var(--r-full);
    border: 1px solid var(--border);
    background: var(--hover);
    font-size: 12.5px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.chip-strong {
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* DR Picker */
.dr-picker {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 3px 8px 3px 10px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    background: var(--hover);
}

/* ---------- 37. Animations ---------- */

.animate-in {
    animation: card-in 0.5s cubic-bezier(0.21, 0.9, 0.35, 1) both;
}

@keyframes card-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .animate-in { animation: none; }
    .hero h1 { animation: none; }
    .auth-body::before { display: none; }
    * { transition-duration: 0.01ms !important; }
}

/* ---------- 38. Responsive ---------- */

@media (max-width: 1100px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-actions { grid-template-columns: repeat(2, 1fr); }
    .grid-12 { grid-template-columns: 1fr; }
    .col-4, .col-5, .col-6, .col-7, .col-8 { grid-column: span 1; }
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        z-index: 31;
    }

    .app[data-sidebar="expanded"] .sidebar { transform: translateX(-100%); }
    .app.sidebar-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-xl); }
    .app.sidebar-open .sidebar-scrim { display: block; }

    .main { margin-left: 0 !important; }

    .only-mobile { display: inline-flex; }
    .only-desktop { display: none; }

    .hero h1 { font-size: 36px; }
    .feature-grid { grid-template-columns: 1fr; }
    .steps-grid { grid-template-columns: repeat(2, 1fr); }
    .section-title { font-size: 24px; }

    .search-trigger span:not(.kbd):not(.icon) { display: none; }
    .search-trigger .kbd { display: none; }
}

@media (max-width: 640px) {
    .content { padding: 16px 16px 32px; }
    .page-head { flex-direction: column; gap: 12px; }
    .page-actions { width: 100%; }
    .page-actions .btn { flex: 1; }

    .kpi-grid { grid-template-columns: 1fr; }
    .quick-actions { grid-template-columns: 1fr; }

    .hero { padding: 60px 0 48px; }
    .hero h1 { font-size: 28px; }
    .hero-sub { font-size: 15px; }
    .section { padding: 56px 0; }
    .steps-grid { grid-template-columns: 1fr; }
    .hero-stats { gap: 28px; }

    .thread-bubble { max-width: 88%; }

    .stepper { padding: 12px 14px; }
    .stepper .step-connector { margin: 0 8px; min-width: 12px; }
    .stepper .step:not(.is-active) .step-label { display: none; }

    /* Mobile table -> card */
    .data-table.is-stack thead { display: none; }
    .data-table.is-stack tbody tr {
        display: block;
        padding: 14px 16px;
        border-bottom: 1px solid var(--border);
    }
    .data-table.is-stack tbody tr:last-child { border-bottom: none; }
    .data-table.is-stack tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        border: none;
        padding: 4px 0;
        max-width: none;
    }
    .data-table.is-stack tbody td::before {
        content: attr(data-label);
        color: var(--text-tertiary);
        font-size: 12px;
        flex: none;
    }
    .data-table.is-stack tbody td.cell-actions { justify-content: flex-end; padding-top: 8px; }
    .data-table.is-stack tbody td.cell-actions::before { content: ""; }
    .data-table.is-stack .url-cell { max-width: none; }

    .cmd-dialog { width: calc(100vw - 32px); }

    .auth-card { padding: 24px; }
}

/* ---------- 39. Icon helper ---------- */

.icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ---------- 40. Print ---------- */

@media print {
    .sidebar, .topbar, .toast-container, .cmd-backdrop, .modal-backdrop { display: none !important; }
    .main { margin-left: 0 !important; }
    body { background: #fff; color: #000; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}

/* ===========================================================================
   Recovered component styles (kv/stat/bars/segmented/tabs/forms/wizard/etc.)
   =========================================================================== */

@keyframes skeleton-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

.strong {
    font-weight: 600;
}

.is-hidden {
    display: none !important;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stack-lg {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.btn-danger-solid {
    background: var(--danger-solid);
    color: #fff;
}

.btn-danger-solid:hover {
    background: var(--danger-solid);
    filter: brightness(0.94);
}

.btn-icon {
    width: 32px;
    padding: 0;
}

.btn-icon.btn-sm {
    width: 28px;
}

.field.has-error .field-error {
    display: block;
}

.field.has-error .input,
.field.has-error .textarea {
    border-color: var(--danger);
}

.input-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon .icon {
    position: absolute;
    left: 10px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.input-icon .input {
    padding-left: 32px;
}

.input-affix {
    display: flex;
}

.input-affix .input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-affix .btn {
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    border: 1px solid var(--border-strong);
    border-left: none;
    background: var(--surface-2);
}

.checkbox-label-strong {
    color: var(--text);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.form-grid .field {
    max-width: none;
}

.form-grid .field--full {
    grid-column: 1 / -1;
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.delta {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
}

.delta .icon {
    width: 12px;
    height: 12px;
}

.delta-up { color: var(--success-text);
}

.delta-flat { color: var(--text-tertiary);
}

.delta-down { color: var(--danger-text); }

.progress-fill.is-success { background: var(--success); }

.card-desc {
    font-size: 12.5px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.segmented {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    max-width: 100%;
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 2px;
    gap: 2px;
}

.segmented-item {
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 12.5px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--r-xs);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: background var(--transition), color var(--transition);
}

.segmented-item:hover {
    color: var(--text-secondary);
}

.segmented-item.is-active {
    background: var(--surface-3);
    color: var(--text);
}

.segmented-item .count {
    font-size: 11px;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.tabs {
    display: flex;
    align-items: center;
    gap: 2px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.tab {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13.5px;
    font-weight: 500;
    padding: 9px 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    transition: color var(--transition), border-color var(--transition);
}

.tab:hover {
    color: var(--text);
}

.tab.is-active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

.tab .count {
    font-size: 11.5px;
    color: var(--text-tertiary);
    background: var(--surface-2);
    border-radius: 999px;
    padding: 0 7px;
    line-height: 18px;
}

.table-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.table-toolbar .spacer {
    flex: 1;
}

.data-table th .sort-indicator {
    display: inline-flex;
    margin-left: 4px;
    vertical-align: -2px;
    color: var(--text-tertiary);
    opacity: 0;
    transition: opacity var(--transition);
}

.data-table th[data-sort]:hover .sort-indicator,
.data-table th.is-sorted .sort-indicator {
    opacity: 1;
}

.data-table th.is-sorted {
    color: var(--text-secondary);
}

.data-table tbody tr.is-selected {
    background: var(--accent-soft);
}

.data-table .cell-check {
    width: 40px;
    padding-right: 4px;
}

.data-table .num {
    font-variant-numeric: tabular-nums;
}

.data-table .cell-secondary {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.cell-domain {
    font-weight: 500;
}

.cell-domain:hover {
    text-decoration: none;
    color: var(--accent-text);
}

.metric-value.is-empty {
    color: var(--text-tertiary);
    font-weight: 400;
}

.row-menu-btn {
    width: 26px;
    height: 26px;
    border-radius: var(--r-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.row-menu-btn:hover,
.row-menu-btn[aria-expanded="true"] {
    background: var(--surface-3);
    color: var(--text);
}

.notif-desc {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 1px;
    line-height: 1.4;
}

.modal-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--surface-2);
    color: var(--text-secondary);
}

.modal-icon.tone-danger { background: var(--danger-soft); color: var(--danger-text);
}

.modal-icon.tone-accent { background: var(--accent-soft); color: var(--accent-text);
}

.modal-title-wrap {
    flex: 1;
    min-width: 0;
}

.modal-close {
    margin: -4px -6px 0 0;
}

.palette-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    height: 50px;
    border-bottom: 1px solid var(--border);
}

.palette-input-wrap .icon {
    color: var(--text-tertiary);
    flex-shrink: 0;
}

.palette-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14.5px;
    height: 100%;
}

.palette-input:focus {
    outline: none;
    box-shadow: none;
}

.palette-list {
    max-height: 340px;
    overflow-y: auto;
    padding: 6px;
}

.palette-section {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    padding: 8px 10px 4px;
}

.palette-item .palette-item-sub {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-tertiary);
}

.palette-empty {
    padding: 32px 16px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
}

.palette-footer {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 14px;
    border-top: 1px solid var(--border);
    font-size: 11.5px;
    color: var(--text-tertiary);
}

.palette-footer .kbd {
    margin-right: 3px;
}

.toast-region {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 340px;
    max-width: calc(100vw - 32px);
}

.toast-title {
    color: var(--text);
    font-weight: 500;
}

.skeleton {
    display: inline-block;
    background: var(--surface-2);
    border-radius: var(--r-xs);
    animation: skeleton-pulse 1.4s ease-in-out infinite;
}

.progress-sm {
    height: 4px;
}

.step-connector {
    flex: 1;
    height: 1px;
    background: var(--border);
    margin: 0 14px;
    min-width: 24px;
}

.activity-time {
    font-size: 11.5px;
    color: var(--text-tertiary);
    white-space: nowrap;
    padding-top: 1px;
}

.bars {
    display: flex;
    flex-direction: column;
}

.bar-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    align-items: center;
    gap: 0 14px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--border);
}

.bar-row:last-child {
    border-bottom: none;
}

.bar-label {
    font-size: 13px;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar-label:hover {
    color: var(--accent-text);
    text-decoration: none;
}

.bar-track {
    grid-column: 1 / -1;
    margin-top: 6px;
    height: 5px;
    border-radius: 999px;
    background: var(--surface-3);
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
    opacity: 0.85;
    transition: width 240ms ease;
}

.bar-value {
    text-align: right;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-bottom: 1px solid var(--border);
}

.stat {
    padding: 14px 18px;
    border-right: 1px solid var(--border);
    min-width: 0;
}

.stat:last-child {
    border-right: none;
}

.stat-label {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 3px;
}

.stat-value {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

.stat-value.is-empty {
    color: var(--text-tertiary);
    font-weight: 400;
}

.stat-sub {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 1px;
}

.kv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px 24px;
    padding: 16px 18px;
}

.kv {
    min-width: 0;
}

.kv-label {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-bottom: 2px;
}

.kv-value {
    font-size: 13.5px;
    color: var(--text);
    overflow-wrap: anywhere;
}
.kv-value .select, .kv-value select { width: 100%; max-width: 100%; }

.code-block {
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 12px 14px;
    font-family: var(--mono);
    font-size: 12px;
    line-height: 1.6;
    color: var(--text-secondary);
    overflow: auto;
    max-height: 320px;
    white-space: pre-wrap;
    word-break: break-word;
}

.code-block.is-error {
    border-color: rgba(248, 81, 73, 0.35);
    color: var(--danger-text);
}

.chart-wrap {
    position: relative;
    padding: 8px 18px 0;
}

.chart-svg {
    display: block;
    width: 100%;
}

.chart-tooltip {
    position: absolute;
    pointer-events: none;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    padding: 6px 10px;
    font-size: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
    z-index: 5;
    transform: translate(-50%, -100%);
    opacity: 0;
    transition: opacity 80ms ease;
}

.chart-tooltip.is-visible {
    opacity: 1;
}

.chart-tooltip .chart-tooltip-value {
    color: var(--text);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.chart-tooltip .chart-tooltip-date {
    color: var(--text-tertiary);
    margin-top: 1px;
}

.chart-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 18px 14px;
    font-size: 12.5px;
    color: var(--text-tertiary);
    flex-wrap: wrap;
}

.chart-meta strong {
    color: var(--text-secondary);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.anchor-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.anchor-row .input {
    flex: 1;
}

.wizard-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.wizard-actions .left,
.wizard-actions .right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.selection-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 18px;
    background: var(--accent-soft);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text);
    flex-wrap: wrap;
}

.selection-bar .spacer {
    flex: 1;
}

.job-summary {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 18px 0;
    flex-wrap: wrap;
}

.job-summary .item {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.job-summary .item .label {
    font-size: 12px;
    color: var(--text-tertiary);
}

.job-summary .item .value {
    font-size: 18px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.progress-block {
    padding: 14px 18px;
}

.progress-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 13px;
}

.progress-counts {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 10px;
    font-size: 12.5px;
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.link-anchor {
    max-width: 180px;
}

.section-list {
    display: flex;
    flex-direction: column;
}

.section-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    padding: 18px;
    border-bottom: 1px solid var(--border);
}

.section-item:last-child {
    border-bottom: none;
}

.section-item-main {
    min-width: 0;
    flex: 1;
}

.section-item-title {
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 2px;
}

.section-item-desc {
    font-size: 12.5px;
    color: var(--text-tertiary);
    line-height: 1.55;
    max-width: 560px;
}

.section-item-control {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    min-width: 260px;
}

.section-item-control .field {
    width: 100%;
    max-width: none;
}

.key-value {
    font-family: var(--mono);
    font-size: 12.5px;
    color: var(--text-secondary);
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--r-xs);
    padding: 3px 8px;
}

@media (max-width: 1100px) {
    .stat-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .stat:nth-child(2) {
        border-right: none;
    }
    .stat:nth-child(1),
    .stat:nth-child(2) {
        border-bottom: 1px solid var(--border);
    }
    .kv-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .stat-row {
        grid-template-columns: 1fr;
    }
    .stat {
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .stat:last-child {
        border-bottom: none;
    }
    .kv-grid {
        grid-template-columns: 1fr;
    }
    .form-grid {
        grid-template-columns: 1fr;
    }
    .table-toolbar {
        padding: 10px 14px;
    }
    .toast-region {
        right: 12px;
        left: 12px;
        width: auto;
    }
    .section-item {
        flex-direction: column;
        gap: 12px;
    }
    .section-item-control {
        align-items: stretch;
        width: 100%;
        min-width: 0;
    }
}


/* ==========================================================================
   Component compatibility layer
   Styles for markup built by assets/js/app.js and the page templates.
   ========================================================================== */

/* ---------- Command palette ---------- */
.palette {
    width: 100%;
    max-width: 580px;
    background: var(--glass-bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    align-self: flex-start;
    margin-top: 12vh;
}
.palette-input-wrap { height: 54px; padding: 0 18px; }
.palette-input { color: var(--text); font-size: 15px; }
.palette-input::placeholder { color: var(--text-tertiary); }
.palette-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 10px;
    border: none;
    background: transparent;
    border-radius: var(--r-sm);
    cursor: pointer;
    text-align: left;
    color: var(--text-secondary);
    font: inherit;
    font-size: 13.5px;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.palette-item .icon { color: var(--text-tertiary); flex-shrink: 0; }
.palette-item:hover,
.palette-item.is-active { background: var(--accent-soft); color: var(--text); }
.palette-item.is-active .icon { color: var(--accent-text); }

/* ---------- Toasts (JS builds .toast.toast-<type> inside .toast-region) ---------- */
.toast-region { z-index: 200; pointer-events: none; top: auto; }
.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-success .toast-icon { color: var(--success-text); }
.toast.toast-error,
.toast.toast-danger { border-left: 3px solid var(--danger); }
.toast.toast-error .toast-icon,
.toast.toast-danger .toast-icon { color: var(--danger-text); }
.toast.toast-warning { border-left: 3px solid var(--warning); }
.toast.toast-warning .toast-icon { color: var(--warning-text); }
.toast.toast-info { border-left: 3px solid var(--accent); }
.toast.toast-info .toast-icon { color: var(--accent-text); }

/* ---------- Tones for notification & modal icons ---------- */
.notif-icon.tone-accent,  .modal-icon.tone-accent  { background: var(--accent-soft);  color: var(--accent-text); }
.notif-icon.tone-success, .modal-icon.tone-success { background: var(--success-soft); color: var(--success-text); }
.notif-icon.tone-warning, .modal-icon.tone-warning { background: var(--warning-soft); color: var(--warning-text); }
.notif-icon.tone-danger,  .modal-icon.tone-danger  { background: var(--danger-soft);  color: var(--danger-text); }
.notif-icon.tone-neutral, .modal-icon.tone-neutral,
.notif-icon.tone-info,    .modal-icon.tone-info    { background: var(--hover); color: var(--text-secondary); }

/* ---------- Modal sizing ---------- */
.modal--wide { max-width: 640px; }
.modal-header { align-items: flex-start; gap: 12px; }

/* ---------- Chart SVG helpers ---------- */
.chart-hover { cursor: crosshair; }
.chart-crosshair,
.chart-dot { transition: opacity var(--transition-fast); pointer-events: none; }

/* ---------- Link wizard ---------- */
.wizard-step { margin-bottom: 16px; }
.anchor-row .btn-icon { flex-shrink: 0; }

.tag-accent { background: var(--accent-soft); color: var(--accent-text); }
a.tag-accent:hover { background: var(--accent-soft-strong); }

/* ---------- Global form/scroll polish ---------- */


* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); background-clip: content-box; }
*::-webkit-scrollbar-corner { background: transparent; }

input[type="file"].input {
    padding: 6px 8px;
    color: var(--text-secondary);
    cursor: pointer;
}
input[type="file"]::file-selector-button {
    margin-right: 12px;
    padding: 6px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}
input[type="file"]::file-selector-button:hover {
    background: var(--surface-3);
    border-color: var(--accent);
}

input[type="date"], input[type="datetime-local"] { color-scheme: inherit; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

.kpi-value .unit { font-size: 0.55em; font-weight: 500; color: var(--text-tertiary); margin-left: 6px; letter-spacing: 0; }

/* Small screens: keep the top bar uncluttered */
@media (max-width: 640px) {
    .topbar-left { min-width: 0; flex: 1; }
    .breadcrumbs { min-width: 0; overflow: hidden; }
    .breadcrumbs .breadcrumb-item:not(.current),
    .breadcrumbs .breadcrumb-sep { display: none; }
    .breadcrumbs .breadcrumb-item.current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
    .topbar-right { gap: 6px; }
}
@media (max-width: 640px) {
    .breadcrumbs .breadcrumb-item.current { min-width: 0; flex: 0 1 auto; display: block; }
}

@media (max-width: 640px) {
    .data-table.is-stack tbody td[data-label=""]::before { display: none; }
    .data-table.is-stack tbody td { text-align: right; overflow-wrap: anywhere; white-space: normal; }
    .data-table.is-stack tbody td::before { text-align: left; text-transform: none; }
    .data-table.is-stack tbody td.cell-check { justify-content: flex-start; }
    .data-table.is-stack tbody td:empty { display: none; }
    .data-table.is-stack .table-wrap, .table-wrap:has(.data-table.is-stack) { overflow-x: visible; }
}

@media (max-width: 640px) {
    .data-table.is-stack th.cell-actions,
    .data-table.is-stack td.cell-actions { width: auto; text-align: left; justify-content: flex-start; padding-top: 8px; }
    .data-table.is-stack tbody tr { display: block; width: 100%; }
}

@media (max-width: 640px) {
    .data-table.is-stack tbody td {
        display: grid;
        grid-template-columns: minmax(84px, 38%) 1fr;
        column-gap: 12px;
        align-items: start;
        text-align: right;
    }
    .data-table.is-stack tbody td::before { grid-column: 1; justify-self: start; text-align: left; padding-top: 1px; }
    .data-table.is-stack tbody td > *,
    .data-table.is-stack tbody td { justify-items: end; }
    .data-table.is-stack tbody td.cell-actions { display: flex; }
    .data-table.is-stack tbody td[data-label=""] { display: flex; justify-content: flex-end; }
}

@media (max-width: 640px) {
    .data-table.is-stack tbody td { min-width: 0; }
    .data-table.is-stack tbody td > * { min-width: 0; max-width: 100%; }
    .data-table.is-stack .url-cell { overflow: hidden; white-space: normal; }
    .data-table.is-stack .url-cell a { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (max-width: 640px) {
    .data-table.is-stack .cell-secondary { overflow-wrap: anywhere; word-break: normal; text-align: right; }
    .data-table.is-stack td > a.cell-domain, .data-table.is-stack td .cell-domain { text-align: right; }
    .page-actions { flex-wrap: wrap; }
    .page-actions .btn { white-space: normal; text-align: center; line-height: 1.25; min-height: 34px; height: auto; padding-top: 6px; padding-bottom: 6px; }
}

@media (max-width: 640px) {
    .data-table.is-stack tbody td > .cell-secondary,
    .data-table.is-stack tbody td > div.cell-secondary {
        grid-column: 1 / -1;
        overflow-wrap: break-word;
        word-break: normal;
        white-space: normal;
        text-align: right;
        max-width: 100%;
    }
    .data-table.is-stack tbody td .cell-secondary { font-size: 11.5px; }
}

@media (max-width: 640px) {
    .data-table.is-stack tbody td.mono,
    .data-table.is-stack tbody td .mono { white-space: normal; overflow-wrap: anywhere; text-align: right; font-size: 11.5px; }
    .data-table.is-stack tbody td.metric-value { white-space: nowrap; }
}

@media (max-width: 640px) {
    .dropdown-menu.dropdown-panel {
        position: fixed !important;
        left: 8px !important;
        right: 8px !important;
        top: calc(var(--topbar-h) + 4px) !important;
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        max-height: calc(100vh - var(--topbar-h) - 24px);
    }
}

/* Landing nav on phones: keep the actions readable, brand collapses to its mark */
@media (max-width: 560px) {
    .landing-nav-inner { padding: 0 14px; }
    .landing-actions { gap: 4px; }
    .landing-nav .brand-name { display: none; }
}

/* Header-less compact tables (e.g. recent orders on the user page) must fit phone width */
@media (max-width: 640px) {
    .data-table:not(:has(thead)) td { padding-left: 8px; padding-right: 8px; }
    .data-table:not(:has(thead)) td.truncate { max-width: 92px !important; }
}

/* Language-aware file picker (replaces the browser-localised native control) */
.file-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; overflow: hidden; }
.file-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    padding: 4px 6px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
}
.file-picker-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--text-tertiary); }
.file-picker.has-file .file-picker-name { color: var(--text); }

/* Audit fixes: nothing may clip its text or push the page wider than the viewport */
.mono { overflow-wrap: anywhere; }
[class*="col-"], .stack-lg, .stack-md, .kv-grid > * { min-width: 0; }
@media (max-width: 640px) {
    .btn:not(.btn-icon) { white-space: normal; height: auto; min-height: 36px; padding-top: 8px; padding-bottom: 8px; line-height: 1.25; text-align: center; }
    .btn-sm:not(.btn-icon) { min-height: 32px; padding-top: 6px; padding-bottom: 6px; }
    .btn-xs:not(.btn-icon) { min-height: 28px; }
    .flex.gap-2 { flex-wrap: wrap; }
    .flex.gap-2 > .input { min-width: 0; flex: 1 1 140px; width: auto !important; }
    .callout > span, .callout span.mono { min-width: 0; overflow-wrap: anywhere; }
}

@media (max-width: 640px) {
    .btn-link { min-height: 32px; display: inline-flex; align-items: center; }
}

/* Items inside a callout sentence stay whole boxes instead of wrapping mid-link */
.callout-item { display: inline-block; }

/* Anchored / programmatic scrolls must not land underneath the sticky top bar */
html { scroll-padding-top: calc(var(--topbar-h, 56px) + 12px); }

/* Min — max pairs stay on one line on phones */
@media (max-width: 640px) {
    .flex.gap-2.range-row { flex-wrap: nowrap; }
    .flex.gap-2.range-row > .input { flex: 1 1 0; min-width: 0; }
}

/* ---------- Subscription terms, promo codes ---------- */

.term-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}
.term-option {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 12px 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--r-md);
    background: var(--surface);
    cursor: pointer;
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}
.term-option:hover { border-color: var(--text-tertiary); }
.term-option input { position: absolute; opacity: 0; pointer-events: none; }
.term-option.is-selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
    background: var(--accent-soft);
}
.term-option:focus-within { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.term-name { font-weight: 600; color: var(--text); }
.term-sub { font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.term-badge {
    align-self: flex-start;
    margin-top: 6px;
    padding: 2px 8px;
    border-radius: var(--r-full);
    background: var(--success-soft);
    color: var(--success-text);
    font-size: 11px;
    font-weight: 600;
}
.auto-renew { display: flex; align-items: flex-start; gap: 8px; }
.auto-renew span { line-height: 1.4; }

.promo-row { display: flex; gap: 8px; }
.promo-row .input { flex: 1; min-width: 0; text-transform: uppercase; font-family: var(--mono); letter-spacing: 0.04em; }
.promo-result {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: var(--r-sm);
    font-size: 13px;
    border: 1px solid transparent;
}
.promo-result.is-ok { background: var(--success-soft); color: var(--success-text); border-color: rgba(22,163,74,0.2); }
.promo-result.is-error { background: var(--danger-soft); color: var(--danger-text); border-color: rgba(220,38,38,0.2); }
.promo-result.is-hidden { display: none; }

@media (max-width: 720px) {
    .term-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.term-option { padding: 10px 10px 9px; }
.term-name { white-space: nowrap; }
.term-sub { white-space: nowrap; font-size: 11.5px; }
@media (max-width: 1180px) and (min-width: 721px) {
    .term-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Public site (landing + SEO pages) — white / cool gray / red accent ---------- */

.landing { background: var(--surface); }
.skip-link {
    position: absolute; left: 12px; top: -48px; z-index: 40;
    padding: 8px 14px; border-radius: var(--r-sm);
    background: var(--accent); color: var(--on-accent); font-weight: 600;
}
.skip-link:focus { top: 12px; }

.landing-nav-inner { gap: 24px; }
.landing-links { display: flex; align-items: center; gap: 4px; margin-right: auto; margin-left: 8px; }
.landing-links a {
    padding: 6px 12px; border-radius: var(--r-sm);
    font-size: 13.5px; font-weight: 500; color: var(--text-secondary);
}
.landing-links a:hover { color: var(--text); background: var(--hover); text-decoration: none; }

.btn-lg { height: 42px; padding: 0 22px; font-size: 14px; }

/* Hero with a soft grid pattern */
.hero {
    background:
        linear-gradient(to bottom, rgba(255,255,255,0) 0%, var(--surface) 100%),
        linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 44px 44px,
        linear-gradient(90deg, var(--border) 1px, transparent 1px) 0 0 / 44px 44px,
        var(--surface);
    border-bottom: 1px solid var(--border);
}
[data-theme="dark"] .hero {
    background:
        linear-gradient(to bottom, rgba(22,25,32,0) 0%, var(--surface) 100%),
        linear-gradient(var(--border) 1px, transparent 1px) 0 0 / 44px 44px,
        linear-gradient(90deg, var(--border) 1px, transparent 1px) 0 0 / 44px 44px,
        var(--surface);
}
.hero h1 { font-size: clamp(32px, 5vw, 52px); letter-spacing: -0.03em; }
.hero-compact { padding: 56px 0 44px; text-align: left; }
.hero-compact h1 { margin-left: 0; margin-right: 0; font-size: clamp(28px, 4vw, 40px); max-width: 860px; }
.hero-compact .hero-sub { margin-left: 0; margin-right: 0; font-size: 16px; max-width: 760px; }
.eyebrow { border-color: var(--accent-soft-strong); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }

.section { background: var(--surface); }
.section:nth-of-type(even) { background: var(--bg); }
.section-kicker { color: var(--accent-text); }
.feature-card, .step-card { border-radius: var(--r-lg); }
.feature-icon { background: var(--accent-soft); color: var(--accent-text); }
.feature-title, .step-title { font-size: 15px; font-weight: 600; margin: 0 0 6px; }
.feature-text, .step-text { margin: 0; }
.step-card .step-index { background: var(--accent); color: var(--on-accent); }
.cta-band { background: var(--bg); }

.pricing-terms { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 18px; font-size: 13px; color: var(--text-secondary); }
.pricing-term { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.pricing-term strong { color: var(--text); min-width: 64px; }
.pricing-term em { font-style: normal; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: var(--r-full); background: var(--success-soft); color: var(--success-text); }
.pricing-more { display: block; margin-top: 12px; text-align: center; font-size: 13px; font-weight: 600; }

/* Guides */
.guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.guide-card {
    display: flex; flex-direction: column; gap: 8px; padding: 20px;
    color: var(--text); transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.guide-card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); text-decoration: none; transform: translateY(-1px); }
.guide-title { font-size: 15.5px; font-weight: 650; line-height: 1.35; margin: 0; letter-spacing: -0.01em; }
.guide-text { font-size: 13.5px; line-height: 1.6; color: var(--text-secondary); margin: 0; }
.guide-more { margin-top: auto; padding-top: 6px; font-size: 13px; font-weight: 600; color: var(--accent-text); }

/* Articles */
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-tertiary); margin-bottom: 14px; flex-wrap: wrap; }
.crumbs a { color: var(--text-secondary); }
.article-meta { margin-top: 16px; font-size: 12.5px; color: var(--text-tertiary); }
.article-section { padding-top: 48px; }
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 48px; align-items: start; }
.article { max-width: 760px; font-size: 16px; line-height: 1.75; color: var(--text); }
.article h2 { font-size: 23px; letter-spacing: -0.02em; line-height: 1.3; margin: 40px 0 12px; scroll-margin-top: 88px; }
.article h2:first-child { margin-top: 0; }
.article p { margin: 0 0 14px; color: var(--text-secondary); }
.article ul { margin: 0 0 14px; padding-left: 22px; color: var(--text-secondary); }
.article li { margin-bottom: 6px; padding-left: 4px; }
.article li::marker { color: var(--accent); }
.article .faq-list { margin-top: 12px; }
.article-aside { position: sticky; top: 88px; display: flex; flex-direction: column; gap: 16px; }
.aside-card { padding: 18px; }
.aside-title { font-size: 13px; font-weight: 650; margin-bottom: 10px; }
.aside-card p { font-size: 13px; line-height: 1.6; color: var(--text-secondary); margin-bottom: 14px; }
.toc { list-style: none; display: flex; flex-direction: column; gap: 2px; padding: 0; margin: 0; counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc a { display: block; padding: 6px 8px; border-radius: var(--r-sm); font-size: 13px; color: var(--text-secondary); }
.toc a::before { content: counter(toc) ". "; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.toc a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.aside-cta { background: var(--accent-soft); border-color: var(--accent-soft-strong); }

.price-table-card { margin: 0 0 28px; overflow-x: auto; }
.price-table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.price-table th, .price-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.price-table thead th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary); background: var(--surface-inset); }
.price-table tbody tr:last-child th, .price-table tbody tr:last-child td { border-bottom: 0; }
.price-table tbody th { font-weight: 600; color: var(--text); }

@media (max-width: 900px) {
    .article-layout { grid-template-columns: minmax(0, 1fr); gap: 28px; }
    .article-aside { position: static; }
    .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .landing-links { display: none; }
}
@media (max-width: 600px) {
    .guide-grid { grid-template-columns: 1fr; }
    .hero { padding: 64px 0 52px; }
    .hero-compact { padding: 36px 0 28px; }
    .article { font-size: 15.5px; }
}

/* Term cards adapt to the width of their column instead of clipping */
.term-grid { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); }
@media (max-width: 1180px) and (min-width: 721px) {
    .term-grid { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); }
}
@media (max-width: 720px) {
    .term-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.hero-notfound { padding: 110px 0 120px; }
.hero-notfound h1 { font-size: clamp(24px, 3.5vw, 34px); }

/* Informational surfaces stay neutral so red keeps meaning "primary action / problem" */
.callout-info { background: var(--surface-inset); border-color: var(--border-strong); color: var(--text-secondary); }
.callout-info .icon { color: var(--text-tertiary); }
.thread-item.is-admin .thread-bubble { background: var(--surface-3); border-color: var(--border-strong); }
.activity-icon.tone-accent, .notif-icon.tone-accent, .modal-icon.tone-accent { background: var(--surface-3); border-color: var(--border); color: var(--text-secondary); }
.status-accent { background: var(--surface-3); color: var(--text-secondary); }
