:root {
  --navy: #0b2545;
  --navy2: #123a6b;
  --gold: #c9a227;
  --gold-soft: #f3e5bb;
  --bg: #f4f6fa;
  --card: #ffffff;
  --ink: #1c2733;
  --muted: #66788c;
  --red: #b3261e;
  --red-bg: #fdecea;
  --green: #1d7a3a;
  --line: #dde3ec;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--navy2); }
header.topbar {
  background: var(--navy); color: #fff; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; position: sticky; top: 0; z-index: 20; flex-wrap: wrap;
}
header.topbar .logo { font-weight: 800; letter-spacing: .3px; }
header.topbar .logo span { color: var(--gold); }
header.topbar .who { margin-left: auto; font-size: 14px; color: #dbe4f2; }
.badge { background: var(--gold); color: var(--navy); border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; text-transform: capitalize; }
button, .btn {
  background: var(--navy2); color: #fff; border: 0; border-radius: 8px; padding: 11px 18px;
  font-size: 15px; cursor: pointer; text-decoration: none; display: inline-block; min-height: 44px;
}
button.gold { background: var(--gold); color: var(--navy); font-weight: 700; }
button.ghost { background: transparent; color: var(--navy2); border: 1px solid var(--line); }
button.danger { background: var(--red); }
button.small { padding: 7px 12px; font-size: 13px; min-height: 34px; }
button:disabled { opacity: .5; cursor: default; }
/* Lead contact actions (Sam, 2026-12-05): Email / Text / Call must be
   impossible to miss on every lead card — prominent gold buttons on
   the collapsed card AND in the expanded detail. */
button.lead-act { padding: 9px 16px; font-size: 14px; min-height: 40px; font-weight: 700; }
.lead-actions button { margin: 2px 4px 2px 0; }
input, select, textarea {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
  background: #fff; color: var(--ink); width: 100%;
}
label { font-size: 13px; color: var(--muted); display: block; margin: 8px 0 4px; }
main { max-width: 1100px; margin: 0 auto; padding: 16px; }
nav.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0; }
nav.tabs button { background: #e7ecf4; color: var(--navy); padding: 11px 18px; font-size: 15px; }
nav.tabs button.active { background: var(--navy); color: #fff; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 14px; }
.card h2, .card h3 { margin-top: 0; color: var(--navy); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
.mut { color: var(--muted); }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.flag-red { background: var(--red-bg); color: var(--red); border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 700; }
/* Attendance (Sam, 2026-11-23): dashboard-top summary strip for Owner /
   Supervisor, the blinking late alert for HR (coaching mode), and the
   red late badge on the Team Lead's attendance panel header. */
.att-strip { border-left: 5px solid var(--gold); }
/* Credentialing editor table (2026-11-29): the global width:100% on
   inputs squeezes the row editors unreadably when ten columns share
   the card. Inside this table only, controls take their natural width
   and the wrapping div scrolls sideways on narrow screens. */
table.credtable select, table.credtable input { width: auto; }
.att-alert { background: var(--red-bg); border: 2px solid var(--red); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; color: var(--red); animation: attPulse 1.1s ease-in-out infinite; }
.att-alert h3 { margin: 0 0 6px; color: var(--red); }
@keyframes attPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.att-badge { background: var(--red); color: #fff; border-radius: 999px; padding: 1px 9px; font-size: 12px; font-weight: 700; vertical-align: middle; }
.att-toggle.active { background: var(--navy); color: #fff; }
.flag-warn { background: #fff4d6; color: #8a6100; border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 700; }
.flag-ok { background: #e4f4e9; color: var(--green); border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 700; }
.login-wrap { max-width: 400px; margin: 60px auto; padding: 0 16px; }
.login-wrap .card { border-top: 5px solid var(--gold); }
.err { background: var(--red-bg); color: var(--red); border-radius: 8px; padding: 8px 12px; font-size: 14px; margin: 10px 0; display: none; }
.bell { position: relative; }
.bell .count { position: absolute; top: -6px; right: -6px; background: var(--red); color: #fff; border-radius: 999px; font-size: 11px; padding: 1px 6px; }
.notif { border-bottom: 1px solid var(--line); padding: 8px 0; font-size: 14px; }
.notif b { color: var(--navy); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 160px; }
details.person { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 8px; background: #fff; }
details.person summary { cursor: pointer; font-weight: 600; }
/* Clickable person names (Sam, 2026-12-04): CEO team only — highlighted
   (gold underline + soft gold wash) and clickable to the profile. */
a.person-link { color: var(--navy2); font-weight: 600; text-decoration: underline; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 2px; background: rgba(201, 162, 39, .14); border-radius: 4px; padding: 0 3px; cursor: pointer; }
a.person-link:hover { color: var(--navy); background: var(--gold-soft); }
details.person.person-flash { outline: 2px solid var(--gold); outline-offset: 2px; }
.leak { border-left: 4px solid var(--gold); padding: 6px 10px; margin: 8px 0; background: #fffdf4; font-size: 14px; }
.hidden { display: none !important; }
.msg { max-width: 78%; padding: 9px 12px; border-radius: 12px; margin: 6px 0; font-size: 14px; width: fit-content; }
.msg.mine { background: var(--navy2); color: #fff; margin-left: auto; }
.msg.theirs { background: #eef2f8; color: var(--ink); }
.msg-meta { font-size: 11px; opacity: .75; margin-top: 4px; }
/* Messages — iPhone-style two-pane layout (Sam, 2026-11-23 late batch):
   conversation list down the left, open conversation on the right. */
.msg-shell { display: flex; gap: 12px; align-items: flex-start; }
.msg-list { flex: 0 0 264px; max-width: 264px; max-height: 560px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.msg-convo { display: block; width: 100%; text-align: left; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 8px; cursor: pointer; color: var(--ink); }
.msg-convo:hover { background: #eef2f8; }
.msg-convo.active { background: var(--navy2); color: #fff; }
.msg-convo.active .mut { color: #cfd9ea; }
.msg-convo-top { display: flex; align-items: center; gap: 4px; }
.msg-unread { background: var(--gold, #c9a227); color: #111; border-radius: 999px; font-size: 11px; font-weight: 700; padding: 0 6px; line-height: 16px; }
tr.att-first td { background: #fff6da; font-weight: 600; }
.msg-convo-snippet { display: block; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.msg-main { flex: 1 1 auto; min-width: 0; }
/* Proper inbox (Sam, 2026-12-05): search + ✎ New on top of the list,
   the new-conversation picker under them, and on phones a single
   column — list first, thread replaces it, back button returns. */
.msg-list-tools { display: flex; gap: 6px; align-items: center; }
.msg-list-tools input[type="search"] { flex: 1 1 auto; min-width: 0; }
.msg-list-tools button { flex: none; }
/* Filter chips (Sam, 2026-12-05): My chats / All chats / Contacts
   across the top of the conversation list. */
.msg-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.msg-chip { flex: 1 1 auto; border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.msg-chip:hover { background: #eef2f8; }
.msg-chip.active { background: var(--navy2); color: #fff; border-color: var(--navy2); }
.msg-contact-go { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--navy2); white-space: nowrap; }
.msg-convo.active .msg-contact-go { color: var(--gold-soft); }
.msg-picker { border: 1px solid var(--gold, #c9a227); border-radius: 8px; padding: 6px; background: #fffdf4; }
.msg-picker input[type="search"] { width: 100%; box-sizing: border-box; margin-bottom: 6px; }
.msg-picker-list { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.msg-back { display: none; }
@media (max-width: 720px) {
  .msg-shell { flex-direction: column; }
  .msg-list { flex: none; max-width: none; width: 100%; max-height: none; }
  .msg-shell.msg-thread-open .msg-list { display: none; }
  .msg-shell:not(.msg-thread-open) .msg-main { display: none; }
  .msg-back { display: inline-block; }
}
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; vertical-align: middle; flex: none; }
.avatar-sm { width: 26px; height: 26px; font-size: 11px; }
.avatar-lg { width: 64px; height: 64px; font-size: 24px; }
.avatar-initials { display: inline-flex; align-items: center; justify-content: center; background: var(--navy2); color: var(--gold-soft); font-weight: 700; }
header.topbar .avatar-initials { background: var(--gold); color: var(--navy); }
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 24px 0; }

/* Assignment board (Sam, 2026-11-28): one column per team lead, plus
   the Unassigned pool; practices are draggable chips (tap-to-assign
   fallback via the .picked outline). */
.assign-board { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.assign-col { flex: 1 1 200px; border: 2px dashed var(--line); border-radius: 10px; padding: 10px; min-height: 90px; background: var(--bg); }
.assign-col h4 { margin: 0 0 8px; color: var(--navy); }
.assign-col.dragover { border-color: var(--gold); background: #fffdf4; }
.asr-chip { display: inline-block; background: var(--navy2); color: #fff; border-radius: 8px; padding: 7px 12px; font-size: 13px; font-weight: 600; margin: 0 6px 6px 0; }
.assign-chip { background: var(--navy2); color: #fff; border-radius: 8px; padding: 9px 12px; margin: 0 0 8px; cursor: grab; font-size: 14px; font-weight: 600; }
.assign-chip.picked { outline: 3px solid var(--gold); background: var(--navy); }
.assign-lead-sel { width: auto; max-width: 170px; padding: 7px 8px; font-size: 13px; }

/* Work Log drill-down (Sam, 2026-12-01): the breakdown rows (By type /
   By rep / By team / By practice) are tappable filters — a tap narrows
   the entries list below to exactly that slice; the active slice stays
   highlighted in gold. */
tr.wl-click { cursor: pointer; }
tr.wl-click:hover td { background: #eef2f8; }
tr.wl-click:active td { background: var(--gold-soft); }
tr.wl-active td { background: var(--gold-soft); font-weight: 600; }

/* Batch #5: the printable accountability log sheet is the ONLY thing
   on paper — everything else on screen stays off the printout. */
#printArea { display: none; }
@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block; font-family: Georgia, serif; color: #000; }
  #printArea table { font-size: 13px; }
}
