/* ============================================================================
   TestTech LABWork — application chrome.

   Ported from the approved UI design (Claude Design canvas "LABWork v3").
   Colours are sampled from the Test Tech logo (accent #2f87c9 is also the
   natural water-lab brand blue); the typeface is Prompt, a Thai/Latin sans,
   because the whole interface is Thai-primary.

   The canvas also linked a "Broadsheet" design system, but that system is a
   newsprint/serif kit whose component classes (.card, .table, .btn, .input)
   collide with the ones below and whose JS bundle is only CMYK print-plate
   SVG filters that this interface never uses. Only the four reset primitives
   the layout genuinely depends on were carried over — see "inherited reset".
   ========================================================================= */

/* ---- inherited reset ---------------------------------------------------- */
/* box-sizing is load-bearing: every padded card and grid column below is
   sized on the border box. */
*, *::before, *::after { box-sizing: border-box; }
img { display: block; max-width: 100%; }
figure { margin: 0; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--brand) 30%, transparent); }

/* ---- tokens ------------------------------------------------------------- */
:root {
  --ink: #1b2a38;
  --mut: #63707d;
  --line: #e2e8ee;
  --brand: #2f87c9;
  --brand-d: #1f6394;
  --brand-l: #e9f2fa;
  --brand-t: #c8e0f0;
  --ok: #1e7a55;
  --ok-l: #e8f6ef;
  --warn: #8a5a00;
  --warn-l: #fff5e6;
  --danger: #c4362b;
  --danger-l: #fdeceb;
  --bg: #f2f5f8;
}

body {
  margin: 0;
  background: var(--bg);
  font-family: "Prompt", system-ui, sans-serif;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  text-wrap: pretty;
}

h1, h2, h3, h4, h5 {
  font-family: "Prompt", system-ui, sans-serif;
  letter-spacing: -.01em;
  color: var(--ink);
}

input, textarea, button, select { font-family: inherit; }
a { color: var(--brand-d); text-underline-offset: 3px; }

/* Tabular figures — every document number, quantity and result reads in a
   column, so they must not wobble between rows. */
.num { font-variant-numeric: tabular-nums; }

/* ---- surfaces ----------------------------------------------------------- */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(22, 32, 43, .04);
}

/* ---- navigation --------------------------------------------------------- */
.side {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--mut);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.side:hover { background: #eef2f6; color: var(--ink); }
.side[data-on="1"] { background: var(--brand-l); color: var(--brand-d); font-weight: 600; }
.side svg { width: 19px; height: 19px; flex: none; }

.top {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--mut);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.top:hover { background: #eef2f6; color: var(--ink); }
.top[data-on="1"] { background: var(--brand-l); color: var(--brand-d); font-weight: 600; }
.top svg { width: 17px; height: 17px; flex: none; }

/* ---- status pills ------------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: .01em;
}
.pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .75;
}
.p-ok   { background: var(--ok-l);     color: var(--ok); }
.p-info { background: var(--brand-l);  color: var(--brand-d); }
.p-warn { background: var(--warn-l);   color: var(--warn); }
.p-bad  { background: var(--danger-l); color: var(--danger); }
.p-mute { background: #eef1f4;         color: var(--mut); }

/* ---- tables ------------------------------------------------------------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--mut);
  padding: 11px 14px;
  background: #fafbfc;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid #eef1f4; vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr[data-click="1"] { cursor: pointer; }
.tbl tbody tr:hover { background: #f8fafb; }

/* ---- forms -------------------------------------------------------------- */
.inp {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.inp:hover { border-color: #c6ced7; }
.inp:focus-visible {
  border-color: var(--brand);
  outline: 2px solid color-mix(in srgb, var(--brand) 22%, transparent);
  outline-offset: 0;
}
textarea.inp { min-height: 88px; resize: vertical; }
select.inp { appearance: auto; }

.lbl { display: block; font-size: 12px; font-weight: 600; color: var(--mut); margin-bottom: 5px; }

/* Validation, wired to ASP.NET Core's unobtrusive client validation. */
.inp.input-validation-error { border-color: var(--danger); background: var(--danger-l); }
.field-validation-error { display: block; margin-top: 5px; font-size: 12px; color: var(--danger); }
.validation-summary-errors { margin: 0 0 14px; padding: 12px 14px; border-radius: 10px; background: var(--danger-l); color: var(--danger); font-size: 13px; }
.validation-summary-errors ul { margin: 0; padding-left: 18px; }
.validation-summary-valid { display: none; }

/* ---- buttons ------------------------------------------------------------ */
.b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 19px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
.b-pri { background: var(--brand); color: #fff; }
.b-pri:hover { background: var(--brand-d); }
.b-sec { background: #fff; border-color: var(--line); color: var(--ink); }
.b-sec:hover { background: #f4f6f8; border-color: #c6ced7; }
.b-gh { background: none; color: var(--brand-d); padding: 0 8px; }
.b-gh:hover { background: var(--brand-l); }
.b:disabled { opacity: .45; cursor: not-allowed; }
.b svg { width: 17px; height: 17px; }

/* ---- utilities ---------------------------------------------------------- */
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--mut); }
.mut { color: var(--mut); }
.g2 > * { min-width: 0; }
.scroll { overflow-x: auto; }

/* A transient confirmation after a write, shown at the top of the screen. */
.flash {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  border-left: 3px solid var(--ok);
  background: var(--ok-l);
  color: var(--ok);
}
.flash-bad { border-left-color: var(--danger); background: var(--danger-l); color: var(--danger); }

/* Wide content (tables, the calendar) scrolls inside its own container so the
   page body never scrolls sideways. */
@media (max-width: 1180px) {
  .g2 { grid-template-columns: 1fr !important; gap: 20px !important; }
}
@media (max-width: 820px) {
  .gf { grid-template-columns: 1fr !important; }
}
