/* ============================================================
   SimpleLink Shortener — Design System v2
   Light/Dark theme, glassmorphism, micro-animations
   ============================================================ */

/* ─── Dark Theme (Default) ──────────────────────────────── */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(31, 41, 55, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-input: rgba(255, 255, 255, 0.06);
    --bg-input-focus: rgba(255, 255, 255, 0.08);
    --bg-tooltip: #1e293b;

    --border-color: rgba(255, 255, 255, 0.08);
    --border-color-hover: rgba(255, 255, 255, 0.15);
    --border-accent: rgba(99, 102, 241, 0.4);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;

    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.25);
    --accent-soft: rgba(99, 102, 241, 0.12);

    --success: #10b981;
    --success-soft: rgba(16, 185, 129, 0.12);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, 0.12);
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, 0.12);
    --info: #06b6d4;
    --info-soft: rgba(6, 182, 212, 0.12);

    --gradient-accent: linear-gradient(135deg, #6366f1, #8b5cf6, #a78bfa);
    --gradient-card: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.04));
    --gradient-hero: linear-gradient(160deg, #0a0e1a 0%, #131b2e 40%, #1a1040 100%);
    --gradient-success: linear-gradient(135deg, #10b981, #34d399);
    --gradient-danger: linear-gradient(135deg, #ef4444, #f87171);

    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 40px var(--accent-glow);

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    --theme-toggle-icon: '🌙';
}

/* ─── Light Theme ───────────────────────────────────────── */
html[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(248, 250, 252, 1);
    --bg-glass: rgba(0, 0, 0, 0.02);
    --bg-input: rgba(0, 0, 0, 0.04);
    --bg-input-focus: rgba(0, 0, 0, 0.06);
    --bg-tooltip: #ffffff;

    --border-color: rgba(0, 0, 0, 0.08);
    --border-color-hover: rgba(0, 0, 0, 0.15);
    --border-accent: rgba(99, 102, 241, 0.3);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #f8fafc;

    --accent: #4f46e5;
    --accent-hover: #6366f1;
    --accent-glow: rgba(79, 70, 229, 0.15);
    --accent-soft: rgba(79, 70, 229, 0.08);

    --success-soft: rgba(16, 185, 129, 0.08);
    --warning-soft: rgba(245, 158, 11, 0.08);
    --danger-soft: rgba(239, 68, 68, 0.08);
    --info-soft: rgba(6, 182, 212, 0.08);

    --gradient-card: linear-gradient(135deg, rgba(99, 102, 241, 0.04), rgba(139, 92, 246, 0.02));
    --gradient-hero: linear-gradient(160deg, #f8fafc 0%, #eef2ff 40%, #f0f0ff 100%);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 40px rgba(79, 70, 229, 0.1);

    --theme-toggle-icon: '☀️';
}

/* ─── Reset & Base ──────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background: var(--gradient-hero);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background var(--transition-slow), color var(--transition-base);
}

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

a:hover {
    color: var(--accent);
}

/* ─── App Wrapper ───────────────────────────────────────── */
.app-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ─── Navbar ────────────────────────────────────────────── */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-base), border-color var(--transition-base);
}

[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.88);
}

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

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary) !important;
    letter-spacing: -0.02em;
}

.logo-icon {
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--gradient-accent);
    border-radius: var(--radius-sm);
    filter: saturate(1.2);
}

.logo-accent {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary) !important;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover,
.nav-link.active {
    background: var(--accent-soft);
    color: var(--accent-hover) !important;
}

.nav-link-icon {
    font-size: 0.9rem;
    line-height: 1;
}

.nav-link-logout {
    opacity: 0.7;
}

.nav-link-logout:hover {
    opacity: 1;
}

.nav-user {
    display: flex;
    align-items: center;
}

.nav-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--gradient-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0;
}

/* Theme Toggle */
.theme-toggle {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--bg-glass);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all var(--transition-fast);
    padding: 0;
    line-height: 1;
}

.theme-toggle:hover {
    background: var(--accent-soft);
    border-color: var(--border-accent);
    transform: rotate(15deg);
}

/* ─── Main Content ──────────────────────────────────────── */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 32px 24px 60px;
}

/* ─── Page Headers ──────────────────────────────────────── */
.page-header {
    margin-bottom: 28px;
}

.page-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

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

.page-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* ─── Cards ─────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all var(--transition-base);
}

[data-theme="light"] .card {
    box-shadow: var(--shadow-sm);
}

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

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

.card-title {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title .icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--accent-soft);
    border-radius: var(--radius-sm);
}

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

