/* =========================================================================
   ServerDog Admin CSS — 现代专业蓝设计系统
   版本: 20260707
   ========================================================================= */

/* ---------- Design Tokens ---------- */
:root {
    /* Primary 蓝 */
    --primary-50:  #eff4ff;
    --primary-100: #dbe7fe;
    --primary-200: #bfd3fe;
    --primary-300: #93b4fd;
    --primary-400: #6090fa;
    --primary-500: #2f6bff;
    --primary-600: #2658e0;
    --primary-700: #1f47b8;
    --primary-800: #1d3c8f;
    --primary-900: #1b3370;

    /* Neutral slate */
    --neutral-50:  #f8fafc;
    --neutral-100: #f1f5f9;
    --neutral-200: #e5ebf3;
    --neutral-300: #cbd5e1;
    --neutral-400: #94a3b8;
    --neutral-500: #6b7280;
    --neutral-600: #475569;
    --neutral-700: #334155;
    --neutral-800: #1f2937;
    --neutral-900: #0f172a;

    /* Success */
    --success-50:  #ecfdf5;
    --success-100: #d1fae5;
    --success-500: #0f9d58;
    --success-600: #059669;
    --success-700: #047857;

    /* Warning */
    --warning-50:  #fffbeb;
    --warning-100: #fef3c7;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --warning-700: #b45309;

    /* Danger */
    --danger-50:  #fef2f2;
    --danger-100: #fee2e2;
    --danger-500: #ef4444;
    --danger-600: #dc2626;
    --danger-700: #b91c1c;

    /* Purple */
    --purple-50:  #faf5ff;
    --purple-100: #f3e8ff;
    --purple-500: #a855f7;
    --purple-700: #7c3aed;

    /* 语义别名（兼容旧代码） */
    --bg:         var(--neutral-50);
    --card:       #ffffff;
    --line:       var(--neutral-200);
    --text:       var(--neutral-800);
    --muted:      var(--neutral-500);
    --brand:      var(--primary-500);
    --brand-soft: rgba(47, 107, 255, 0.10);
    --success:    var(--success-500);

    /* 间距 */
    --space-1:  4px;
    --space-2:  8px;
    --space-3:  12px;
    --space-4:  16px;
    --space-5:  20px;
    --space-6:  24px;
    --space-8:  32px;
    --space-10: 40px;
    --space-12: 48px;

    /* 圆角 */
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   14px;
    --radius-xl:   20px;
    --radius-2xl:  24px;
    --radius-full: 999px;

    /* 阴影 */
    --shadow-sm:     0 1px 2px rgba(15, 23, 42, .04);
    --shadow-md:     0 4px 12px rgba(15, 23, 42, .06);
    --shadow-lg:     0 10px 30px rgba(15, 23, 42, .06);
    --shadow-xl:     0 18px 48px rgba(15, 23, 42, .08);
    --shadow-brand:  0 12px 32px rgba(47, 107, 255, .18);

    /* 字号 */
    --text-xs:  12px;
    --text-sm:  13px;
    --text-base:14px;
    --text-md:  15px;
    --text-lg:  16px;
    --text-xl:  18px;
    --text-2xl: 22px;
    --text-3xl: 28px;
    --text-4xl: 34px;

    /* 行高 */
    --leading-tight:  1.3;
    --leading-normal: 1.6;
    --leading-relaxed:1.8;

    /* 过渡 */
    --transition-fast: .15s ease;
    --transition:      .2s ease;
    --transition-slow: .3s ease;

    /* z-index */
    --z-sticky: 50;
    --z-topbar: 100;
    --z-modal:  1000;
    --z-toast:  9999;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--primary-600); }

h1, h2, h3, h4 { color: var(--neutral-900); line-height: var(--leading-tight); }

/* ---------- Layout: Admin Shell ---------- */
.admin-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

.sidebar {
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    color: #e2e8f0;
    padding: var(--space-8) var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid rgba(255, 255, 255, .06);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.brand strong,
.brand small { display: block; }

.brand strong {
    color: #fff;
    font-size: var(--text-md);
    font-weight: 700;
    letter-spacing: .01em;
}

.brand small {
    color: var(--neutral-400);
    margin-top: var(--space-1);
    font-size: var(--text-xs);
}

.brand-mark {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-lg);
    display: block;
    object-fit: cover;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
}

