

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;500;600;700&family=Lora:ital,wght@0,400;0,600;1,400&display=swap');

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
    --teal-900: #0C4A6E;
    --teal-800: #075985;
    --teal-700: #0369A1;
    --teal-600: #0284C7;
    --teal-500: #0EA5E9;
    --teal-400: #38BDF8;
    --teal-300: #7DD3FC;
    --teal-200: #BAE6FD;
    --teal-100: #E0F2FE;
    --teal-50: #F0F9FF;
    /* Aliases — same values, blue names for clarity */
    --blue-900: var(--teal-900);
    --blue-800: var(--teal-800);
    --blue-700: var(--teal-700);
    --blue-600: var(--teal-600);
    --blue-500: var(--teal-500);
    --blue-400: var(--teal-400);
    --blue-300: var(--teal-300);
    --blue-200: var(--teal-200);
    --blue-100: var(--teal-100);
    --blue-50: var(--teal-50);
    --white: #ffffff;
    --grey-25: #fafbfc;
    --grey-50: #f4f6f8;
    --grey-100: #eaecf0;
    --grey-200: #d0d5dd;
    --grey-300: #98a2b3;
    --grey-400: #667085;
    --grey-500: #475467;
    --grey-700: #344054;
    --grey-900: #101828;
    --text-primary: var(--grey-900);
    --text-secondary: var(--grey-500);
    --text-muted: var(--grey-400);
    --text-inverse: var(--white);
    --text-teal: var(--teal-700);
    --bg-page: var(--grey-50);
    --bg-card: var(--white);
    --bg-sidebar: var(--white);
    --bg-header: var(--white);
    --bg-teal: var(--teal-500);
    --bg-teal-soft: var(--teal-50);
    --border-default: var(--grey-200);
    --border-teal: var(--teal-300);
    --border-teal-strong: var(--teal-500);
    --red: #d92d20;
    --red-light: #fef3f2;
    --red-border: #fda29b;
    --amber: #b54708;
    --amber-light: #fffaeb;
    --amber-border: #fec84b;
    --green: #027a48;
    --green-light: #ecfdf3;
    --green-border: #6ce9a6;
    --shadow-xs: 0 1px 2px rgba(16,24,40,0.05);
    --shadow-sm: 0 1px 3px rgba(16,24,40,0.1), 0 1px 2px rgba(16,24,40,0.06);
    --shadow-md: 0 4px 8px rgba(16,24,40,0.08), 0 2px 4px rgba(16,24,40,0.04);
    --shadow-lg: 0 12px 24px rgba(16,24,40,0.1), 0 4px 8px rgba(16,24,40,0.06);
    --shadow-teal: 0 0 0 4px rgba(14, 165, 233, 0.12);
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 20px;
    --r-full: 9999px;
    --t-fast: 0.12s ease;
    --t-base: 0.18s ease;
    --t-slow: 0.28s ease;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: 'Nunito', sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── Animations (defined ONCE) ──────────────────────────────── */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes blink {
    0%,100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══════════════════════════════════════════════════════════════
   SHELL & SIDEBAR
═══════════════════════════════════════════════════════════════ */

.shell {
    display: grid;
    grid-template-columns: 220px 1fr;
    min-height: 100vh;
}

.sidebar-nav, .sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-default);
    display: flex;
    flex-direction: column;
    padding-bottom: 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 8px rgba(16,24,40,.04);
    z-index: 20;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px 14px;
    border-bottom: 1px solid var(--border-default);
    margin-bottom: 8px;
    flex-shrink: 0;
}

.logo-mark {
    width: 34px;
    height: 34px;
    background: var(--teal-500);
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 700;
    flex-shrink: 0;
    font-family: 'Nunito', sans-serif;
}

.logo-text {
    font-family: 'Lora', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--teal-700);
    letter-spacing: -0.02em;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 12px 16px 4px;
    flex-shrink: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 16px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all var(--t-fast);
    margin: 1px 0;
    flex-shrink: 0;
}

    .nav-link:hover {
        background: var(--grey-50);
        color: var(--text-primary);
    }

    .nav-link.active {
        background: var(--teal-50);
        color: var(--teal-700);
        border-left-color: var(--teal-500);
        font-weight: 600;
    }

.nav-icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.nav-bottom {
    margin-top: auto;
    padding: 12px 16px 0;
    border-top: 1px solid var(--border-default);
    flex-shrink: 0;
}

.nav-version {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--r-sm);
    transition: background var(--t-fast);
    align-items: center;
    justify-content: center;
}

    .mobile-menu-toggle:hover {
        background: var(--grey-100);
    }

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.5);
    z-index: 99;
    animation: fadeIn 0.15s ease-out;
}

/* ═══════════════════════════════════════════════════════════════
   MAIN CONTENT & TOP BAR
═══════════════════════════════════════════════════════════════ */

.main-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow: hidden;
    background: var(--bg-page);
}

.top-bar {
    background: var(--white);
    border-bottom: 1px solid var(--border-default);
    padding: 0 40px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: var(--shadow-xs);
    flex-shrink: 0;
}

.top-bar-title {
    font-family: 'Lora', serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-bar-user {
    font-family: 'Nunito', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--teal-700);
    background: var(--teal-50);
    border: 1px solid var(--teal-200);
    padding: 4px 12px;
    border-radius: var(--r-full);
}

