/*
  Darner Operations stylesheet.

  A quiet, modern interface: a neutral slate canvas, hairline borders instead of
  heavy frames, soft rounded surfaces, one confident brand green, and the system
  UI font (nothing is loaded from the network — SCOPE.md §8.1, §8.3). Vendored,
  no build step.

  Light and dark are both first-class. Everything below is written against the
  colour *tokens* in the next section and never against a literal colour, so a
  theme is nothing more than a set of values:

    - :root holds the dark values (the brand default when the system has no
      preference).
    - A system preference for light switches to the light values — unless the
      visitor has chosen dark.
    - html[data-theme="light"] forces them. common/js/theme.js sets data-theme
      from the visitor's saved choice (the header's sun/moon button) or from the
      system, before the first paint.

  The light values are therefore written twice, once for the media query and once
  for the attribute; common/tests/test_theme.py fails if the two ever differ, and
  also checks the contrast of the colour pairs the pages rely on.

  Mobile-first: the engineer console must work one-handed on a phone at 03:00 in a
  car park (SCOPE.md §8.5) — large tap targets, high contrast, no reliance on hover.
*/

:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #0b0f14;
  --bg-subtle: #0e141a;
  --bg-panel: #121920;
  --bg-panel-raised: #1a232c;
  --bg-input: #0d1319;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);

  /* Text */
  --ink: #e7ecf1;
  --ink-dim: #98a6b3;
  --ink-faint: #7a8896;

  /* Brand green */
  --accent: #2fbf71;
  --accent-strong: #5ddb98;
  --accent-ink: #04140a;
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  /* Save buttons: a slightly darker green than the other buttons. */
  --accent-save: #22a35f;
  --accent-save-strong: #2fbf71;
  /* Each company's own colours (the company buttons always; the whole page when it is
     Uchuma's, below). Darner's are the accent above. */
  --darner-accent: #2fbf71;
  --darner-accent-strong: #5ddb98;
  --darner-accent-ink: #04140a;
  /* Uchuma's gray: the quote PDF's #555b62 in the light theme; lighter in the dark one,
     where #555b62 on the near-black page would be too faint to read. */
  --uchuma-accent: #8d959e;
  --uchuma-accent-strong: #b6bcc3;
  --uchuma-accent-ink: #0b0d10;
  --uchuma-accent-save: #7d858e;
  --uchuma-accent-save-strong: #8d959e;
  --uchuma-glow: rgba(141, 149, 158, 0.08);

  /* Amber (warnings, "needs a look"), red (errors), blue (keyboard focus) */
  --signal: #f0b34a;
  --signal-soft: color-mix(in srgb, var(--signal) 15%, transparent);
  --color-danger: #ff8a7a;
  --color-danger-bg: rgba(255, 99, 80, 0.14);
  --color-focus: #7cc0ff;
  --now: #ff6b5e;

  /* Depth and atmosphere */
  --glow: rgba(47, 191, 113, 0.08);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.55), 0 2px 8px rgba(0, 0, 0, 0.35);

  /* Shape and rhythm (the same in both themes) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2rem;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-pill: 999px;
  --tap-target: 44px;

  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI Variable Text", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-display: var(--font-body);
  --font-mono: ui-monospace, "Cascadia Mono", "SF Mono", "Roboto Mono", Consolas, "Liberation Mono",
    Menlo, monospace;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;

    --bg: #f4f6f8;
    --bg-subtle: #eceff3;
    --bg-panel: #ffffff;
    --bg-panel-raised: #f5f7fa;
    --bg-input: #ffffff;
    --line: rgba(15, 23, 32, 0.09);
    --line-strong: rgba(15, 23, 32, 0.19);

    --ink: #0f1720;
    --ink-dim: #556372;
    --ink-faint: #6b7886;

    --accent: #00833b;
    --accent-strong: #006a30;
    --accent-ink: #ffffff;
    --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent);
    --accent-save: #006a30;
    --accent-save-strong: #00541f;
    --darner-accent: #00833b;
    --darner-accent-strong: #006a30;
    --darner-accent-ink: #ffffff;
    --uchuma-accent: #555b62;
    --uchuma-accent-strong: #43484e;
    --uchuma-accent-ink: #ffffff;
    --uchuma-accent-save: #43484e;
    --uchuma-accent-save-strong: #33373c;
    --uchuma-glow: rgba(85, 91, 98, 0.07);

    --signal: #975100;
    --signal-soft: color-mix(in srgb, var(--signal) 10%, transparent);
    --color-danger: #c0262d;
    --color-danger-bg: rgba(192, 38, 45, 0.08);
    --color-focus: #0b63ce;
    --now: #d92d20;

    --glow: rgba(0, 131, 59, 0.07);
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.06);
    --shadow: 0 16px 40px rgba(16, 24, 40, 0.14), 0 2px 8px rgba(16, 24, 40, 0.06);
  }
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f4f6f8;
  --bg-subtle: #eceff3;
  --bg-panel: #ffffff;
  --bg-panel-raised: #f5f7fa;
  --bg-input: #ffffff;
  --line: rgba(15, 23, 32, 0.09);
  --line-strong: rgba(15, 23, 32, 0.19);

  --ink: #0f1720;
  --ink-dim: #556372;
  --ink-faint: #6b7886;

  --accent: #00833b;
  --accent-strong: #006a30;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 11%, transparent);
  --accent-save: #006a30;
  --accent-save-strong: #00541f;
  --darner-accent: #00833b;
  --darner-accent-strong: #006a30;
  --darner-accent-ink: #ffffff;
  --uchuma-accent: #555b62;
  --uchuma-accent-strong: #43484e;
  --uchuma-accent-ink: #ffffff;
  --uchuma-accent-save: #43484e;
  --uchuma-accent-save-strong: #33373c;
  --uchuma-glow: rgba(85, 91, 98, 0.07);

  --signal: #975100;
  --signal-soft: color-mix(in srgb, var(--signal) 10%, transparent);
  --color-danger: #c0262d;
  --color-danger-bg: rgba(192, 38, 45, 0.08);
  --color-focus: #0b63ce;
  --now: #d92d20;

  --glow: rgba(0, 131, 59, 0.07);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.06);
  --shadow: 0 16px 40px rgba(16, 24, 40, 0.14), 0 2px 8px rgba(16, 24, 40, 0.06);
}

/* An Uchuma page (common/companies.theme_company; <html data-company="UCHUMA">): Uchuma's
   gray wherever Darner's green would be. After the theme blocks, so it wins over them. */
