/* 3Dtracking brand: dark teal #00444E (website primary), logo blue #00A0BE, logo orange #F49600,
   ink #171B25, light grey #F4F6FA, Inter. Layout: teal brand bar with the reversed logo, then one
   working column; plan drawn as a dashed outline, actual as a solid fill. */
:root {
  --brand-teal: #00444E; --brand-teal-dk: #0F3E44; --brand-blue: #00A0BE; --brand-orange: #F49600;
  --bg: #F4F6FA; --surface: #FFFFFF; --sunken: #EBEFF4; --ink: #171B25; --muted: #5A6472; --line: #DCE2EA;
  --accent: #00444E; --accent-ink: #FFFFFF; --accent-soft: #DCEFF2; --accent-text: #00707F;
  --good: #1D7F53; --good-soft: #DDF1E6; --warn: #A65F00; --warn-soft: #FCEBD0; --bad: #B83A33; --bad-soft: #F7DEDC;
  --display: "Inter", "Segoe UI", Arial, sans-serif;
  --body: "Inter", "Segoe UI", Arial, sans-serif;
  --mono: "Inter", "Segoe UI", Arial, sans-serif;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #0D1518; --surface: #15222A; --sunken: #101B21; --ink: #E6EDF2; --muted: #93A3AE; --line: #263842;
  --accent: #2FB8D1; --accent-ink: #0D1518; --accent-soft: #10343D; --accent-text: #5CCDE2;
  --good: #4FC38C; --good-soft: #15302A; --warn: #F5A938; --warn-soft: #33281A; --bad: #EE726B; --bad-soft: #3A1E1F;
  color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #0D1518; --surface: #15222A; --sunken: #101B21; --ink: #E6EDF2; --muted: #93A3AE; --line: #263842;
  --accent: #2FB8D1; --accent-ink: #0D1518; --accent-soft: #10343D; --accent-text: #5CCDE2;
  --good: #4FC38C; --good-soft: #15302A; --warn: #F5A938; --warn-soft: #33281A; --bad: #EE726B; --bad-soft: #3A1E1F;
  color-scheme: dark }

* { box-sizing: border-box }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body) }
.app { max-width: 960px; margin: 0 auto; padding: 8px 16px 64px }
h1, h2, h3 { font-family: var(--display); font-weight: 700; letter-spacing: -0.01em; text-wrap: balance; margin: 0 }
button, input, select, textarea { font: inherit; color: inherit }
:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 2px }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums }

/* Brand bar: always the website's dark teal, in both themes, so the reversed logo reads. */
.brandbar { background: var(--brand-teal); color: #FFFFFF; border-bottom: 3px solid var(--brand-blue) }
.brandbar-inner { max-width: 960px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap }
.brand { display: flex; align-items: center; gap: 14px; min-width: 0 }
.brand img { height: 40px; width: auto; display: block }
.brand .appname { padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, .3); line-height: 1.2 }
.brand h1 { font-size: 18px; font-weight: 600; color: #FFFFFF }
.brand p { margin: 2px 0 0; color: rgba(255, 255, 255, .72); font-size: 12.5px }
.who { display: flex; align-items: center; gap: 8px; font-size: 13px; color: rgba(255, 255, 255, .78) }
.who .initials { background: var(--brand-blue); color: #FFFFFF }
.who .me b { color: #FFFFFF }
.who .linkbtn { color: #FFFFFF; opacity: .85 }
.who .linkbtn:hover { opacity: 1 }

.tabs { display: flex; gap: 4px; margin: 16px 0 16px; border-bottom: 1px solid var(--line) }
.tab { background: none; border: 0; padding: 10px 14px; cursor: pointer; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -1px }
.tab[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--brand-orange) }
.tab:hover { color: var(--ink) }

.notice { background: var(--warn-soft); color: var(--ink); border: 1px solid var(--warn); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; font-size: 14px }

.datebar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px }
.datebar h2 { font-size: 24px; margin-right: 4px }
.iconbtn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 16px; line-height: 1 }
.iconbtn:hover { border-color: var(--muted) }
.datebar input[type=date] { height: 34px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 0 8px }
.spacer { flex: 1 }
.save { font-size: 12px; color: var(--muted) }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; letter-spacing: .02em; white-space: nowrap }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50% ; background: currentColor }
.pill.none { background: var(--sunken); color: var(--muted) }
.pill.draft { background: var(--warn-soft); color: var(--warn) }
.pill.locked { background: var(--accent-soft); color: var(--accent) }
.pill.reviewed { background: var(--good-soft); color: var(--good) }

