:root {
  /* Brand — refined Chick-fil-A red */
  --cfa-red: #e51636;
  --cfa-red-dark: #c20f29;
  --cfa-red-deep: #4f0b16;
  --brand-tint: #fff1f3;       /* soft brand fill / hover */
  --brand-tint-2: #ffe2e7;
  --cfa-white: #ffffff;

  /* Neutrals — warm, premium ramp */
  --cfa-cream: #f7f4f3;        /* app background */
  --surface: #ffffff;          /* cards / sheets */
  --ink: #1c1418;              /* primary text */
  --ink-soft: #5b5054;         /* secondary text / labels */
  --muted: #8d8488;            /* tertiary / hints */
  --line: #ece7e9;             /* hairline border */
  --line-strong: #ddd5d8;      /* input / control border */

  /* Icon accent — a deeper shade of the powder blue, legible on white (WCAG 3:1) */
  --icon: #3a8094;
  --icon-tint: #e6f0f3;        /* pale fill behind icons */
  --ic-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.6 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.6a2 2 0 0 0-3.4 0z'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");

  /* Semantic */
  --green: #1f9d57; --green-bg: #e8f6ef;
  --red: #d92d3c;  --red-bg: #fdebed;
  --amber: #bb8205; --amber-bg: #fdf3da;

  /* Elevation — layered, neutral */
  --shadow-sm: 0 1px 2px rgba(28,20,24,.07), 0 1px 1px rgba(28,20,24,.04);
  --shadow: 0 1px 3px rgba(28,20,24,.05), 0 10px 26px -8px rgba(28,20,24,.12);
  --shadow-lg: 0 20px 50px -14px rgba(28,20,24,.24);
  --ring: 0 0 0 3px rgba(229,22,54,.18);   /* focus halo */

  /* Radius + motion */
  --r-sm: 9px; --r: 13px; --r-lg: 18px; --r-xl: 24px;
  --ease: cubic-bezier(.4,0,.2,1);
  --t: .18s;
}