:root[data-company="UCHUMA"] {
  --accent: var(--uchuma-accent);
  --accent-strong: var(--uchuma-accent-strong);
  --accent-ink: var(--uchuma-accent-ink);
  --accent-save: var(--uchuma-accent-save);
  --accent-save-strong: var(--uchuma-accent-save-strong);
  --glow: var(--uchuma-glow);
}

/* --- Base --------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* A faint wash of brand green at the top of every page: depth without decoration. */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 420px;
  background: radial-gradient(70% 100% at 50% 0%, var(--glow), transparent 72%);
  pointer-events: none;
  z-index: -1;
}

::selection {
  background: color-mix(in srgb, var(--accent) 35%, transparent);
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-3);
  color: var(--ink);
}

h1 {
  font-size: clamp(1.55rem, 1.25rem + 1.2vw, 2rem);
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.2rem;
  margin-top: var(--space-4);
}

h3 {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

p {
  margin: 0 0 var(--space-3);
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-thickness: 2px;
}

code {
  font-family: var(--font-mono);
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.4em;
  font-size: 0.88em;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--space-4) 0;
}

details > summary {
  cursor: pointer;
  font-weight: 600;
}

.hint {
  color: var(--ink-dim);
  font-size: 0.875rem;
}

/* Text for screen readers that the eye doesn't need. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Visible focus everywhere — never rely on hover (SCOPE.md §8.5) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  z-index: 100;
  font-weight: 700;
}

.skip-link:focus {
  left: var(--space-2);
  top: var(--space-2);
}

/* --- Layout ---------------------------------------------------------------- */

.app-main {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-3) var(--space-5);
}

/* A page that is one short form (e.g. Change password): a readable column, not the full width. */
.narrow-page {
  max-width: 34rem;
}

/* --- Eyebrow (small kicker above a heading) ----------------------------------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6em;
  margin-bottom: var(--space-2);
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

/* --- Buttons ------------------------------------------------------------------ */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: var(--tap-target);
  padding: 0.55rem 1.15rem;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.005em;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.16);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease, transform 0.06s ease;
}

.button:hover {
  background: var(--accent-strong);
  text-decoration: none;
}

.button:active {
  transform: translateY(1px);
}

