/* SureFire IT theme, matched to the SureFire HaloPSA tenant (service.sfit.ca):
 * Halo red top bar with the white SureFire logo, cool light-grey page, rounded
 * white cards, pill buttons, Poppins. Change colours here only. */
@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap");

:root {
  --brand-red: #cd0200;        /* Halo tenant primary (close to SureFire logo red #c7192d) */
  --brand-red-dark: #a80200;
  --brand-red-soft: #e83c4a;   /* Halo icon-circle red */

  --bg: #f1f5fb;               /* Halo page background */
  --surface: #ffffff;          /* cards, inputs */
  --fg: #212529;
  --muted: #5d686f;
  --line: #dde3ec;
  --accent: var(--brand-red);
  --accent-hover: var(--brand-red-dark);
  --accent-fg: #ffffff;
  --link: var(--brand-red-dark);
  --select-bg: #fdeceb;
  --focus: var(--brand-red);
  --shadow: 0 1px 3px rgba(23, 32, 39, .06), 0 1px 2px rgba(23, 32, 39, .04);

  --header-bg: #ffffff;        /* white bar so the logo shows in its real colours */
  --header-fg: #212529;
  --header-link: var(--brand-red-dark);

  --ok-bg: #eef7f0; --ok-line: #9ccfa9; --ok-fg: #1e6b34;
  --warn-bg: #f6f7f9; --warn-line: #dde3ec; --warn-fg: #33414a;
  --err-bg: #fdeceb; --err-line: #efa9a6; --err-fg: #a80200;

  --radius-card: 14px;
  --radius-input: 10px;
  --radius-pill: 999px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #172027;             /* SureFire charcoal */
    --surface: #212c33;
    --fg: #eef1f2;
    --muted: #aeb7bc;
    --line: #3d484f;
    --accent-hover: #e0201e;
    --link: #ff8f9c;
    --select-bg: #3a2226;
    --focus: #ff8f9c;
    --shadow: none;
    --header-bg: #0f161b;      /* charcoal bar + official reversed logo */
    --header-fg: #eef1f2;
    --header-link: #ff8f9c;
    --ok-bg: #16301f; --ok-line: #2f6b40; --ok-fg: #a9e3b5;
    --warn-bg: #262f35; --warn-line: #465159; --warn-fg: #d7dee1;
    --err-bg: #3a1d22; --err-line: #7a2a35; --err-fg: #ffb6bf;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font: 14px/1.5 Poppins, "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont, sans-serif; }
body.dialog { padding: 0; }
.dialog-body { padding: 24px 20px; }

/* ---- Header: full-colour SureFire logo on white (reversed logo on charcoal in dark mode),
 *      Halo-red rule underneath ---- */
.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: var(--header-bg); color: var(--header-fg);
  border-bottom: 3px solid var(--brand-red);
}
.topbar .logo { height: 24px; width: auto; display: block; }
.topbar .product {
  font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  padding: 1px 8px; border: 1px solid var(--brand-red); border-radius: var(--radius-pill);
  color: var(--header-link);
}
.who { font-size: 12px; flex: 1; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar button.link { color: var(--header-link); text-decoration: underline; text-underline-offset: 2px; }
main { padding: 12px 14px 24px; }

.hidden { display: none !important; }
.label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin: 14px 0 4px; text-transform: uppercase; letter-spacing: .05em; }
.meta { color: var(--muted); font-size: 12px; }
.subject { font-weight: 600; word-break: break-word; }
.small { font-size: 12px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 12px 14px; margin: 8px 0; box-shadow: var(--shadow); }
.card .label { margin-top: 0; }
.card.ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-fg); box-shadow: none; }
.card.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-fg); box-shadow: none; }

.banner { padding: 9px 12px; border-radius: var(--radius-input); margin-bottom: 8px; border: 1px solid var(--line); background: var(--surface); word-break: break-word; }
.banner.error { color: var(--err-fg); background: var(--err-bg); border-color: var(--err-line); }
.banner.warn { color: var(--warn-fg); background: var(--warn-bg); border-color: var(--muted); }
.banner.success { color: var(--ok-fg); background: var(--ok-bg); border-color: var(--ok-line); }
.banner.error a, .banner.success a, .card.ok a, .card.warn a { color: inherit; font-weight: 600; }

.row { display: flex; gap: 6px; }
.row.center { align-items: center; }
.grow { flex: 1; }
input[type=search], input[type=text], select {
  flex: 1; width: 100%; padding: 7px 12px; border: 1px solid var(--line); border-radius: var(--radius-input);
  background: var(--surface); color: var(--fg); font: inherit;
}
select[size] { margin-top: 6px; border-radius: var(--radius-input); }
input:focus-visible, select:focus-visible, button:focus-visible, .tickets li:focus-visible, summary:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 1px;
}

button { font: inherit; font-weight: 500; padding: 7px 16px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); font-weight: 600; }
button.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
button.wide { width: 100%; margin-top: 12px; padding: 9px 16px; }
button.link { border: 0; background: none; color: var(--link); padding: 0; font-size: 12px; border-radius: 0; }
button.link:hover { text-decoration: underline; }
a { color: var(--link); }

.check { display: flex; align-items: center; gap: 6px; margin: 6px 0; }
input[type=checkbox] { accent-color: var(--brand-red); }

.tickets { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-card); background: var(--surface); box-shadow: var(--shadow); }
.tickets:empty { display: none; }
.tickets li { padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.tickets li:last-child { border-bottom: 0; }
.tickets li:hover { background: var(--bg); }
.tickets li[aria-checked=true] { background: var(--select-bg); box-shadow: inset 3px 0 0 var(--brand-red); }
.tickets .tid { font-weight: 600; margin-right: 6px; color: var(--link); }
.tickets .tsum { word-break: break-word; }
.tickets .tmeta { color: var(--muted); font-size: 12px; }

#signInView button { display: block; margin-top: 8px; }
#sessionBox .kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 10px 0; font-size: 12px; }
#sessionBox dt { color: var(--muted); }
#sessionBox dd { margin: 0; word-break: break-word; }
#sessResult { margin-top: 8px; }
.ok-text { color: var(--ok-fg) !important; }
.err-text { color: var(--err-fg) !important; }

.newlink { margin-top: 8px; font-size: 13px; font-weight: 600; }
#newTicketView .row { margin-top: 8px; }

details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 8px; }
summary { cursor: pointer; font-weight: 600; }

.busy { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--muted); }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--brand-red); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* Logos: full-colour on light, official reversed logo in dark mode */
.brand-logo { height: 40px; width: auto; }
.on-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
  .on-light { display: none !important; }
  .on-dark { display: block !important; }
}
