/* ================================================================
   404link.com — Smart 404 Redirect Service
   CSS Design System — Editorial / Magazine Style
   ================================================================ */

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { min-height: 100vh; line-height: 1.6; -webkit-font-smoothing: antialiased; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }

/* ── Custom Properties (Light Mode) ─────────────────────────── */
:root {
    /* Colors */
    --color-bg:          #FAFAFA;
    --color-surface:     #FFFFFF;
    --color-surface-alt: #F5F5F7;
    --color-border:      #E5E7EB;
    --color-border-light:#F0F0F2;

    --color-text:        #1A1A2E;
    --color-text-secondary: #6B7280;
    --color-text-muted:  #9CA3AF;

    --color-primary:     #2563EB;
    --color-primary-hover:#1D4ED8;
    --color-primary-light:#DBEAFE;
    --color-primary-dark: #1E40AF;

    --color-accent:      #F97316;
    --color-accent-hover:#EA580C;
    --color-accent-light:#FFF7ED;

    --color-success:     #059669;
    --color-success-bg:  #ECFDF5;
    --color-warning:     #D97706;
    --color-warning-bg:  #FFFBEB;
    --color-danger:      #DC2626;
    --color-danger-bg:   #FEF2F2;
    --color-info:        #2563EB;
    --color-info-bg:     #EFF6FF;

    --color-navy:        #1A1A2E;
    --color-charcoal:    #2D2D44;

    /* Typography */
    --font-heading: Georgia, 'Times New Roman', serif;
    --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono:    'SF Mono', 'Fira Code', 'Fira Mono', Menlo, monospace;

    --text-xs:   0.75rem;
    --text-sm:   0.875rem;
    --text-base: 1rem;
    --text-lg:   1.125rem;
    --text-xl:   1.25rem;
    --text-2xl:  1.5rem;
    --text-3xl:  1.875rem;
    --text-4xl:  2.25rem;
    --text-5xl:  3rem;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;

    /* Layout */
    --max-width:  1200px;
    --max-narrow: 720px;
    --sidebar-width: 260px;

    /* Shadows */
    --shadow-sm:  0 1px 2px rgba(0,0,0,0.05);
    --shadow-md:  0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg:  0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --shadow-xl:  0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.06);

    /* Borders */
    --radius-sm:  4px;
    --radius-md:  8px;
    --radius-lg:  12px;
    --radius-xl:  16px;
    --radius-full: 9999px;

    /* Transitions */
    --transition: 150ms ease;
}

/* ── Dark Mode ──────────────────────────────────────────────── */
[data-theme="dark"] {
    --color-bg:          #0F0F1A;
    --color-surface:     #1A1A2E;
    --color-surface-alt: #222238;
    --color-border:      #2D2D44;
    --color-border-light:#252540;

    --color-text:        #F1F1F4;
    --color-text-secondary: #A1A1B5;
    --color-text-muted:  #6B6B80;

    --color-primary:     #3B82F6;
    --color-primary-hover:#60A5FA;
    --color-primary-light:#1E3A5F;
    --color-primary-dark: #93C5FD;

    --color-accent:      #FB923C;
    --color-accent-hover:#FDBA74;
    --color-accent-light:#3D2814;

    --color-success:     #34D399;
    --color-success-bg:  #0D2818;
    --color-warning:     #FBBF24;
    --color-warning-bg:  #3D2E0A;
    --color-danger:      #F87171;
    --color-danger-bg:   #3D1414;
    --color-info:        #60A5FA;
    --color-info-bg:     #1A2744;

    --shadow-sm:  0 1px 2px rgba(0,0,0,0.3);
    --shadow-md:  0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg:  0 10px 15px -3px rgba(0,0,0,0.4);
    --shadow-xl:  0 20px 25px -5px rgba(0,0,0,0.5);
}

/* ── Base Typography ────────────────────────────────────────── */
body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--color-text);
    background-color: var(--color-bg);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-text);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }

p { margin-bottom: var(--space-4); color: var(--color-text-secondary); }
p:last-child { margin-bottom: 0; }