/* ---------- Nav ---------- */
.nav-menu {
    display: grid;
    gap: var(--space-1);
}

.nav-menu a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 10px var(--space-4);
    border-radius: var(--radius-md);
    transition: var(--transition);
    font-size: var(--text-lg);
    display: block;
    position: relative;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.nav-menu a.active {
    background: rgba(47, 107, 255, .14);
}

.nav-top-link {
    font-weight: 600;
    font-size: var(--text-xl);
}

.nav-h5-link {
    margin-top: var(--space-1);
    border-top: 1px solid rgba(255, 255, 255, .1);
    padding-top: var(--space-3) !important;
    color: var(--neutral-400) !important;
    font-size: var(--text-lg) !important;
}

.nav-group-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    color: #fff;
    font-size: var(--text-md);
    font-weight: 700;
    letter-spacing: .06em;
    padding: var(--space-3) var(--space-4) 6px;
    margin-top: var(--space-3);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: color var(--transition-fast), background var(--transition-fast);
    text-align: left;
    font-family: inherit;
    line-height: 1;
}

.nav-group-label:hover {
    color: #fff;
    background: rgba(255, 255, 255, .06);
}

.nav-group-label.open { color: #fff; }

.nav-arrow {
    font-size: var(--text-lg);
    transition: transform var(--transition);
    transform: rotate(0deg);
    line-height: 1;
    color: var(--neutral-400);
}

.nav-group-label.open .nav-arrow { transform: rotate(90deg); }

.nav-group-body {
    display: grid;
    gap: 2px;
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height var(--transition-slow), opacity var(--transition);
}

.nav-group-body.open {
    max-height: 600px;
    opacity: 1;
}

.nav-group-body a {
    padding-left: 22px;
    font-size: var(--text-base);
    color: var(--neutral-400);
    position: relative;
}

.nav-group-body a:hover,
.nav-group-body a.active {
    color: #fff;
}

.nav-group-body a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 18px;
    background: var(--primary-500);
    border-radius: var(--radius-full);
}

.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--danger-500);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    border-radius: var(--radius-full);
    padding: 1px 6px;
    min-width: 18px;
    line-height: 1.6;
    vertical-align: middle;
    margin-left: 5px;
    box-shadow: 0 2px 6px rgba(239, 68, 68, .35);
}

.sidebar-tip {
    margin-top: auto;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    color: #cbd5e1;
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

/* ---------- Main Panel ---------- */
.main-panel {
    padding: var(--space-8);
    min-width: 0;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-5);
    margin-bottom: var(--space-6);
    position: sticky;
    top: 0;
    z-index: var(--z-topbar);
    background: rgba(248, 250, 252, .85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--line);
    margin-left: calc(var(--space-8) * -1);
    margin-right: calc(var(--space-8) * -1);
    padding-left: var(--space-8);
    padding-right: var(--space-8);
}

@supports not (backdrop-filter: blur(12px)) {
    .topbar { background: var(--neutral-50); }
}

.topbar h1 {
    margin: 0 0 var(--space-2);
    font-size: var(--text-3xl);
    font-weight: 800;
    color: var(--neutral-900);
    letter-spacing: -.01em;
}

.topbar p {
    margin: 0;
    color: var(--muted);
    font-size: var(--text-sm);
}

.topbar-badge {
    background: var(--brand-soft);
    color: var(--brand);
    border-radius: var(--radius-full);
    padding: 10px var(--space-4);
    font-weight: 600;
    font-size: var(--text-sm);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.user-chip {
    display: grid;
    gap: 2px;
    text-align: right;
}

.user-chip strong {
    color: var(--text);
    font-size: var(--text-sm);
}

.user-chip span {
    color: var(--muted);
    font-size: var(--text-xs);
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
}

.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--brand); }
.breadcrumb .sep { color: var(--neutral-300); }
.breadcrumb .current { color: var(--text); font-weight: 600; }

