/* EMS Self-Service — professional theme. CSP-clean: all styling lives here
   (no inline styles, no external fonts/CDNs — default-src 'self'). */

:root {
    --brand:      #0d5c75;   /* deep teal */
    --brand-2:    #1487a8;   /* lighter teal (header gradient) */
    --brand-ink:  #ffffff;
    --accent:     #0e7490;
    --accent-700: #0b5066;
    --ink:        #16242e;
    --muted:      #5b6b78;
    --bg:         #eef2f5;
    --card:       #ffffff;
    --line:       #dbe3e8;
    --ok-bg:      #e7f6ec;  --ok-fg:    #15683a;  --ok-bar:    #1f9d57;
    --warn-bg:    #fdf3e3;  --warn-fg:  #8a5a12;  --warn-bar:  #d79328;
    --err-bg:     #fdeceb;  --err-fg:   #97211c;  --err-bar:   #d23b34;
    --radius:     10px;
    --shadow:     0 1px 2px rgba(16,40,55,.06), 0 4px 16px rgba(16,40,55,.07);
    --shadow-sm:  0 1px 2px rgba(16,40,55,.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }

/* ---------- header ---------- */
.app-header {
    background: linear-gradient(100deg, var(--brand) 0%, var(--brand-2) 100%);
    color: var(--brand-ink);
    box-shadow: var(--shadow-sm);
    position: sticky; top: 0; z-index: 50;
}
.app-header .bar {
    max-width: 880px; margin: 0 auto; padding: .7rem 1rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--brand-ink); }
.brand .logo {
    width: 34px; height: 34px; border-radius: 8px; flex: none;
    background: rgba(255,255,255,.18);
    display: grid; place-items: center; font-weight: 800; font-size: 1rem; letter-spacing: .5px;
}
.brand .title { font-weight: 700; font-size: 1.02rem; line-height: 1.1; }
.brand .subtitle { font-weight: 400; font-size: .76rem; opacity: .85; }
.app-nav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.app-nav a, .app-nav button {
    color: var(--brand-ink); background: transparent; border: 0; cursor: pointer;
    font: inherit; font-size: .92rem; padding: .4rem .7rem; border-radius: 6px; text-decoration: none;
    transition: background .15s ease;
}
.app-nav a:hover, .app-nav button:hover { background: rgba(255,255,255,.16); }
.app-nav a.active { background: rgba(255,255,255,.22); font-weight: 600; }
.app-nav form { display: inline; margin: 0; }
.lang-link { border: 1px solid rgba(255,255,255,.45); border-radius: 6px; }
.auth-lang { display: inline-block; margin-top: .7rem; color: var(--accent); border: 1px solid var(--line);
    border-radius: 6px; padding: .25rem .7rem; font-size: .85rem; text-decoration: none; }
.auth-lang:hover { background: #f1f6f8; border-color: var(--accent); }

/* ---------- layout ---------- */
main { max-width: 880px; margin: 1.5rem auto; padding: 0 1rem 3rem; }
.page-title { margin: 0 0 1rem; font-size: 1.35rem; font-weight: 700; }
.site-footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 1.5rem 1rem 2.5rem; }