small { font-size: var(--text-sm); color: var(--color-text-muted); }

code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--color-surface-alt);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
}

a:not(.btn) {
    color: var(--color-primary);
    transition: color var(--transition);
}
a:not(.btn):hover {
    color: var(--color-primary-hover);
}

/* ── Layout Utilities ───────────────────────────────────────── */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-narrow {
    max-width: var(--max-narrow);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-lg { font-size: var(--text-lg); }
.text-muted { color: var(--color-text-muted); }
.text-secondary { color: var(--color-text-secondary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.ml-auto { margin-left: auto; }

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.p-8 { padding: var(--space-8); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-8 { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.py-12 { padding-top: var(--space-12); padding-bottom: var(--space-12); }
.py-16 { padding-top: var(--space-16); padding-bottom: var(--space-16); }
.py-20 { padding-top: var(--space-20); padding-bottom: var(--space-20); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0.625rem 1.25rem;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    text-decoration: none;
}
.btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--color-primary);
    color: #fff;
    border-color: var(--color-primary);
}
.btn-primary:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

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

.btn-outline {
    background: transparent;
    color: var(--color-text);
    border-color: var(--color-border);
}
.btn-outline:hover {
    background: var(--color-surface-alt);
    border-color: var(--color-text-muted);
}

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

.btn-danger {
    background: var(--color-danger);
    color: #fff;
    border-color: var(--color-danger);
}
.btn-danger:hover {
    background: #B91C1C;
    border-color: #B91C1C;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: var(--text-xs);
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: var(--text-base);
    border-radius: var(--radius-lg);
}

.btn-block { width: 100%; }

.btn:disabled, .btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ── Cards ──────────────────────────────────────────────────── */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.card-hover:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--color-primary);
    transform: translateY(-1px);
    transition: all var(--transition);
}

/* ── Stats Card ─────────────────────────────────────────────── */
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}

.stat-card .stat-label {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-1);
}

.stat-card .stat-value {
    font-family: var(--font-heading);
    font-size: var(--text-3xl);
    font-weight: 700;
    color: var(--color-text);
    line-height: 1;
}

.stat-card .stat-change {
    font-size: var(--text-sm);
    margin-top: var(--space-2);
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-group {
    margin-bottom: var(--space-5);
}

.form-group label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-family: var(--font-body);
    font-size: var(--text-base);
    color: var(--color-text);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.form-control::placeholder {
    color: var(--color-text-muted);
}

.form-control.is-invalid {
    border-color: var(--color-danger);
}

.form-text {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-top: var(--space-1);
}

.form-error {
    font-size: var(--text-sm);
    color: var(--color-danger);
    margin-top: var(--space-1);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.input-group {
    display: flex;
    align-items: stretch;
}
.input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.input-group .input-addon {
    display: flex;
    align-items: center;
    padding: 0 0.875rem;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    white-space: nowrap;
}
.input-group-prepend {
    display: flex;
    align-items: center;
    padding: 0 0.875rem;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    white-space: nowrap;
}
.input-group .input-group-prepend + .form-control {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
}

/* ── Tables ─────────────────────────────────────────────────── */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
}

.table {
    width: 100%;
    font-size: var(--text-sm);
}

.table th {
    text-align: left;
    padding: var(--space-3) var(--space-4);
    font-weight: 600;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    background: var(--color-surface-alt);
    border-bottom: 1px solid var(--color-border);
}

.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-border-light);
    vertical-align: middle;
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: var(--color-surface-alt);
}

.table .actions {
    white-space: nowrap;
    text-align: right;
}

/* ── Alerts / Flash Messages ────────────────────────────────── */
.alert {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    margin-bottom: var(--space-6);
    border: 1px solid transparent;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}

.alert-success {
    background: var(--color-success-bg);
    color: var(--color-success);
    border-color: var(--color-success);
}

.alert-error {
    background: var(--color-danger-bg);
    color: var(--color-danger);
    border-color: var(--color-danger);
}

