/* 3Dtracking brand (as the sales planner): dark teal #00444E, logo blue #00A0BE, logo orange #F49600,
   ink #171B25, light grey #F4F6FA, Inter. Red / amber / green carry the support rules' meaning. */
:root {
  --brand-teal: #00444E; --brand-blue: #00A0BE; --brand-orange: #F49600;
  --bg: #F4F6FA; --surface: #FFFFFF; --sunken: #EBEFF4; --ink: #171B25; --muted: #5A6472; --line: #DCE2EA;
  --row: #F1F4F8; --row-line: #DFE5EC; --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;
  --row: #1B2A33; --row-line: #2E4251; --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;
  --row: #1B2A33; --row-line: #2E4251; --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: 1120px; margin: 0 auto; padding: 16px 16px 64px }
h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; margin: 0 }
button, input, select { 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) }

/* 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: 1120px; 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: 10px; font-size: 13px; color: rgba(255, 255, 255, .78) }
.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 }
.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 }

.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 }
.hint { color: var(--muted); font-size: 13px; margin: 0 }
.err { color: var(--red) }
.loading { color: var(--muted) }
.notice { background: var(--amber-soft); border: 1px solid var(--amber); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0 0; 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 }

.dataline { margin-bottom: 16px }
.datawhen { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 14px; color: var(--muted) }
.datawhen b { color: var(--ink) }

/* Summary cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-bottom: 24px }
.card { text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 8px; align-content: start }
.card.click { cursor: pointer }
.card.click:hover { border-color: var(--accent-text) }
.label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600 }
.big { font-size: 30px; font-weight: 700; line-height: 1.1 }
.big small { font-size: 14px; font-weight: 500; color: var(--muted) }
.sub { color: var(--muted); font-size: 12.5px }

.rag { display: grid; gap: 4px }
.ragbar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--sunken); gap: 2px }
.ragbar span { display: block; min-width: 4px }
.ragbar .r { background: var(--red) } .ragbar .a { background: var(--amber) } .ragbar .g { background: var(--green) }
.ragbar .none { flex: 1; background: var(--sunken) }
.ragnums { display: flex; gap: 10px; font-size: 12px; font-weight: 600; flex-wrap: wrap }
.ragnums .r { color: var(--red) } .ragnums .a { color: var(--amber) } .ragnums .g { color: var(--green) }

.section { margin-bottom: 24px }
.section > header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 10px }
.section h3 { font-size: 18px }

/* Team queues */
.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 }
thead th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600 }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0 }
td.r, th.r { text-align: right }
table.team tbody tr { cursor: pointer }
table.team tbody tr:hover, table.team tbody tr.sel { background: var(--accent-soft) }
table.team tbody th { font-weight: 600 }
.tm { display: inline-flex; align-items: center; gap: 10px }
.ragcell { min-width: 220px }

/* Tickets */
.filters { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-bottom: 8px }
.filters .sel { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted) }
.filters .search { flex: 1 1 220px }
.chips { display: flex; gap: 6px }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted) }
.chip b { font-weight: 700 }
.chip[aria-pressed="true"] { color: var(--ink); border-color: currentColor }
.chip.red[aria-pressed="true"] { background: var(--red-soft); color: var(--red) }
.chip.amber[aria-pressed="true"] { background: var(--amber-soft); color: var(--amber) }
.chip.green[aria-pressed="true"] { background: var(--green-soft); color: var(--green) }
.chip.waiting[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text) }
.count { font-size: 13px; color: var(--muted); margin: 0 0 8px }

.tickets { display: grid; gap: 8px }
.ticket { display: grid; grid-template-columns: 12px minmax(0, 1fr) 90px 200px; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: var(--radius); padding: 10px 14px }
.ticket.red { border-left-color: var(--red) } .ticket.amber { border-left-color: var(--amber) }
.ticket .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--green) }
.ticket.red .dot { background: var(--red) } .ticket.amber .dot { background: var(--amber) }
.tline { display: flex; gap: 8px; align-items: baseline; min-width: 0 }
.tline > a:first-child, .tline > b { font-weight: 700; flex: none; font-variant-numeric: tabular-nums }
.tsubjlink { color: var(--ink); text-decoration: none; min-width: 0 }
.tsubjlink:hover { text-decoration: underline }
.tsubj { font-weight: 600; overflow-wrap: anywhere }
.tmeta { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 12.5px; color: var(--muted); margin-top: 2px }
.tage { display: grid; text-align: right; line-height: 1.2 }
.tage b { font-size: 16px }
.ticket.red .tage b { color: var(--red) } .ticket.amber .tage b { color: var(--amber) }
.tage small, .tupd small { font-size: 12px; color: var(--muted) }
.tupd { display: grid; gap: 2px; justify-items: start; line-height: 1.3; min-width: 0 }
.tupd small { overflow-wrap: anywhere }
.badge { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap }
.badge.cust { background: var(--accent-soft); color: var(--accent-text) }
.badge.int { background: var(--sunken); color: var(--muted) }

@media (max-width: 760px) {
  .ticket { grid-template-columns: 12px minmax(0, 1fr) auto; }
  .ticket .tupd { grid-column: 2 / -1 }
  .who .me { text-align: left }
}

/* View as (super-administrators) */
.viewas { background: var(--surface); border-bottom: 1px solid var(--line) }
.viewas.on { background: var(--amber-soft); border-bottom-color: var(--amber) }
.viewas-inner { max-width: 1120px; margin: 0 auto; padding: 8px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; font-size: 13.5px }
.viewas label { display: flex; align-items: center; gap: 8px; font-weight: 600 }
.viewas select { max-width: min(460px, 70vw) }
.viewas-msg { color: var(--muted) }
.viewas.on .viewas-msg { color: var(--ink) }