.page-body {
    flex: 1;
    padding: 28px 40px 48px;
    overflow-y: auto;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: var(--r-md);
    font-family: 'Nunito', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all var(--t-base);
    white-space: nowrap;
    line-height: 1;
}

    .btn:active {
        transform: translateY(1px);
    }

.btn-primary {
    background: var(--teal-500);
    color: var(--white);
    border-color: var(--teal-500);
}

    .btn-primary:hover {
        background: var(--teal-600);
        border-color: var(--teal-600);
        box-shadow: var(--shadow-sm);
        transform: translateY(-1px);
    }

.btn-secondary {
    background: var(--white);
    color: var(--teal-700);
    border-color: var(--teal-300);
}

    .btn-secondary:hover {
        background: var(--teal-50);
        border-color: var(--teal-500);
    }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-default);
}

    .btn-ghost:hover {
        background: var(--grey-50);
        color: var(--text-primary);
    }

.btn-danger {
    background: var(--white);
    color: var(--red);
    border-color: var(--red-border);
}

    .btn-danger:hover {
        background: var(--red-light);
    }

.btn-sm {
    padding: 5px 12px;
    font-size: 0.8rem;
}

.btn-large {
    padding: 14px 22px;
    font-size: 1rem;
    font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════
   CARDS, TABLES, FORMS, BADGES
═══════════════════════════════════════════════════════════════ */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--grey-25);
}

.card-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
}

    .card-body.p-0 {
        padding: 0;
    }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

    .data-table thead tr {
        background: var(--grey-50);
        border-bottom: 2px solid var(--border-default);
    }

    .data-table thead th {
        padding: 10px 14px;
        text-align: left;
        font-size: 0.72rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        color: var(--text-muted);
        white-space: nowrap;
    }

    .data-table tbody tr {
        border-bottom: 1px solid var(--border-default);
        transition: background var(--t-fast);
    }

        .data-table tbody tr:hover {
            background: var(--teal-50);
        }

        .data-table tbody tr:last-child {
            border-bottom: none;
        }

    .data-table td {
        padding: 12px 14px;
        color: var(--text-primary);
        vertical-align: middle;
    }

.table-empty {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-style: italic;
}

.table-footer {
    padding: 10px 16px;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-default);
    background: var(--grey-25);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

    .form-label .required {
        color: var(--red);
        margin-left: 2px;
    }

.form-label-large {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: block;
}

.form-control {
    padding: 9px 13px;
    border-radius: var(--r-md);
    border: 1.5px solid var(--border-default);
    background: var(--white);
    color: var(--text-primary);
    font-family: 'Nunito', sans-serif;
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--t-base), box-shadow var(--t-base);
    width: 100%;
}

    .form-control:focus {
        border-color: var(--teal-500);
        box-shadow: var(--shadow-teal);
    }

    .form-control::placeholder {
        color: var(--text-muted);
    }

    .form-control:disabled {
        background: var(--grey-50);
        color: var(--text-muted);
        cursor: not-allowed;
    }

.form-control-large {
    font-size: 1rem;
    padding: 12px 14px;
}

textarea.form-control {
    resize: vertical;
    min-height: 90px;
    line-height: 1.5;
}

textarea.form-control-large {
    font-size: 1rem;
    line-height: 1.6;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2398a2b3' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.search-wrap {
    position: relative;
    flex: 1;
    max-width: 360px;
}

.search-icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    pointer-events: none;
}

.search-input {
    padding-left: 34px !important;
}

.validation-msg {
    color: var(--red);
    font-size: 0.78rem;
    margin-top: 4px;
    display: block;
}

.saving-indicator {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-style: italic;
}

.save-success {
    font-size: 0.82rem;
    color: var(--green);
    font-weight: 600;
}

.check-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--r-sm);
    border: 1px solid var(--border-default);
    background: var(--white);
    transition: all var(--t-fast);
}

    .check-label:hover {
        border-color: var(--teal-300);
        background: var(--teal-50);
        color: var(--teal-700);
    }

    .check-label input[type="checkbox"] {
        accent-color: var(--teal-500);
        width: 14px;
        height: 14px;
    }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--r-full);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.badge-teal {
    background: var(--teal-50);
    color: var(--teal-700);
    border: 1px solid var(--teal-200);
}

.badge-green {
    background: var(--green-light);
    color: var(--green);
    border: 1px solid var(--green-border);
}

.badge-red {
    background: var(--red-light);
    color: var(--red);
    border: 1px solid var(--red-border);
}

.badge-amber {
    background: var(--amber-light);
    color: var(--amber);
    border: 1px solid var(--amber-border);
}

.badge-grey {
    background: var(--grey-100);
    color: var(--grey-500);
    border: 1px solid var(--grey-200);
}

.badge-open {
    background: #eff8ff;
    color: #1570ef;
    border: 1px solid #84caff;
}

.badge-filled {
    background: var(--teal-50);
    color: var(--teal-700);
    border: 1px solid var(--teal-200);
}

.badge-completed {
    background: var(--green-light);
    color: var(--green);
    border: 1px solid var(--green-border);
}

.badge-urgent {
    background: var(--red-light);
    color: var(--red);
    border: 1px solid var(--red-border);
}