.alert-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning);
    border-color: var(--color-warning);
}

.alert-info {
    background: var(--color-info-bg);
    color: var(--color-info);
    border-color: var(--color-info);
}

.alert .alert-close {
    margin-left: auto;
    cursor: pointer;
    background: none;
    border: none;
    font-size: var(--text-lg);
    color: inherit;
    opacity: 0.7;
    line-height: 1;
}
.alert .alert-close:hover { opacity: 1; }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15em 0.6em;
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-primary { background: var(--color-primary-light); color: var(--color-primary); }
.badge-success { background: var(--color-success-bg); color: var(--color-success); }
.badge-warning { background: var(--color-warning-bg); color: var(--color-warning); }
.badge-danger  { background: var(--color-danger-bg); color: var(--color-danger); }
.badge-muted   { background: var(--color-surface-alt); color: var(--color-text-muted); }

.badge-free     { background: var(--color-surface-alt); color: var(--color-text-muted); }
.badge-pro      { background: var(--color-primary-light); color: var(--color-primary); }
.badge-business { background: var(--color-accent-light); color: var(--color-accent); }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    margin-top: var(--space-8);
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 var(--space-3);
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    transition: all var(--transition);
}
.pagination a:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.pagination .active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}
.pagination .disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ── Bar Charts (CSS-only) ──────────────────────────────────── */
.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 120px;
    padding-top: var(--space-4);
}

.chart-bar {
    flex: 1;
    background: var(--color-primary);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    min-height: 2px;
    position: relative;
    transition: background var(--transition);
    cursor: default;
}
.chart-bar:hover {
    background: var(--color-primary-hover);
}
.chart-bar .chart-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-navy);
    color: #fff;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    white-space: nowrap;
    margin-bottom: 4px;
}
.chart-bar:hover .chart-tooltip { display: block; }

.chart-labels {
    display: flex;
    gap: 2px;
    margin-top: var(--space-1);
}
.chart-labels span {
    flex: 1;
    text-align: center;
    font-size: 0.625rem;
    color: var(--color-text-muted);
}

/* ── Public Header ──────────────────────────────────────────── */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-4) var(--space-6);
}

.site-logo {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text);
}
.site-logo span { color: var(--color-primary); }

.site-nav {
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.site-nav a {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    transition: color var(--transition);
}
.site-nav a:hover { color: var(--color-text); }

.nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.theme-toggle {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    padding: 0.4rem;
    color: var(--color-text-secondary);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
}
.theme-toggle:hover {
    color: var(--color-text);
    border-color: var(--color-text-muted);
}
.theme-toggle svg { width: 18px; height: 18px; }

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-2);
    color: var(--color-text);
}

/* ── Public Footer ──────────────────────────────────────────── */
.site-footer {
    background: var(--color-navy);
    color: #E5E7EB;
    padding: var(--space-12) var(--space-6);
    margin-top: auto;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--space-8);
}

.footer-brand p { color: #9CA3AF; font-size: var(--text-sm); margin-top: var(--space-3); }

.footer-col h4 {
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-4);
    color: #fff;
}

.footer-col a {
    display: block;
    font-size: var(--text-sm);
    color: #9CA3AF;
    margin-bottom: var(--space-2);
    transition: color var(--transition);
}
.footer-col a:hover { color: #fff; }

.footer-bottom {
    max-width: var(--max-width);
    margin: var(--space-8) auto 0;
    padding-top: var(--space-6);
    border-top: 1px solid #2D2D44;
    display: flex;
    justify-content: space-between;
    font-size: var(--text-sm);
    color: #6B6B80;
}

/* ── Auth Layout ────────────────────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
    background: var(--color-bg);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-10);
    box-shadow: var(--shadow-lg);
}

.auth-logo {
    text-align: center;
    margin-bottom: var(--space-8);
}
.auth-logo a {
    font-family: var(--font-heading);
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-text);
}
.auth-logo a span { color: var(--color-primary); }

.auth-title {
    text-align: center;
    margin-bottom: var(--space-2);
    font-size: var(--text-2xl);
}

.auth-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    margin-bottom: var(--space-8);
}

.auth-footer {
    text-align: center;
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    border-top: 1px solid var(--color-border);
    font-size: var(--text-sm);
    color: var(--color-text-muted);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin: var(--space-6) 0;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-border);
}

/* ── Dashboard Layout ───────────────────────────────────────── */
.dash-wrapper {
    display: flex;
    min-height: 100vh;
}

.dash-sidebar {
    width: var(--sidebar-width);
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    overflow-y: auto;
}

.dash-sidebar .sidebar-logo {
    padding: var(--space-6);
    border-bottom: 1px solid var(--color-border);
}
.dash-sidebar .sidebar-logo a {
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--color-text);
}
.dash-sidebar .sidebar-logo a span { color: var(--color-primary); }

