/* Consultant Allocation: Fulcrum Care brand styles. Self-contained: system fonts only,
   no external files, no inline styles (the CSP allows only this file).
   Brand: teal #002D3F, pink #E81D58, light grey #F2F2F2, white #FFFFFF.
   --pink-text is a darker pink for small text: #E81D58 on white is 4.4:1, just under
   the 4.5:1 that WCAG asks for normal-size text. */
:root {
  --teal: #002D3F;
  --pink: #E81D58;
  --grey: #F2F2F2;
  --white: #FFFFFF;

  --bg: var(--grey);
  --card: var(--white);
  --text: #102530;
  --muted: #55656D;
  --heading: var(--teal);
  --border: #DCE1E4;
  --row-alt: #FAFAFA;
  --head-bg: var(--grey);
  --link: var(--teal);
  --button-bg: var(--teal);
  --button-text: var(--white);
  --pink-text: #B8113F;
  --flag-bg: #FDECF1;
  --ok-bg: #E6F0F3;
  --error-bg: #FDECF1;
  --error-text: #8C0C30;
  --focus: var(--pink);
  --shadow: 0 1px 2px rgba(0, 45, 63, 0.06), 0 2px 8px rgba(0, 45, 63, 0.05);
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #001B26;
    --card: #002D3F;
    --text: #EEF3F5;
    --muted: #A9BAC2;
    --heading: var(--white);
    --border: #164556;
    --row-alt: #00324A;
    --head-bg: #00384F;
    --link: #FFFFFF;
    --button-bg: var(--pink);
    --button-text: var(--white);
    --pink-text: #FF7FA0;
    --flag-bg: #3D1426;
    --ok-bg: #0A3B4F;
    --error-bg: #3D1426;
    --error-text: #FFB3C6;
    --shadow: none;
  }
}

