/* DIANO IT: one stylesheet for every page. Phone first; laptop adds room.
   The look: midnight navy, electric blue for actions, amber for what needs
   attention. Every text colour pair below passes WCAG AA (4.5:1). */
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/plus-jakarta-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/fonts/plus-jakarta-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
:root {
  --bg: #f1f4fa;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #475569;
  --line: #e2e8f0;
  --brand: #2563eb;
  --brand-ink: #ffffff;
  --link: #1d4ed8;
  --accent: #f59e0b;
  --accent-ink: #0b1736;
  --ok: #166534;
  --ok-bg: #dcfce7;
  --warn: #92400e;
  --warn-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --chip: #e2e8f0;
  --chip-ink: #334155;
  --field-line: #7c8aa0;
  /* The navy bar, the same in light and dark. */
  --bar: #0b1736;
  --bar-2: #13224a;
  --bar-ink: #ffffff;
  --bar-muted: #a5b4d4;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 6px 20px rgba(15, 23, 42, 0.06);
  --radius: 16px;
  --gap: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #070d1f;
    --surface: #101a36;
    --ink: #e8edf7;
    --muted: #a5b4d4;
    --line: #22305a;
    --brand: #3b82f6;
    --brand-ink: #0a1128;
    --link: #8db8ff;
    --ok: #86efac;
    --ok-bg: #0f3b24;
    --warn: #fcd34d;
    --warn-bg: #3d2806;
    --bad: #fca5a5;
    --bad-bg: #4a1414;
    --chip: #1c2a52;
    --chip-ink: #d5def0;
    --field-line: #6b7cb0;
    --bar: #050a19;
    --bar-2: #13224a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 16px/1.5 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); font-weight: 600; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; }
h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; margin: 0; overflow-wrap: anywhere; min-width: 0; }
h2 { font-size: 1.15rem; font-weight: 800; margin: 0 0 8px; }
h3 { font-size: 1rem; font-weight: 700; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 20px 16px; }
@media (min-width: 760px) { .wrap { padding: 28px 24px; } }
.stack > * + * { margin-top: var(--gap); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.spread { display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}
.grid { display: grid; gap: var(--gap); }
@media (min-width: 760px) { .grid.two { grid-template-columns: 1fr 1fr; } .grid.three { grid-template-columns: repeat(3, 1fr); } }

/* The navy bar across the top of every page. */
header.top {
  background: var(--bar);
  color: var(--bar-ink);
  position: sticky;
  top: 0;
  z-index: 5;
  box-shadow: 0 2px 12px rgba(11, 23, 54, 0.25);
}
header.top .wrap { padding-top: 12px; padding-bottom: 12px; }
header.top .muted { color: var(--bar-muted); }
header.top a { color: #bfd4ff; }
header.top :focus-visible { outline-color: var(--accent); }
header.top button { background: transparent; color: var(--bar-ink); border-color: rgba(255, 255, 255, 0.28); }
header.top button:hover { background: var(--bar-2); }
.brand { font-weight: 800; letter-spacing: 0.02em; display: inline-flex; align-items: center; gap: 10px; font-size: 1.05rem; }
.brand::before {
  content: "DI";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #2563eb;
  color: #ffffff;
  font-size: 0.85rem;
  letter-spacing: 0;
}

button, .button {
  font: inherit;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 10px 16px;
  min-height: 44px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s;
}
button:hover, .button:hover { border-color: var(--brand); }
button.primary, .button.primary {
  background: var(--brand);
  color: var(--brand-ink);
  border-color: var(--brand);
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
}
button.primary:hover, .button.primary:hover { filter: brightness(0.92); }
button.ghost { background: transparent; }
button.danger { color: var(--bad); border-color: var(--bad); }
button:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }

.field { display: grid; gap: 6px; }
.field span { font-size: 0.875rem; font-weight: 600; color: var(--muted); }
input, select, textarea {
  font: inherit;
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1.5px solid var(--field-line);
  background: var(--surface);
  color: var(--ink);
  min-height: 46px;
}
input.check { width: 22px; height: 22px; min-height: 0; padding: 0; accent-color: var(--brand); }
[hidden] { display: none !important; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18); }