.steps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px }
.step { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; cursor: pointer; display: flex; gap: 12px; align-items: flex-start }
.step:disabled { cursor: not-allowed; opacity: .55 }
.step[aria-selected="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent) }
.step .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 600 12px var(--mono); background: var(--sunken); flex: none }
.step[aria-selected="true"] .n { background: var(--accent); color: var(--accent-ink) }
.step b { display: block; font-weight: 600 }
.step small { color: var(--muted); font-size: 12.5px }

.section { margin-bottom: 24px }
.section > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap }
.section h3 { font-size: 17px }
.hint { color: var(--muted); font-size: 13px; margin: 0 }
.label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600 }

.targets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px }
.target.wide { grid-column: 1 / -1 }
.tval { display: flex; align-items: baseline; gap: 8px }
.tval input { flex: 1 1 auto; min-width: 0 }
.tval .of { color: var(--muted); font-size: 13px; white-space: nowrap }
.mgroups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px }
.mgroup { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 8px; align-content: start; min-width: 0 }
.mhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px }
.mcount { font-size: 20px; font-weight: 600 }
.mlist { display: grid; gap: 6px }
.mrow { display: flex; gap: 6px; align-items: center; flex-wrap: wrap }
.mrow .field { flex: 1 1 160px }
.mrow .deal { flex: 1 1 140px; font-weight: 500; overflow-wrap: anywhere; min-width: 0 }
.mrow .x { width: 30px; height: 30px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 8px; font-size: 18px }
.mrow .x:hover { background: var(--bad-soft); color: var(--bad) }
.btn.sm { padding: 5px 10px; font-size: 13px; justify-self: start }
.derived { display: inline-block; width: 64px; text-align: right; font-weight: 600 }
.deals { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0 }
.dline.mline { grid-template-columns: 96px minmax(0, 1fr) }
.results { display: grid; gap: 6px; margin-top: 6px }
.hit { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); flex-wrap: wrap }
.hit img { width: 32px; height: 32px; border-radius: 50%; flex: none }
.hit .nm { flex: 1 1 160px; min-width: 0; font-weight: 600; overflow-wrap: anywhere }
.hit .nm small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px }
.confirm { display: flex; gap: 6px; align-items: center; flex-wrap: wrap }
.btn.danger { background: var(--bad); border-color: var(--bad); color: var(--accent-ink); font-weight: 600 }
.who small { display: block; color: rgba(255, 255, 255, .72); font-size: 11.5px }
.addcard { background: var(--surface); border: 1px solid var(--accent); border-radius: var(--radius); padding: 16px; margin-bottom: 24px; display: grid; gap: 10px }
.addcard h3 { font-size: 18px }
.addcard p { margin: 0 }
.ways { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px }
.ways > div { display: grid; gap: 6px; align-content: start; min-width: 0; background: var(--sunken); border-radius: 8px; padding: 12px }
.steps-list { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px }
@media (max-width: 680px) { .ways { grid-template-columns: 1fr } }
.dline .label { font-size: 10.5px }
.target { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; display: grid; gap: 4px }
.target input { width: 100%; border: 0; background: transparent; font: 600 24px var(--mono); padding: 0 }
.target input:disabled { opacity: 1 }
.target input::placeholder { color: var(--line) }

.field { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 7px 9px; width: 100%; min-width: 0 }
.field:disabled { background: transparent; border-color: transparent; padding-left: 0 }
textarea.field { resize: vertical; min-height: 80px }

