:root {
    --brand-50: #eef4ff;
    --brand-100: #d9e7ff;
    --brand-200: #b7d0ff;
    --brand-300: #88b0ff;
    --brand-400: #5d8ef0;
    --brand-500: #2d6ae3;
    --brand-600: #245bd6;
    --brand-700: #1b49b0;
    --brand-800: #153e90;
    --brand-900: #102c64;

    --accent-success: #198754;
    --accent-info: #0b7285;
    --accent-warning: #9a6700;
    --accent-danger: #c13245;
    --accent-purple: #7c3aed;

    --bg-app: #f3f6fb;
    --bg-surface: #ffffff;
    --bg-soft: #f8fbff;
    --bg-muted: #eef3f9;

    --text-strong: #1f2a37;
    --text-body: #334155;
    --text-soft: #64748b;
    --text-inverse: #f8fafc;

    --border-soft: #d8e2ef;
    --border-strong: #c3d2e5;

    --nav-bg: linear-gradient(135deg, #10243e 0%, #18365b 100%);
    --card-shadow: 0 10px 35px rgba(23, 43, 77, 0.08);
    --card-shadow-strong: 0 18px 40px rgba(24, 54, 91, 0.14);

    --radius-sm: 12px;
    --radius-md: 16px;
    --radius-lg: 20px;
}

html[data-theme="dark"] {
    --bg-app: #0b1220;
    --bg-surface: #121c2d;
    --bg-soft: #182336;
    --bg-muted: #1b2940;

    --text-strong: #edf2f7;
    --text-body: #d4deeb;
    --text-soft: #97a9c0;
    --text-inverse: #ffffff;

    --border-soft: #26354f;
    --border-strong: #31445f;

    --nav-bg: linear-gradient(135deg, #0d1727 0%, #173152 100%);
    --card-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
    --card-shadow-strong: 0 20px 48px rgba(0, 0, 0, 0.36);
}

body.app-shell {
    background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg-app) 100%);
    min-height: 100vh;
    color: var(--text-strong);
    transition: background-color .25s ease, color .25s ease;
}

.app-nav {
    background: var(--nav-bg);
    box-shadow: 0 8px 24px rgba(16, 36, 62, 0.18);
}

.brand-lockup {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}
.brand-mark {
    width: 40px;
    height: 40px;
    display: block;
}
.brand-text-wrap {
    display: inline-flex;
    flex-direction: column;
    line-height: 1;
}
.brand-title {
    color: #f8fafc;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: .01em;
}
.brand-subtitle {
    color: #c9d7f2;
    font-size: .68rem;
    margin-top: 4px;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.shadow-soft {
    box-shadow: var(--card-shadow);
    border-radius: var(--radius-lg);
}

.card,
.form-control,
.form-select,
.btn {
    border-radius: var(--radius-sm);
}

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-soft);
    color: var(--text-strong);
}
.card-header,
.card-footer {
    background: transparent !important;
    border-color: var(--border-soft) !important;
}

.form-control,
.form-select {
    border-color: var(--border-soft);
    background: var(--bg-surface);
    color: var(--text-strong);
    min-height: 46px;
}

.form-control::placeholder {
    color: var(--text-soft);
}

.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 .2rem rgba(45, 106, 227, 0.14);
    border-color: var(--brand-300);
    background: var(--bg-surface);
    color: var(--text-strong);
}

.btn-primary,
.btn-brand {
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    border: 0;
    color: #fff;
    box-shadow: 0 8px 18px rgba(36, 91, 214, .22);
}
.btn-primary:hover,
.btn-brand:hover {
    background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
    color: #fff;
}

.btn-outline-primary {
    border-color: var(--brand-500);
    color: var(--brand-600);
}
.btn-outline-primary:hover {
    background: var(--brand-500);
    color: #fff;
}

.btn-outline-secondary {
    border-color: var(--border-strong);
    color: var(--text-body);
}

.btn-outline-light {
    border-color: rgba(255,255,255,.28);
}

.btn-theme-toggle {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.16);
    color: #fff;
    border-radius: 999px;
    min-width: 44px;
}
.btn-theme-toggle:hover {
    background: rgba(255,255,255,.14);
    color: #fff;
}
.theme-toggle-sun,
.theme-toggle-moon {
    font-size: 14px;
    line-height: 1;
}

