:root {
  --bg: #f6f6f4;
  --panel: #ffffff;
  --ink: #1c1c1a;
  --muted: #6d6d68;
  --line: #e0e0da;
  --accent: #1f5f4e;
  --accent-ink: #ffffff;
  --warn: #8a5a00;
  --warn-bg: #fdf4e3;
  --error: #96201c;
  --error-bg: #fbeceb;
  --ok: #1f5f4e;
  --ok-bg: #e9f3ef;
  --pending: #8a5a00;
  --pending-bg: #fbeed4;
  --radius: 8px;
}

* { box-sizing: border-box; }

/* An author `display` declaration beats the UA stylesheet's [hidden] rule, so
   .btn/.notice would stay visible when the JS hides them. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        Helvetica, Arial, sans-serif;
}

code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { font-size: 0.9em; }
a { color: var(--accent); }

/* --- chrome --------------------------------------------------------------- */

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
.brand { color: var(--ink); text-decoration: none; font-size: 15px; }
.brand strong { font-weight: 600; }
.topbar nav { display: flex; align-items: center; gap: 12px; }
.topbar nav:last-of-type { margin-left: auto; }

/* The sections of the app. Only the ones you have a role for are rendered. */
.sections { gap: 6px !important; margin-left: 18px; }
.section-btn {
  padding: 6px 14px; border-radius: 6px; font-size: 14px;
  color: var(--ink); text-decoration: none; border: 1px solid transparent;
}
.section-btn:hover { background: var(--bg); }
.section-btn.is-current {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent);
}

