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

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #eff6ff;
    --success: #059669;
    --success-soft: #ecfdf5;
    --warning: #d97706;
    --warning-soft: #fffbeb;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --info: #0284c7;
    --info-soft: #f0f9ff;

    --bg: #f4f6fb;
    --bg-elevated: #ffffff;
    --topbar-bg: #0f172a;
    --topbar-text: #cbd5e1;
    --topbar-active: #ffffff;

    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 4px 16px rgba(15, 23, 42, .06);
    --shadow-lg: 0 12px 32px rgba(15, 23, 42, .1);

    --header-h: 60px;
    --container: 1240px;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;

    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); }

.container-wide {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding-left: var(--space-6);
    padding-right: var(--space-6);
}

/* —— App shell & top navigation —— */
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 200;
    height: var(--header-h);
    background: var(--topbar-bg);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    box-shadow: var(--shadow-sm);
}

.topbar-inner {
    height: 100%;
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: #fff;
    flex-shrink: 0;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .5px;
}

.brand-text {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
}

.topnav {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    flex: 1;
}

.topnav-link {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--topbar-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.topnav-link:hover {
    background: rgba(255, 255, 255, .08);
    color: var(--topbar-active);
}

.topnav-link.is-active {
    background: rgba(37, 99, 235, .35);
    color: #fff;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-left: auto;
    flex-shrink: 0;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #334155;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

.user-meta {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.user-meta strong {
    font-size: 13px;
    color: #f8fafc;
    font-weight: 600;
}

.user-meta small {
    font-size: 11px;
    color: var(--topbar-text);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: #e2e8f0;
    border-radius: 2px;
}

.page-container { flex: 1; padding-top: var(--space-6); padding-bottom: var(--space-8); }

.main-content { min-height: 400px; }

.app-footer {
    margin-top: var(--space-8);
    padding: var(--space-4) 0;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-muted);
    font-size: 12px;
}

.app-footer a { text-decoration: none; color: var(--text-secondary); }
.app-footer a:hover { color: var(--primary); }

/* —— Page header & quick actions —— */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text);
}

.page-header .breadcrumb,
.page-desc {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: var(--space-1);
    max-width: 720px;
}

.page-header .breadcrumb a { text-decoration: none; }
.page-header .breadcrumb a:hover { text-decoration: underline; }

.page-actions {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
    align-items: center;
}

.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.quick-action {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 10px 16px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
    transition: border-color .15s, box-shadow .15s, transform .15s;
}

.quick-action:hover {
    border-color: #bfdbfe;
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.quick-action.primary {
    background: var(--primary-soft);
    border-color: #bfdbfe;
    color: var(--primary-hover);
}

/* —— Cards —— */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-6);
    margin-bottom: var(--space-5);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-3);
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.card-muted {
    background: #f8fafc;
}

/* —— Stats —— */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    position: relative;
    overflow: hidden;
    transition: box-shadow .15s;
}

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

.stat-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--primary);
}

.stat-card.success::after { background: var(--success); }
.stat-card.warning::after { background: var(--warning); }
.stat-card.danger::after { background: var(--danger); }
.stat-card.info::after { background: var(--info); }

.stat-card .stat-label { color: var(--text-muted); font-size: 12px; margin-bottom: var(--space-1); }
.stat-card .stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat-card .stat-icon { display: none; }

.team-goal-banner {
    margin-bottom: var(--space-5);
    padding: var(--space-5);
    border: 1px solid var(--border);
    background: linear-gradient(135deg, rgba(79,70,229,.06) 0%, rgba(16,185,129,.05) 100%);
}

.team-goal-banner-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.team-goal-banner-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 var(--space-2);
}

.team-goal-banner-desc {
    margin: 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.team-goal-banner-stats {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.team-goal-percent {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

.team-goal-banner-foot {
    margin: var(--space-3) 0 0;
    font-size: 12px;
}

.team-goal-progress-track {
    height: 10px;
    border-radius: 999px;
    background: rgba(0,0,0,.06);
    overflow: hidden;
}

.team-goal-progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--primary), #10b981);
    transition: width .4s ease;
}

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

.team-goal-admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
    margin-bottom: var(--space-5);
}

