/* 3Dtracking brand (as the sales planner and dashboard): dark teal #00444E, logo blue #00A0BE,
   logo orange #F49600, ink #171B25, light grey #F4F6FA, Inter. Red / amber / green = against target. */
:root {
  --brand-teal: #00444E; --brand-blue: #00A0BE; --brand-orange: #F49600;
  --bg: #F4F6FA; --surface: #FFFFFF; --sunken: #EBEFF4; --ink: #171B25; --muted: #5A6472; --line: #DCE2EA;
  --field: #FFFFFF; --field-line: #D3DBE4;
  --accent: #00444E; --accent-ink: #FFFFFF; --accent-soft: #DCEFF2; --accent-text: #00707F;
  --red: #C8372D; --red-soft: #F9E0DD; --amber: #C77700; --amber-soft: #FCEBD0; --green: #1D8A55; --green-soft: #DDF1E6;
  --font: "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;
  --field: #1C2B34; --field-line: #3A5062;
  --accent: #2FB8D1; --accent-ink: #0D1518; --accent-soft: #10343D; --accent-text: #5CCDE2;
  --red: #F0766E; --red-soft: #3A1E1F; --amber: #F5A938; --amber-soft: #33281A; --green: #4FC38C; --green-soft: #15302A;
  color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #0D1518; --surface: #15222A; --sunken: #101B21; --ink: #E6EDF2; --muted: #93A3AE; --line: #263842;
  --field: #1C2B34; --field-line: #3A5062;
  --accent: #2FB8D1; --accent-ink: #0D1518; --accent-soft: #10343D; --accent-text: #5CCDE2;
  --red: #F0766E; --red-soft: #3A1E1F; --amber: #F5A938; --amber-soft: #33281A; --green: #4FC38C; --green-soft: #15302A;
  color-scheme: dark }

* { box-sizing: border-box }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font) }
.app { max-width: 1180px; margin: 0 auto; padding: 16px 16px 64px }
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.01em; margin: 0 }
button, input, select, textarea { font: inherit; color: inherit }
:focus-visible { outline: 2px solid var(--brand-blue); outline-offset: 2px }
.num { font-variant-numeric: tabular-nums }
a { color: var(--accent-text) }
[hidden] { display: none !important }

/* 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: 1180px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; 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 }
.nav { display: flex; gap: 4px; flex-wrap: wrap; margin-right: auto }
.nav a { color: rgba(255, 255, 255, .8); text-decoration: none; padding: 6px 12px; border-radius: 8px; font-size: 14px; font-weight: 600 }
.nav a:hover { background: rgba(255, 255, 255, .1); color: #FFFFFF }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, .16); color: #FFFFFF }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: rgba(255, 255, 255, .78); flex-wrap: wrap }
.who .me { display: grid; line-height: 1.25; text-align: right }
.who .me b { color: #FFFFFF; font-weight: 600 }
.who .me small { font-size: 12px }
.who .initials { background: var(--brand-blue); color: #FFFFFF }
.who .linkbtn { color: #FFFFFF; opacity: .85 }
.who select { background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .3); color: #FFFFFF; border-radius: 8px; padding: 4px 8px; max-width: 220px }
.who select option { color: #171B25; background: #FFFFFF }
.initials { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 700; flex: none }
.linkbtn { background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; color: var(--accent-text) }

/* "View as" bar */
.viewas { background: var(--brand-orange); color: #171B25 }
.viewas > div { max-width: 1180px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px }
.viewas .btn { background: #FFFFFF; color: #171B25; border-color: #FFFFFF }

.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink) }
.btn:hover { border-color: var(--muted) }
.btn.sm { padding: 4px 10px; font-size: 13px }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent) }
.btn:disabled { opacity: .6; cursor: wait }
.field { border: 1px solid var(--field-line); background: var(--field); border-radius: 8px; padding: 7px 10px; min-width: 0; width: 100% }
textarea.field { resize: vertical; min-height: 60px }
.hint { color: var(--muted); font-size: 13px; margin: 0 }
.err { color: var(--red) }
.ok { color: var(--green) }
.loading { color: var(--muted) }
.notice { background: var(--amber-soft); border: 1px solid var(--amber); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 16px; font-size: 14px }
.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); padding: 28px 20px; text-align: center; color: var(--muted); display: grid; gap: 8px; justify-items: center }
.empty b { color: var(--ink); font-size: 16px }

