/**
 * ClaimTell Design System
 * Version: v1.0.0
 *
 * Trust-first, enterprise-grade fintech aesthetic.
 * Mobile-first responsive design.
 * Typography: Instrument Serif (display) + Plus Jakarta Sans (body)
 */

/* ============================================
   DESIGN TOKENS
   ============================================ */

:root {
    /* Primary palette — trust, authority, finance */
    --ct-navy: #0f172a;
    --ct-navy-95: rgba(15, 23, 42, 0.95);
    --ct-slate-900: #0f172a;
    --ct-slate-800: #1e293b;
    --ct-slate-700: #334155;
    --ct-slate-600: #475569;
    --ct-slate-500: #64748b;
    --ct-slate-400: #94a3b8;
    --ct-slate-300: #cbd5e1;
    --ct-slate-200: #e2e8f0;
    --ct-slate-100: #f1f5f9;
    --ct-slate-50: #f8fafc;
    --ct-white: #ffffff;

    /* Accent — recovery, opportunity, confidence */
    --ct-teal-700: #0f766e;
    --ct-teal-600: #0d9488;
    --ct-teal-500: #14b8a6;
    --ct-teal-100: #ccfbf1;
    --ct-teal-50: #f0fdfa;

    /* Semantic */
    --ct-success: #059669;
    --ct-success-light: #ecfdf5;
    --ct-warning: #d97706;
    --ct-warning-light: #fffbeb;
    --ct-error: #dc2626;
    --ct-error-light: #fef2f2;
    --ct-info: #2563eb;
    --ct-info-light: #eff6ff;

    /* Typography */
    --ct-font-display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
    --ct-font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ct-font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;

    /* Spacing */
    --ct-space-xs: 4px;
    --ct-space-sm: 8px;
    --ct-space-md: 16px;
    --ct-space-lg: 24px;
    --ct-space-xl: 32px;
    --ct-space-2xl: 48px;
    --ct-space-3xl: 64px;

    /* Radius */
    --ct-radius-sm: 6px;
    --ct-radius-md: 8px;
    --ct-radius-lg: 12px;
    --ct-radius-xl: 16px;

    /* Shadows */
    --ct-shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --ct-shadow-md: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
    --ct-shadow-lg: 0 4px 6px rgba(0,0,0,0.05), 0 12px 40px rgba(0,0,0,0.08);
    --ct-shadow-xl: 0 8px 16px rgba(0,0,0,0.06), 0 24px 60px rgba(0,0,0,0.1);

    /* Layout */
    --ct-sidebar-width: 260px;
    --ct-header-height: 64px;
    --ct-max-content-width: 1200px;
}


/* ============================================
   RESET & BASE
   ============================================ */

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--ct-font-body);
    color: var(--ct-navy);
    background: var(--ct-slate-50);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--ct-teal-700);
    text-decoration: none;
    transition: color 0.15s;
}
a:hover { color: var(--ct-teal-600); }

img { max-width: 100%; height: auto; }


/* ============================================
   TYPOGRAPHY
   ============================================ */

h1, h2, h3 {
    font-family: var(--ct-font-display);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

h4, h5, h6 {
    font-family: var(--ct-font-body);
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

h1 { font-size: clamp(28px, 4vw, 40px); }
h2 { font-size: clamp(24px, 3vw, 32px); }
h3 { font-size: clamp(20px, 2.5vw, 26px); }
h4 { font-size: 18px; }
h5 { font-size: 16px; }
h6 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ct-slate-500); }

.text-display { font-family: var(--ct-font-display); font-weight: 400; }
.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-muted { color: var(--ct-slate-500); }
.text-success { color: var(--ct-success); }
.text-error { color: var(--ct-error); }
.text-warning { color: var(--ct-warning); }


/* ============================================
   ADMIN LAYOUT
   ============================================ */

.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: var(--ct-sidebar-width);
    background: var(--ct-navy);
    color: var(--ct-white);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand h2 {
    font-size: 22px;
    color: var(--ct-white);
}

.sidebar-brand span {
    font-size: 11px;
    color: var(--ct-slate-400);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: block;
    margin-top: 2px;
    font-family: var(--ct-font-body);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-section {
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-section-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ct-slate-500);
    padding: 8px 12px 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--ct-radius-md);
    color: var(--ct-slate-300);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
    text-decoration: none;
}

.nav-link:hover {
    color: var(--ct-white);
    background: rgba(255,255,255,0.06);
}

.nav-link.active {
    color: var(--ct-white);
    background: rgba(255,255,255,0.1);
}

.nav-link .nav-icon {
    width: 18px;
    height: 18px;
    opacity: 0.6;
    flex-shrink: 0;
}