.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--r-md);
    font-size: 0.85rem;
    line-height: 1.4;
    border: 1px solid;
}

.alert-teal {
    background: var(--teal-50);
    border-color: var(--teal-200);
    color: var(--teal-800);
}

.alert-red {
    background: var(--red-light);
    border-color: var(--red-border);
    color: var(--red);
}

.alert-amber {
    background: var(--amber-light);
    border-color: var(--amber-border);
    color: var(--amber);
}

.alert-green {
    background: var(--green-light);
    border-color: var(--green-border);
    color: var(--green);
}

.divider {
    height: 1px;
    background: var(--border-default);
    margin: 16px 0;
}

/* ═══════════════════════════════════════════════════════════════
   AVATARS
═══════════════════════════════════════════════════════════════ */

.avatar {
    border-radius: var(--r-full);
    background: var(--teal-100);
    border: 2px solid var(--teal-200);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--teal-700);
    flex-shrink: 0;
    font-family: 'Lora', serif;
}

.avatar-sm {
    width: 36px;
    height: 36px;
    font-size: 1rem;
}

.avatar-lg {
    width: 68px;
    height: 68px;
    font-size: 1.8rem;
}

.profile-avatar {
    width: 64px;
    height: 64px;
    border-radius: var(--r-full);
    background: var(--teal-100);
    border: 2px solid var(--teal-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--teal-700);
    flex-shrink: 0;
}

.nhs-number {
    font-family: monospace;
    font-size: 0.85rem;
    color: var(--teal-700);
    background: var(--teal-50);
    padding: 2px 8px;
    border-radius: var(--r-sm);
    border: 1px solid var(--teal-200);
    letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════════════════════════════
   STAT TILES & DASHBOARD
═══════════════════════════════════════════════════════════════ */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}

.stat-tile {
    background: var(--bg-card);
    border: 1px solid var(--border-default);
    border-radius: var(--r-lg);
    padding: 18px 16px;
    box-shadow: var(--shadow-xs);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: box-shadow var(--t-base), transform var(--t-base);
}

    .stat-tile:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-1px);
    }

    .stat-tile.accent {
        background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-800) 100%);
        border-color: var(--teal-600);
    }

    .stat-tile.warn {
        border-color: var(--amber-border);
        background: var(--amber-light);
    }

    .stat-tile.danger {
        border-color: var(--red-border);
        background: var(--red-light);
    }

.stat-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.stat-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.stat-value {
    font-family: 'Lora', serif;
    font-size: 1.9rem;
    font-weight: 600;
    color: var(--teal-700);
    line-height: 1.1;
    margin: 2px 0;
}

.stat-tile.accent .stat-label,
.stat-tile.accent .stat-value {
    color: #fff;
}

.stat-tile.warn .stat-value {
    color: var(--amber);
}

.stat-tile.danger .stat-value {
    color: var(--red);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
}

/* ═══════════════════════════════════════════════════════════════
   LOADING & EMPTY STATES
═══════════════════════════════════════════════════════════════ */

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    gap: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--teal-100);
    border-top-color: var(--teal-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-spinner-sm {
    width: 14px;
    height: 14px;
    border: 2px solid var(--teal-200);
    border-top-color: var(--teal-500);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

.empty-state {
    padding: 32px;
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════
   LIST ROWS, QUICK ACTIONS
═══════════════════════════════════════════════════════════════ */

.list-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 18px;
    border-bottom: 1px solid var(--border-default);
    gap: 12px;
    transition: background var(--t-fast);
}

    .list-row:hover {
        background: var(--teal-50);
    }

    .list-row:last-child {
        border-bottom: none;
    }

.list-row-main {
    flex: 1;
    min-width: 0;
}

.list-row-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-row-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    border-radius: var(--r-lg);
    border: 1.5px solid var(--border-default);
    background: var(--grey-25);
    cursor: pointer;
    transition: all var(--t-base);
    font-family: 'Nunito', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

    .quick-action-btn:hover {
        background: var(--teal-50);
        border-color: var(--teal-400);
        color: var(--teal-700);
        transform: translateY(-2px);
        box-shadow: var(--shadow-sm);
    }

.qa-icon {
    font-size: 1.4rem;
}

/* ═══════════════════════════════════════════════════════════════
   PROFILE
═══════════════════════════════════════════════════════════════ */

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.profile-header-card .card-body,
.profile-header-body {
    padding: 20px 24px;
    display: flex;
    align-items: flex-start;
    gap: 18px;
}

.profile-header-info {
    flex: 1;
    min-width: 0;
}

.profile-name {
    font-family: 'Lora', serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.2;
}

.profile-preferred {
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 6px;
    font-family: 'Nunito', sans-serif;
}

.profile-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

.meta-dot {
    color: var(--grey-300);
    font-size: 0.7rem;
}

.profile-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
}

.profile-tab {
    padding: 10px 18px;
    font-family: 'Nunito', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border: 1px solid var(--border-default);
    border-bottom: none;
    background: var(--grey-50);
    border-radius: var(--r-md) var(--r-md) 0 0;
    margin-right: 4px;
    transition: all var(--t-fast);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

    .profile-tab:hover {
        background: var(--teal-50);
        color: var(--teal-700);
    }

    .profile-tab.active {
        background: var(--white);
        color: var(--teal-700);
        border-color: var(--border-default);
        border-bottom-color: var(--white);
        position: relative;
        z-index: 1;
    }

.profile-tab-card {
    border-top-left-radius: 0;
    margin-top: -1px;
}

.field-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
    padding: 2px 0;
    line-height: 1.5;
}

    .field-value.pref-value {
        white-space: pre-wrap;
        line-height: 1.6;
        color: var(--text-secondary);
    }

    .field-value.allergy-value {
        color: var(--red);
        font-weight: 600;
    }

.patient-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nok-card {
    background: var(--grey-25);
    border: 1px solid var(--border-default);
    border-radius: var(--r-lg);
    padding: 16px 18px;
    margin-bottom: 12px;
}

.nok-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

/* ═══════════════════════════════════════════════════════════════
   SHIFTS, CLOCK, VIEW TABS
═══════════════════════════════════════════════════════════════ */

.shift-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border-default);
    border-radius: var(--r-lg);
    padding: 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: var(--shadow-xs);
    transition: all var(--t-base);
    border-left: 4px solid var(--teal-400);
}

    .shift-card:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-1px);
        border-left-color: var(--teal-600);
    }

    .shift-card.urgent {
        border-left-color: var(--red);
    }

    .shift-card.open {
        border-left-color: #1570ef;
    }

    .shift-card.completed {
        border-left-color: #12b76a;
    }

