/* ================================================================
   IFA Central — Design System & Component Styles
   ================================================================
   Aesthetic: Premium fintech, refined editorial.
   Fonts: Fraunces (serif display) + Manrope (sans UI).
   Palette: Deep emerald + mint accent + soft sage gradients
            with warm cream warmth notes.
   ================================================================ */

/* ================================================================
   *** BUILD MARKER: GLOBAL-MOBILE-FIX-V1 — 2026-05-14 ***
   If you can see this when opening this file's URL, the global
   mobile overflow fix IS deployed. Adds min-width:0 to .main in
   the 960px media query — fixes Tasks/Policies/Tele-calling and
   any future page from overflowing the viewport on mobile.
   ================================================================ */


@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700&family=Manrope:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Brand palette */
    --emerald-900: #022c22;
    --emerald-800: #064e3b;
    --emerald-700: #047857;
    --emerald-600: #059669;
    --emerald-500: #10b981;
    --emerald-400: #34d399;
    --emerald-300: #6ee7b7;
    --emerald-200: #a7f3d0;
    --emerald-100: #d1fae5;
    --emerald-50:  #ecfdf5;

    --sage-300: #b8d8c8;
    --sage-200: #d4e7dd;
    --sage-100: #e8f1ec;

    --cream-100: #fefce8;
    --cream-200: #fef9c3;
    --cream-300: #fef08a;

    --ink-900: #052e16;
    --ink-800: #14532d;
    --ink-700: #1f2937;
    --ink-600: #374151;
    --ink-500: #6b7280;
    --ink-400: #9ca3af;
    --ink-300: #d1d5db;
    --ink-200: #e5e7eb;
    --ink-100: #f3f4f6;
    --ink-50:  #f9fafb;

    --danger:  #dc2626;
    --warning: #d97706;
    --success: var(--emerald-600);

    /* Typography */
    --font-display: 'Fraunces', 'Cambria', Georgia, serif;
    --font-sans:    'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    /* Surfaces & shadows */
    --surface:        rgba(255, 255, 255, 0.72);
    --surface-solid:  #ffffff;
    --border-subtle:  rgba(6, 78, 59, 0.08);
    --border-soft:    rgba(6, 78, 59, 0.14);

    --shadow-sm:  0 1px 2px rgba(6, 78, 59, 0.05);
    --shadow-md:  0 4px 16px rgba(6, 78, 59, 0.08), 0 1px 2px rgba(6, 78, 59, 0.04);
    --shadow-lg:  0 24px 48px -12px rgba(6, 78, 59, 0.18), 0 8px 16px -4px rgba(6, 78, 59, 0.08);
    --shadow-xl:  0 40px 80px -20px rgba(2, 44, 34, 0.25), 0 12px 24px -6px rgba(6, 78, 59, 0.10);

    /* Layout */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 26px;
    --radius-pill: 999px;

    /* Motion */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

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

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

body {
    font-family: var(--font-sans);
    font-weight: 400;
    color: var(--ink-900);
    background: var(--cream-100);
    min-height: 100vh;
    line-height: 1.55;
    overflow-x: hidden;
}

/* ================================================================
   ANIMATED GRADIENT MESH BACKGROUND (auth pages)
   Layered radial gradients drifting slowly = "running graphics".
   ================================================================ */

.aurora {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    background:
        radial-gradient(ellipse 80% 60% at 20% 30%, var(--emerald-100) 0%, transparent 60%),
        radial-gradient(ellipse 70% 50% at 80% 70%, var(--sage-200) 0%, transparent 60%),
        linear-gradient(135deg, #ffffff 0%, var(--cream-100) 50%, var(--emerald-50) 100%);
}

.aurora::before,
.aurora::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.55;
    will-change: transform;
}

.aurora::before {
    width: 70vmax;
    height: 70vmax;
    top: -20vmax;
    left: -15vmax;
    background: radial-gradient(circle at 30% 30%, var(--emerald-300), var(--emerald-500) 50%, transparent 75%);
    animation: drift-a 28s var(--ease-in-out) infinite alternate;
}

