/* GLOBAL STYLES
-------------------------------------------------- */
/* Padding below the footer and lighter body text */

body {
    padding-bottom: 40px;
    color: #5a5a5a;
    background-color: #FFFFFF;

    /* Blue accent palette */
    --accent-blue: #2563EB;
    --accent-blue-light: #EFF6FF;
    --accent-blue-border: #BFDBFE;
    --accent-blue-hover: rgba(37, 99, 235, 0.08);
    --accent-blue-active: rgba(37, 99, 235, 0.12);

    /* Posture readiness palette — single CSS source of truth, mirroring
       staffing.constants.LEVEL_COLORS / LEVEL_TEXT_COLORS (the Python source).
       Every posture surface (the duty grid .posture-level-*, the crew board
       wash .cs-cell-l*, and the officer console trend strip pL*) derives from
       these tokens so the levels read the same colour everywhere.
       (--posture-0 is the grid's light baseline-cell grey; LEVEL_COLORS[0]
       #6c757d is the heavier value used only for borders/strips in Python.) */
    --posture-0: #e9ecef;  --posture-text-0: #495057;
    --posture-1: #d4edda;  --posture-text-1: #155724;
    --posture-2: #a3d9a5;  --posture-text-2: #155724;
    --posture-3: #28a745;  --posture-text-3: #ffffff;
    --posture-4: #1e7e34;  --posture-text-4: #ffffff;
    --posture-5: #155724;  --posture-text-5: #ffffff;
    /* Pale washes (same hue family) for chip-bearing crew cells — kept light so
       the role-coloured initials chips stay legible on top. */
    --posture-wash-0: #f1f3f5;
    --posture-wash-1: #edf7ee;
    --posture-wash-2: #e3f3e5;
    --posture-wash-3: #d9efdb;
    --posture-wash-4: #cfead2;
    --posture-wash-5: #c5e6c9;
}

/* CUSTOMIZE THE NAVBAR
-------------------------------------------------- */

.navbar-wrapper > .container {
    padding-right: 0;
    padding-left: 0;
}
.navbar-wrapper .navbar {
    padding-right: 15px;
    padding-left: 15px;
}
.navbar-wrapper .navbar .container {
    width: auto;
}

/* Private navbar (navy) */
.navbar-private {
    background-color: #1A2332;
    border-bottom: 3px solid #CC3333;
}

.navbar-private .navbar-brand {
    color: #F1F5F9;
}


.navbar-private .navbar-text {
    color: #94A3B8;
}

.navbar-private .navbar-nav .nav-link {
    color: #F1F5F9;
}

/* ux-048: prevent page-wide horizontal scroll (clip, not hidden, to preserve sticky navbar) */
body { overflow-x: clip; }
.navbar-private .container-fluid { flex-wrap: nowrap; }
.navbar-private .navbar-brand { min-width: 0; overflow: hidden; }

/* Public navbar (dark red/inverse) */
.navbar-dark {
    background-color: #1A2332;
    border-color: #1A2332;
}
.navbar-dark .navbar-brand {
    color: #F1F5F9;
}
.navbar-dark .navbar-text {
    color: #F1F5F9;
}
.navbar-dark .navbar-nav .nav-link {
    color: #F1F5F9;
}

/* Public pages: offset for fixed-top navbar */
body.public-page {
    padding-top: 56px;
}

/* SIDEBAR NAVIGATION
-------------------------------------------------- */

.sidebar {
    width: 260px;
    background-color: #E2E8F0;
    border-right: 1px solid #CBD5E1;
    overflow-y: auto;
}

.sidebar .offcanvas-header {
    background-color: #1A2332;
    color: #F1F5F9;
}