.nav-link.active .nav-icon { opacity: 1; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ct-teal-700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--ct-white);
    flex-shrink: 0;
}

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

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--ct-white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: var(--ct-slate-400);
}

/* Main content area */
.admin-main {
    flex: 1;
    margin-left: var(--ct-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-header {
    height: var(--ct-header-height);
    background: var(--ct-white);
    border-bottom: 1px solid var(--ct-slate-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.admin-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.admin-header h1 {
    font-family: var(--ct-font-body);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--ct-slate-600);
}

.admin-content {
    flex: 1;
    padding: 32px;
    max-width: var(--ct-max-content-width);
    width: 100%;
}


/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--ct-white);
    border-radius: var(--ct-radius-lg);
    border: 1px solid var(--ct-slate-200);
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--ct-slate-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-family: var(--ct-font-body);
    font-size: 16px;
    font-weight: 600;
}

.card-body { padding: 24px; }
.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--ct-slate-100);
    background: var(--ct-slate-50);
}


/* ============================================
   STAT CARDS
   ============================================ */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--ct-white);
    border: 1px solid var(--ct-slate-200);
    border-radius: var(--ct-radius-lg);
    padding: 20px;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ct-slate-500);
    margin-bottom: 6px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ct-navy);
}

.stat-note {
    font-size: 12px;
    color: var(--ct-slate-400);
    margin-top: 4px;
}


/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--ct-radius-md);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--ct-font-body);
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
}

.btn:focus-visible {
    outline: 2px solid var(--ct-teal-600);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--ct-teal-700);
    color: var(--ct-white);
    border-color: var(--ct-teal-700);
}
.btn-primary:hover {
    background: var(--ct-teal-600);
    border-color: var(--ct-teal-600);
    color: var(--ct-white);
}

.btn-secondary {
    background: var(--ct-white);
    color: var(--ct-slate-700);
    border-color: var(--ct-slate-200);
}
.btn-secondary:hover {
    background: var(--ct-slate-50);
    border-color: var(--ct-slate-300);
    color: var(--ct-navy);
}

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

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-block { width: 100%; }

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--ct-slate-600);
}
.btn-ghost:hover { background: var(--ct-slate-100); color: var(--ct-navy); }


/* ============================================
   FORMS
   ============================================ */

.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ct-slate-700);
    margin-bottom: 6px;
}

.form-label .required { color: var(--ct-error); }

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--ct-slate-200);
    border-radius: var(--ct-radius-md);
    font-size: 14px;
    font-family: var(--ct-font-body);
    color: var(--ct-navy);
    background: var(--ct-white);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--ct-teal-600);
    box-shadow: 0 0 0 3px var(--ct-teal-50);
}

.form-input::placeholder { color: var(--ct-slate-400); }
.form-textarea { min-height: 100px; resize: vertical; }

.form-help {
    font-size: 12px;
    color: var(--ct-slate-400);
    margin-top: 4px;
    line-height: 1.5;
}

.form-error {
    font-size: 12px;
    color: var(--ct-error);
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 8px;
}

/* Toggle switch */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle input { display: none; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--ct-slate-300);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 2px;
    width: 20px;
    height: 20px;
    background: var(--ct-white);
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: var(--ct-shadow-sm);
}

.toggle input:checked + .toggle-slider { background: var(--ct-teal-600); }
.toggle input:checked + .toggle-slider::after { transform: translateX(20px); }


/* ============================================
   ALERTS / FLASH MESSAGES
   ============================================ */

.alert {
    padding: 14px 18px;
    border-radius: var(--ct-radius-md);
    font-size: 14px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.5;
}

.alert-success { background: var(--ct-success-light); color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: var(--ct-error-light); color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background: var(--ct-warning-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: var(--ct-info-light); color: #1e40af; border: 1px solid #bfdbfe; }


/* ============================================
   TABLES
   ============================================ */

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

.data-table th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ct-slate-500);
    padding: 10px 16px;
    border-bottom: 1px solid var(--ct-slate-200);
    text-align: left;
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--ct-slate-100);
    font-size: 14px;
    color: var(--ct-slate-700);
}

.data-table tr:hover td { background: var(--ct-slate-50); }
.data-table tr:last-child td { border-bottom: none; }