/* ---------- Card ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-lg);
    transition: box-shadow var(--transition), transform var(--transition);
}

.card-hover:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px);
}

/* ---------- Stats ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

.stat-card {
    display: grid;
    gap: var(--space-3);
    min-height: 120px;
}

.stat-label,
.stat-note {
    color: var(--muted);
    font-size: var(--text-sm);
}

.stat-value {
    font-size: var(--text-4xl);
    font-weight: 800;
    color: var(--neutral-900);
    line-height: 1.1;
    letter-spacing: -.02em;
}

/* Metric card with trend */
.metric-card { position: relative; }
.metric-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-sm);
    font-weight: 600;
}
.metric-trend.up   { color: var(--success-600); }
.metric-trend.down { color: var(--danger-600); }

/* ---------- Content Grid ---------- */
.content-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: var(--space-5);
}

.content-grid.single { grid-template-columns: 1fr; }

.two-panels { gap: var(--space-5); }

/* ---------- Section ---------- */
.section-title {
    font-size: var(--text-xl);
    font-weight: 700;
    margin-bottom: var(--space-4);
    color: var(--neutral-900);
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.section-head .section-title { margin-bottom: 0; }

.section-subtitle {
    color: var(--muted);
    font-size: var(--text-sm);
}

/* ---------- Detail Header ---------- */
.detail-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
}

.detail-header h1,
.detail-header h2 {
    margin: 0;
    font-size: var(--text-2xl);
    font-weight: 700;
}

/* ---------- Info Card (内联信息卡替代) ---------- */
.info-card {
    background: var(--neutral-50);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding: 10px 0;
    border-bottom: 1px solid var(--neutral-100);
    font-size: var(--text-base);
}
.info-row:last-child { border-bottom: none; }
.info-row .info-label { color: var(--muted); }
.info-row .info-value { color: var(--text); font-weight: 600; }

/* ---------- Pager ---------- */
.pager {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
}
.pager a, .pager span {
    padding: 6px var(--space-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    color: var(--text);
    background: #fff;
    text-decoration: none;
    transition: var(--transition);
}
.pager a:hover { border-color: var(--primary-300); background: var(--primary-50); }
.pager .current {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}
.pager .disabled { color: var(--neutral-300); cursor: not-allowed; }

/* ---------- Page Note ---------- */
.page-note {
    color: var(--muted);
    margin-top: 0;
    margin-bottom: var(--space-5);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

/* ---------- Tag / Status ---------- */
.tag,
.status-pill {
    display: inline-flex;
    align-items: center;
    border-radius: var(--radius-full);
    padding: 4px 10px;
    font-size: var(--text-xs);
    font-weight: 600;
    background: var(--brand-soft);
    color: var(--brand);
    line-height: 1.5;
}

.tag-purple { background: var(--purple-100);   color: var(--purple-700); }
.tag-green  { background: var(--success-100);  color: var(--success-700); }
.tag-blue   { background: var(--primary-100);  color: var(--primary-700); }
.tag-orange { background: var(--warning-100);  color: var(--warning-700); }
.tag-red    { background: var(--danger-100);   color: var(--danger-700); }
.tag-neutral{ background: var(--neutral-100);  color: var(--neutral-600); }

/* 旧别名（兼容现有视图） */
.tag-success { background: var(--success-100); color: var(--success-700); }
.tag-danger  { background: var(--danger-100);  color: var(--danger-700); }
.tag-warning { background: var(--warning-100); color: var(--warning-700); }
.tag-primary { background: var(--primary-100); color: var(--primary-700); }
.tag-info    { background: var(--primary-100); color: var(--primary-700); }

/* ---------- Button ---------- */
.primary-btn,
.ghost-btn,
.secondary-btn,
.danger-btn,
.link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    padding: 10px var(--space-4);
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    font-size: var(--text-base);
    font-weight: 600;
    font-family: inherit;
    transition: var(--transition);
    line-height: 1.4;
}

.primary-btn {
    background: var(--brand);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.primary-btn:hover {
    background: var(--primary-600);
    color: #fff;
    box-shadow: var(--shadow-brand);
    transform: translateY(-1px);
}
.primary-btn:active { transform: translateY(0); }

.secondary-btn {
    background: var(--primary-50);
    color: var(--primary-700);
}
.secondary-btn:hover {
    background: var(--primary-100);
    color: var(--primary-700);
}

.ghost-btn {
    background: #fff;
    color: var(--text);
    border-color: var(--line);
}
.ghost-btn:hover {
    border-color: var(--primary-300);
    background: var(--primary-50);
    color: var(--primary-700);
}

.danger-btn {
    background: var(--danger-50);
    color: var(--danger-700);
    border-color: var(--danger-100);
}
.danger-btn:hover {
    background: var(--danger-100);
    color: var(--danger-700);
}

.link-btn {
    background: transparent;
    color: var(--brand);
    padding: 4px var(--space-2);
}
.link-btn:hover { color: var(--primary-600); text-decoration: underline; }

.ghost-btn.small,
.btn-sm {
    padding: 8px var(--space-3);
    font-size: var(--text-sm);
}

.btn-lg {
    padding: 14px var(--space-6);
    font-size: var(--text-lg);
}

/* ---------- Form ---------- */
.main-panel select,
.main-panel input[type="text"],
.main-panel input[type="email"],
.main-panel input[type="password"],
.main-panel input[type="number"],
.main-panel input[type="date"],
.main-panel textarea,
.form-input {
    width: 100%;
    min-height: 44px;
    padding: 10px var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: #fff;
    color: var(--text);
    font-size: var(--text-base);
    font-family: inherit;
    line-height: 1.4;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}

.main-panel select,
select.form-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding-right: 40px;
    background-image: linear-gradient(45deg, transparent 50%, var(--neutral-500) 50%), linear-gradient(135deg, var(--neutral-500) 50%, transparent 50%);
    background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
}

.main-panel select:focus,
.main-panel input[type="text"]:focus,
.main-panel input[type="email"]:focus,
.main-panel input[type="password"]:focus,
.main-panel input[type="number"]:focus,
.main-panel input[type="date"]:focus,
.main-panel textarea:focus,
.form-input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px var(--brand-soft);
}

