/* ==========================================================================
   twinsonice — Premium Design System
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design Tokens
   -------------------------------------------------------------------------- */
:root,
html.dark,
html[data-theme="dark"] {
    /* Backgrounds */
    --color-bg:             #06080f;
    --color-bg-mid:         #0b0e1a;
    --color-surface:        rgba(15, 20, 35, 0.85);
    --color-surface-solid:  #0f1423;
    --color-surface-hover:  rgba(255, 255, 255, 0.04);
    --color-surface-active: rgba(255, 255, 255, 0.08);
    --color-glass:          rgba(255, 255, 255, 0.03);
    --color-glass-hover:    rgba(255, 255, 255, 0.06);

    /* Borders */
    --color-border:         rgba(255, 255, 255, 0.08);
    --color-border-hover:   rgba(255, 255, 255, 0.16);
    --color-border-focus:   rgba(99, 102, 241, 0.6);

    /* Specific surface areas */
    --color-sidebar:        #070a14;
    --color-topbar:         rgba(6, 8, 15, 0.92);
    --color-input:          rgba(0, 0, 0, 0.35);
    --color-footer:         #070a14;

    /* Typography */
    --color-text-main:      #e2e4ef;
    --color-text-muted:     rgba(180, 186, 213, 0.6);
    --color-text-heading:   #ffffff;
    --color-text-inverse:   #06080f;

    /* Brand */
    --color-primary:           #7c7ff5;
    --color-primary-hover:     #6366f1;
    --color-primary-light:     rgba(124, 127, 245, 0.12);
    --color-primary-border:    rgba(124, 127, 245, 0.25);
    --color-primary-glow:      rgba(124, 127, 245, 0.35);

    /* Status */
    --color-success:        #34d399;
    --color-success-bg:     rgba(52, 211, 153, 0.1);
    --color-success-border: rgba(52, 211, 153, 0.25);
    --color-danger:         #f87171;
    --color-danger-bg:      rgba(248, 113, 113, 0.1);
    --color-danger-border:  rgba(248, 113, 113, 0.25);
    --color-warning:        #fbbf24;
    --color-info:           #38bdf8;

    /* Gradients */
    --gradient-brand:    linear-gradient(135deg, #7c7ff5 0%, #a78bfa 100%);
    --gradient-surface:  linear-gradient(180deg, rgba(15,20,40,0.9) 0%, rgba(8,10,22,0.95) 100%);
    --gradient-glow:     radial-gradient(ellipse at 50% 0%, rgba(124,127,245,0.15) 0%, transparent 70%);
}

html.light,
html[data-theme="light"] {
    /* Backgrounds */
    --color-bg:             #f0f2fa;
    --color-bg-mid:         #e8eaf5;
    --color-surface:        rgba(255, 255, 255, 0.92);
    --color-surface-solid:  #ffffff;
    --color-surface-hover:  rgba(0, 0, 0, 0.03);
    --color-surface-active: rgba(0, 0, 0, 0.06);
    --color-glass:          rgba(255, 255, 255, 0.7);
    --color-glass-hover:    rgba(255, 255, 255, 0.85);

    /* Borders */
    --color-border:         rgba(0, 0, 0, 0.08);
    --color-border-hover:   rgba(0, 0, 0, 0.16);
    --color-border-focus:   rgba(79, 70, 229, 0.5);

    /* Specific surface areas */
    --color-sidebar:        #ffffff;
    --color-topbar:         rgba(240, 242, 250, 0.95);
    --color-input:          #ffffff;
    --color-footer:         #e8eaf5;

    /* Typography */
    --color-text-main:      #1e2040;
    --color-text-muted:     #6b7299;
    --color-text-heading:   #0d0f26;
    --color-text-inverse:   #ffffff;

    /* Brand */
    --color-primary:           #4f46e5;
    --color-primary-hover:     #4338ca;
    --color-primary-light:     rgba(79, 70, 229, 0.08);
    --color-primary-border:    rgba(79, 70, 229, 0.2);
    --color-primary-glow:      rgba(79, 70, 229, 0.25);

    /* Status */
    --color-success:        #059669;
    --color-success-bg:     rgba(5, 150, 105, 0.08);
    --color-success-border: rgba(5, 150, 105, 0.2);
    --color-danger:         #dc2626;
    --color-danger-bg:      rgba(220, 38, 38, 0.08);
    --color-danger-border:  rgba(220, 38, 38, 0.2);
    --color-warning:        #d97706;
    --color-info:           #0284c7;

    /* Gradients */
    --gradient-brand:    linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --gradient-surface:  linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(240,242,250,0.98) 100%);
    --gradient-glow:     radial-gradient(ellipse at 50% 0%, rgba(79,70,229,0.08) 0%, transparent 70%);
}