/* ============================================
   BADGES / STATUS
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
}

.badge-success { background: var(--ct-success-light); color: var(--ct-success); }
.badge-error   { background: var(--ct-error-light); color: var(--ct-error); }
.badge-warning { background: var(--ct-warning-light); color: var(--ct-warning); }
.badge-info    { background: var(--ct-info-light); color: var(--ct-info); }
.badge-neutral { background: var(--ct-slate-100); color: var(--ct-slate-600); }

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}
.status-dot-ok      { background: var(--ct-success); }
.status-dot-error   { background: var(--ct-error); }
.status-dot-warning { background: var(--ct-warning); }


/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: 48px 24px;
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: var(--ct-slate-300);
}

.empty-state h3 {
    font-family: var(--ct-font-body);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.empty-state p {
    font-size: 14px;
    color: var(--ct-slate-400);
}


/* ============================================
   SETTINGS CATEGORY CARDS
   ============================================ */

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.settings-card {
    background: var(--ct-white);
    border: 1px solid var(--ct-slate-200);
    border-radius: var(--ct-radius-lg);
    padding: 24px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    display: block;
}

.settings-card:hover {
    border-color: var(--ct-teal-600);
    box-shadow: var(--ct-shadow-md);
    color: inherit;
}

.settings-card h4 {
    font-size: 15px;
    margin-bottom: 4px;
}

.settings-card p {
    font-size: 13px;
    color: var(--ct-slate-500);
    line-height: 1.5;
}

.settings-card .settings-count {
    font-size: 12px;
    color: var(--ct-slate-400);
    margin-top: 12px;
}


/* ============================================
   PUBLIC / AUTH PAGES
   ============================================ */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--ct-slate-50);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--ct-white);
    border-radius: var(--ct-radius-xl);
    box-shadow: var(--ct-shadow-xl);
    overflow: hidden;
}

.auth-header {
    background: var(--ct-navy);
    padding: 32px;
    text-align: center;
}

.auth-header h1 {
    color: var(--ct-white);
    font-size: 26px;
    margin-bottom: 4px;
}

.auth-header p {
    color: var(--ct-slate-400);
    font-size: 14px;
}

.auth-body { padding: 32px; }
.auth-footer {
    text-align: center;
    padding: 0 32px 32px;
    font-size: 13px;
    color: var(--ct-slate-400);
}


/* ============================================
   COMING SOON / PUBLIC SHELL
   ============================================ */

.public-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--ct-navy);
    color: var(--ct-white);
    text-align: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
}

.public-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 20%, rgba(13,148,136,0.12) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 80%, rgba(13,148,136,0.08) 0%, transparent 50%);
    pointer-events: none;
}

.public-page > * { position: relative; z-index: 1; }

.public-page h1 {
    font-size: clamp(36px, 6vw, 56px);
    margin-bottom: 16px;
    color: var(--ct-white);
}

.public-page .tagline {
    font-size: clamp(16px, 2.5vw, 20px);
    color: var(--ct-slate-400);
    max-width: 500px;
    line-height: 1.6;
}

.public-page .brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 100px;
    font-size: 12px;
    color: var(--ct-slate-400);
    margin-bottom: 40px;
    font-weight: 500;
    letter-spacing: 0.03em;
}


/* ============================================
   ERROR PAGES
   ============================================ */

.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
}

.error-code {
    font-size: 72px;
    font-weight: 700;
    color: var(--ct-slate-200);
    line-height: 1;
    margin-bottom: 16px;
}


/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
        width: 280px;
    }

    .admin-sidebar.open { transform: translateX(0); }

    .admin-main { margin-left: 0; }

    .admin-header { padding: 0 16px; }
    .admin-content { padding: 16px; }

    .mobile-toggle { display: flex; }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
        display: none;
    }

    .sidebar-overlay.show { display: block; }

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

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

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

    .card-header { padding: 16px 18px; }
    .card-body { padding: 18px; }

    /* Mobile table cards */
    .data-table thead { display: none; }
    .data-table tr {
        display: block;
        padding: 12px 0;
        border-bottom: 1px solid var(--ct-slate-100);
    }
    .data-table td {
        display: flex;
        justify-content: space-between;
        padding: 4px 0;
        border: none;
        font-size: 13px;
    }
    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--ct-slate-500);
        font-size: 12px;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }
    .data-table tr:hover td { background: transparent; }
}

@media (max-width: 480px) {
    .stat-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 24px; }
    .auth-header, .auth-body { padding: 24px; }
}


/* ============================================
   UTILITY CLASSES
   ============================================ */

.mt-sm { margin-top: var(--ct-space-sm); }
.mt-md { margin-top: var(--ct-space-md); }
.mt-lg { margin-top: var(--ct-space-lg); }
.mt-xl { margin-top: var(--ct-space-xl); }
.mb-sm { margin-bottom: var(--ct-space-sm); }
.mb-md { margin-bottom: var(--ct-space-md); }
.mb-lg { margin-bottom: var(--ct-space-lg); }
.mb-xl { margin-bottom: var(--ct-space-xl); }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-sm { gap: var(--ct-space-sm); }
.gap-md { gap: var(--ct-space-md); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