.shift-header-icon {
    font-size: 2.5rem;
    flex-shrink: 0;
}

.view-tabs {
    display: flex;
    background: var(--grey-50);
    border: 1px solid var(--border-default);
    border-radius: var(--r-lg);
    padding: 3px;
    gap: 2px;
}

.view-tab {
    padding: 6px 16px;
    border-radius: var(--r-md);
    border: none;
    background: transparent;
    font-family: 'Nunito', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--t-fast);
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

    .view-tab:hover {
        color: var(--text-primary);
        background: var(--white);
    }

    .view-tab.active {
        background: var(--white);
        color: var(--teal-700);
        box-shadow: var(--shadow-xs);
    }

.tab-badge {
    background: var(--teal-500);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--r-full);
    min-width: 18px;
    text-align: center;
}

.tab-badge-red {
    background: var(--red);
}

.clock-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: var(--r-xl);
    font-family: 'Nunito', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all var(--t-base);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
    flex-shrink: 0;
}

    .clock-btn.clock-in {
        background: var(--teal-500);
        color: var(--white);
    }

        .clock-btn.clock-in:hover {
            background: var(--teal-600);
            transform: translateY(-2px);
            box-shadow: var(--shadow-md);
        }

    .clock-btn.clock-out {
        background: var(--white);
        color: var(--red);
        border: 2px solid var(--red-border);
    }

        .clock-btn.clock-out:hover {
            background: var(--red-light);
            transform: translateY(-2px);
            box-shadow: var(--shadow-md);
        }

.clock-running {
    font-size: 0.78rem;
    color: var(--teal-600);
    font-weight: 600;
    text-align: center;
    padding: 4px 12px;
    background: var(--teal-50);
    border: 1px solid var(--teal-200);
    border-radius: var(--r-md);
}

.clock-summary {
    background: var(--green-light);
    border: 1px solid var(--green-border);
    border-radius: var(--r-lg);
    padding: 16px 20px;
    text-align: center;
    flex-shrink: 0;
}

.clock-summary-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--green);
    margin-bottom: 4px;
}

.clock-summary-value {
    font-family: 'Lora', serif;
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--green);
    line-height: 1;
}

.clock-summary-sub {
    font-size: 0.75rem;
    color: var(--green);
    opacity: 0.8;
    margin-top: 4px;
}

.clock-status {
    padding: 10px 14px;
    border-radius: var(--r-md);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 12px;
    background: var(--grey-50);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    text-align: center;
}

    .clock-status.ok {
        background: var(--green-light);
        border-color: var(--green);
        color: #065f46;
    }

    .clock-status.warn {
        background: #fef3c7;
        border-color: var(--amber);
        color: #92400e;
    }

/* ═══════════════════════════════════════════════════════════════
   TASKS
═══════════════════════════════════════════════════════════════ */

.task-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-default);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-xs);
    transition: all var(--t-base);
}

    .task-card:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-1px);
    }

    .task-card.urgent {
        border-left: 4px solid var(--red);
    }

    .task-card.task-card-completed {
        background: var(--grey-25);
        opacity: 0.75;
    }

    .task-card.task-card-declined {
        background: var(--red-light);
        border-color: var(--red-border);
        opacity: 0.7;
    }

.task-card-left {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.task-card-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.task-card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 6px;
}

    .task-card-title.done {
        text-decoration: line-through;
        color: var(--text-muted);
    }

.task-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.task-completion-note {
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-style: italic;
    background: var(--grey-50);
    padding: 6px 10px;
    border-radius: var(--r-sm);
    border-left: 3px solid var(--teal-300);
}

.task-complete-inline {
    min-width: 260px;
}

.priority-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}

    .priority-dot.urgent {
        background: var(--red);
        box-shadow: 0 0 6px var(--red-border);
    }

    .priority-dot.routine {
        background: #1570ef;
    }

    .priority-dot.whenpossible {
        background: var(--green);
    }