.button:disabled,
.button[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Save: the same button a shade darker, so it stands out from the other actions.
   Two classes plus .app-main so it also wins over a page's own button rules (quotes.css). */
.button.button--save,
.app-main .button.button--save {
  color: var(--accent-ink);
  background: var(--accent-save);
  border-color: transparent;
}

.button.button--save:hover,
.app-main .button.button--save:hover {
  color: var(--accent-ink);
  background: var(--accent-save-strong);
}

.button--secondary {
  color: var(--ink);
  background: var(--bg-panel);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.button--secondary:hover {
  color: var(--ink);
  background: var(--bg-panel-raised);
  border-color: color-mix(in srgb, var(--ink) 30%, transparent);
}

.button--link {
  min-height: auto;
  padding: 0 var(--space-2);
  color: var(--ink-dim);
  background: transparent;
  border: none;
  box-shadow: none;
  font-weight: 600;
  text-decoration: none;
}

.button--link:hover {
  color: var(--accent-strong);
  background: transparent;
  text-decoration: underline;
}

.button--large {
  width: 100%;
  min-height: 56px;
  font-size: 1rem;
  border-radius: var(--radius-lg);
}

.button--danger {
  color: var(--color-danger);
  background: var(--color-danger-bg);
  border-color: color-mix(in srgb, var(--color-danger) 45%, transparent);
  box-shadow: none;
}

.button--danger:hover {
  color: #fff;
  background: color-mix(in srgb, var(--color-danger) 88%, black);
  border-color: transparent;
}

/* An upload box while files are dragged over it (common/js/file-drop.js). */
.is-file-drop {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
  border-radius: var(--radius);
  background: var(--accent-soft);
}

/* --- Forms ---------------------------------------------------------------------- */

.field {
  margin-bottom: var(--space-4);
}

.field label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: var(--ink-dim);
}

.field .hint {
  margin-top: var(--space-1);
}

/* Django's password rules arrive as a <ul> in the help text. */
.field .hint ul {
  margin: 0;
  padding-left: 1.2em;
}

.field .error,
.error {
  margin-top: var(--space-1);
  font-size: 0.875rem;
  color: var(--color-danger);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="datetime-local"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  min-height: var(--tap-target);
  padding: 0.5rem 0.85rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg-input);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

textarea {
  min-height: calc(var(--tap-target) * 2);
  line-height: 1.5;
  resize: vertical;
}

/* The caret is two gradients meeting in a point, in the text colour, so it needs no
   image and follows the theme by itself. */
select {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 2.25rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-dim) 50%),
    linear-gradient(135deg, var(--ink-dim) 50%, transparent 50%);
  background-repeat: no-repeat;
  background-position: calc(100% - 1.15rem) calc(50% + 1px), calc(100% - 0.8rem) calc(50% + 1px);
  background-size: 0.36rem 0.36rem, 0.36rem 0.36rem;
  cursor: pointer;
}

input::placeholder,
textarea::placeholder {
  color: var(--ink-faint);
  opacity: 1;
}

input:hover,
select:hover,
textarea:hover {
  border-color: color-mix(in srgb, var(--ink) 32%, transparent);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 24%, transparent);
  outline: 2px solid transparent; /* shows in forced-colours mode, where shadows don't */
}

input:disabled,
select:disabled,
textarea:disabled {
  color: var(--ink-dim);
  background: var(--bg-subtle);
  cursor: not-allowed;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
}

/* A switch standing in for a bare checkbox, for the flag-like booleans across the
   project/ticket/calendar forms (Billable, After hours, Standby, "A change was
   made", "Start timer now"). The real <input type="checkbox"> stays in the DOM and
   drives label/keyboard/screen-reader behaviour as normal; only its own box is
   visually hidden, sized to a 1px point rather than display:none so it stays
   focusable and announced. The track and thumb are sibling <span>s styled off
   :checked. Element-qualified (label.toggle), because some usages sit inside a
   .field and ".field label" is equally specific — this needs to win that tie by
   source order, and it resets every property ".field label" sets so a switch's own
   text ("Start timer now") reads as normal text rather than as a field label. */
label.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0;
  font-size: 1rem;
  font-weight: 450;
  letter-spacing: normal;
  color: var(--ink);
  cursor: pointer;
}

.toggle--center {
  justify-content: center;
}

.toggle--spaced {
  margin-bottom: var(--space-4);
}

.toggle input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
}

.toggle__track {
  position: relative;
  flex-shrink: 0;
  width: 42px;
  height: 24px;
  background: color-mix(in srgb, var(--ink) 16%, transparent);
  border-radius: var(--radius-pill);
  transition: background-color 0.18s ease;
}

.toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.18s ease;
}

.toggle input:checked + .toggle__track {
  background: var(--accent);
}

.toggle input:checked + .toggle__track .toggle__thumb {
  transform: translateX(18px);
}

