/* thePHO palette (brand/README.md). Light only, declared as such, so browsers in
   dark mode don't restyle form controls into white-on-white. */
:root {
  color-scheme: light;
  --plum: #c23d41;
  --plum-dark: #9e2f33;
  --hibiscus: #ed696e;
  --marigold: #f6aa01;
  --dusk: #fad1d4;
  --nimbus: #e3e1e0;
  --onyx: #3c3c3b;
  --muted: #6b6a69;
  --bg: #f7f6f5;
  --card: #ffffff;
  --bad: #a4262c;
  --bad-bg: #fdecec;
  --warn-bg: #fff4d6;
  --ok: #1e6b3a;
  --ok-bg: #e5f4ea;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--onyx);
  font-family: "Source Sans 3", "Source Sans Pro", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.45;
}
a { color: var(--plum); }
a:hover { color: var(--plum-dark); }
h1 { font-size: 1.6rem; margin: 0 0 .5rem; line-height: 1.2; }
h2 { font-size: 1.1rem; margin: 0 0 .5rem; }
.wrap { max-width: 1400px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.eyebrow { margin: 0; color: var(--muted); font-size: .9rem; }

.top { background: var(--card); border-bottom: 1px solid var(--nimbus); margin-bottom: 24px; }
.top-inner { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand img { display: block; height: 36px; width: auto; }
.top-title { color: var(--muted); }
.top-out { margin-left: auto; }
.foot { color: var(--muted); font-size: .9rem; padding-top: 24px; padding-bottom: 32px; }

.card { background: var(--card); border: 1px solid var(--nimbus); border-radius: 8px; padding: 20px 24px; margin-bottom: 20px; }
.narrow { max-width: 560px; }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }

label { display: block; font-weight: 600; margin: 12px 0 4px; }
input, select, textarea {
  font: inherit; color: inherit; background: #fff;
  border: 1px solid #b9b7b5; border-radius: 4px; padding: 6px 8px; max-width: 100%;
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid var(--dusk); outline-offset: 1px; border-color: var(--plum); }
input[type=email] { width: 100%; }
input.code { font-size: 1.5rem; letter-spacing: .3em; width: 9em; }
textarea { width: 100%; max-width: 720px; }
.hint { color: var(--muted); font-size: .9rem; margin: 4px 0 16px; }

button, .button {
  font: inherit; cursor: pointer; border-radius: 4px; padding: 8px 16px;
  border: 1px solid transparent; text-decoration: none; display: inline-block;
}
button.primary { background: var(--plum); color: #fff; }
button.primary:hover { background: var(--plum-dark); }
button.secondary, .button.secondary { background: #fff; color: var(--plum); border-color: var(--plum); }
button.secondary:hover, .button.secondary:hover { background: var(--dusk); }
button.link { background: none; border: none; color: var(--plum); padding: 2px 4px; text-decoration: underline; }
button:disabled { opacity: .5; cursor: not-allowed; }
form.inline { display: inline; }

.alert { padding: 10px 14px; border-radius: 4px; margin: 0 0 16px; }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.warn { background: var(--warn-bg); color: #5c3f00; }

.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .85rem; background: var(--nimbus); white-space: nowrap; }
.pill.complete { background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.pill.not-started { background: var(--warn-bg); }
.pill.test { background: #e8e3f5; color: #4b3b7a; font-weight: 600; }
tr.testrow td { background: #f8f6fc; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--card); border: 1px solid var(--nimbus); border-radius: 999px; padding: 3px 12px; font-size: .9rem; }
.chip.warn { background: var(--warn-bg); border-color: var(--marigold); }
.chip.ok { background: var(--ok-bg); border-color: #b8dcc4; }

details.card summary { cursor: pointer; font-weight: 600; }
.key { border-left: 4px solid var(--plum); }
.key ul { margin: 8px 0 12px; padding-left: 20px; }
.key li { margin-bottom: 6px; }
.key p { margin: 8px 0 0; }
.key-sub { font-size: .95rem; margin: 12px 0 6px; }
.key .due { margin: 0 0 8px; color: var(--plum-dark); }
.swatches { list-style: none; margin: 0 0 8px; padding: 0; }
.swatches li { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
/* Sample boxes that look like the table's inputs, with a word inside so they
   still read in high-contrast mode or when the page is copied as text. */
.sw { flex: 0 0 5.5em; display: inline-block; text-align: center; font-size: .8rem;
      padding: 3px 0; border-radius: 4px; border: 1px solid #b9b7b5; background: #fff; color: var(--muted); }
.sw.error { border-color: var(--bad); background: var(--bad-bg); color: var(--bad); }
.sw.warning { border-color: var(--marigold); background: var(--warn-bg); color: #7a5300; }
.sw.expect { border: 1px dashed var(--marigold); }
th.incl-h { white-space: normal; min-width: 8em; max-width: 9em; }
.issues { border-left: 4px solid var(--marigold); }
.issues.attempted { border-color: var(--bad); border-left-width: 4px; }
.issues.attempted h2 { color: var(--bad); }
.issues ul { margin: 0 0 8px; padding-left: 20px; }
.todo li { margin-bottom: 4px; }
.todo a { margin-left: 6px; font-size: .9rem; }

.tablewrap { overflow: auto; max-height: 78vh; background: var(--card); border: 1px solid var(--nimbus); border-radius: 8px; margin-bottom: 12px; }
table.ret thead th { position: sticky; top: 0; z-index: 2; }
th.fac { white-space: normal; min-width: 5.5em; max-width: 8em; color: var(--onyx); background: #f4efe9; }
th.fac .sub { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }
td.hrs { background: #fcfaf7; }
td.hrs.expect input { border-color: var(--marigold); border-style: dashed; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin: 8px 0 10px; }
.tools input[type=search] { width: 16em; }
label.check { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; margin: 0; }
.status { flex: 1 1 100%; margin: 0; font-size: .95rem; }
.status.todo { color: var(--bad); }
.status.clean { color: var(--onyx); }
.status.stale { color: var(--muted); }
.sticky-actions { position: sticky; bottom: 0; background: var(--bg); padding: 10px 0; border-top: 1px solid var(--nimbus); z-index: 3; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; vertical-align: top; padding: 6px 8px; border-bottom: 1px solid var(--nimbus); }
th { font-size: .85rem; color: var(--muted); font-weight: 600; background: #fbfaf9; white-space: nowrap; }
td.r, th.r { text-align: right; }
table.ret td.num { color: var(--muted); font-size: .85rem; padding-top: 12px; }
/* Explicit widths: a select is otherwise as wide as its longest option, and
   "Registered nurse prescribing in primary health and specialty teams" is long. */
.w-role { width: 13em; } .w-loc { width: 4.2em; }
.w-reg { width: 6em; } .w-sur { width: 8.5em; } .w-first { width: 7.5em; }
.w-hrs { width: 4.2em; } .w-incl { width: 7.5em; }
table.ret .tp { display: block; font-size: .8rem; color: var(--muted); margin-top: 2px; }
table.ret td.acts { white-space: nowrap; }
table.ret tr.out td { background: #f3f2f1; }
table.ret tr.out input, table.ret tr.out select:not(.incl) { opacity: .55; }
td.error input, td.error select { border-color: var(--bad); background: var(--bad-bg); }
td.warning input, td.warning select { border-color: var(--marigold); background: var(--warn-bg); }
.msg { display: block; font-size: .8rem; margin-top: 2px; max-width: 16em; }
.msg.error { color: var(--bad); }
.msg.warning { color: #7a5300; }
.badnum { color: var(--bad); font-weight: 600; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 16px 0; }
.admin-box .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.linkbox { width: 100%; font-family: ui-monospace, monospace; font-size: .85rem; }
.contact { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--nimbus); padding: 4px 0; }
.contact-add { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.contact-add input[type=email] { width: auto; flex: 1 1 14em; }
ul.plain { list-style: none; padding: 0; }

.foot p { margin: 0 0 4px; }
.madeby { font-size: .8rem; color: #8a8988; }

/* Phones and narrow windows: tables become one card per row, each field with its
   label (from data-label), so nobody scrolls a wide table sideways on a phone. */
@media (max-width: 760px) {
  .wrap { padding: 0 12px; }
  .top { margin-bottom: 16px; }
  .top-title { display: none; }
  h1 { font-size: 1.35rem; }
  .card { padding: 16px; }
  .head { flex-wrap: wrap; }
  .admin-box .grid2 { grid-template-columns: 1fr; }

  .tablewrap { max-height: none; overflow: visible; border: 0; background: transparent; }
  table.ret thead, table.list thead { display: none; }
  table.ret, table.ret tbody, table.ret tr,
  table.list, table.list tbody, table.list tr { display: block; width: 100%; }
  table.ret tr, table.list tr {
    background: var(--card); border: 1px solid var(--nimbus); border-radius: 8px;
    margin-bottom: 12px; padding: 8px 12px;
  }
  table.ret tr.out { background: #f3f2f1; }
  table.ret td, table.list td {
    display: grid; grid-template-columns: 8.5em minmax(0, 1fr); align-items: center;
    gap: 2px 10px; padding: 5px 0; border: 0; background: none; text-align: left;
  }
  table.ret td::before, table.list td::before {
    content: attr(data-label); font-size: .8rem; font-weight: 600; color: var(--muted);
  }
  table.ret td > *:not(input):not(select), table.list td > * { grid-column: 2; }
  table.ret td input, table.ret td select { width: 100%; max-width: none; }
  table.ret td.hrs input { width: 6em; }
  table.ret td.num { display: block; font-weight: 600; color: var(--onyx); padding-top: 2px; }
  table.ret td.num::before { content: "Row "; font-size: inherit; color: inherit; }
  table.ret td.acts { display: flex; gap: 16px; justify-content: flex-end; }
  table.ret td.acts::before { content: none; }
  td.hrs { background: none; }

  .tools input[type=search] { width: 100%; }
  .sticky-actions button { flex: 1 1 100%; }
  .contact-add input[type=email] { flex: 1 1 100%; }
}