.main-panel select:disabled,
.main-panel input:disabled,
.main-panel textarea:disabled,
.form-input:disabled {
    background: var(--neutral-50);
    color: var(--neutral-400);
    cursor: not-allowed;
}

.inline-form select,
.data-table select {
    width: auto;
    min-width: 140px;
    min-height: 36px;
    padding: 7px 34px 7px 12px;
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
}

.form-row {
    display: grid;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.form-row label {
    color: var(--text);
    font-size: var(--text-sm);
    font-weight: 600;
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--space-2);
}

.form-group {
    margin-bottom: var(--space-5);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}

.form-grid label {
    display: grid;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text);
}

.form-grid input,
.form-grid select {
    width: 100%;
    padding: 10px var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    outline: none;
    font-family: inherit;
    font-size: var(--text-base);
    min-height: 44px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-grid input:focus,
.form-grid select:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px var(--brand-soft);
}

.full-span { grid-column: 1 / -1; }

.inline-btn { margin-top: var(--space-3); }

.inline-form {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    flex-wrap: wrap;
}

.inline-form select { min-width: 150px; }

.inline-form input[type="text"] {
    min-width: 180px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
}

.inline-actions {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    flex-wrap: wrap;
}

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--neutral-300);
    border-radius: var(--radius-full);
    transition: var(--transition);
}
.switch .slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}
.switch input:checked + .slider { background: var(--primary-500); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* Checkbox / Radio */
input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--primary-500);
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ---------- Flash ---------- */
.flash {
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-5);
    margin: 0 0 var(--space-4);
    font-size: var(--text-base);
    border: 1px solid transparent;
    border-left-width: 4px;
}

.flash-success {
    background: var(--success-50);
    color: var(--success-700);
    border-left-color: var(--success-500);
}

.flash-danger {
    background: var(--danger-50);
    color: var(--danger-700);
    border-left-color: var(--danger-500);
}

.flash-warning {
    background: var(--warning-50);
    color: var(--warning-700);
    border-left-color: var(--warning-500);
}

.flash-info {
    background: var(--primary-50);
    color: var(--primary-700);
    border-left-color: var(--primary-500);
}

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-5);
}
.modal-overlay.open { display: flex; }