.toggle input:focus-visible + .toggle__track {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

/* --- Messages / banners ------------------------------------------------------------- */

.messages {
  list-style: none;
  margin: 0 0 var(--space-4);
  padding: 0;
}

.messages__item {
  padding: 0.8rem var(--space-3);
  border-radius: var(--radius);
  margin-bottom: var(--space-2);
  border: 1px solid var(--line-strong);
  background: var(--bg-panel);
  font-size: 0.9375rem;
}

.messages__item--success {
  background: var(--accent-soft);
  color: var(--accent-strong);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.messages__item--error {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: color-mix(in srgb, var(--color-danger) 45%, transparent);
}

.messages__item--warning {
  background: var(--signal-soft);
  color: var(--signal);
  border-color: color-mix(in srgb, var(--signal) 45%, transparent);
}

.banner {
  padding: 0.8rem var(--space-3);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
  border: 1px solid color-mix(in srgb, var(--color-danger) 45%, transparent);
  background: var(--color-danger-bg);
  color: var(--color-danger);
  font-weight: 600;
}

.banner a {
  color: inherit;
}

/* The same green pairing as .messages__item--success, for positive-status
   banners (e.g. a running timer). */
.banner--success {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

/* --- Cards ------------------------------------------------------------------------------ */

.card {
  position: relative;
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card > :last-child {
  margin-bottom: 0;
}

.card h2:first-child,
.card h3:first-child {
  margin-top: 0;
}

/* A plain list of facts (label, value, label, value), e.g. on the delete-entry page. */
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-2) var(--space-4);
  margin: 0 0 var(--space-3);
}

.facts dt {
  color: var(--ink-dim);
  font-size: 0.875rem;
}

.facts dd {
  margin: 0;
}

/* --- Auth screens (centred, phone-first) -------------------------------------------------- */

.auth-screen {
  max-width: 420px;
  margin: clamp(1rem, 7vh, 4rem) auto var(--space-5);
}

.auth-screen .card {
  margin-bottom: 0;
  padding: var(--space-5) var(--space-4);
  box-shadow: var(--shadow);
}

.auth-screen h1 {
  font-size: 1.6rem;
}

.auth-screen .mark {
  width: 44px;
  height: 44px;
  margin-bottom: var(--space-3);
}

/* The Operations Portal mark (common/_portal_mark.html): bigger, as the page's logo. */
.auth-screen .mark--portal {
  display: block;
  width: 72px;
  height: 72px;
}

/* QR codes need guaranteed light-on-dark-modules contrast to scan, regardless of
   site theme — the SVG itself has a transparent background, so this backing is
   not optional. */
.qr-wrap {
  max-width: 220px;
  margin: 0 auto var(--space-4);
  background: #ffffff;
  padding: var(--space-3);
  border-radius: var(--radius);
}

/* --- Severity picker: four large buttons, SCOPE.md §6.1 ------------------------------------- */

.severity-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
  list-style: none;
  margin: 0 0 var(--space-4);
  padding: 0;
}

.severity-picker input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.severity-picker label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 60px;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.severity-picker label:hover {
  background: var(--bg-panel-raised);
}

.severity-picker input[type="radio"]:checked + label {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
  box-shadow: 0 0 0 1px var(--accent);
}

.severity-picker input[type="radio"]:focus-visible + label {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.severity-picker .severity-hint {
  display: block;
  font-weight: 450;
  font-size: 0.8125rem;
  opacity: 0.85;
}

/* --- Client search (Log a call) ------------------------------------------------------------- */

.client-results-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
  padding: 0;
}

.client-results-list .button {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.client-picked-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  padding: 0.8rem var(--space-3);
  background: var(--accent-soft);
  color: var(--accent-strong);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: var(--radius);
}

/* .button--link defaults to --ink-dim; keep "Change" in the banner's own green. */
.client-picked-banner .button--link {
  color: var(--accent-strong);
}

/* --- Ticket list / dashboard ------------------------------------------------------------------ */

.ticket-list {
  list-style: none;
  margin: 0 0 var(--space-4);
  padding: 0;
}

.ticket-list__item {
  display: block;
  margin-bottom: var(--space-2);
  padding: var(--space-3) var(--space-3) var(--space-3) calc(var(--space-3) + 3px);
  color: var(--ink);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: inset 3px 0 0 var(--severity, transparent), var(--shadow-sm);
  text-decoration: none;
  transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}

.ticket-list__item strong {
  font-weight: 650;
}

.ticket-list__item:hover,
.ticket-list__item:focus-visible {
  background: var(--bg-panel-raised);
  border-color: var(--line-strong);
}

.ticket-list__item--P1 {
  --severity: var(--color-danger);
}

.ticket-list__item--P2 {
  --severity: var(--signal);
}

.ticket-list__item--P3,
.ticket-list__item--P4 {
  --severity: var(--line-strong);
}

.ticket-list__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: 0.875rem;
  color: var(--ink-dim);
}