/* ─── Dashboard Stats Grid ──────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

[data-theme="light"] .stat-card {
    background: var(--bg-secondary);
    box-shadow: var(--shadow-sm);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-accent);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.stat-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    font-size: 1.5rem;
    margin-bottom: 12px;
    display: block;
}

.stat-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat-card.success .stat-value {
    background: var(--gradient-success);
    -webkit-background-clip: text;
    background-clip: text;
}

.stat-card.warning .stat-value {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
    -webkit-background-clip: text;
    background-clip: text;
}

.stat-card.info .stat-value {
    background: linear-gradient(135deg, #06b6d4, #22d3ee);
    -webkit-background-clip: text;
    background-clip: text;
}

.stat-footer {
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ─── Forms ─────────────────────────────────────────────── */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.9375rem;
    outline: none;
    transition: all var(--transition-fast);
}

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

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--bg-input-focus);
}

.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.input-group {
    display: flex;
    gap: 12px;
}

.input-group .form-input {
    flex: 1;
}

.input-group .btn {
    white-space: nowrap;
    padding: 14px 24px;
    height: auto;
}

.form-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Search */
.search-input {
    padding: 10px 16px 10px 38px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 0.8125rem;
    outline: none;
    width: 220px;
    transition: all var(--transition-fast);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
    background-size: 16px;
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    width: 280px;
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary {
    background: var(--gradient-accent);
    color: white;
    box-shadow: 0 2px 12px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px var(--accent-glow);
    filter: brightness(1.1);
    color: white;
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-input-focus);
    border-color: var(--border-color-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-success {
    background: var(--success-soft);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.8125rem;
    border-radius: var(--radius-sm);
}

.btn-xs {
    padding: 5px 10px;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
}

.btn-group {
    display: inline-flex;
    gap: 4px;
}

/* ─── Result Box ────────────────────────────────────────── */
.result-box {
    background: var(--success-soft);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    margin-top: 20px;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.result-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--success);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}

.result-url-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.result-url {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
}

.btn-copy {
    padding: 10px 18px;
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-copy:hover {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.btn-copy.copied {
    background: #059669;
}

/* ─── Alerts ────────────────────────────────────────────── */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    animation: slideUp 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-error {
    background: var(--danger-soft);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

[data-theme="light"] .alert-error {
    color: #dc2626;
}

.alert-success {
    background: var(--success-soft);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #6ee7b7;
}

[data-theme="light"] .alert-success {
    color: #059669;
}

.alert-info {
    background: var(--info-soft);
    border: 1px solid rgba(6, 182, 212, 0.25);
    color: #67e8f9;
}

[data-theme="light"] .alert-info {
    color: #0891b2;
}

/* ─── Tables ────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table thead {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="light"] .table thead {
    background: rgba(0, 0, 0, 0.02);
}

.table th {
    padding: 14px 18px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: middle;
}

.table tbody tr {
    transition: background var(--transition-fast);
}

.table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="light"] .table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

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

.table .slug-cell {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent-hover);
    font-size: 0.875rem;
}

.table .url-cell {
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.table .clicks-cell {
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.table .date-cell {
    white-space: nowrap;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.table .actions-cell {
    white-space: nowrap;
}

/* ─── Status Badge ──────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    letter-spacing: 0.02em;
}

.badge-accent {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.badge-success {
    background: var(--success-soft);
    color: var(--success);
}

.badge-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
}

.status-dot.active {
    background: var(--success);
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.5);
}

.status-dot.inactive {
    background: var(--danger);
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.3);
}

/* ─── QR Code Modal ─────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-lg);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.modal-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    word-break: break-all;
    font-family: var(--font-mono);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-glass);
    border-radius: var(--radius-full);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-container {
    background: white;
    border-radius: var(--radius-md);
    padding: 24px;
    display: inline-block;
    margin-bottom: 20px;
}

.qr-container canvas,
.qr-container img {
    display: block;
    max-width: 200px;
    height: auto;
}

/* ─── Confirm Dialog ────────────────────────────────────── */
.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 24px;
}

/* ─── Empty State ───────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state .empty-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state .empty-text {
    font-size: 0.875rem;
}

/* ─── Stats Detail ──────────────────────────────────────── */
.stats-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--text-muted) !important;
    transition: color var(--transition-fast);
}

.back-link:hover {
    color: var(--accent-hover) !important;
}

.stats-meta {
    margin-bottom: 28px;
}

.stats-meta .meta-url {
    font-size: 0.875rem;
    color: var(--text-muted);
    word-break: break-all;
    margin-top: 4px;
}

.stats-meta .meta-url a {
    color: var(--text-muted);
    transition: color var(--transition-fast);
}

.stats-meta .meta-url a:hover {
    color: var(--accent-hover);
}

.section-gap {
    margin-top: 28px;
}

/* Bar Chart */
.bar-track {
    background: var(--accent-soft);
    border-radius: 4px;
    overflow: hidden;
    height: 8px;
}

.bar-fill {
    height: 100%;
    background: var(--gradient-accent);
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── 404 Page ──────────────────────────────────────────── */
.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.error-code {
    font-size: 6rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
    margin-bottom: 12px;
}

.error-message {
    font-size: 1.125rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* ─── Footer ────────────────────────────────────────────── */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 24px 0;
    margin-top: auto;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 12px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
}

.footer-brand strong {
    background: var(--gradient-accent);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-logo {
    font-size: 1rem;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.footer-links a {
    color: var(--text-muted);
    transition: color var(--transition-fast);
    text-decoration: none;
}

.footer-links a:hover {
    color: var(--accent-hover);
}

.footer-sep {
    opacity: 0.3;
}

.footer-version {
    padding: 2px 8px;
    background: var(--accent-soft);
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--accent-hover);
}

.footer-copy {
    opacity: 0.5;
}

@media (max-width: 640px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

/* ─── Top Links List ────────────────────────────────────── */
.top-links-list {
    display: flex;
    flex-direction: column;
}

.top-link-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 4px;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

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

.top-link-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="light"] .top-link-item:hover {
    background: rgba(0, 0, 0, 0.015);
}

.top-link-rank {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--accent-hover);
    flex-shrink: 0;
}

.top-link-info {
    flex: 1;
    min-width: 0;
}

.top-link-slug {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent-hover);
    font-size: 0.9rem;
}

.top-link-url {
    font-size: 0.8rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.top-link-clicks {
    text-align: right;
    flex-shrink: 0;
}

.top-link-count {
    display: block;
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.top-link-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ─── Stats Details (Collapsible) ───────────────────────── */
.stats-details {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
}

.stats-summary {
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 0;
    user-select: none;
    transition: color var(--transition-fast);
}

.stats-summary:hover {
    color: var(--accent-hover);
}

/* ─── Animations ────────────────────────────────────────── */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(8px);
    }
}

.animate-in {
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.animate-in-delay-1 {
    animation-delay: 0.08s;
}

.animate-in-delay-2 {
    animation-delay: 0.16s;
}

.animate-in-delay-3 {
    animation-delay: 0.24s;
}

.animate-in-delay-4 {
    animation-delay: 0.32s;
}

/* ─── Copy Toast ────────────────────────────────────────── */
.copy-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--success);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    animation: slideUp 0.3s ease, fadeOut 0.3s ease 1.5s forwards;
}

