/* ==========================================================================
   Thorne Technology, Admin
   Built 2 Nov 2026 from the approved mockups.

   Section 1  Tokens
   Section 2  Base
   Section 3  Shell: rail, topbar, quick strip
   Section 4  Components
   Section 5  Sign in

   The mockups were drawn at reduced scale inside a frame. Everything here is
   at real size: 14px body, 36px controls. Admin is deliberately denser than
   the client portal, which is the only difference between the two sheets.
   ========================================================================== */


/* ==========================================================================
   1. TOKENS
   ========================================================================== */

:root {
  /* Brand */
  --purple:        #543174;
  --purple-soft:   #EFEBF4;
  --purple-deep:   #43265D;
  --lime:          #B0CA1F;
  --lime-soft:     #F4F7E3;
  --lime-ink:      #5B6B12;   /* the only lime readable as text on white */

  /* Chrome */
  --sidebar:       #2A222D;   /* Purple Black */
  --rail-link:     #B8B0C2;
  --rail-muted:    #9A93A6;   /* contrast floor on Purple Black, 5.2:1 */
  --rail-hair:     rgba(255,255,255,.07);
  --rail-hover:    rgba(255,255,255,.05);

  /* Surface and ink */
  --bg:            #F4F3F7;
  --surface:       #FFFFFF;
  --surface-2:     #FAF9FC;
  --ink:           #2A222D;
  --body-ink:      #5B5266;
  --muted:         #8A8394;
  --faint:         #9A94A3;

  /* Lines */
  --border:        #E7E4EC;
  --border-soft:   #F1EEF5;
  --border-faint:  #F6F4F9;
  --field-border:  #D4CEDC;

  /* Semantic */
  --green:  #5B6B12;  --green-soft:  #F4F7E3;
  --amber:  #C77D1A;  --amber-soft:  #FDF3E4;
  --red:    #B23A2E;  --red-soft:    #FBE9E6;
  --blue:   #2F6FED;  --blue-soft:   #EAF0FE;
  --neutral:#8A8394;  --neutral-soft:#F4F3F7;

  /* Type */
  --font-ui:   'Jost', system-ui, -apple-system, sans-serif;
  --font-body: 'Mulish', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;

  /* Radii */
  --r-sm: 9px; --r: 10px; --r-md: 14px; --r-lg: 16px; --r-pill: 20px;

  /* Elevation */
  --shadow:    0 1px 2px rgba(42,34,45,.05);
  --shadow-md: 0 4px 14px rgba(42,34,45,.08);
  --shadow-lg: 0 24px 60px rgba(42,34,45,.18);

  /* Focus */
  --ring: 0 0 0 3px rgba(84,49,116,.14);

  /* Layout */
  --rail-w: 238px;
  --top-h:  58px;
  --pad:    22px;
}


/* ==========================================================================
   2. BASE
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
* { font-synthesis: none; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  color: var(--body-ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--ink);
  margin: 0;
  letter-spacing: -.015em;
}
h1 { font-size: 24px; line-height: 1.2; }
h2 { font-size: 19px; line-height: 1.25; }
h3 { font-size: 16px; line-height: 1.3; }
h4 { font-size: 14px; line-height: 1.35; letter-spacing: 0; }

p { margin: 0 0 14px; }
a { color: var(--purple); text-decoration: none; }
a:hover { color: var(--purple-deep); }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; border-radius: 3px; }

/* Class rules must beat the browser default, which is how spans inside
   buttons ended up rendering inline three times during the portal build. */
[hidden] { display: none !important; }

/* Every icon gets a size HERE, not at each call site. The first version only
   sized .rail-i .ic, so the topbar search and bell rendered at the SVG's own
   size and spilled across the header. */
.ic { width: 16px; height: 16px; flex: none; display: block; }

code, .mono { font-family: var(--font-mono); font-size: .88em; }
.tnum { font-variant-numeric: tabular-nums; }
.vh {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}


/* ==========================================================================
   3. SHELL
   ========================================================================== */

.shell { display: flex; min-height: 100vh; }

/* --- rail --- */