.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--chip); color: var(--chip-ink); font-size: 0.8rem; font-weight: 700; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }

.banner { padding: 12px 16px; border-radius: 12px; background: var(--chip); color: var(--chip-ink); }
.banner.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--accent); }
.banner.bad { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad); }

dialog.sheet {
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  width: min(520px, calc(100vw - 32px));
  padding: 22px;
  box-shadow: 0 24px 60px rgba(11, 23, 54, 0.35);
}
dialog.sheet::backdrop { background: rgba(11, 23, 54, 0.55); }

#toast { position: fixed; left: 16px; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 20; pointer-events: none; }
.toast { background: var(--bar); color: #ffffff; padding: 12px 16px; border-radius: 12px; max-width: 520px; margin: 0 auto; font-weight: 600; box-shadow: 0 10px 30px rgba(11, 23, 54, 0.3); }
.toast.bad { background: #b91c1c; color: #fff; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.75rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.table-scroll { overflow-x: auto; }

/* The bold-heading menus (SALES · HARDWARE · SOFTWARE · RENTAL · MAINTENANCE / REPAIRS · SUPPORT). */
nav.menu { display: flex; gap: 4px; flex-wrap: wrap; }
nav.menu details { position: relative; }
nav.menu summary { list-style: none; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.8rem; padding: 10px 12px; cursor: pointer; border-radius: 10px; color: #e2e8f0; }
nav.menu summary::-webkit-details-marker { display: none; }
nav.menu summary:hover { background: var(--bar-2); }
nav.menu details[open] summary { background: #2563eb; color: #ffffff; }
nav.menu .items { position: absolute; z-index: 10; background: var(--bar-2); border: 1px solid #22305a; border-radius: 14px; padding: 6px; min-width: 230px; box-shadow: 0 16px 40px rgba(11, 23, 54, 0.35); }
nav.menu .items a, nav.menu .items span { display: block; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: #e2e8f0; font-weight: 600; }
nav.menu .items a:hover { background: #2563eb; color: #ffffff; }
nav.menu .soon { color: var(--bar-muted); font-weight: 500; }
@media (max-width: 759px) {
  nav.menu { flex-direction: column; }
  nav.menu .items { position: static; border: 0; padding-left: 12px; box-shadow: none; background: transparent; }
}

canvas.sign { width: 100%; height: 180px; background: #fff; border: 2px dashed var(--line); border-radius: 12px; touch-action: none; }

/* Back office and portal. */
.menu-toggle { display: none; }
@media (max-width: 759px) {
  .menu-toggle { display: inline-flex; }
  header.top nav.menu { display: none; }
  body.menu-open header.top nav.menu { display: flex; }
}
header.top nav.menu { margin-top: 8px; }
.list { display: grid; gap: 10px; }
.list > a.card { color: var(--ink); text-decoration: none; display: block; font-weight: 400; transition: border-color 0.15s, transform 0.15s; }
.list > a.card:hover { border-color: var(--brand); transform: translateY(-1px); }
.msg { border-left: 3px solid var(--line); padding: 6px 12px; }
.msg.internal { border-left-color: var(--accent); background: var(--warn-bg); border-radius: 0 10px 10px 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; }
.checks input { width: auto; min-height: 0; }
.pill-under-review { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 3px 12px; font-size: 0.8rem; font-weight: 800; }

/* A whole card that is a link. */
.plain-link { display: block; color: inherit; text-decoration: none; font-weight: inherit; }

/* Priority labels: P1 red, P2 amber, P3 blue, P4 grey. */
.chip.p1 { background: #b91c1c; color: #ffffff; }
.chip.p2 { background: var(--accent); color: var(--accent-ink); }
.chip.p3 { background: #dbeafe; color: #1e40af; }
.chip.p4 { background: var(--chip); color: var(--chip-ink); }

/* The numbers at the top of a page. */
.tiles { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 4px; box-shadow: var(--shadow); font-size: 0.875rem; font-weight: 600; color: var(--muted); }
.tile .n { font-size: 2.1rem; font-weight: 800; line-height: 1; color: var(--ink); }
.tile.navy { background: var(--bar); border-color: #2c3d70; color: var(--bar-muted); }
.tile.navy .n { color: #ffffff; }
.tile.amber { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tile.amber .n { color: var(--accent-ink); }
a.tile { text-decoration: none; }
.facts { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
a.tile:hover { border-color: var(--ink); }
.tile.red { border-color: #b91c1c; box-shadow: inset 4px 0 0 #b91c1c; }
.chip.live::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #16a34a; margin-right: 6px; vertical-align: middle; }

/* On a laptop, signed in, the navy bar becomes a menu down the left side. */
@media (min-width: 1000px) {
  body:has(header.top nav.menu) { padding-left: 264px; }
  body:has(header.top nav.menu) header.top {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 264px;
    overflow-y: auto;
    box-shadow: none;
  }
  header.top:has(nav.menu) .wrap { padding: 22px 16px; }
  header.top:has(nav.menu) .spread { flex-direction: column; align-items: flex-start; gap: 14px; }
  header.top:has(nav.menu) .spread > .row { flex-direction: column; align-items: flex-start; gap: 8px; }
  header.top nav.menu { flex-direction: column; gap: 2px; margin-top: 24px; }
  header.top nav.menu summary { color: var(--bar-muted); padding: 10px 12px; }
  header.top nav.menu summary::after { content: "+"; float: right; font-weight: 700; }
  header.top nav.menu details[open] summary::after { content: "–"; }
  header.top nav.menu details[open] summary { background: transparent; color: #ffffff; }
  header.top nav.menu .items { position: static; min-width: 0; border: 0; box-shadow: none; background: transparent; padding: 0 0 8px 6px; }
}
nav.menu .items a[aria-current="page"] { background: #2563eb; color: #ffffff; }

/* Technician app: the job's navy header card and big work buttons. */
.card.hero { background: var(--bar); border-color: #2c3d70; color: #ffffff; }
.card.hero .muted { color: var(--bar-muted); }
.card.hero h1 { font-size: 1.5rem; }
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.actions button { width: 100%; min-height: 52px; }
.actions button.primary:not(:disabled) { grid-column: 1 / -1; min-height: 60px; font-size: 1.1rem; background: var(--accent); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px rgba(245, 158, 11, 0.35); }
@media (min-width: 760px) { .actions { grid-template-columns: repeat(3, minmax(0, 1fr)); } }


/* Product pricing: cost, markup, VAT and profit, worked out as you type. */
.price-facts { background: var(--surface-2, transparent); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.bad-text { color: #b91c1c; }
.ok-text { color: #15803d; }
@media (prefers-color-scheme: dark) { .bad-text { color: #f87171; } .ok-text { color: #4ade80; } }
#markups summary { cursor: pointer; }

/* "← Back" at the top of pages */
.back-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 4px; }
.back-bar .back-btn { min-height: 40px; padding: 6px 14px; font-weight: 700; }
.back-bar a { font-size: 0.9rem; }

/* The "Ask DIANO" assistant: a header button and a chat panel. */
.assistant-button { border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
.assistant-panel { position: fixed; right: 16px; bottom: 16px; z-index: 15; width: min(420px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 32px)); display: flex; flex-direction: column; gap: 10px; padding: 16px; box-shadow: 0 24px 60px rgba(11, 23, 54, 0.35); }
.assistant-panel[hidden] { display: none; }
.assistant-panel h2 { margin: 0; font-size: 1.05rem; }
.assistant-log { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.assistant-turn { margin: 0; padding: 10px 12px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: 92%; }
.assistant-turn.user { align-self: flex-end; background: var(--brand); color: var(--brand-ink); }
.assistant-turn.assistant { align-self: flex-start; background: var(--chip); color: var(--chip-ink); }
.assistant-turn.assistant.muted { background: transparent; color: var(--muted); padding: 0; }
.assistant-turn.error { align-self: stretch; background: var(--bad-bg); color: var(--bad); }
.assistant-form { display: grid; gap: 8px; }
.assistant-form textarea { width: 100%; resize: vertical; }
@media print { .assistant-button, .assistant-panel { display: none; } }
