/*
 * OmLuxe HQ. The spec's palette, and its rule: no other colours, no
 * gradients, no drop shadows. It should look like a page from a magazine,
 * not a SaaS dashboard.
 */

:root {
  color-scheme: light;
  --cream: #F7F3EC;
  --ink: #3A3532;
  --gold: #B08A5A;
  --line: #E4DBCD;
  --soft: #EDD7CF;
  --muted: #8A817A;
  --red: #9B4A3F;
  --paper: #FFFDFA;
  --display: "Cormorant Garamond", "Hoefler Text", "Iowan Old Style", Palatino, Georgia, serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; -webkit-text-size-adjust: 100%; }
html { background: var(--cream); }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font: 400 17px/1.55 var(--body);
  padding: max(28px, env(safe-area-inset-top)) 16px calc(56px + env(safe-area-inset-bottom));
}
a { color: var(--gold); }

.wrap { max-width: 34rem; margin: 0 auto; }
.wrap.wide { max-width: 1240px; }

/* Small caps gold label. The one decorative element the spec allows. */
.label, h2 {
  font: 600 12px/1 var(--body); letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold); margin: 0;
}
h2 { margin: 42px 0 14px; }
h2.red { color: var(--red); }

.brand { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 26px; }
.brand .date { color: var(--muted); font-size: 14px; }
/* Pamela's "check now", at the top where she looks for fresh news. */
.checknow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: -8px 0 22px; }
.checknow button { padding: 10px 16px; font-size: 14px; }
.checknow .hint { margin: 0; font-size: 13px; flex: 1 1 200px; }
#scan-result .stale { margin: -8px 0 22px; }

h1 {
  font: 300 clamp(34px, 9vw, 46px)/1.12 var(--display);
  margin: 0 0 12px; letter-spacing: -.005em; color: var(--ink);
}
h1.red { color: var(--red); }
.sub { color: var(--muted); font-size: 15px; margin: 0; }
.sub b { color: var(--ink); font-weight: 600; }

/* The success state. Large serif, centred, generous space. The whole screen. */
.quiet {
  min-height: 60vh; display: flex; align-items: center; justify-content: center; text-align: center;
}
.quiet h1 { font-size: clamp(38px, 10vw, 56px); }