/* Patient task UI — large radios */
.patient-form-card .card-body {
    padding: 20px;
}

.big-radio-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.big-radio {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border: 2px solid var(--border-default);
    border-radius: var(--r-lg);
    cursor: pointer;
    transition: all var(--t-fast);
    background: var(--white);
}

    .big-radio:hover {
        border-color: var(--teal-300);
        background: var(--teal-50);
    }

    .big-radio.selected {
        border-color: var(--teal-500);
        background: var(--teal-50);
        box-shadow: var(--shadow-teal);
    }

.big-radio-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.big-radio-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.big-radio-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.category-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 8px;
    border: 2px solid var(--border-default);
    border-radius: var(--r-md);
    background: var(--white);
    cursor: pointer;
    transition: all var(--t-fast);
    font-family: 'Nunito', sans-serif;
    min-height: 80px;
}

    .category-tile:hover {
        border-color: var(--teal-300);
        background: var(--teal-50);
    }

    .category-tile.selected {
        border-color: var(--teal-500);
        background: var(--teal-50);
        box-shadow: var(--shadow-teal);
    }

.category-icon {
    font-size: 1.5rem;
}

.category-name {
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    color: var(--text-secondary);
    line-height: 1.2;
}

.priority-pills {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.priority-pill {
    padding: 12px 22px;
    border: 2px solid var(--border-default);
    border-radius: var(--r-full);
    background: var(--white);
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    transition: all var(--t-fast);
}

    .priority-pill:hover {
        border-color: var(--teal-300);
    }

    .priority-pill.priority-routine.selected {
        border-color: var(--green);
        background: #d1fae5;
        color: #065f46;
    }

    .priority-pill.priority-whenpossible.selected {
        border-color: var(--amber);
        background: #fef3c7;
        color: #92400e;
    }

    .priority-pill.priority-urgent.selected {
        border-color: var(--red);
        background: #fee2e2;
        color: #991b1b;
    }

/* ═══════════════════════════════════════════════════════════════
   CARERS, ACTIVITY, MEDICATIONS, PROVISIONS, WAGES
═══════════════════════════════════════════════════════════════ */

.rate-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--teal-700);
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.rate-sub {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
}

.activity-timeline {
    position: relative;
    padding-left: 20px;
}

.activity-date {
    font-family: 'Lora', serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--teal-700);
    margin: 20px 0 12px -20px;
    padding-left: 20px;
    border-bottom: 1px solid var(--border-default);
    padding-bottom: 6px;
}

    .activity-date:first-child {
        margin-top: 0;
    }

.activity-item {
    display: grid;
    grid-template-columns: 60px 24px 1fr;
    gap: 10px;
    margin-bottom: 14px;
    position: relative;
}

.activity-time {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    padding-top: 3px;
    font-family: 'JetBrains Mono', monospace;
}

.activity-marker {
    position: relative;
    display: flex;
    justify-content: center;
}

    .activity-marker::before {
        content: '';
        position: absolute;
        top: 18px;
        bottom: -24px;
        left: 50%;
        width: 2px;
        background: var(--border-default);
        transform: translateX(-1px);
    }

.activity-item:last-child .activity-marker::before {
    display: none;
}

.activity-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-top: 5px;
    z-index: 1;
    border: 3px solid var(--white);
    box-shadow: 0 0 0 1.5px var(--border-default);
}

    .activity-dot.red {
        background: var(--red);
        box-shadow: 0 0 0 1.5px var(--red);
    }

    .activity-dot.teal {
        background: var(--teal-500);
        box-shadow: 0 0 0 1.5px var(--teal-500);
    }

    .activity-dot.green {
        background: var(--green);
        box-shadow: 0 0 0 1.5px var(--green);
    }

    .activity-dot.amber {
        background: var(--amber);
        box-shadow: 0 0 0 1.5px var(--amber);
    }

    .activity-dot.blue {
        background: #1570ef;
        box-shadow: 0 0 0 1.5px #1570ef;
    }

    .activity-dot.grey {
        background: var(--text-muted);
        box-shadow: 0 0 0 1.5px var(--text-muted);
    }

.activity-content {
    min-width: 0;
}

.activity-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.activity-type {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
}

.activity-notes {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-top: 4px;
    line-height: 1.5;
}

.activity-edit-reason {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 4px;
}

.med-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--r-md);
    border: 1px solid var(--border-default);
    background: var(--white);
    transition: all var(--t-fast);
}

    .med-row:hover {
        border-color: var(--teal-200);
        background: var(--teal-50);
    }

.med-name {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-primary);
    flex: 1;
}

.med-dose {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.med-time {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.provision-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--r-md);
    border: 1px solid var(--border-default);
    background: var(--white);
}

.provision-name {
    flex: 1;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.stock-bar-wrap {
    width: 80px;
    height: 6px;
    background: var(--grey-100);
    border-radius: var(--r-full);
    overflow: hidden;
}

.stock-bar {
    height: 100%;
    border-radius: var(--r-full);
    background: var(--teal-400);
    transition: width var(--t-slow), background var(--t-slow);
}

    .stock-bar.low {
        background: #f79009;
    }

    .stock-bar.critical {
        background: var(--red);
    }

.stock-qty {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: right;
}

.stock-low {
    color: var(--amber);
    font-weight: 700;
}

.pay-summary {
    background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-800) 100%);
    border-radius: var(--r-xl);
    padding: 24px;
    color: var(--white);
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: var(--shadow-lg);
}