:root {
    --sidebar-width:           260px;
    --sidebar-width-collapsed: 60px;
    --max-content-width:       1400px;
    --max-page-width:          1200px;

    --font-family-sans:    'Inter', system-ui, -apple-system, sans-serif;
    --font-family-heading: 'Outfit', sans-serif;
    --font-family-mono:    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    --radius-xs:   0.25rem;
    --radius-sm:   0.5rem;
    --radius-md:   0.75rem;
    --radius-lg:   1rem;
    --radius-xl:   1.5rem;
    --radius-full: 9999px;

    --shadow-sm:  0 1px 3px rgba(0,0,0,0.2), 0 1px 2px rgba(0,0,0,0.15);
    --shadow-md:  0 4px 16px rgba(0,0,0,0.25), 0 2px 6px rgba(0,0,0,0.15);
    --shadow-lg:  0 12px 40px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
    --shadow-glow: 0 0 30px var(--color-primary-glow);

    --transition-fast:   0.15s ease;
    --transition-normal: 0.22s ease;
    --transition-slow:   0.35s ease;
}

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

html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    background-color: var(--color-bg);
    color: var(--color-text-main);
    font-family: var(--font-family-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

/* Background radial glow for dark mode */
html.dark body::before,
html[data-theme="dark"] body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--gradient-glow);
    pointer-events: none;
    z-index: 0;
}

a {
    color: inherit;
    text-decoration: none;
}

code {
    font-family: var(--font-family-mono);
    font-size: 0.85em;
    word-break: break-all;
    overflow-wrap: anywhere;
    padding: 0.1em 0.35em;
    background: var(--color-surface-active);
    border-radius: var(--radius-xs);
}

:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   3. Bootstrap Icons
   -------------------------------------------------------------------------- */
svg.bi {
    vertical-align: middle;
    fill: currentColor;
    display: inline-block;
    flex-shrink: 0;
}

.icon-xs { width: 0.85rem; height: 0.85rem; }
.icon-sm { width: 1rem;    height: 1rem;    }
.icon-md { width: 1.25rem; height: 1.25rem; }
.icon-lg { width: 1.75rem; height: 1.75rem; }

/* --------------------------------------------------------------------------
   4. Public Layout — Main Wrapper
   -------------------------------------------------------------------------- */
.main-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* --------------------------------------------------------------------------
   5. Navigation Bar (public)
   -------------------------------------------------------------------------- */
.main-navbar {
    background: var(--color-topbar);
    border-bottom: 1px solid var(--color-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0.875rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.brand-title {
    font-family: var(--font-family-heading);
    font-size: 1.4rem;
    font-weight: 700;
    background: var(--gradient-brand);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    letter-spacing: -0.02em;
}

/* The icon in brand title needs to be colored separately */
.brand-title svg {
    -webkit-text-fill-color: initial;
    color: var(--color-primary);
}

.main-nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    flex-wrap: wrap;
}

.main-nav-links li > a:not(.btn) {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background var(--transition-fast);
    white-space: nowrap;
    display: inline-block;
}

.main-nav-links li > a:not(.btn):hover {
    color: var(--color-text-heading);
    background: var(--color-surface-hover);
}

.main-container {
    flex: 1;
    max-width: var(--max-page-width);
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    position: relative;
    z-index: 1;
}

/* --------------------------------------------------------------------------
   6. Footer
   -------------------------------------------------------------------------- */
.main-footer {
    border-top: 1px solid var(--color-border);
    padding: 1.5rem 2rem;
    text-align: center;
    font-size: 0.825rem;
    color: var(--color-text-muted);
    background: var(--color-footer);
}

.footer-disclaimer-text {
    max-width: 900px;
    margin: 0 auto 0.75rem auto;
    font-size: 0.775rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

.footer-links {
    margin-top: 0.5rem;
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
    white-space: nowrap;
}

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

/* Minimal footer (linktree domain) */
.minimal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.775rem;
    color: var(--color-text-muted);
    background: var(--color-footer);
}

.minimal-footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.footer-sep {
    opacity: 0.4;
}

.footer-compact-links {
    display: flex;
    gap: 1rem;
}

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

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

/* --------------------------------------------------------------------------
   7. Admin Panel Layout
   -------------------------------------------------------------------------- */
.admin-wrapper {
    display: flex;
    width: 100%;
    max-width: 100vw;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--color-sidebar);
    border-right: 1px solid var(--color-border);
    padding: 1.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
}