.dash-sidebar .sidebar-nav {
    padding: var(--space-4);
    flex: 1;
}

.dash-sidebar .nav-section {
    margin-bottom: var(--space-6);
}

.dash-sidebar .nav-section-title {
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    padding: 0 var(--space-3);
    margin-bottom: var(--space-2);
}

.dash-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0.5rem var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--color-text-secondary);
    transition: all var(--transition);
    margin-bottom: 2px;
}
.dash-sidebar .nav-link:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
}
.dash-sidebar .nav-link.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.dash-sidebar .nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.dash-sidebar .sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--color-border);
}

.dash-sidebar .user-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
}

.dash-sidebar .user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--color-primary-light);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.dash-sidebar .user-name {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--color-text);
}
.dash-sidebar .user-plan {
    font-size: var(--text-xs);
    color: var(--color-text-muted);
    text-transform: capitalize;
}

.dash-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    background: var(--color-bg);
}

.dash-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-8);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 40;
}

.dash-topbar .topbar-left {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.dash-topbar .topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-2);
    color: var(--color-text);
}

.dash-content {
    padding: var(--space-8);
}

.page-header {
    margin-bottom: var(--space-8);
}

.page-header h1 {
    font-size: var(--text-3xl);
    margin-bottom: var(--space-2);
}

.page-header p {
    color: var(--color-text-secondary);
}

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

/* ── Admin Layout ───────────────────────────────────────────── */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--color-navy);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    overflow-y: auto;
}

.admin-sidebar .sidebar-logo {
    padding: var(--space-6);
    border-bottom: 1px solid var(--color-charcoal);
}
.admin-sidebar .sidebar-logo a {
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    font-weight: 700;
    color: #fff;
}
.admin-sidebar .sidebar-logo a span { color: var(--color-primary); }
.admin-sidebar .sidebar-logo small { color: #6B6B80; font-size: var(--text-xs); }

.admin-sidebar .sidebar-nav {
    padding: var(--space-4);
    flex: 1;
}

.admin-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0.5rem var(--space-3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: 500;
    color: #A1A1B5;
    transition: all var(--transition);
    margin-bottom: 2px;
}
.admin-sidebar .nav-link:hover {
    background: var(--color-charcoal);
    color: #fff;
}
.admin-sidebar .nav-link.active {
    background: var(--color-primary);
    color: #fff;
}

.admin-sidebar .sidebar-footer {
    padding: var(--space-4);
    border-top: 1px solid var(--color-charcoal);
}

.admin-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    background: var(--color-bg);
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-8);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}

.admin-content {
    padding: var(--space-8);
}

/* ── Landing Page ───────────────────────────────────────────── */
.hero {
    padding: var(--space-24) var(--space-6) var(--space-20);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 50% 0%, var(--color-primary-light) 0%, transparent 70%);
    opacity: 0.5;
    pointer-events: none;
}

.hero h1 {
    font-size: var(--text-5xl);
    max-width: 800px;
    margin: 0 auto var(--space-6);
    position: relative;
}

.hero .hero-subtitle {
    font-size: var(--text-xl);
    color: var(--color-text-secondary);
    max-width: 600px;
    margin: 0 auto var(--space-10);
    position: relative;
}

