/* CM/SW Assignment Board
   Fonts: Inter and IBM Plex Mono if present on the host, system faces otherwise.
   Layout is deliberately dense. One screen should hold as much of the sheet as it can. */

:root {
  --ink: #10222c;
  --slate: #3d5b6b;
  --teal: #00747f;
  --cyan: #16b5cf;
  --wash: #eef3f6;
  --panel: #ffffff;
  --line: #d2dfe5;
  --flag: #9a5b00;
  --flag-bg: #fff4e0;
  --live: #0d7a4a;
  --live-bg: #e6f5ee;
  --hit: #fff5b8;
  --sans: Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, "Liberation Mono", monospace;
  --radius: 7px;
  --pad: 9px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.35;
}

a { color: var(--teal); }

.wrap { max-width: 1400px; margin: 0 auto; padding: 0 12px 32px; }

/* Masthead */
.masthead {
  background: linear-gradient(180deg, #12303d 0%, #0d2531 100%);
  color: #fff;
  border-bottom: 3px solid var(--cyan);
}
.masthead .wrap { padding-top: 8px; padding-bottom: 8px; }
.mast-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.org {
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--cyan); font-weight: 600;
}
.mast-title { font-size: 18px; font-weight: 700; margin: 0; letter-spacing: -.01em; line-height: 1.2; }
.mast-date { font-size: 14px; color: #cfe3ea; margin-left: auto; }
.mast-sub { font-size: 12px; color: #a9c4ce; margin-top: 1px; }

.badge {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .07em;
  text-transform: uppercase; padding: 2px 6px; border-radius: 999px;
}
.badge-live { background: var(--live-bg); color: var(--live); }
.badge-draft { background: var(--flag-bg); color: var(--flag); }

/* View state: today's posted board is the plain white one. Anything else is tinted,
   so a screenshot or a left-open tab is recognizable at a glance. */
body.view-past   { --wash: #f2eee6; --edge: #8a6d3b; --panel: #fffdf9; }
body.view-future { --wash: #e9f0f8; --edge: #2b6ca8; --panel: #fbfdff; }
body.view-draft  { --wash: #fdf2e0; --edge: #9a5b00; --panel: #fffdf7; }
body.view-past .masthead, body.view-future .masthead, body.view-draft .masthead {
  border-bottom-color: var(--edge);
}
body.view-draft .masthead { background: linear-gradient(180deg, #33291a 0%, #221a10 100%); }
body.view-past .masthead  { background: linear-gradient(180deg, #2e2b25 0%, #201e1a 100%); }
body.view-future .masthead { background: linear-gradient(180deg, #16303f 0%, #102633 100%); }
body.view-past .rowlabel, body.view-future .rowlabel, body.view-draft .rowlabel {
  border-left-color: var(--edge);
}

.state-bar { background: var(--edge); color: #fff; }
.state-bar .wrap {
  padding: 4px 12px; font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 4px 10px;
  align-items: baseline;
}
.state-bar strong { letter-spacing: .04em; text-transform: uppercase; font-size: 11.5px; }
.state-bar a { color: #fff; }

/* Controls */
.toolbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.toolbar .wrap { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px 12px; }
.search {
  flex: 1 1 220px; min-width: 0;
  font: 15px/1.2 var(--sans); color: var(--ink);
  padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff;
}
.search:focus { outline: 3px solid rgba(22,181,207,.35); outline-offset: 1px; border-color: var(--cyan); }
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  font: 600 13px var(--sans); color: var(--ink); text-decoration: none;
  padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--teal); color: var(--teal); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: #005f68; color: #fff; }
.btn-danger { border-color: #d8b0b0; color: #9a1c1c; }
.btn:focus-visible, .chip:focus-visible, a:focus-visible { outline: 3px solid rgba(22,181,207,.5); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 4px; padding: 7px 0 0; }
.chip {
  font: 600 12px var(--sans); color: var(--slate);
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line);
  background: #fff; cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Sections */
.section { margin-top: 14px; }
.section-head { display: flex; align-items: baseline; gap: 9px; margin-bottom: 4px; }
.section-head h2 { font-size: 13px; margin: 0; letter-spacing: .06em; text-transform: uppercase; }
.section-head .hint { font-size: 11.5px; color: var(--slate); }

.grid { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.grid-head, .row {
  display: grid;
  grid-template-columns: minmax(140px, .62fr) repeat(var(--cols, 1), minmax(0, 1fr));
}
.grid-head {
  background: var(--ink); color: #cfe3ea;
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; font-weight: 600;
}
.grid-head div { padding: 4px var(--pad); }
.row { border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; }
.row:nth-child(even) { background: #f7fafb; }
.row.hide { display: none; }
.row.hit { background: var(--hit); }

.cell { padding: 4px var(--pad); min-width: 0; }
.cell + .cell { border-left: 1px solid var(--line); }
.rowlabel { border-left: 3px solid var(--cyan); }
.rowlabel .label { font-weight: 700; }
.rowlabel .sublabel { font-size: 11.5px; color: var(--slate); }
.who { font-weight: 600; }
.who.empty { color: #96a9b3; font-weight: 500; font-style: italic; }
.tel {
  font: 500 13px var(--mono); letter-spacing: -.02em;
  color: var(--teal); text-decoration: none; white-space: nowrap;
}
.tel:hover { color: #005f68; text-decoration: underline; }
.note { font-size: 11.5px; color: var(--slate); }
.slot-label { display: none; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--slate); }

/* Name and number share one line wherever there is room. */
.person { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 8px; }

/* Single-column sections (social work, support, UM) flow into several columns
   instead of one tall list. */
.grid-dense {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  background: var(--panel); border: 1px solid var(--line);
}
.grid-dense .row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  background: var(--panel); padding: 4px 9px;
  border-top: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.grid-dense .row:nth-child(even) { background: var(--panel); }
.grid-dense .row.hit { background: var(--hit); }
.grid-dense .cell, .grid-dense .rowlabel { padding: 0; border: 0; }
/* Both sides can shrink, so a long payer list never pushes a name off the row. */
.grid-dense .rowlabel { flex: 1 1 auto; min-width: 0; }
.grid-dense .rowlabel .label { display: inline; }
.grid-dense .rowlabel .sublabel { display: inline; margin-left: 4px; }
.grid-dense .cell:last-child { flex: 0 1 auto; min-width: 0; text-align: right; }
.grid-dense .person { justify-content: flex-end; }
.grid-dense .who { white-space: nowrap; }
/* An instruction such as "Contact the team case management specialist" is not a name and
   must wrap, otherwise it pushes the row label out of its own cell. */
.who-long { white-space: normal; overflow-wrap: anywhere; }
.grid-dense .who-long { white-space: normal; }
.grid-dense .note { flex: 1 0 100%; text-align: right; }

/* Notices */
.notice {
  margin-top: 10px; padding: 7px var(--pad); border-radius: var(--radius);
  background: var(--flag-bg); border: 1px solid #f0d9ac; color: #6b3f00; font-size: 13.5px;
}
.changes { margin-top: 14px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px var(--pad); }
.changes h3 { margin: 0 0 4px; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--slate); }
.changes ul { margin: 0; padding-left: 16px; columns: 2; column-gap: 24px; }
.changes li { font-size: 13px; break-inside: avoid; }
.changes .from { color: var(--slate); text-decoration: line-through; }
.empty-state { background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--slate); }
.foot { margin-top: 16px; font-size: 12px; color: var(--slate); display: flex; flex-wrap: wrap; gap: 10px; }
.count-note { font-size: 12px; color: var(--slate); min-height: 16px; }

/* Forms and admin */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-top: 12px; }
.card h2 { margin: 0 0 6px; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; }
label.field { display: block; margin: 8px 0 0; font-size: 12px; font-weight: 600; color: var(--slate); }
input[type=text], input[type=password], input[type=date], input[type=tel], select, textarea {
  width: 100%; font: 14px var(--sans); color: var(--ink);
  padding: 5px 8px; margin-top: 2px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
}
textarea { min-height: 52px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(22,181,207,.3); border-color: var(--cyan); }
.inline { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-end; }
.inline > * { flex: 1 1 150px; }
.inline > .btn { flex: 0 0 auto; }
.actions { margin-top: 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.msg { padding: 7px 10px; border-radius: 6px; margin-top: 10px; font-size: 13.5px; }
.msg-ok { background: var(--live-bg); color: #0a5c38; }
.msg-err { background: #fdeaea; color: #8d1a1a; }

table.data { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: 13.5px; }
table.data th, table.data td { text-align: left; padding: 3px 6px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--slate); }
table.data tr:hover td { background: #f7fafb; }
table.data input, table.data select { margin-top: 0; }

.nav { background: var(--ink); }
.nav .wrap { display: flex; flex-wrap: wrap; gap: 2px; padding: 0 12px; }
.nav a { color: #b7cfd9; text-decoration: none; font-size: 13px; font-weight: 600; padding: 8px 10px; }
.nav a:hover { color: #fff; }
.nav a.on { color: #fff; box-shadow: inset 0 -3px 0 var(--cyan); }
.nav .right { margin-left: auto; display: flex; }

/* PDF import: drop area and progress steps */
.dropzone {
  display: block; position: relative; cursor: pointer;
  border: 2px dashed var(--line); border-radius: var(--radius);
  background: #fbfdfe; padding: 22px 16px; text-align: center; margin-top: 10px;
}
.dropzone:hover, .dropzone.over { border-color: var(--teal); background: #f2fafb; }
.dropzone.over { border-style: solid; }
.dropzone.bad { border-color: #d8b0b0; background: #fdf6f6; }
.dropzone input[type=file] {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer;
}
.dropzone strong { display: block; font-size: 15px; }
.dropzone .dz-sub { display: block; font-size: 12.5px; color: var(--slate); margin-top: 2px; }

.steps { list-style: none; margin: 12px 0 0; padding: 0; }
.steps li {
  display: flex; align-items: baseline; gap: 9px;
  padding: 6px 0; font-size: 14px; color: #9bacb5;
  border-top: 1px solid var(--line);
}
.steps li:first-child { border-top: 0; }
.steps li.active, .steps li.done, .steps li.failed { color: var(--ink); }
.steps .mark {
  flex: 0 0 auto; width: 13px; height: 13px; border-radius: 50%;
  border: 2px solid var(--line); align-self: center;
}
.steps li.active .mark { border-color: var(--teal); border-top-color: transparent; animation: spin .8s linear infinite; }
.steps li.done .mark { border-color: var(--live); background: var(--live); }
.steps li.failed .mark { border-color: #9a1c1c; background: #9a1c1c; }
.steps .what { flex: 0 1 auto; }
.steps .detail { margin-left: auto; font: 500 12.5px var(--mono); color: var(--slate); }
@keyframes spin { to { transform: rotate(360deg); } }

/* A save control that stays in reach on long forms, and one above the list so that
   pressing Enter in a field triggers a save rather than whatever destructive button
   happens to come first in the markup. */
.formbar, .savebar {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 8px 12px; margin-top: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
}
.savebar {
  position: sticky; bottom: 8px; z-index: 15;
  box-shadow: 0 3px 14px rgba(16, 34, 44, .13);
}
.formbar .hint, .savebar .hint { font-size: 12.5px; color: var(--slate); margin-left: auto; }

/* Board editor */
.editrow {
  display: grid; grid-template-columns: minmax(130px, 200px) 1fr; gap: 10px; align-items: start;
  padding: 5px 0; border-top: 1px solid var(--line);
}
.editrow:first-of-type { border-top: 0; }
.slotbox { display: grid; grid-template-columns: 165px 1fr 130px 1fr; gap: 5px; align-items: center; margin-bottom: 4px; }
.slotbox .slotname { display: none; }

@media (max-width: 900px) {
  .slotbox { grid-template-columns: 1fr 1fr; }
  .slotbox .slotname { display: block; grid-column: 1 / -1; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--slate); }
  .editrow { grid-template-columns: 1fr; }
}

/* Narrow screens: the two-slot grid becomes stacked cards */
@media (max-width: 760px) {
  .grid-head { display: none; }
  .grid:not(.grid-dense) { background: transparent; border: 0; }
  .grid:not(.grid-dense) .row {
    display: block; background: var(--panel); border: 1px solid var(--line);
    border-radius: var(--radius); margin-bottom: 6px;
  }
  .grid:not(.grid-dense) .row:nth-child(even) { background: var(--panel); }
  .grid:not(.grid-dense) .row.hit { background: var(--hit); }
  .grid:not(.grid-dense) .cell + .cell { border-left: 0; border-top: 1px solid #e8eff2; }
  .grid:not(.grid-dense) .rowlabel { border-left: 0; border-top: 3px solid var(--cyan); }
  .grid:not(.grid-dense) .slot-label { display: block; }
  /* Slot name on the left, person on the right, so a team is two short lines. */
  .grid:not(.grid-dense) .cell:not(.rowlabel) {
    display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  }
  .grid:not(.grid-dense) .slot-label { flex: 0 0 auto; margin: 0; }
  .grid:not(.grid-dense) .person { justify-content: flex-end; text-align: right; }
  .tel { font-size: 14px; }
  .mast-date { margin-left: 0; width: 100%; }
  .changes ul { columns: 1; }
}

@media print {
  body { background: #fff; font-size: 9px; }
  .toolbar, .nav, .chips, .foot, .btn, .changes, .count-note,
  .formbar, .savebar { display: none !important; }
  /* A printed draft or an old board has to say so on paper too. */
  .state-bar { background: #fff; color: #000; border: 2px solid #000; margin-bottom: 6px; }
  .state-bar a { display: none; }
  .masthead,
  body.view-past .masthead, body.view-future .masthead, body.view-draft .masthead {
    background: #fff; color: #000; border-bottom: 2px solid #000;
  }
  .org, .mast-date, .mast-sub { color: #333; }
  .wrap { max-width: none; padding: 0; }
  .section { margin-top: 7px; break-inside: avoid; }
  .grid { border: 1px solid #999; }
  .grid-dense { grid-template-columns: repeat(3, 1fr); }
  .grid-head { background: #eee; color: #000; }
  .row { break-inside: avoid; }
  .cell { padding: 1px 5px; }
  .tel { color: #000; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .steps li.active .mark { border-top-color: var(--teal); background: var(--cyan); }
}