.sidebar .nav-section-header {
    background-color: #1A2332;
    color: #F1F5F9;
    border-left: 3px solid #CC3333;
    padding: 0.5rem 0.75rem;
    margin: 0;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar .nav-section-header.section-active {
    border-left-width: 5px;
}

.sidebar .nav-section-header i {
    color: #F1F5F9;
}

.sidebar .nav-sublabel {
    font-size: 0.65rem;
    font-weight: 600;
    color: #64748B;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 1rem 0.125rem;
}

.sidebar .sidebar-search {
    padding: 0.5rem 0.75rem;
    background-color: #F8FAFC;
    border-bottom: 1px solid #CBD5E1;
    position: sticky;
    top: 0;
    z-index: 5;
}

.sidebar .sidebar-search input {
    width: 100%;
    padding: 0.3rem 0.5rem 0.3rem 1.75rem;
    border: 1px solid #CBD5E1;
    border-radius: 4px;
    font-size: 0.85rem;
    background: white url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2.5'><circle cx='11' cy='11' r='7'/><path d='M21 21l-4.35-4.35'/></svg>") 0.5rem center no-repeat;
}

.sidebar .sidebar-search input:focus {
    outline: none;
    border-color: var(--accent-blue, #3B82F6);
}

/* Hidden by search filter */
.sidebar .nav-hidden { display: none !important; }

.sidebar .accordion-button {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background-color: transparent;
    color: #333;
}

.sidebar .accordion-button:not(.collapsed) {
    background-color: var(--accent-blue-hover);
    color: #1A2332;
    box-shadow: none;
}

.sidebar .accordion-button:focus {
    box-shadow: none;
    border-color: transparent;
}

.sidebar .accordion-body {
    padding: 0;
}

.sidebar .accordion-body a {
    display: block;
    padding: 0.35rem 1rem 0.35rem 2rem;
    font-size: 0.85rem;
    color: #555;
    text-decoration: none;
}

.sidebar .accordion-body a:hover {
    background-color: var(--accent-blue-hover);
    color: #1A2332;
}

.sidebar .nav-link-single {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    color: #333;
    text-decoration: none;
}

.sidebar .nav-link-single:hover {
    background-color: var(--accent-blue-hover);
    color: #1A2332;
}

.sidebar .accordion-body a.active,
.sidebar .nav-link-single.active {
    background-color: var(--accent-blue-active);
    color: #1A2332;
    font-weight: 600;
    border-left: 3px solid var(--accent-blue);
    padding-left: calc(2rem - 3px);
}

.sidebar .nav-link-single.active {
    padding-left: calc(1rem - 3px);
}

/* Desktop: pin sidebar fixed, offset content */
@media (min-width: 992px) {
    .sidebar.offcanvas-lg {
        position: fixed !important;
        top: 56px;
        bottom: 0;
        left: 0;
        width: 260px !important;
        background-color: #E2E8F0 !important;
        border-right: 1px solid #CBD5E1;
        z-index: 1019;
        visibility: visible !important;
        transform: none !important;
    }

    .sidebar.offcanvas-lg .offcanvas-body {
        display: block !important;
        background-color: transparent !important;
        overflow-y: auto !important;
        height: 100%;
        padding: 0 !important;
    }

    .page-with-sidebar {
        margin-left: 260px;
        width: auto;
    }
}

/* Carousel and marketing content styles moved to avfd-modern.css */

/* Featurettes - Keep for About Us page */

.featurette-divider {
    margin: 80px 0;
}

.featurette-heading {
    font-weight: 300;
    line-height: 1;
    letter-spacing: -1px;
    color: #D91408;
}

.text-muted {
    color: #8295A6 !important;
}

@media (min-width: 768px) {
    .featurette-heading {
        font-size: 50px;
    }
}

@media (min-width: 992px) {
    .featurette-heading {
        margin-top: 120px;
    }
}

/* Heading colors */
h1 {
    color: #D91408;
}

h2 {
    color: #8295A6;
}

.no-padding {
    padding: 0;
}

.green{
  color: green;
}

.red{
    color:red;
}

.orange{
    color:orange;
}

.blue{
    color:blue;
}

.lightblue{
    color:#4B9CD3
}

/* Form validation feedback */
.invalid-feedback {
    font-size: 0.875rem;
}

/* ux-058: style Django's default as_p errorlist (red, no bullets, alert-like) */
ul.errorlist {
    list-style: none;
    margin: 0 0 0.5rem;
    padding: 0;
    color: #dc3545;
    font-size: 0.875rem;
    font-weight: 600;
}
ul.errorlist li { margin: 0; }

/* Heading consistency for private pages */
h3 {
    color: #5a5a5a;
}

/* Enabling prettier tables */
.table td.no_left_border {
    border-left: none;
}

.table td.no_right_border {
    border-right: none;
}

.table td.thick_left_border {
    border-left: 1px solid black;
}

.table td.thick_right_border {
    border-right: 1px solid black;
}

.table th.thick_left_border {
    border-left: 1px solid black;
}

.table th.thick_right_border {
    border-right: 1px solid black;
}

.table th.thick_top_border {
    border-top: 1px solid grey;
}

.table td.thick_top_border {
    border-top: 1px solid grey;
}

.table td.thin_left_border {
    border-left: 1px solid #ddd;
}

.table th.thin_left_border {
    border-left: .5px solid #ddd;
}

/* ── Today column highlight ── */
.duty-calendar th.today-col,
.duty-calendar td.today-col {
    background-color: rgba(37, 99, 235, 0.06);
}
.duty-calendar thead th.today-col {
    font-weight: 700;
}
/* Preserve posture level colors over today highlight */
.duty-calendar td.today-col.posture-level-0 { background-color: var(--posture-0); color: var(--posture-text-0); }
.duty-calendar td.today-col.posture-level-1 { background-color: var(--posture-1); color: var(--posture-text-1); }
.duty-calendar td.today-col.posture-level-2 { background-color: var(--posture-2); color: var(--posture-text-2); }
.duty-calendar td.today-col.posture-level-3 { background-color: var(--posture-3); color: var(--posture-text-3); }
.duty-calendar td.today-col.posture-level-4 { background-color: var(--posture-4); color: var(--posture-text-4); }
.duty-calendar td.today-col.posture-level-5 { background-color: var(--posture-5); color: var(--posture-text-5); }

/* ── Mini month calendar ── */
.mini-cal {
    min-width: 240px;
    user-select: none;
}
.mini-cal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}
.mini-cal-title {
    font-weight: 600;
    font-size: 0.85rem;
}
.mini-cal-nav {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    font-size: 0.75rem;
    color: #555;
    border-radius: 0.25rem;
}
.mini-cal-nav:hover {
    background-color: #e9ecef;
}
.mini-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    text-align: center;
    font-size: 0.75rem;
    line-height: 1;
}
.mini-cal-dow {
    font-weight: 600;
    color: #888;
    padding: 0.2rem 0;
    font-size: 0.65rem;
    text-transform: uppercase;
}
.mini-cal-day {
    padding: 0.3rem 0.15rem;
    cursor: pointer;
    border-radius: 0.2rem;
    color: #333;
}
.mini-cal-day:hover {
    background-color: #e9ecef;
}
.mini-cal-blank {
    cursor: default;
}
.mini-cal-blank:hover {
    background: none;
}
.mini-cal-active {
    background-color: #CC3333;
    color: #fff;
    font-weight: 600;
}
.mini-cal-active:hover {
    background-color: #a82a2a;
    color: #fff;
}
.mini-cal-today {
    outline: 2px solid #333;
    outline-offset: -2px;
}