.hero .hero-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    position: relative;
}

.hero .hero-slug-demo {
    margin-top: var(--space-12);
    position: relative;
}

.slug-demo-box {
    display: inline-flex;
    align-items: center;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4) var(--space-6);
    font-family: var(--font-mono);
    font-size: var(--text-lg);
    box-shadow: var(--shadow-lg);
    gap: var(--space-2);
}
.slug-demo-box .slug-prefix { color: var(--color-text-muted); }
.slug-demo-box .slug-editable { color: var(--color-primary); font-weight: 600; }

.features-section {
    padding: var(--space-20) var(--space-6);
}

.features-section .section-title {
    text-align: center;
    margin-bottom: var(--space-4);
}

.features-section .section-subtitle {
    text-align: center;
    color: var(--color-text-secondary);
    max-width: 600px;
    margin: 0 auto var(--space-12);
    font-size: var(--text-lg);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-8);
    max-width: var(--max-width);
    margin: 0 auto;
}

.feature-card {
    text-align: center;
    padding: var(--space-8);
}

.feature-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-5);
    font-size: var(--text-2xl);
}
.feature-icon.blue { background: var(--color-primary-light); color: var(--color-primary); }
.feature-icon.coral { background: var(--color-accent-light); color: var(--color-accent); }
.feature-icon.green { background: var(--color-success-bg); color: var(--color-success); }

.feature-card h3 {
    margin-bottom: var(--space-3);
    font-size: var(--text-xl);
}

.how-it-works {
    padding: var(--space-20) var(--space-6);
    background: var(--color-surface-alt);
}

.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-8);
    max-width: var(--max-width);
    margin: 0 auto;
}

.step-card {
    text-align: center;
    padding: var(--space-6);
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: var(--text-lg);
    margin: 0 auto var(--space-4);
}

.step-card h3 { margin-bottom: var(--space-3); }

.cta-section {
    padding: var(--space-20) var(--space-6);
    text-align: center;
    background: var(--color-navy);
    color: #fff;
}

.cta-section h2 { color: #fff; margin-bottom: var(--space-4); }
.cta-section p { color: #A1A1B5; margin-bottom: var(--space-8); font-size: var(--text-lg); }

/* ── Pricing Page ───────────────────────────────────────────── */
.pricing-section {
    padding: var(--space-20) var(--space-6);
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-6);
    max-width: 960px;
    margin: 0 auto;
    align-items: start;
}

.pricing-card {
    background: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    position: relative;
}

.pricing-card.featured {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-xl);
    transform: scale(1.04);
}

.pricing-card .plan-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    color: #fff;
    padding: 0.25rem 1rem;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pricing-card .plan-name {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.pricing-card .plan-price {
    font-family: var(--font-heading);
    font-size: var(--text-4xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
}
.pricing-card .plan-price span {
    font-size: var(--text-base);
    font-weight: 400;
    color: var(--color-text-muted);
}

.pricing-card .plan-desc {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--space-6);
}

.pricing-features {
    list-style: none;
    margin-bottom: var(--space-6);
}
.pricing-features li {
    padding: var(--space-2) 0;
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}
.pricing-features li::before {
    content: '\2713';
    color: var(--color-success);
    font-weight: 700;
}
.pricing-features li.disabled {
    color: var(--color-text-muted);
    text-decoration: line-through;
}
.pricing-features li.disabled::before {
    content: '\2717';
    color: var(--color-text-muted);
}

/* ── Dashboard Pages ────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.empty-state {
    text-align: center;
    padding: var(--space-16) var(--space-6);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    opacity: 0.3;
}

.empty-state h3 {
    margin-bottom: var(--space-3);
}

.empty-state p {
    max-width: 400px;
    margin: 0 auto var(--space-6);
}

.link-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--color-border-light);
    transition: background var(--transition);
}
.link-row:hover { background: var(--color-surface-alt); }
.link-row:last-child { border-bottom: none; }

.link-row .link-info h4 {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: 2px;
}

.link-row .link-slug {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--color-primary);
}

.link-row .link-dest {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.link-row .link-clicks {
    font-family: var(--font-heading);
    font-size: var(--text-xl);
    font-weight: 700;
    color: var(--color-text);
    text-align: center;
    min-width: 60px;
}

.link-row .link-status .badge { min-width: 60px; justify-content: center; }

/* ── Analytics Page ─────────────────────────────────────────── */
.analytics-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.analytics-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--space-6);
}