/* --- base ---------------------------------------------------------------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--pink-text); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { color: var(--heading); line-height: 1.25; }
h1 { font-size: 1.6rem; margin: 0 0 0.75rem; font-weight: 700; }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; font-weight: 700; }
h3 { font-size: 1rem; margin: 1.5rem 0 0.4rem; font-weight: 700; }
p { margin: 0 0 0.9rem; }
.muted { color: var(--muted); }

/* --- header -------------------------------------------------------------- */
header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  padding: 0.8rem 1.25rem;
  background: var(--teal);
  color: var(--white);
  border-bottom: 4px solid var(--pink);
}
.brand { display: flex; align-items: center; gap: 0.6rem; margin-right: auto; font-weight: 600; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2rem; height: 2rem; border-radius: 8px;
  background: var(--pink); color: var(--white); font-weight: 800; font-size: 0.9rem; letter-spacing: 0.02em;
}
.brand-name { color: var(--white); }
.brand-sub { color: #BFD0D8; font-weight: 500; }
header nav { display: flex; gap: 0.25rem; }
header nav a {
  color: var(--white); text-decoration: none; font-weight: 600;
  padding: 0.35rem 0.7rem; border-radius: 6px;
}
header nav a:hover { color: var(--white); background: rgba(255, 255, 255, 0.12); }
.account { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 1rem; }
.who { color: #BFD0D8; }
/* 2 Dec: the Guest login's label in the header (on the teal header in both themes). */
.read-only {
  display: inline-block; padding: 0 0.5rem; border-radius: 999px; font-size: 0.8rem; font-weight: 700;
  line-height: 1.6; color: var(--teal); background: var(--white); white-space: nowrap;
}
.account a { color: var(--white); font-weight: 600; text-underline-offset: 3px; }
.account a:hover { color: var(--white); text-decoration-color: var(--pink); }
header button.link { color: var(--white); }
header button.link:hover { color: var(--white); text-decoration-color: var(--pink); }

/* --- layout -------------------------------------------------------------- */
main {
  max-width: 30rem;
  margin: 2rem auto;
  padding: 0 1rem;
}
main.wide { max-width: 72rem; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.35rem;
  margin: 0 0 1.25rem;
}
.card > :last-child { margin-bottom: 0; }
.page-head { margin: 0 0 1.25rem; }
.page-head h1 { margin-bottom: 0.35rem; }
.page-head p { margin: 0; }
.back { margin: 1.5rem 0 0; }
.back a { font-weight: 600; }
.back a::before { content: "\2190\00a0"; }
.links { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.links a {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.85rem 1rem; border: 1px solid var(--border); border-radius: 8px;
  text-decoration: none; font-weight: 600; background: var(--card);
}
.links a:hover { border-color: var(--teal); color: var(--link); }
.links a::after { content: "\203A"; font-size: 1.3rem; line-height: 1; color: var(--muted); }

/* --- forms --------------------------------------------------------------- */
label { display: block; margin: 0 0 1rem; font-weight: 600; color: var(--heading); }
input[type="email"], input[type="password"] {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.7rem 0.8rem;
  font: inherit;
  font-weight: 400;
  color: var(--text);
  background: var(--card);
  border: 1px solid #B9C3C8;
  border-radius: 8px;
}
input[type="email"]:focus, input[type="password"]:focus { border-color: var(--teal); }
button {
  padding: 0.7rem 1.3rem;
  min-height: 2.75rem;
  font: inherit;
  font-weight: 700;
  color: var(--button-text);
  background: var(--button-bg);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}
button:hover { filter: brightness(1.15); }
form > button[type="submit"] { width: 100%; margin-top: 0.25rem; }
button.link {
  min-height: 0;
  padding: 0;
  color: var(--link);
  background: none;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
button.link:hover { filter: none; }
form.inline { display: inline; margin: 0; }
.auth { margin-top: 3rem; }
.auth .card { padding: 1.75rem 1.5rem; }
.auth h1 { text-align: left; }

/* --- messages ------------------------------------------------------------ */
.error {
  padding: 0.75rem 0.9rem;
  color: var(--error-text);
  background: var(--error-bg);
  border-left: 4px solid var(--pink);
  border-radius: 6px;
}
.flag { color: var(--pink-text); }
.notice {
  padding: 0.8rem 1rem;
  border-radius: 8px;
  border-left: 4px solid var(--pink);
  background: var(--flag-bg);
  color: var(--text);
}
.notice.flag { color: var(--text); }
.notice.flag strong, .notice strong { color: var(--pink-text); }
.notice.info { border-left-color: var(--teal); background: var(--ok-bg); }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.75rem; padding: 0; list-style: none; }
.chip {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  background: var(--flag-bg);
  color: var(--pink-text);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
}
.badge {
  display: inline-block;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  background: var(--ok-bg);
  color: var(--heading);
  white-space: nowrap;
}
.badge.warn { background: var(--flag-bg); color: var(--pink-text); }

/* "Working…": a calm spinner, CSS only; still when the user asks for less motion. */
.working {
  display: flex; align-items: flex-start; gap: 0.8rem;
  padding: 0.9rem 1rem; border-radius: 8px;
  background: var(--ok-bg); border-left: 4px solid var(--teal);
}
.working::before {
  content: ""; flex: none; width: 1.1rem; height: 1.1rem; margin-top: 0.2rem;
  border: 3px solid var(--border); border-top-color: var(--pink); border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .working::before { animation: none; } }

/* --- tables -------------------------------------------------------------- */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 0 0 1rem;
}
table { width: 100%; border-collapse: collapse; background: var(--card); }
.table-wrap table { min-width: 40rem; }
th, td { padding: 0.65rem 0.8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
thead th {
  background: var(--head-bg);
  color: var(--heading);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
tbody tr:nth-child(even) { background: var(--row-alt); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--ok-bg); }
tr.needs td:first-child { box-shadow: inset 4px 0 0 var(--pink); }
td a { font-weight: 700; }
td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* --- Requests list ------------------------------------------------------- */
.summary { font-size: 1.1rem; font-weight: 600; color: var(--heading); margin: 0 0 0.25rem; }
.summary .sep { color: var(--muted); margin: 0 0.35rem; }
.ok-text { color: var(--muted); font-weight: 600; }
.small { font-size: 0.875rem; }
table.rows td { padding-top: 0.95rem; padding-bottom: 0.95rem; vertical-align: middle; }
table.rows .home { display: block; font-weight: 600; color: var(--heading); }
table.rows .sub { display: block; margin-top: 0.15rem; font-size: 0.875rem; color: var(--muted); }
table.rows td.days { font-size: 1.15rem; font-weight: 700; color: var(--heading); font-variant-numeric: tabular-nums; }
.need-label { display: block; font-weight: 700; color: var(--pink-text); }
.reasons { display: block; margin-top: 0.15rem; font-size: 0.875rem; }
.badge.source { background: transparent; border: 1px solid var(--border); color: var(--muted); font-weight: 600; }
.badge.complete { background: var(--ok-bg); color: var(--heading); }

/* Whole-row link without a script (the CSP allows none): the job number's link is stretched over its
   row, so a click anywhere on the row (or card) opens the job. The job number stays a real link, so
   keyboard users tab to it and press Enter; the whole row shows the focus ring. */
table.rows tbody tr { position: relative; }
a.row-link::after { content: ""; position: absolute; inset: 0; }
a.row-link:focus-visible { outline: none; }
table.rows tbody tr:hover { background: var(--ok-bg); cursor: pointer; }
table.rows tbody tr:focus-within { outline: 3px solid var(--focus); outline-offset: -3px; }
table.rows tbody tr:focus-within td { background: var(--ok-bg); }

/* Job facts: label / value pairs, two pairs a row; one pair a row on a phone. */
/* --- step 10: the "Missing information" box and the "Ops" marker ----------- */
.ops-mark {
  display: inline-block; margin-left: 0.3rem; padding: 0 0.45rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; line-height: 1.5; letter-spacing: 0.02em; vertical-align: 0.05em;
  color: var(--heading); background: var(--ok-bg); border: 1px solid var(--teal); white-space: nowrap;
}
.inputs-box { border-top: 4px solid var(--teal); }
.inputs-box .error ul { margin: 0.4rem 0 0; padding-left: 1.2rem; }
.input-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 0.25rem 1rem; margin: 0.75rem 0 0.5rem; }
.input-field label { margin: 0 0 0.35rem; }
.input-field input, .input-field select {
  display: block; width: 100%; min-height: 2.75rem; padding: 0.6rem 0.75rem;
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid #B9C3C8; border-radius: 8px;
}
.input-field input:focus, .input-field select:focus { border-color: var(--teal); }
.input-field .hint { margin: 0.3rem 0 0.75rem; color: var(--muted); font-size: 0.85rem; }
form.inputs > button[type="submit"] { width: auto; min-width: 9rem; }

table.facts { width: 100%; margin: 0; background: none; }
table.facts th {
  width: 9rem; padding: 0.45rem 0.75rem 0.45rem 0;
  color: var(--muted); font-weight: 600; font-size: 0.9rem; background: none;
  text-transform: none; letter-spacing: 0;
}
table.facts td { padding: 0.45rem 1.5rem 0.45rem 0; }
table.facts tr:nth-child(even), table.facts tr:hover { background: none; }
table.facts tr:last-child th, table.facts tr:last-child td { border-bottom: 0; }

/* --- phone ----------------------------------------------------------------- */
@media (max-width: 40rem) {
  header { padding: 0.7rem 1rem; gap: 0.35rem 0.75rem; }
  .brand { flex-basis: 100%; }
  .brand-sub, .who { display: none; }
  .account { gap: 0.35rem 0.9rem; }
  header nav { margin-left: -0.7rem; margin-right: auto; }
  main { margin: 1.25rem auto; }
  h1 { font-size: 1.35rem; }
  .card { padding: 1rem; }
  .auth { margin-top: 1.5rem; }
  table.facts, table.facts tbody { display: block; }
  table.facts tr { display: grid; grid-template-columns: 8rem 1fr; border-bottom: 1px solid var(--border); }
  table.facts tr:last-child { border-bottom: 0; }
  table.facts th, table.facts td { border-bottom: 0; padding-right: 0.5rem; }
  table.facts th:empty, table.facts th:empty + td:empty { display: none; }
  form.inputs > button[type="submit"] { width: 100%; }

  /* Tables marked "stack": one small labelled card per row (labels from data-label). */
  .table-wrap.stack-wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
  table.stack { min-width: 0; background: none; }
  table.stack thead {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; }
  table.stack tr {
    background: var(--card); border: 1px solid var(--border); border-radius: 8px;
    margin: 0 0 0.6rem; padding: 0.35rem 0;
  }
  table.stack tbody tr:nth-child(even), table.stack tbody tr:hover { background: var(--card); }
  table.stack tr.needs { border-left: 4px solid var(--pink); }
  table.stack tr.needs td:first-child { box-shadow: none; }
  table.stack td {
    display: grid; grid-template-columns: 7.5rem 1fr; gap: 0.5rem;
    padding: 0.3rem 0.85rem; border-bottom: 0;
  }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 0.85rem; font-weight: 600; }
  table.stack td > .badge { justify-self: start; align-self: start; }
  table.rows td { padding-top: 0.3rem; padding-bottom: 0.3rem; vertical-align: top; }
  table.rows tbody tr { padding: 0.5rem 0; }
  table.rows tbody tr:focus-within { outline-offset: 0; }
}

@media print {
  header nav, header form, .back { display: none; }
  body { background: #fff; }
  .card, .table-wrap { box-shadow: none; }
}
