/* THEOS Modern Responsive CSS Design System */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Open+Sans:wght@700&display=swap');

:root {
    --bg-main: #090d16;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.8);
    --bg-sidebar: rgba(15, 23, 42, 0.95);
    --bg-input: #1e293b;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(99, 102, 241, 0.3);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #8291a3;

    /* #6366f1 measured 4.47:1 for white text — darkened just enough to clear
       the 4.5:1 AA floor for text/icons on solid fills (buttons, active nav). */
    --primary: #585aee;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);

    /* Text/icon-safe status colors, tuned per theme against neutral surfaces
       (bg-input, card) — NOT the same job as *-fill below. */
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --danger: #f87171;
    --danger-bg: rgba(239, 68, 68, 0.15);

    /* Solid-fill backgrounds meant to carry white text (buttons, priority
       chips) — deliberately theme-invariant. The text-safe shades above are
       too light for white text to clear 4.5:1 once used as a fill instead of
       a text color, so fills get their own darker, always-dark value. */
    --success-fill: #047857;
    --warning-fill: #92400e;
    --danger-fill: #b91c1c;

    /* Text/icon color for translucent tinted chips (badges, scorecard cells,
       metric icons) — bright enough to pop against dark surfaces. Light theme
       (below) swaps these for darker shades since the same brightness reads
       as low-contrast pastel-on-pastel once the chip sits on white instead. */
    --accent-indigo: #818cf8;
    --accent-emerald: #34d399;
    --accent-amber: #fbbf24;
    --accent-rose: #f87171;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --backdrop-blur: blur(12px);
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme Variables Toggle */
[data-theme="light"] {
    --bg-main: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(255, 255, 255, 1);
    --bg-sidebar: #ffffff;
    --bg-input: #f8fafc;
    --border-color: rgba(0, 0, 0, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #5f7086;
    --shadow-glass: 0 8px 30px rgba(0, 0, 0, 0.06);

    /* Darker, more saturated than dark theme's — the vibrant shades in :root
       are tuned for dark backgrounds and read as low-contrast pastel-on-pastel
       once the same chip/icon/text sits on a white surface instead. */
    --success: #047857;
    --warning: #92400e;
    --danger: #b91c1c;
    --accent-indigo: #4f46e5;
    --accent-emerald: #047857;
    --accent-amber: #92400e;
    --accent-rose: #b91c1c;
}

[data-theme="light"] .card:hover {
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .badge-admin {
    color: var(--accent-indigo);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.5;
}

a {
    color: var(--accent-indigo);
    text-decoration: none;
    transition: var(--transition);
}
a:not(.btn):not(.btn-l10-start):not(.nav-link):not(.brand-logo):hover {
    text-decoration: underline;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    backdrop-filter: var(--backdrop-blur);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition);
}

.main-wrapper {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    backdrop-filter: var(--backdrop-blur);
    position: sticky;
    top: 0;
    z-index: 90;
}

.content-area {
    padding: 2rem;
    flex: 1;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
}

.app-footer {
    padding: 1.25rem 2rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-color);
}

/* Brand Logo */
.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    letter-spacing: -0.025em;
    color: var(--text-primary);
    text-decoration: none;
    margin-bottom: 1.25rem;
    padding: 0 0.5rem;
}
.brand-logo:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.brand-wordmark {
    font-family: 'Open Sans', sans-serif;
    font-weight: 700;
}

.team-switcher {
    padding: 0 0.5rem;
    margin-bottom: 1.5rem;
}

.brand-logo .logo-icon {
    width: 38px;
    height: 38px;
    background: #ffffff;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.25);
}

.brand-logo .logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Navigation Links */
.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--primary-light);
}

.nav-link.active {
    color: #fff;
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.nav-link svg, .nav-link i {
    font-size: 1.2rem;
}

/* Start L10 CTA Button */
.btn-l10-start {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff !important;
    font-weight: 700;
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
    margin-top: 1rem;
    transition: var(--transition);
}
.btn-l10-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

/* Glassmorphism Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    backdrop-filter: var(--backdrop-blur);
    box-shadow: var(--shadow-glass);
    transition: var(--transition);
}
.card:hover {
    border-color: rgba(255, 255, 255, 0.15);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}
.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Dashboard Grid & Metric Cards */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.metric-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
}

.metric-info h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.metric-info .value {
    font-size: 1.85rem;
    font-weight: 800;
    color: var(--text-primary);
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.metric-icon.indigo { background: rgba(99, 102, 241, 0.15); color: var(--accent-indigo); }
.metric-icon.emerald { background: rgba(16, 185, 129, 0.15); color: var(--accent-emerald); }
.metric-icon.amber { background: rgba(245, 158, 11, 0.15); color: var(--accent-amber); }
.metric-icon.rose { background: rgba(239, 68, 68, 0.15); color: var(--accent-rose); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: var(--bg-card-hover);
}

.btn-danger {
    background: var(--danger-fill);
    color: #fff;
}
.btn-danger:hover {
    background: #991b1b;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

/* User Avatars */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}
.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
}

/* User Badge Pill */
.user-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-input);
    padding: 0.25rem 0.6rem 0.25rem 0.25rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
    font-weight: 500;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: capitalize;
}