.rows { display: grid; gap: 6px }
.row { display: grid; grid-template-columns: 100px 140px minmax(0, 1fr) minmax(0, 1.3fr) 34px; gap: 6px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px }
.row .x { width: 34px; height: 34px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 8px; font-size: 18px }
.row .x:hover { background: var(--bad-soft); color: var(--bad) }

.locked-item { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius) }
.time { font: 500 13px var(--mono); color: var(--muted); padding-top: 2px }
.what { min-width: 0 }
.what .acct { font-weight: 600 }
.what .type { font-size: 12px; color: var(--accent-text); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; margin-right: 6px }
.what .goal { color: var(--muted); font-size: 14px; overflow-wrap: anywhere }

.empty { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted) }
.empty b { color: var(--ink); display: block; margin-bottom: 4px }

.btn { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 8px 14px; cursor: pointer; font-weight: 500 }
.btn:hover { border-color: var(--muted) }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600 }
.btn.primary:hover:not(:disabled) { filter: brightness(1.15) }
.btn.primary:disabled { opacity: .45; cursor: not-allowed }
.btn.ghost { border-style: dashed; color: var(--muted) }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 16px; background: var(--sunken); border-radius: var(--radius) }
.actions p { margin: 0; flex: 1 1 260px; font-size: 13.5px; color: var(--muted) }

.score { display: grid; grid-template-columns: 1.3fr repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 24px }
.score > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px }
.score .big { font: 700 40px/1 var(--display); margin-top: 6px }
.score .mid { font: 600 24px/1.1 var(--mono); margin-top: 6px }
.score small { color: var(--muted); font-size: 12.5px }

.review-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 4px 12px }
.review-item.o-done { border-left: 4px solid var(--good) }
.review-item.o-partial { border-left: 4px solid var(--warn) }
.review-item.o-moved, .review-item.o-missed { border-left: 4px solid var(--bad) }
.review-item .controls { grid-column: 2; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; align-items: center }
.review-item .controls .field { flex: 1 1 220px }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; flex-wrap: wrap }
.seg button { border: 0; background: var(--surface); padding: 6px 11px; cursor: pointer; font-size: 13px; border-right: 1px solid var(--line) }
.seg button:last-child { border-right: 0 }
.seg button:disabled { cursor: default }
.seg button[aria-pressed="true"].done { background: var(--good-soft); color: var(--good); font-weight: 600 }
.seg button[aria-pressed="true"].partial { background: var(--warn-soft); color: var(--warn); font-weight: 600 }
.seg button[aria-pressed="true"].moved, .seg button[aria-pressed="true"].missed { background: var(--bad-soft); color: var(--bad); font-weight: 600 }

.tv { display: grid; gap: 10px }
.tv-row { display: grid; grid-template-columns: 130px 90px minmax(0, 1fr); gap: 12px; align-items: center }
.tv-row .act { display: flex; align-items: center; gap: 6px }
.tv-row .act input { width: 64px; text-align: right }
.tv-row .act span { color: var(--muted); font-size: 13px; white-space: nowrap }
.bar { position: relative; height: 18px }
.bar .plan { position: absolute; inset: 0 auto 0 0; border: 1.5px dashed var(--muted); border-radius: 4px }
.bar .act { position: absolute; top: 4px; bottom: 4px; left: 0; border-radius: 3px; background: var(--brand-blue) }
.bar .act.hit { background: var(--good) }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); align-items: center }
.legend i { display: inline-block; width: 18px; height: 9px; border-radius: 2px; vertical-align: middle; margin-right: 6px }
.legend .lp { border: 1.5px dashed var(--muted) }
.legend .la { background: var(--brand-blue) }

.meter { height: 8px; background: var(--sunken); border-radius: 4px; overflow: hidden; min-width: 60px }
.meter span { display: block; height: 100%; background: var(--brand-blue); border-radius: 4px }
.meter span.g { background: var(--good) } .meter span.w { background: var(--warn) } .meter span.b { background: var(--bad) }