@media (max-width: 900px) {
    .team-goal-admin-grid { grid-template-columns: 1fr; }
}

.team-goal-live-num {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.team-goal-live-num .current { color: var(--primary); }
.team-goal-live-num .sep { color: var(--text-muted); margin: 0 4px; font-weight: 400; }
.team-goal-live-num .target { color: var(--text-secondary); font-size: 28px; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 400;
    cursor: pointer;
}

.filter-date-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 13px;
    color: var(--text-secondary);
}

.filter-date-label input[type="date"] {
    width: auto;
    min-width: 150px;
}

.filter-inline-check {
    margin: 0;
    font-size: 13px;
}

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

.work-monitor-table {
    font-size: 13px;
}

.work-monitor-table .th-group {
    text-align: center;
    background: rgba(79, 70, 229, .06);
    font-size: 12px;
}

.work-monitor-table td.num {
    text-align: center;
    white-space: nowrap;
}

.work-monitor-row-quiet td.num {
    opacity: .85;
}

.work-monitor-totals {
    background: rgba(0, 0, 0, .03);
}

.work-monitor-totals td {
    border-top: 2px solid var(--border);
}

.charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-5);
    margin-bottom: var(--space-5);
}

/* —— Forms —— */
.form-group { margin-bottom: var(--space-4); }
.form-group label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 500;
    font-size: 13px;
    color: var(--text-secondary);
}