.badge-on-track, .badge-complete, .badge-success {
    background: var(--success-bg);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-off-track, .badge-danger {
    background: var(--danger-bg);
    color: var(--accent-rose);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-pending, .badge-warning {
    background: var(--warning-bg);
    color: var(--accent-amber);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-admin {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent-indigo);
    border: 1px solid rgba(99, 102, 241, 0.4);
}

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

/* Modern Scorecard Table */
.scorecard-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

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

.scorecard-table th, .scorecard-table td {
    padding: 0.85rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.scorecard-table th {
    background: var(--bg-sidebar);
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.scorecard-table th.sticky-col, .scorecard-table td.sticky-col {
    position: sticky;
    left: 0;
    background: var(--bg-sidebar);
    z-index: 10;
    text-align: left;
    min-width: 250px;
}

.scorecard-cell-input {
    width: 75px;
    padding: 0.4rem 0.5rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: var(--bg-input);
    color: var(--text-primary);
    text-align: center;
    font-weight: 700;
    font-size: 0.9rem;
    transition: var(--transition);
}

.scorecard-cell-input:focus {
    outline: none;
    background: var(--bg-input);
    border-color: var(--primary);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.scorecard-cell-input.cell-on-track {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-emerald);
    border-color: rgba(16, 185, 129, 0.4);
}

.scorecard-cell-input.cell-off-track {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-rose);
    border-color: rgba(239, 68, 68, 0.4);
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--bg-sidebar);
    border: 1px solid var(--border-glow);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 550px;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    transform: translateY(20px);
    transition: var(--transition);
}

.modal-backdrop.active .modal {
    transform: translateY(0);
}

/* Form Controls */
.form-group {
    margin-bottom: 1.25rem;
}
.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

/* Tag Input (autocomplete multi-select) */
.tag-input-wrapper {
    position: relative;
}
.tag-input-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    min-height: 2.85rem;
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-md);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    cursor: text;
    transition: var(--transition);
}
.tag-input-box:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}
.tag-input-box input {
    flex: 1;
    min-width: 100px;
    border: none;
    background: transparent;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    padding: 0.25rem;
}
.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent-indigo);
    border: 1px solid rgba(99, 102, 241, 0.35);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
}
.tag-chip button {
    display: flex;
    align-items: center;
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
}
.tag-chip button:hover {
    opacity: 1;
}
.tag-suggestions {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    z-index: 20;
}
.tag-suggestions.active {
    display: block;
}
.tag-suggestion-item {
    padding: 0.55rem 0.85rem;
    font-size: 0.88rem;
    color: var(--text-primary);
    cursor: pointer;
}
.tag-suggestion-item:hover {
    background: var(--bg-input);
}
.tag-suggestion-empty {
    padding: 0.55rem 0.85rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    background: #1e293b;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: toastIn 0.3s forwards;
}

.toast.toast-success { border-left-color: var(--success); }
.toast.toast-danger { border-left-color: var(--danger); }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Responsive Mobile Navigation */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.mobile-open {
        transform: translateX(0);
    }
    .main-wrapper {
        margin-left: 0;
    }
}

/* Built-in Help Center */
.help-toc {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.help-section {
    margin-bottom: 1.75rem;
    scroll-margin-top: 90px;
}

.help-screenshot {
    width: 100%;
    display: block;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-top: 1.25rem;
}

/* Swap in the matching light/dark screenshot based on the active theme --
   data-theme is kept live on <html> by the theme toggle, so this updates
   instantly with no page reload. */
.help-screenshot.theme-shot-light {
    display: none;
}
[data-theme="light"] .help-screenshot.theme-shot-dark {
    display: none;
}
[data-theme="light"] .help-screenshot.theme-shot-light {
    display: block;
}

.help-legend {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    margin-top: 1.25rem;
}

.help-legend li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.help-legend li strong {
    color: var(--text-primary);
}

.help-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #f59e0b;
    color: #111;
    font-weight: 800;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.help-glossary dt {
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 1rem;
}
.help-glossary dd {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.15rem;
}

/* Print-only letterhead, shown in place of the sidebar/topbar */
.print-header {
    display: none;
}

/* Print-Friendly Output */
@media print {
    .sidebar, .topbar, .app-footer, .toast-container, .modal-backdrop,
    .no-print, .step-tab, #timerPauseBtn {
        display: none !important;
    }

    .print-header {
        display: block;
        margin-bottom: 1.25rem;
        padding-bottom: 0.75rem;
        border-bottom: 2px solid #000;
    }
    .print-header h1 {
        font-size: 1.4rem;
        font-weight: 800;
        color: #000;
    }
    .print-header p {
        font-size: 0.85rem;
        color: #333;
        margin-top: 0.2rem;
    }

    body {
        background: #fff;
        color: #000;
    }

    .main-wrapper {
        margin-left: 0;
    }
    .content-area {
        padding: 0;
        max-width: 100%;
    }

    /* Force every L10 meeting step to print, regardless of which is active on screen */
    .meeting-step-content {
        display: block !important;
        page-break-inside: avoid;
        margin-bottom: 1.5rem;
    }

    .card {
        background: #fff;
        color: #000;
        border: 1px solid #ccc;
        box-shadow: none;
        backdrop-filter: none;
        break-inside: avoid;
    }

    .scorecard-container {
        border: 1px solid #ccc;
        background: #fff;
        overflow: visible;
    }
    .scorecard-table th, .scorecard-table td {
        color: #000;
        border-color: #ccc;
    }
    .scorecard-table th, .scorecard-table td.sticky-col {
        background: #f1f5f9;
        position: static;
    }
    .scorecard-cell-input {
        background: transparent !important;
        border: none;
        color: #000 !important;
        font-weight: 700;
    }

    a[href] {
        color: #000;
        text-decoration: none;
    }
}