.signin { max-width: 420px; margin: 48px auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; display: grid; gap: 12px }
.btn.ms { justify-content: center; padding: 10px 14px }
.mslogo { display: grid; grid-template-columns: 8px 8px; gap: 2px }
.mslogo i { width: 8px; height: 8px; display: block }

/* Page header (title + month picker) */
.pagehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 20px }
.pagehead h2 { font-size: 22px }
.pagehead .tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap }
.pagehead select.field { width: auto }

.section { margin-bottom: 32px }
.section > header { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 2px solid var(--line) }
.section h3 { font-size: 19px }
.section h4, .panel h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; margin: 18px 0 8px }
.role { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); white-space: nowrap }
.role.executive { background: #F3E6FA; color: #6B2C91 }
.role.manager { background: #FCEBD0; color: #8A5300 }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .role.executive { background: #2E2140; color: #D2A8EE } :root:not([data-theme="light"]) .role.manager { background: #33281A; color: #F5C27A } }

/* KPI cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px }
.card { background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--line); border-radius: var(--radius); padding: 12px 16px 14px; display: grid; gap: 6px; align-content: start }
.card.red { border-top-color: var(--red) } .card.amber { border-top-color: var(--amber) } .card.green { border-top-color: var(--green) }
.label { font-size: 12.5px; font-weight: 600; color: var(--muted) }
.big { font-size: 28px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums }
.big.none { color: var(--muted); font-weight: 500; font-size: 20px }
.sub { color: var(--muted); font-size: 12.5px; display: flex; gap: 4px 12px; flex-wrap: wrap; align-items: center }
.delta.up { color: var(--green) } .delta.down { color: var(--red) }
.spark { width: 100%; height: 34px; display: block }
.spark path { fill: none; stroke: var(--accent-text); stroke-width: 2 }
.spark .tgt { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3 }
.spark circle { fill: var(--accent-text) }
.subjecthead { display: flex; align-items: center; gap: 10px; margin: 16px 0 8px; flex-wrap: wrap }
.subjecthead:first-child { margin-top: 0 }
.subjecthead b { font-size: 15px }

/* People tables */
.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: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle }
thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; white-space: normal; min-width: 90px }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0 }
td.r, th.r { text-align: right }
tbody th { font-weight: 600 }
table.people tbody tr { cursor: pointer }
table.people tbody tr:hover, table.people tbody tr.sel { background: var(--accent-soft) }
.tm { display: inline-flex; align-items: center; gap: 10px }
.cell { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none }
.dot.red { background: var(--red) } .dot.amber { background: var(--amber) } .dot.green { background: var(--green) }
.detail { margin-top: 12px; background: var(--sunken); border-radius: var(--radius); padding: 14px }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted) }
.legend span { display: inline-flex; align-items: center; gap: 6px }

/* Admin */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px }
.tabs a { text-decoration: none; padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 600; font-size: 14px }
.tabs a[aria-current="page"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent) }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px }
.panel > h3 { font-size: 16px; margin-bottom: 12px }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end }
.form label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; color: var(--muted) }
.form .wide { grid-column: 1 / -1 }
.form .check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink) }
.form .actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; grid-column: 1 / -1 }
.split { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 16px; align-items: start }
@media (max-width: 800px) { .split { grid-template-columns: 1fr } }
.list { display: grid; gap: 2px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; max-height: 70vh; overflow: auto }
.list button { text-align: left; background: none; border: 0; border-radius: 8px; padding: 8px 10px; cursor: pointer; display: grid; gap: 1px }
.list button:hover { background: var(--sunken) }
.list button[aria-current="true"] { background: var(--accent-soft) }
.list button small { color: var(--muted); font-size: 12.5px }
.list .off { opacity: .55 }
.members td select { width: auto }
input.val { width: 110px; text-align: right; font-variant-numeric: tabular-nums }
td.muted, .muted { color: var(--muted) }
.badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 1px 7px; border-radius: 999px; background: var(--sunken); color: var(--muted) }

@media (max-width: 640px) {
  .who .me { display: none }
  .big { font-size: 24px }
}