.form-hint {
    display: block;
    margin-top: var(--space-1);
    font-size: 12px;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

textarea.form-control { resize: vertical; min-height: 88px; }
select.form-control { cursor: pointer; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }

/* —— Buttons —— */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, border-color .15s, color .15s;
    white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: #f8fafc; }
.btn-ghost { background: rgba(255,255,255,.06); color: #e2e8f0; border-color: rgba(255,255,255,.12); }
.btn-ghost:hover { background: rgba(255,255,255,.12); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* —— Tables —— */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

table { width: 100%; border-collapse: collapse; }

table th, table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: none;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
}

table tbody tr:last-child td { border-bottom: none; }
table tbody tr:hover td { background: #fafbff; }
table .actions { white-space: nowrap; }

.cell-keywords {
    max-width: 200px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.45;
    word-break: break-word;
}

/* —— Badges & alerts —— */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success { background: var(--success-soft); color: #047857; }
.badge-warning { background: var(--warning-soft); color: #b45309; }
.badge-danger { background: var(--danger-soft); color: #b91c1c; }
.badge-secondary { background: #f1f5f9; color: #475569; }
.badge-info { background: var(--info-soft); color: #0369a1; }

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-4);
    font-size: 14px;
    border: 1px solid transparent;
}

.alert-success { background: var(--success-soft); color: #065f46; border-color: #a7f3d0; }
.alert-error { background: var(--danger-soft); color: #991b1b; border-color: #fecaca; }
.alert-info { background: var(--info-soft); color: #1e40af; border-color: #bfdbfe; }

/* —— Tabs —— */
.tabs {
    display: flex;
    gap: var(--space-1);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-5);
    overflow-x: auto;
}

.tab {
    padding: 10px 16px;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    text-decoration: none;
    white-space: nowrap;
}

.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-hint {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 var(--space-4);
    padding: 10px 14px;
    background: var(--primary-soft);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm);
}
.tab-hint a { font-weight: 500; }

/* —— Link detail —— */
.link-header { display: flex; gap: var(--space-5); align-items: flex-start; margin-bottom: var(--space-5); flex-wrap: wrap; }
.link-header-media { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.link-info h2 { font-size: 18px; margin-bottom: var(--space-2); }
.link-info .meta { color: var(--text-muted); font-size: 13px; }
.link-info .meta span { margin-right: var(--space-4); }

.link-stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); margin-bottom: var(--space-4); }
.link-stats-row-5 { grid-template-columns: repeat(5, 1fr); }
.link-stats-row-6 { grid-template-columns: repeat(6, 1fr); }
.link-stat {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-3);
    text-align: center;
}
.link-stat .num { font-size: 20px; font-weight: 700; color: var(--primary); }
.link-stat .lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 40px; margin-bottom: var(--space-3); opacity: .85; }

.activity-list { list-style: none; }
.activity-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--border);
}
.activity-item:last-child { border-bottom: none; }
.activity-type {
    width: 34px; height: 34px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
}
.activity-type.sales { background: var(--success-soft); }
.activity-type.volume { background: var(--primary-soft); }
.activity-type.rank { background: var(--warning-soft); }
.activity-type.p4p { background: var(--info-soft); }
.activity-type.violation { background: var(--danger-soft); }
.activity-type.creative { background: var(--warning-soft); }
.activity-body { flex: 1; min-width: 0; }
.activity-body .title { font-weight: 500; font-size: 13px; }
.activity-body .desc { font-size: 12px; color: var(--text-muted); }
.activity-time { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-4); }
.shop-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    transition: box-shadow .15s, border-color .15s;
}
.shop-card:hover { box-shadow: var(--shadow); border-color: #cbd5e1; }
.shop-card h3 { font-size: 16px; margin-bottom: var(--space-2); }
.shop-card .shop-meta { color: var(--text-muted); font-size: 13px; margin-bottom: var(--space-3); }
.shop-card .shop-stats { display: flex; gap: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.shop-card .shop-stat-item { text-align: center; flex: 1; }
.shop-card .shop-stat-item .num { font-size: 18px; font-weight: 700; color: var(--primary); }
.shop-card .shop-stat-item .lbl { font-size: 11px; color: var(--text-muted); }
.shop-card .shop-actions { display: flex; gap: var(--space-2); margin-top: var(--space-4); flex-wrap: wrap; }

.filter-bar { display: flex; gap: var(--space-3); align-items: center; margin-bottom: var(--space-4); flex-wrap: wrap; }
.filter-bar-form {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
}
.filter-bar select, .filter-bar input {
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: #fff;
}
.topbar-admin { background: #1e1b4b; }

.form-readonly-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-4);
}
.ro-label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.ro-value { font-size: 14px; font-weight: 500; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}
.checkbox-label input { width: auto; }

.filter-bar .filter-search {
    flex: 1;
    min-width: 200px;
    max-width: 360px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4);
    border-top: 1px solid var(--border);
}
.pagination-link {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
}
.pagination-link:hover { background: var(--primary-soft); }
.pagination-link.is-disabled {
    color: var(--text-muted);
    pointer-events: none;
    background: #f8fafc;
}
.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

.cms-page-card { max-width: 900px; }
.cms-page-content {
    font-size: 15px;
    line-height: 1.75;
    color: var(--text-secondary);
}
.cms-page-content h2, .cms-page-content h3, .cms-page-content h4 {
    color: var(--text-primary);
    margin: 1.25em 0 0.5em;
}
.cms-page-content p { margin-bottom: 1em; }
.cms-page-content ul, .cms-page-content ol { padding-left: 1.5em; margin-bottom: 1em; }
.cms-page-content a { color: var(--primary); }
.cms-page-content .cms-image-figure {
    display: inline-block;
    margin: 0.75em 0.75em 0.75em 0;
    vertical-align: top;
    max-width: 100%;
}

