/* ════════════════════════════════════════════════════════════════
 * Medworx — shared design tokens + base styles
 *
 * THIS IS THE SOURCE OF TRUTH for the visual system. Every locked
 * wireframe screen from #14 onwards imports this file. Edit here
 * = updates everywhere.
 *
 * Aesthetic: flat surfaces, 0.5px borders, generous whitespace,
 * restrained colour. Sentence case throughout. Two weights only
 * (400, 500). Slight cool tint on the page bg, white card surfaces,
 * subtle borders for definition. Medworx red is the brand accent —
 * used selectively for primary actions, section dividers, active
 * tab underlines, and focus states; not for hover states, body
 * links, or hover row tints.
 *
 * ── Status (Phase 2C, session 41) ──
 * This file is the locked starting reference for the Rails build.
 * Palette, type, spacing, radii, and primitives carry forward.
 * Components (Rails partials/ViewComponents), Tailwind-vs-plain-CSS
 * choice, and detailed responsive rules emerge during build — they
 * are not pre-specified here. The first few production screens are
 * expected to refine, not replace, what this file encodes.
 *
 * ── Earlier note retained for context ──
 * Screen #13 was drawn under an earlier one-off layered/serif
 * variant (Fraunces + shadow stack) before this stylesheet was
 * extracted. Locked as-is, not the canon. Dental and DHB screens
 * drawn before this file existed are also locked as-is, no
 * back-fill.
 * ════════════════════════════════════════════════════════════════ */

:root {
  /* Backgrounds — light, restrained, slight cool tint */
  --bg-page: #fcfcfd;             /* page bg, near-white with cool tint */
  --bg-primary: #ffffff;          /* card surfaces */
  --bg-secondary: #f4f5f7;        /* hover, secondary surfaces */
  --bg-muted: #eaebef;             /* metric cards, dim sections */
  --bg-info: #eef4fb;              /* info callout */
  --bg-info-strong: #d9e7f7;       /* info hover */
  --bg-success: #ecf3df;           /* status pills stay warm — friendly data-point feel */
  --bg-warning: #fbf1de;
  --bg-danger: #fceaea;

  /* Text — neutral near-black, no warm undertone */
  --text-primary: #16171c;
  --text-secondary: #6c6d75;
  --text-tertiary: #9999a1;
  --text-info: #1559a0;
  --text-info-dark: #0c447c;
  --text-success: #3a6c10;
  --text-warning: #82500c;
  --text-danger: #9d2c2c;

  /* Brand — Medworx red. Used selectively: primary actions,
     section dividers, active tab underline, focus states, brand
     wordmark. NOT used for body links, row hover, status pills,
     or general icons. */
  --brand-red: #CC1F26;
  --brand-red-dark: #a81a20;
  --brand-red-tint: #fdecea;       /* very faint pink, for soft hover/active surfaces only */

  /* Borders — 0.5px tertiary is the default, almost invisible */
  --border-tertiary: rgba(22, 23, 28, 0.12);
  --border-secondary: rgba(22, 23, 28, 0.22);
  --border-primary: rgba(22, 23, 28, 0.35);
  --border-info: #b9d2ee;
  --border-warning: #ecc784;
  --border-danger: #e9b6b6;

  /* Layout */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  /* Type */
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg-page);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--text-info); text-decoration: none; }
a:hover { text-decoration: underline; }

.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 32px 64px;
}

/* ────────────────────────────────────────────────
   Header bar
   ──────────────────────────────────────────────── */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: var(--bg-primary);
  border: 0.5px solid var(--border-tertiary);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}