/* Used as the badge row directly under a project/ticket detail page's <h1>,
   rather than under a .ticket-list__item — needs space below it. */
.ticket-list__meta--detail {
  margin-top: 0;
  margin-bottom: var(--space-4);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.005em;
  background: color-mix(in srgb, var(--ink) 8%, transparent);
  color: var(--ink-dim);
  border: 1px solid var(--line);
  text-decoration: none;
}

a.badge:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

/* --- Timer / allowance panel ---------------------------------------------------------------- */

.timer-panel {
  text-align: center;
  padding: var(--space-4);
}

.timer-panel__display {
  margin-bottom: var(--space-3);
  font-size: 3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--accent-strong);
}

.allowance-panel dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-2) var(--space-3);
  margin: 0;
}

.allowance-panel dt {
  align-self: center;
  font-size: 0.875rem;
  color: var(--ink-dim);
}

.allowance-panel dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* --- Data tables (time entries, closing report, the quotes register) ---------------------------- */

/* The wrapper is the frame: it scrolls sideways on a narrow screen and rounds the
   table's corners. It is also the containing block for anything absolutely
   positioned inside, so a visually hidden label in a wide table can't widen the page. */
.data-table-wrap {
  position: relative;
  overflow-x: auto;
  margin-bottom: var(--space-4);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card .data-table-wrap {
  box-shadow: none;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.data-table thead th {
  background: var(--bg-subtle);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
  white-space: nowrap;
}

.data-table tbody tr:last-child td,
.data-table tbody tr:last-child th {
  border-bottom: 0;
}

.data-table tbody tr {
  transition: background-color 0.12s ease;
}

.data-table tbody tr:hover {
  background: color-mix(in srgb, var(--ink) 3%, transparent);
}

.data-table td.tabular,
.data-table td:has(.tabular) {
  font-variant-numeric: tabular-nums;
}

.data-table a:not(.button, .badge) {
  font-weight: 600;
  text-decoration: none;
}

.data-table a:not(.button, .badge):hover {
  text-decoration: underline;
}

/* --- Action bars --------------------------------------------------------------------------------- */

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.action-bar form {
  margin: 0;
}

/* --- Detail-page spacing (project/ticket detail, close-ticket flow) -------------------------------- */

.manual-entry-details {
  margin-top: var(--space-4);
  margin-bottom: var(--space-4);
}

.manual-entry-details > summary {
  margin-bottom: var(--space-3);
  color: var(--ink-dim);
}

.confirm-close-form {
  margin-top: var(--space-4);
}

.log-call-cta {
  margin-bottom: var(--space-4);
}

/* --- Theme switch: fade the colours across, but only for a deliberate switch --------------------- */

.theme-changing,
.theme-changing *,
.theme-changing *::before,
.theme-changing *::after {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, fill 0.3s ease,
    stroke 0.3s ease, box-shadow 0.3s ease !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* The Top menu page (accounts/top_menu.html): one tick box per menu item. */
.menu-choices {
  margin: 0 0 var(--space-3);
  padding: 0;
  border: none;
}

.menu-choices legend {
  margin-bottom: var(--space-2);
  font-weight: 600;
}

.menu-choice {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  font-weight: 400;
}

.menu-choice input {
  width: auto;
  min-height: 0;
}

/* The Darner / Uchuma buttons, top left of Projects, Quotes and Reports
   (common/_company_switch.html): the chosen company solid green, as the Quotes buttons; the
   other an outlined green button. Classes of their own (not .button), so no page's button
   styles change them: they look the same everywhere. */
.company-switch {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-3);
}

.app-main .company-switch__button,
.company-switch__button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--accent-strong);
  background: transparent;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  text-decoration: none;
}

.app-main .company-switch__button:hover,
.company-switch__button:hover {
  color: var(--accent-ink);
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  text-decoration: none;
}

/* Each company's button in its own colours, whichever company's page it is on. */
.company-switch__button--darner {
  --accent: var(--darner-accent);
  --accent-strong: var(--darner-accent-strong);
  --accent-ink: var(--darner-accent-ink);
}

.company-switch__button--uchuma {
  --accent: var(--uchuma-accent);
  --accent-strong: var(--uchuma-accent-strong);
  --accent-ink: var(--uchuma-accent-ink);
}

.app-main .company-switch__button--on,
.company-switch__button--on {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

/* A page heading with a button beside it (Projects: Darner Project Matrix). */
.page-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
}

.page-heading h1 {
  margin-bottom: var(--space-2);
}