.cms-page-content .cms-media-thumb,
.cms-page-content img.cms-media-thumb {
    display: block;
    width: 200px;
    height: 150px;
    max-width: 100%;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: #f8fafc;
    cursor: zoom-in;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.cms-page-content .cms-media-thumb:hover,
.cms-page-content img.cms-media-thumb:hover {
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.cms-page-content .cms-image-figure-cap {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.3;
}

.cms-page-content .cms-inline-image:not(.cms-media-thumb) {
    max-width: 100%;
    height: auto;
}

.cms-page-media-hint {
    font-size: 12px;
    margin: 0 0 var(--space-3);
    padding: 0;
}

.rich-editor-shell {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
    overflow: hidden;
}

.rich-editor-mount {
    min-height: 200px;
}

.rich-editor-shell.is-ready .rich-editor-source {
    display: none !important;
}

.rich-editor-source {
    width: 100%;
}

.rich-editor-shell .ql-toolbar.ql-snow {
    border: none;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}

.rich-editor-shell .ql-container.ql-snow {
    border: none;
    font-size: 14px;
}

.rich-editor-shell .ql-editor {
    min-height: 280px;
    line-height: 1.65;
}

.rich-editor-shell.rich-editor-fallback {
    border: none;
    background: transparent;
    overflow: visible;
}

.cms-page-form-card {
    max-width: 960px;
}

.cms-page-content h1 { font-size: 1.5em; }
.cms-page-content h5, .cms-page-content h6 { margin: 1em 0 0.5em; }

.cms-image-upload-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.work-experience-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.work-experience-item-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.work-experience-title {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 var(--space-1);
}

.work-experience-meta {
    font-size: 12px;
    line-height: 1.5;
}

.work-experience-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-start;
}

.work-experience-form-card {
    max-width: 960px;
}

.work-experience-content.rich-html-content {
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-secondary);
}

.work-experience-content.rich-html-content ul,
.work-experience-content.rich-html-content ol {
    padding-left: 1.5em;
    margin: 0.5em 0 1em;
}

.work-experience-content.rich-html-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
    font-size: 13px;
}

.work-experience-content.rich-html-content th,
.work-experience-content.rich-html-content td {
    border: 1px solid var(--border);
    padding: 8px 10px;
}

.work-experience-content.rich-html-content blockquote {
    margin: 1em 0;
    padding: 0.5em 1em;
    border-left: 3px solid var(--primary);
    background: rgba(79, 70, 229, 0.04);
}

.work-experience-content {
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-secondary);
    white-space: normal;
}

.work-experience-actions {
    display: flex;
    gap: 8px;
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
}

/* —— Auth —— */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    background:
        radial-gradient(circle at 10% 20%, rgba(37, 99, 235, .25), transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(14, 165, 233, .2), transparent 35%),
        linear-gradient(160deg, #0f172a 0%, #1e293b 45%, #0f172a 100%);
}

.auth-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(255, 255, 255, .2);
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin-bottom: var(--space-5);
}
.auth-brand .brand-text { color: var(--text-primary); font-weight: 600; font-size: 15px; }

.auth-card h1 { text-align: center; margin-bottom: var(--space-2); font-size: 20px; }
.auth-card .subtitle { text-align: center; color: var(--text-muted); margin-bottom: var(--space-6); }
.auth-link { text-align: center; margin-top: var(--space-5); font-size: 13px; color: var(--text-muted); }
.auth-link a { font-weight: 500; text-decoration: none; }