/* ─── Pagination ────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.pagination a:hover {
    background: var(--accent-soft);
    border-color: var(--border-accent);
    color: var(--accent-hover);
}

.pagination .active {
    background: var(--gradient-accent);
    border-color: transparent;
    color: white;
}

/* ─── No Results (search) ───────────────────────────────── */
.no-results {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-size: 0.875rem;
    display: none;
}

/* ─── Styled Checkbox ───────────────────────────────────── */
.checkbox-field {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    cursor: pointer;
}

.checkbox-toggle {
    appearance: none;
    -webkit-appearance: none;
    width: 44px;
    height: 24px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    cursor: pointer;
    position: relative;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.checkbox-toggle::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-muted);
    top: 2px;
    left: 2px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.checkbox-toggle:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.checkbox-toggle:checked::after {
    transform: translateX(20px);
    background: white;
}

.checkbox-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.checkbox-hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.85em;
    margin-left: 4px;
}

/* ─── Keyboard Shortcut Badge ──────────────────────────── */
.kbd-hint {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    font-size: 0.7rem;
    color: var(--text-muted);
    opacity: 0.6;
}

.kbd {
    display: inline-block;
    padding: 2px 6px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 600;
    line-height: 1.4;
}

/* ─── Mobile Nav Text Hiding ───────────────────────────── */
@media (max-width: 480px) {
    .nav-link-text {
        display: none;
    }

    .nav-link {
        padding: 8px 10px;
    }
}

/* ─── Slug Input with Prefix ────────────────────────────── */
.slug-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-fast);
    width: 100%;
}

.slug-prefix {
    padding: 14px 0 14px 18px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9375rem;
    white-space: nowrap;
    background: transparent;
    user-select: none;
    font-family: var(--font-family);
    line-height: normal;
}

[data-theme="light"] .slug-prefix {
    color: rgba(0, 0, 0, 0.4);
}

.slug-field {
    border: none !important;
    background: transparent !important;
    padding: 14px 18px 14px 4px !important;
    box-shadow: none !important;
    width: 100%;
    flex: 1;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.slug-input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: var(--bg-input-focus);
}

/* ─── Responsive ────────────────────────────────────────── */
@media (max-width: 768px) {
    .main-content {
        padding: 20px 16px 40px;
    }

    .page-title {
        font-size: 1.375rem;
    }

    .page-header-row {
        flex-direction: column;
    }

    .form-row {
        flex-direction: column;
    }

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

    .stat-value {
        font-size: 1.5rem;
    }

    .card {
        padding: 20px;
    }

    .table th,
    .table td {
        padding: 10px 12px;
    }

    .result-url-row {
        flex-direction: column;
        align-items: stretch;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-input {
        width: 100%;
    }

    .search-input:focus {
        width: 100%;
    }

    .top-link-item {
        gap: 10px;
    }

    .top-link-url {
        max-width: 150px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .nav-inner {
        padding: 0 16px;
    }

    .btn-group {
        flex-wrap: wrap;
    }
}

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

::selection {
    background: var(--accent);
    color: white;
}