.brand-logo {
    font-family: var(--font-family-heading);
    font-size: 1.35rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.25rem 0.5rem;
    letter-spacing: -0.02em;
}

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

.brand-logo svg {
    color: var(--color-primary);
    -webkit-text-fill-color: initial;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.875rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: all var(--transition-normal);
    border: 1px solid transparent;
}

.nav-item a:hover {
    color: var(--color-text-heading);
    background: var(--color-surface-hover);
    border-color: var(--color-border);
}

.nav-item.active a {
    color: var(--color-primary);
    background: var(--color-primary-light);
    border-color: var(--color-primary-border);
    font-weight: 600;
    box-shadow: inset 3px 0 0 var(--color-primary);
}

.sidebar-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    opacity: 0.5;
    padding: 0.5rem 0.875rem 0.25rem;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.7rem;
    color: var(--color-text-muted);
    line-height: 1.5;
    padding-left: 0.5rem;
}

.sidebar-footer strong {
    display: block;
    margin-bottom: 0.2rem;
    color: var(--color-text-main);
    font-size: 0.75rem;
}

/* Main content area */
.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    max-width: calc(100vw - var(--sidebar-width));
    flex: 1;
    padding: 2rem 2.5rem 3rem;
    overflow-x: hidden;
}

/* Admin Topbar */
.admin-topbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 2.5rem;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    background: var(--color-surface-hover);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    font-size: 0.825rem;
    color: var(--color-text-main);
    white-space: nowrap;
    font-weight: 500;
}

/* --------------------------------------------------------------------------
   8. Theme Switcher (PRESERVED EXACTLY)
   -------------------------------------------------------------------------- */
.theme-switcher {
    display: inline-flex;
    align-items: center;
    background: var(--color-surface-solid);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    padding: 0.2rem;
    gap: 0.15rem;
}

.theme-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-full);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--color-text-muted);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background-color var(--transition-normal), color var(--transition-normal);
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.theme-btn:hover {
    color: var(--color-text-heading);
}

.theme-btn.active {
    background: var(--gradient-brand);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--color-primary-glow);
}

/* --------------------------------------------------------------------------
   9. Cards
   -------------------------------------------------------------------------- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    width: 100%;
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
    position: relative;
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.card-title {
    font-family: var(--font-family-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text-heading);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   10. Page Header & Title
   -------------------------------------------------------------------------- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-family: var(--font-family-heading);
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--color-text-heading);
    margin-bottom: 0.25rem;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.page-subtitle {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   11. Stats Grid (Dashboard)
   -------------------------------------------------------------------------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
    width: 100%;
}

.stat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow: hidden;
}

/* Subtle gradient shine on stat cards */
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--color-primary-border) 50%, transparent 100%);
    opacity: 0.6;
}

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

.stat-icon-wrapper {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-label {
    font-size: 0.725rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    font-family: var(--font-family-heading);
    color: var(--color-text-heading);
    line-height: 1;
    letter-spacing: -0.04em;
}

.stat-footer {
    font-size: 0.775rem;
    color: var(--color-text-muted);
    padding-top: 0.5rem;
    border-top: 1px solid var(--color-border);
}

.stat-footer a {
    color: var(--color-primary);
    font-weight: 500;
    transition: opacity var(--transition-fast);
}

.stat-footer a:hover {
    opacity: 0.75;
}

.dashboard-split {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* --------------------------------------------------------------------------
   12. Tables
   -------------------------------------------------------------------------- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
}

table th,
table td {
    white-space: nowrap !important;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text-main);
    vertical-align: middle;
}

table th {
    color: var(--color-text-muted);
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: var(--color-surface-hover);
}

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

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

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

.cell-mono {
    font-family: var(--font-family-mono);
    font-size: 0.82rem;
}

.cell-actions {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
}