.modal {
    background: #fff;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 480px;
    width: 100%;
    padding: var(--space-8);
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn var(--transition-slow);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(20px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-title {
    font-size: var(--text-xl);
    font-weight: 700;
    margin: 0 0 var(--space-4);
    color: var(--neutral-900);
}

.modal-actions {
    display: flex;
    gap: var(--space-3);
    justify-content: flex-end;
    margin-top: var(--space-5);
}

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    top: var(--space-5);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, .92);
    color: #fff;
    padding: 10px var(--space-5);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    z-index: var(--z-toast);
    box-shadow: var(--shadow-xl);
}

/* ---------- Table ---------- */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: #fff;
    box-shadow: var(--shadow-md);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th,
.data-table td {
    padding: var(--space-5) var(--space-3);
    border-bottom: 1px solid var(--neutral-100);
    text-align: left;
    font-size: var(--text-base);
}

.data-table thead th {
    color: var(--muted);
    font-weight: 600;
    font-size: var(--text-sm);
    background: var(--neutral-50);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.data-table tbody tr {
    transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--primary-50);
}

.data-table.zebra tbody tr:nth-child(even) {
    background: var(--neutral-50);
}

.data-table.zebra tbody tr:nth-child(even):hover {
    background: var(--primary-50);
}

.data-table tr.selected {
    background: var(--primary-100) !important;
}

.data-table tbody tr:last-child td { border-bottom: none; }

.compact-table th,
.compact-table td {
    padding-top: 12px;
    padding-bottom: 12px;
}

/* ---------- Empty State ---------- */
.empty-state,
.empty {
    text-align: center;
    color: var(--muted);
    padding: var(--space-12) var(--space-6);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--space-3);
    opacity: .5;
}

/* ---------- Chart Placeholder ---------- */
.chart-placeholder {
    background: var(--neutral-50);
    border: 1px dashed var(--neutral-300);
    border-radius: var(--radius-lg);
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: var(--text-sm);
}

/* ---------- Progress ---------- */
.progress {
    width: 100%;
    height: 8px;
    background: var(--neutral-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-400));
    border-radius: var(--radius-full);
    transition: width var(--transition-slow);
}

/* ---------- Timeline ---------- */
.timeline-list {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
    line-height: 2;
}

/* ---------- Summary / Stage ---------- */
.summary-strip {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
    color: var(--muted);
}

.stage-stack {
    display: grid;
    gap: var(--space-5);
}

.stage-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}

.stage-card:hover { box-shadow: var(--shadow-md); }

.stage-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.stage-head small {
    display: block;
    color: var(--muted);
    margin-top: var(--space-1);
}

.stage-progress {
    margin-bottom: var(--space-3);
    color: var(--muted);
}

.assessment-box {
    margin-top: var(--space-3);
    margin-bottom: var(--space-3);
    padding: var(--space-4);
    background: var(--primary-50);
    border: 1px solid var(--primary-100);
    border-radius: var(--radius-lg);
}

.assessment-box p {
    margin: var(--space-2) 0 0;
    color: var(--muted);
}

.top-gap { margin-top: var(--space-3); }

/* ---------- Tone Variants ---------- */
.tone-primary {
    border-color: rgba(47, 107, 255, .22);
    background: rgba(47, 107, 255, .03);
}

.tone-success {
    border-color: rgba(15, 157, 88, .22);
    background: rgba(15, 157, 88, .04);
}

.tone-warning {
    border-color: rgba(245, 158, 11, .28);
    background: rgba(245, 158, 11, .06);
}

.tone-neutral { background: #fff; }

/* ---------- Dashboard ---------- */
.dashboard-simple-intro {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.dashboard-summary {
    margin: 0 0 var(--space-3);
    color: var(--muted);
    line-height: var(--leading-relaxed);
}

.dashboard-tip-list { margin-top: var(--space-2); }

.todo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}

.dashboard-todo-list {
    display: grid;
    gap: var(--space-3);
}

.dashboard-todo-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: var(--text);
    background: #fff;
    transition: var(--transition);
}

.dashboard-todo-row:hover {
    border-color: var(--primary-300);
    background: var(--primary-50);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.dashboard-todo-meta {
    display: grid;
    justify-items: end;
    gap: var(--space-1);
}

.todo-card {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-5);
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    text-decoration: none;
    color: var(--text);
    background: #fff;
    transition: var(--transition);
}