/* Hairline rows, no cards with shadows. */
.row {
  display: flex; justify-content: space-between; gap: 16px; align-items: baseline;
  padding: 13px 0; border-top: 1px solid var(--line);
}
.rows > .row:last-child { border-bottom: 1px solid var(--line); }
.row .t { font-size: 17px; min-width: 0; overflow-wrap: anywhere; }
.row .t small { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.row .n { color: var(--muted); font-size: 15px; white-space: nowrap; text-align: right; }
.row .n b { color: var(--ink); font-weight: 600; }
.row.red .t, .row.red .n b { color: var(--red); }
.row .flag { color: var(--gold); font-size: 13px; }

/* The email's own first line, so she can tell what it is without opening it.
   Set slightly darker than the reason underneath it: this is what the sender
   said, and the line below is only what this app thinks about it. */
.row .t small.preview { color: var(--ink); opacity: 0.72; margin-top: 4px; font-style: italic; }
.row .t small.where { margin-top: 4px; }
.row .t small.where b { color: var(--ink); font-weight: 600; font-style: normal; }

/* Her own note on a row: in her ink, set off by the gold rule, never urgent red. */
.note-slot { display: block; margin-top: 6px; }
.row .t small.note { color: var(--ink); font-size: 14px; border-left: 2px solid var(--gold); padding-left: 8px; margin-top: 0; }
.row .t small.note .by { color: var(--muted); white-space: nowrap; }
.row .t small.note a, .row .t a.add-note { color: var(--gold); font-size: 13px; }
.note-form { display: flex; flex-wrap: wrap; gap: 8px; }
.note-form textarea {
  flex: 1 1 100%; min-width: 0; font: 400 15px/1.45 var(--body); padding: 10px 12px; resize: vertical;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 2px;
}
.note-form button { padding: 10px 14px; font-size: 14px; }

.stale {
  margin: 20px 0 0; padding: 12px 14px; border-left: 2px solid var(--gold);
  background: var(--paper); color: var(--ink); font-size: 15px;
}

details { margin-top: 8px; }
/* Pamela's "Rachel is fixing" line: near the top, quiet, opens to the list. */
details.fixing { margin: 18px 0 4px; }
details.fixing .row .t { font-size: 15px; color: var(--muted); }
details > summary { cursor: pointer; color: var(--muted); font-size: 14px; list-style: none; padding: 4px 0; }
details > summary::-webkit-details-marker { display: none; }
details > summary::after { content: " \2192"; }
details[open] > summary::after { content: " \2191"; }
.evidence {
  font: 400 13.5px/1.55 var(--mono); color: var(--muted); margin: 8px 0 2px; padding: 10px 12px;
  background: var(--paper); border: 1px solid var(--line); overflow-wrap: anywhere;
}
.evidence b { color: var(--ink); font-weight: 600; display: block; font-family: var(--body); font-size: 14px; margin-bottom: 3px; }

button, .btn {
  font: 500 15px/1 var(--body); cursor: pointer; background: var(--ink); color: var(--cream);
  border: 0; border-radius: 2px; padding: 13px 20px; text-decoration: none; display: inline-block;
}
button.quiet-btn { background: transparent; color: var(--gold); border: 1px solid var(--line); }
button[disabled] { opacity: .45; cursor: default; }
input[type=email], input[type=password] {
  font: 400 17px var(--body); width: 100%; padding: 13px 14px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); border-radius: 2px;
}
input[type=password] { margin-top: 10px; }
.hint { color: var(--muted); font-size: 14px; margin: 12px 0 0; }
.tools { margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--line); }
footer { margin-top: 30px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.hidden { display: none !important; }
nav.top { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 14px; margin-bottom: 26px; }
nav.top a { color: var(--muted); text-decoration: none; }
nav.top a.here { color: var(--ink); border-bottom: 1px solid var(--gold); }
nav.top .spacer { flex: 1; }
/* Systems is Rachel's. Hidden until the page knows the reader is her. */
nav.top .admin-only { display: none; }
body[data-role="admin"] nav.top .admin-only { display: inline; }
/* On a phone the four pages fit on one line only without Sign out beside
   them, so Sign out moves to the foot of the page there (29 September: it
   was wrapping onto a line of its own). */
.signout-foot { display: none; margin: 36px 0 0; font-size: 14px; }
.signout-foot a { color: var(--muted); }
@media (max-width: 600px) {
  nav.top { flex-wrap: nowrap; gap: 0 clamp(12px, 4.5vw, 22px); white-space: nowrap; }
  nav.top #out, nav.top .spacer { display: none; }
  .signout-foot { display: block; }
}

/* ---------- Rachel's grid. Dense, hairline, small. May be plain. Must be fast. ---------- */
/* Fixed layout: the columns share the page's width and nothing inside a
   cell can push the table wider than the page. Before this, one long note
   on a subscription made the whole page scroll sideways. */
.grid { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 8px; table-layout: fixed; }
.grid th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 11px; letter-spacing: .06em;
  text-transform: uppercase; padding: 6px 6px; border-bottom: 1px solid var(--ink); cursor: pointer;
  user-select: none; white-space: nowrap;
}
.grid th[data-dir]::after { content: attr(data-dir); margin-left: 4px; color: var(--gold); }
.grid td { padding: 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid td .cell {
  display: block; width: 100%; min-height: 30px; padding: 6px 6px; border: 0; background: transparent;
  font: inherit; color: inherit; outline: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.grid td .cell:focus { background: var(--paper); box-shadow: inset 0 0 0 1px var(--gold); white-space: normal; }
.grid td.gold .cell { color: var(--gold); font-weight: 600; }
.grid td.red .cell { color: var(--red); font-weight: 600; }
.grid td .diff { font-size: 11px; color: var(--gold); margin-left: 4px; }
.grid tr.new-row td { background: var(--paper); }
.grid tr.new-row .cell::placeholder { color: var(--muted); font-style: italic; }
.grid td.x { width: 24px; text-align: center; }
.grid td.x button { background: none; border: 0; color: var(--muted); font-size: 14px; padding: 4px 6px; cursor: pointer; }
.grid td.x button:hover { color: var(--red); }
.add-row { margin: 8px 0 0; padding: 6px 12px; font-size: 13px; }
.grid td .ro { cursor: default; user-select: text; }
/* Locked cells are text, not inputs, so they can wrap and be read in full. */
.grid td .cell.ro { white-space: normal; overflow-wrap: anywhere; }
.grid select.cell { appearance: none; -webkit-appearance: none; cursor: pointer; }
.grid input[type=checkbox] { margin: 0 6px; }
.filter { font: 400 13px var(--body); padding: 6px 8px; border: 1px solid var(--line); background: var(--paper); width: 240px; margin: 0 0 8px; }
.section-head { display: flex; align-items: baseline; gap: 16px; margin: 34px 0 8px; }
.section-head h2 { margin: 0; }
.section-head .count { color: var(--muted); font-size: 12px; }
.saved { position: fixed; right: 16px; bottom: 16px; font-size: 12px; color: var(--muted); background: var(--paper); border: 1px solid var(--line); padding: 6px 10px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.saved.on { opacity: 1; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 20px; background: var(--ink); color: var(--cream); padding: 12px 16px; font-size: 14px; display: flex; gap: 16px; align-items: center; }
.toast button { background: transparent; color: var(--gold); padding: 0; font-size: 14px; }
/* Long subject lines on a phone: wrap inside the note, never past the screen edge. */
.toast { left: 16px; right: 16px; transform: none; margin: 0 auto; width: fit-content; max-width: calc(100vw - 32px); box-sizing: border-box; }
.toast span { min-width: 0; overflow-wrap: anywhere; }
.toast button { flex: none; }
.msgbox { width: 100%; min-height: 220px; font: 14px/1.5 var(--body); padding: 12px; border: 1px solid var(--line); background: var(--paper); white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 720px) {
  body { padding: 16px 14px 48px; }
}

/* Too narrow for a ten-column table: each row becomes a small card, one
   field per line with its column name beside it, so nothing is cut off and
   nothing scrolls sideways. Sorting by header is a desktop thing; the filter
   box still works. */
@media (max-width: 860px) {
  .grid { table-layout: auto; font-size: 14px; }
  .grid thead { display: none; }
  .grid, .grid tbody, .grid tr { display: block; width: 100%; }
  .grid tr { border-top: 1px solid var(--ink); padding: 4px 0 8px; }
  .grid tr.new-row { border-top-style: dashed; }
  .grid td { display: grid; grid-template-columns: 7rem minmax(0, 1fr); align-items: center; border-bottom: 0; }
  .grid td::before {
    content: attr(data-label); color: var(--muted); font-size: 11px; letter-spacing: .06em;
    text-transform: uppercase; padding: 6px 8px 6px 0;
  }
  .grid td .cell { white-space: normal; overflow-wrap: anywhere; min-width: 0; }
  .grid td .diff { grid-column: 2; margin: 0 0 4px 6px; }
  .grid input[type=checkbox] { justify-self: start; margin: 8px 6px; }
  .grid td.x { display: block; width: auto; text-align: right; }
  .grid td.x::before { content: none; }
  .filter { width: 100%; }
}

/* Charges found in her inbox that the Subscriptions table does not have. */
.unlisted { margin: 4px 0 14px; max-width: 60rem; }
.unlisted .hint { margin: 0 0 6px; }
.unlisted .row .t { font-size: 15px; }
.charges-alert { margin: 0 0 18px; max-width: 60rem; }
.charges-alert a { color: var(--gold); white-space: nowrap; }
.unlisted .charges-h { font: 600 13px/1.4 var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 0 4px; }