/* ---------- cards ---------- */
.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.4rem 1.5rem; margin-bottom: 1.25rem; box-shadow: var(--shadow);
}
.card h2 {
    margin: 0 0 1rem; font-size: 1.12rem; font-weight: 700; color: var(--ink);
    padding-bottom: .6rem; border-bottom: 1px solid var(--line);
}
.card h2.section { margin-top: 1.5rem; }
.panel { background: #f4f7f9; border: 1px solid var(--line); border-radius: 8px; padding: 1rem 1.1rem; margin-bottom: 1.1rem; }
.lead { color: var(--muted); margin: -.3rem 0 1.1rem; }

/* ---------- alerts ---------- */
.flash {
    border-radius: 8px; padding: .8rem 1rem .8rem 1.1rem; margin-bottom: 1rem;
    font-size: .95rem; border-left: 4px solid transparent;
}
.flash.ok    { background: var(--ok-bg);   color: var(--ok-fg);   border-left-color: var(--ok-bar); }
.flash.warn  { background: var(--warn-bg); color: var(--warn-fg); border-left-color: var(--warn-bar); }
.flash.error { background: var(--err-bg);  color: var(--err-fg);  border-left-color: var(--err-bar); }

/* ---------- forms ---------- */
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: .3rem; }
.field input, .field select {
    width: 100%; padding: .6rem .7rem; font: inherit; color: var(--ink);
    background: #fff; border: 1px solid var(--line); border-radius: 8px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14,116,144,.18);
}
.field input[readonly] { background: #eef2f5; color: var(--muted); }
.field-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.field-row > .field { flex: 1 1 9rem; }
.help { font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.help.leading { line-height: 1.55; }
.help.leading p { margin: .6rem 0; }

/* ---------- buttons ---------- */
.actions { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; margin-top: 1.1rem; }
.actions.end { align-items: flex-end; }
.btn {
    display: inline-block; background: var(--accent); color: #fff; border: 1px solid var(--accent);
    padding: .6rem 1.15rem; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer;
    text-decoration: none; transition: background .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--accent-700); border-color: var(--accent-700); box-shadow: var(--shadow-sm); }
.btn.secondary { background: #fff; color: var(--accent); border-color: var(--line); }
.btn.secondary:hover { background: #f1f6f8; border-color: var(--accent); }
.btn.small { padding: .4rem .75rem; font-size: .85rem; }

/* ---------- prominent passkey sign-in (preferred method) ---------- */
.btn-block {
    display: flex; width: 100%; justify-content: center; align-items: center; gap: .55rem;
    padding: .8rem 1rem; font-size: 1.02rem;
}
.btn-passkey { background: var(--brand); border-color: var(--brand); }
.btn-passkey:hover { background: var(--accent-700); border-color: var(--accent-700); }
.btn-passkey .pk-ico { width: 22px; height: 22px; flex: none; }
.passkey-sub { text-align: center; color: var(--muted); font-size: .82rem; margin: .55rem 0 0; }
.or-divider {
    display: flex; align-items: center; text-align: center;
    color: var(--muted); font-size: .82rem; margin: 1.1rem 0 .9rem;
}
.or-divider::before, .or-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.or-divider span { padding: 0 .7rem; }   /* activate page's bare text is itself the centered flex child */
.balance-card { border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin: 14px 0; }
.balance-kind { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.balance-num { font-size: 40px; font-weight: 700; color: var(--accent); margin-top: 4px; line-height: 1.1; }
.balance-num.negative { color: var(--err-fg); }
.balance-unit { font-size: 16px; font-weight: 600; color: var(--muted); }
.balance-asof { font-size: 13px; color: var(--muted); margin-top: 6px; }
.doc-viewer-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.doc-viewer-title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-viewer-spacer { flex: 1; }
.doc-viewer-bar-bottom { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.doc-frame { width: 100%; height: 85vh; height: calc(100dvh - 210px); min-height: 380px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.doc-frame-hint { margin-top: 10px; }
.pdf-render { width: 100%; max-height: calc(100dvh - 210px); min-height: 380px; overflow-y: auto;
    border: 1px solid var(--line); border-radius: 8px; background: #525659; padding: 10px; }
.pdf-render canvas { display: block; margin: 0 auto 10px; max-width: 100%; background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.pdf-loading { color: #fff; text-align: center; padding: 28px 12px; font-size: 14px; }
.ts-period { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.ts-period select { padding: .5rem; }
.ts-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ts-table th, .ts-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.ts-table th.num, .ts-table td.num { text-align: right; }
.ts-table tbody tr:hover { background: var(--panel, rgba(0,0,0,.02)); }
.ts-subtotal td { color: var(--muted); font-size: 13px; border-bottom: 2px solid var(--line); }
.ts-total td { font-weight: 700; border-top: 2px solid var(--accent); }
.ts-sub2 td { color: var(--muted); font-size: 13px; }
.ts-tabs { display: flex; gap: 8px; margin: 4px 0 16px; }
.ts-h3 { margin: 18px 0 6px; font-size: 15px; }
.ts-legal { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); font-style: italic; }
.nav-badge { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: #d23b34; color: #fff; font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.alt-list { list-style: none; margin: 12px 0 0; padding: 0; }
.alt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.alt-info { display: flex; flex-direction: column; gap: 2px; }
.alt-type { font-weight: 700; color: var(--accent); font-size: 13px; letter-spacing: .04em; }
.alt-when { font-weight: 600; }
.alt-reason { font-size: 13px; color: var(--muted); }
.alt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 8px 0 4px; }
.alt-certify { margin: 16px 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--warn-bg, #fff7e6); font-size: 14px; }
.score-card { text-align: center; }
.score-head { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.score-big { font-size: 44px; font-weight: 800; line-height: 1.1; margin: 6px 0; }
.score-good { color: #1f9d57; }
.score-warn { color: #d79328; }
.score-sub { margin: 0 auto 8px; max-width: 36ch; }
.score-windows { display: flex; gap: 10px; justify-content: center; margin: 12px 0 6px; }
.score-windows > div { display: flex; flex-direction: column; min-width: 84px; padding: 8px 4px; border: 1px solid var(--line); border-radius: 8px; }
.score-n { font-size: 22px; font-weight: 800; }
.score-lbl { font-size: 11px; color: var(--muted); }
.score-rank { margin: 8px 0 2px; display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.score-rk { padding: 5px 12px; border-radius: 20px; background: #eef3f6; font-size: 14px; }
.tier-badge { display: inline-block; padding: 8px 24px; border-radius: 24px; font-weight: 800; font-size: 20px; letter-spacing: .04em; margin: 4px 0 6px; box-shadow: var(--shadow-sm); }
.tier-platinum .tier-badge { background: linear-gradient(135deg, #f4f7fa, #c2ccd3); color: #243038; }
.tier-gold .tier-badge { background: linear-gradient(135deg, #ffe48a, #e3b100); color: #5a4500; }
.tier-silver .tier-badge { background: linear-gradient(135deg, #eef1f3, #c3cbd0); color: #36424a; }
.tier-bronze .tier-badge { background: linear-gradient(135deg, #e4b48b, #c97f3a); color: #4a2c10; }
.tier-platinum.score-card { border: 2px solid #cfd8dd; box-shadow: 0 0 0 4px rgba(190,205,215,.30), var(--shadow); }
.score-streak { margin: 6px auto 2px; font-weight: 700; color: #c2410c; }

/* ---------- home tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.tile {
    display: block; text-decoration: none; color: var(--ink);
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1.2rem 1.3rem; box-shadow: var(--shadow-sm);
    transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand-2); }
.tile .ico { width: 40px; height: 40px; border-radius: 9px; background: #e3eef2; color: var(--brand);
    display: grid; place-items: center; margin-bottom: .7rem; }
.tile .ico svg { width: 22px; height: 22px; }
.tile h3 { margin: 0 0 .25rem; font-size: 1.05rem; }
.tile p { margin: 0; color: var(--muted); font-size: .9rem; }

/* ---------- collapsible sections ---------- */
.card details > summary {
    list-style: none; cursor: pointer; user-select: none;
    font-size: 1.12rem; font-weight: 700; color: var(--ink);
    padding-bottom: .6rem; border-bottom: 1px solid var(--line); margin-bottom: .5rem;
    display: flex; align-items: center; gap: .5rem;
}
.card details > summary::-webkit-details-marker { display: none; }
.card details > summary::before {
    content: ""; width: 7px; height: 7px; flex: none; margin-right: .15rem;
    border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
    transform: rotate(-45deg); transition: transform .15s ease;
}
.card details[open] > summary::before { transform: rotate(45deg); }

/* ---------- document list ---------- */
.doc-list { list-style: none; padding: 0; margin: 0; }
.doc-list li {
    border-top: 1px solid var(--line); padding: .85rem .25rem;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.doc-list li:first-child { border-top: 0; }
.doc-list li.doc-head {
    border-top: 0; padding-bottom: .3rem;
    font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: var(--muted);
}
.doc-list li.doc-head .doc-main { gap: 0; }
.doc-list li.block { display: block; }
.doc-main { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.doc-name { font-weight: 600; text-decoration: none; color: var(--accent); }
.doc-name.plain { color: var(--ink); font-weight: 600; }
.doc-meta { color: var(--muted); font-size: .82rem; }
.filetype { width: 30px; height: 30px; border-radius: 7px; flex: none; display: grid; place-items: center;
    background: #e3eef2; color: var(--brand); }
.filetype svg { width: 16px; height: 16px; }

/* ---------- badges / tags ---------- */
.tag {
    display: inline-block; font-size: .72rem; font-weight: 600; padding: .12rem .5rem;
    border-radius: 999px; background: #eaf1f4; color: var(--accent-700); margin-left: .35rem; vertical-align: middle;
}
.tag.taxdoc { background: #fbeede; color: #8a5a12; }
.tag.warn   { background: var(--err-bg); color: var(--err-fg); }
.tag.muted  { background: #eceff1; color: var(--muted); }

/* ---------- admin rows ---------- */
.row-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; align-items: center; }
.row-actions form { display: flex; gap: .35rem; align-items: center; margin: 0; }
.row-actions input[type=tel], .row-actions select { width: auto; padding: .4rem .55rem; }

/* ---------- utilities ---------- */
.inline { display: inline; }
.center { text-align: center; }
.code-big {
    font: 700 2rem/1.1 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    letter-spacing: .25em; color: var(--accent); margin: .4rem 0;
}
.copybox {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: .9rem; background: var(--card); border: 1px dashed var(--line);
    border-radius: 8px; padding: .8rem 1rem; margin: .4rem 0 0; word-break: break-word;
    user-select: all;
}

/* ---------- auth (logged-out) layout ---------- */
.auth-wrap { max-width: 420px; margin: 3rem auto 1rem; padding: 0 1rem; }
.auth-brand { text-align: center; margin-bottom: 1.25rem; }
.auth-brand .logo {
    width: 52px; height: 52px; border-radius: 12px; margin: 0 auto .6rem;
    background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
    display: grid; place-items: center; font-weight: 800; font-size: 1.3rem;
}
.auth-brand .title { font-weight: 700; font-size: 1.15rem; }
.auth-brand .subtitle { color: var(--muted); font-size: .85rem; }

@media (max-width: 540px) {
    .app-header .bar { flex-direction: column; align-items: flex-start; gap: .5rem; }
    .brand .subtitle { display: none; }
}

/* ---------- dark mode (follows the device/browser preference) ---------- */
@media (prefers-color-scheme: dark) {
    :root {
        --ink: #e6edf3; --muted: #9fb0bd;
        --bg: #0e1620; --card: #16212c; --line: #2a3742;
        --accent: #36b3cc; --accent-700: #2a93ab;
        --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.35);
        --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
        --ok-bg: #122a1d;  --ok-fg: #7fe0a6;  --ok-bar: #1f9d57;
        --warn-bg: #2c2410; --warn-fg: #e9c97a; --warn-bar: #d79328;
        --err-bg: #2c1514;  --err-fg: #f1a39e;  --err-bar: #d23b34;
    }
    .panel { background: #1b2935; }
    .field input, .field select { background: #0f1924; color: var(--ink); }
    .field input[readonly] { background: #1b2935; color: var(--muted); }
    .filetype, .tile .ico { background: #1d2c39; color: #7fd3e6; }
    .tag { background: #1d2c39; color: #9fdbe9; }
    .tag.taxdoc { background: #33280f; color: #e9c97a; }
    .tag.muted { background: #222e39; color: var(--muted); }
    .btn.secondary { background: var(--card); }
    .btn.secondary:hover { background: #1b2935; }
}

/* --- My Schedule --------------------------------------------------------- */
.msched { display: flex; flex-direction: column; gap: 1rem; }
.msched-day { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); overflow: hidden; }
.msched-date { padding: .55rem .9rem; font-weight: 700; color: var(--ink);
    background: #f1f6f8; border-bottom: 1px solid var(--line); }
.msched-shift { display: flex; align-items: center; gap: .9rem; padding: .7rem .9rem;
    border-left: 4px solid var(--line); }
.msched-shift + .msched-shift { border-top: 1px solid var(--line); }
.msched-shift.band-day { border-left-color: #e0a021; }
.msched-shift.band-eve { border-left-color: #2f7dd1; }
.msched-shift.band-noc { border-left-color: #6366f1; }
.msched-time { font-weight: 700; font-size: 1.02rem; color: var(--ink); min-width: 116px; }
.msched-meta { display: flex; flex-direction: column; line-height: 1.35; }
.msched-pos { font-weight: 600; color: var(--ink); }
.msched-sub { color: var(--muted); font-size: .86rem; }

/* --- My Schedule: tabs, open-shift pills, claim --- */
.msched-tabs { display: flex; gap: .5rem; margin: 0 0 1rem; border-bottom: 1px solid var(--line); }
.msched-tabs a { padding: .5rem .9rem; text-decoration: none; color: var(--muted); font-weight: 600;
    border-bottom: 3px solid transparent; margin-bottom: -1px; }
.msched-tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.msched-tabs .nav-badge { display: inline-block; min-width: 1.2em; padding: 0 .35em; border-radius: 999px;
    background: var(--brand); color: #fff; font-size: .72rem; text-align: center; }
.msched-shift .msched-meta { flex: 1; }
.pill { display: inline-block; margin-left: .4rem; padding: .05rem .45rem; border-radius: 999px;
    font-size: .7rem; font-weight: 700; vertical-align: middle; }
.pill-appr   { background: var(--warn-bg); color: var(--warn-fg); }
.pill-vital  { background: #ede9fe; color: #5b21b6; }
.pill-nearby { background: #e0f2fe; color: #075985; }
.msched-claim { margin: 0; }
.msched-claim .btn { padding: .45rem .9rem; font-size: .9rem; white-space: nowrap; }

/* --- My Schedule: time-off --- */
.to-form .to-grid { display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: .7rem; }
.to-form label { display: flex; flex-direction: column; font-size: .8rem; font-weight: 600;
    color: var(--muted); gap: .25rem; }
.to-form input, .to-form select { padding: .45rem .5rem; border: 1px solid var(--line);
    border-radius: 8px; font-size: .95rem; font-weight: 400; color: var(--ink); background: #fff; }
.to-form .to-reason { width: 100%; margin-bottom: .8rem; }
.to-form .to-reason input { width: 100%; box-sizing: border-box; }
.to-h { margin: 1.4rem 0 .6rem; }
.to-list { display: flex; flex-direction: column; gap: .6rem; }
.to-item { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: .7rem .9rem; }
.to-range { font-weight: 700; color: var(--ink); }
.to-days { font-weight: 400; color: var(--muted); font-size: .82rem; margin-left: .3rem; }
.to-sub { color: var(--muted); font-size: .86rem; margin-top: .15rem; }
.to-note { color: var(--ink); }
.to-side { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; white-space: nowrap; }
.status { display: inline-block; padding: .12rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 700; }
.status-pending   { background: var(--warn-bg); color: var(--warn-fg); }
.status-approved  { background: var(--ok-bg);   color: var(--ok-fg); }
.status-denied    { background: var(--err-bg);  color: var(--err-fg); }
.status-cancelled { background: #eef2f5;        color: var(--muted); }
.btn-link { background: none; border: none; color: var(--err-fg); font-size: .82rem;
    cursor: pointer; padding: 0; text-decoration: underline; }

/* --- My Schedule: availability grid --- */
.msched-tabs { flex-wrap: wrap; row-gap: 0; }   /* wrap so all tabs show on narrow phones */
.msched-tabs a { flex-shrink: 0; white-space: nowrap; }
/* hourly 24x7 availability grid — hours down, days across (fits a phone) */
.avail-lead-note { background: var(--ok-bg); border: 1px solid var(--ok-bar); border-radius: 8px;
    padding: .5rem .7rem; font-size: .84rem; margin: 0 0 .8rem; }
.avail-tools { display: flex; justify-content: flex-end; margin: 0 0 .3rem; }
.avail-tools button { background: none; border: 0; color: var(--brand); font-weight: 600;
    font-size: .85rem; cursor: pointer; padding: .2rem .3rem; }
.availh-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin-bottom: .6rem; }
.availh { border-collapse: collapse; width: 100%; max-width: 460px; user-select: none; }
.availh th, .availh td { border: 1px solid #e3e8ec; text-align: center; }
.availh thead th { position: sticky; top: 0; z-index: 1; background: #fff; font-size: .74rem;
    font-weight: 700; color: var(--muted); padding: .4rem 0; cursor: pointer; }
.availh th.hrlab { font-size: .7rem; font-weight: 600; color: var(--muted); white-space: nowrap;
    width: 42px; padding: 0 .2rem; cursor: pointer; }
.availh td.ac { padding: 0; background: #fff; }
.availh td.ac label { display: block; min-height: 36px; cursor: pointer; }
.availh td.ac input { position: absolute; opacity: 0; width: 0; height: 0; }
.availh td.ac.on { background: var(--brand); }
.avail-key { display: flex; align-items: center; gap: .3rem; color: var(--muted); font-size: .82rem; margin: .1rem 0 1rem; }
.avail-key .k { display: inline-block; width: 16px; height: 16px; border-radius: 4px; border: 1px solid var(--brand); vertical-align: middle; }
.avail-key .k-on { background: var(--brand); }

/* --- My Schedule: messages --- */
.msg-list { display: flex; flex-direction: column; gap: .55rem; }
.msg-item { display: block; text-decoration: none; color: inherit; background: var(--card);
    border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: .7rem .9rem; border-left: 4px solid transparent; }
.msg-item.unread { border-left-color: var(--brand); background: #f7fbfc; }
.msg-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.msg-subject { font-weight: 700; color: var(--ink); }
.msg-item.unread .msg-subject { color: var(--brand); }
.msg-dot { flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); }
.msg-meta { color: var(--muted); font-size: .8rem; margin-top: .1rem; }
.msg-preview { color: var(--muted); font-size: .88rem; margin-top: .3rem;
    overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.msg-back { margin: 0 0 .6rem; }
.msg-back a { text-decoration: none; color: var(--accent); font-weight: 600; }
.msg-detail .msg-body { white-space: pre-wrap; line-height: 1.5; color: var(--ink); margin: .8rem 0; }
.msg-ackform { margin-top: .6rem; }
.msg-acked { color: var(--ok-fg); font-weight: 700; margin-top: .6rem; }

/* --- My Schedule: settings + messages head --- */
.msg-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
.msg-settings { font-size: .85rem; color: var(--accent); text-decoration: none; font-weight: 600; white-space: nowrap; }
.set-status { font-weight: 600; color: var(--ink); margin: .4rem 0 .8rem; }
.set-note { color: var(--muted); font-size: .84rem; margin: .5rem 0 0; }

/* --- My Schedule: swaps --- */
.swap-pick { text-decoration: none; color: inherit; }
.swap-pick:hover { background: #f7fbfc; }
.swap-go { margin-left: auto; color: var(--accent); font-size: .82rem; font-weight: 600;
    white-space: nowrap; align-self: center; }
.status-offered { background: var(--warn-bg); color: var(--warn-fg); }

/* --- Settings page --- */
.set-sep { border: none; border-top: 1px solid var(--line); margin: .9rem 0; }

/* --- swap B-consent respond --- */
.swap-respond { display: flex; align-items: center; gap: .5rem; }
.status-declinedbyb { background: var(--err-bg); color: var(--err-fg); }