/* --------------------------------------------------------------------------
   13. Buttons
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: 0.01em;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--gradient-brand);
    color: #ffffff;
    border-color: var(--color-primary-border);
    box-shadow: 0 2px 12px var(--color-primary-glow);
}

.btn-primary:hover {
    opacity: 0.9;
    box-shadow: 0 4px 20px var(--color-primary-glow);
    transform: translateY(-1px);
}

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

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

.btn-secondary:hover {
    background: var(--color-surface-active);
    border-color: var(--color-border-hover);
    color: var(--color-text-heading);
}

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

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

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.775rem;
    border-radius: var(--radius-sm);
}

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

/* --------------------------------------------------------------------------
   14. Form Controls
   -------------------------------------------------------------------------- */
.form-group {
    margin-bottom: 1.25rem;
    width: 100%;
}

.form-label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--color-text-main);
    letter-spacing: 0.01em;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--color-input);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-main);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

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

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

.form-control:hover:not(:focus) {
    border-color: var(--color-border-hover);
}

.form-hint {
    margin-top: 0.35rem;
    font-size: 0.775rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.checkbox-control {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    cursor: pointer;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   15. Alerts & Badges
   -------------------------------------------------------------------------- */
.alert-success {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-md);
    background: var(--color-success-bg);
    border: 1px solid var(--color-success-border);
    color: var(--color-success);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.alert-error {
    padding: 0.875rem 1.25rem;
    border-radius: var(--radius-md);
    background: var(--color-danger-bg);
    border: 1px solid var(--color-danger-border);
    color: var(--color-danger);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.badge-active {
    background: var(--color-success-bg);
    color: var(--color-success);
    border: 1px solid var(--color-success-border);
}

.badge-inactive {
    background: var(--color-surface-hover);
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}

.badge-platform {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border: 1px solid var(--color-primary-border);
}

/* --------------------------------------------------------------------------
   16. Legal View
   -------------------------------------------------------------------------- */
.legal-container {
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
}

.legal-header {
    margin-bottom: 2rem;
    text-align: center;
}

.legal-title {
    font-family: var(--font-family-heading);
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--color-text-heading);
    letter-spacing: -0.03em;
}

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

.legal-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 2rem;
    align-items: start;
}

.legal-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 0.6rem;
    position: sticky;
    top: 5rem;
    backdrop-filter: blur(12px);
}

.legal-nav-item {
    padding: 0.6rem 0.875rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: all var(--transition-fast);
    white-space: nowrap;
    display: block;
}

.legal-nav-item:hover {
    background: var(--color-surface-hover);
    color: var(--color-text-heading);
}

.legal-nav-item.active {
    background: var(--color-primary-light);
    color: var(--color-primary);
    border: 1px solid var(--color-primary-border);
    font-weight: 700;
}

.legal-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    min-height: 350px;
    backdrop-filter: blur(12px);
}

.legal-content-body {
    line-height: 1.8;
    color: var(--color-text-main);
    font-size: 0.9rem;
    white-space: pre-line;
}

/* --------------------------------------------------------------------------
   17. Link Preview (redirect page)
   -------------------------------------------------------------------------- */
.preview-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.preview-container {
    max-width: 460px;
    width: 100%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 3rem 2.5rem;
    text-align: center;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
}

.preview-icon-badge {
    width: 68px;
    height: 68px;
    background: var(--gradient-brand);
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem auto;
    color: #ffffff;
    box-shadow: 0 8px 24px var(--color-primary-glow);
}

.btn-redirect {
    display: block;
    width: 100%;
    padding: 1rem 1.5rem;
    background: var(--gradient-brand);
    color: #ffffff;
    font-weight: 700;
    font-size: 1rem;
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 16px var(--color-primary-glow);
    letter-spacing: 0.01em;
}

.btn-redirect:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--color-primary-glow);
}

/* --------------------------------------------------------------------------
   18. Linktree Hub — Public Home Page
   -------------------------------------------------------------------------- */
.linkdomain-wrapper {
    background: var(--color-bg);
    position: relative;
}

/* Ambient glow at the top */
.linkdomain-wrapper::before {
    content: '';
    position: fixed;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 600px;
    background: radial-gradient(ellipse, rgba(124,127,245,0.12) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.compact-container {
    padding: 1.5rem 1.25rem;
    position: relative;
    z-index: 1;
}

.linktree-container {
    max-width: 640px;
    width: 100%;
    margin: 2rem auto 3rem auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
    z-index: 1;
}

/* Header */
.linktree-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.linktree-avatar-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 1.25rem;
}

.linktree-avatar-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-primary-border);
    box-shadow: 0 0 0 4px var(--color-primary-light), 0 8px 32px rgba(0,0,0,0.3);
    transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.linktree-avatar-img:hover {
    transform: scale(1.06);
    box-shadow: 0 0 0 4px var(--color-primary-light), var(--shadow-glow), 0 12px 40px rgba(0,0,0,0.4);
}