/* ---------- Dark mode (opt-in via [data-theme="dark"]) ---------- */
:root[data-theme="dark"] {
  --cfa-cream: #15171b;        /* app background */
  --surface: #1e2127;          /* cards / sheets */
  --ink: #e9e7e8;              /* primary text */
  --ink-soft: #b1abae;         /* secondary text */
  --muted: #8c868a;            /* tertiary / hints */
  --line: #2d3037;            /* hairline border */
  --line-strong: #3c404a;      /* control border */
  --cfa-red-deep: #f2a6b2;     /* heading text — a red that reads on dark */
  --brand-tint: #361b22;       /* dark red-tint fill / hover */
  --brand-tint-2: #46232d;
  --green: #4cc185; --green-bg: #163a2a;
  --red: #f07474;  --red-bg: #3d2024;
  --amber: #e0a93a; --amber-bg: #3a2f17;
  --icon: #a7ced8;             /* light powder blue reads well on dark */
  --icon-tint: #213139;        /* dark blue tile behind icons */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.45);
  --shadow: 0 1px 3px rgba(0,0,0,.5), 0 10px 26px -8px rgba(0,0,0,.6);
  --shadow-lg: 0 22px 52px -14px rgba(0,0,0,.75);
  --ring: 0 0 0 3px rgba(229,22,54,.4);
  color-scheme: dark;
}
/* Tokens used as solid backgrounds (not surfaces) need explicit dark values */
:root[data-theme="dark"] .toast-item { background: #2b2f37; }
:root[data-theme="dark"] .bio-lock { background: #2a0a11; }
:root[data-theme="dark"] .convo-avatar.group { background: #7a1f2c; }
:root[data-theme="dark"] .skeleton { background: #2a2d34; }
:root[data-theme="dark"] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255,255,255,.06), transparent); }
/* --cfa-red-dark is used as both red TEXT and as red hover BACKGROUNDS.
   In dark, lighten it for text, then restore real red on the few backgrounds. */
:root[data-theme="dark"] { --cfa-red-dark: #ef8e9c; }
:root[data-theme="dark"] button:hover { background: #c20f29; }
:root[data-theme="dark"] .section-toggle .seg.active:hover, :root[data-theme="dark"] .tab.active:hover { background: #c20f29; }
:root[data-theme="dark"] .section-toggle .seg:hover, :root[data-theme="dark"] .tab:hover, :root[data-theme="dark"] button.ghost:hover { color: #f6b6c0; }
:root[data-theme="dark"] input::placeholder, :root[data-theme="dark"] textarea::placeholder { color: #7c767a; }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #3a3d44; }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: #4a4e57; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', 'Segoe UI', Roboto, system-ui, -apple-system, sans-serif;
  background: var(--cfa-cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.006em;
}
h1, h2, h3 { letter-spacing: -0.02em; }

.hidden { display: none !important; }

/* Tabular figures keep metrics & data aligned (a small premium tell). */
.rsa-tally, .cov-n, .cov-h, .car-total, .car-hours, .sdt-num, .sdt-count, .cal-grid,
.data-grid, .notif-time, .menu-unread, .role-tag, .dash-sched, .brk-sub { font-variant-numeric: tabular-nums; }

::selection { background: var(--brand-tint-2); color: var(--cfa-red-deep); }

/* Refined scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d8cfd2; border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #c4babd; background-clip: padding-box; }

button {
  font: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 10px 18px;
  background: var(--cfa-red);
  color: #fff;
  font-weight: 600;
  letter-spacing: -0.01em;
  box-shadow: 0 1px 2px rgba(28,20,24,.10);
  transition: background var(--t) var(--ease), box-shadow var(--t) var(--ease), transform .08s var(--ease), border-color var(--t) var(--ease);
}
button:hover { background: var(--cfa-red-dark); box-shadow: 0 5px 16px -4px rgba(194,15,41,.42); }
button:active { transform: translateY(1px); box-shadow: 0 1px 2px rgba(79,11,22,.28); }
button:focus-visible { outline: none; box-shadow: var(--ring); }
button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; transform: none; }
button.ghost { background: var(--surface); color: var(--cfa-red-dark); border: 1px solid var(--line-strong); box-shadow: none; }
button.ghost:hover { background: var(--brand-tint); border-color: var(--cfa-red); }
button.tiny { padding: 6px 13px; font-size: 13px; box-shadow: none; }
button.tiny:not(.ghost):hover { box-shadow: 0 3px 10px -3px rgba(194,15,41,.4); }

input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  transition: border-color var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
input::placeholder, textarea::placeholder { color: #b4aaae; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--cfa-red);
  box-shadow: var(--ring);
}
/* Validation + disabled states */
input:disabled, select:disabled, textarea:disabled { background: var(--cfa-cream); color: var(--muted); cursor: not-allowed; opacity: .7; }
input:user-invalid, textarea:user-invalid, select:user-invalid, input.input-bad, textarea.input-bad { border-color: var(--red); }
input:user-invalid:focus, textarea:user-invalid:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(217,45,60,.2); }
input.input-ok, textarea.input-ok { border-color: var(--green); }
label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); display: block; margin-bottom: 6px; letter-spacing: -0.005em; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(120% 90% at 50% -10%, #f43a54 0%, var(--cfa-red) 38%, var(--cfa-red-dark) 72%, var(--cfa-red-deep) 100%);
  padding: 20px;
  position: relative;
}
/* subtle texture so the brand panel reads as crafted, not flat */
.login-wrap::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(40% 30% at 85% 8%, rgba(255,255,255,.14), transparent 60%),
    radial-gradient(45% 35% at 10% 100%, rgba(0,0,0,.16), transparent 60%);
}
.login-card {
  position: relative;
  width: 100%;
  max-width: 384px;
  background: var(--surface);
  border-radius: var(--r-xl);
  padding: 36px 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid rgba(255,255,255,.6);
}
.brand { text-align: center; margin-bottom: 24px; }
.brand .mark {
  width: 66px; height: 66px; border-radius: 20px;
  background: linear-gradient(160deg, #ef2342 0%, var(--cfa-red) 50%, var(--cfa-red-dark) 100%); color: #fff;
  display: grid; place-items: center;
  font-size: 34px; font-weight: 800; margin: 0 auto 14px;
  box-shadow: 0 10px 24px -8px rgba(229,22,54,.6);
}
.brand h1 { font-size: 23px; margin: 0; color: var(--cfa-red-deep); font-weight: 800; letter-spacing: -0.025em; }
.brand p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.field { margin-bottom: 14px; }
.login-card button { width: 100%; margin-top: 6px; }
.error { color: var(--cfa-red); font-size: 14px; margin: 8px 0 0; min-height: 18px; }
/* Any non-empty error message automatically gets a leading alert icon */
.error:not(:empty) { display: flex; align-items: center; gap: 5px; }
.error:not(:empty)::before {
  content: ""; flex: none; width: 14px; height: 14px; background: currentColor;
  -webkit-mask: var(--ic-alert) center/contain no-repeat; mask: var(--ic-alert) center/contain no-repeat;
}
.hint {
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 12.5px; color: var(--muted); line-height: 1.6;
}
.hint code { background: var(--cfa-cream); padding: 1px 6px; border-radius: 6px; color: var(--cfa-red-dark); }

/* ---------- Biometric lock ---------- */
.bio-lock { position: fixed; inset: 0; z-index: 9999; background: var(--cfa-red-deep); display: grid; place-items: center; }
.bio-box { text-align: center; color: #fff; }
.bio-box .mark { width: 84px; height: 84px; border-radius: 22px; background: var(--surface); color: var(--cfa-red);
  display: grid; place-items: center; font-size: 46px; font-weight: 800; margin: 0 auto 16px; }
.bio-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; }
.bio-box button { background: var(--surface); color: var(--cfa-red-dark); }
.bio-box button:hover { background: #ffe7eb; }
.bio-alt { display: inline-block; margin-top: 16px; color: #fff; font-size: 14px; text-decoration: underline; cursor: pointer; }

/* ---------- Area selector ---------- */
.selector-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 20px;
  background: radial-gradient(120% 90% at 50% -10%, #f43a54 0%, var(--cfa-red) 38%, var(--cfa-red-dark) 72%, var(--cfa-red-deep) 100%);
}
.selector-card {
  width: 100%; max-width: 480px; background: var(--surface); border-radius: 22px;
  padding: 34px 30px; box-shadow: var(--shadow);
}
.selector-options { display: grid; gap: 14px; margin-top: 22px; }
@media (min-width: 460px) { .selector-options { grid-template-columns: 1fr 1fr; } }
.area-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: var(--cfa-cream); color: var(--ink); border: 2px solid var(--line);
  border-radius: 16px; padding: 22px 14px; text-align: center;
}
.area-btn:hover { background: var(--brand-tint); border-color: var(--cfa-red); }
.area-emoji { font-size: 38px; }
.area-name { font-size: 17px; font-weight: 800; color: var(--cfa-red-deep); }
.area-sub { font-size: 12px; color: var(--muted); }
.area-tag { font-size: 12px; font-weight: 600; opacity: 0.9; }

/* ---------- Header menu (Hub / Communication Central) ---------- */
.topbar-menu { position: relative; }
.menu-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 200;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px; min-width: 220px; display: flex; flex-direction: column; gap: 4px;
}
.menu-dropdown button { background: var(--surface); color: var(--ink); text-align: left; border-radius: 8px; font-weight: 600; }
.menu-dropdown button:hover { background: var(--cfa-cream); }

.menu-unread { background: var(--cfa-red); color: #fff; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 0 6px; margin-left: 4px; }
.seg.active .menu-unread { background: var(--surface); color: var(--cfa-red-dark); }

/* Section toggle (Hub / Communication Central) */
.section-toggle { display: flex; gap: 8px; padding: 12px 22px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.section-toggle .seg { background: var(--surface); color: var(--ink-soft); border: 1px solid var(--line-strong); border-radius: 999px; padding: 9px 18px; font-weight: 600; letter-spacing: -0.01em; box-shadow: none; transition: background var(--t) var(--ease), color var(--t) var(--ease), border-color var(--t) var(--ease), box-shadow var(--t) var(--ease); }
.section-toggle .seg:hover { background: var(--brand-tint); color: var(--cfa-red-dark); border-color: var(--brand-tint-2); }
.section-toggle .seg.active { background: var(--cfa-red); color: #fff; border-color: var(--cfa-red); box-shadow: 0 4px 12px -3px rgba(194,15,41,.42); }
.section-toggle .seg.active:hover { background: var(--cfa-red-dark); color: #fff; }
@media (max-width: 620px) {
  .section-toggle { padding: 10px 12px; overflow-x: auto; flex-wrap: nowrap; }
  .section-toggle .seg { flex: 0 0 auto; padding: 8px 14px; font-size: 13px; }
}

/* ---------- Communication Central ---------- */
.comm-wrap { display: grid; grid-template-columns: 320px 1fr; gap: 0; height: calc(100vh - 64px); }
.comm-sidebar { border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.comm-sidebar-head { padding: 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.comm-sidebar-head strong { color: var(--cfa-red-deep); }
.comm-newbtns { display: flex; gap: 8px; }
.convo-list { overflow-y: auto; flex: 1; }
.comm-group-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 6px; font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.comm-group-actions { display: flex; gap: 6px; }
.comm-group-actions button { padding: 3px 9px; font-size: 12px; }
.convo-reorder { display: flex; flex-direction: column; gap: 1px; flex: none; }
.convo-reorder button { padding: 0 5px; font-size: 11px; line-height: 1.2; background: transparent; color: var(--muted); }
.convo-reorder button:hover { color: var(--cfa-red); background: transparent; }
.convo-pin { flex: none; cursor: pointer; opacity: .5; font-size: 14px; }
.convo-pin.pinned { opacity: 1; }
.convo-lock { color: var(--muted); font-size: 12px; }
.pinned-bar { background: var(--amber-bg); border-bottom: 1px solid #f0dca6; padding: 8px 14px; font-size: 13px; }
.pinned-bar .pin-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.pinned-bar .pin-row .pin-txt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pinned-bar .pin-unpin { cursor: pointer; color: var(--amber); font-weight: 700; }
.browse-row { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); }
.browse-row .grow { flex: 1; }
.convo-item { padding: 11px 14px; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; gap: 10px; align-items: center; }
.convo-item:hover, .convo-item.active { background: var(--cfa-cream); }
.convo-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--av, var(--cfa-red)); color: #fff; display: grid; place-items: center; font-weight: 800; flex: none; font-size: 15px; }
.convo-avatar.group { background: var(--cfa-red-deep); }
/* Deterministic initials avatar */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--av, #8a8086); color: #fff; font-weight: 700; font-size: 13px; flex: none; letter-spacing: .3px; line-height: 1; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.xs { width: 20px; height: 20px; font-size: 9px; }
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }
.convo-info { flex: 1; min-width: 0; }
.convo-name { font-weight: 700; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.convo-name .cn-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-time { font-size: 11px; color: var(--muted); font-weight: 500; flex: none; }
.convo-preview { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-unread { background: var(--cfa-red); color: #fff; font-size: 11px; font-weight: 800; border-radius: 999px; padding: 1px 7px; flex: none; }
.comm-main { display: flex; flex-direction: column; min-height: 0; background: var(--cfa-cream); position: relative; }
.scroll-down { position: absolute; right: 16px; bottom: 86px; width: 42px; height: 42px; border-radius: 50%; background: var(--cfa-red); color: #fff; border: none; box-shadow: var(--shadow); cursor: pointer; font-size: 19px; line-height: 1; display: flex; align-items: center; justify-content: center; z-index: 5; }
.scroll-down:hover { background: var(--cfa-red-dark); }
.scroll-down.hidden { display: none; }
/* Message actions, reactions, threads */
.msg-act { font-size: 12px; cursor: pointer; opacity: .55; margin-left: 6px; }
.msg-act:hover { opacity: 1; }
.msg-act-reply { display: inline-flex; vertical-align: middle; }
.reply-ico { fill: currentColor; vertical-align: middle; }
.msg-reactions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.rchip { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.rchip.mine { border-color: var(--cfa-red); background: #fff1f0; color: var(--cfa-red-deep); }
.msg.mine .rchip { background: rgba(255,255,255,.85); }
.emoji-pop { position: fixed; z-index: 700; display: flex; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 8px; box-shadow: var(--shadow); }
.emoji-pop button { border: none; background: none; font-size: 20px; cursor: pointer; padding: 2px 4px; border-radius: 8px; line-height: 1; }
.emoji-pop button:hover { background: var(--cfa-cream); }
.thread-bar { margin: -2px 0 2px; }
.thread-bar.mine { text-align: right; }
.thread-toggle { border: none; background: none; color: var(--cfa-red-deep); font-weight: 700; font-size: 12px; cursor: pointer; padding: 2px 4px; }
.thread-toggle:hover { text-decoration: underline; }
.thread-replies { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 4px 22px; padding-left: 12px; border-left: 2px solid var(--line); }
.msg.is-reply { font-size: 14px; }
.reply-banner { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--cfa-cream); border-top: 1px solid var(--line); font-size: 13px; }
.reply-banner .reply-to { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-banner button { border: none; background: none; cursor: pointer; font-size: 15px; color: var(--muted); }
.comm-thread-head { padding: 14px 18px; border-bottom: 1px solid var(--line); background: var(--surface); font-weight: 800; color: var(--cfa-red-deep); display: flex; align-items: center; gap: 8px; }
.comm-back { display: none; }
.comm-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 75%; padding: 8px 12px; border-radius: 14px; font-size: 14.5px; line-height: 1.4; position: relative; }
.msg .msg-sender { font-size: 11px; font-weight: 700; color: var(--cfa-red-dark); margin-bottom: 3px; display: flex; align-items: center; gap: 5px; }
.msg .msg-time { font-size: 10px; color: var(--muted); margin-top: 3px; text-align: right; }
.msg.theirs { background: var(--surface); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.mine { background: var(--cfa-red); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.mine .msg-time { color: rgba(255,255,255,.8); }
.msg .msg-del { font-size: 10px; cursor: pointer; opacity: .6; margin-left: 6px; }
.comm-compose { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); align-items: flex-end; }
.attach-btn { flex: none; cursor: pointer; font-size: 20px; padding: 7px 6px; border-radius: 8px; user-select: none; }
.attach-btn:hover { background: var(--cfa-cream); }
.compose-note { padding: 12px 14px; border-top: 1px solid var(--line); background: var(--cfa-cream); color: var(--ink-soft); font-size: 13px; font-weight: 600; text-align: center; }
.msg-img { max-width: 230px; max-height: 230px; border-radius: 10px; display: block; cursor: pointer; }
.file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: rgba(0,0,0,.06); color: inherit; text-decoration: none; font-size: 13.5px; }
.msg.mine .file-chip { background: rgba(255,255,255,.2); }
.file-chip .file-size { opacity: .7; font-size: 11px; }
.attach-preview { display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--cfa-cream); font-size: 13px; border-top: 1px solid var(--line); }
.attach-preview .x { cursor: pointer; color: var(--cfa-red); font-weight: 700; }
.mention-wrap { position: relative; flex: 1; }
.mention-wrap input { width: 100%; }
.mention-box { position: absolute; bottom: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 180px; overflow-y: auto; z-index: 10; }
.mention-opt { padding: 8px 12px; cursor: pointer; font-size: 14px; }
.mention-opt:hover, .mention-opt.active { background: var(--cfa-cream); }
.mention-opt .role-tag { color: var(--muted); font-size: 11px; }
.msg .mention { font-weight: 700; }
.msg.theirs .mention { color: var(--cfa-red-dark); }
.msg.mine .mention { text-decoration: underline; }
.msg .msg-report { font-size: 10px; cursor: pointer; opacity: .6; margin-left: 6px; }
.report-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.report-item .r-text { font-size: 14px; margin: 4px 0; }
.report-item .r-meta { font-size: 12px; color: var(--muted); }
.comm-modal { position: fixed; inset: 0; z-index: 500; background: rgba(20,12,16,.46); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 18px; }
.comm-modal-card { background: var(--surface); border-radius: var(--r-lg); padding: 24px; width: 100%; max-width: 420px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.comm-modal-card h3 { margin: 0 0 14px; color: var(--cfa-red-deep); }
@media (max-width: 720px) {
  .comm-wrap { grid-template-columns: 1fr; }
  .comm-wrap.thread-open .comm-sidebar { display: none; }
  .comm-wrap:not(.thread-open) .comm-main { display: none; }
  .comm-back { display: inline-block; }
  /* An open conversation takes over the full screen so the composer is always
     pinned to the bottom (no scrolling down to reach it) and the message list
     scrolls inside. Modals (z-index 500) still appear above this. */
  .comm-wrap.thread-open {
    position: fixed; inset: 0; z-index: 100;
    height: 100vh; height: 100dvh; background: var(--cfa-cream);
  }
  .comm-wrap.thread-open .comm-main { height: 100vh; height: 100dvh; }
  .scroll-down { bottom: 92px; }
}

/* ---------- App shell ---------- */
header.topbar {
  background: linear-gradient(180deg, #ec1d3d 0%, var(--cfa-red) 45%, var(--cfa-red-dark) 100%);
  color: #fff;
  padding: 13px 22px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 1px 0 rgba(0,0,0,.05), 0 10px 28px -14px rgba(79,11,22,.55);
  position: relative;
  z-index: 50;
}
.util-menu-btn { font-size: 18px; line-height: 1; position: relative; }
.util-dot { position: absolute; top: 2px; right: 2px; width: 9px; height: 9px; border-radius: 50%; background: #ffd166; border: 1.5px solid var(--cfa-red); }
.util-item-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--cfa-red); margin-left: 4px; vertical-align: middle; }
.whatsnew-body { max-height: 62vh; overflow-y: auto; }
.wn-entry { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.wn-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.wn-title { font-weight: 800; color: var(--cfa-red-deep); }
.wn-date { font-size: 11px; color: var(--muted); white-space: nowrap; }
.wn-items { margin: 4px 0 0; padding-left: 18px; }
.wn-items li { font-size: 14px; margin: 3px 0; line-height: 1.4; }
.util-menu { position: absolute; top: calc(100% - 4px); right: 16px; z-index: 600;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg);
  padding: 6px; display: flex; flex-direction: column; min-width: 218px; }
.util-item { background: none; border: none; box-shadow: none; text-align: left; padding: 11px 12px; border-radius: 9px;
  cursor: pointer; font-weight: 600; color: var(--ink); font-size: 15px; transition: background var(--t) var(--ease);
  display: flex; align-items: center; }
.util-item:hover { background: var(--brand-tint); }
/* Notification bell badge (count) + dropdown panel */
.util-dot.count { width: auto; height: auto; min-width: 16px; top: -4px; right: -4px; padding: 1px 4px; font-size: 10px; font-weight: 800; line-height: 1.3; color: var(--cfa-red-deep); background: #ffd166; border-radius: 9px; text-align: center; }
.notif-panel { position: absolute; top: calc(100% - 4px); right: 16px; z-index: 600;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  width: 340px; max-width: calc(100vw - 24px); overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 800; color: var(--cfa-red-deep); }
.notif-list { max-height: 70vh; overflow-y: auto; display: flex; flex-direction: column; }
.notif-empty { padding: 26px 14px; text-align: center; color: var(--muted); font-size: 14px; }
.notif-item { display: block; width: 100%; text-align: left; background: none; border: none; border-bottom: 1px solid var(--line); padding: 11px 14px; cursor: pointer; }
.notif-item:hover { background: var(--cfa-cream); }
.notif-item.unread { background: var(--brand-tint); }
.notif-item.unread .notif-title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--cfa-red); margin-right: 7px; vertical-align: middle; }
.notif-title { font-weight: 700; font-size: 14px; color: var(--ink); }
.notif-body { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.notif-time { font-size: 11px; color: var(--muted); margin-top: 3px; }
.notif-prefs { display: flex; flex-direction: column; gap: 2px; }
.notif-pref { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.notif-pref:last-child { border-bottom: none; }
.notif-pref span { font-weight: 600; font-size: 15px; }
.notif-pref input { width: 20px; height: 20px; }
.history-list { max-height: 60vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.history-row { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; }
.history-detail { font-size: 14px; }
.history-when { font-size: 11px; color: var(--muted); margin-top: 2px; }
.ms-scroll { overflow-x: auto; }
.ms-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ms-table th, .ms-table td { padding: 8px 6px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ms-table th { font-size: 11px; color: var(--muted); }
.ms-table .ms-name { text-align: left; font-weight: 700; }
.ms-table tr.ms-current { background: var(--brand-tint); }
.ms-table tfoot td { font-weight: 800; border-top: 2px solid var(--line); border-bottom: none; }
.admin-op { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.admin-op input { width: 150px; padding: 5px 8px; }

/* Checklists */
#checklistsView { max-width: 760px; margin: 0 auto; }
.cl-subtabs { display: flex; gap: 6px; margin: 8px 0; }
.cl-sub { flex: 1; padding: 9px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; font-weight: 700; cursor: pointer; color: var(--muted); }
.cl-sub.active { background: var(--cfa-red); color: #fff; border-color: var(--cfa-red); }
.cl-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 14px; margin-bottom: 12px; }
.cl-card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cl-title { font-weight: 800; font-size: 16px; }
.cl-pct { font-weight: 800; font-size: 15px; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.cl-pct.good { background: var(--green-bg); color: #2e7d32; } .cl-pct.warn { background: var(--amber-bg); color: #b97400; }
.cl-pct.bad { background: var(--red-bg); color: var(--cfa-red); } .cl-pct.na { background: var(--cfa-cream); color: var(--muted); }
.cl-sub2 { font-size: 12px; color: var(--muted); margin: 2px 0 8px; }
.cl-items { display: flex; flex-direction: column; gap: 4px; }
.cl-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.cl-item input { width: auto; flex: none; }
.cl-item.done .cl-item-text { text-decoration: line-through; color: var(--muted); }
.cl-item-text { flex: 1; }
.cl-by { font-size: 11px; color: var(--muted); font-weight: 700; }
.cl-edit-row { display: flex; gap: 6px; margin-bottom: 6px; }
.cl-edit-row .cl-edit-item { flex: 1; }

/* Schedule */
.sched-upload-btn { display: inline-block; padding: 10px 16px; border: 1px dashed var(--cfa-red); background: var(--brand-tint); color: var(--cfa-red); font-weight: 700; border-radius: 10px; cursor: pointer; }
.sched-upload-btn:hover { background: var(--red-bg); }
.sched-history { margin-top: 12px; }
.sched-hist-title { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.sched-hist-row { font-size: 13px; padding: 4px 0; border-top: 1px solid var(--line); }
.sched-row { display: flex; align-items: center; gap: 14px; padding: 11px 4px; border-bottom: 1px solid var(--line); }
.sched-row.today { background: var(--brand-tint); border-radius: 8px; }
.sched-day { width: 56px; flex: none; text-align: center; }
.sched-dow { font-size: 12px; font-weight: 800; color: var(--cfa-red-deep); text-transform: uppercase; }
.sched-date { font-size: 13px; color: var(--muted); }
.sched-time { font-weight: 800; font-size: 16px; }
.sched-pos { font-size: 12px; color: var(--muted); }
.sched-info { flex: 1; min-width: 0; }
.sched-contacts { flex: none; display: flex; align-items: center; gap: 8px; }
.sched-contact { font-size: 13px; font-weight: 700; color: var(--cfa-red-deep); text-decoration: none; white-space: nowrap; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; }
.sched-contact:hover { background: var(--brand-tint); }
/* Set Up / deployments */
#setupView { max-width: 880px; margin: 0 auto; }
.deploy-areas { display: flex; gap: 6px; margin: 8px 0 4px; }
.deploy-area-btn { flex: 1; padding: 9px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--r-sm); font-weight: 700; cursor: pointer; color: var(--ink-soft); transition: all var(--t) var(--ease); }
.deploy-area-btn.active { background: var(--cfa-red); color: #fff; border-color: var(--cfa-red); }
.deploy-frames { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.deploy-frame { padding: 8px 12px; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; font-weight: 600; font-size: 13px; cursor: pointer; color: var(--ink-soft); transition: all var(--t) var(--ease); }
.deploy-frame.active { background: var(--cfa-red); color: #fff; border-color: var(--cfa-red); }
.deploy-board { display: flex; gap: 14px; align-items: flex-start; margin-top: 8px; }
.deploy-positions { flex: 2; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.deploy-pool-wrap { flex: 1; min-width: 150px; position: sticky; top: 8px; }
.deploy-pos { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--surface); }
.deploy-pos-name { font-weight: 800; font-size: 13px; margin-bottom: 6px; }
.deploy-pos-slot { min-height: 44px; border: 1px dashed var(--line); border-radius: 8px; padding: 5px; display: flex; flex-wrap: wrap; gap: 5px; align-content: flex-start; }
.deploy-pool-head { font-size: 12px; font-weight: 800; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.deploy-pool { min-height: 60px; border: 1px dashed var(--cfa-red); border-radius: 10px; padding: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; background: var(--brand-tint); }
.deploy-drop.over { background: #ffe39e; border-color: var(--amber, #d98a00); }
.deploy-chip { display: inline-flex; flex-direction: column; align-items: flex-start; padding: 5px 11px; border-radius: 12px; background: var(--cfa-red); color: #fff; cursor: grab; touch-action: none; user-select: none; white-space: nowrap; line-height: 1.15; }
.deploy-chip .dc-name { font-weight: 700; font-size: 13px; }
.deploy-chip .dc-time { font-size: 10px; opacity: .85; font-weight: 600; }
.deploy-pos-slot .deploy-chip { background: var(--cfa-red-deep, #5a0b18); }
.deploy-ghost { position: fixed; z-index: 1000; pointer-events: none; transform: translate(-50%, -50%); box-shadow: var(--shadow); opacity: .95; }
.deploy-chip.dragging { opacity: .4; }
/* Tap-to-place: tap a name, then tap a position (easier than dragging on a phone) */
.deploy-chip.sel { outline: 3px solid #ffd400; outline-offset: 1px; }
.deploy-selbar { display: none; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 10px; padding: 9px 12px; border-radius: 10px; background: var(--brand-tint); border: 1px solid var(--cfa-red); font-weight: 700; font-size: 14px; color: var(--cfa-red-deep); }
.deploy-selbar.show { display: flex; }
.deploy-board.selecting .deploy-pos { cursor: pointer; }
.deploy-board.selecting .deploy-pos-slot, .deploy-board.selecting .deploy-pool { border-color: var(--green); border-style: solid; background: var(--green-bg); }
.deploy-board.selecting .deploy-pos:active .deploy-pos-slot { background: #c9f0d8; }
.dp-row { display: flex; gap: 4px; align-items: center; margin-bottom: 6px; }
.dp-row .dp-name { flex: 1; }
@media (max-width: 640px) {
  .deploy-board { flex-direction: column; }
  /* Keep the name pool pinned to the top so it's always reachable while you
     scroll the positions below — no more hunting up and down to drag. */
  .deploy-pool-wrap { width: 100%; order: -1; position: sticky; top: 0; z-index: 6; background: var(--cfa-cream); padding: 8px; border-radius: 0 0 14px 14px; box-shadow: 0 6px 14px rgba(0,0,0,.10); }
  /* Names in two columns so the pool reads as a tidy grid, not a tall stack. */
  .deploy-pool { display: grid; grid-template-columns: 1fr 1fr; align-content: start; max-height: 34vh; overflow-y: auto; }
  #deployPool .muted-sm { grid-column: 1 / -1; }
  /* Positions two-wide as well, so they aren't one long clunky stack. */
  .deploy-positions { grid-template-columns: 1fr 1fr; }
  /* Chips fill their cell and wrap long names instead of spilling past the box;
     assigned names stack so the slot just grows to fit everyone. */
  #deployPool .deploy-chip, .deploy-pos-slot .deploy-chip { width: 100%; }
  #deployPool .dc-name, .deploy-pos-slot .dc-name { white-space: normal; overflow-wrap: anywhere; }
}

.dash-sched { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.dash-sched-row { display: flex; align-items: center; gap: 12px; padding: 7px 4px; border-bottom: 1px solid var(--line); }
.dash-sched-row:last-child { border-bottom: none; }
.dash-sched-row.today { background: var(--brand-tint); border-radius: 8px; }
.dash-sched-day { width: 54px; flex: none; font-weight: 800; color: var(--cfa-red-deep); font-size: 13px; }
.dash-sched-time { font-weight: 700; flex: 1; }
.dash-sched-pos { font-size: 12px; color: var(--muted); }
/* Personal dashboard arrangement — drag & drop */
.dash-widget { grid-column: 1 / -1; position: relative; }
.dash-toolbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; margin: -6px 0 -8px; }
.dash-arrange-hint { font-size: 13px; color: var(--muted); }
#dashboardView.dash-arranging .dash-widget { outline: 2px dashed var(--cfa-red); outline-offset: 3px; border-radius: 18px; }
/* While arranging, a card's own controls are muted so dragging stays the focus. */
#dashboardView.dash-arranging .dash-widget button:not(.dash-handle),
#dashboardView.dash-arranging .dash-widget input,
#dashboardView.dash-arranging .dash-widget textarea,
#dashboardView.dash-arranging .dash-widget form { pointer-events: none; }
/* Grab handle shown on each card in arrange mode */
.dash-handle {
  position: absolute; top: 10px; right: 12px; z-index: 3;
  display: none; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 9px; cursor: grab;
  background: var(--brand-tint); border: 1px solid var(--cfa-red); color: var(--cfa-red-deep);
  font-weight: 800; font-size: 13px; touch-action: none; user-select: none;
}
#dashboardView.dash-arranging .dash-handle { display: inline-flex; }
.dash-handle:active { cursor: grabbing; }
.dash-widget.dragging { opacity: 0.4; }
.dash-placeholder { grid-column: 1 / -1; border: 2px dashed var(--cfa-red); border-radius: 18px; background: var(--brand-tint); }
.dash-drag-ghost {
  position: fixed; z-index: 9999; pointer-events: none; margin: 0;
  width: var(--ghost-w, 320px); transform: translate(-50%, -24px) rotate(1.5deg);
  box-shadow: 0 18px 40px rgba(0,0,0,0.28); opacity: 0.96;
}
/* Break management */
.break-rules { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 6px 0 14px; background: var(--cfa-cream); }
.break-rules h3 { margin: 0 0 10px; font-size: 15px; color: var(--cfa-red-deep); }
.break-rules .field { margin-bottom: 10px; }
.break-rules label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.break-rules input { width: 90px; }
.brk-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 11px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--surface); flex-wrap: wrap; }
.brk-info { flex: 1; min-width: 120px; }
.brk-row.overdue { border-color: var(--cfa-red); background: var(--red-bg); }
.brk-row.due { border-color: #d98a00; background: var(--amber-bg); }
.brk-name { font-weight: 800; }
.brk-minor { font-size: 10px; font-weight: 800; text-transform: uppercase; background: #7a3cff; color: #fff; padding: 1px 6px; border-radius: 999px; margin-left: 4px; }
.brk-young { background: #d12; }
.brk-warn { margin-top: 4px; font-size: 12px; font-weight: 800; color: var(--cfa-red-deep); }
.brk-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.brk-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.brk-pill { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.brk-pill.overdue { background: var(--cfa-red); color: #fff; }
.brk-pill.due { background: var(--amber-bg); color: #b97400; }
.brk-pill.needed { background: var(--cfa-cream); color: var(--cfa-red-deep); }
.brk-pill.done { background: var(--green-bg); color: #2e7d32; }
.brk-pill.none { background: #f1eef0; color: var(--muted); }

.dash-deploy { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.dash-deploy-row { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.dash-deploy-row:last-child { border-bottom: none; }
.dash-deploy-frame { width: 96px; flex: none; font-weight: 800; color: var(--cfa-red-deep); font-size: 13px; }
.dash-deploy-pos { font-weight: 700; }
.sched-day-tabs { display: flex; gap: 4px; margin: 8px 0; overflow-x: auto; }
.sched-day-tab { flex: 1; min-width: 44px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); cursor: pointer; color: var(--ink); }
.sched-day-tab.active { background: var(--cfa-red); color: #fff; border-color: var(--cfa-red); }
.sdt-dow { font-size: 10px; font-weight: 800; text-transform: uppercase; }
.sdt-num { font-size: 15px; font-weight: 800; }
.sdt-count { font-size: 10px; opacity: .75; }
.sched-filter { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 10px; }
.sched-chip { padding: 6px 12px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; font-size: 13px; font-weight: 700; cursor: pointer; color: var(--muted); }
.sched-chip.active { background: var(--cfa-red); color: #fff; border-color: var(--cfa-red); }
.cov-wrap { margin: 6px 0 12px; }
.cov-title { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
/* SVG column chart */
.cg { width: 100%; height: auto; display: block; margin: 6px 0 2px; overflow: visible; }
.cg-grid { stroke: var(--line); stroke-width: 1; }
.cg-ylab { fill: var(--muted); font-size: 9px; text-anchor: end; }
.cg-xlab { fill: var(--muted); font-size: 9px; text-anchor: middle; }
.cg-val { fill: var(--ink-soft); font-size: 9px; font-weight: 700; text-anchor: middle; }
.cg-bar { fill: var(--cfa-red); transition: fill .15s var(--ease); }
.cg-col { cursor: default; }
.cg-col:hover .cg-bar { fill: #c20f29; }
.cov-chart { display: flex; align-items: stretch; gap: 3px; height: 150px; overflow-x: auto; }
.cov-col { flex: 1; min-width: 26px; display: flex; flex-direction: column; align-items: center; }
.cov-n { font-size: 11px; font-weight: 800; color: var(--cfa-red-deep); height: 15px; }
.cov-bar-area { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.cov-bar { width: 72%; background: var(--cfa-red); border-radius: 4px 4px 0 0; min-height: 2px; }
.cov-h { font-size: 10px; color: var(--muted); margin-top: 3px; height: 14px; }
header .mark {
  width: 40px; height: 40px; border-radius: 12px; background: var(--surface); color: var(--cfa-red);
  display: grid; place-items: center; font-weight: 800; font-size: 22px;
}
.logo-mark { width: 64%; height: 64%; display: block; }
header .who { margin-left: auto; text-align: right; line-height: 1.2; display: flex; align-items: center; gap: 10px; }
header .who .name { font-weight: 700; }
header .who .role { font-size: 12px; opacity: .85; text-transform: capitalize; }
header button { background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); box-shadow: none; color: #fff; }
header button:hover { background: rgba(255,255,255,.26); box-shadow: none; }
header .who .role { letter-spacing: .01em; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* Phone layout: store name + who on row 1, action buttons wrap to row 2 */
@media (max-width: 620px) {
  header.topbar { flex-wrap: wrap; padding: 12px 14px; gap: 8px 10px; }
  header.topbar .mark { width: 34px; height: 34px; font-size: 18px; }
  #headerStore { font-size: 15px !important; }
  header .who { gap: 8px; }
  header .who .name { font-size: 13px; }
  .topbar-actions { flex-basis: 100%; justify-content: flex-end; }
  header button { padding: 8px 14px; font-size: 13px; }
  .tabs { padding: 12px 10px 0; }
}

main {
  max-width: 760px; margin: 0 auto; padding: 22px;
  display: grid; gap: 22px; grid-template-columns: 1fr;
}

.card {
  background: var(--surface); border-radius: var(--r-lg); padding: 21px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
  transition: box-shadow var(--t) var(--ease);
}
.card h2 { margin: 0 0 14px; font-size: 16.5px; color: var(--cfa-red-deep); font-weight: 800; letter-spacing: -0.015em; }
.card h2 .sub { font-weight: 500; color: var(--muted); font-size: 13px; letter-spacing: 0; }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-head h2 { margin: 0; flex: 1; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding: 4px 0; text-transform: uppercase; }
.cal-cell {
  min-height: 74px; border: 1px solid var(--line); border-radius: 10px; padding: 5px 6px;
  background: var(--surface); display: flex; flex-direction: column; gap: 3px;
}
.cal-cell.empty { background: transparent; border: none; }
.cal-cell.today { border-color: var(--cfa-red); box-shadow: 0 0 0 1px var(--cfa-red); }
.cal-date { font-size: 12px; font-weight: 700; color: var(--muted); }
.pill {
  font-size: 11px; line-height: 1.25; padding: 2px 6px; border-radius: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
}
.pill.complete { background: var(--green-bg); color: var(--green); border: 1px solid #bfe6cd; }
.pill.failed   { background: var(--red-bg);   color: var(--red);   border: 1px solid #f1c4c4; }
.pill.pending  { background: var(--amber-bg); color: var(--amber); border: 1px solid #f0dca6; }

.legend { display: flex; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.dot.complete { background: var(--green); }
.dot.failed { background: var(--red); }
.dot.pending { background: var(--amber); }

/* ---------- Goal list ---------- */
.goal {
  border: 1px solid var(--line); border-left-width: 5px; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 10px; background: var(--surface);
}
.goal.complete { border-left-color: var(--green); }
.goal.failed   { border-left-color: var(--red); }
.goal.pending  { border-left-color: var(--amber); }
.goal .row1 { display: flex; align-items: center; gap: 10px; }
.goal .title { font-weight: 700; flex: 1; }
.goal .badge { font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px; text-transform: uppercase; }
.goal .badge.complete { background: var(--green-bg); color: var(--green); }
.goal .badge.failed { background: var(--red-bg); color: var(--red); }
.goal .badge.pending { background: var(--amber-bg); color: var(--amber); }
.goal .meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.goal .desc { font-size: 13.5px; margin-top: 6px; }
.goal .actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.goal .actions .locked { font-size: 12px; color: var(--muted); align-self: center; }
button.ok { background: var(--green); }
button.ok:hover { background: #246e45; }
button.bad { background: var(--red); }
button.bad:hover { background: #b32f2f; }

.empty-note { color: var(--muted); font-size: 14px; padding: 18px 10px; text-align: center; line-height: 1.55; }

/* ---------- Loading & empty states ---------- */
/* Rich empty state — icon + title + optional subtitle/action */
.empty-state { text-align: center; padding: 34px 18px; }
.empty-state .es-icon { width: 56px; height: 56px; border-radius: 16px; display: inline-grid; place-items: center;
  background: var(--icon-tint); color: var(--icon); margin-bottom: 13px; }
.empty-state .es-icon .ic { width: 27px; height: 27px; }

/* Line-icon system */
.ic { width: 1.05em; height: 1.05em; display: inline-block; vertical-align: -0.16em; flex: none; }
[data-icon], .theme-ic { display: inline-flex; align-items: center; }
.seg .ic, .tab .ic { width: 17px; height: 17px; vertical-align: -3px; margin-right: 7px; stroke-width: 3.24; color: var(--icon); }
.seg.active .ic, .tab.active .ic { color: #fff; } /* white on the active red pill */
.util-item .ic { width: 18px; height: 18px; vertical-align: -4px; margin-right: 9px; color: var(--icon); }
.util-menu-btn .ic { width: 20px; height: 20px; }
/* Heading icons take the indigo accent; button icons match the button's text. */
.card h2 .ic, .today-head .ic, .cem-head h2 .ic, h3 .ic, .focus-label .ic, .shoutout-label .ic { color: var(--icon); margin-right: 8px; vertical-align: -3px; }
button .ic { margin-right: 6px; vertical-align: -2px; }
.today-head { display: flex; align-items: center; }
/* Icon-only buttons: no label, so no right margin */
.scroll-down .ic, .attach-btn .ic, #pollBtn .ic { margin-right: 0; width: 20px; height: 20px; }
/* Consistency-sweep icon placements (area selector, calendar nav, compose note, feature toggles, schedule contacts) */
.area-emoji .ic { width: 38px; height: 38px; stroke-width: 2.2; color: var(--cfa-red); margin: 0; }
.cal-head button .ic, .comm-back .ic { width: 18px; height: 18px; margin: 0; vertical-align: -4px; color: var(--icon); }
.compose-note .ic { color: var(--icon); margin-right: 4px; vertical-align: -3px; }
.feat-toggle .ic { color: var(--icon); margin: 0; }
.sched-contact .ic { width: 14px; height: 14px; margin-right: 3px; vertical-align: -2px; color: var(--icon); }
.empty-state .es-title { font-size: 15px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.empty-state .es-sub { font-size: 13.5px; color: var(--muted); margin: 5px auto 0; line-height: 1.55; max-width: 330px; }
.empty-state .es-action { margin-top: 15px; }

/* Skeleton shimmer placeholders */
.skeleton { position: relative; overflow: hidden; background: #efeaec; border-radius: 7px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent); animation: shimmer 1.3s var(--ease) infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk-line { height: 12px; margin: 7px 0; }
.sk-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); }
.sk-row:last-child { border-bottom: none; }
.sk-av { width: 38px; height: 38px; border-radius: 50%; flex: none; }
.sk-grow { flex: 1; min-width: 0; }
.sk-card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; margin-bottom: 12px; background: var(--surface); }

/* Inline spinner */
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--brand-tint-2); border-top-color: var(--cfa-red); animation: spin .7s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* App boot splash */
.app-loading { position: fixed; inset: 0; z-index: 9000; display: grid; place-items: center;
  background: radial-gradient(120% 90% at 50% -10%, #f43a54 0%, var(--cfa-red) 38%, var(--cfa-red-dark) 72%, var(--cfa-red-deep) 100%); }
.app-loading .al-mark { width: 78px; height: 78px; border-radius: 22px; background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.28); color: #fff; display: grid; place-items: center; }
.app-loading .al-mark svg { width: 58%; height: 58%; }
.app-loading .al-bar { width: 134px; height: 4px; border-radius: 999px; background: rgba(255,255,255,.24); margin-top: 24px; overflow: hidden; }
.app-loading .al-bar::after { content: ""; display: block; width: 40%; height: 100%; border-radius: 999px; background: var(--surface); animation: slideBar 1.1s var(--ease) infinite; }
@keyframes slideBar { 0% { transform: translateX(-130%); } 100% { transform: translateX(340%); } }
.field-row { display: flex; gap: 10px; }
.field-row > div { flex: 1; }

/* People manager */
.person { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.person .role-tag { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.person .grow { flex: 1; min-width: 130px; }
.role-select { width: auto; padding: 6px 8px; font-size: 12px; border-radius: 8px; }

/* Account › Security & privacy */
.sessions-list { margin-bottom: 10px; }
.sessions-list .person:last-child { border-bottom: none; }
.acct-data-rights { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.acct-data-rights h3 { font-size: 14px; font-weight: 700; margin: 0 0 10px; }
.acct-rights-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.acct-rights-row:last-child { border-bottom: none; }
.acct-rights-row .grow { flex: 1; min-width: 0; }
button.ghost.danger { color: var(--red); }
button.ghost.danger:hover { background: var(--red-bg); border-color: var(--red); }

/* Ask your store (AI assistant) */
.assistant-card textarea { width: 100%; resize: vertical; min-height: 52px; }
.assistant-answer { white-space: pre-wrap; background: var(--brand-tint); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 4px 0 12px; font-size: 14px; line-height: 1.55; max-height: 320px; overflow: auto; }
.assistant-answer.assistant-loading { color: var(--muted); font-style: italic; }
.assistant-disclaimer { margin-top: 10px; color: var(--muted); }

/* Micro-interactions: consistent focus-visible halos on every interactive surface
   (buttons + inputs already have them — this fills links, tabs, segs, menu/area
   items) and a reusable inline spinner for async button actions. */
a:focus-visible, .tab:focus-visible, .seg:focus-visible, .util-item:focus-visible,
.area-btn:focus-visible, .btn-file:focus-visible, [tabindex]:focus-visible {
  outline: none; box-shadow: var(--ring); border-radius: 8px;
}
.btn-spin {
  display: inline-block; width: 14px; height: 14px; margin-right: 7px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  vertical-align: -2px; animation: btn-spin .6s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* Food safety summary (#24) */
.fs-summary { display: flex; gap: 20px; flex-wrap: wrap; margin: 4px 0 14px; }
.fs-stat { display: flex; flex-direction: column; }
.fs-num { font-size: 22px; font-weight: 800; line-height: 1.1; }
.fs-lbl { font-size: 12px; color: var(--muted); margin-top: 2px; }
.fs-stat.fs-bad .fs-num { color: var(--red); }

/* Command palette (#17) */
.cmdk { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: grid; place-items: start center; padding-top: 12vh; z-index: 200; }
.cmdk-box { width: min(560px, 92vw); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; }
#cmdkInput { width: 100%; border: none; border-bottom: 1px solid var(--line); padding: 16px 18px; font-size: 16px; background: transparent; color: var(--ink); }
#cmdkInput:focus { outline: none; box-shadow: none; }
.cmdk-list { max-height: 50vh; overflow: auto; padding: 6px; }
.cmdk-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; color: var(--ink); }
.cmdk-item.active { background: var(--brand-tint); }
.cmdk-item .cmdk-hint { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.cmdk-empty { padding: 18px; color: var(--muted); font-size: 14px; text-align: center; }

/* Certifications (#25) */
.cert-add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.cert-add #certName { flex: 1; min-width: 160px; }
.cert-add #certExpires { width: auto; }
.cert-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; vertical-align: 1px; margin-left: 4px; }
.cert-badge.cert-valid { background: var(--green-bg); color: var(--green); }
.cert-badge.cert-expired { background: var(--red-bg); color: var(--red); }
.cert-badge.cert-none { background: var(--brand-tint); color: var(--muted); }
.cert-badge.cert-soon { background: #fff4e0; color: #9a5b00; }
:root[data-theme="dark"] .cert-badge.cert-soon { background: rgba(212,160,23,.22); color: #f0c66a; }

/* First-run welcome (#16) */
.welcome-card { text-align: center; max-width: 460px; }
.welcome-card .mark { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 14px; background: var(--cfa-red); color: #fff; display: grid; place-items: center; box-shadow: 0 8px 20px rgba(229,22,54,.3); }
.welcome-card .mark svg { width: 30px; height: 30px; }
.welcome-list { list-style: none; padding: 0; margin: 14px 0 0; text-align: left; display: grid; gap: 10px; }
.welcome-list li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 1.45; }
.welcome-list li [data-icon] { color: var(--icon); flex: 0 0 auto; margin-top: 1px; }
/* Weekly focus banner (spans both dashboard columns) */
.focus-card {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #fff, var(--cfa-cream));
  border: 1.5px solid var(--line);
  border-left: 6px solid var(--cfa-red);
}
.focus-head { display: flex; align-items: center; gap: 10px; }
.focus-label {
  flex: 1; font-size: 12px; font-weight: 800; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--cfa-red);
}
.focus-text {
  font-size: 24px; font-weight: 800; color: var(--cfa-red-deep);
  margin-top: 6px; line-height: 1.3;
}
.focus-text.empty { font-size: 16px; font-weight: 500; font-style: italic; color: var(--muted); }
.focus-meta { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* Upcoming Events — large full-width calendar */
.events-page { max-width: 1200px; margin: 0 auto; padding: 22px; }
.cal-grid.big { gap: 8px; }
.cal-grid.big .cal-cell { min-height: 118px; padding: 7px 8px; }
.cal-grid.big .cal-date { font-size: 14px; }
.ev-pill {
  background: var(--cfa-red); color: #fff; font-size: 11.5px; font-weight: 600;
  padding: 3px 7px; border-radius: 6px; cursor: pointer; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ev-pill:hover { background: var(--cfa-red-dark); }
.ev-pill.past { background: var(--muted); }
.cal-grid.big .cal-cell { cursor: default; }
.ev-detail-row { margin: 6px 0; font-size: 14.5px; }
.ev-detail-row .lbl { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; display: block; margin-bottom: 1px; }

/* Uniform requests */
.ureq {
  border: 1px solid var(--line); border-left-width: 5px; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 10px; background: var(--surface);
}
.ureq.pending, .ureq.open { border-left-color: var(--amber); }
.ureq.ordered, .ureq.done { border-left-color: var(--green); }
.ureq.train { border-left-color: var(--cfa-red); }
.ureq-type { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.ureq-top { display: flex; align-items: center; gap: 10px; }
.ureq-item { font-weight: 700; flex: 1; }
.ureq-note { margin: 8px 0 6px; font-size: 14px; }
.ureq-meta { font-size: 12.5px; color: var(--muted); }
.ureq .actions { margin-top: 10px; }
.ureq .badge {
  font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  text-transform: uppercase; flex: none;
}
.ureq .badge.pending { background: var(--amber-bg); color: var(--amber); }
.ureq .badge.complete { background: var(--green-bg); color: var(--green); }
.usub { font-size: 14px; color: var(--cfa-red-deep); margin: 18px 0 10px; }
.usub.first { margin-top: 0; }

/* Shout-outs */
.shoutout-banner {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #fff, var(--amber-bg));
  border: 1.5px solid var(--line);
  border-left: 6px solid var(--amber);
}
.shoutout-head { margin-bottom: 6px; }
.shoutout-label { font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--amber); }
.shoutout-display { min-height: 46px; display: flex; align-items: center; }
.shoutout-item { animation: soIn 0.5s ease; font-size: 16px; line-height: 1.4; }
.shoutout-item .so-people { color: var(--cfa-red-deep); font-weight: 800; }
.shoutout-item .so-msg { color: var(--ink); }
@keyframes soIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }

.so-feed-item { border: 1px solid var(--line); border-left: 4px solid var(--amber); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; background: var(--surface); }
.so-feed-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.so-people { font-weight: 700; color: var(--cfa-red-deep); }
.so-time { font-size: 12px; color: var(--muted); margin-left: auto; }
.so-feed-msg { margin-top: 6px; font-size: 14.5px; }
.so-feed-item .actions { margin-top: 8px; }

/* Corporate mission statement */
.login-card .mission {
  margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line);
  font-size: 12px; font-style: italic; color: var(--muted);
  text-align: center; line-height: 1.55;
}
.mission-footer {
  max-width: 720px; margin: 0 auto; padding: 26px 18px 34px;
  text-align: center; font-size: 12.5px; font-style: italic;
  color: var(--muted); line-height: 1.6;
}
.mission-footer strong {
  display: block; font-style: normal; font-size: 11px; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--cfa-red-deep); margin-bottom: 6px;
}

/* Discipline */
.rsa-tally.dsc-green { color: var(--green); }
.rsa-tally.dsc-yellow { color: var(--amber); }
.rsa-tally.dsc-red { color: var(--red); }
.dsc-person { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; background: var(--surface); }
.dsc-person-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.dsc-person-name { font-weight: 800; flex: 1; }
.dsc-total { font-weight: 800; font-size: 15px; padding: 3px 11px; border-radius: 999px; }
.dsc-total.dsc-green { color: var(--green); background: var(--green-bg); }
.dsc-total.dsc-yellow { color: var(--amber); background: var(--amber-bg); }
.dsc-total.dsc-red { color: var(--red); background: var(--red-bg); }
.dsc-item { border-top: 1px solid var(--line); padding: 9px 0 4px; font-size: 13.5px; }
.dsc-item:first-child { border-top: none; }
.dsc-item .dsc-meta { color: var(--muted); font-size: 12px; margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.dsc-pts { font-weight: 800; color: var(--cfa-red-dark); }
.dsc-expired { opacity: 0.6; }
.dsc-expired-tag { font-style: italic; color: var(--muted); }

/* Multi-select assignee list */
.assignee-list {
  max-height: 210px; overflow-y: auto;
  border: 1.5px solid var(--line); border-radius: 10px; padding: 5px;
}
.assignee-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 9px; border-radius: 8px; cursor: pointer; font-size: 14px;
}
.assignee-row:hover { background: var(--cfa-cream); }
.assignee-row input { width: auto; margin: 0; flex: none; }
.assignee-row .role-tag { color: var(--muted); font-size: 11px; }
.muted-count { font-weight: 500; color: var(--muted); font-size: 13px; }

/* Account page + avatars */
.account-profile { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.avatar-lg {
  width: 92px; height: 92px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--line); background: var(--cfa-cream);
}
.avatar-fallback {
  display: grid; place-items: center; font-size: 36px; font-weight: 800;
  color: #fff; background: var(--cfa-red); border-color: var(--cfa-red);
}
.avatar-controls { display: flex; flex-direction: column; gap: 8px; }
.btn-file {
  display: inline-block; cursor: pointer; background: var(--cfa-red); color: #fff;
  padding: 9px 16px; border-radius: 999px; font-weight: 600; font-size: 14px; text-align: center;
}
.btn-file:hover { background: var(--cfa-red-dark); }
.hint-sm { font-size: 12px; color: var(--muted); }
.avatar-sm {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  border: 1.5px solid rgba(255, 255, 255, 0.6);
}

/* CEM scorecard */
.cem-head { display: flex; align-items: center; gap: 10px; }
.cem-head h2 { flex: 1; margin: 0; }
.cem-meta { font-size: 12.5px; color: var(--muted); margin: 4px 0 12px; }
.cem-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cem-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cem-row:last-child { border-bottom: none; }
.cem-row:nth-child(odd) { background: var(--cfa-cream); }
.cem-label { flex: 1; font-weight: 600; }
.cem-val { font-weight: 800; font-size: 19px; color: var(--cfa-red-deep); min-width: 64px; text-align: right; }
.cem-trend { font-size: 17px; width: 24px; text-align: center; }
.cem-trend.up { color: var(--green); }
.cem-trend.down { color: var(--red); }
.cem-trend.flat { color: var(--amber); }

/* Today action panel */
.today-panel { grid-column: 1 / -1; border-left: 6px solid var(--green); }
.today-head { font-size: 12px; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--green); margin-bottom: 8px; }
.today-item { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.today-item:last-child { border-bottom: none; }
.today-item .ti-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.today-item .ti-dot.warn { background: var(--amber); }
.today-item .ti-dot.due { background: var(--cfa-red); }
.today-clear { color: var(--muted); font-size: 14px; padding: 4px 0; }
.today-item a, .today-link { color: var(--cfa-red-dark); font-weight: 600; cursor: pointer; }

/* Announcement banner + board */
.ann-banner { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 10px; }
.ann-card {
  background: linear-gradient(135deg, #fff, var(--cfa-cream));
  border: 1.5px solid var(--line); border-left: 6px solid var(--cfa-red);
  border-radius: 16px; padding: 14px 18px; box-shadow: var(--shadow);
}
.ann-card .ann-body { font-size: 15px; font-weight: 600; color: var(--ink); white-space: pre-wrap; }
.ann-meta { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ann-aud { font-size: 11px; font-weight: 700; text-transform: uppercase; padding: 1px 7px; border-radius: 999px; background: var(--brand-tint); color: var(--cfa-red-dark); }
.ann-expired { opacity: 0.55; }

/* Birthdays */
.bday-banner { grid-column: 1 / -1; border-left: 6px solid var(--amber); text-align: center; font-size: 17px; font-weight: 700; color: var(--cfa-red-deep); }
.bday-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.bday-row:last-child { border-bottom: none; }
.bday-when { margin-left: auto; font-weight: 700; color: var(--cfa-red-dark); }
.bday-soon { color: var(--amber); }

/* Data / analytics */
.data-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 18px; }
.stat { border: 1px solid var(--line); border-radius: 14px; padding: 14px; text-align: center; background: var(--surface); }
.stat .num { font-size: 30px; font-weight: 800; color: var(--cfa-red-deep); line-height: 1; }
.stat .lbl { font-size: 12px; color: var(--muted); margin-top: 6px; }
.stat.good .num { color: var(--green); }
.stat.warn .num { color: var(--amber); }
.stat.bad .num { color: var(--red); }
.data-section-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--cfa-red-deep); margin: 18px 0 10px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; font-size: 13.5px; }
.bar-row .bar-label { width: 130px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; background: var(--cfa-cream); border-radius: 999px; height: 18px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--cfa-red); border-radius: 999px; }
.bar-val { width: 44px; flex: none; text-align: right; font-weight: 700; }

/* Temperature logs */
.temp-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.temp-row:last-child { border-bottom: none; }
.temp-row label { flex: 1; font-weight: 600; font-size: 14px; margin: 0; }
.temp-row .temp-unit { color: var(--muted); font-size: 13px; }
.temp-row input { width: 84px; text-align: center; }
.temp-log-item { border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px; margin-bottom: 10px; background: var(--surface); }
.temp-log-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.temp-log-top .who { font-weight: 700; color: var(--ink); }
.temp-readings { display: flex; flex-wrap: wrap; gap: 6px; }
.temp-chip { font-size: 12px; padding: 3px 9px; border-radius: 7px; font-weight: 600; }
.temp-chip.ok { background: var(--green-bg); color: var(--green); }
.temp-chip.bad { background: var(--red-bg); color: var(--red); }

/* Daily RSA tally */
.rsa-tally { font-size: 46px; font-weight: 800; color: var(--cfa-red-deep); line-height: 1; margin: 6px 0; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.rsa-tally.done { color: var(--green); }
.rsa-tally .rsa-of { font-size: 22px; color: var(--muted); font-weight: 700; margin-left: 4px; }
.rsa-status { font-size: 14px; color: var(--muted); font-weight: 600; }

/* RSA calendar cell states */
.cal-cell.rsa-green { background: var(--green-bg); border-color: #bfe6cd; }
.cal-cell.rsa-red   { background: var(--red-bg);   border-color: #f1c4c4; }
.cal-cell.rsa-amber { background: var(--amber-bg); border-color: #f0dca6; }
.rsa-cell-count { font-size: 13px; font-weight: 800; margin-top: auto; }
.rsa-green .rsa-cell-count { color: var(--green); }
.rsa-red .rsa-cell-count   { color: var(--red); }
.rsa-amber .rsa-cell-count { color: var(--amber); }

/* Tabs — single horizontally-scrollable row (keeps mobile tidy) */
.tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 14px 12px 2px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}
.tabs::-webkit-scrollbar { display: none; } /* Chrome / Safari */
.tab { flex: 0 0 auto; white-space: nowrap; background: var(--surface); color: var(--ink-soft); border: 1px solid var(--line-strong); font-weight: 600; letter-spacing: -0.01em; box-shadow: none; transition: background var(--t) var(--ease), color var(--t) var(--ease), border-color var(--t) var(--ease), box-shadow var(--t) var(--ease); }
.tab:hover { background: var(--brand-tint); color: var(--cfa-red-dark); border-color: var(--brand-tint-2); }
.tab.active { background: var(--cfa-red); color: #fff; border-color: var(--cfa-red); box-shadow: 0 4px 12px -3px rgba(194,15,41,.42); }
.tab.active:hover { background: var(--cfa-red-dark); color: #fff; }

/* Daily Feedback page */
.feedback-page { max-width: 760px; margin: 0 auto; padding: 22px; }
.fb-day { margin-bottom: 22px; }
.fb-day:last-child { margin-bottom: 0; }
.fb-date {
  font-weight: 800; color: var(--cfa-red-deep); font-size: 15px;
  margin: 0 0 10px; padding-bottom: 6px; border-bottom: 2px solid var(--line);
}
.fb-entry {
  border: 1px solid var(--line); border-left-width: 5px; border-radius: 12px;
  padding: 12px 14px; margin-bottom: 10px; background: var(--surface);
}
.fb-entry.complete { border-left-color: var(--green); }
.fb-entry.failed { border-left-color: var(--red); }
.fb-top { display: flex; align-items: center; gap: 10px; }
.fb-goal { font-weight: 700; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-time { color: var(--muted); font-size: 12px; flex: none; }
.fb-note { margin: 9px 0 6px; font-size: 14.5px; font-style: italic; line-height: 1.45; }
.fb-meta { font-size: 12.5px; color: var(--muted); }
.fb-entry .badge {
  font-size: 11px; font-weight: 700; padding: 2px 9px; border-radius: 999px;
  text-transform: uppercase; flex: none;
}
.fb-entry .badge.complete { background: var(--green-bg); color: var(--green); }
.fb-entry .badge.failed { background: var(--red-bg); color: var(--red); }

/* Feedback input inside a markable goal */
.mark-box { width: 100%; }
.fb-input { margin-bottom: 8px; resize: vertical; min-height: 44px; }

/* Vision banner */
.vision {
  background: #940929;
  color: #fff;
  text-align: center;
  padding: 12px 18px;
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 10px;
}
.vision-label {
  font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  color: #ffd7dd; opacity: .9;
}
.vision-text { font-size: 18px; font-weight: 700; font-style: italic; }
.vision #visionEditBtn { background: rgba(255,255,255,0.18); color: #fff; border: none; }
.vision #visionEditBtn:hover { background: rgba(255,255,255,0.3); }
.vision-editor { background: #940929; padding: 0 18px 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.vision-editor input { max-width: 420px; }
.vision-editor .error { color: #ffd7dd; }

/* Personal rank badge */
.rank-badge {
  text-align: center; font-weight: 800; font-size: 14px;
  padding: 11px 12px; border-radius: 12px; margin-bottom: 14px;
  background: var(--brand-tint); color: var(--cfa-red-dark);
}
.rank-badge.gold   { background: linear-gradient(135deg, var(--amber-bg), #ffe28a); color: #876400; }
.rank-badge.silver { background: linear-gradient(135deg, #f3f5f8, #d9dee6); color: #555f6e; }
.rank-badge.bronze { background: linear-gradient(135deg, #f8e7d6, #e8c39a); color: #7a4a1d; }
.rank-badge.zero   { background: var(--cfa-cream); color: var(--muted); }

/* Leaderboard */
#leaderboardCard { margin-bottom: 22px; }
.lb-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 8px; border-bottom: 1px solid var(--line); border-radius: 8px;
  font-size: 14px;
}
.lb-row:last-child { border-bottom: none; }
.lb-row.me { background: var(--cfa-cream); }
.lb-row.podium .lb-name { font-weight: 700; }
.lb-rank {
  width: 30px; flex: none; text-align: center;
  font-weight: 800; color: var(--muted); font-size: 15px;
}
.lb-rank.medal { font-size: 20px; }
.lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name .role-tag { color: var(--muted); font-size: 11px; }
.lb-pts {
  flex: none; font-weight: 800; color: var(--cfa-red-dark);
  background: var(--brand-tint); border-radius: 999px; padding: 3px 11px; font-size: 13px;
}
.lb-sep { text-align: center; color: var(--muted); font-size: 14px; letter-spacing: 2px; padding: 2px 0; }

/* Car count */
.car-hours { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 6px 0 12px; }
.car-hour { border: 1px solid var(--line); border-radius: 10px; padding: 8px; text-align: center; background: var(--surface); }
.car-hour.filled { border-color: #2e9e44; background: var(--green-bg); }
.car-hour-lbl { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 5px; white-space: nowrap; }
.car-hour input { width: 100%; text-align: center; padding: 7px 4px; font-weight: 700; font-size: 15px; }
.car-hour-val { font-weight: 800; font-size: 16px; padding: 6px 0; }
.car-total { font-size: 15px; padding-top: 4px; border-top: 1px solid var(--line); }
.car-trend { font-size: 14px; font-weight: 700; white-space: nowrap; }
.car-trend-txt { color: var(--muted); font-weight: 600; font-size: 13px; }
.cal-cell.car-selected { outline: 2px solid var(--cfa-red); outline-offset: -2px; }
.car-records { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.car-rec { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.car-rec-lbl { font-weight: 700; width: 84px; flex: none; font-size: 13px; }
.car-rec-val { flex: 1; font-weight: 800; }
.car-rec-when { color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.car-rec.edit .car-rec-count { width: 90px; flex: none; text-align: center; font-weight: 700; }
.car-rec.edit .car-rec-date { flex: 1; }
.muted-sm { color: var(--muted); font-size: 12px; }
@media (max-width: 560px) { .car-hours { grid-template-columns: repeat(3, 1fr); } }

/* Toasts — stacked, slide-up, auto-dismiss */
.toast-host { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 2000;
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: max-content; max-width: 92vw; }
.toast-item { display: flex; align-items: center; gap: 9px; background: var(--ink); color: #fff;
  padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(12px) scale(.97); transition: opacity .2s var(--ease), transform .2s var(--ease); max-width: 100%; }
.toast-item.in { opacity: 1; transform: none; }
.toast-item .toast-ic { display: inline-flex; }
.toast-item .toast-ic .ic { width: 17px; height: 17px; }
.toast-item.success .toast-ic { color: #6ee7a8; }
.toast-item.error .toast-ic { color: #ff8f8f; }
.toast-item.info .toast-ic { color: #a7ced8; }

/* Branded dialog — confirm / alert / prompt */
.app-dialog { position: fixed; inset: 0; z-index: 2100; display: grid; place-items: center; padding: 20px;
  background: rgba(20,12,16,.46); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .18s var(--ease); }
.app-dialog.in { opacity: 1; }
.app-dialog-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 400px; padding: 22px 22px 18px; transform: translateY(10px) scale(.96); transition: transform .2s var(--ease); }
.app-dialog.in .app-dialog-card { transform: none; }
.dlg-title { margin: 0 0 8px; font-size: 17px; font-weight: 800; color: var(--ink); letter-spacing: -.02em; }
.dlg-msg { margin: 0 0 16px; font-size: 14px; color: var(--ink-soft); line-height: 1.55; white-space: pre-line; }
.dlg-input { margin-bottom: 16px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Motion: view & modal entrances ---------- */
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
.feedback-page, #commView, #checklistsView, #scheduleView, #setupView, #breaksView, #adminView {
  animation: viewIn .26s var(--ease) both;
}
.comm-modal:not(.hidden) .comm-modal-card { animation: modalIn .2s var(--ease) both; }
/* Dashboard cards rise in with a gentle stagger on load */
#dashboardView > .card, #dashboardView > .dash-widget { animation: cardIn .34s var(--ease) both; }
#dashboardView > *:nth-child(2) { animation-delay: .03s; }
#dashboardView > *:nth-child(3) { animation-delay: .06s; }
#dashboardView > *:nth-child(4) { animation-delay: .09s; }
#dashboardView > *:nth-child(5) { animation-delay: .12s; }
#dashboardView > *:nth-child(6) { animation-delay: .15s; }
#dashboardView > *:nth-child(n+7) { animation-delay: .18s; }
/* Honor users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* App Admin console */
.admin-wrap { max-width: 760px; margin: 0 auto; padding: 4px 0 30px; }
.admin-card h2 { margin: 0 0 4px; }
.admin-create { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--cfa-cream); }
.admin-create h3 { margin: 0 0 10px; font-size: 15px; }
.admin-create-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.admin-create-row .field { flex: 1; min-width: 130px; margin: 0; }
.admin-create-row button { flex: none; white-space: nowrap; }
.admin-store-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.admin-store { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.admin-store.current { border-color: var(--cfa-red); background: var(--brand-tint); }
.admin-store-info { flex: 1; }
.admin-store-name { font-weight: 700; }
.admin-store-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
@media (max-width: 560px) {
  .admin-create-row { flex-direction: column; align-items: stretch; }
  .admin-create-row button { width: 100%; }
}

/* Contact Support */
.app-footer { margin-top: 26px; padding: 18px 0 8px; border-top: 1px solid var(--line); text-align: center; }
.link-btn { background: none; border: none; color: var(--cfa-red); font-weight: 700; font-size: 14px; cursor: pointer; padding: 6px 10px; }
.link-btn:hover { text-decoration: underline; }
.support-start { display: block; width: calc(100% - 20px); margin: 6px 10px; padding: 9px; border: 1px dashed var(--cfa-red); background: var(--brand-tint); color: var(--cfa-red); font-weight: 700; border-radius: 10px; cursor: pointer; }
.support-start:hover { background: var(--red-bg); }

/* Files & photos gallery */
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; max-height: 60vh; overflow-y: auto; padding: 2px; }
.file-cell { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--surface); transition: border-color .15s, transform .1s; }
.file-cell:hover { border-color: var(--cfa-red); transform: translateY(-1px); }
.file-thumb { display: block; width: 100%; height: 90px; object-fit: cover; background: var(--cfa-cream); }
.file-cell-doc .file-doc { height: 90px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 26px; padding: 6px; background: var(--cfa-cream); }
.file-doc-name { font-size: 11px; font-weight: 700; color: var(--ink); text-align: center; word-break: break-word; line-height: 1.2; max-height: 28px; overflow: hidden; }
.file-doc .file-size { font-size: 10px; color: var(--muted); font-weight: 600; }
.file-meta { display: flex; justify-content: space-between; gap: 4px; padding: 4px 6px; font-size: 10px; color: var(--muted); }
.file-by { font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Polls */
.msg.has-poll { max-width: 340px; width: 100%; }
.poll { display: flex; flex-direction: column; gap: 7px; }
.poll-q { font-weight: 800; font-size: 14px; }
.poll-opts { display: flex; flex-direction: column; gap: 6px; }
.poll-opt { position: relative; overflow: hidden; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 11px; cursor: pointer; font: inherit; }
.poll-opt:hover:not(:disabled) { border-color: var(--cfa-red); }
.poll-opt:disabled { cursor: default; }
.poll-opt.chosen { border-color: var(--cfa-red); }
.poll-bar { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(221, 0, 49, 0.12); transition: width .3s ease; z-index: 0; }
.poll-opt.chosen .poll-bar { background: rgba(221, 0, 49, 0.22); }
.poll-opt-row { position: relative; z-index: 1; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.poll-opt-text { font-weight: 600; }
.poll-opt-count { font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; }
.poll-foot { font-size: 11px; color: var(--muted); font-weight: 600; }
.poll-close { color: var(--cfa-red); cursor: pointer; font-weight: 700; }
.poll-close:hover { text-decoration: underline; }
.poll-opt-input { display: flex; gap: 6px; margin-bottom: 6px; }
.poll-opt-input input { flex: 1; }
.poll-opt-remove { flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; cursor: pointer; color: var(--muted); padding: 0 10px; }
.poll-opt-remove:hover { color: var(--cfa-red); border-color: var(--cfa-red); }
.poll-multi-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 13px; }
.poll-multi-row input { width: auto; }

/* Owner UI customization */
.feature-toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-top: 8px; }
.feat-toggle { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; font-size: 14px; }
.feat-toggle input { width: auto; }
/* Knowledge Base / SOPs */
.sop-head-actions { display: flex; gap: 8px; align-items: center; }
#sopSearch { margin: 12px 0 8px; }
.sop-cat-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.sop-chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); font-size: 13px; font-weight: 600; cursor: pointer; transition: all var(--t) var(--ease); }
.sop-chip:hover { border-color: var(--cfa-red); }
.sop-chip.active { background: var(--cfa-red); border-color: var(--cfa-red); color: #fff; }
.sop-list { display: flex; flex-direction: column; gap: 8px; }
.sop-item { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.sop-item-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: none; border: none; cursor: pointer; text-align: left; color: var(--ink); }
.sop-item-head:hover { background: var(--brand-tint); }
.sop-item-title { flex: 1; font-weight: 700; font-size: 14.5px; }
.sop-item-cat { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--icon); background: var(--brand-tint-2); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.sop-caret .ic { width: 16px; height: 16px; color: var(--muted); transition: transform var(--t) var(--ease); }
.sop-item.open .sop-caret .ic { transform: rotate(90deg); }
.sop-item-body { padding: 12px 14px 14px; font-size: 14px; line-height: 1.6; color: var(--ink-soft); border-top: 1px solid var(--line); }
.sop-item-meta { margin-top: 10px; font-size: 12px; color: var(--muted); }
.sop-cat-row { display: flex; gap: 6px; margin-bottom: 6px; }
.sop-cat-row input { flex: 1; }
.tab-edit { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 12px; background: var(--surface); }
.tab-edit-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tab-edit-head .icon-in { width: 48px; text-align: center; flex: none; }
.tab-edit-head input[data-f="name"] { flex: 1; min-width: 120px; }
.widget-list { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.widget-edit { border: 1px dashed var(--line); border-radius: 10px; padding: 10px; background: var(--cfa-cream); }
.we-head { display: flex; gap: 8px; align-items: center; }
.we-head input { flex: 1; }
.we-type { font-size: 11px; text-transform: uppercase; font-weight: 800; color: var(--muted); }
.link-row, .ev-row { display: flex; gap: 6px; margin-bottom: 6px; }
.link-row input { flex: 1; }
.ev-row input[data-ef="label"] { flex: 1; }
.add-widgets { margin-top: 10px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
/* Custom widgets (read-only view) */
.custom-head { margin-bottom: 10px; }
.custom-widget { margin-top: 14px; }
.widget-notes { line-height: 1.5; white-space: normal; }
.widget-links { display: flex; flex-direction: column; gap: 8px; }
.widget-link { display: inline-block; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; font-weight: 700; color: var(--cfa-red); background: var(--surface); text-decoration: none; }
.widget-link:hover { border-color: var(--cfa-red); background: var(--brand-tint); }
.wcal-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.wcal-nav { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.wcal-nav button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; width: 30px; height: 30px; cursor: pointer; }
.wcal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.wcal-dow { text-align: center; font-size: 11px; font-weight: 800; color: var(--muted); padding-bottom: 2px; }
.wcal-cell { min-height: 60px; border: 1px solid var(--line); border-radius: 8px; padding: 4px; font-size: 11px; background: var(--surface); }
.wcal-cell.empty { border: none; background: transparent; }
.wcal-cell.has-ev { border-color: var(--cfa-red); }
.wcal-num { font-weight: 700; color: var(--muted); }
.wcal-evs { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.wcal-ev { font-size: 10px; padding: 1px 4px; border-radius: 4px; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wcal-ev.blue { background: #2f6fed; } .wcal-ev.green { background: #2e9e44; } .wcal-ev.amber { background: #d98a00; } .wcal-ev.red { background: var(--cfa-red); }
.we-perms { display: flex; gap: 12px; flex-wrap: wrap; margin: 6px 0 8px; font-size: 12px; }
.we-perms select { width: auto; padding: 4px 8px; }
.we-h { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; }
.we-h input { width: 80px; }
.item-row { display: flex; gap: 6px; margin-bottom: 6px; }
.item-row input { flex: 1; }
/* Embedded doc */
.widget-embed { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.widget-embed-open { display: inline-block; margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--cfa-red); text-decoration: none; }
/* Shared checklist */
.checklist { display: flex; flex-direction: column; gap: 4px; }
.chk-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.chk-item input { width: auto; flex: none; }
.chk-item.done .chk-text { text-decoration: line-through; color: var(--muted); }
.chk-text { flex: 1; }
.chk-by { font-size: 11px; color: var(--muted); font-weight: 700; }
/* Task calendar (RSA/FSA-style) */
.task-controls { margin: 8px 0; font-size: 14px; }
.task-count { display: block; font-size: 10px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.wcal-cell.task-met { background: var(--green-bg); border-color: #2e9e44; }
.wcal-cell.task-met .task-count { color: #2e9e44; }
.wcal-cell.task-partial { background: var(--amber-bg); border-color: #d98a00; }
.wcal-cell.task-missed { background: var(--red-bg); border-color: var(--cfa-red); }
.wcal-cell.task-missed .task-count { color: var(--cfa-red); }

.msg-highlight { animation: msgFlash 2s ease; border-radius: 12px; }
@keyframes msgFlash {
  0%, 35% { box-shadow: 0 0 0 3px #ffd166, 0 0 14px 2px rgba(255, 209, 102, 0.8); }
  100% { box-shadow: 0 0 0 0 rgba(255, 209, 102, 0); }
}

/* ---------- Desktop / wide-screen: sidebar app shell ---------- */
@media (min-width: 1000px) {
  header.topbar { position: sticky; top: 0; z-index: 50; }
  /* The section nav becomes a fixed left sidebar (same buttons, restyled) */
  .section-toggle {
    position: fixed; top: 0; left: 0; bottom: 0; width: 232px; z-index: 40;
    flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 4px;
    padding: 78px 14px 18px; overflow-y: auto;
    background: var(--surface); border-right: 1px solid var(--line); border-bottom: none;
  }
  .section-toggle .seg { justify-content: flex-start; width: 100%; border: 1px solid transparent; border-radius: 11px; font-size: 14.5px; padding: 11px 14px; }
  .section-toggle .seg:hover { border-color: transparent; }
  .section-toggle .seg .ic { width: 19px; height: 19px; margin-right: 11px; }
  /* Shift each section's content to the right of the sidebar */
  #hubBody, #commView, #checklistsView, #scheduleView, #setupView, #breaksView, #adminView { margin-left: 232px; }
  /* Give the centered content columns a bit more room on big screens */
  main { max-width: 880px; }
  #setupView, .feedback-page { max-width: 1000px; }
}