/* Landing: one card per job, each showing where the content goes. */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.choice {
  display: flex; flex-direction: column; text-decoration: none; color: inherit;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
}
.choice:hover { border-color: #bdbdb5; }
.choice h2 { margin: 0 0 8px; font-size: 18px; }
.choice p { margin: 0 0 16px; }
/* Pushes the link to the bottom edge, so three cards of unequal prose still
   line their calls-to-action up with each other. */
.choice-go { margin-top: auto; color: var(--accent); font-size: 14px; font-weight: 600; }
.choices-foot { margin-top: 16px; }

/* The path the content takes, under each card. Nodes and arrows rather than a
   sentence: the direction is the part worth seeing at a glance. */
.flow {
  display: flex; align-items: flex-start; gap: 6px; flex-wrap: wrap;
  margin: 0 0 18px; padding: 14px 12px;
  background: var(--bg); border-radius: var(--radius);
}
.flow-node {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  width: 74px; text-align: center;
}
.flow-icon {
  display: grid; place-items: center; width: 38px; height: 38px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; color: var(--accent);
}
.flow-label { font-size: 11px; line-height: 1.25; color: var(--muted); }
.flow-arrow {
  flex: none; align-self: flex-start; margin-top: 18px;
  width: 14px; height: 2px; background: var(--line); position: relative;
}
.flow-arrow::after {
  content: ""; position: absolute; right: -1px; top: -3px;
  border: 4px solid transparent; border-left-color: var(--line);
}
/* One step that ends in three places at once -- the approved correction. */
.flow-fan { display: flex; flex-direction: column; gap: 8px; }
.flow-fan .flow-node { flex-direction: row; width: auto; gap: 8px; text-align: left; }
.flow-fan .flow-icon { width: 28px; height: 28px; border-radius: 8px; }
.flow-fan .flow-icon svg { width: 16px; height: 16px; }

/* Change Images: what to install, above the pages waiting for it. */
.extension-card { max-width: 640px; }
.extension-card h2 { margin-top: 0; font-size: 17px; }
.listhead { font-size: 17px; display: flex; align-items: baseline; gap: 10px; }

/* Pages queue */
.statuspick { display: flex; align-items: center; gap: 8px; }
.statuspick select { font: inherit; padding: 6px 8px; border-radius: 6px;
                     border: 1px solid var(--line); background: var(--panel); }
.table .tick { width: 34px; }
.queue-row.is-blocked { opacity: 0.55; }
.queue-row.is-done { background: var(--ok-bg); }
.queue-row.is-failed { background: var(--error-bg); }
.result { overflow-wrap: anywhere; }
.result.is-ok { color: var(--ok); }
.result.is-error { color: var(--error); }
.who { color: var(--muted); font-size: 13px; }

main { max-width: 100dvw; margin: 0 auto; padding: 24px; }

h1 { font-size: 22px; margin: 4px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.spacer { flex: 1; }

.pagehead { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
/* The controls to the right of the title -- but only when there are some. As
   :last-child this also matched the title itself on a screen that has none,
   which pushed the whole heading to the right-hand edge. */
.pagehead > :not(:first-child):last-child { margin-left: auto; }
.pagehead p { margin: 0; }

/* --- cards, notices ------------------------------------------------------- */

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}
.card-narrow { max-width: 480px; margin: 48px auto; }
.card-narrow h1 { margin-top: 0; }
.details summary { cursor: pointer; font-weight: 600; }
.details[open] summary { margin-bottom: 12px; }

.notice {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 16px;
  background: var(--panel);
}
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.notice-error { border-left-color: var(--error); background: var(--error-bg); }
.notice-warn  { border-left-color: var(--warn);  background: var(--warn-bg); }
.notice-ok    { border-left-color: var(--ok);    background: var(--ok-bg); }
.notice-info  { border-left-color: var(--muted); }

.errortext { white-space: pre-wrap; background: var(--bg); padding: 12px;
             border-radius: var(--radius); font-size: 13px; }

/* --- buttons -------------------------------------------------------------- */

.btn {
  display: inline-block;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  border-radius: 6px;
  padding: 7px 14px;
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { border-color: #bdbdb5; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-save { background: #7a2f1e; color: #fff; border-color: #7a2f1e; font-weight: 600; }
.btn-quiet { background: transparent; }
.btn-small { padding: 4px 9px; font-size: 12.5px; }
.btn-big { padding: 11px 20px; font-size: 15px; }

.pill {
  display: inline-block; padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.01em;
}
.pill-pending { background: var(--pending-bg); color: var(--pending); }
.pill-ready { background: var(--ok-bg); color: var(--ok); }

/* --- tables --------------------------------------------------------------- */

.table {
  width: 100%; border-collapse: collapse; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
}
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.table .num { text-align: right; }
.table-small td, .table-small th { padding: 7px 10px; font-size: 13px; }
.clip { max-width: 320px; overflow-wrap: anywhere; }

/* --- toolbar -------------------------------------------------------------- */

.toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 12px;
}
/* Separates the two directions in the Pages toolbar: the buttons before it read
   a sheet, the one after it replaces one. */
.toolbar-sep {
  width: 1px;
  align-self: stretch;
  margin: 0 2px;
  background: var(--line);
}
.toolbar-status { font-size: 13px; color: var(--muted); }
.toolbar-status.is-ok { color: var(--ok); }
.toolbar-status.is-error { color: var(--error); }

@media (max-width: 760px) {
  main { padding: 16px; }
}


/* --- Proofreading ---------------------------------------------------------- */

.section-count {
  display: inline-block; min-width: 16px; padding: 0 5px; margin-left: 4px;
  border-radius: 999px; background: var(--pending); color: #fff;
  font-size: 11px; font-weight: 700; text-align: center;
}
.section-btn.is-current .section-count { background: rgba(255, 255, 255, .3); }

.proposal {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.proposal.is-conflict { border-color: var(--error); }
.proposal.is-decided { opacity: .75; }

.proposal-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.proposal-head > :last-child { margin-left: auto; text-align: right; }
.proposal-meta { white-space: nowrap; }
.proposal h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em;
               color: var(--muted); margin: 12px 0 4px; font-weight: 600; }

/* Source and proposal side by side -- the comparison the manager is making. */
.proposal-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.proposal-diff .quote { margin: 0; padding: 8px 10px; border-radius: 6px;
                        background: var(--bg); overflow-wrap: anywhere; }
.proposal-diff .diff-side:first-child .quote { border-left: 3px solid var(--error); }
.proposal-diff .diff-side:last-child .quote { border-left: 3px solid var(--ok); }

.proposal .diff { margin: 0; padding: 8px 10px; background: var(--bg);
                  border-radius: 6px; overflow-wrap: anywhere; }
.run-removed { background: var(--error-bg); color: var(--error); text-decoration: line-through; }
.run-added { background: var(--ok-bg); color: var(--ok); font-weight: 600; }

.proposal .context { margin-top: 8px; overflow-wrap: anywhere; }
.proposal-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.edit-box { margin-top: 10px; }
.edit-box textarea { width: 100%; box-sizing: border-box; font: inherit;
                     padding: 8px; border: 1px solid var(--line); border-radius: 6px; }
.edit-box .row { display: flex; gap: 8px; margin-top: 8px; }
.edit-box input { flex: 1; font: inherit; padding: 6px 8px;
                  border: 1px solid var(--line); border-radius: 6px; }

/* The reverse-sync step. Set apart from the decision buttons above it: the
   decision is about the wording, this is about a different document. */
.sheet-box { display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
             margin-top: 14px; padding: 10px 12px; border-radius: 6px;
             background: var(--pending-bg); }
.sheet-box > div:first-child { flex: 1 1 240px; }
.sheet-box .plan { flex-basis: 100%; margin: 0; }

.pill-pending  { background: var(--pending-bg); color: var(--pending); }
.pill-accepted { background: var(--ok-bg); color: var(--ok); }
.pill-edited   { background: var(--ok-bg); color: var(--ok); }
.pill-rejected { background: var(--error-bg); color: var(--error); }

@media (max-width: 760px) {
  /* Stacked on a phone: two columns of prose side by side is unreadable, and
     the brief asks for mobile. */
  .proposal-diff { grid-template-columns: 1fr; }
  .proposal-actions { flex-wrap: wrap; }
}

/* --- the page overview -------------------------------------------------------
   One row per page. Deliberately not a dense table: each row carries four
   readiness flags, two assignments and a priority, and a table of that would be
   eleven columns nobody can read on a laptop, let alone the phone the brief asks
   for. */
.pagerow { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px;
           margin-bottom: 12px; background: var(--card); }
.pagerow.is-healthy { border-color: var(--ok); }
.pagerow-head { display: flex; justify-content: space-between; align-items: flex-start;
                gap: 12px; }
.pagerow-name { min-width: 0; overflow-wrap: anywhere; }
.pagerow-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.flags { display: flex; flex-wrap: wrap; gap: 8px 18px; list-style: none;
         margin: 12px 0 0; padding: 0; }
.flag { display: flex; align-items: center; gap: 6px; font-size: 13px;
        color: var(--muted); }
.flag.is-done { color: var(--ok); font-weight: 600; }
.flag-mark { display: inline-block; width: 1em; text-align: center; }

.pagerow-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
                   margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.pagerow-actions label { display: flex; align-items: center; gap: 6px; }
.pagerow-actions select, .pagerow-actions input { font: inherit; font-size: 13px;
    padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; }
.pagerow-actions input[type="email"] { width: 150px; }
.pagerow-actions .spacer { flex: 1; }

.typepick { margin-bottom: 14px; }

/* Priority reads as urgency, so it is coloured like it -- but "low" is not a
   problem, so it stays quiet rather than going green (which would read as done). */
.pill-priority-high   { background: var(--error-bg); color: var(--error); }
.pill-priority-normal { background: var(--pending-bg); color: var(--pending); }
.pill-priority-low    { background: var(--bg); color: var(--muted); }

@media (max-width: 760px) {
  .pagerow-head { flex-direction: column; }
  .pagerow-actions .spacer { flex-basis: 100%; }
  .pagerow-actions input[type="email"] { width: 100%; }
}

/* --- activity figures --------------------------------------------------------
   Numbers first, at a size you can read across a desk, because these exist to be
   glanced at in a review rather than studied. */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
           gap: 12px; margin-bottom: 18px; }
.figure { background: var(--panel); border: 1px solid var(--line);
          border-radius: var(--radius); padding: 14px 16px; }
.figure-count { font-size: 28px; font-weight: 600; line-height: 1.1; }
.figure-label { font-weight: 600; margin-top: 2px; }

/* One number per row, so the bar is the comparison rather than decoration. */
.barcell { width: 45%; }
.bar { display: block; height: 10px; border-radius: 999px; background: var(--accent);
       min-width: 2px; }

/* Page history: one line per thing that happened, newest first. A table would
   need a column for a detail most rows do not have. */
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline;
              padding: 7px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border-bottom: none; }
.history-when { flex: 0 0 11.5em; }
.history-what { font-weight: 600; }

/* --- the proofreading queue, grouped by page ----------------------------------
   A <details> per page rather than a JS accordion: the browser already knows how
   to do this, keyboard and screen reader included, and it survives the script
   failing to load. */
.pagegroup { border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
             margin-bottom: 12px; }
.pagegroup > summary { cursor: pointer; padding: 13px 16px; list-style-position: inside; }
.pagegroup[open] > summary { border-bottom: 1px solid var(--line); }
.pagegroup-head { display: flex; justify-content: space-between; align-items: baseline;
                  gap: 12px; flex-wrap: wrap; }
.pagegroup-name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pagegroup-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
                  margin-left: auto; }
.pagegroup-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
                     padding: 10px 16px; border-bottom: 1px solid var(--line);
                     background: var(--bg); }
/* The cards sit inside a group now, so they lose their own outer frame. */
.pagegroup .proposal { border: none; border-radius: 0; margin: 0;
                       border-bottom: 1px solid var(--line); }
.pagegroup .proposal:last-child { border-bottom: none; }