.rail {
  width: var(--rail-w); flex: none; background: var(--sidebar);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow: hidden;
}
.rail-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 14px; flex: none;
}
.rail-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--lime);
  display: flex; align-items: center; justify-content: center; flex: none;
  font-family: var(--font-ui); font-weight: 600; font-size: 15px; color: var(--sidebar);
}
.rail-brand-t { min-width: 0; }
.rail-name {
  display: block; font-family: var(--font-ui); font-weight: 600; font-size: 14px;
  color: #fff; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rail-sub { display: block; font-size: 10.5px; color: var(--rail-muted); line-height: 1.3; }

.rail-nav { flex: 1; padding-bottom: 14px; overflow-y: auto; overscroll-behavior: contain; }

/* A real button, so the group is reachable by keyboard. The old rail used a
   div, which is why it never was. */
.rail-grp {
  background: none; border: 0; width: 100%; text-align: left; cursor: pointer;
  font-family: var(--font-ui); font-weight: 600; font-size: 9.5px; letter-spacing: .16em;
  text-transform: uppercase; color: var(--lime);
  padding: 14px 16px 5px; display: flex; align-items: center; gap: 7px;
}
.rail-grp:hover { color: #C8E03A; }
.rail-grp .cv { font-size: 9px; display: inline-block; transition: transform .12s; }
.rail-grp[aria-expanded="false"] .cv { transform: rotate(-90deg); }
.rail-grp .gc {
  margin-left: auto; font-family: var(--font-mono); font-size: 9.5px;
  color: #6E6678; letter-spacing: 0;
}
.rail-grp[aria-expanded="true"] .gc { display: none; }

.rail-i {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 16px; font-size: 13px; color: var(--rail-link);
  border-left: 2px solid transparent;
}
.rail-i:hover { background: var(--rail-hover); color: #fff; }
.rail-i.on {
  background: rgba(176,202,31,.12); color: var(--lime);
  font-weight: 600; border-left-color: var(--lime);
}
.rail-i .ic { width: 15px; height: 15px; flex: none; opacity: .85; }
.rail-i.on .ic { opacity: 1; }
.rail-i .ct {
  margin-left: auto; font-family: var(--font-mono); font-size: 10px;
  background: rgba(255,255,255,.14); border-radius: 8px; padding: 1px 6px; color: #fff;
}

.rail-foot {
  flex: none; border-top: 1px solid var(--rail-hair); padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
}
.rail-foot .av {
  width: 30px; height: 30px; border-radius: 50%; background: var(--purple); color: #fff;
  font-family: var(--font-ui); font-weight: 600; font-size: 12px;
  display: flex; align-items: center; justify-content: center; flex: none;
}
.rail-foot .who { min-width: 0; flex: 1; }
.rail-foot .who b { display: block; font-family: var(--font-ui); font-size: 12.5px; color: #fff;
  font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-foot .who span { display: block; font-size: 10.5px; color: var(--rail-muted); }
.rail-out {
  background: none; border: 0; cursor: pointer; color: var(--rail-muted);
  padding: 5px; border-radius: 6px; display: flex; flex: none;
}
.rail-out:hover { color: #fff; background: var(--rail-hover); }

.rail-scrim { display: none; }

/* --- main --- */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  min-height: var(--top-h); background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 10px var(--pad);
  position: sticky; top: 0; z-index: 20; flex-wrap: wrap;
}
.tb-h { min-width: 0; }
.tb-t { font-family: var(--font-ui); font-weight: 600; font-size: 17px; color: var(--ink);
  letter-spacing: -.01em; line-height: 1.2; }
.tb-s { font-size: 12.5px; color: var(--muted); }
.tb-sp { flex: 1; }

.tb-search {
  height: 34px; min-width: 200px; max-width: 320px; flex: 1 1 200px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface-2); display: flex; align-items: center; gap: 8px;
  padding: 0 11px; font-size: 13px; color: var(--faint); cursor: pointer;
}
.tb-search .ic { width: 15px; height: 15px; }
.tb-search span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-search kbd {
  margin-left: auto; font-family: var(--font-mono); font-size: 10.5px;
  border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; color: var(--muted);
  background: var(--surface);
}
.tb-ic {
  width: 34px; height: 34px; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface); color: var(--body-ink); cursor: pointer; flex: none;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.tb-ic:hover { border-color: var(--field-border); color: var(--ink); }
.tb-ic .ic { width: 17px; height: 17px; }
.tb-ic .dot {
  position: absolute; top: 6px; right: 6px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--red); border: 1.5px solid var(--surface);
}
.rail-toggle { display: none; }

.content { padding: var(--pad); display: grid; gap: 14px; align-content: start; }

/* --- the impersonation banner. Amber, full width, never scrolls away. --- */
.imp-ban {
  background: var(--amber); color: #fff; font-size: 13px; font-weight: 600;
  padding: 9px var(--pad); display: flex; align-items: center; gap: 10px; flex: none;
}
.imp-ban svg { width: 16px; height: 16px; flex: none; }
.imp-ban form { margin-left: auto; }
.imp-ban button {
  background: rgba(255,255,255,.22); border: 0; color: #fff; cursor: pointer;
  font-family: var(--font-ui); font-weight: 600; font-size: 12px;
  border-radius: 6px; padding: 4px 11px;
}
.imp-ban button:hover { background: rgba(255,255,255,.34); }


/* ==========================================================================
   4. COMPONENTS
   ========================================================================== */

/* --- quick view strip. Same four tiles at the top of every section. --- */

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.qt {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 13px 14px; min-width: 0;
}
.qt .l {
  display: block; font-family: var(--font-ui); font-weight: 600; font-size: 9.5px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.qt .v {
  display: block; font-family: var(--font-ui); font-weight: 600; font-size: 26px;
  color: var(--ink); letter-spacing: -.025em; margin-top: 3px;
  font-variant-numeric: tabular-nums; line-height: 1.15;
}
.qt .d { display: block; font-size: 11px; color: var(--green); margin-top: 2px; }
.qt .d.warn { color: var(--amber); }
.qt .d.bad  { color: var(--red); }
.qt .d.neutral { color: var(--muted); }

/* --- panel --- */

.pan {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; min-width: 0;
}
.pan-h {
  padding: 12px 15px; border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.pan-h h3 { font-size: 14px; }
.pan-h .more { margin-left: auto; font-size: 12px; font-weight: 600; }
.pan-b { padding: 15px; }
.pan-b > :last-child { margin-bottom: 0; }

/* --- a panel that folds -----------------------------------------------
 *
 * Replaced a fixed height scrolling sidebar. That kept the column the right
 * length but squeezed the contents into a sliver, which is worse: the whole
 * point of the sidebar is reading it. Folding gives the same short column and
 * full size content in whichever panel you actually opened.
 */
details.fold > summary.pan-h {
  cursor: pointer;
  list-style: none;
  user-select: none;
  padding-right: 15px;
}
details.fold > summary.pan-h::-webkit-details-marker { display: none; }
details.fold > summary.pan-h:hover h3 { color: var(--purple); }
details.fold > summary.pan-h:focus-visible {
  outline: 2px solid var(--purple); outline-offset: -2px; border-radius: var(--r) var(--r) 0 0;
}
.fold-cv {
  font-size: 10px; color: var(--muted); flex: none;
  transition: transform .14s ease;
  display: inline-block; width: 11px;
}
details.fold:not([open]) > summary.pan-h { border-bottom: 0; }
details.fold:not([open]) .fold-cv { transform: rotate(-90deg); }

/* --- table --- */

.tw { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th {
  font-family: var(--font-ui); font-weight: 700; font-size: 9.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); text-align: left;
  padding: 9px 15px; border-bottom: 1px solid var(--border-soft); white-space: nowrap;
}
table.t td {
  font-size: 13px; padding: 10px 15px; border-bottom: 1px solid var(--border-faint);
  color: var(--ink); vertical-align: middle;
}
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.clickable { cursor: pointer; }
table.t tbody tr.clickable:hover { background: var(--surface-2); }
table.t td.m { font-family: var(--font-mono); font-size: 11.5px; color: var(--body-ink); white-space: nowrap; }
table.t td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.t td.r { text-align: right; }
table.t td.t { color: var(--body-ink); }

/* --- a row in a state --------------------------------------------------
 *
 * A breached ticket shown as one red badge in a column of forty rows is easy
 * to scan straight past. The row itself is not. Kept as a tint plus a left
 * edge rather than a solid fill, because a solid red row makes its own text
 * harder to read, and the point is to draw the eye to the row, not to stop it
 * being readable once it gets there.
 *
 * The left edge carries the same meaning as the tint, so this is never colour
 * alone: the SLA column still says "Breached" in words.
 */
table.t tr.row-bad td  { background: #FDF1EF; }
table.t tr.row-warn td { background: #FEF8EE; }
table.t tr.row-bad:hover td  { background: #FBE9E6; }
table.t tr.row-warn:hover td { background: var(--amber-soft); }

/* The edge goes on the FIRST cell only. Putting it on every td drew a bar
   down the left of every column, which read as a broken table rather than an
   urgent row. */
table.t tr.row-bad td:first-child  { box-shadow: inset 2px 0 0 var(--red); font-weight: 600; }
table.t tr.row-warn td:first-child { box-shadow: inset 2px 0 0 var(--amber); }

/* --- badges --- */

.bd {
  font-family: var(--font-ui); font-weight: 700; font-size: 9.5px; letter-spacing: .06em;
  text-transform: uppercase; padding: 3px 9px; border-radius: var(--r-pill);
  white-space: nowrap; display: inline-block;
}
.bd-red { background: var(--red-soft);    color: var(--red); }
.bd-amb { background: var(--amber-soft);  color: var(--amber); }
.bd-grn { background: var(--green-soft);  color: var(--green); }
.bd-blu { background: var(--blue-soft);   color: var(--blue); }
.bd-ntl { background: var(--neutral-soft);color: var(--muted); }
.bd-pur { background: var(--purple-soft); color: var(--purple); }
.bd-lim { background: var(--lime);        color: var(--sidebar); }

/* --- buttons --- */

.btn {
  font-family: var(--font-ui); font-weight: 600; font-size: 13px; height: 36px;
  padding: 0 16px; border-radius: var(--r-sm); border: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn-p { background: var(--purple); color: #fff; }
.btn-p:hover { background: var(--purple-deep); color: #fff; }
.btn-l { background: var(--lime); color: var(--sidebar); }
.btn-l:hover { background: #9DB61B; color: var(--sidebar); }
.btn-o { background: var(--surface); border: 1.5px solid var(--field-border); color: var(--ink); }
.btn-o:hover { border-color: var(--purple); color: var(--purple); }
.btn-t { background: none; color: var(--muted); }
.btn-t:hover { background: var(--bg); color: var(--ink); }
.btn-d { background: var(--red-soft); color: var(--red); }
.btn-d:hover { background: #F7DAD5; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn-lg { height: 42px; padding: 0 22px; font-size: 14px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* --- fields --- */

.fgroup { margin-bottom: 16px; }
.flab {
  display: block; font-family: var(--font-ui); font-weight: 600; font-size: 10px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px;
}
.fld {
  width: 100%; border: 1.5px solid var(--field-border); border-radius: var(--r-sm);
  padding: 10px 13px; font-family: var(--font-body); font-size: 14px;
  color: var(--ink); background: var(--surface);
  transition: border-color .12s, box-shadow .12s;
}
.fld:focus { outline: none; border-color: var(--purple); box-shadow: var(--ring); }
.fld::placeholder { color: var(--faint); }
textarea.fld { resize: vertical; min-height: 84px; line-height: 1.6; }
select.fld { cursor: pointer; }
.fhint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* --- alerts --- */

.alert {
  padding: 12px 15px; border-radius: var(--r); font-size: 13.5px; line-height: 1.6;
  margin-bottom: 14px; border: 1px solid transparent;
}
.alert-ok   { background: var(--green-soft); border-color: #DCE8B4; color: #3F4A0C; }
.alert-err  { background: var(--red-soft);   border-color: #F2C9C3; color: #8C2A20; }
.alert-warn { background: var(--amber-soft); border-color: #F3DDB8; color: #8A5510; }
.alert-info { background: var(--purple-soft);border-color: #DFD6E8; color: var(--purple-deep); }

/* --- note, a quieter alert used inside panels --- */
.note {
  background: var(--purple-soft); border: 1px solid #DFD6E8; border-radius: var(--r-sm);
  padding: 11px 13px; font-size: 13px; color: var(--purple-deep); line-height: 1.6;
}
.note-l { background: var(--lime-soft); border-color: #DCE8B4; color: #3F4A0C; }
.note-a { background: var(--amber-soft);border-color: #F3DDB8; color: #8A5510; }
/* Red. Was being asked for and quietly rendering grey. Added 11 Nov. */
.note-r { background: #FBEDEB; border-color: #EFC9C3; color: #8C2A20; }

/* --- toasts ------------------------------------------------------------
 *
 * A write redirects, so without something that moves, the only evidence it
 * worked is a line of text at the top of a page that looks identical to the
 * one before it. A toast moves, which is the part that registers.
 *
 * role=status and aria-live=polite on the container, so a screen reader hears
 * it without the page being interrupted mid sentence.
 */
.toasts {
  position: fixed; top: calc(var(--top-h) + 12px); right: 16px; z-index: 80;
  display: flex; flex-direction: column; gap: 9px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--purple);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13.5px; line-height: 1.55; color: var(--ink);
  animation: toast-in .22s cubic-bezier(.2,.9,.3,1.2) both;
}
.toast.ok  { border-left-color: var(--lime); }
.toast.err { border-left-color: var(--red); }
.toast .ic { margin-top: 2px; }
.toast.ok  .ic { color: var(--lime-ink); }
.toast.err .ic { color: var(--red); }
.toast .t { flex: 1; min-width: 0; }
.toast .x {
  background: none; border: 0; cursor: pointer; color: var(--muted);
  font-size: 16px; line-height: 1; padding: 2px 3px; flex: none; border-radius: 4px;
}
.toast .x:hover { color: var(--ink); background: var(--bg); }
.toast.going { animation: toast-out .2s ease forwards; }

@keyframes toast-in  { from { opacity: 0; transform: translateX(14px) scale(.98); } }
@keyframes toast-out { to   { opacity: 0; transform: translateX(14px); } }

@media (prefers-reduced-motion: reduce) {
  .toast, .toast.going { animation: none; }
}
@media (max-width: 560px) {
  .toasts { left: 16px; right: 16px; width: auto; }
}

/* --- key/value --- */

dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; margin: 0; font-size: 13px; }
dl.kv dt {
  font-family: var(--font-ui); font-size: 9.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); padding-top: 2px;
}
dl.kv dd { margin: 0; color: var(--ink); min-width: 0; }

/* --- tabs --- */

.tabs {
  display: flex; gap: 2px; flex-wrap: wrap; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r); padding: 0 4px;
}
/* Only lose the bottom edge when a panel is joined directly underneath. */
.tabs:has(+ .pan) { border-bottom: 0; border-radius: var(--r) var(--r) 0 0; }
.tab {
  font-family: var(--font-ui); font-weight: 600; font-size: 12.5px; color: var(--muted);
  padding: 11px 13px; border-bottom: 2px solid transparent; background: none; border-top: 0;
  border-left: 0; border-right: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.on { color: var(--purple); border-bottom-color: var(--purple); }
.tab .n {
  font-family: var(--font-mono); font-size: 10px; background: var(--neutral-soft);
  border-radius: 8px; padding: 0 5px; color: var(--muted);
}
.tab.on .n { background: var(--purple-soft); color: var(--purple); }
.tabs + .pan { border-radius: 0 0 var(--r) var(--r); }

/* --- workflow stages --- */

.stages { display: flex; align-items: center; flex-wrap: wrap; gap: 0; }
.stage { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.stage .n {
  width: 22px; height: 22px; border-radius: 50%; background: var(--neutral-soft);
  color: var(--muted); display: flex; align-items: center; justify-content: center;
  font-family: var(--font-ui); font-weight: 700; font-size: 11px; flex: none;
}
.stage.done .n { background: var(--lime); color: var(--sidebar); }
.stage.done { color: var(--ink); }
.stage.now .n { background: var(--purple); color: #fff; }
.stage.now { color: var(--purple); font-weight: 700; }
.stage-l { width: 26px; height: 1.5px; background: var(--border); margin: 0 10px; flex: none; }

/* --- SLA bars. A bar reads at a glance; a timestamp needs arithmetic. --- */

.sla { margin-bottom: 14px; }
.sla:last-child { margin-bottom: 0; }
.sla-l { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 5px; gap: 10px; }
.sla-v { font-family: var(--font-ui); font-weight: 700; font-size: 13px; color: var(--ink); }
.sla-v.ok { color: var(--green); } .sla-v.warn { color: var(--amber); } .sla-v.bad { color: var(--red); }
.sla-t { height: 7px; background: var(--border-soft); border-radius: 4px; overflow: hidden; }
.sla-t span { display: block; height: 100%; border-radius: 4px; background: var(--purple); }
.sla-t span.ok { background: var(--lime); }
.sla-t span.warn { background: var(--amber); }
.sla-t span.bad { background: var(--red); }
.sla-d { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

/* --- bars --- */

.bars { display: grid; gap: 9px; }
/* 118px, not 94px: client names are the usual label here and "Morgan Lettings"
   truncated at 94. */
.bar { display: grid; grid-template-columns: 118px 1fr auto; gap: 12px; align-items: center; font-size: 12.5px; }
.bar .lb { color: var(--body-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .tk { height: 8px; background: var(--border-soft); border-radius: 4px; overflow: hidden; }
.bar .tk span { display: block; height: 100%; border-radius: 4px; background: var(--purple); }
.bar .tk span.l { background: var(--lime); }
.bar .tk span.a { background: var(--amber); }
.bar .vn { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }

/* --- thread --- */

.thread { display: grid; gap: 11px; }
.msg { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 14px; background: var(--surface); }
.msg-int  { background: var(--amber-soft);  border-color: #F3DDB8; }
.msg-cust { background: var(--purple-soft); border-color: #DFD6E8; }
.msg-m { font-size: 11.5px; color: var(--body-ink); margin-bottom: 6px;
  display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.msg-m b { font-family: var(--font-ui); font-size: 13px; color: var(--ink); font-weight: 600; }
.msg-b { font-size: 13.5px; line-height: 1.65; color: var(--ink); white-space: pre-wrap; }
.msg-f { margin-top: 9px; display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  font-size: 11.5px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 7px; padding: 3px 9px; color: var(--body-ink);
  display: inline-flex; align-items: center; gap: 6px;
}

/* --- layout helpers --- */

.g2  { display: grid; grid-template-columns: 1.55fr 1fr; gap: 14px; align-items: start; min-width: 0; }
.g2e { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; min-width: 0; }
.g3  { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
.stack { display: grid; gap: 14px; align-content: start; min-width: 0; }

/* --- empty state --- */

.empty { text-align: center; padding: 34px 18px; color: var(--muted); font-size: 13px; }
.empty b { display: block; font-family: var(--font-ui); font-size: 15px; color: var(--ink); margin-bottom: 5px; }

/* --- a section that could not load its data. Never a fatal. --- */
.dataerr {
  border: 1px solid #F3DDB8; background: var(--amber-soft); color: #8A5510;
  border-radius: var(--r); padding: 14px 16px; font-size: 13px; line-height: 1.6;
}
.dataerr b { display: block; font-family: var(--font-ui); font-size: 14px; color: #6E440D; margin-bottom: 3px; }


/* ==========================================================================
   5. SIGN IN
   ========================================================================== */

.auth-bar {
  height: 60px; background: var(--sidebar); display: flex; align-items: center;
  gap: 14px; padding: 0 30px;
}
.auth-bar img { height: 26px; width: auto; display: block; }
.auth-bar .wordmark { font-family: var(--font-ui); font-weight: 600; font-size: 17px; color: #fff; }
.auth-bar .ctx {
  font-family: var(--font-ui); font-weight: 500; font-size: 11px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--lime);
  border-left: 1px solid rgba(255,255,255,.16); padding-left: 14px; margin-left: 2px;
}
.auth { position: relative; min-height: calc(100vh - 60px); display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr); background: var(--surface); }
.auth-pane { position: relative; display: flex; align-items: center; justify-content: center;
  padding: 80px 32px 104px; }
.auth-card { width: 100%; max-width: 536px; }
.auth-h { font-family: var(--font-ui); font-weight: 600; font-size: 34px; letter-spacing: -.015em;
  color: var(--ink); line-height: 1.2; margin: 0; }
.auth-s { font-size: 15px; color: var(--body-ink); margin: 11px 0 0; line-height: 1.6; max-width: 44ch; }
.auth-f { margin-top: 34px; }
.auth-help { margin-top: 34px; font-size: 14.5px; color: var(--body-ink); line-height: 1.75; }
.auth-foot { position: absolute; left: 0; right: 50%; bottom: 34px;
  display: flex; justify-content: center; padding: 0 32px; }
.auth-foot-in { width: 100%; max-width: 536px; display: flex; flex-wrap: wrap; gap: 28px; font-size: 13.5px; }
.auth-foot a { color: var(--muted); }
.auth-foot a:hover { color: var(--purple); }
.code-in { font-size: 21px; letter-spacing: .3em; text-align: center; font-family: var(--font-mono); }

/* artwork panel. Admin swaps which ribbon carries the lime. */
.auth-art { position: relative; background: #211B24; overflow: hidden; min-height: 420px;
  --art-bg:#211B24; --art-1:#3A2448; --art-2:#B0CA1F; --art-3:#543174;
  --art-4:#7E4CA8; --art-tile:#B0CA1F; --art-planet:#8C6FB0; }
.auth-art svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.auth-art::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 52%;
  background: linear-gradient(to top, rgba(26,21,29,.94) 0%, rgba(26,21,29,.86) 22%,
              rgba(26,21,29,.52) 52%, transparent 100%);
  z-index: 1; pointer-events: none;
}
.auth-art-copy { position: absolute; left: 52px; right: 52px; bottom: 46px; z-index: 2; color: #fff; }
.auth-art-line { font-family: var(--font-ui); font-weight: 600; font-size: 30px; line-height: 1.28;
  letter-spacing: -.015em; max-width: 17ch; margin: 0; }
.auth-art-sub { font-size: 15px; color: var(--rail-link); line-height: 1.7; margin: 14px 0 0; max-width: 40ch; }


/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 1100px) {
  .quick { grid-template-columns: repeat(2, 1fr); }
  .g2, .g2e { grid-template-columns: 1fr; }
  .g3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  .rail {
    position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .rail.open { transform: none; }
  .rail-scrim {
    display: block; position: fixed; inset: 0; background: rgba(42,34,45,.42);
    z-index: 55; opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .rail-scrim.open { opacity: 1; pointer-events: auto; }
  .rail-toggle { display: flex; }
  .g3 { grid-template-columns: 1fr; }
  :root { --pad: 16px; }
}

@media (max-width: 1000px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-pane { padding: 48px 26px 128px; }
  .auth-foot { right: 0; padding: 0 26px; }
}

@media (max-width: 560px) {
  .quick { grid-template-columns: 1fr; }
  .topbar { gap: 9px; }
  .tb-search { display: none; }

  /* Let a table scroll sideways rather than squash. Without this the summary
     column wraps to one word per line and the badge on the right is clipped,
     which is exactly what a dense admin table must not do on a phone. */
  table.t { min-width: 580px; }
  .tw { -webkit-overflow-scrolling: touch; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media print {
  .rail, .topbar, .rail-scrim { display: none !important; }
  .content { padding: 0; }
  .pan { break-inside: avoid; }
}

/* "by email" beside a client name worked out from the sender's address rather
   than stored on the ticket. Deliberately quiet: it is a qualifier on the name
   next to it, not a status of its own, so it must not compete with the badges
   in the same row. Added 8 Nov. */
.hint-i {
  font: 500 11px/1 "Jost", system-ui, sans-serif;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 5px;
  margin-left: 6px;
  white-space: nowrap;
  cursor: help;
  vertical-align: 1px;
}

/* A clickable booking in the week view. Added 11 Nov with the booking detail
   screen: the bars looked identical whether or not there was anything behind
   them, which is how a week of bookings read as a dead end. */
a.cal-ev { transition: filter .12s ease, box-shadow .12s ease; }
a.cal-ev:hover { filter: brightness(.97); box-shadow: 0 1px 3px rgba(42,34,45,.10); }
a.cal-ev:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

/* Tone and emphasis inside a key/value list. These were being asked for all
   over the build and quietly ignored, so a value the screen meant to flag as
   missing read exactly like one that was fine. Added 11 Nov. */
.kv-bad    { color: var(--red); font-weight: 600 }
.kv-warn   { color: var(--amber); font-weight: 600 }
.kv-strong { color: var(--ink); font-weight: 600 }

/* A divider inside a panel, between two related lists. */
.hr { height: 1px; background: var(--border); margin: 14px 0; border: 0 }

/* Raw stored text shown as-is, for a value that could not be parsed. Wrapped,
   because the alternative is a panel with a horizontal scrollbar. */
pre.raw {
  margin: 10px 0 0; padding: 10px 12px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r-sm);
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.6; color: var(--body);
  white-space: pre-wrap; word-break: break-word; max-height: 320px; overflow: auto;
}