.pay-summary-label {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.8;
}

.pay-summary-amount {
    font-family: 'Lora', serif;
    font-size: 2.4rem;
    font-weight: 600;
    line-height: 1;
}

.pay-summary-sub {
    font-size: 0.82rem;
    opacity: 0.75;
}

/* ═══════════════════════════════════════════════════════════════
   AUTH
═══════════════════════════════════════════════════════════════ */

.auth-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--teal-50) 0%, var(--grey-50) 60%, var(--teal-100) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    background: var(--white);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border-default);
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}

.auth-brand {
    font-family: 'Lora', serif;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--teal-700);
    letter-spacing: -0.02em;
}

.auth-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 1px;
}

.auth-heading {
    font-family: 'Nunito', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.auth-submit {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 0.95rem;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

    .auth-divider::before,
    .auth-divider::after {
        content: '';
        flex: 1;
        height: 1px;
        background: var(--border-default);
    }

.auth-link {
    background: none;
    border: none;
    color: var(--teal-600);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0;
    text-decoration: underline;
    font-family: 'Nunito', sans-serif;
}

    .auth-link:hover {
        color: var(--teal-800);
    }

.auth-note {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
    background: var(--grey-50);
    padding: 10px 14px;
    border-radius: var(--r-md);
    border: 1px solid var(--border-default);
}

.role-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.role-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1.5px solid var(--border-default);
    border-radius: var(--r-lg);
    cursor: pointer;
    transition: all var(--t-fast);
    background: var(--white);
}

    .role-option:hover {
        border-color: var(--teal-300);
        background: var(--teal-50);
    }

    .role-option.selected {
        border-color: var(--teal-500);
        background: var(--teal-50);
        box-shadow: var(--shadow-teal);
    }

    .role-option input[type="radio"] {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
        margin: 0;
        pointer-events: none;
    }

.role-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.role-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
    min-width: 90px;
}

.role-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 24px;
    animation: fadeIn 0.15s ease-out;
    overflow-y: auto;
}

.modal {
    background: var(--white);
    border-radius: var(--r-xl);
    box-shadow: 0 20px 50px rgba(0,0,0,0.25);
    max-width: 560px;
    width: 100%;
    max-height: calc(100vh - 48px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.2s ease-out;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-default);
    flex-shrink: 0;
}

.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

/* ═══════════════════════════════════════════════════════════════
   DATETIME PICKER
═══════════════════════════════════════════════════════════════ */

.datetime-picker {
    display: flex;
    gap: 8px;
}

    .datetime-picker .date-input {
        flex: 2;
        min-width: 0;
    }

    .datetime-picker .time-input {
        flex: 1;
        min-width: 100px;
        text-align: center;
        font-variant-numeric: tabular-nums;
        cursor: pointer;
    }

    .datetime-picker input[type="time"]::-webkit-calendar-picker-indicator,
    .datetime-picker input[type="date"]::-webkit-calendar-picker-indicator {
        cursor: pointer;
        opacity: 0.6;
    }

        .datetime-picker input[type="time"]::-webkit-calendar-picker-indicator:hover,
        .datetime-picker input[type="date"]::-webkit-calendar-picker-indicator:hover {
            opacity: 1;
        }

/* ═══════════════════════════════════════════════════════════════
   GEOFENCING
═══════════════════════════════════════════════════════════════ */

.location-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--grey-50);
    border-radius: var(--r-md);
    border: 1px solid var(--border-default);
}

.location-coords {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.location-set-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 8px;
    flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════════
   SHIFT NOTES
═══════════════════════════════════════════════════════════════ */

.notes-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-card {
    background: var(--white);
    border: 1px solid var(--border-default);
    border-left: 4px solid var(--text-muted);
    border-radius: var(--r-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-xs);
    transition: all var(--t-fast);
}

    .note-card:hover {
        box-shadow: var(--shadow-sm);
    }

    .note-card.flagged {
        background: #fffbeb;
        border-left-color: var(--amber);
    }

    .note-card.coordinator {
        border-left-color: var(--teal-600);
    }

    .note-card.carer {
        border-left-color: #6b7280;
    }

    .note-card.patient {
        border-left-color: var(--amber);
    }

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.note-role-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--r-full);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: var(--grey-100);
    color: var(--text-secondary);
}

    .note-role-badge.coordinator {
        background: var(--teal-50);
        color: var(--teal-700);
    }

    .note-role-badge.carer {
        background: var(--grey-100);
        color: var(--text-secondary);
    }

    .note-role-badge.patient {
        background: #fef3c7;
        color: #92400e;
    }

.note-author {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-left: 6px;
}

.note-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

.note-body {
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--text-primary);
}

    .note-body p {
        margin: 0 0 6px 0;
    }

/* ═══════════════════════════════════════════════════════════════
   HANDOVER PROMPT
═══════════════════════════════════════════════════════════════ */

.handover-prompt {
    background: #fffbeb;
    border: 2px solid var(--amber);
    border-radius: var(--r-lg);
    padding: 16px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-top: 8px;
    box-shadow: var(--shadow-sm);
}