/* —— UI spec page —— */
.spec-section { margin-bottom: var(--space-8); }
.spec-section h2 { font-size: 18px; margin-bottom: var(--space-3); }
.spec-section h3 { font-size: 15px; margin: var(--space-4) 0 var(--space-2); color: var(--text-secondary); }
.spec-section p, .spec-section li { color: var(--text-secondary); font-size: 14px; }
.spec-section ul { padding-left: 1.25rem; margin-bottom: var(--space-3); }
.token-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--space-3); }
.token-swatch {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    font-size: 12px;
}
.token-swatch .color { height: 48px; }
.token-swatch .label { padding: 8px; background: #fff; color: var(--text-muted); }

.inline-form { display: inline; }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.mt-2 { margin-top: var(--space-2); }
.mb-0 { margin-bottom: 0; }

input[type="file"].form-control { padding: 8px; font-size: 13px; }

.upload-progress-wrap {
    margin: var(--space-4) 0 var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.upload-progress-track {
    height: 8px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}
.upload-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary), #3b82f6);
    border-radius: 999px;
    transition: width 0.15s ease-out;
}
.upload-progress-text {
    margin-top: var(--space-2);
    font-size: 13px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

/* Media preview (unchanged behavior, token-aligned) */
.upload-preview {
    margin-top: var(--space-3);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    padding: var(--space-2);
    background: #f8fafc;
    display: inline-block;
}
.upload-preview-compact { max-width: 100%; }
.media-preview-hint { font-size: 12px; }
.media-thumb, .creative-thumb {
    display: inline-block;
    width: 72px; height: 72px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: #fff;
    cursor: zoom-in;
}
.media-thumb-lg { width: 96px; height: 96px; }
.media-thumb-link { display: inline-flex; align-items: center; justify-content: center; font-size: 12px; text-decoration: none; color: var(--primary); }
.media-thumb-placeholder { display: inline-flex; align-items: center; justify-content: center; background: #f1f5f9; border: 1px solid var(--border); color: #cbd5e1; font-size: 28px; }
.media-video-thumb, .creative-video-thumb {
    position: relative; display: inline-block;
    width: 72px; height: 72px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    background: #0f172a;
    cursor: zoom-in;
}
.media-video-thumb video, .creative-video-thumb video { width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.media-video-play, .creative-video-play {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #fff;
    background: rgba(15, 23, 42, .35);
    pointer-events: none;
}
.media-lightbox, .image-lightbox {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: center; justify-content: center;
}
.media-lightbox[hidden], .image-lightbox[hidden] { display: none !important; }
.media-lightbox-backdrop, .image-lightbox-backdrop {
    position: absolute; inset: 0;
    background: rgba(15, 23, 42, .75);
    cursor: zoom-out;
}
.media-lightbox-inner, .image-lightbox-inner {
    position: relative; z-index: 1;
    max-width: min(92vw, 960px);
    max-height: 90vh;
    padding: 12px;
}
.media-lightbox-inner img, .media-lightbox-inner video,
.image-lightbox-inner img, .image-lightbox-inner video {
    display: block;
    max-width: 100%;
    max-height: calc(90vh - 24px);
    margin: 0 auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}
.media-lightbox-inner video, .image-lightbox-inner video { background: #000; width: min(92vw, 960px); }
.media-lightbox-inner img[hidden], .media-lightbox-inner video[hidden],
.image-lightbox-inner img[hidden], .image-lightbox-inner video[hidden] { display: none !important; }
.media-lightbox-close, .image-lightbox-close {
    position: absolute; top: -4px; right: -4px;
    width: 36px; height: 36px;
    border: none; border-radius: 50%;
    background: #fff; cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 2;
}
.creative-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); }
.creative-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: #fafbfc; }
.creative-card-title { font-weight: 600; margin-bottom: var(--space-3); }
.creative-media-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.creative-media-label { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.creative-card-footer {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
}

@media (max-width: 960px) {
    .charts-row { grid-template-columns: 1fr; }
    .link-stats-row, .link-stats-row-5, .link-stats-row-6 { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .brand-text { display: none; }
    .user-meta { display: none; }
}

@media (max-width: 768px) {
    .container-wide { padding-left: var(--space-4); padding-right: var(--space-4); }
    .nav-toggle { display: flex; }
    .topnav {
        display: none;
        position: absolute;
        top: var(--header-h);
        left: 0; right: 0;
        background: #1e293b;
        flex-direction: column;
        align-items: stretch;
        padding: var(--space-3);
        border-bottom: 1px solid rgba(255,255,255,.08);
        box-shadow: var(--shadow-lg);
    }
    .topnav.is-open { display: flex; }
    .topnav-link { padding: 12px 14px; }
    .topbar-inner { position: relative; flex-wrap: wrap; }
    .page-header h1 { font-size: 20px; }
}