.linktree-avatar-fallback {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--gradient-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 0 0 4px var(--color-primary-light), var(--shadow-glow);
}

.avatar-icon {
    width: 2.5rem;
    height: 2.5rem;
}

/* Online indicator */
.linktree-avatar-wrapper::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 14px;
    height: 14px;
    background: var(--color-success);
    border-radius: 50%;
    border: 2px solid var(--color-bg);
    box-shadow: 0 0 8px rgba(52,211,153,0.6);
}

.linktree-title {
    font-family: var(--font-family-heading);
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-text-heading);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.25rem;
    letter-spacing: -0.04em;
    line-height: 1.1;
}

.verified-badge {
    color: #38bdf8;
    width: 1.4rem;
    height: 1.4rem;
    flex-shrink: 0;
}

.linktree-handle {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 0.75rem;
    letter-spacing: 0.02em;
}

.linktree-subtitle {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    max-width: 440px;
    line-height: 1.6;
    margin-bottom: 1.25rem;
}

.linktree-badge-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Search */
.linktree-search-wrapper {
    position: relative;
    width: 100%;
}

.linktree-search-wrapper .search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}

.linktree-search-input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.85rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-full);
    color: var(--color-text-main);
    font-size: 0.9rem;
    backdrop-filter: blur(12px);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

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

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

/* Link list */
.linktree-list {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

/* Individual card */
.linktree-item-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.875rem;
    transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal), background var(--transition-normal);
    backdrop-filter: blur(12px);
    cursor: pointer;
}

.linktree-item-card:hover {
    transform: translateY(-3px);
    border-color: var(--color-primary-border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.2), 0 0 0 1px var(--color-primary-border);
    background: var(--color-glass-hover);
}

.linktree-item-card.featured {
    border-color: var(--color-primary-border);
    background: linear-gradient(135deg, var(--color-surface) 0%, var(--color-primary-light) 100%);
    box-shadow: 0 0 20px var(--color-primary-light), inset 0 1px 0 rgba(255,255,255,0.05);
}

.linktree-item-card.featured:hover {
    box-shadow: 0 8px 32px rgba(0,0,0,0.2), 0 0 25px var(--color-primary-glow);
}

.linktree-item-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 1;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.linktree-item-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.linktree-item-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    background: var(--color-primary-light);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--transition-normal), transform var(--transition-normal);
    border: 1px solid var(--color-primary-border);
}

.linktree-item-card:hover .linktree-item-icon {
    background: var(--color-primary);
    color: #ffffff;
    transform: scale(1.08);
}

.linktree-item-text {
    min-width: 0;
    flex: 1;
}

.linktree-item-title {
    font-family: var(--font-family-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-heading);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    letter-spacing: -0.01em;
}

.linktree-badge {
    font-size: 0.6rem;
    font-weight: 800;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    background: var(--gradient-brand);
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.linktree-item-subtitle {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.1rem;
    line-height: 1.3;
}

.linktree-item-right {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.linktree-arrow-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--color-text-muted);
    transition: transform var(--transition-fast), color var(--transition-fast);
}

.linktree-item-card:hover .linktree-arrow-icon {
    transform: translateX(4px);
    color: var(--color-primary);
}

/* Copy button */
.linktree-item-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-left: 1px solid var(--color-border);
    padding-left: 1rem;
    flex-shrink: 0;
}

.btn-copy-link {
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-copy-link:hover {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

/* Disclaimer card */
.disclaimer-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 1.25rem 1.5rem;
    backdrop-filter: blur(12px);
}

.disclaimer-header {
    font-family: var(--font-family-heading);
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--color-text-heading);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.disclaimer-body {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* Icon preview (admin table) */
.linktree-icon-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--color-primary-light);
    color: var(--color-primary);
    border: 1px solid var(--color-primary-border);
}

