@font-face { font-family: "Archivo Black"; src: url("assets/fonts/archivo-black.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("assets/fonts/archivo.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("assets/fonts/instrument-sans.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  color-scheme: light;
  --surface: #ffffff; --surface-alt: #f4f6f5; --page: #eef1f0;
  --ink: #22282b; --ink-soft: #3d464a; --ink-muted: #5b6569;
  --line: #e2e6e3; --line-strong: #8a9097;
  --navy: #0e3350; --on-navy: #fff; --on-navy-muted: #cddfeb; --navy-accent: #8bb8de;
  --red: #ec2023; --cwfr-blue: #4a90ce; --madp-green: #7ac144; --link: #2165a3; --focus: #2165a3;
  --co-cwfr: #2a78d6; --co-madp: #7bc144; /* company series: CWFR blue, MADP signature (logo) green */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(14, 51, 80, .06), 0 2px 8px rgba(14, 51, 80, .05);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Instrument Sans", system-ui, sans-serif; color: var(--ink); background: var(--page); font-size: 15px; line-height: 1.45; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: "Archivo", system-ui, sans-serif; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.btn { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 7px; padding: 7px 14px; cursor: pointer; font-weight: 600; }
.btn:hover { background: var(--surface-alt); }
.btn-primary { background: var(--navy); color: var(--on-navy); border-color: var(--navy); }
.btn-primary:hover { background: #163f62; }
.btn-ghost { background: transparent; color: var(--on-navy); border-color: rgba(255,255,255,.35); }
.btn-ghost:hover { background: rgba(255,255,255,.08); }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-danger { color: #b3171a; border-color: #e7b3b4; }

/* PIN gate */
.gate { min-height: 100vh; display: grid; place-items: center; background: var(--navy); padding: 24px; }
.gate-card { background: var(--surface); border-radius: 14px; padding: 36px 32px 28px; width: min(420px, 100%); text-align: center; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.gate-card { width: min(480px, 100%) !important; }
.gate-logos { display: flex; align-items: center; justify-content: center; gap: 22px; margin-bottom: 18px; }
.gate-logo { height: 96px; width: auto; display: block; }
.gate-logo--madp { height: 96px; }
@media (max-width: 480px) { .gate-logo, .gate-logo--madp { height: 64px; } .gate-logos { gap: 14px; } }
.gate h1 { font-family: "Archivo Black"; font-weight: 400; font-size: 26px; color: var(--navy); }
.gate-sub { color: var(--ink-muted); margin: 6px 0 20px; }
.pin { display: flex; gap: 8px; justify-content: center; margin-bottom: 10px; }
.pin input { width: 46px; height: 56px; text-align: center; font-size: 24px; font-weight: 700; border: 1.5px solid var(--line-strong); border-radius: 8px; }
.pin input:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgba(14,51,80,.15); }
.gate-err { color: #b3171a; min-height: 22px; margin: 6px 0 14px; font-weight: 600; }
.gate .btn-primary { width: 100%; padding: 12px; font-size: 16px; }

/* Header */
.top { background: var(--navy); color: var(--on-navy); position: sticky; top: 0; z-index: 20; }
.top-inner { max-width: 1400px; margin: 0 auto; padding: 12px 20px 6px; display: flex; align-items: center; gap: 16px; }
.top-logo { height: 48px; width: auto; }
.top-title { display: flex; flex-direction: column; line-height: 1.15; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--on-navy-muted); font-weight: 600; }
.top-title strong { font-family: "Archivo Black"; font-weight: 400; font-size: 20px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.synced { font-size: 13px; color: var(--on-navy-muted); }
.viewas { font-size: 13px; color: var(--on-navy-muted); display: flex; gap: 6px; align-items: center; }
.viewas select { background: #fff; color: var(--ink); border-radius: 6px; border: 0; padding: 4px 8px; }
.tabs { max-width: 1400px; margin: 0 auto; padding: 0 20px; display: flex; gap: 4px; overflow-x: auto; }
.tabs button { background: none; border: 0; color: var(--on-navy-muted); padding: 10px 14px 12px; cursor: pointer; font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: #fff; border-bottom-color: var(--red); }
.tabs button:hover { color: #fff; }

/* Announcements */
.news { max-width: 1400px; margin: 16px auto 0; padding: 0 20px; }
.news-card { background: var(--surface); border-left: 4px solid var(--red); border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow); margin-bottom: 8px; }
.news-card h3 { font-size: 15px; }
.news-card p { margin: 4px 0 0; white-space: pre-wrap; color: var(--ink-soft); }
.news-meta { font-size: 12px; color: var(--ink-muted); margin-top: 6px; }
.news-more { background: none; border: 0; color: var(--link); cursor: pointer; font-weight: 600; padding: 2px 0; }

/* Filters */
.filters { max-width: 1400px; margin: 16px auto 0; padding: 0 20px; display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.f { display: flex; flex-direction: column; gap: 3px; font-size: 12px; font-weight: 600; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .04em; }
.f select, .f input { text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 7px; padding: 6px 8px; min-width: 130px; }
.f-note { font-size: 12px; color: var(--ink-muted); align-self: center; }

/* Content */
.content { max-width: 1400px; margin: 16px auto 0; padding: 0 20px 24px; }
.loading { padding: 60px; text-align: center; color: var(--ink-muted); }
.section-title .hint { text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 8px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-muted); margin: 22px 0 10px; font-weight: 700; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
@media (min-width: 1000px) { .tiles.six { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
.tiles.company .tile { background: var(--surface-alt); box-shadow: none; border: 1px solid var(--line); }
.tile { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; overflow: hidden; }
.tile .lbl { font-size: 13px; color: var(--ink-muted); font-weight: 600; }
.tile .val { font-family: "Archivo Black"; font-size: 28px; color: var(--navy); margin-top: 4px; letter-spacing: -.01em; white-space: nowrap; line-height: 1.2; }
.tile .sub { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(560px, 1fr)); gap: 14px; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } .tile .val { font-size: 24px; } .top-logo { height: 30px; } }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px 12px; min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.card-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.card-h h3 { font-size: 15px; color: var(--ink); }
.card-h .note { font-size: 12px; color: var(--ink-muted); }
.card-h .tgl { margin-left: auto; background: none; border: 0; color: var(--link); cursor: pointer; font-size: 12px; font-weight: 600; }
.empty { color: var(--ink-muted); padding: 30px 0; text-align: center; font-size: 14px; }

/* Charts */
.chart { width: 100%; overflow-x: auto; }
.chart svg { display: block; }
.chart text { font-family: "Instrument Sans", system-ui, sans-serif; fill: var(--ink-muted); font-size: 11px; }
.chart .vlabel { fill: var(--ink-soft); font-size: 10.5px; font-weight: 600; }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .axis-l { stroke: var(--line-strong); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--ink-soft); margin: 2px 0 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tip { position: fixed; z-index: 50; background: #fff; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; box-shadow: 0 4px 16px rgba(0,0,0,.12); pointer-events: none; min-width: 140px; }
.tip b { display: block; margin-bottom: 4px; }
.tip .row { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.tip .row span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.tip i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }

/* Tables */
.tbl-wrap { overflow: auto; max-height: 520px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); padding: 8px 10px; border-bottom: 1px solid var(--line-strong); position: sticky; top: 0; background: var(--surface); cursor: pointer; white-space: nowrap; }
table.t td { padding: 7px 10px; border-bottom: 1px solid var(--line); }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr:hover td { background: var(--surface-alt); }
table.t tfoot td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.neg { color: #b3171a; }

/* Admin */
.admin-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.admin-form textarea { min-height: 70px; width: 100%; }
.secret { background: #fff8e1; border: 1px solid #f0d27a; border-radius: 8px; padding: 10px 12px; margin: 10px 0; font-size: 14px; word-break: break-all; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-alt); color: var(--ink-soft); }
.pill.on { background: #e3f3e3; color: #1f6b1f; }
.pill.off { background: #f8e3e3; color: #8d1b1b; }
.foot { max-width: 1400px; margin: 0 auto; padding: 8px 20px 30px; font-size: 12px; color: var(--ink-muted); }

/* View-as banner */
.viewing { max-width: 1400px; margin: 12px auto 0; padding: 10px 20px; display: flex; align-items: center; gap: 12px; justify-content: space-between;
  background: #fff8e1; border: 1px solid #f0d27a; border-radius: 10px; font-size: 14px; }
@media (min-width: 1440px) { .viewing { padding: 10px 16px; } }

/* "i" = what a number counts (info panel); Ask lives inside the panel */
.tile { position: relative; }
.tile .lbl { padding-right: 22px; }
.info { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-strong); background: #fff; color: var(--ink-muted);
  font: italic 700 12px/1 Georgia, 'Times New Roman', serif; cursor: pointer; padding: 0; flex: none; opacity: .6; transition: opacity .15s, color .15s, border-color .15s; }
.info:hover, .info:focus-visible { opacity: 1; color: var(--link); border-color: var(--link); }
.tile .info { position: absolute; top: 8px; right: 8px; }
.tile:hover .info { opacity: 1; }
.card-h .info { margin-left: 2px; }
.info-body { font-size: 14px; color: var(--ink-soft); }
.info-body .info-what { color: var(--ink); margin: 0 0 10px; }
.info-body h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); margin: 12px 0 4px; }
.info-body ul { margin: 0; padding-left: 18px; }
.info-body li { margin: 3px 0; }
.info-meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 12px 0 0; }
.info-meta dt { color: var(--ink-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.info-meta dd { margin: 0; }
.info-note { background: var(--surface-alt); border-radius: 8px; padding: 8px 10px; margin: 12px 0 0; }
.info-now { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 10px; font-size: 13px; color: var(--ink-muted); }
#infoFoot:empty { display: none; }
#infoFoot { margin-top: 12px; }
.card-h .tgl { margin-left: 0; }
.card-h .spacer { margin-left: auto; }
.modal-bg { position: fixed; inset: 0; background: rgba(14, 51, 80, .45); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: #fff; border-radius: 12px; width: min(560px, 100%); max-height: 90vh; overflow: auto; padding: 18px 20px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.modal-h h3 { font-size: 17px; }
.modal .x { background: none; border: 0; font-size: 24px; cursor: pointer; color: var(--ink-muted); }
.ask-about { background: var(--surface-alt); border-radius: 8px; padding: 8px 10px; font-size: 13px; color: var(--ink-soft); margin-bottom: 10px; }
.modal textarea { width: 100%; min-height: 110px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; resize: vertical; }
.ask-note { font-size: 12px; color: var(--ink-muted); margin: 6px 0 10px; }
.modal-f { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.ask-msg { font-size: 13px; color: var(--ink-soft); margin-right: auto; }
.mine { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 10px; }
.mine h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); margin: 0 0 6px; }
.q { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-size: 13.5px; }
.q .meta { font-size: 12px; color: var(--ink-muted); margin-bottom: 4px; }
.q .reply { margin-top: 6px; padding: 6px 8px; background: #eef5fb; border-radius: 6px; white-space: pre-wrap; }
.q .msg { white-space: pre-wrap; }
.badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; line-height: 18px; text-align: center; }
.qa-reply { width: 100%; min-height: 54px; border: 1px solid var(--line-strong); border-radius: 6px; padding: 6px 8px; margin-top: 6px; }

.tiles + .grid { margin-top: 14px; }
@media (max-width: 640px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile .sub { font-size: 11px; }
  .card-h { flex-wrap: wrap; }
  .card-h .note { order: 9; flex-basis: 100%; margin-top: -2px; }
}
.card-h .sortby { font: inherit; font-size: 12px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.ask-kind { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 2px 0 10px; font-size: 13px; }
.ask-kind label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

/* Company tab: Service Type multi-select */
.f .ms { position: relative; }
.ms-btn { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 190px; text-transform: none; letter-spacing: 0;
  font-size: 14px; font-weight: 500; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 7px;
  padding: 6px 8px; cursor: pointer; text-align: left; }
.ms-caret { color: var(--ink-muted); font-size: 11px; }
.ms-pop { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; min-width: 240px; max-width: calc(100vw - 40px); max-height: 62vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .15); padding: 8px 8px 0;
  text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink); font-size: 14px; }
.ms-opt { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; cursor: pointer; }
.ms-opt:hover { background: var(--surface-alt); }
.ms-all { font-weight: 600; border-bottom: 1px solid var(--line); border-radius: 0; margin-bottom: 2px; padding-bottom: 8px; }
.ms-gh { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-muted); font-weight: 700; padding: 8px 6px 2px; }
.ms-foot { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); margin-top: 6px; padding: 8px 0; position: sticky; bottom: 0; background: var(--surface); }
.f .ms-pop input[type=checkbox] { min-width: 0; width: 16px; height: 16px; padding: 0; margin: 0; flex: none; accent-color: var(--navy, #0e3350); }
