:root {
  --bg: #f4f6f3;
  --panel: #ffffff;
  --ink: #18201b;
  --muted: #66716a;
  --line: #dfe4df;
  --brand: #0f7a4b;
  --brand-ink: #ffffff;
  --brand-soft: #e3f2ea;
  --danger: #c0392b;
  --warn: #b7791f;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 14px rgba(0,0,0,.04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); }
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.2; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.mono { font-variant-numeric: tabular-nums; font-family: ui-monospace, "SF Mono", Consolas, monospace; }

/* top bar + tabs */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--brand); color: var(--brand-ink);
  display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem;
}
.topbar .logo { font-weight: 700; letter-spacing: .3px; }
.topbar .who { margin-left: auto; font-size: .85rem; opacity: .9; }
.topbar button { background: rgba(255,255,255,.15); color: inherit; border: 0; }
.tabs {
  display: flex; gap: .25rem; overflow-x: auto; background: var(--panel);
  border-bottom: 1px solid var(--line); padding: 0 .5rem; position: sticky; top: 48px; z-index: 9;
}
.tabs button {
  background: none; border: 0; border-bottom: 3px solid transparent; border-radius: 0;
  padding: .8rem .9rem; color: var(--muted); font-weight: 600; white-space: nowrap;
}
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }

main { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.view { display: none; }
.view.active { display: block; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem;
}
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; }
.row > * { flex: 1 1 140px; }
.row > .shrink { flex: 0 0 auto; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.stat .num { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; }
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: .4rem 0; }
.bar > span { display: block; height: 100%; background: var(--brand); }

/* forms */
label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: .25rem; font-weight: 600; }
input, select {
  width: 100%; padding: .65rem .75rem; font: inherit; color: inherit;
  border: 1px solid var(--line); border-radius: 9px; background: #fff;
}
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: -1px; border-color: transparent; }
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1rem; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--ink);
}
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
button.danger { color: var(--danger); }
button.sm { padding: .35rem .6rem; font-size: .85rem; }
button:disabled { opacity: .5; cursor: not-allowed; }

/* tables -> cards on mobile */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
td.edit { cursor: pointer; border-radius: 6px; }
td.edit:hover { background: var(--brand-soft); }
td.edit input { padding: .35rem .5rem; }
@media (max-width: 680px) {
  table.cards thead { display: none; }
  table.cards tr { display: block; border: 1px solid var(--line); border-radius: 10px; margin-bottom: .6rem; padding: .3rem .2rem; background: #fff; }
  table.cards td { display: flex; justify-content: space-between; gap: 1rem; border: 0; padding: .35rem .6rem; }
  table.cards td::before { content: attr(data-label); color: var(--muted); font-size: .8rem; font-weight: 600; }
}

/* tags */
.tag { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .75rem; font-weight: 600; background: var(--line); }
.tag.REAL { background: var(--brand-soft); color: var(--brand); }
.tag.UN { background: #fdf3df; color: var(--warn); }
.tag.DP { background: #fbe4e1; color: var(--danger); }
.tag.s-Picked { background: var(--brand-soft); color: var(--brand); }
.tag.s-NotPicked { background: #fdf3df; color: var(--warn); }
.tag.s-PotentialCS { background: #e2ecfb; color: #2457a6; }
.tag.s-LeftUS, .tag.s-WrongNumber { background: #fbe4e1; color: var(--danger); }
.tag.active { background: var(--brand-soft); color: var(--brand); }
.tag.upcoming { background: #e2ecfb; color: #2457a6; }

/* calling screen */
.callcard { text-align: center; padding: 1.6rem 1rem; }
.callcard .serial { color: var(--muted); font-weight: 600; }
.callcard .phone { font-size: 2rem; font-weight: 700; letter-spacing: 1px; margin: .3rem 0; font-variant-numeric: tabular-nums; }
.callcard .cardno { font-size: 1.1rem; }
.callbtn { width: 100%; max-width: 360px; padding: 1.05rem; font-size: 1.15rem; border-radius: 14px; margin-top: 1rem; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(15,25,20,.5); display: none; align-items: flex-end; justify-content: center; z-index: 50; }
.modal.open { display: flex; }
.modal .sheet { background: #fff; width: 100%; max-width: 480px; border-radius: 18px 18px 0 0; padding: 1.2rem; max-height: 90vh; overflow: auto; }
@media (min-width: 680px) { .modal { align-items: center; } .modal .sheet { border-radius: 18px; } }
.chips { display: grid; gap: .5rem; margin: .8rem 0 1rem; }
.chip { padding: .9rem 1rem; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-weight: 600; text-align: left; }
.chip.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); }
.chip:disabled { opacity: .4; }

.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); background: var(--ink); color: #fff;
  padding: .7rem 1rem; border-radius: 10px; z-index: 99; display: none; max-width: 90vw; }
.toast.err { background: var(--danger); }
.empty { text-align: center; padding: 2rem 1rem; color: var(--muted); }
.pager { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; margin-top: .8rem; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-wrap .card { width: 100%; max-width: 360px; }
.login-wrap .brand { text-align: center; margin-bottom: 1rem; color: var(--brand); }