.todo-card:hover {
    border-color: var(--primary-300);
    box-shadow: var(--shadow-brand);
    transform: translateY(-2px);
}

.todo-title {
    font-weight: 600;
    color: var(--text);
    font-size: var(--text-md);
}

.todo-note,
.todo-action {
    color: var(--muted);
    font-size: var(--text-sm);
}

.todo-value {
    font-size: var(--text-3xl);
    font-weight: 800;
    color: var(--neutral-900);
}

.dashboard-shortcuts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-3);
}

.dashboard-shortcut-item {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #fff;
    text-decoration: none;
    color: var(--text);
    transition: var(--transition);
}

.dashboard-shortcut-item:hover {
    border-color: var(--primary-300);
    background: var(--primary-50);
    transform: translateY(-1px);
}

.dashboard-shortcut-item strong {
    font-size: var(--text-md);
    color: var(--neutral-900);
}

.dashboard-shortcut-item span {
    color: var(--muted);
    font-size: var(--text-sm);
    line-height: var(--leading-normal);
}

.guidance-card { margin-bottom: var(--space-5); }

.compact-list { line-height: var(--leading-relaxed); }

/* ---------- Auth ---------- */
.auth-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--space-6);
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--neutral-50) 100%);
}

.auth-shell {
    width: 100%;
    max-width: 520px;
}

.auth-panel-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-xl);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.auth-brand strong,
.auth-brand small { display: block; }

.auth-brand strong {
    font-size: var(--text-lg);
    color: var(--neutral-900);
}

.auth-brand small {
    color: var(--muted);
    margin-top: var(--space-1);
    font-size: var(--text-sm);
}

.auth-header h1 {
    margin-bottom: var(--space-2);
    font-size: var(--text-xl);
}

.auth-header p,
.auth-help p {
    color: var(--muted);
    font-size: var(--text-sm);
}

.auth-form {
    display: grid;
    gap: var(--space-4);
}

.auth-form label {
    display: grid;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 600;
}

.auth-form input,
.auth-form select {
    width: 100%;
    padding: 12px var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    outline: none;
    font-family: inherit;
    font-size: var(--text-base);
    min-height: 44px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.auth-form input:focus,
.auth-form select:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 4px var(--brand-soft);
}

.auth-help { margin-top: var(--space-5); }

.auth-embedded-card { max-width: 720px; }

/* ---------- Help Page ---------- */
.help-body {
    margin: 0;
    background: linear-gradient(180deg, var(--primary-50) 0%, var(--neutral-50) 100%);
}

.help-page-shell {
    max-width: 1180px;
    margin: 0 auto;
    padding: var(--space-8);
}

.help-page-topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-5);
    margin-bottom: var(--space-5);
}

.help-page-title {
    font-size: 30px;
    font-weight: 800;
    color: var(--neutral-900);
    margin-bottom: var(--space-2);
    letter-spacing: -.01em;
}

.help-page-subtitle {
    margin: 0;
    color: var(--muted);
    line-height: var(--leading-relaxed);
}

.help-page-actions {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    flex-wrap: wrap;
}

.help-page-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-2xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-lg);
}

.help-sidebar-card {
    position: sticky;
    top: var(--space-6);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--line);
    border-radius: var(--radius-2xl);
    padding: var(--space-5) var(--space-4);
    box-shadow: var(--shadow-md);
    max-height: calc(100vh - 48px);
    overflow: auto;
}

.help-sidebar-title {
    font-size: var(--text-md);
    font-weight: 700;
    color: var(--neutral-900);
    margin-bottom: var(--space-3);
}

.help-sidebar-list {
    display: grid;
    gap: var(--space-2);
}

.help-sidebar-link {
    display: block;
    text-decoration: none;
    color: var(--muted);
    font-size: var(--text-sm);
    line-height: 1.5;
    border-radius: var(--radius-md);
    padding: 8px 10px;
    transition: var(--transition);
}

.help-sidebar-link:hover {
    color: var(--brand);
    background: var(--brand-soft);
}

.help-sidebar-link.level-3 {
    padding-left: 22px;
    font-size: var(--text-xs);
}

.help-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-5);
    margin-bottom: var(--space-5);
}

.help-hero-actions {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.help-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: var(--space-5);
    align-items: start;
}