/* ── Empty cell indicator ── */
.duty-calendar td .cell-empty {
    color: #ccc;
    font-size: 0.85em;
}

/* ── Legend ── */
.schedule-legend {
    font-size: 0.75rem;
    color: #666;
}
.schedule-legend .legend-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}
.schedule-legend .legend-label {
    font-weight: 600;
    color: #444;
}
.schedule-legend .legend-item {
    white-space: nowrap;
}

/* ── Collapsible shift group headers ── */
.shift-group-header {
    cursor: pointer;
    user-select: none;
    background-color: var(--accent-blue-light);
}
.shift-group-header:hover {
    background-color: #e9ecef;
}
.shift-group-header td {
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
    border-top: 2px solid #dee2e6;
}
.shift-group-header .toggle-icon {
    transition: transform 0.2s;
    display: inline-block;
}
.shift-group-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}
.shift-row.hidden-by-group,
.shift-row.hidden-by-filter {
    display: none;
}

/* ── Schedule header layout ── */
.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}
.schedule-header-left {
    flex: 1;
    min-width: 0;
}
.schedule-header-left h4 {
    font-size: 1.25rem;
    font-weight: 600;
}
.schedule-header-right {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}
@media (max-width: 767.98px) {
    .schedule-header {
        flex-direction: column;
        align-items: stretch;
    }
    .schedule-header-right {
        align-items: flex-start;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* ux-061: week-nav chevrons get a >=44px tap target on phones */
@media (max-width: 767.98px) {
    .week-nav .btn {
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

/* ── Role filter bar ── */
.role-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}
.role-filter-bar .btn {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
}
.role-filter-bar .btn.active {
    font-weight: 600;
}
.role-filter-bar .dropdown-item.active {
    background-color: transparent;
    color: inherit;
    font-weight: 600;
}
.role-filter-bar .dropdown-item {
    font-size: 0.85rem;
    padding: 0.3rem 1rem;
}

/* ── Inline sign-up button ── */
.signup-inline-btn {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-blue);
    background: none;
    border: 1px dashed var(--accent-blue);
    border-radius: 0.25rem;
    cursor: pointer;
    line-height: 1.3;
}
.signup-inline-btn:hover {
    background-color: var(--accent-blue);
    color: #fff;
    border-style: solid;
}

/* ── Officer Mode ── */
.officer-action-queue {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}
.action-queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.2rem 0;
    border-bottom: 1px solid #fff3cd;
}
.action-queue-item:last-child { border-bottom: none; }

.officer-readiness-bar {
    display: flex;
    align-items: center;
    gap: 2px;
}
.readiness-label { white-space: nowrap; }
.readiness-segment {
    flex: 1;
    text-align: center;
    padding: 0.2rem 0;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 0.2rem;
    color: #fff;
    cursor: default;
}
.readiness-green { background-color: #28a745; }
.readiness-amber { background-color: #e67e22; }
.readiness-red { background-color: #dc3545; }
.readiness-gray { background-color: #adb5bd; }

/* Gap dots hidden by default, visible only in officer view */
.officer-only-indicator { display: none; }
.officer-view .officer-only-indicator { display: inline; }

/* Officer view enhanced gap indicators */
.officer-view td.posture-level-0,
.officer-view td:not([class*="posture-level-"]) {
    border-left: 3px solid #e67e22;
}
.officer-view td[class*="posture-level-"]:not(.posture-level-0) {
    border-left: none;
}

/* ── Gap Filler Panel ── */
.gap-filler-panel {
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    background: #fff;
    margin-bottom: 0.75rem;
}
.gap-filler-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    background: var(--accent-blue-light);
    border-radius: 0.375rem 0.375rem 0 0;
    border-bottom: 1px solid #dee2e6;
}
.gap-filler-panel.collapsed .gap-filler-body {
    display: none;
}
.gap-filler-panel.collapsed .gap-filler-header {
    border-bottom: none;
    border-radius: 0.375rem;
}
.gap-filler-panel.collapsed .gap-filler-toggle i {
    transform: rotate(-90deg);
}
.gap-filler-toggle i {
    transition: transform 0.15s ease;
}
.gap-filler-body {
    max-height: 400px;
    overflow-y: auto;
}
.gap-filler-slot {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #eee;
}
.gap-filler-slot:last-child { border-bottom: none; }
.gap-filler-slot-header {
    font-size: 0.8rem;
    margin-bottom: 0.35rem;
    color: #495057;
}
.gap-filler-position {
    margin-left: 0.5rem;
    margin-bottom: 0.35rem;
}
.gap-filler-position-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 0.15rem;
}
.gap-filler-member {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.15rem 0;
    font-size: 0.8rem;
}
.gap-filler-member-name {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gap-filler-member-count {
    white-space: nowrap;
}
.gap-filler-invite-btn {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    white-space: nowrap;
}

/* ── Crew chip-density grid (committed duty schedule) ──
   Compact week table mirroring the availability board grammar: posture wash
   + role-colored initials chips in three position lanes. One table, desktop
   and mobile (horizontal scroll on narrow screens via .table-responsive). */
.cs-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 3px;
    table-layout: fixed;
}
.cs-grid thead th {
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
    color: #6c757d;
    padding: 0.2rem;
}
.cs-grid th.cs-shift-label {
    width: 8.5rem;
    text-align: left;
    font-size: 0.78rem;
    font-weight: 600;
    color: #212529;
    vertical-align: middle;
}
.cs-grid .cs-today { outline: 2px solid var(--accent-blue); outline-offset: -2px; }
.cs-cell {
    position: relative;
    min-height: 56px;
    border-radius: 6px;
    padding: 5px 6px 4px;
    vertical-align: top;
}
/* Posture wash — a LIGHT tint of the same green readiness ramp the grid uses
   (var(--posture-wash-*)), so toggling Grid<->Crew shows the same colour family
   per level; kept pale so the role-coloured chips stay legible on top. */
.cs-cell-l0 { background: var(--posture-wash-0); }
.cs-cell-l1 { background: var(--posture-wash-1); }
.cs-cell-l2 { background: var(--posture-wash-2); }
.cs-cell-l3 { background: var(--posture-wash-3); }
.cs-cell-l4 { background: var(--posture-wash-4); }
.cs-cell-l5 { background: var(--posture-wash-5); }
.cs-pbadge {
    position: absolute;
    top: 3px;
    right: 5px;
    font-size: 0.62rem;
    font-weight: 700;
    color: #495057;
}
.cs-lane {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-wrap: wrap;
    margin-bottom: 3px;
}
.cs-lane-icon { width: 13px; font-size: 0.7rem; text-align: center; flex: none; }
.cs-lane-fire .cs-lane-icon { color: #dc3545; }
.cs-lane-ems .cs-lane-icon { color: var(--accent-blue); }
.cs-lane-other .cs-lane-icon { color: #f59f00; }
.cs-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 0.62rem;
    font-weight: 600;
    color: #fff;
    flex: none;
}
.cs-chip-ff { background: #2fb344; }
.cs-chip-observer { background: transparent; color: #868e96; border: 1.5px solid #ced4da; }
.cs-chip-ems-driver  { background: #15aabf; }
.cs-chip-ems-tech    { background: #1098ad; }
.cs-chip-ems-trainee { background: #15aabf; border: 1.5px dashed #ffffff; }
.cs-chip-ems-student { background: #66d9e8; color: #0b525b; }
.cs-chip-oic { background: #4263eb; }
.cs-chip-collateral { background: #868e96; }
.cs-chip.cs-me { box-shadow: 0 0 0 2px #6ea8fe; }
.cs-chip.cs-pending {
    background: transparent !important;
    color: #b8860b;
    border: 1.5px dashed #f59f00;
}
.cs-chip.hidden-by-filter { display: none; }
.cs-more { font-size: 0.64rem; color: #6c757d; padding: 0 3px; align-self: center; }
.cs-cell-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 4px;
    font-size: 0.64rem;
    color: #6c757d;
    margin-top: 2px;
}
/* One "Sign up" button per cell (opens the role-picker modal) — replaces the
   busy row of per-position pills. */
.cs-signup-btn {
    font-size: 0.62rem;
    font-weight: 600;
    line-height: 1.3;
    padding: 2px 8px;
    border: 1px solid #6ea8fe;
    border-radius: 999px;
    color: #0a4bce;
    background: #fff;
    white-space: nowrap;
}
.cs-signup-btn:hover { background: #eaf1ff; }
.cs-signup-btn i { font-size: 0.58rem; }
.cs-add { font-size: 0.7rem; color: #adb5bd; }
.cs-foot-left { display: inline-flex; align-items: center; gap: 7px; }
.cs-details { font-size: 0.64rem; white-space: nowrap; text-decoration: none; }
.cs-details:hover { text-decoration: underline; }

/* Crew roster peek offcanvas */
.peek-lane-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #6c757d;
    margin-bottom: 0.2rem;
}
.peek-row { padding: 0.25rem 0; line-height: 1.45; border-bottom: 1px solid #f1f3f5; }
.peek-lane:last-child .peek-row:last-child { border-bottom: none; }

/* Mobile crew view: one day at a time, full-width chip cards with room to
   breathe. Reuses the chip lanes + posture wash (.cs-cell-l*) from the cell
   inner partial; .cs-mcard is position:relative so the inner .cs-pbadge anchors
   to the card corner. */
.crew-mobile-day-panel { display: none; }
.crew-mobile-day-panel.active { display: block; }
.cs-mcard {
    position: relative;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px 12px 8px;
    margin-bottom: 10px;
}
.cs-mcard-head {
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 8px;
    padding-bottom: 5px;
    padding-right: 2.4rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.07);
}
.cs-mcard .cs-lane { gap: 5px; margin-bottom: 6px; }
.cs-mcard .cs-chip { width: 30px; height: 30px; font-size: 0.72rem; }
.cs-mcard .cs-lane-icon { width: 18px; font-size: 0.85rem; }
.cs-mcard .cs-pbadge { top: 10px; right: 12px; font-size: 0.72rem; }
.cs-mcard .cs-cell-footer { margin-top: 8px; font-size: 0.72rem; }
.cs-mcard .cs-details { font-size: 0.78rem; }
.cs-mcard .cs-signup-btn { font-size: 0.78rem; padding: 4px 12px; }

@media (max-width: 991.98px) {
    .cs-grid th.cs-shift-label { width: 4.5rem; font-size: 0.68rem; }
    .cs-cell { padding: 4px; }
}

/* ── Gap indicator dot ── */
.gap-dot {
    color: #e67e22;
    font-size: 0.7rem;
    vertical-align: middle;
    margin-left: 0.25rem;
    cursor: default;
}

/* ── "Your week" hero (above the schedule) ── */
.myweek-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--accent-blue-light);
    border: 1px solid #dbe4f7;
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 1rem;
}
.myweek-main { min-width: 0; flex: 1 1 auto; }
.myweek-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #4263eb;
    margin-bottom: 6px;
}
.myweek-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.myweek-chip {
    background: #fff;
    border: 1px solid #cdd9f0;
    border-radius: 999px;
    padding: 3px 11px;
    font-size: 0.82rem;
    white-space: nowrap;
}
.myweek-chip strong { color: #1f3a8a; }
.myweek-nudge { font-size: 0.9rem; color: #495057; }
.myweek-nudge i { color: #4263eb; margin-right: 4px; }
.myweek-stats { display: flex; align-items: center; gap: 14px; flex: none; }
.myweek-ring {
    --pct: 0;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: conic-gradient(#2fb344 calc(var(--pct) * 1%), #dde5f0 0);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
}
.myweek-ring-inner {
    width: 47px;
    height: 47px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.05;
}
.myweek-ring-num { font-size: 1.05rem; font-weight: 700; color: #212529; }
.myweek-ring-den { font-size: 0.58rem; color: #6c757d; }
.myweek-meta { font-size: 0.82rem; color: #495057; }
.myweek-meta > div { margin-bottom: 2px; }

@media (max-width: 575.98px) {
    .myweek-stats { width: 100%; justify-content: space-between; }
}

/* ── Gamification: streak badge ── */
.my-streak-badge {
    color: #e67e22;
    font-weight: 600;
    white-space: nowrap;
}
.my-streak-badge i { color: #e67e22; }

/* ── Urgent sign-up styling ── */
.signup-urgent {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    background-color: #e67e22;
    border: 1px solid #e67e22;
    border-radius: 0.25rem;
    cursor: pointer;
}
.signup-urgent:hover {
    background-color: #d35400;
    border-color: #d35400;
    color: #fff;
}

/* ── Sign-up modal ── */
.signup-modal-info {
    background-color: var(--accent-blue-light);
    border-radius: 0.25rem;
    padding: 0.5rem 0.75rem;
}
#signupModal .modal-sm { max-width: 360px; }

/* ── Invite autocomplete ── */
.invite-search-wrapper { position: relative; }
.invite-search-results {
    position: absolute;
    z-index: 1050;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    max-height: 150px;
    overflow-y: auto;
    width: 100%;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.invite-result-item {
    padding: 0.3rem 0.5rem;
    font-size: 0.82rem;
    cursor: pointer;
}
.invite-result-item:hover { background-color: var(--accent-blue-light); }
.invite-tag {
    display: inline-block;
    background: #e9ecef;
    border-radius: 1rem;
    padding: 0.15rem 0.5rem;
    font-size: 0.78rem;
    margin: 0.15rem 0.15rem 0 0;
}
.invite-tag-remove {
    cursor: pointer;
    margin-left: 0.2rem;
    font-weight: bold;
    color: #6c757d;
}
.invite-tag-remove:hover { color: #dc3545; }

/* ── Consistent cell formatting ── */
.shift-entry { margin-bottom: 0.15rem; }
.shift-entry + .shift-entry { padding-top: 0.15rem; border-top: 1px dotted #eee; }
.shift-member { font-weight: 500; }
.shift-badges { font-size: 0.8em; opacity: 0.85; }
.shift-notes { display: block; font-size: 0.8em; color: #888; font-style: italic; }

/* ── Staffing summary dots (inline in table headers & mobile tabs) ── */
.summary-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.2rem;
    vertical-align: middle;
}
.summary-dot.status-green { background-color: #28a745; }
.summary-dot.status-yellow { background-color: #ffc107; }
.summary-dot.status-red { background-color: #dc3545; }
.summary-dot.status-gray { background-color: #ccc; }

/* Posture level cell backgrounds */
.posture-level-0 { background-color: var(--posture-0); color: var(--posture-text-0); }
.posture-level-1 { background-color: var(--posture-1); color: var(--posture-text-1); }
.posture-level-2 { background-color: var(--posture-2); color: var(--posture-text-2); }
.posture-level-3 { background-color: var(--posture-3); color: var(--posture-text-3); }
.posture-level-4 { background-color: var(--posture-4); color: var(--posture-text-4); }
.posture-level-5 { background-color: var(--posture-5); color: var(--posture-text-5); }
/* Override Bootstrap .table td background (higher specificity needed) */
.duty-calendar td.posture-level-0 { background-color: var(--posture-0); color: var(--posture-text-0); }
.duty-calendar td.posture-level-1 { background-color: var(--posture-1); color: var(--posture-text-1); }
.duty-calendar td.posture-level-2 { background-color: var(--posture-2); color: var(--posture-text-2); }
.duty-calendar td.posture-level-3 { background-color: var(--posture-3); color: var(--posture-text-3); }
.duty-calendar td.posture-level-4 { background-color: var(--posture-4); color: var(--posture-text-4); }
.duty-calendar td.posture-level-5 { background-color: var(--posture-5); color: var(--posture-text-5); }

/* ── Mobile card view ── */
.mobile-schedule { display: none; }
.mobile-day-tabs {
    display: flex;
    overflow-x: auto;
    gap: 0;
    border-bottom: 2px solid #dee2e6;
    -webkit-overflow-scrolling: touch;
}
.mobile-day-tabs .day-tab {
    flex: 0 0 auto;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    border: none;
    background: none;
    cursor: pointer;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    color: #666;
}
.mobile-day-tabs .day-tab.active {
    color: #CC3333;
    border-bottom-color: #CC3333;
    font-weight: 700;
}
.mobile-day-panel { display: none; }
.mobile-day-panel.active { display: block; }
.mobile-shift-card {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    overflow: hidden;
}
.mobile-shift-card-header {
    background-color: var(--accent-blue-light);
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
    border-bottom: 1px solid #dee2e6;
}
.mobile-shift-card-body { padding: 0; }
.mobile-position-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f0f0f0;
    gap: 0.5rem;
}
.mobile-position-row:last-child { border-bottom: none; }
.mobile-position-label {
    font-weight: 500;
    font-size: 0.85rem;
    min-width: 110px;
    flex-shrink: 0;
    color: #555;
}
.mobile-position-content {
    flex: 1;
    font-size: 0.85rem;
    text-align: right;
}
.mobile-position-content .cell-empty { color: #ccc; }

/* ── Responsive: hide desktop table, show mobile on small screens ── */
/* Note: no !important here so that Bootstrap's d-none (!important) can
   override these defaults when JS toggles between Grid / Crew views. */
@media (max-width: 991.98px) {
    .desktop-schedule { display: none; }
    .mobile-schedule { display: block; }
    .crew-schedule { display: none; }
    .crew-schedule-mobile { display: block; }
}
@media (min-width: 992px) {
    .desktop-schedule { display: block; }
    .mobile-schedule { display: none; }
    .crew-schedule-mobile { display: none; }
}

/* Duty schedule calendar desktop responsive */
@media (max-width: 768px) {
    .duty-calendar td, .duty-calendar th {
        font-size: 0.75rem;
        padding: 0.25rem;
    }
}

/* Posture level link colors (keep links readable on dark backgrounds) */
.posture-level-3 a, .posture-level-4 a, .posture-level-5 a,
.duty-calendar td.posture-level-3 a,
.duty-calendar td.posture-level-4 a,
.duty-calendar td.posture-level-5 a {
    color: #ffffff;
}
.posture-level-0 a, .posture-level-1 a, .posture-level-2 a,
.duty-calendar td.posture-level-0 a,
.duty-calendar td.posture-level-1 a,
.duty-calendar td.posture-level-2 a {
    color: #155724;
}

/* ── Accent utility classes (opt-in via template classes) ── */

/* Card left-border accents */
.card-accent-blue {
    border-left: 3px solid var(--accent-blue);
}

.card-accent-green {
    border-left: 3px solid #22C55E;
}

.card-accent-red {
    border-left: 3px solid #DC2626;
}

/* Colored stat boxes */
.stat-box-blue {
    background-color: var(--accent-blue-light);
    border: 1px solid var(--accent-blue-border);
    border-radius: 0.25rem;
}
.stat-box-blue .stat-value { color: var(--accent-blue); }
.stat-box-blue .stat-label { color: #1E40AF; }

.stat-box-green {
    background-color: #F0FDF4;
    border: 1px solid #BBF7D0;
    border-radius: 0.25rem;
}
.stat-box-green .stat-value { color: #16A34A; }
.stat-box-green .stat-label { color: #166534; }

.stat-box-red {
    background-color: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: 0.25rem;
}
.stat-box-red .stat-value { color: #DC2626; }
.stat-box-red .stat-label { color: #991B1B; }

/* ux-107: larger tap targets for sidebar sub-links on touch/phones */
@media (max-width: 991.98px) {
    .sidebar .accordion-body a,
    .sidebar .nav-link-single { padding-top: 0.7rem; padding-bottom: 0.7rem; min-height: 44px; }
}
