/* ==========================================================================
   Workbook & Worksheet Management — application theme
   A small design system layered on top of MDBootstrap.
   Loaded by includes/header.php (app shell) and the auth pages.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */
:root {
    /* Brand */
    --brand-50:  #eef4ff;
    --brand-100: #dbe7ff;
    --brand-200: #bcd2ff;
    --brand-300: #8fb4ff;
    --brand-400: #5b8cff;
    --brand-500: #3b71ca;
    --brand-600: #2e59a8;
    --brand-700: #244887;
    --brand-gradient: linear-gradient(135deg, #4f8cff 0%, #3b71ca 55%, #2a4d9b 100%);

    /* Accents */
    --accent-teal:   #12a89d;
    --accent-violet: #7c5cff;
    --accent-amber:  #f5a524;
    --accent-rose:   #f43f5e;
    --accent-green:  #14a44d;

    /* Surfaces & text (light) */
    --app-bg:        #f4f6fb;
    --surface:       #ffffff;
    --surface-2:     #f8fafc;
    --surface-3:     #eef2f7;
    --border:        #e6eaf2;
    --border-strong: #d7deeb;
    --text:          #101828;
    --text-muted:    #667085;
    --text-subtle:   #98a2b3;

    /* Sidebar */
    --sidebar-w: 264px;
    --sidebar-w-collapsed: 82px;
    --sidebar-bg: linear-gradient(185deg, #16233b 0%, #131d31 55%, #101828 100%);
    --sidebar-text: #a9b7cd;
    --sidebar-text-strong: #ffffff;
    --sidebar-muted: #64748b;

    /* Elevation */
    --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-md: 0 6px 16px -4px rgba(16, 24, 40, .10), 0 2px 6px -2px rgba(16, 24, 40, .05);
    --shadow-lg: 0 18px 40px -12px rgba(16, 24, 40, .22);

    /* Shape & motion */
    --radius-sm: .5rem;
    --radius:    .85rem;
    --radius-lg: 1.15rem;
    --ease: cubic-bezier(.4, 0, .2, 1);
}

/* Dark theme overrides */
[data-theme="dark"] {
    --app-bg:        #0d1424;
    --surface:       #151d2f;
    --surface-2:     #1a2437;
    --surface-3:     #202b41;
    --border:        #263149;
    --border-strong: #33405c;
    --text:          #e8edf7;
    --text-muted:    #9fadc4;
    --text-subtle:   #7b8aa3;
    --sidebar-bg: linear-gradient(185deg, #111a2c 0%, #0f1729 60%, #0c1322 100%);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .45);
    --shadow-md: 0 8px 20px -6px rgba(0, 0, 0, .55);
    --shadow-lg: 0 20px 44px -14px rgba(0, 0, 0, .65);
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
html { -webkit-text-size-adjust: 100%; }

body {
    background: var(--app-bg);
    color: var(--text);
    font-family: "Inter", "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
    font-size: .925rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    transition: background-color .25s var(--ease), color .25s var(--ease);
}

h1, h2, h3, h4, h5, h6 { color: var(--text); letter-spacing: -.015em; }
a { text-decoration: none; }
hr { border-color: var(--border); opacity: 1; }

::selection { background: var(--brand-200); color: var(--brand-700); }

/* Slim, unobtrusive scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

:focus-visible {
    outline: 2px solid var(--brand-400);
    outline-offset: 2px;
    border-radius: 4px;
}

.text-muted { color: var(--text-muted) !important; }

/* --------------------------------------------------------------------------
   3. App shell — sidebar
   -------------------------------------------------------------------------- */
.sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex; flex-direction: column;
    z-index: 1050;
    border-right: 1px solid rgba(255, 255, 255, .05);
    transition: width .22s var(--ease), transform .25s var(--ease);
}

.sidebar .brand {
    display: flex; align-items: center; gap: .7rem;
    padding: 1.1rem 1.15rem;
    color: #fff; font-weight: 700; font-size: 1.02rem; letter-spacing: -.02em;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    white-space: nowrap; overflow: hidden;
}
.sidebar .brand-mark {
    flex: 0 0 38px; width: 38px; height: 38px; border-radius: .7rem;
    background: var(--brand-gradient);
    display: inline-flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.02rem;
    box-shadow: 0 6px 16px -4px rgba(59, 113, 202, .65);
}
.sidebar .brand-mark img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.sidebar .brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sidebar .brand-text small { color: var(--sidebar-muted); font-size: .68rem; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; }

.sidebar-user {
    display: flex; align-items: center; gap: .7rem;
    padding: .85rem 1.15rem;
    border-bottom: 1px solid rgba(255, 255, 255, .07);
    white-space: nowrap; overflow: hidden;
}
.sidebar-user .avatar {
    flex: 0 0 40px; width: 40px; height: 40px; border-radius: 50%;
    background: rgba(255, 255, 255, .08); color: #cbd5e1;
    display: inline-flex; align-items: center; justify-content: center;
    object-fit: cover; font-size: 1rem;
    box-shadow: 0 0 0 2px rgba(79, 140, 255, .35);
}
.sidebar-user .u-meta { min-width: 0; }
.sidebar-user .u-name { color: var(--sidebar-text-strong); font-weight: 600; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .u-role {
    color: #7fa4e6; font-size: .68rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .07em;
}

.sidebar-nav { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: .55rem .65rem 1.25rem; }

.nav-section {
    padding: 1rem .6rem .35rem;
    font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em;
    color: var(--sidebar-muted);
}

.sidebar .nav-link {
    position: relative;
    display: flex; align-items: center; gap: .75rem;
    padding: .55rem .7rem; margin-bottom: 2px;
    color: var(--sidebar-text); font-size: .875rem; font-weight: 500;
    border-radius: .6rem; white-space: nowrap;
    transition: background-color .16s var(--ease), color .16s var(--ease), transform .16s var(--ease);
}
.sidebar .nav-link i {
    flex: 0 0 1.35rem; width: 1.35rem; text-align: center;
    font-size: .95rem; color: #7c8ca6;
    transition: color .16s var(--ease);
}
.sidebar .nav-link .nav-text { overflow: hidden; text-overflow: ellipsis; }
.sidebar .nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.sidebar .nav-link:hover i { color: #b9cdf0; }
.sidebar .nav-link.active {
    background: linear-gradient(90deg, rgba(79, 140, 255, .26), rgba(79, 140, 255, .07));
    color: #fff; font-weight: 600;
}
.sidebar .nav-link.active i { color: #74a6ff; }
.sidebar .nav-link.active::before {
    content: ""; position: absolute; left: -.65rem; top: 50%; transform: translateY(-50%);
    width: 3px; height: 22px; border-radius: 0 3px 3px 0; background: #74a6ff;
}

/* Collapsed (icon-only) sidebar on large screens */
@media (min-width: 992px) {
    body.sidebar-collapsed { --sidebar-w: var(--sidebar-w-collapsed); }
    body.sidebar-collapsed .sidebar .brand-text,
    body.sidebar-collapsed .sidebar .u-meta,
    body.sidebar-collapsed .sidebar .nav-text,
    body.sidebar-collapsed .sidebar .nav-section { display: none; }
    body.sidebar-collapsed .sidebar .brand,
    body.sidebar-collapsed .sidebar-user { justify-content: center; padding-inline: .5rem; }
    body.sidebar-collapsed .sidebar .nav-link { justify-content: center; padding-inline: .5rem; }
    body.sidebar-collapsed .sidebar .nav-link.active::before { left: -.4rem; }
    body.sidebar-collapsed .sidebar-nav { padding-top: .8rem; }
    /* Tooltip-style labels when collapsed */
    body.sidebar-collapsed .sidebar .nav-link:hover .nav-text {
        display: block; position: absolute; left: calc(100% + .55rem); top: 50%;
        transform: translateY(-50%);
        background: #0b1220; color: #fff; padding: .3rem .6rem;
        border-radius: .45rem; font-size: .78rem; box-shadow: var(--shadow-lg); z-index: 5;
    }
}

/* --------------------------------------------------------------------------
   4. App shell — main area & topbar
   -------------------------------------------------------------------------- */
.main-content {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex; flex-direction: column;
    transition: margin-left .22s var(--ease);
}

.topbar {
    position: sticky; top: 0; z-index: 1020;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .7rem 1.35rem;
    background: var(--surface); /* fallback for browsers without color-mix() */
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}
.topbar .page-title { font-size: 1.06rem; font-weight: 650; margin: 0; letter-spacing: -.02em; }
.topbar .page-eyebrow { font-size: .72rem; color: var(--text-subtle); letter-spacing: .06em; text-transform: uppercase; font-weight: 600; }

.icon-btn {
    position: relative;
    width: 38px; height: 38px; border-radius: .65rem;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--surface-2); color: var(--text-muted);
    border: 1px solid var(--border);
    transition: all .16s var(--ease);
}
.icon-btn:hover { background: var(--brand-50); color: var(--brand-500); border-color: var(--brand-200); }
[data-theme="dark"] .icon-btn:hover { background: rgba(79, 140, 255, .14); color: #8fb4ff; border-color: rgba(79, 140, 255, .3); }
.icon-btn .dot-badge {
    position: absolute; top: -5px; right: -5px;
    min-width: 18px; height: 18px; padding: 0 4px;
    border-radius: 999px; background: var(--accent-rose); color: #fff;
    font-size: .65rem; font-weight: 700; line-height: 18px; text-align: center;
    box-shadow: 0 0 0 2px var(--surface);
}

.user-chip {
    display: inline-flex; align-items: center; gap: .55rem;
    padding: .25rem .75rem .25rem .3rem;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 999px; color: var(--text);
    transition: all .16s var(--ease);
}
.user-chip:hover { border-color: var(--brand-200); background: var(--brand-50); }
[data-theme="dark"] .user-chip:hover { background: rgba(79, 140, 255, .12); border-color: rgba(79, 140, 255, .3); }
.user-chip .avatar-sm { width: 30px; height: 30px; }
.user-chip .u-line { line-height: 1.1; text-align: left; }
.user-chip .u-line strong { font-size: .8rem; font-weight: 600; display: block; }
.user-chip .u-line span { font-size: .68rem; color: var(--text-subtle); }

.avatar-sm { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }

.content-wrap { flex: 1; padding: 1.5rem 1.35rem 2rem; max-width: 1600px; width: 100%; }

.app-footer {
    padding: 1rem 1.35rem 1.5rem;
    color: var(--text-subtle); font-size: .8rem; text-align: center;
}

/* Mobile drawer */
.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .content-wrap { padding: 1.1rem .9rem 2rem; }
    .topbar { padding: .65rem .9rem; }
    .sidebar-backdrop {
        display: block; position: fixed; inset: 0; z-index: 1040;
        background: rgba(9, 15, 28, .55); backdrop-filter: blur(2px);
        opacity: 0; pointer-events: none; transition: opacity .25s var(--ease);
    }
    .sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
}

/* --------------------------------------------------------------------------
   5. Page header (title block above content)
   -------------------------------------------------------------------------- */
.page-head {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: .75rem; margin-bottom: 1.1rem;
}
.page-head .lead-sub { color: var(--text-muted); font-size: .86rem; }

/* --------------------------------------------------------------------------
   6. Cards
   -------------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    color: var(--text);
    transition: box-shadow .2s var(--ease), transform .2s var(--ease), border-color .2s var(--ease);
}
.card-header {
    background: transparent !important;
    border-bottom: 1px solid var(--border);
    padding: .9rem 1.15rem;
    font-weight: 600; font-size: .92rem;
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    border-radius: var(--radius) var(--radius) 0 0 !important;
}
.card-body { padding: 1.15rem; }
.card-footer { background: transparent !important; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius) !important; }

/* Section heading icon chip used inside card headers */
.head-ico {
    width: 30px; height: 30px; border-radius: .55rem;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .82rem; margin-right: .1rem;
}

/* Stat cards */
.stat-card { position: relative; overflow: hidden; }
.stat-card::after {
    content: ""; position: absolute; right: -28px; top: -28px;
    width: 96px; height: 96px; border-radius: 50%;
    background: currentColor; opacity: .05;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .card-body { display: flex; align-items: center; gap: .9rem; padding: 1.05rem 1.15rem; }
.stat-card .stat-icon {
    flex: 0 0 46px; width: 46px; height: 46px; border-radius: .7rem;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
}
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.05; letter-spacing: -.03em; }
.stat-card .stat-label { color: var(--text-muted); font-size: .78rem; font-weight: 500; }

/* Soft tinted surfaces for icons/badges */
.soft-primary { background: rgba(59, 113, 202, .12); color: var(--brand-500); }
.soft-success { background: rgba(20, 164, 77, .12);  color: var(--accent-green); }
.soft-warning { background: rgba(245, 165, 36, .14); color: #b9791a; }
.soft-danger  { background: rgba(244, 63, 94, .12);  color: var(--accent-rose); }
.soft-info    { background: rgba(18, 168, 157, .13); color: var(--accent-teal); }
.soft-violet  { background: rgba(124, 92, 255, .13); color: var(--accent-violet); }
.soft-muted   { background: var(--surface-3);        color: var(--text-muted); }
[data-theme="dark"] .soft-warning { color: #f0b95c; }

/* --------------------------------------------------------------------------
   7. Tables
   -------------------------------------------------------------------------- */
.table { color: var(--text); margin-bottom: 0; --mdb-table-hover-bg: transparent; }
.table > :not(caption) > * > * { background-color: transparent; }
.table thead th {
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
    white-space: nowrap;
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--border);
}
.table tbody td { padding: .75rem 1rem; vertical-align: middle; border-bottom: 1px solid var(--border); font-size: .875rem; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr { transition: background-color .14s var(--ease); }
.table-hover tbody tr:hover td { background: var(--surface-2); }
.table a { color: var(--brand-500); }
.table a:hover { color: var(--brand-600); }
.fc-nowrap { white-space: nowrap; }

.table-responsive { border-radius: 0 0 var(--radius) var(--radius); }

/* Timetable grid */
.table-bordered > :not(caption) > * > * { border-color: var(--border); }
.table .table-primary,
.table > :not(caption) > * > *.table-primary {
    background: rgba(59, 113, 202, .08) !important;
    color: var(--text) !important;
}
.break-row {
    background: var(--surface-3) !important;
    color: var(--text-muted);
    font-size: .78rem;
}

/* Horizontal scroll hint on narrow screens */
@media (max-width: 767.98px) {
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        background:
            linear-gradient(to right, var(--surface) 30%, rgba(255, 255, 255, 0)) left / 40px 100% no-repeat,
            linear-gradient(to left, var(--surface) 30%, rgba(255, 255, 255, 0)) right / 40px 100% no-repeat,
            radial-gradient(farthest-side at 0 50%, rgba(16, 24, 40, .12), transparent) left / 14px 100% no-repeat,
            radial-gradient(farthest-side at 100% 50%, rgba(16, 24, 40, .12), transparent) right / 14px 100% no-repeat;
        background-attachment: local, local, scroll, scroll;
    }
    .table thead th, .table tbody td { padding-inline: .7rem; }
}

/* Empty state */
.empty-state { padding: 2.5rem 1rem; text-align: center; color: var(--text-muted); }
.empty-state i { font-size: 1.9rem; color: var(--text-subtle); display: block; margin-bottom: .6rem; opacity: .7; }
.empty-state p { margin: 0; font-size: .875rem; }

/* --------------------------------------------------------------------------
   8. Buttons
   -------------------------------------------------------------------------- */
.btn {
    border-radius: .6rem;
    font-weight: 600; font-size: .85rem; letter-spacing: .01em; text-transform: none;
    padding: .5rem .95rem;
    box-shadow: none;
    transition: all .16s var(--ease);
}
.btn:hover, .btn:focus { box-shadow: none; }
.btn-sm { padding: .35rem .7rem; font-size: .78rem; border-radius: .5rem; }
.btn-lg { padding: .7rem 1.4rem; font-size: .95rem; border-radius: .7rem; }

.btn-primary {
    background: var(--brand-gradient); border: 0; color: #fff;
    box-shadow: 0 4px 12px -4px rgba(59, 113, 202, .55);
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    filter: brightness(1.06);
    box-shadow: 0 8px 18px -6px rgba(59, 113, 202, .65);
    transform: translateY(-1px);
}

.btn-light { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-light:hover { background: var(--surface-3); color: var(--text); }

[class*="btn-outline-"] { border-width: 1px; background: var(--surface); }
[class*="btn-outline-"]:hover { transform: translateY(-1px); }
.btn-outline-secondary { color: var(--text-muted); border-color: var(--border-strong); }
.btn-outline-secondary:hover { background: var(--surface-3); color: var(--text); border-color: var(--border-strong); }

/* Compact icon action buttons in table rows */
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* --------------------------------------------------------------------------
   9. Forms
   -------------------------------------------------------------------------- */
.form-label { font-size: .78rem; font-weight: 600; color: var(--text-muted); margin-bottom: .3rem; }

.form-control, .form-select, .input-group-text {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: .6rem;
    color: var(--text);
    font-size: .875rem;
    padding: .5rem .75rem;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background-color .15s var(--ease);
}
.form-control::placeholder { color: var(--text-subtle); }
.form-control:focus, .form-select:focus {
    background: var(--surface);
    border-color: var(--brand-400);
    box-shadow: 0 0 0 3px rgba(79, 140, 255, .16);
    color: var(--text);
}
.form-control-sm, .form-select-sm { padding: .35rem .6rem; font-size: .8rem; border-radius: .5rem; }
textarea.form-control { min-height: 92px; }
.form-check-input { border-color: var(--border-strong); }
.form-check-input:checked { background-color: var(--brand-500); border-color: var(--brand-500); }
.input-group-text { background: var(--surface-2); color: var(--text-muted); }

/* Filter toolbar card */
.filter-card .card-body { padding: .9rem 1.05rem; }

/* Status tab strip (workbook / worksheet lists) */
.tab-count-on { background: rgba(255, 255, 255, .25) !important; color: #fff !important; }

/* Sticky form action bar */
.form-actions {
    position: sticky; bottom: 0; z-index: 10;
    display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem;
    margin: 1.25rem -1.35rem -2rem;
    padding: .85rem 1.35rem;
    background: var(--surface); /* fallback for browsers without color-mix() */
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(10px);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    border-top: 1px solid var(--border);
}
@media (max-width: 991.98px) {
    .form-actions { margin: 1.25rem -.9rem -2rem; padding: .8rem .9rem; }
    .form-actions .btn { flex: 1 1 auto; }
}

/* Timetable slot chips inside the workbook form */
.tt-chip { border-radius: .6rem; font-weight: 500; }
.tt-chip.tt-done { opacity: .65; }

/* --------------------------------------------------------------------------
   10. Badges, alerts, dropdowns, pagination
   -------------------------------------------------------------------------- */
.badge {
    font-weight: 600; font-size: .7rem; letter-spacing: .02em;
    padding: .35em .65em; border-radius: .45rem;
}
.badge.bg-secondary { background: var(--surface-3) !important; color: var(--text-muted) !important; }
.badge.bg-success   { background: rgba(20, 164, 77, .14) !important; color: #0f8a41 !important; }
.badge.bg-info      { background: rgba(18, 168, 157, .15) !important; color: #0d857d !important; }
.badge.bg-warning   { background: rgba(245, 165, 36, .18) !important; color: #a56a10 !important; }
.badge.bg-danger    { background: rgba(244, 63, 94, .14) !important; color: #d32748 !important; }
.badge.bg-primary   { background: rgba(59, 113, 202, .14) !important; color: var(--brand-500) !important; }
.badge.bg-dark      { background: rgba(16, 24, 40, .12) !important; color: var(--text) !important; }
[data-theme="dark"] .badge.bg-success { color: #4ade80 !important; }
[data-theme="dark"] .badge.bg-info    { color: #5eead4 !important; }
[data-theme="dark"] .badge.bg-warning { color: #fbbf24 !important; }
[data-theme="dark"] .badge.bg-danger  { color: #fb7185 !important; }
[data-theme="dark"] .badge.bg-primary { color: #8fb4ff !important; }

.alert {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-xs);
    font-size: .875rem;
    padding: .75rem 1rem;
}
.alert-success { background: rgba(20, 164, 77, .10); color: #0f7a3d; border-color: rgba(20, 164, 77, .25); }
.alert-danger  { background: rgba(244, 63, 94, .09);  color: #c02744; border-color: rgba(244, 63, 94, .22); }
.alert-warning { background: rgba(245, 165, 36, .12); color: #9a6410; border-color: rgba(245, 165, 36, .28); }
.alert-info    { background: rgba(59, 113, 202, .10); color: var(--brand-600); border-color: rgba(59, 113, 202, .22); }

.dropdown-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    padding: .35rem;
    font-size: .875rem;
}
.dropdown-item { border-radius: .45rem; padding: .5rem .65rem; color: var(--text); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-2); color: var(--text); }
.dropdown-divider { border-color: var(--border); }

.notif-panel { width: 340px; max-height: 430px; overflow-y: auto; padding: 0; }
.notif-panel .panel-head {
    position: sticky; top: 0; z-index: 1; background: var(--surface);
    display: flex; align-items: center; justify-content: space-between;
    padding: .7rem .9rem; border-bottom: 1px solid var(--border); font-size: .82rem;
}
.notif-item { display: block; padding: .7rem .9rem; border-bottom: 1px solid var(--border); border-radius: 0; }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--surface-2); }
.notif-dot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand-400); margin-top: .4rem; }

.pagination { gap: .25rem; }
.page-link {
    border: 1px solid var(--border); border-radius: .5rem !important;
    color: var(--text-muted); background: var(--surface);
    font-size: .82rem; padding: .35rem .65rem;
}
.page-link:hover { background: var(--surface-2); color: var(--text); }
.page-item.active .page-link { background: var(--brand-gradient); border-color: transparent; color: #fff; }
.page-item.disabled .page-link { background: var(--surface-2); color: var(--text-subtle); }

/* Tabs / pills */
.nav-pills .nav-link { border-radius: .6rem; color: var(--text-muted); font-weight: 600; font-size: .85rem; }
.nav-pills .nav-link.active { background: var(--brand-50); color: var(--brand-600); }
[data-theme="dark"] .nav-pills .nav-link.active { background: rgba(79, 140, 255, .16); color: #9dc0ff; }

/* Progress */
.progress { background: var(--surface-3); border-radius: 999px; height: .5rem; }
.progress-bar { background: var(--brand-gradient); border-radius: 999px; }

/* Modals */
.modal-content { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.modal-header, .modal-footer { border-color: var(--border); }

/* List groups */
.list-group-item { background: var(--surface); border-color: var(--border); color: var(--text); }

/* Timeline used by the activity feed */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .t-ico {
    flex: 0 0 30px; width: 30px; height: 30px; border-radius: .55rem;
    display: inline-flex; align-items: center; justify-content: center; font-size: .72rem;
}
.timeline .t-body { font-size: .84rem; min-width: 0; }
.timeline .t-time { font-size: .72rem; color: var(--text-subtle); }

/* Chips (schedule slots etc.) */
.chip {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .4rem .7rem; border-radius: .6rem;
    background: var(--surface-2); border: 1px solid var(--border);
    font-size: .8rem; font-weight: 500; color: var(--text);
}
.chip i { color: var(--brand-500); font-size: .78rem; }

/* --------------------------------------------------------------------------
   11. Auth pages
   -------------------------------------------------------------------------- */
.auth-body {
    min-height: 100vh;
    display: grid; grid-template-columns: 1.05fr .95fr;
    background: var(--app-bg);
}
.auth-aside {
    position: relative; overflow: hidden;
    padding: 3rem;
    display: flex; flex-direction: column; justify-content: space-between;
    background: linear-gradient(150deg, #16233b 0%, #1e3a6d 45%, #3b71ca 100%);
    color: #e8eefb;
}
.auth-aside::before,
.auth-aside::after {
    content: ""; position: absolute; border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 70%);
}
.auth-aside::before { width: 420px; height: 420px; top: -120px; right: -110px; }
.auth-aside::after  { width: 320px; height: 320px; bottom: -110px; left: -90px; }
.auth-aside .aside-inner { position: relative; z-index: 1; }
.auth-aside h2 { color: #fff; font-weight: 700; font-size: 1.9rem; letter-spacing: -.03em; }
.auth-aside p { color: rgba(232, 238, 251, .82); }
.auth-feature { display: flex; gap: .8rem; align-items: flex-start; margin-top: 1.1rem; }
.auth-feature .f-ico {
    flex: 0 0 38px; width: 38px; height: 38px; border-radius: .65rem;
    background: rgba(255, 255, 255, .13); color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    backdrop-filter: blur(6px);
}
.auth-feature strong { color: #fff; font-size: .92rem; display: block; }
.auth-feature span { font-size: .82rem; color: rgba(232, 238, 251, .75); }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 2rem 1.5rem; }
.auth-card { width: 100%; max-width: 420px; }
.auth-logo {
    width: 58px; height: 58px; border-radius: 1rem; margin-bottom: 1rem;
    background: var(--brand-gradient); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
    box-shadow: 0 10px 24px -8px rgba(59, 113, 202, .7);
}
.auth-logo img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.auth-title { font-size: 1.5rem; font-weight: 700; margin-bottom: .2rem; }
.auth-sub { color: var(--text-muted); font-size: .875rem; margin-bottom: 1.4rem; }

.role-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: .4rem; margin-bottom: 1.15rem; }
.role-switch button {
    border: 1px solid var(--border); background: var(--surface);
    border-radius: .65rem; padding: .55rem .3rem;
    font-size: .78rem; font-weight: 600; color: var(--text-muted);
    display: flex; flex-direction: column; align-items: center; gap: .25rem;
    transition: all .16s var(--ease);
}
.role-switch button i { font-size: .95rem; }
.role-switch button:hover { border-color: var(--brand-300); color: var(--brand-500); }
.role-switch button.active {
    background: var(--brand-50); border-color: var(--brand-300); color: var(--brand-600);
    box-shadow: 0 4px 12px -6px rgba(59, 113, 202, .5);
}
[data-theme="dark"] .role-switch button.active { background: rgba(79, 140, 255, .16); color: #9dc0ff; }

.pw-field { position: relative; }
.pw-field .pw-toggle {
    position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
    border: 0; background: transparent; color: var(--text-subtle);
    padding: .3rem .45rem; border-radius: .4rem;
}
.pw-field .pw-toggle:hover { color: var(--brand-500); background: var(--surface-2); }

.auth-note {
    margin-top: 1.35rem; padding: .75rem .9rem;
    background: var(--surface-2); border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm); font-size: .78rem; color: var(--text-muted);
}

@media (max-width: 991.98px) {
    .auth-body { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
}

/* Centred single-card auth screens (forgot / reset password) */
.auth-simple {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(1100px 520px at 15% -10%, rgba(79, 140, 255, .30), transparent 60%),
        radial-gradient(900px 480px at 105% 110%, rgba(124, 92, 255, .28), transparent 60%),
        linear-gradient(160deg, #16233b 0%, #1b2b48 60%, #101828 100%);
}
.auth-simple .card { width: 100%; max-width: 430px; box-shadow: var(--shadow-lg); border: 0; }
.auth-simple .card-body { padding: 1.85rem; }
.auth-icon {
    width: 54px; height: 54px; border-radius: 1rem; margin: 0 auto 1rem;
    background: var(--brand-gradient); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
    box-shadow: 0 10px 22px -8px rgba(59, 113, 202, .7);
}

/* --------------------------------------------------------------------------
   12. Utilities & motion
   -------------------------------------------------------------------------- */
.hover-lift { transition: transform .18s var(--ease), box-shadow .18s var(--ease); }
.hover-lift:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.fade-up { animation: fadeUp .32s var(--ease) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* --------------------------------------------------------------------------
   13. Print
   -------------------------------------------------------------------------- */
@media print {
    .sidebar, .topbar, .app-footer, .no-print, .sidebar-backdrop { display: none !important; }
    .main-content { margin-left: 0 !important; }
    .content-wrap { padding: 0 !important; max-width: none; }
    body { background: #fff; }
    .card { box-shadow: none !important; border-color: #ddd !important; }
}