.aurora::after {
    width: 60vmax;
    height: 60vmax;
    bottom: -15vmax;
    right: -10vmax;
    background: radial-gradient(circle at 70% 70%, var(--cream-300), var(--emerald-200) 55%, transparent 75%);
    animation: drift-b 34s var(--ease-in-out) infinite alternate;
}

.aurora-blob {
    position: absolute;
    width: 45vmax;
    height: 45vmax;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, var(--emerald-200), var(--sage-200) 60%, transparent 80%);
    filter: blur(70px);
    opacity: 0.5;
    animation: drift-c 22s var(--ease-in-out) infinite alternate;
}

@keyframes drift-a {
    0%   { transform: translate(0, 0) rotate(0deg) scale(1); }
    100% { transform: translate(8vmax, 5vmax) rotate(40deg) scale(1.1); }
}
@keyframes drift-b {
    0%   { transform: translate(0, 0) rotate(0deg) scale(1); }
    100% { transform: translate(-6vmax, -8vmax) rotate(-30deg) scale(0.95); }
}
@keyframes drift-c {
    0%   { transform: translate(-50%, -50%) scale(1); }
    100% { transform: translate(-40%, -60%) scale(1.15); }
}

/* Subtle grain overlay for texture */
.aurora-grain {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.4;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.02  0 0 0 0 0.18  0 0 0 0 0.10  0 0 0 0.05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

@media (prefers-reduced-motion: reduce) {
    .aurora::before,
    .aurora::after,
    .aurora-blob {
        animation: none;
    }
}

/* ================================================================
   AUTH LAYOUT (login & signup)
   ================================================================ */

.auth-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 20px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: var(--surface);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 44px 40px;
    animation: card-in 0.7s var(--ease-out) both;
}

.auth-card.wide { max-width: 520px; }

@keyframes card-in {
    0%   { opacity: 0; transform: translateY(16px); }
    100% { opacity: 1; transform: translateY(0); }
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 32px;
}

.brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--emerald-700), var(--emerald-500) 70%, var(--cream-300));
    display: grid;
    place-items: center;
    color: white;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 19px;
    letter-spacing: -0.02em;
    box-shadow: 0 4px 14px rgba(6, 78, 59, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.brand-name {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 22px;
    letter-spacing: -0.02em;
    color: var(--emerald-900);
    font-variation-settings: "opsz" 36;
}

.brand-name em {
    font-style: italic;
    font-weight: 400;
    color: var(--emerald-700);
}

.auth-headline {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 32px;
    line-height: 1.15;
    letter-spacing: -0.025em;
    color: var(--emerald-900);
    margin-bottom: 8px;
    font-variation-settings: "opsz" 60;
}

.auth-headline em {
    font-style: italic;
    font-weight: 400;
    color: var(--emerald-700);
}

.auth-sub {
    color: var(--ink-500);
    font-size: 15px;
    margin-bottom: 28px;
}

/* ================================================================
   GOOGLE BUTTON (placeholder until OAuth wired up)
   ================================================================ */

.google-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 18px;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-md);
    background: white;
    color: var(--ink-700);
    font-family: inherit;
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.google-btn:hover {
    border-color: var(--ink-300);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.google-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.google-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 20px 0;
    color: var(--ink-400);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 600;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border-soft);
}

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

.field {
    margin-bottom: 16px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-700);
    margin-bottom: 6px;
    letter-spacing: -0.005em;
}

.field label .opt {
    font-weight: 400;
    color: var(--ink-400);
    font-size: 12px;
    margin-left: 4px;
}

.field input,
.field select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--ink-200);
    border-radius: var(--radius-md);
    background: white;
    font-family: inherit;
    font-size: 14.5px;
    color: var(--ink-900);
    transition: all 0.15s var(--ease-out);
}

