:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #1c2733;
  --muted: #67788a;
  --line: #dde4ec;
  --brand: #0d5c63;
  --brand-dark: #093f44;
  --urgent: #c0392b;
  --high: #d97b0d;
  --medium: #2874a6;
  --low: #7f8c9b;
  --good: #1e8449;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }

header {
  display: flex; align-items: center; gap: 24px;
  background: var(--brand-dark); color: #fff; padding: 10px 20px;
  position: sticky; top: 0; z-index: 20;
}
.brand { font-size: 17px; font-weight: 700; letter-spacing: .3px; }
.brand span { font-weight: 300; opacity: .85; }
nav button {
  background: none; border: none; color: #cfe3e5; font-size: 14px;
  padding: 8px 14px; cursor: pointer; border-radius: 6px;
}
nav button.active, nav button:hover { background: rgba(255,255,255,.14); color: #fff; }
.search-box { position: relative; margin-left: auto; flex: 0 1 340px; }
.search-box input {
  width: 100%; padding: 7px 12px; border-radius: 8px; border: none; font-size: 13px;
  background: rgba(255,255,255,.14); color: #fff;
}
.search-box input::placeholder { color: #b8d2d4; }
.search-box input:focus { background: #fff; color: var(--ink); outline: none; }
.search-results {
  position: absolute; top: 40px; right: 0; width: 520px; max-width: 90vw;
  max-height: 480px; overflow-y: auto; background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 60;
}
.search-results .sr {
  display: flex; gap: 10px; align-items: baseline; padding: 9px 14px;
  border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13px;
}
.search-results .sr:hover { background: #f0f6f7; }
.search-results .sr .nm { font-weight: 700; flex: 1; }
.search-results .sr .meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.search-results .sr .bal { font-weight: 700; font-variant-numeric: tabular-nums; }
.search-results .none { padding: 12px 14px; color: var(--muted); font-size: 13px; }
.st-tag {
  display: inline-block; padding: 1px 7px; border-radius: 12px; font-size: 10.5px;
  font-weight: 700; background: #e8edf2; color: #4a5a6a; white-space: nowrap;
}
.st-tag.active { background: #e3f2e8; color: #1e8449; }
.st-tag.departed { background: #f0f0f0; color: #8a94a0; }
.who { display: flex; align-items: center; gap: 8px; }
.who select {
  font-size: 14px; padding: 6px 10px; border-radius: 6px; border: none;
}

main { max-width: 1200px; margin: 0 auto; padding: 18px 20px 60px; }

.stat-row { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 16px; min-width: 120px;
}
.stat .v { font-size: 22px; font-weight: 700; }
.stat .l { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.stat.urgent .v { color: var(--urgent); }
.stat.good .v { color: var(--good); }

/* ---- the "work this now" card ---- */
.now-card {
  background: var(--panel); border: 2px solid var(--brand); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 18px; box-shadow: 0 4px 14px rgba(13,92,99,.12);
}
.kicker { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; color: var(--brand); }
.kicker.urgent { color: var(--urgent); }
.now-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.now-head h2 { margin: 2px 0 4px; font-size: 24px; }
.now-phone { margin: 4px 0 2px; font-size: 21px; font-weight: 800; color: var(--brand-dark); }
.now-phone .no-phone { color: var(--muted); font-weight: 600; font-size: 15px; }
.now-phone .edit-phone {
  border: none; background: none; cursor: pointer; font-size: 14px;
  color: var(--brand); margin-left: 6px;
}
.now-phone .em { font-size: 13px; font-weight: 500; color: var(--muted); margin-left: 10px; }
.other-accts {
  margin: 10px 0; padding: 10px 12px; border-radius: 8px;
  background: #eef4fb; border: 1px solid #cfdff2;
}
.other-accts .oa-title { font-weight: 700; font-size: 13px; margin-bottom: 6px; color: #1f4e79; }
.other-accts .oa-row {
  display: flex; gap: 14px; font-size: 13px; padding: 3px 0; flex-wrap: wrap;
}
.other-accts .oa-row .bal { font-weight: 700; font-variant-numeric: tabular-nums; }
.ids { color: var(--muted); font-size: 13px; }
.ids b { color: var(--ink); user-select: all; }
.balance-block { text-align: right; }
.big-balance { font-size: 30px; font-weight: 800; color: var(--brand-dark); }
.balance-block .sub { color: var(--muted); font-size: 12px; }
.promise-banner {
  margin: 10px 0 2px; padding: 12px 14px; border-radius: 8px;
  background: #e8f8ee; border: 2px solid #1e8449; color: #145a32;
  font-size: 15px; line-height: 1.45;
}
.promise-banner .p-label { font-weight: 800; text-transform: uppercase; letter-spacing: .6px; font-size: 12.5px; }
.promise-banner .p-note { font-weight: 600; }
.promise-banner .p-meta { color: #3f7050; font-size: 12px; }
.time-hint {
  margin: 10px 0 2px; padding: 8px 12px; border-radius: 8px;
  background: #fdf3e3; border: 1px solid #f0d9ab; color: #8a5a00; font-weight: 600;
}
.now-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px 18px; margin: 12px 0; padding: 12px; background: #f8fafc;
  border-radius: 8px; border: 1px solid var(--line);
}
.now-grid .f .l { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.now-grid .f .v { font-weight: 600; }
.now-history { margin: 8px 0; }
.now-history .h-item {
  display: flex; gap: 10px; padding: 5px 0; border-top: 1px dashed var(--line); font-size: 13px;
}
.now-history .h-item:first-child { border-top: none; }
.h-when { color: var(--muted); white-space: nowrap; min-width: 145px; }
.h-code { font-weight: 600; }
.h-note { color: var(--muted); }

.log-box { border-top: 2px solid var(--line); padding-top: 12px; margin-top: 8px; }
.log-title { font-weight: 700; margin-bottom: 8px; }
.code-buttons { display: flex; flex-direction: column; gap: 10px; }
.code-group .cg-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px;
  color: var(--muted); margin-bottom: 5px;
}
.code-group .cg-btns { display: flex; flex-wrap: wrap; gap: 8px; }
button.primary:disabled { opacity: .45; cursor: not-allowed; }
.code-buttons button {
  border: 1px solid var(--line); background: #fff; padding: 8px 12px; border-radius: 8px;
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink);
}
.code-buttons button:hover { border-color: var(--brand); color: var(--brand); }
.code-buttons button.good { border-color: #bfe3cd; background: #f0faf4; }
.code-buttons button.bad { border-color: #f2cfc9; background: #fdf5f4; }
.code-buttons button.stop { border-color: var(--urgent); background: #fdeeec; color: #8e2418; font-weight: 700; }
.code-buttons button.stop:hover { border-color: #8e2418; color: #6b1a10; }
.note-pane { margin-top: 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.picked { font-weight: 700; margin-bottom: 6px; color: var(--brand-dark); }
.note-pane textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px; font: inherit; }
.note-actions { margin-top: 8px; display: flex; gap: 8px; }

button.primary {
  background: var(--brand); color: #fff; border: none; padding: 9px 16px;
  border-radius: 8px; font-weight: 700; cursor: pointer; font-size: 13px;
}
button.primary:hover { background: var(--brand-dark); }
button:not(.primary):not(nav button):not(.code-buttons button):not(.modal-close):not(.linkish) {
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 14px; cursor: pointer; font-size: 13px;
}

.empty { text-align: center; padding: 50px 0; color: var(--muted); }

.list-block {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 14px; padding: 0;
}
.list-block summary {
  cursor: pointer; font-weight: 700; padding: 12px 16px; user-select: none;
}
.count { color: var(--muted); font-weight: 400; margin-left: 6px; }
.table-wrap { overflow-x: auto; padding: 0 8px 8px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase;
     letter-spacing: .4px; padding: 6px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f0f6f7; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px;
  font-weight: 700; color: #fff; white-space: nowrap;
}
.badge.Urgent { background: var(--urgent); }
.badge.High { background: var(--high); }
.badge.Medium { background: var(--medium); }
.badge.Low { background: var(--low); }
.badge.None { background: #b9c2cc; }

/* ---- manager ---- */
.mgr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px;
}
.card.wide { grid-column: 1 / -1; }
.card h3 { margin: 0 0 8px; }
.card h4 { margin: 14px 0 6px; }
.drop-zone {
  border: 2px dashed var(--line); border-radius: 8px; padding: 22px; text-align: center;
  color: var(--muted); margin: 10px 0;
}
.drop-zone.over { border-color: var(--brand); color: var(--brand); background: #f0f7f8; }
.row-actions { display: flex; align-items: center; gap: 12px; margin: 8px 0; flex-wrap: wrap; }
.import-result { font-size: 13px; margin-top: 6px; }
.import-result .ok { color: var(--good); font-weight: 600; }
.import-result .err { color: var(--urgent); font-weight: 600; }
.add-collector { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.add-collector input[type=text], .add-collector input:not([type]) {
  border: 1px solid var(--line); border-radius: 6px; padding: 8px; font: inherit;
}
.settings-form { display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
.settings-form label { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.settings-form input { width: 90px; border: 1px solid var(--line); border-radius: 6px; padding: 6px; font: inherit; }
.rules-days { width: 60px; border: 1px solid var(--line); border-radius: 6px; padding: 5px; font: inherit; }

.an-row { margin-bottom: 10px; }
.an-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 3px; gap: 12px; }
.an-bar { height: 10px; background: #edf1f5; border-radius: 6px; overflow: hidden; }
.an-bar div { height: 100%; background: var(--brand); border-radius: 6px; }
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--brand-dark); color: #fff; padding: 12px 22px; border-radius: 30px;
  font-weight: 600; box-shadow: 0 6px 18px rgba(0,0,0,.25); z-index: 50;
}
.toast.err { background: var(--urgent); }

.modal {
  position: fixed; inset: 0; background: rgba(15,25,35,.45); z-index: 40;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px;
  overflow-y: auto;
}
.modal-body {
  background: #fff; border-radius: 12px; max-width: 860px; width: 100%;
  padding: 22px; position: relative;
}
.modal-log {
  margin-top: 16px; border-top: 2px solid var(--line); padding-top: 12px;
}
.modal-log h3 { margin: 0 0 8px; }
.modal-log-grid { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.modal-log-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.modal-log-grid select, .modal-log-grid input {
  border: 1px solid var(--line); border-radius: 6px; padding: 7px; font: inherit; min-width: 180px;
}
.modal-log textarea { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 8px; font: inherit; }
.modal-close {
  position: absolute; top: 10px; right: 12px; border: none; background: none;
  font-size: 18px; cursor: pointer; color: var(--muted);
}
@media (max-width: 900px) { .mgr-grid { grid-template-columns: 1fr; } }

/* ---- supervisor / manager week tables ---- */
th.grp { text-align: center; border-bottom: 1px solid var(--line); background: rgba(0,0,0,.03); }
tr.today-row td { background: #f0f7f8; }

/* ---- collector scorecard ---- */
#scTable td.sc-help { font-size: 12px; max-width: 360px; }
#scTable tr.sc-group td { background: rgba(0,0,0,.04); font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: .5px; color: var(--muted); }
#scTable td.sc-team { font-weight: 600; border-left: 1px solid var(--line); }
#scTable td.sc-best { color: var(--good); font-weight: 700; }

.st-tag.yld { background: #fff4d6; color: #7a5200; }

/* ---- cloud version additions ---- */
.login-overlay { position: fixed; inset: 0; background: var(--brand-dark, #0f3d42); display: flex; align-items: center; justify-content: center; z-index: 50; }
.login-box { background: #fff; border-radius: 12px; padding: 28px 30px; width: 380px; max-width: 92vw; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.login-box .brand { color: var(--brand-dark, #0f3d42); font-size: 20px; margin-bottom: 18px; }
.login-step { display: flex; flex-direction: column; gap: 12px; }
.login-step label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.login-step input { border: 1px solid var(--line); border-radius: 6px; padding: 9px 10px; font: inherit; font-size: 15px; }
.login-step button.primary { padding: 10px; font-size: 15px; }
.login-step p { margin: 0; font-size: 13.5px; line-height: 1.4; }
.login-msg { margin-top: 12px; font-size: 13px; color: var(--muted); min-height: 18px; }
.login-msg.err { color: var(--urgent); }
.qr { display: flex; justify-content: center; min-height: 40px; }
.secret-key { font-size: 12px; color: var(--muted); word-break: break-all; }
.secret-key code { user-select: all; }
.small { font-size: 12px; }
.who-name { font-weight: 600; font-size: 13px; }
.who label { font-size: 12px; opacity: .85; }
button.linkish { background: none; border: 1px solid rgba(255,255,255,.4); color: inherit; border-radius: 6px; padding: 4px 8px; cursor: pointer; font: inherit; font-size: 12px; }
button.linkish:hover { background: rgba(255,255,255,.12); }
.amount-row { margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.amount-row label { font-weight: 600; font-size: 13px; }
.amount-row input { width: 120px; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: inherit; }
.settings-form.col { flex-direction: column; align-items: stretch; }
.settings-form.col label { flex-direction: column; align-items: stretch; }
.settings-form textarea, .settings-form.col input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font: inherit; }
.rules-label, .rules-bp { width: 100%; border: 1px solid var(--line); border-radius: 4px; padding: 4px 6px; font: inherit; font-size: 12.5px; }
.rules-days { width: 60px; }
#nu_email, #nu_name, #nu_logins { width: 260px; }
#nu_idle { width: 90px; }
nav a.nav-link { color: #fff; opacity: .85; text-decoration: none; padding: 6px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; }
nav a.nav-link:hover { background: rgba(255,255,255,.12); opacity: 1; }
.st-tag.directory { background: #eef2f7; color: #4a5a6a; }

.pk-row { margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.modal-actions { display: flex; gap: 12px; align-items: flex-end; margin-top: 14px; }
.modal-actions label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