.team { display: grid; gap: 8px }
.rep { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius) }
.rep > button { width: 100%; display: grid; grid-template-columns: 32px minmax(0, 1.4fr) 110px minmax(80px, 1fr) 48px; gap: 12px; align-items: center; padding: 10px 14px; background: none; border: 0; cursor: pointer; text-align: left }
.rep img { width: 32px; height: 32px; border-radius: 50% }
.rep .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.rep .nm small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px }
.rep .pct { font: 600 15px var(--mono); text-align: right }
.rep .detail { border-top: 1px solid var(--line); padding: 12px 14px; display: grid; gap: 8px }
.rep .detail .refl { background: var(--sunken); padding: 10px 12px; border-radius: 8px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere }
.mini { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted) }
.mini b { color: var(--ink); font-family: var(--mono); font-weight: 500 }
.oc { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap }
.oc.done { background: var(--good-soft); color: var(--good) } .oc.partial { background: var(--warn-soft); color: var(--warn) }
.oc.moved, .oc.missed { background: var(--bad-soft); color: var(--bad) } .oc.none { background: var(--sunken); color: var(--muted) }
.oc.unpl { background: var(--accent-soft); color: var(--accent) }
.dline { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; font-size: 14px }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius) }
table { width: 100%; border-collapse: collapse; font-size: 14px }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600 }
tbody tr { cursor: pointer } tbody tr:hover { background: var(--sunken) }
tbody tr:last-child td { border-bottom: 0 }
td.r, th.r { text-align: right }
.loading { color: var(--muted) }

@media (max-width: 680px) {
  .targets { grid-template-columns: 1fr }
  .mgroups { grid-template-columns: 1fr }
  .row { grid-template-columns: 1fr 1fr 34px }
  .row > :nth-child(3), .row > :nth-child(4) { grid-column: 1 / 3 }
  .row > :nth-child(5) { grid-column: 3; grid-row: 1 }
  .score { grid-template-columns: repeat(2, minmax(0, 1fr)) }
  .tv-row { grid-template-columns: 1fr auto; }
  .tv-row .bar { grid-column: 1 / -1 }
  .rep > button { grid-template-columns: 32px minmax(0, 1fr) 48px }
  .rep > button .pill, .rep > button .meter { display: none }
  .steps { grid-template-columns: 1fr }
}
@media (prefers-reduced-motion: no-preference) { .meter span, .bar .act { transition: width .3s ease } }

/* ---------- hosted version: page base, sign-in, user admin ---------- */
html { color-scheme: light }
body { margin: 0; min-height: 100vh }
[hidden] { display: none !important }
.who { gap: 12px; flex-wrap: wrap }
.who .me { text-align: right; line-height: 1.3 }
.who .me b { display: block; color: #FFFFFF; font-weight: 600 }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-size: 13px; text-decoration: underline; text-underline-offset: 2px }
.initials { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font: 600 12px var(--mono); flex: none }

.auth { max-width: 400px; margin: 48px auto 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: grid; gap: 14px }
.auth h2 { font-size: 22px }
.auth p { margin: 0; color: var(--muted) }
.form { display: grid; gap: 12px }
.form label { display: grid; gap: 4px; font-size: 13px; font-weight: 500 }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px }
.form .btn.primary { justify-self: start }
.err { color: var(--bad); font-size: 13.5px; margin: 0 }
.ok { color: var(--good); font-size: 13.5px; margin: 0 }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 14px; max-width: calc(100% - 32px); z-index: 10 }
.toast.bad { background: var(--bad); color: var(--accent-ink) }

.ulist { display: grid; gap: 6px }
.urow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius) }
.urow .nm { flex: 1 1 200px; min-width: 0; font-weight: 600; overflow-wrap: anywhere }
.urow .nm small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px }
.urow .acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center }
.urow form { flex-basis: 100% }
.role { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent) }
@media (max-width: 680px) {
  .form .row2 { grid-template-columns: 1fr }
  .who .me { text-align: left }
  .brandbar-inner { padding-block: 10px; gap: 10px }
  .brand img { height: 32px }
  .brand p { display: none }
  .who .initials, .who small { display: none }
}