.field input:hover,
.field select:hover {
    border-color: var(--ink-300);
}

.field input:focus,
.field select:focus {
    outline: none;
    border-color: var(--emerald-600);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.15);
}

.field-hint {
    font-size: 12px;
    color: var(--ink-400);
    margin-top: 5px;
}

.field-error {
    font-size: 12.5px;
    color: var(--danger);
    margin-top: 5px;
    font-weight: 500;
}

/* Password visibility toggle */
.pwd-wrap { position: relative; }
.pwd-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 0;
    cursor: pointer;
    color: var(--ink-400);
    padding: 6px;
    border-radius: 6px;
    display: grid;
    place-items: center;
}
.pwd-toggle:hover { color: var(--ink-700); background: var(--ink-100); }

/* Checkbox row */
.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 8px 0 20px;
    font-size: 13.5px;
    color: var(--ink-600);
}

.checkbox-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--emerald-600);
    cursor: pointer;
}

.checkbox-row a { color: var(--emerald-700); text-decoration: none; font-weight: 600; }
.checkbox-row a:hover { text-decoration: underline; }

/* Primary submit button */
.btn-primary {
    width: 100%;
    padding: 14px 18px;
    border: 0;
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, var(--emerald-600), var(--emerald-700));
    color: white;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.005em;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 6px 16px -4px rgba(6, 78, 59, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 1px 0 rgba(255,255,255,0.2) inset, 0 12px 24px -6px rgba(6, 78, 59, 0.5);
}

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

.btn-primary:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Footer link */
.auth-foot {
    text-align: center;
    margin-top: 22px;
    font-size: 14px;
    color: var(--ink-500);
}

.auth-foot a {
    color: var(--emerald-700);
    text-decoration: none;
    font-weight: 600;
}

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

/* Forgot password link */
.field-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.field-meta a {
    font-size: 12.5px;
    color: var(--emerald-700);
    text-decoration: none;
    font-weight: 600;
}
.field-meta a:hover { text-decoration: underline; }

/* ================================================================
   ALERTS
   ================================================================ */

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

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-success {
    background: var(--emerald-50);
    border: 1px solid var(--emerald-200);
    color: var(--emerald-800);
}

.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

/* ================================================================
   DASHBOARD LAYOUT (post-login)
   ================================================================ */

.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 240px 1fr;
    background: var(--ink-50);
}

.sidebar {
    background: white;
    border-right: 1px solid var(--border-subtle);
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.sidebar .brand { margin-bottom: 28px; padding-left: 6px; }

.nav-section {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink-400);
    margin: 16px 12px 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: var(--radius-md);
    color: var(--ink-600);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s var(--ease-out);
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--emerald-50);
    color: var(--emerald-800);
}

.nav-item.active {
    background: linear-gradient(90deg, var(--emerald-50), transparent);
    color: var(--emerald-800);
    font-weight: 600;
}

.nav-item.disabled {
    color: var(--ink-400);
    cursor: not-allowed;
    pointer-events: none;
}

.nav-item.disabled .badge {
    background: var(--ink-100);
    color: var(--ink-500);
    font-size: 10px;
    padding: 2px 7px;
    border-radius: var(--radius-pill);
    font-weight: 600;
    margin-left: auto;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-foot {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    transition: background 0.15s;
}
.user-pill:hover { background: var(--ink-100); }

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--emerald-500), var(--emerald-700));
    color: white;
    display: grid;
    place-items: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.user-pill .user-name { font-size: 13.5px; font-weight: 600; color: var(--ink-700); line-height: 1.2; }
.user-pill .user-firm { font-size: 12px; color: var(--ink-400); line-height: 1.2; }

/* Main content */
.main {
    padding: 28px 36px 60px;
    max-width: 1280px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 26px;
}

.greeting {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 28px;
    letter-spacing: -0.02em;
    color: var(--emerald-900);
    font-variation-settings: "opsz" 48;
}
.greeting em { font-style: italic; font-weight: 400; color: var(--emerald-700); }