.help-sidebar {
    position: sticky;
    top: var(--space-6);
}

.help-topic-list {
    display: grid;
    gap: var(--space-3);
}

.help-topic-item {
    display: grid;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-xl);
    text-decoration: none;
    color: var(--text) !important;
    background: var(--primary-50);
    border: 1px solid var(--line);
    transition: var(--transition);
}

.help-topic-item span {
    color: var(--muted);
    font-size: var(--text-sm);
    line-height: var(--leading-relaxed);
}

.help-topic-item:hover,
.help-topic-item.active {
    border-color: var(--primary-300);
    background: var(--brand-soft);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.help-main {
    display: grid;
    gap: var(--space-5);
}

.help-summary-card {
    display: grid;
    gap: var(--space-4);
}

.help-quick-tips {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.help-quick-tips span {
    padding: 8px var(--space-3);
    background: var(--brand-soft);
    color: var(--brand);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
}

.help-doc-card { padding: var(--space-6); }

.help-prose {
    color: var(--text);
    line-height: var(--leading-relaxed);
}

.help-prose h2,
.help-prose h3,
.help-prose h4 {
    margin: 0 0 var(--space-3);
    color: var(--neutral-900);
}

.help-prose h2 { font-size: 26px; }
.help-prose h3 { font-size: 19px; margin-top: var(--space-6); }
.help-prose h4 { font-size: var(--text-lg); margin-top: var(--space-5); }

.help-prose p,
.help-prose ul,
.help-prose ol,
.help-prose blockquote,
.help-prose pre,
.help-prose .help-table-wrap,
.help-prose hr {
    margin: 0 0 var(--space-4);
}

.help-prose ul,
.help-prose ol { padding-left: 22px; }

.help-prose li { margin-bottom: var(--space-1); }

.help-prose blockquote {
    padding: var(--space-4) var(--space-5);
    border-left: 4px solid var(--brand);
    background: var(--primary-50);
    color: var(--muted);
    border-radius: var(--radius-md);
}

.help-prose code {
    background: var(--neutral-100);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    font-size: var(--text-sm);
}

.help-prose pre {
    overflow: auto;
    padding: var(--space-4);
    background: var(--neutral-900);
    color: #e2e8f0;
    border-radius: var(--radius-lg);
}

.help-prose pre code {
    background: transparent;
    border: none;
    padding: 0;
    color: inherit;
}

.help-prose hr {
    border: none;
    border-top: 1px solid var(--line);
}

.help-table-wrap { overflow-x: auto; }

.help-table th,
.help-table td { white-space: nowrap; }

/* ---------- Roadmap / Module ---------- */
.roadmap-list,
.module-list {
    display: grid;
    gap: var(--space-4);
}

.roadmap-item,
.module-item {
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    background: #fff;
    transition: var(--transition);
}

.roadmap-item:hover,
.module-item:hover {
    border-color: var(--primary-300);
    box-shadow: var(--shadow-md);
}

.roadmap-item h3,
.module-item h3 {
    margin: var(--space-2) 0;
}

.roadmap-item p,
.module-item p {
    margin: 0;
    color: var(--muted);
    line-height: var(--leading-relaxed);
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .stats-grid,
    .content-grid {
        grid-template-columns: 1fr 1fr;
    }

    .dashboard-shortcuts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .help-page-shell { padding: var(--space-6); }

    .help-layout { grid-template-columns: 1fr; }

    .help-sidebar-card {
        position: static;
        max-height: none;
    }
}

@media (max-width: 860px) {
    .admin-shell { grid-template-columns: 1fr; }

    .sidebar {
        position: static;
        height: auto;
        padding-bottom: var(--space-3);
    }

    .stats-grid,
    .content-grid { grid-template-columns: 1fr; }

    .dashboard-shortcuts { grid-template-columns: 1fr; }

    .help-page-topbar { flex-direction: column; }

    .section-head,
    .dashboard-simple-intro {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-todo-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-todo-meta { justify-items: start; }

    .form-grid { grid-template-columns: 1fr; }

    .topbar {
        position: static;
        margin-left: 0;
        margin-right: 0;
        padding-left: 0;
        padding-right: 0;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border-bottom: none;
    }
}