.app-header .brand {
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.005em;
}
.app-header .user {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ────────────────────────────────────────────────
   Wireframe banner — small, dashed, aside
   ──────────────────────────────────────────────── */
.wf-banner {
  background: transparent;
  border: 0.5px dashed var(--border-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 20px;
  text-align: center;
  letter-spacing: 0.01em;
}
.wf-banner a { color: var(--text-tertiary); }

/* ────────────────────────────────────────────────
   Breadcrumb
   ──────────────────────────────────────────────── */
.crumb {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.crumb a { color: var(--text-secondary); }
.crumb a:hover { color: var(--text-primary); }

/* Type pill (client type tag inside breadcrumb) */
.type-pill {
  display: inline-block;
  background: var(--bg-info);
  color: var(--text-info-dark);
  padding: 1px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 500;
  margin-left: 4px;
  vertical-align: 1px;
}

/* ────────────────────────────────────────────────
   Page title
   ──────────────────────────────────────────────── */
.page-title {
  font-size: 24px;
  font-weight: 500;
  margin: 0 0 4px;
  letter-spacing: -0.012em;
  line-height: 1.2;
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 20px;
}

/* ────────────────────────────────────────────────
   Workflow call-out (Begin testing day, etc.)
   ──────────────────────────────────────────────── */
.callout-action {
  background: var(--bg-info);
  border: 0.5px solid var(--border-info);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.callout-action .label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-info-dark);
  margin: 0 0 3px;
}
.callout-action .meta {
  font-size: 13px;
  color: var(--text-info);
  margin: 0;
}
.callout-action button.primary {
  background: var(--text-info);
  color: white;
  border: none;
  padding: 9px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  height: auto;
  letter-spacing: 0.005em;
}
.callout-action button.primary:hover { background: var(--text-info-dark); }

/* ────────────────────────────────────────────────
   Notes block (yellow callout)
   ──────────────────────────────────────────────── */
.notes-block {
  background: var(--bg-warning);
  border: 0.5px solid var(--border-warning);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  margin-bottom: 20px;
}
.notes-block .label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-warning);
  margin: 0 0 2px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.notes-block .body {
  font-size: 13px;
  color: var(--text-warning);
  margin: 0;
  line-height: 1.5;
}
.notes-block .body a { color: var(--text-warning); margin-left: 8px; text-decoration: underline; }

/* ────────────────────────────────────────────────
   Tab bar
   ──────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 0.5px solid var(--border-tertiary);
  margin-bottom: 18px;
}
.tabs .tab {
  padding: 10px 18px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -0.5px;
  text-decoration: none;
  transition: color 80ms ease;
}
.tabs .tab.active {
  color: var(--text-info);
  border-bottom-color: var(--text-info);
  font-weight: 500;
}
.tabs .tab:hover:not(.active) {
  color: var(--text-primary);
}

/* ────────────────────────────────────────────────
   Form controls
   ──────────────────────────────────────────────── */
input[type="text"], input[type="search"], input[type="email"], input[type="number"],
textarea, select {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 12px;
  border: 0.5px solid var(--border-secondary);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  height: 36px;
  outline: none;
  transition: border-color 80ms ease, box-shadow 80ms ease;
}
input[type="search"]::placeholder { color: var(--text-tertiary); }
input:focus, textarea:focus, select:focus {
  border-color: var(--text-info);
  box-shadow: 0 0 0 3px var(--bg-info-strong);
}
textarea { height: auto; min-height: 64px; }

button {
  font-family: inherit;
  font-size: 14px;
  padding: 0 16px;
  border: 0.5px solid var(--border-secondary);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  height: 36px;
  font-weight: 400;
  transition: background 80ms ease, transform 80ms ease;
}
button:hover { background: var(--bg-secondary); }
button:active { transform: scale(0.985); }

/* ────────────────────────────────────────────────
   Toolbar (search + add new)
   ──────────────────────────────────────────────── */
.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}
.toolbar input { flex: 1; }

/* ────────────────────────────────────────────────
   Section headers (small caps grey labels above lists)
   ──────────────────────────────────────────────── */
.section-header {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0 0 10px;
  font-weight: 500;
}
.section-header + .asset-group { margin-top: 0; }

/* ────────────────────────────────────────────────
   Asset group <details> blocks
   ──────────────────────────────────────────────── */
.asset-group {
  border: 0.5px solid var(--border-tertiary);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  background: var(--bg-primary);
  margin-bottom: 6px;
  transition: border-color 80ms ease;
}
.asset-group:hover { border-color: var(--border-secondary); }
.asset-group[open] { padding-bottom: 14px; }

.asset-group > summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
  user-select: none;
  padding: 2px 0;
}
.asset-group > summary::-webkit-details-marker { display: none; }
.asset-group > summary::after {
  content: "›";
  color: var(--text-tertiary);
  font-size: 18px;
  margin-left: 8px;
  font-weight: 300;
  transition: transform 120ms ease;
  display: inline-block;
}
.asset-group[open] > summary::after {
  transform: rotate(90deg);
}
.asset-group .count {
  color: var(--text-secondary);
  font-weight: 400;
  margin-left: 6px;
}
.asset-group .meta {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
  margin-right: 12px;
}

/* Retired group — styled to look quieter */
.asset-group.retired {
  background: transparent;
  border-style: dashed;
  margin-top: 18px;
}
.asset-group.retired > summary {
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 13px;
}

/* ────────────────────────────────────────────────
   Asset table inside an open group
   ──────────────────────────────────────────────── */
.asset-table {
  width: 100%;
  margin-top: 14px;
  font-size: 13px;
  border-collapse: collapse;
}
.asset-table thead tr {
  color: var(--text-tertiary);
  border-bottom: 0.5px solid var(--border-tertiary);
}
.asset-table th {
  text-align: left;
  padding: 8px 10px;
  font-weight: 400;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.asset-table tbody tr {
  border-bottom: 0.5px solid var(--border-tertiary);
  cursor: pointer;
  transition: background 80ms ease;
}
.asset-table tbody tr:last-child { border-bottom: none; }
.asset-table tbody tr:hover { background: var(--bg-secondary); }
.asset-table td { padding: 9px 10px; }
.asset-table .num { font-variant-numeric: tabular-nums; font-weight: 500; }
.asset-table .pass { color: var(--text-success); font-weight: 500; }
.asset-table .fail { color: var(--text-danger); font-weight: 500; }
.asset-table .dim { color: var(--text-tertiary); font-style: italic; }

/* ────────────────────────────────────────────────
   Status pills
   ──────────────────────────────────────────────── */
.status {
  display: inline-block;
  font-size: 11px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.status-active   { background: var(--bg-success); color: var(--text-success); }
.status-notfound { background: var(--bg-warning); color: var(--text-warning); }
.status-niau     { background: var(--bg-warning); color: var(--text-warning); }
.status-retired  { background: var(--bg-muted);   color: var(--text-tertiary); }

/* ────────────────────────────────────────────────
   Footer actions row
   ──────────────────────────────────────────────── */
.footer-actions {
  margin-top: 28px;
  display: flex;
  gap: 8px;
  padding-top: 18px;
  border-top: 0.5px solid var(--border-tertiary);
}