.subgreeting { color: var(--ink-500); font-size: 14.5px; margin-top: 2px; }

.topbar-actions { display: flex; gap: 10px; align-items: center; }

.btn-ghost {
    padding: 9px 14px;
    border: 1px solid var(--border-soft);
    background: white;
    border-radius: var(--radius-md);
    color: var(--ink-700);
    font-family: inherit;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}
.btn-ghost:hover { background: var(--ink-50); border-color: var(--ink-300); }

/* Stat cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    transition: all 0.2s var(--ease-out);
}

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

.stat-label {
    font-size: 12.5px;
    color: var(--ink-500);
    font-weight: 500;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.stat-label svg { width: 14px; height: 14px; color: var(--emerald-600); }

.stat-value {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 500;
    color: var(--emerald-900);
    letter-spacing: -0.025em;
    line-height: 1;
    font-variation-settings: "opsz" 48;
}

.stat-meta { font-size: 12px; color: var(--ink-400); margin-top: 6px; }

/* Welcome / coming soon panel */
.panel {
    background: white;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 26px 28px;
    margin-bottom: 18px;
}

.panel-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 500;
    color: var(--emerald-900);
    letter-spacing: -0.02em;
    margin-bottom: 6px;
    font-variation-settings: "opsz" 36;
}

.panel-sub { color: var(--ink-500); font-size: 14px; margin-bottom: 18px; }

.welcome-panel {
    background: linear-gradient(135deg, white 0%, var(--emerald-50) 100%);
    border: 1px solid var(--emerald-200);
    position: relative;
    overflow: hidden;
}

.welcome-panel::before {
    content: "";
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--emerald-200), transparent 70%);
    opacity: 0.6;
}

.checklist {
    list-style: none;
    margin: 14px 0 0;
}

.checklist li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border-subtle);
    font-size: 14px;
    color: var(--ink-700);
}

.checklist li:last-child { border-bottom: 0; }

.check-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--ink-300);
    flex-shrink: 0;
}

.check-dot.done {
    background: var(--emerald-600);
    border-color: var(--emerald-600);
    position: relative;
}
.check-dot.done::after {
    content: "✓";
    position: absolute;
    color: white;
    font-size: 11px;
    font-weight: 700;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.checklist .pill {
    margin-left: auto;
    font-size: 11.5px;
    color: var(--ink-500);
    background: var(--ink-100);
    padding: 3px 9px;
    border-radius: var(--radius-pill);
    font-weight: 600;
}

/* Two-column dashboard layout */
.cols-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 18px;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--ink-400);
}
.empty-state .em-icon {
    width: 48px; height: 48px;
    border-radius: 14px;
    background: var(--emerald-50);
    color: var(--emerald-600);
    display: inline-grid;
    place-items: center;
    margin-bottom: 12px;
}
.empty-state .em-icon svg { width: 24px; height: 24px; }
.empty-state h4 { font-family: var(--font-display); font-size: 16px; color: var(--ink-700); font-weight: 500; margin-bottom: 4px; }
.empty-state p { font-size: 13.5px; }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 960px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .cols-2 { grid-template-columns: 1fr; }
    .app { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s var(--ease-out);
        width: 240px;
    }
    .sidebar.open { transform: translateX(0); }
    .main { padding: 20px 18px 60px; min-width: 0; }  /* min-width:0 added: lets the .app CSS-grid track shrink to viewport on mobile so wide content (scope-tabs, tele grid, etc.) scrolls *inside* its container instead of overflowing the whole page */
    .greeting { font-size: 24px; }
}

@media (max-width: 540px) {
    .auth-card { padding: 32px 24px; }
    .auth-headline { font-size: 26px; }
    .field-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
}
/* === Fix: sidebar scrollable when content overflows === */
.sidebar {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(6, 78, 59, 0.2) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(6, 78, 59, 0.18);
    border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(6, 78, 59, 0.35); }