/* --------------------------------------------------------------------------
   19. Auth Pages
   -------------------------------------------------------------------------- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.5rem;
    position: relative;
}

.auth-wrapper::before {
    content: '';
    position: fixed;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 700px;
    height: 500px;
    background: radial-gradient(ellipse, rgba(124,127,245,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.auth-card {
    max-width: 440px;
    width: 100%;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    position: relative;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, var(--color-primary-border) 50%, transparent 100%);
}

.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 2rem;
}

.auth-icon-badge {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    background: var(--gradient-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    margin-bottom: 1rem;
    box-shadow: 0 8px 24px var(--color-primary-glow);
}

.auth-title {
    font-family: var(--font-family-heading);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-text-heading);
    margin-bottom: 0.35rem;
    letter-spacing: -0.03em;
}

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

.auth-footer-text {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.825rem;
    color: var(--color-text-muted);
}

.auth-footer-text a {
    color: var(--color-primary);
    font-weight: 600;
}

.auth-footer-text a:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   20. Hero View (non-linktree home)
   -------------------------------------------------------------------------- */
.hero-wrapper {
    text-align: center;
    max-width: 800px;
    width: 100%;
    margin: 4rem auto;
    padding: 0 1rem;
}

.hero-title {
    font-family: var(--font-family-heading);
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.25rem;
    color: var(--color-text-heading);
    letter-spacing: -0.04em;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    line-height: 1.7;
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
    gap: 1.5rem;
    text-align: left;
    width: 100%;
    margin-top: 3.5rem;
}

.feature-card-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* --------------------------------------------------------------------------
   21. Responsive Breakpoints
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-width-collapsed);
        padding: 1.25rem 0.4rem;
        align-items: center;
    }

    .brand-logo-gradient,
    .nav-item a span,
    .sidebar-footer {
        display: none;
    }

    .brand-logo {
        justify-content: center;
    }

    .nav-item a {
        padding: 0.75rem;
        justify-content: center;
        gap: 0;
    }

    .main-content {
        margin-left: var(--sidebar-width-collapsed);
        width: calc(100% - var(--sidebar-width-collapsed));
        max-width: calc(100vw - var(--sidebar-width-collapsed));
        padding: 1.5rem 1rem;
    }

    .admin-topbar {
        justify-content: space-between;
        margin-bottom: 1.5rem;
    }

    .legal-layout {
        grid-template-columns: 1fr;
    }

    .legal-nav {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .hero-title {
        font-size: 2.25rem;
    }

    .main-navbar {
        padding: 0.75rem 1.25rem;
    }

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

@media (max-width: 480px) {
    .linktree-container {
        padding: 0 0.25rem;
        gap: 1rem;
        margin-top: 1rem;
    }

    .linktree-title {
        font-size: 1.75rem;
    }

    .linktree-subtitle {
        font-size: 0.85rem;
    }

    .linktree-item-card {
        padding: 0.875rem 1rem;
    }

    .linktree-item-icon {
        width: 40px;
        height: 40px;
    }

    .linktree-item-title {
        font-size: 0.925rem;
    }

    .compact-container {
        padding: 1rem 0.75rem;
    }

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

    .hero-title {
        font-size: 1.85rem;
    }

    .auth-card {
        padding: 2rem 1.25rem;
    }
}

/* --------------------------------------------------------------------------
   22. Scrollbar Styling
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--color-border-hover);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-muted);
}

/* --------------------------------------------------------------------------
   23. Animations
   -------------------------------------------------------------------------- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(52,211,153,0.6); }
    50%       { box-shadow: 0 0 16px rgba(52,211,153,0.9); }
}

.linktree-container {
    animation: fadeInUp 0.45s ease both;
}

.linktree-item-card {
    animation: fadeIn 0.3s ease both;
}

.linktree-avatar-wrapper::after {
    animation: pulse-glow 2.5s ease infinite;
}

/* Staggered card animation */
.linktree-item-card:nth-child(1)  { animation-delay: 0.05s; }
.linktree-item-card:nth-child(2)  { animation-delay: 0.10s; }
.linktree-item-card:nth-child(3)  { animation-delay: 0.15s; }
.linktree-item-card:nth-child(4)  { animation-delay: 0.20s; }
.linktree-item-card:nth-child(5)  { animation-delay: 0.25s; }
.linktree-item-card:nth-child(6)  { animation-delay: 0.30s; }
.linktree-item-card:nth-child(7)  { animation-delay: 0.35s; }
.linktree-item-card:nth-child(8)  { animation-delay: 0.40s; }
.linktree-item-card:nth-child(n+9){ animation-delay: 0.45s; }