.handover-prompt-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.handover-prompt-body {
    flex: 1;
}

.handover-prompt-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #92400e;
    margin-bottom: 4px;
}

.handover-prompt-msg {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   INCIDENTS
═══════════════════════════════════════════════════════════════ */

.incident-type-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 6px;
}

.incident-type-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 10px;
    border: 2px solid var(--border-default);
    border-radius: var(--r-md);
    background: var(--white);
    cursor: pointer;
    transition: all var(--t-fast);
    font-family: 'Nunito', sans-serif;
    min-height: 78px;
}

    .incident-type-btn:hover {
        border-color: var(--red);
        background: #fef2f2;
    }

    .incident-type-btn.selected {
        border-color: var(--red);
        background: #fef2f2;
        box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
    }

.incident-icon {
    font-size: 1.5rem;
}

.incident-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
}

/* ═══════════════════════════════════════════════════════════════
   SHIFT SUMMARY CARD
═══════════════════════════════════════════════════════════════ */

.shift-summary-card {
    background: var(--white);
    border: 1px solid var(--border-default);
    border-left: 4px solid var(--teal-500);
    border-radius: var(--r-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-xs);
    transition: all var(--t-fast);
}

    .shift-summary-card:hover {
        box-shadow: var(--shadow-sm);
        transform: translateY(-1px);
    }

    .shift-summary-card.has-issues {
        border-left-color: var(--amber);
        background: #fffbeb;
    }

.shift-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.shift-summary-date {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.shift-summary-time {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: 8px;
}

.shift-summary-people {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.shift-summary-hours {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--teal-700);
    line-height: 1;
    text-align: right;
}

.hr-suffix {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: 2px;
}

.shift-summary-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.summary-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--grey-50);
    border-radius: var(--r-sm);
    border: 1px solid transparent;
}

    .summary-stat.stat-warning,
    .summary-stat.stat-flagged {
        background: #fef3c7;
        border-color: var(--amber);
    }

    .summary-stat.stat-incident {
        background: #fee2e2;
        border-color: var(--red);
    }

.summary-stat-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.summary-stat-value {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1;
}

.summary-stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.shift-summary-action {
    margin-left: auto;
}

.shift-summary-clocks {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-default);
    font-family: 'JetBrains Mono', monospace;
}

/* ═══════════════════════════════════════════════════════════════
   TRAINING VIDEOS
═══════════════════════════════════════════════════════════════ */

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
}

.video-card {
    background: var(--white);
    border: 1px solid var(--border-default);
    border-radius: var(--r-lg);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    transition: all var(--t-fast);
    display: flex;
    flex-direction: column;
}

    .video-card:hover {
        box-shadow: var(--shadow-sm);
        transform: translateY(-2px);
    }

.video-player-wrap {
    background: #000;
    aspect-ratio: 16 / 9;
    position: relative;
}

.video-player {
    width: 100%;
    height: 100%;
    display: block;
}

.video-info {
    padding: 14px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.video-title {
    margin: 0 0 6px 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.video-description {
    margin: 0 0 10px 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
}

.video-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin-top: auto;
}

/* ═══════════════════════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════════════════════ */

.toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(60px);
    background: var(--grey-900);
    color: var(--white);
    padding: 10px 20px;
    border-radius: var(--r-lg);
    font-size: 0.85rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    transition: transform var(--t-slow);
    z-index: 200;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .toast.show {
        transform: translateX(-50%) translateY(0);
    }

    .toast.green {
        background: var(--green);
    }

    .toast.red {
        background: var(--red);
    }

    .toast.teal {
        background: var(--teal-600);
    }

/* ═══════════════════════════════════════════════════════════════
   SCROLLBAR
═══════════════════════════════════════════════════════════════ */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--grey-50);
}

::-webkit-scrollbar-thumb {
    background: var(--grey-200);
    border-radius: var(--r-full);
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--teal-300);
    }

/* ═══════════════════════════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════════════════════════ */

.text-teal {
    color: var(--teal-600);
}

.text-muted {
    color: var(--text-muted);
}

.text-danger {
    color: var(--red);
}

.text-success {
    color: var(--green);
}

.text-bold {
    font-weight: 700;
}

.text-sm {
    font-size: 0.82rem;
}

.text-xs {
    font-size: 0.72rem;
}

.fw-600 {
    font-weight: 600;
}

.mt-4 {
    margin-top: 4px;
}

.mt-8 {
    margin-top: 8px;
}

.mt-12 {
    margin-top: 12px;
}

.mt-16 {
    margin-top: 16px;
}

.mb-4 {
    margin-bottom: 4px;
}

.mb-16 {
    margin-bottom: 16px;
}

