/* ==========================================================================
   TCAT Crump EMT Clinical Tracking and Documentation System
   Theme stylesheet.

   To rebrand, change the brand variables in the :root block below. Drop a
   logo image at static/img/logo.png and it replaces the text wordmark
   automatically (see base.html).
   ========================================================================== */

:root {
    /* Official TCAT Crump / Tennessee Board of Regents palette.
       Change these to retheme the whole application. */
    --brand:        #00539b;   /* TCAT Crump institutional blue */
    --brand-dark:   #00427c;
    --header:       #1c2532;   /* dark navy top bar */

    /* Functional status colors */
    --accent:       #34c98a;   /* complete / success / active (brand green) */
    --accent-dark:  #1f9d6b;
    --warn:         #eaa93a;   /* incomplete (brand amber) */
    --danger:       #c8102e;   /* missing / error (brand red) */
    --info:         #00539b;

    /* Neutrals */
    --ink:          #1c2532;
    --muted:        #5b6a7d;
    --line:         #e3e7ec;
    --line-strong:  #cfd6df;
    --bg:           #f4f6f9;
    --work:         #ffffff;
    --shade:        #eef2f7;

    --radius:       8px;
    --radius-sm:    5px;
    --shadow:       0 1px 3px rgba(20,30,45,.08), 0 1px 2px rgba(20,30,45,.06);
    --shadow-lg:    0 8px 24px rgba(20,30,45,.14);
    --font: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { height: 100%; }
body {
    margin: 0; padding: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.45;
    /* Sticky footer: fill at least the viewport so the footer sits at the
       bottom on short pages and flows below content on long ones. */
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
main { flex: 1 0 auto; }
.tc-foot { flex-shrink: 0; }

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Top bar
   -------------------------------------------------------------------------- */
.topbar {
    display: flex; align-items: center;
    background: var(--header);
    color: #fff;
    height: 58px;
    padding: 0 16px;
    position: sticky; top: 0; z-index: 50;
}
.topbar .home {
    color: #fff; font-size: 20px; margin-right: 14px; opacity: .85;
    display: inline-flex; text-decoration: none;
}
/* TCAT Crump brand lockup in the header */
.tc-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: #fff; }
.tc-brand:hover { text-decoration: none; }
.tc-logo { height: 38px; width: auto; display: block; flex: 0 0 auto; }
.tc-word { display: flex; flex-direction: column; line-height: 1; }
.tc-word b { font-style: italic; font-weight: 800; font-size: 19px; color: #fff; letter-spacing: .5px; }
.tc-word small { font-size: 9.5px; font-weight: 800; letter-spacing: 3px; color: #cfd6df; margin-top: 3px; }
.tc-sep { width: 1px; height: 30px; background: #3a4653; margin: 0 4px; }
.tc-dept {
    font-size: 12px; color: #b7c0cc; text-transform: uppercase;
    letter-spacing: 1px; line-height: 1.15; max-width: 190px;
}
@media (max-width: 720px) { .tc-sep, .tc-dept { display: none; } }
.topbar .context {
    margin-left: 22px; padding-left: 22px; border-left: 1px solid #3a4653;
}
.topbar .context .label {
    font-size: 10px; letter-spacing: 1.5px; color: #8b97a5; text-transform: uppercase;
}
.topbar .context .value { font-size: 16px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.topbar .tools { display: flex; align-items: center; gap: 8px; }
.topbar .tool {
    color: #cdd5de; background: transparent; border: 0; cursor: pointer;
    padding: 8px 10px; border-radius: 6px; font-size: 14px; position: relative;
    display: inline-flex; align-items: center; gap: 7px; text-decoration: none;
}
.topbar .tool:hover { background: #2c3644; color: #fff; text-decoration: none; }
.badge-count {
    position: absolute; top: 2px; right: 2px; background: var(--danger);
    color: #fff; font-size: 10px; font-weight: 700; border-radius: 9px;
    min-width: 16px; height: 16px; line-height: 16px; text-align: center; padding: 0 4px;
}

/* User menu */
.usermenu { position: relative; }
.usermenu-panel {
    display: none; position: absolute; right: 0; top: 46px; background: var(--work);
    color: var(--ink); border-radius: var(--radius); box-shadow: var(--shadow-lg);
    min-width: 210px; overflow: hidden; z-index: 60;
}
.usermenu-panel.open { display: block; }
.usermenu-panel .who { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.usermenu-panel .who .name { font-weight: 700; }
.usermenu-panel .who .role { font-size: 12px; color: var(--muted); }
.usermenu-panel a {
    display: block; padding: 10px 14px; color: var(--ink); font-size: 14px;
}
.usermenu-panel a:hover { background: var(--shade); text-decoration: none; }

/* --------------------------------------------------------------------------
   Primary navigation (second tier)
   -------------------------------------------------------------------------- */
.mainnav {
    background: var(--brand);
    display: flex; align-items: stretch; flex-wrap: wrap;
    box-shadow: var(--shadow);
}
@media (max-width: 600px) {
    .mainnav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
    .mainnav::-webkit-scrollbar { display: none; }
    .mainnav a { padding: 12px 12px; font-size: 11.5px; }
}
.mainnav a {
    color: #f4dfe2; text-decoration: none; padding: 13px 11px; font-size: 12px;
    font-weight: 600; letter-spacing: .4px; text-transform: uppercase;
    display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
    border-bottom: 3px solid transparent;
}
.mainnav a:hover { background: var(--brand-dark); color: #fff; text-decoration: none; }
.mainnav a.active { background: var(--brand-dark); color: #fff; border-bottom-color: var(--accent); }

/* Section tabs used inside the charting workspace */
.sectionnav {
    background: var(--brand);
    display: flex; align-items: stretch; overflow-x: auto;
}
.sectionnav a {
    color: #f4dfe2; text-decoration: none; padding: 12px 18px; font-size: 12px;
    font-weight: 600; letter-spacing: .5px; text-transform: uppercase;
    display: inline-flex; flex-direction: column; align-items: center; gap: 4px;
    white-space: nowrap; border-bottom: 3px solid transparent; min-width: 92px;
}
.sectionnav a:hover { background: var(--brand-dark); color: #fff; text-decoration: none; }
.sectionnav a.active { background: var(--work); color: var(--brand); border-bottom-color: var(--accent); }
.sectionnav .status-dot { width: 8px; height: 8px; border-radius: 50%; }

/* --------------------------------------------------------------------------
   Layout: work area with optional left submenu
   -------------------------------------------------------------------------- */
.layout { display: flex; min-height: calc(100vh - 116px); }
.submenu {
    width: 216px; flex-shrink: 0; background: var(--work);
    border-right: 1px solid var(--line); padding: 14px 12px;
    position: sticky; top: 116px; align-self: flex-start;
    max-height: calc(100vh - 116px); overflow-y: auto;
}
.submenu a {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px; margin-bottom: 4px; color: var(--ink); text-decoration: none;
    font-size: 14px; font-weight: 600; border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
}
.submenu a:hover { background: var(--shade); text-decoration: none; }
.submenu a.active { background: var(--accent); color: #fff; }
.submenu .submenu-back {
    margin-top: 12px; padding-top: 14px; border-top: 1px solid var(--line);
    color: var(--info); font-weight: 600; border-radius: 0; border-left: 0;
}
.submenu .submenu-back:hover { background: transparent; color: var(--brand); }
.submenu .dot { width: 8px; height: 8px; border-radius: 50%; }

.work { flex: 1; padding: 26px 34px; max-width: 1100px; }
.work.wide { max-width: none; }

.section-head {
    display: flex; align-items: center; gap: 12px; padding: 14px 0 18px;
    border-bottom: 1px solid var(--line); margin-bottom: 22px;
}
.section-head .icon { width: 34px; height: 34px; color: var(--brand); }
.section-head h1 { font-size: 22px; margin: 0; font-weight: 700; }
.section-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* Status dots */
.dot-complete { background: var(--accent); }
.dot-incomplete { background: var(--warn); }
.dot-missing { background: var(--danger); }
.dot-neutral { background: var(--line-strong); }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field { margin-bottom: 22px; max-width: 640px; }
.field > label {
    display: block; font-size: 12px; letter-spacing: .6px; color: var(--muted);
    text-transform: uppercase; margin-bottom: 6px; font-weight: 600;
}
.field input[type=text], .field input[type=number], .field input[type=date],
.field input[type=time], .field input[type=email], .field input[type=password],
.field input[type=datetime-local], .field select, .field textarea,
input.line, select.line, textarea.line {
    width: 100%; border: 0; border-bottom: 2px solid var(--line-strong);
    background: transparent; padding: 9px 2px; font-size: 16px; color: var(--ink);
    font-family: inherit;
}
.field textarea { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 12px; min-height: 120px; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--brand);
}
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

/* Option button groups, like the reference chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
    background: var(--shade); border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm); padding: 12px 18px; font-size: 15px;
    cursor: pointer; color: var(--ink); user-select: none; min-width: 120px;
    text-align: center; transition: all .12s; position: relative;
}
.chip:hover { border-color: var(--brand); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip.selected { background: var(--brand); border-color: var(--brand); color: #fff; }

.row { display: flex; gap: 20px; flex-wrap: wrap; }
.row .field { flex: 1; min-width: 160px; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
    background: var(--accent); color: #fff; border: 0; border-radius: var(--radius-sm);
    padding: 12px 22px; font-size: 14px; font-weight: 700; cursor: pointer;
    text-decoration: none; font-family: inherit; letter-spacing: .3px;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; color: #fff; }
.btn.secondary { background: var(--shade); color: var(--ink); border: 1px solid var(--line-strong); }
.btn.secondary:hover { background: var(--line); color: var(--ink); }
.btn.brand { background: var(--brand); }
.btn.brand:hover { background: var(--brand-dark); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 7px 13px; font-size: 12.5px; }
.btn.block { display: flex; width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-plain {
    background: none; border: 0; color: var(--danger); cursor: pointer;
    font-size: 13px; font-family: inherit; padding: 4px 6px;
}
.btn-plain:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   Cards, panels, tables
   -------------------------------------------------------------------------- */
.card {
    background: var(--work); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px;
}
.card .card-head {
    padding: 14px 18px; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between;
}
.card .card-head h2 { font-size: 15px; margin: 0; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.card .card-body { padding: 18px; }

.grid { display: grid; gap: 20px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.stat {
    background: var(--work); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 18px; box-shadow: var(--shadow);
}
.stat .num { font-size: 30px; font-weight: 800; color: var(--brand); line-height: 1.1; }
.stat .num.ok { color: var(--accent); }
.stat .num.warn { color: var(--warn); }
.stat .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin-top: 4px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 6px; }

table.data { width: 100%; border-collapse: collapse; background: var(--work); }
table.data th {
    text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
    color: var(--muted); padding: 10px 12px; border-bottom: 2px solid var(--line);
    white-space: nowrap;
}
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
table.data tr:hover td { background: var(--shade); }
table.data .num-cell { text-align: right; font-variant-numeric: tabular-nums; }
table.data th.num-cell { text-align: right; }

/* progress bar */
.progress { height: 8px; background: var(--line); border-radius: 5px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); }
.progress.warn > span { background: var(--warn); }

/* Pills / badges */
.pill {
    display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11.5px;
    font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
}
.pill.green { background: #e3f5ea; color: var(--accent-dark); }
.pill.amber { background: #fbeed6; color: #94620f; }
.pill.red   { background: #fbe4e1; color: #a02b1c; }
.pill.gray  { background: var(--shade); color: var(--muted); }
.pill.blue  { background: #e1ecf7; color: var(--info); }

/* Flash messages */
.flashes { margin: 0 0 18px; }
.flash {
    padding: 12px 16px; border-radius: var(--radius); margin-bottom: 10px; font-size: 14px;
    border-left: 4px solid var(--info); background: #eaf2fb;
}
.flash.success { border-left-color: var(--accent); background: #e8f6ee; }
.flash.error { border-left-color: var(--danger); background: #fbe9e7; }
.flash.info { border-left-color: var(--info); background: #eaf2fb; }

/* Signature pad */
.sigpad-wrap { max-width: 520px; }
.sigpad {
    border: 2px dashed var(--line-strong); border-radius: var(--radius);
    background: var(--sig-bg, #fff); touch-action: none; width: 100%; height: 170px; display: block;
}
.sig-actions { display: flex; gap: 10px; margin-top: 10px; }
.sig-saved img { border: 1px solid var(--line); border-radius: var(--radius); background: var(--sig-bg, #fff); max-width: 100%; }

/* Login */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--header) 0%, #2c3644 100%);
    padding: 20px;
}
.login-card {
    background: var(--work); border-radius: 12px; box-shadow: var(--shadow-lg);
    width: 100%; max-width: 400px; overflow: hidden;
}
.login-card::before { content: ""; display: block; height: 4px; background: linear-gradient(90deg, var(--brand) 0 55%, var(--danger) 55% 100%); }
.login-card .head { background: var(--header); color: #fff; padding: 30px 30px 24px; text-align: center; }
.login-card .head .login-logo { height: 66px; width: auto; display: block; margin: 0 auto 12px; }
.login-card .head .login-word b { font-style: italic; font-weight: 800; font-size: 26px; }
.login-card .head .login-word small { font-size: 12px; font-weight: 800; letter-spacing: 5px; margin-left: 3px; color: #cfd6df; }
.login-card .head .sub { margin-top: 10px; font-size: 12px; opacity: .85; letter-spacing: 1.5px; text-transform: uppercase; }
.login-card .head .badge {
    background: rgba(255,255,255,.15); display: inline-block; padding: 8px 16px;
    border-radius: 6px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; font-size: 20px;
}
.login-card .head .sub { margin-top: 12px; font-size: 13px; opacity: .9; letter-spacing: .5px; }
.login-card .body { padding: 28px 30px 32px; }
.login-card .demo { margin-top: 18px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; }
.login-card .demo code { background: var(--shade); padding: 1px 5px; border-radius: 3px; }

/* Empty state */
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .big { font-size: 15px; font-weight: 600; color: var(--ink); }

.section-block { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 8px; }
.section-block > h2 {
    font-size: 16px; text-transform: uppercase; letter-spacing: .6px;
    color: var(--ink); margin: 14px 0 16px;
}

.inline-form { display: inline; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mt { margin-top: 18px; }
.mb { margin-bottom: 18px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 820px) {
    .layout { flex-direction: column; }
    .submenu {
        width: 100%; display: flex; overflow-x: auto; border-right: 0;
        border-bottom: 1px solid var(--line); padding: 8px;
        position: sticky; top: 106px; max-height: none; z-index: 20; gap: 6px;
    }
    .submenu a { border-left: 0; white-space: nowrap; margin-bottom: 0; }
    .submenu a.active { border-left: 0; }
    .submenu .submenu-back { border-top: 0; margin-top: 0; padding-top: 11px; }
    .work { padding: 20px 16px; }
    .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
    .wordmark .subtitle { display: none; }
    .topbar .context { margin-left: 12px; padding-left: 12px; }
    /* On a tablet or phone the clock in/out card comes first, since that is
       the first thing a student needs when they arrive on site. */
    .ws-grid .ws-right { order: -1; }
    .topbar .context .value { font-size: 14px; }
}


@media (max-width: 520px) {
    .wordmark .subtitle { display: none; }
    .stat .num { font-size: 24px; }
    .work { padding: 16px 12px; }
    .sectionnav a { min-width: 76px; padding: 10px 12px; font-size: 10.5px; }
}

/* --------------------------------------------------------------------------
   Month calendar grid
   -------------------------------------------------------------------------- */
.cal-toolbar {
    display: flex; align-items: center; gap: 12px; margin-bottom: 16px;
}
.cal-toolbar h2 { margin: 0; font-size: 20px; min-width: 180px; text-align: center; }
.cal-toolbar .spacer { flex: 1; }
.cal-nav {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 8px; border: 1px solid var(--line-strong);
    background: var(--work); color: var(--ink); cursor: pointer; text-decoration: none;
    font-size: 18px; line-height: 1;
}
.cal-nav:hover { background: var(--shade); text-decoration: none; }

.calendar {
    width: 100%; border-collapse: collapse; table-layout: fixed;
    background: var(--work); border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.calendar th {
    background: var(--shade); color: var(--muted); font-size: 11px;
    text-transform: uppercase; letter-spacing: .6px; padding: 9px 6px;
    text-align: left; border-bottom: 1px solid var(--line);
}
.calendar td {
    vertical-align: top; height: 108px; width: 14.28%;
    border: 1px solid var(--line); padding: 4px 5px 6px;
}
.calendar td.empty { background: var(--shade); }
.calendar td.today { background: #fdf6ee; }
.cal-daynum {
    font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 4px;
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px; border-radius: 50%;
}
.calendar td.today .cal-daynum { background: var(--brand); color: #fff; }

.cal-shift {
    display: block; width: 100%; text-align: left; border: 0; cursor: pointer;
    background: var(--shade); color: var(--ink); border-left: 3px solid var(--muted);
    border-radius: 4px; padding: 4px 6px; margin-bottom: 4px; font-size: 11.5px;
    line-height: 1.25; font-family: inherit; text-decoration: none;
}
.cal-shift:hover { filter: brightness(.97); text-decoration: none; }
.cal-shift .t { font-weight: 700; display: block; }
.cal-shift .p { color: var(--muted); display: block; }
.cal-shift.open   { border-left-color: var(--info); background: #eaf2fb; }
.cal-shift.mine   { border-left-color: var(--accent); background: #e8f6ee; }
.cal-shift.full   { border-left-color: var(--muted); }

@media (max-width: 820px) {
    .calendar td { height: auto; min-height: 64px; }
    .calendar th:nth-child(n), .cal-shift .p { font-size: 10px; }
    .cal-shift .p, .cal-shift .te { display: none; }
    .cal-shift .t { white-space: normal; }
}

/* --------------------------------------------------------------------------
   Collapsible review groups (native details/summary)
   -------------------------------------------------------------------------- */
.review-group { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; background: var(--work); box-shadow: var(--shadow); overflow: hidden; }
.review-group > summary {
    list-style: none; cursor: pointer; padding: 14px 18px;
    display: flex; align-items: center; gap: 12px;
}
.review-group > summary::-webkit-details-marker { display: none; }
.review-group > summary::before {
    content: ""; width: 0; height: 0; border-left: 6px solid var(--muted);
    border-top: 5px solid transparent; border-bottom: 5px solid transparent;
    transition: transform .15s; flex-shrink: 0;
}
.review-group[open] > summary::before { transform: rotate(90deg); }
.review-group > summary .who { font-weight: 700; }
.review-group > summary .spacer { flex: 1; }
.review-group .group-body { border-top: 1px solid var(--line); }

/* --------------------------------------------------------------------------
   Charting: subsection tab panels and sticky action footer
   -------------------------------------------------------------------------- */
.chart-panel, .card[id^="sub-"], #sub-vital-sets { display: none; }
.chart-panel.active, .card[id^="sub-"].active, #sub-vital-sets.active { display: block; }
.chart-panel.active { animation: panelin .12s ease; }
@keyframes panelin { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.panel-title {
    font-size: 18px; font-weight: 700; margin: 0 0 18px; padding-bottom: 12px;
    border-bottom: 1px solid var(--line); color: var(--ink);
}

/* Completion markers in the sidebar */
.submenu a { position: relative; }
.submenu a .sub-ic { display: inline-flex; flex-shrink: 0; }
.sub-ic .ic-done, .sub-ic .ic-todo, .sec-ic .ic-done, .sec-ic .ic-todo { display: none; }
.sub-ic.done .ic-done { display: inline-flex; }
.sub-ic.todo .ic-todo, .sub-ic.opt .ic-todo { display: inline-flex; }
.submenu a .sub-ic.done { color: var(--accent); }
.submenu a .sub-ic.todo { color: var(--line-strong); }
.submenu a .sub-ic.opt { color: var(--line-strong); opacity: .55; }
.submenu a .sub-label { flex: 1; }
.submenu a.active .sub-ic { color: #fff; }

/* Completion markers in the top section tabs */
.sectionnav .sec-ic { display: inline-flex; margin-left: 5px; vertical-align: middle; }
.sec-ic.done .ic-done { display: inline-flex; }
.sec-ic.todo .ic-todo { display: inline-flex; }
.sectionnav a .sec-ic.done { color: var(--accent); }
.sectionnav a .sec-ic.todo { color: #d7b4ba; }
.sectionnav a.active .sec-ic.todo { color: var(--line-strong); }

.chart-footer {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    background: var(--work); border-top: 1px solid var(--line-strong);
    box-shadow: 0 -2px 8px rgba(20,30,45,.06);
    display: flex; align-items: center; gap: 10px; padding: 12px 22px;
}
@media (max-width: 820px) {
    .chart-footer { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
    .chart-footer .btn { padding: 10px 14px; font-size: 13px; }
}

/* Sticky bulk action bar for the compliance portal */
.bulk-bar {
    position: sticky; bottom: 0; z-index: 30;
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    background: var(--work); border: 1px solid var(--line-strong);
    border-radius: var(--radius); box-shadow: 0 -2px 10px rgba(20,30,45,.08);
    padding: 14px 18px; margin-top: 6px;
}
@media (max-width: 560px) {
    .bulk-bar .btn { width: 100%; }
}

/* --------------------------------------------------------------------------
   TCAT Crump branded footer
   -------------------------------------------------------------------------- */
.tc-foot { background: var(--header); color: #cfd6df; margin-top: 40px; }
.tc-foot-in {
    max-width: 1180px; margin: 0 auto; padding: 26px 22px;
    display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
}
.tc-foot-brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.tc-foot-brand img { height: 44px; width: auto; display: block; }
.tc-foot-brand .tc-fw { display: flex; flex-direction: column; line-height: 1; }
.tc-foot-brand .tc-fw b { font-style: italic; font-weight: 800; font-size: 20px; color: #fff; }
.tc-foot-brand .tc-fw small { font-size: 9.5px; font-weight: 800; letter-spacing: 3px; color: #cfd6df; margin-top: 3px; }
.tc-foot-txt { flex: 1; min-width: 240px; }
.tc-foot-txt p { margin: 0 0 6px; font-size: 12.5px; line-height: 1.5; color: #9db1c9; }
.tc-foot-txt p:last-child { margin-bottom: 0; color: #7f8ea3; }
.tc-foot-bar { height: 4px; background: linear-gradient(90deg, var(--brand) 0 55%, var(--danger) 55% 100%); }

/* --------------------------------------------------------------------------
   Branded error page (404 / 403 / 413)
   -------------------------------------------------------------------------- */
.error-page {
    display: flex; align-items: center; justify-content: center;
    text-align: center; padding: 48px 20px; min-height: 55vh;
}
.error-card { max-width: 440px; }
.error-card .error-logo { height: 84px; width: auto; display: block; margin: 0 auto 18px; }
.error-card .error-code {
    font-size: 66px; font-weight: 800; line-height: 1; color: var(--brand);
    letter-spacing: -1px;
}
.error-card .error-code.small { font-size: 30px; letter-spacing: 0; }
.error-card .error-msg { margin: 10px 0 24px; font-size: 16px; color: var(--muted); }
.error-card .btn { display: inline-flex; }

/* --------------------------------------------------------------------------
   Dark theme. Overrides the neutral palette; brand/status hues are tuned
   for contrast on dark surfaces. Applied via data-theme="dark" on <html>.
   -------------------------------------------------------------------------- */
[data-theme="dark"] {
    --brand:        #2f83d6;   /* lifted blue for contrast on dark */
    --brand-dark:   #256bb0;
    --info:         #5aa2e6;   /* links */
    --accent:       #34c98a;
    --accent-dark:  #2aa876;
    --warn:         #eaa93a;
    --danger:       #e0555f;

    --ink:          #e6ebf2;
    --muted:        #9db1c9;
    --line:         #2a3441;
    --line-strong:  #3a4757;
    --bg:           #0f141b;
    --work:         #1a2330;
    --shade:        #232f3f;

    --shadow:       0 1px 3px rgba(0,0,0,.45), 0 1px 2px rgba(0,0,0,.4);
    --shadow-lg:    0 10px 30px rgba(0,0,0,.55);
    color-scheme: dark;
}

/* Surfaces that need a specific dark value */
[data-theme="dark"] .calendar td.today { background: #22303f; }
[data-theme="dark"] .pill.amber { background: #3a2f16; color: #f0c268; }
[data-theme="dark"] .pill.red   { background: #3a1f22; color: #f0949a; }
[data-theme="dark"] .pill.green { background: #16352a; color: #6fdcae; }
[data-theme="dark"] .flash.error { background: #3a1f22; }
[data-theme="dark"] .flash.success { background: #16352a; }
[data-theme="dark"] .flash.info { background: #16283a; }
[data-theme="dark"] .pill.blue { background: #17293c; color: #7fb6ea; }
/* Signature pad becomes a dark drawing surface with light ink in dark mode */
[data-theme="dark"] { --sig-bg: #0f141b; }
[data-theme="dark"] .sigpad { border-color: var(--line-strong); }

/* Login adapts to the theme: darker backdrop, and a divider so the navy
   brand banner reads distinctly from the dark card body. */
[data-theme="dark"] .login-wrap { background: linear-gradient(135deg, #0b0f15 0%, #18212e 100%); }
[data-theme="dark"] .login-card .head { border-bottom: 1px solid var(--line); }

/* Theme toggle: show the icon for the theme you'd switch TO */
.theme-toggle { position: relative; }
.theme-ic { display: none; align-items: center; }
.theme-ic-dark { display: inline-flex; }         /* moon shown in light mode */
[data-theme="dark"] .theme-ic-dark { display: none; }
[data-theme="dark"] .theme-ic-light { display: inline-flex; }  /* sun in dark mode */

/* Fixed toggle used on the login screen */
.theme-toggle-fixed {
    position: fixed; top: 16px; right: 16px; z-index: 80;
    width: 40px; height: 40px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(28,37,50,.75); color: #fff; border: 1px solid rgba(255,255,255,.15);
    cursor: pointer;
}
.theme-toggle-fixed:hover { background: rgba(28,37,50,.95); }

[hidden] { display: none !important; }
.clock-cam { width: 100%; margin-top: 12px; }
.cam-box { max-width: 360px; background: #000; border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; }
.cam-box video, .cam-box img { width: 100%; display: block; transform: scaleX(-1); }
.clock-thumb { height: 56px; width: 56px; object-fit: cover; border-radius: 50%; border: 2px solid var(--line-strong); }
.clock-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 4px 0 14px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }

/* --------------------------------------------------------------------------
   Print: reports and records print cleanly; the browser's Save as PDF gives
   the PDF export.
   -------------------------------------------------------------------------- */
.print-head { display: none; }
@media print {
    :root { color-scheme: light; }
    body { background: #fff !important; color: #111 !important; display: block; }
    .topbar, .mainnav, .sectionnav, .tc-foot, .noprint, .toolbar, .flashes, .theme-toggle { display: none !important; }
    main { flex: none; }
    .work { padding: 0 !important; max-width: none !important; }
    .print-head { display: block; font-size: 11px; color: #555; border-bottom: 2px solid #00539b; padding-bottom: 6px; margin-bottom: 12px; }
    .card { box-shadow: none !important; border: 1px solid #bbb !important; break-inside: avoid; background: #fff !important; color: #111 !important; }
    .card .card-head { background: #f1f4f8 !important; color: #111 !important; }
    table.data th { background: #e8eef5 !important; color: #111 !important; }
    table.data td, table.data th { border-color: #ccc !important; color: #111 !important; }
    .pill { border: 1px solid #999; background: none !important; color: #111 !important; }
    .stat { border: 1px solid #bbb; background: #fff !important; }
    .stat .num { color: #00539b !important; }
    a { color: inherit; text-decoration: none; }
}

.login-help { margin: 14px 0 0; text-align: center; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.tc-foot-txt a { color: #9db1c9; text-decoration: none; }
.tc-foot-txt a:hover { text-decoration: underline; }

/* Preceptor handoff */
.handoff-banner { background: var(--brand); color: #fff; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px; }
.handoff-banner .hb-title { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.handoff-banner .hb-sub { margin-top: 4px; font-size: 14px; color: #dfe8f3; }
.attest { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.5; cursor: pointer; }
.attest input { margin-top: 4px; width: 20px; height: 20px; }

/* Chart summary page */
table.kv { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.kv th { text-align: left; width: 38%; padding: 7px 14px; color: var(--muted); font-weight: 600; vertical-align: top; border-bottom: 1px solid var(--line); }
table.kv td { padding: 7px 14px 7px 0; border-bottom: 1px solid var(--line); white-space: pre-wrap; }
table.kv tr:last-child th, table.kv tr:last-child td { border-bottom: 0; }
.narrative-text { white-space: pre-wrap; line-height: 1.6; }
@media print {
    .summary-grid { display: block; }
    .card { break-inside: avoid; box-shadow: none; border: 1px solid #bbb; }
}

/* Phones: wide tables scroll inside their card instead of stretching the page,
   and the top bar drops the shift/patient context text. */
@media (max-width: 600px) {
    .card { overflow-x: auto; }
    table.data { min-width: 100%; }
    .grid.cols-4, .grid.cols-3 { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat { padding: 14px; }
    /* Short lists become stacked cards instead of squeezed columns. */
    table.stack-sm, table.stack-sm tbody { display: block; width: 100%; }
    table.stack-sm thead, table.stack-sm tr:first-child:has(th) { display: none; }
    table.stack-sm tr { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); }
    table.stack-sm tr:last-child { border-bottom: 0; }
    table.stack-sm td { display: inline-block; border: 0; padding: 2px 10px 2px 0; }
    table.stack-sm td.right { display: block; text-align: left; padding-top: 8px; }
    table.stack-sm td.right .btn, table.stack-sm td.right form { display: inline-block; margin: 0 6px 4px 0; }
    /* Calendar: time only, the site fits in the day view when tapped. */
    .cal-shift .p, .cal-shift .te { display: none; }
    .cal-shift .t { white-space: normal; }
    .cal-shift .t { font-size: 10px; }
    .cal-daynum { font-size: 12px; }
    .topbar .context { display: none; }
    .topbar { padding-left: 8px; padding-right: 8px; }
    .toolbar { flex-wrap: wrap; }
    .section-head { flex-wrap: wrap; }
    .section-head .icon { flex: 0 0 auto; }
    .section-head > .icon + div { flex: 1 1 60%; min-width: 0; }
    .section-head h1 { font-size: 19px; }
    /* Chart section tabs: keep each tab's label inside its own box and let
       the strip scroll sideways. */
    .sectionnav a { min-width: 0; padding: 10px 10px; font-size: 10px; letter-spacing: .2px; flex: 0 0 auto; }
    .sectionnav { scrollbar-width: none; }
    .sectionnav::-webkit-scrollbar { display: none; }
    .nowrap { white-space: normal; }
    .work.wide { padding-left: 12px; padding-right: 12px; }
}