.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--text-strong);
    --bs-table-striped-bg: color-mix(in srgb, var(--bg-soft) 70%, transparent);
    --bs-table-hover-bg: color-mix(in srgb, var(--bg-muted) 70%, transparent);
    --bs-table-border-color: var(--border-soft);
}
.table-light {
    --bs-table-bg: var(--bg-soft);
    --bs-table-color: var(--text-strong);
}
.table > :not(caption) > * > * {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.nav-link {
    color: rgba(248,250,252,.86) !important;
}
.nav-link:hover,
.nav-link.active {
    color: #ffffff !important;
}

.text-muted,
.small,
.form-text {
    color: var(--text-soft) !important;
}

.alert-success {
    background: color-mix(in srgb, var(--accent-success) 14%, var(--bg-surface));
    border-color: color-mix(in srgb, var(--accent-success) 30%, transparent);
    color: var(--text-strong);
}
.alert-danger {
    background: color-mix(in srgb, var(--accent-danger) 12%, var(--bg-surface));
    border-color: color-mix(in srgb, var(--accent-danger) 28%, transparent);
    color: var(--text-strong);
}

.stat-card .stat-label,
.stat-mini .stat-label {
    font-size: .9rem;
    color: var(--text-soft);
    margin-bottom: .35rem;
}
.stat-card .stat-value,
.stat-mini .stat-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}
.stat-mini {
    background: var(--bg-soft);
    border-radius: 14px;
    padding: 1rem;
    border: 1px solid var(--border-soft);
}
.table-row-overdue {
    background: color-mix(in srgb, var(--accent-danger) 8%, transparent);
}
.insight-item {
    padding-left: 1rem;
    position: relative;
}
.insight-item::before {
    content: "";
    width: .5rem;
    height: .5rem;
    border-radius: 50%;
    background: var(--brand-500);
    position: absolute;
    left: 0;
    top: .55rem;
}

.bulk-select {
    min-width: 150px;
}

.attendance-grid {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
}
.attendance-pill {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    border: 1px solid var(--border-soft);
    border-radius: 999px;
    padding: .5rem .8rem;
    background: var(--bg-soft);
}

.fc-host {
    min-height: 780px;
}

/* Calendar legibility fixes */
.fc {
    --fc-border-color: var(--border-soft);
    --fc-page-bg-color: var(--bg-surface);
    --fc-neutral-bg-color: var(--bg-soft);
    --fc-today-bg-color: #fff9e8;
    --fc-event-border-color: transparent;
    --fc-event-text-color: #ffffff;
    --fc-list-event-hover-bg-color: var(--bg-soft);
}
html[data-theme="dark"] .fc {
    --fc-today-bg-color: rgba(154,103,0,.16);
}
.fc .fc-toolbar-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-strong);
}
.fc .fc-button {
    border-radius: 10px;
    font-weight: 600;
}
.fc .fc-button-primary {
    background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
    border: none;
}
.fc .fc-button-primary:not(:disabled):hover {
    background: linear-gradient(135deg, var(--brand-600), var(--brand-800));
}
.fc .fc-daygrid-day-frame {
    min-height: 120px;
    background: var(--bg-surface);
}
.fc .fc-day-other .fc-daygrid-day-frame {
    background: var(--bg-soft);
}
.fc .fc-daygrid-day-number,
.fc .fc-col-header-cell-cushion {
    color: var(--brand-600);
    font-weight: 700;
    text-decoration: none;
}
.fc .fc-col-header-cell-cushion {
    padding: 10px 4px;
}
.fc .fc-daygrid-day-top {
    padding: 6px 8px 0 8px;
}
.fc .fc-daygrid-event,
.fc .fc-timegrid-event {
    border-radius: 8px;
    padding: 3px 6px;
    margin-top: 4px;
    min-height: 24px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .12);
}
.fc .fc-event-title,
.fc .fc-event-time {
    color: #ffffff !important;
    font-weight: 600;
}
.fc .fc-daygrid-event-dot {
    display: none;
}
.fc .fc-daygrid-event-harness {
    margin-inline: 4px;
}
.fc .fc-daygrid-more-link {
    color: var(--text-body);
    font-weight: 600;
    text-decoration: none;
    margin-left: 6px;
}
.fc .fc-timegrid-slot-label-cushion,
.fc .fc-timegrid-axis-cushion {
    color: var(--text-body);
    font-weight: 600;
}
.fc .fc-scrollgrid,
.fc .fc-theme-standard td,
.fc .fc-theme-standard th {
    border-color: var(--border-soft);
}
.fc .fc-highlight {
    background: rgba(37, 99, 235, 0.10);
}
.fc .fc-event-main {
    overflow: hidden;
}
.fc .fc-event-title-container {
    min-width: 0;
}
.fc .fc-daygrid-event .fc-event-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Calendar user colour legend */
.calendar-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
}
.calendar-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .95rem;
    color: var(--text-body);
}
.calendar-legend-swatch {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    display: inline-block;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.35), 0 0 0 1px rgba(15,23,42,.08);
}