.page-title {
    font-family: 'Lora', serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .section-title::after {
        content: '';
        flex: 1;
        height: 1px;
        background: var(--border-default);
    }

.page-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE (CONSOLIDATED)
═══════════════════════════════════════════════════════════════ */

@media (max-width: 900px) {
    /* Single column — sidebar slides over content */
    .shell {
        grid-template-columns: 1fr;
    }

    .mobile-menu-toggle {
        display: inline-flex;
    }

    /* Sidebar becomes a sliding drawer */
    .sidebar-nav {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 280px;
        max-width: 85vw;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform var(--t-base) ease-out;
        box-shadow: 4px 0 20px rgba(0,0,0,0.15);
        overflow-y: auto;
    }

    /* When .shell has .sidebar-visible, slide the sidebar in */
    .shell.sidebar-visible .sidebar-nav {
        transform: translateX(0);
    }

    .sidebar-backdrop.open {
        display: block;
    }

    .top-bar {
        padding: 0 12px;
        gap: 8px;
    }

    .top-bar-title {
        font-size: 1rem;
        flex: 1;
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .top-bar-user {
        display: none;
    }

    .top-bar-right {
        gap: 6px;
    }

    .page-body {
        padding: 16px;
    }

    .profile-grid {
        grid-template-columns: 1fr;
    }

    .profile-tabs {
        flex-wrap: wrap;
    }

    .profile-tab {
        border-radius: var(--r-md);
        border-bottom: 1px solid var(--border-default);
        margin-bottom: 2px;
    }

    .profile-header-body {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .quick-actions {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 700px) {
    .big-radio-group {
        grid-template-columns: 1fr;
    }

    .category-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .priority-pill {
        flex: 1;
        min-width: 0;
    }

    .shift-summary-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .shift-summary-action {
        grid-column: span 2;
    }
}

@media (max-width: 600px) {
    .datetime-picker {
        flex-direction: column;
    }

    .incident-type-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stat-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }

    .sidebar-nav {
        width: 260px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   COORDINATOR DASHBOARD (clean rebuild — namespaced .dash-*)
═══════════════════════════════════════════════════════════════ */

.dash-welcome {
    background: linear-gradient(135deg, var(--teal-500) 0%, var(--teal-700) 100%);
    color: var(--white);
    border-radius: var(--r-xl);
    padding: 28px 32px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
    box-shadow: var(--shadow-md);
}

.dash-welcome-title {
    font-family: 'Lora', serif;
    font-size: 1.6rem;
    font-weight: 600;
    margin: 0 0 6px 0;
    letter-spacing: -0.02em;
}

.dash-welcome-sub {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.dash-welcome-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

    .dash-welcome-actions .btn-secondary {
        background: rgba(255,255,255,0.15);
        color: var(--white);
        border-color: rgba(255,255,255,0.3);
    }

        .dash-welcome-actions .btn-secondary:hover {
            background: rgba(255,255,255,0.25);
            border-color: rgba(255,255,255,0.5);
        }

    .dash-welcome-actions .btn-primary {
        background: var(--white);
        color: var(--teal-700);
        border-color: var(--white);
    }

        .dash-welcome-actions .btn-primary:hover {
            background: var(--teal-50);
            color: var(--teal-800);
        }

/* Stats grid — auto-fitting tiles */
.dash-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.dash-stat {
    background: var(--white);
    border: 1px solid var(--border-default);
    border-radius: var(--r-lg);
    padding: 18px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: var(--shadow-xs);
    transition: all var(--t-base);
    position: relative;
    overflow: hidden;
}

    .dash-stat:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-2px);
    }

.dash-stat-icon {
    font-size: 1.6rem;
    flex-shrink: 0;
    line-height: 1;
}

.dash-stat-body {
    flex: 1;
    min-width: 0;
}

.dash-stat-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.dash-stat-value {
    font-family: 'Lora', serif;
    font-size: 1.9rem;
    font-weight: 600;
    color: var(--teal-700);
    line-height: 1;
    margin-bottom: 4px;
}

.dash-stat-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Variants */
.dash-stat.dash-stat-accent {
    background: linear-gradient(135deg, var(--teal-50) 0%, var(--white) 60%);
    border-color: var(--teal-200);
}

.dash-stat.dash-stat-warn {
    border-color: var(--amber-border);
    background: linear-gradient(135deg, var(--amber-light) 0%, var(--white) 60%);
}

    .dash-stat.dash-stat-warn .dash-stat-value {
        color: var(--amber);
    }

.dash-stat.dash-stat-danger {
    border-color: var(--red-border);
    background: linear-gradient(135deg, var(--red-light) 0%, var(--white) 60%);
}

    .dash-stat.dash-stat-danger .dash-stat-value {
        color: var(--red);
    }

/* Two-column row */
.dash-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

/* Quick action tiles */
.dash-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.dash-quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 12px;
    background: var(--grey-25);
    border: 1.5px solid var(--border-default);
    border-radius: var(--r-md);
    cursor: pointer;
    transition: all var(--t-fast);
    font-family: 'Nunito', sans-serif;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-height: 90px;
}

    .dash-quick-btn:hover {
        background: var(--teal-50);
        border-color: var(--teal-400);
        color: var(--teal-700);
        transform: translateY(-2px);
        box-shadow: var(--shadow-sm);
    }

.dash-quick-icon {
    font-size: 1.6rem;
}

/* Dashboard responsive */
@media (max-width: 900px) {
    .dash-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .dash-welcome {
        padding: 20px 22px;
    }

    .dash-welcome-title {
        font-size: 1.3rem;
    }

    .dash-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .dash-stat {
        padding: 14px 16px;
    }

    .dash-stat-value {
        font-size: 1.6rem;
    }

    .dash-quick-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 420px) {
    .dash-stats {
        grid-template-columns: 1fr;
    }
}