.breakdown-list {
    list-style: none;
}
.breakdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--color-border-light);
    font-size: var(--text-sm);
}
.breakdown-item:last-child { border-bottom: none; }

.breakdown-bar {
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--color-surface-alt);
    margin-top: var(--space-1);
    overflow: hidden;
}
.breakdown-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    background: var(--color-primary);
}

/* ── Slug Availability ──────────────────────────────────────── */
.slug-check {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    margin-top: var(--space-2);
    min-height: 20px;
}
.slug-check.available { color: var(--color-success); }
.slug-check.taken { color: var(--color-danger); }
.slug-check.checking { color: var(--color-text-muted); }

/* ── Error Pages ────────────────────────────────────────────── */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-6);
}

.error-page .error-code {
    font-family: var(--font-heading);
    font-size: 8rem;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
    margin-bottom: var(--space-4);
}

.error-page h2 {
    margin-bottom: var(--space-4);
}

.error-page p {
    margin-bottom: var(--space-8);
}

/* ── Redirect Rules ─────────────────────────────────────────── */
.rules-list {
    margin-top: var(--space-4);
}

.rule-row {
    display: grid;
    grid-template-columns: 120px 1fr 1fr auto;
    gap: var(--space-3);
    align-items: center;
    padding: var(--space-3);
    background: var(--color-surface-alt);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
}

.rule-row .form-control {
    padding: 0.4rem 0.65rem;
    font-size: var(--text-sm);
}

/* ── Copy Button ────────────────────────────────────────────── */
.copy-btn {
    position: relative;
    cursor: pointer;
}
.copy-btn .copy-tooltip {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-navy);
    color: #fff;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    white-space: nowrap;
    margin-bottom: 4px;
}
.copy-btn.copied .copy-tooltip { display: block; }

/* ── Animations ─────────────────────────────────────────────── */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease both;
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 200px; }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .features-grid { grid-template-columns: repeat(2, 1fr); }
    .steps-grid { grid-template-columns: repeat(2, 1fr); }
    .pricing-grid { grid-template-columns: 1fr; max-width: 400px; }
    .pricing-card.featured { transform: none; }
    .analytics-grid { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    :root {
        --text-5xl: 2.25rem;
        --text-4xl: 1.875rem;
        --text-3xl: 1.5rem;
    }

    .site-nav { display: none; }
    .site-nav.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--color-surface);
        border-bottom: 1px solid var(--color-border);
        padding: var(--space-4) var(--space-6);
        box-shadow: var(--shadow-lg);
    }
    .mobile-toggle { display: block; }

    .dash-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .dash-sidebar.open { transform: translateX(0); }
    .dash-main { margin-left: 0; }
    .dash-content { padding: var(--space-4); }
    .sidebar-toggle { display: block; }

    .admin-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .admin-content { padding: var(--space-4); }

    .link-row {
        grid-template-columns: 1fr;
        gap: var(--space-2);
    }
    .link-row .link-clicks { text-align: left; }

    .rule-row { grid-template-columns: 1fr; }

    .features-grid { grid-template-columns: 1fr; }
    .steps-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }

    .hero { padding: var(--space-12) var(--space-4) var(--space-12); }
    .hero .hero-actions { flex-direction: column; }

    .footer-inner { grid-template-columns: 1fr; }
    .footer-bottom { flex-direction: column; gap: var(--space-2); text-align: center; }

    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }

    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: var(--space-4);
    }
}

@media (max-width: 480px) {
    .auth-card { padding: var(--space-6); }
    .slug-demo-box { font-size: var(--text-base); padding: var(--space-3) var(--space-4); }
}