/* Month view title restore */
.fc-month-event-wrap {
    display: block;
    width: 100%;
    overflow: hidden;
}
.fc .fc-daygrid-event .fc-month-event-title {
    color: #ffffff;
    font-weight: 700;
    font-size: 12px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Week/day event multi-line labels */
.fc-custom-event-wrap {
    display: block;
    width: 100%;
    overflow: hidden;
}
.fc .fc-timegrid-event .fc-custom-title {
    font-weight: 700;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fc .fc-timegrid-event .fc-custom-partner {
    font-size: 11px;
    line-height: 1.1;
    opacity: 0.95;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fc .fc-timegrid-event .fc-custom-user {
    font-size: 11px;
    line-height: 1.1;
    opacity: 0.92;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.fc .fc-timegrid-event .fc-event-main {
    padding: 2px 4px;
}

.report-list-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .7rem 0;
    border-bottom: 1px solid var(--border-soft);
}
.report-list-row:last-child {
    border-bottom: 0;
}
.forecast-card {
    background: linear-gradient(135deg, #10243e 0%, #21446f 100%);
    color: #fff;
}
.forecast-kicker {
    font-size: .85rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    opacity: .85;
}
.forecast-score {
    font-size: 4rem;
    font-weight: 700;
    line-height: 1;
    margin-top: .35rem;
}
.forecast-band {
    font-size: 1.25rem;
    margin-top: .35rem;
}
.report-tile {
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-radius: 16px;
    padding: 1rem;
    height: 100%;
}
.report-tile-label {
    color: var(--text-soft);
    font-size: .85rem;
    margin-bottom: .25rem;
}
.report-tile-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.1;
}
.slide-card {
    background: var(--bg-surface);
    border-radius: 20px;
    box-shadow: var(--card-shadow);
    padding: 2rem;
    border: 1px solid var(--border-soft);
}
.slide-eyebrow {
    font-size: .8rem;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: .4rem;
}
.slide-title {
    font-size: 1.7rem;
    margin-bottom: 1rem;
}
.forecast-score-block {
    background: var(--bg-soft);
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    padding: 1.25rem;
    text-align: center;
}

/* Auth branding */
.auth-shell {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 28px;
    min-height: calc(100vh - 132px);
    align-items: stretch;
}
.auth-brand-panel {
    background: linear-gradient(135deg, rgba(21,62,144,.96), rgba(45,106,227,.92));
    border-radius: var(--radius-lg);
    color: #fff;
    padding: 40px;
    box-shadow: var(--card-shadow-strong);
    position: relative;
    overflow: hidden;
}
.auth-brand-panel::after {
    content: "";
    position: absolute;
    inset: auto -40px -60px auto;
    width: 280px;
    height: 280px;
    border-radius: 999px;
    background: rgba(255,255,255,.08);
    filter: blur(8px);
}
.auth-logo {
    max-width: 280px;
    width: 100%;
    height: auto;
}
.auth-panel-title {
    margin-top: 28px;
    font-size: 2.2rem;
    line-height: 1.1;
    font-weight: 700;
}
.auth-panel-copy {
    margin-top: 16px;
    max-width: 560px;
    color: rgba(255,255,255,.84);
    font-size: 1.05rem;
}
.auth-feature-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 28px;
}
.auth-feature-pill {
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.18);
    color: #fff;
    font-size: .92rem;
    font-weight: 600;
}
.auth-form-panel {
    display: flex;
    align-items: center;
    justify-content: center;
}
.auth-card {
    width: 100%;
    max-width: 520px;
}
.auth-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
}
.auth-card-mark {
    width: 48px;
    height: 48px;
    display: block;
}

.badge-soft-primary { background: color-mix(in srgb, var(--brand-500) 16%, transparent); color: var(--brand-700); }
.badge-soft-secondary { background: color-mix(in srgb, var(--text-soft) 14%, transparent); color: var(--text-body); }
.badge-soft-success { background: color-mix(in srgb, var(--accent-success) 16%, transparent); color: #18794e; }
.badge-soft-danger { background: color-mix(in srgb, var(--accent-danger) 14%, transparent); color: var(--accent-danger); }
.badge-soft-warning { background: color-mix(in srgb, var(--accent-warning) 18%, transparent); color: var(--accent-warning); }
.badge-soft-info { background: color-mix(in srgb, var(--accent-info) 16%, transparent); color: var(--accent-info); }

code.small {
    color: var(--text-body);
    background: var(--bg-soft);
    padding: .2rem .35rem;
    border-radius: 8px;
}

@media (max-width: 991px) {
    .auth-shell {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    .auth-brand-panel {
        padding: 28px;
    }
    .brand-subtitle {
        display: none;
    }
    .fc-host {
        min-height: 620px;
    }
}


.invite-link-input {
    min-width: 260px;
    font-size: .85rem;
}


/* Focus grid */
.focus-grid-table th,
.focus-grid-table td {
    white-space: nowrap;
    text-align: center;
    font-size: .88rem;
}
.focus-grid-table .sticky-col {
    position: sticky;
    left: 0;
    z-index: 2;
}
.focus-grid-table th.sticky-col {
    z-index: 3;
}
.focus-hit {
    background: rgba(45,106,227,.10);
    font-weight: 700;
}
.focus-empty {
    color: var(--text-soft);
    background: color-mix(in srgb, var(--bg-soft) 80%, transparent);
}


.debug-panel {
    margin: 16px 0;
    padding: 16px;
    border: 1px solid #dc3545;
    background: #fff5f5;
    border-radius: 12px;
}
.debug-panel-title {
    font-weight: 700;
    margin-bottom: 8px;
    color: #842029;
}
.debug-panel-pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 12px;
    color: #212529;
}
