/* The look follows nakodaexportsgroup.com: an ivory page, near-white sheets with a fine green-grey rule,
   forest green for what you press and what is selected, gold for the one figure to find first, a thin
   dark-green strip across the top, serif headings over a plain sans. One light theme only: the page looks
   the same whatever the system is set to.
   Corners: sheets 14px, boxes you type in 10px, buttons, tabs and chips fully round. */
:root {
  color-scheme: light;
  --bg: #faf9f4;            /* ivory: the page */
  --surface: #fffefb;       /* the sheets, and every table on them */
  --field: #fffefb;         /* boxes you type in */
  --soft: #f4f5ee;          /* a quieter band inside a sheet: panels, footers, the row for a new entry */
  --wash: #eef3ea;          /* pale green: day headings, an open template, variables */
  --hover: #f7f8f2;
  --line: #e2e6da; --line-strong: #c9d1c2;
  --text: #17211a; --ink: #0d1c12; --muted: #616c60;
  --accent: #275634;        /* forest green: filled buttons, the open tab, a chosen filter */
  --accent-deep: #20452b;   /* the same, under the pointer; also green text on buttons */
  --accent-edge: #275634;
  --accent-ink: #275634;    /* green as text on a sheet (8 : 1) */
  --on-accent: #faf9f4;
  --gold: #d3af46;          /* gold, with dark text on it: what a lot sold at */
  --gold-pale: #f6efd2;     /* a question waiting for an answer */
  --strip: #0d1c12;         /* the dark strip across the top */
  --warn: #9a4a00; --bad: #b3261e; --bad-wash: #fbe9e6;
  --bubble: #d9fdd3; --bubble-ink: #111b21;   /* WhatsApp's own message colour, for the preview */
  --shadow: 0 1px 2px rgb(13 28 18 / .04), 0 12px 28px -22px rgb(13 28 18 / .3);
  --serif: Fraunces, "Noto Serif", Georgia, "Times New Roman", serif;
  --quick: 140ms ease;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 15px/1.5 Inter, "Noto Sans", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
[lang="hi"] { line-height: 1.6; }
::selection { background: var(--accent); color: var(--on-accent); }
.skip { position: absolute; left: 16px; top: -48px; background: var(--surface); color: var(--accent-ink); padding: 8px 12px; border-radius: 10px; z-index: 5; }
.skip:focus { top: 8px; }

/* ---------- header and tabs ---------- */
/* Two rows: the dark strip with the state of the WhatsApp connection, then the name and the tabs. */
header {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0 32px;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
header h1 {
  display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 0 12px 28px;
  font: 500 20px/1.2 var(--serif); letter-spacing: -.01em; color: var(--ink);
}
/* Three ruled lines: a ledger page, which is what this tool keeps. */
.mark {
  width: 26px; height: 26px; border-radius: 8px; background: var(--accent);
  background-image: linear-gradient(var(--gold), var(--gold)), linear-gradient(var(--on-accent), var(--on-accent)), linear-gradient(var(--on-accent), var(--on-accent));
  background-size: 14px 2px, 14px 2px, 8px 2px; background-position: 6px 8px, 6px 12px, 6px 16px; background-repeat: no-repeat;
}
nav { display: flex; flex-wrap: wrap; gap: 6px; padding-right: 28px; }
nav [role="tab"] { border-color: transparent; background: none; color: var(--muted); padding: 7px 16px; }
nav [role="tab"]:hover:not(:disabled) { color: var(--accent-deep); background: var(--wash); border-color: transparent; }
nav [role="tab"][aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
#conn {
  grid-row: 1; grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 5px 28px;
  background: var(--strip); color: rgb(250 249 244 / .78); font-size: 13px;
}
#conn .dot { width: 7px; height: 7px; border-radius: 50%; background: rgb(250 249 244 / .4); }
#conn[data-state="ready"] .dot { background: #dfc670; }
#conn[data-state="sending"] .dot { background: #ff9f43; animation: pulse 1s infinite; }
#conn[data-state="qr"] .dot { background: #ff9f43; }
#conn[data-state="qr"], #conn[data-state="sending"] { color: #ffd6a8; }
#conn[data-state="closed"], #conn[data-state="error"] { color: #ffb4ab; }
#conn[data-state="closed"] .dot, #conn[data-state="error"] .dot { background: #ff8a80; }
#conn #screenOpen { margin-left: auto; }
#conn #screenOpen[aria-expanded="true"] { background: rgb(250 249 244 / .16); }
#viewScreen { grid-template-columns: minmax(0, 1fr); max-width: 1340px; padding-bottom: 0; }
#screenImg { display: block; width: 100%; height: auto; background: var(--soft); }
#screenImg[hidden] { display: none; }
#conn button { margin-left: 6px; padding: 3px 12px; background: transparent; color: var(--on-accent); border-color: rgb(250 249 244 / .3); }
#conn button:hover:not(:disabled) { background: rgb(250 249 244 / .12); border-color: rgb(250 249 244 / .5); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- layout ---------- */
.view { display: grid; gap: 24px; max-width: 1640px; margin: 0 auto; padding: 28px 28px 56px; align-items: start; }
#viewSend { grid-template-columns: minmax(0, 2.3fr) minmax(320px, 1fr); }
#viewTemplates { grid-template-columns: minmax(230px, 320px) minmax(0, 1fr); max-width: 1180px; }
#viewRates { grid-template-columns: minmax(0, 1fr); max-width: 1280px; }
/* Side by side only on screens wide enough for the table's columns; otherwise the table gets the full width
   and the message box sits below it, with its preview alongside. */
@media (max-width: 1500px) {
  #viewSend { grid-template-columns: minmax(0, 1fr); }
}
.compose { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 28px; }
@media (min-width: 900px) and (max-width: 1500px) {
  .compose { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
  .compose-side > :first-child:not([hidden]), .compose-side > [hidden]:first-child + :not([hidden]) { margin-top: 0; }
}
@media (max-width: 800px) {
  #viewTemplates { grid-template-columns: minmax(0, 1fr); }
  .view { padding: 16px 12px 40px; gap: 16px; }
  header { grid-template-columns: minmax(0, 1fr); }
  header h1 { padding: 10px 14px 4px; }
  nav { padding: 0 10px 10px; }
  nav [role="tab"] { padding: 6px 12px; }
  #conn { padding: 5px 14px; }
}
section { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; min-width: 0; box-shadow: var(--shadow); overflow: clip; }
section > h2, .bar h2 { font: 500 19px/1.3 var(--serif); letter-spacing: -.01em; color: var(--ink); margin: 0; }
section > h2 { padding: 15px 18px; border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.grow { flex: 1; }
.pad { padding: 18px; }
.panel { padding: 16px 18px; border-bottom: 1px solid var(--line); background: var(--soft); font-size: 13px; }
.panel textarea { width: 100%; min-height: 110px; margin-top: 8px; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; }
.panel p { margin: 10px 0 0; }
.panel ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.panel .row { margin-top: 14px; }
.panel summary { cursor: pointer; color: var(--muted); margin-top: 10px; width: fit-content; }
.drop {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px; border: 1.5px dashed var(--line-strong);
  border-radius: 10px; background: var(--field); color: var(--muted); transition: border-color var(--quick), background var(--quick);
}
.panel.over .drop { border-color: var(--accent-edge); background: var(--wash); color: var(--text); }
#importSource { font-weight: 600; }
.maprow { display: flex; gap: 8px 18px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); }
.maprow select { margin-left: 6px; padding: 4px 8px; font-size: 13px; max-width: 220px; }
table.sample { margin-top: 12px; font-size: 13px; }
table.sample caption { text-align: left; color: var(--muted); padding-bottom: 4px; }
table.sample th, table.sample td { background: none; padding: 4px 12px 4px 0; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.warnline { color: var(--warn); }

/* ---------- controls ---------- */
button, a.button {
  font: inherit; font-size: 14px; font-weight: 600; border: 1px solid rgb(39 86 52 / .28); background: var(--surface); color: var(--accent-deep);
  padding: 8px 16px; border-radius: 99px; cursor: pointer; white-space: nowrap;
  transition: background var(--quick), border-color var(--quick), color var(--quick), transform 80ms ease;
}
button:hover:not(:disabled), a.button:hover { border-color: var(--accent); background: var(--wash); }
button:active:not(:disabled), a.button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.primary:hover:not(:disabled) { background: var(--accent-deep); border-color: var(--accent-deep); }
button.danger { border-color: var(--bad); color: var(--bad); }
button.danger:hover:not(:disabled) { background: var(--bad-wash); border-color: var(--bad); }
button.small, a.button.small { padding: 5px 13px; font-size: 13px; }
button.x { border: 0; background: none; color: var(--muted); padding: 6px 7px; font-size: 15px; font-weight: 400; line-height: 1; }
button.x:hover:not(:disabled) { color: var(--text); background: var(--soft); }
button.x.del:hover:not(:disabled) { color: var(--bad); background: var(--bad-wash); }
a.button { display: inline-block; text-decoration: none; }
.muted { color: var(--muted); font-size: 13px; }
button.link { border: 0; background: none; padding: 0; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; font-size: 13px; border-radius: 3px; }
button.link:active:not(:disabled) { transform: none; }
button.link:hover:not(:disabled) { background: none; color: var(--text); }
input[type="text"], input[type="search"], input[type="number"], input[type="password"], select, textarea {
  font: inherit; color: inherit; background: var(--field); border: 1px solid var(--line-strong); border-radius: 10px; padding: 7px 11px;
  transition: border-color var(--quick), box-shadow var(--quick);
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
textarea:focus, select:focus, input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgb(39 86 52 / .18); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--accent-ink); cursor: pointer; }
input[type="checkbox"]:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; box-shadow: none; }
#q, #rQ { width: 170px; padding: 5px 10px; font-size: 13px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.chip { padding: 4px 12px; font-size: 13px; font-weight: 400; color: var(--text); border-color: var(--line-strong); }
.chip b { font-weight: 600; margin-left: 5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"], .chip[aria-pressed="true"]:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.chip[aria-pressed="true"] b { color: inherit; opacity: .8; }

/* ---------- contacts table ---------- */
/* The table scrolls sideways when there are many columns; the tick box and the name stay in view. */
.scroll { overflow-x: auto; container-type: inline-size; }
/* width: 100% lets columns shrink to their min-widths before the table starts to scroll. */
table { border-collapse: separate; border-spacing: 0; width: 100%; }
th, td { background: var(--surface); border-bottom: 1px solid var(--line); transition: background var(--quick); }
th { white-space: nowrap; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 9px 8px; vertical-align: top; }
td { padding: 2px 6px; vertical-align: middle; }
#rows > tr:not(.detail):not(.none):hover > td { background: var(--hover); }
.c0 { position: sticky; left: 0; z-index: 1; width: 46px; min-width: 46px; text-align: center; padding-left: 14px; }
.c1 { position: sticky; left: 46px; z-index: 1; min-width: 170px; box-shadow: 1px 0 0 var(--line); }
th .fixed { display: block; padding: 4px 5px; }
th small.v { display: block; padding: 0 5px; font: 400 11px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent-ink); opacity: .9; }
/* Your own columns are ruled off like spreadsheet cells, which is what they are. */
th.col, td.col { min-width: 130px; border-left: 1px solid var(--line); }
th.btns, td.btns { border-left: 1px solid var(--line); }
.colhead { display: flex; align-items: center; }
.colhead input, input.newcol {
  flex: 1; min-width: 0; width: 100%; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 3px 4px; border-color: transparent; background: transparent;
}
.colhead input:hover:not(:disabled) { border-color: var(--line-strong); }
.colhead input:focus, input.newcol { color: var(--text); background: var(--field); border-color: var(--accent-ink); }
input.newcol { min-width: 130px; }
.colhead button.x { padding: 2px 5px; }
.colask { white-space: normal; color: var(--text); max-width: 190px; font-weight: 400; }
.colask span { display: flex; gap: 6px; margin-top: 6px; }
td.num { min-width: 130px; font-variant-numeric: tabular-nums; }
td.st { white-space: nowrap; padding-right: 10px; }
td.act { font-size: 13px; color: var(--muted); min-width: 140px; max-width: 240px; overflow-wrap: anywhere; }
td.act q { color: var(--text); quotes: "“" "”"; }
th.btns, td.btns { text-align: right; padding-right: 10px; }
td input[type="text"] { width: 100%; border-color: transparent; background: transparent; padding: 8px 6px; border-radius: 6px; }
td input[type="text"]:hover:not(:disabled) { border-color: var(--line-strong); }
td input[type="text"]:focus { background: var(--field); }
.namecell { display: flex; align-items: center; }
.namecell button.x { padding: 6px 4px; font-size: 12px; width: 24px; }
.c1 input[type="text"] { font-weight: 600; }
#add { font-weight: 600; }
tr.add td { background: var(--soft); padding-top: 8px; padding-bottom: 8px; border-bottom: 0; color: var(--muted); }
tr.add input[type="text"] { background: var(--field); border-color: var(--line-strong); font-weight: 400; }
tr.detail > td, tr.none > td { padding: 0; background: var(--soft); }
tr.none > td { background: var(--surface); }
/* Detail panels span the visible width of the table, not its full scrolled width. */
.detail-grid, td > .empty { position: sticky; left: 0; width: 100cqw; padding: 16px 18px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 700px) { .detail-grid { grid-template-columns: minmax(0, 1fr); } }
.empty { color: var(--muted); padding: 28px 18px; max-width: 62ch; text-wrap: pretty; }
.detail label, .form label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.detail textarea { width: 100%; min-height: 70px; resize: vertical; }
.detail select { margin-bottom: 12px; }
.history { margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); max-height: 150px; overflow: auto; }
.history li { padding: 2px 0; overflow-wrap: anywhere; }
.history time { color: var(--text); font-variant-numeric: tabular-nums; }

/* Where a contact stands: a word with a dot in front, coloured by what it asks of you. */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .75; }
.pill.new::before { background: none; box-shadow: inset 0 0 0 1.5px currentColor; }
.pill.sent, .pill.found, .pill.replied, .pill.interested { color: var(--accent-ink); }
.pill.sending, .pill.unconfirmed, .pill.due { color: var(--warn); }
.pill.failed, .pill.not_interested { color: var(--bad); }

#notice { margin: 0; padding: 10px 18px; border-top: 1px solid var(--line); font-size: 13px; background: var(--wash); }
.err { color: var(--bad); font-size: 13px; margin: 12px 0 0; }
#cerror, #rError { margin: 0; padding: 10px 18px; border-top: 1px solid var(--line); background: var(--bad-wash); }
#rError { border-top: 0; border-bottom: 1px solid var(--line); }
.foot {
  display: flex; gap: 8px 22px; flex-wrap: wrap; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 13px; background: var(--soft);
}
.foot input[type="number"] { width: 64px; padding: 4px 6px; }

/* ---------- message and template editors ---------- */
.tplrow { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.tplrow select { flex: 1; min-width: 140px; }
textarea.body { width: 100%; min-height: 170px; resize: vertical; padding: 12px; line-height: 1.55; }
.form input[type="text"] { width: 100%; margin-bottom: 14px; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
code, .var { background: var(--wash); color: var(--accent-ink); padding: 1px 7px; border-radius: 6px; font: 400 12px ui-monospace, SFMono-Regular, Menlo, monospace; }
button.var { border: 0; margin: 0 4px 4px 0; padding: 2px 8px; }
button.var:hover:not(:disabled) { background: var(--accent); color: var(--on-accent); border: 0; }
.field { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.field label { min-width: 90px; }
.field input { flex: 1; min-width: 0; }
.varlist { list-style: none; margin: 12px 0 0; padding: 0; font-size: 13px; color: var(--muted); }
.varlist li { padding: 2px 0; }
.varlist li.bad { color: var(--warn); }
.previewWrap { margin-top: 16px; }
.previewWrap > span { font-size: 12px; color: var(--muted); }
.bubble {
  margin-top: 6px; background: var(--bubble); color: var(--bubble-ink); border-radius: 8px 0 8px 8px;
  padding: 9px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; max-height: 280px; overflow: auto;
  box-shadow: 0 1px 1px rgb(14 20 51 / .16);
}
.bubble mark { background: none; color: var(--bad); font-weight: 600; }
.bubble i { opacity: .65; }
.row { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.ask { margin-top: 16px; padding: 14px; border: 1px solid #e3d291; border-radius: 10px; background: var(--gold-pale); }
.ask p { margin: 0 0 10px; }
#warn { color: var(--warn); font-size: 13px; margin: 10px 0 0; }
#progress, #tState { color: var(--muted); font-size: 13px; }

#tList { list-style: none; margin: 0; padding: 6px; }
#tList button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px 12px; white-space: normal; border-radius: 10px; color: var(--text); font-size: 15px; font-weight: 400; }
#tList button:hover { background: var(--hover); }
#tList button[aria-current="true"] { background: var(--wash); box-shadow: inset 3px 0 0 var(--accent); }
#tList b { display: block; font-weight: 600; }
#tList span { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tList .none { padding: 12px 10px; color: var(--muted); font-size: 13px; }

#qr { margin-bottom: 24px; }
#qr .pad { text-align: center; }
#qr img { width: 240px; height: 240px; background: #fff; padding: 10px; border: 1px solid var(--line); border-radius: 8px; image-rendering: pixelated; }
#qr ol { text-align: left; margin: 14px auto 0; max-width: 300px; padding-left: 20px; color: var(--muted); font-size: 14px; }

/* ---------- daily rates ---------- */
/* Set out like a rate book: a day, then one entry per message. Each entry has the time, who it is from,
   and its commodities with every price ruled off, the figures in a column of their own. */
.filters { background: var(--soft); padding-top: 10px; padding-bottom: 10px; }
.filters .chips { flex: 0 1 auto; }
.filters select { padding: 4px 8px; font-size: 13px; border-radius: 99px; border-color: var(--line-strong); width: 104px; }
.filters select.on { width: auto; max-width: 240px; }
.filters select.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.filters label.check { margin-left: auto; }
label.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.ledger h3.day {
  position: sticky; top: 0; z-index: 2; margin: 0; padding: 9px 18px; font-size: 13px; font-weight: 700; color: var(--ink);
  background: var(--wash); border-bottom: 1px solid var(--line); border-top: 1px solid var(--line);
}
.ledger h3.day:first-child { border-top: 0; }
.ledger h3.day small { font-weight: 400; color: var(--muted); margin-left: 10px; font-size: 13px; }
.entry {
  display: grid; grid-template-columns: 64px minmax(170px, 250px) minmax(0, 1fr); gap: 4px 18px;
  padding: 14px 18px 16px; border-bottom: 1px solid var(--line); transition: background var(--quick);
}
.entry:hover { background: var(--hover); }
.entry:last-of-type { border-bottom: 0; }
.rtime { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 1px; }
.rtime small { display: block; font-size: 11px; color: var(--warn); }
.rsrc { display: flex; align-items: flex-start; min-width: 0; }
.rsrc button.x { margin: -3px 4px 0 -8px; font-size: 12px; }
.rsrc b { display: block; font-weight: 600; overflow-wrap: anywhere; }
.rsrc small { display: block; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.rsrc small.tel { font-variant-numeric: tabular-nums; }
.rbody { min-width: 0; }
.rblock + .rblock { margin-top: 16px; }
.rhead { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.rhead b { font-weight: 700; }
.hi { color: var(--muted); }
.rhead .arr { color: var(--muted); font-size: 13px; }
.rhead .arr + .arr::before { content: "· "; }
/* How a price moved: green with an arrow up, red with an arrow down. In a block's heading it sits at the
   right edge, where the eye lands after the name. */
.delta {
  display: inline-block; padding: 1px 10px; border-radius: 99px; font-size: 13px; font-weight: 700; white-space: nowrap;
  font-variant-numeric: tabular-nums; cursor: default;
}
.delta.up { color: #17692f; background: #dcefdf; }
.delta.down { color: var(--bad); background: var(--bad-wash); }
.delta.flat { color: var(--muted); background: var(--soft); font-weight: 600; }
.rhead .move { margin-left: auto; display: inline-flex; align-items: baseline; gap: 8px; }
.rhead .move small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.rhead .delta { font-size: 14.5px; padding: 2px 12px; }
.rline { margin: 1px 0 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.rnote { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
/* Prices flow into as many columns as fit, each row ruled off under its words and its figure. */
.prices { margin: 6px 0 0; columns: 300px 3; column-gap: 36px; }
.pr { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 3px 0; border-bottom: 1px dotted var(--line-strong); break-inside: avoid; }
.pr dt { min-width: 0; overflow-wrap: anywhere; }
.pr dt b { font-weight: 600; }
.pr dt small { margin-left: 7px; color: var(--muted); font-size: 12px; }
.pr dd { margin: 0; display: flex; align-items: baseline; justify-content: flex-end; gap: 10px; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
/* In a list the change has a column of its own after the price, so the prices stay in line. */
.pr dd .slot { min-width: 122px; text-align: right; }
.pr dd .delta { font-size: 12px; padding: 0 8px; }
/* What a lot actually sold at is the figure looked for first: it sits on the accent. */
.pr.sold .fig { background: var(--gold); color: var(--ink); padding: 0 9px; margin-right: -9px; border-radius: 99px; }
.pr.sold.none .fig { background: none; }
.pr.none .fig { color: var(--muted); font-weight: 400; }
.prices.gist { columns: 420px 2; }
.prices.list { columns: 400px 2; }   /* wider columns: each line also carries its change */
.gist .pr dt small { margin-left: 10px; font-size: 13px; }
.psub { margin: 12px 0 2px; font-size: 13px; font-weight: 700; color: var(--text); break-after: avoid; }
.psub:first-child { margin-top: 0; }
.pterm { padding: 2px 0 5px; color: var(--muted); font-size: 12.5px; break-inside: avoid; }
.pterm b { font-weight: 600; }
button.more { display: block; margin-top: 10px; text-align: left; white-space: normal; }
.terms { border: 1px solid var(--line); display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 28px; margin-top: 10px; padding: 12px 14px; background: var(--soft); border-radius: 8px; font-size: 13px; }
.terms h4 { margin: 0 0 2px; font-size: 12.5px; font-weight: 700; }
.terms ul { margin: 0; padding: 0; list-style: none; color: var(--muted); }
.terms li { overflow-wrap: anywhere; }
.rtext { grid-column: 3; margin-top: 10px; padding: 12px 14px; background: var(--bubble); color: var(--bubble-ink); border-radius: 0 8px 8px 8px; max-width: 520px; box-shadow: 0 1px 1px rgb(14 20 51 / .16); }
.rtext small { display: block; font-size: 12px; opacity: .7; margin-bottom: 4px; }
.rtext pre { margin: 0; font: inherit; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.foot label { display: inline-flex; align-items: center; gap: 8px; }
.foot input[type="text"] { padding: 4px 8px; font-size: 13px; width: 170px; }
@media (max-width: 760px) {
  .entry { grid-template-columns: 52px minmax(0, 1fr); padding: 12px; }
  .rbody, .rtext { grid-column: 1 / -1; }
  .filters label.check { margin-left: 0; }
}

/* ---------- price analysis ---------- */
/* A table, because there are more sellers and grades than colours could tell apart: one row per grade,
   with its latest price, how it moved over a week and a month, and a small line of the last 30 days. */
.bar label select { margin-left: 6px; padding: 5px 9px; font-size: 14px; color: var(--text); }
.basis { margin: 0; padding: 9px 18px; border-bottom: 1px solid var(--line); background: var(--soft); }
table.analysis th, table.analysis td { padding: 9px 14px; vertical-align: middle; }
table.analysis thead th { padding-top: 11px; padding-bottom: 11px; vertical-align: bottom; }
table.analysis tbody th { font-size: 14px; font-weight: 400; color: var(--text); white-space: normal; min-width: 170px; }
table.analysis tbody th small, table.analysis td small { margin-left: 8px; color: var(--muted); font-size: 12px; }
table.analysis tr.seller th { background: var(--wash); color: var(--ink); font-weight: 700; padding-top: 8px; padding-bottom: 8px; }
table.analysis .fig { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.analysis td.fig { font-weight: 600; }
table.analysis td.fig small { font-weight: 400; }
table.analysis tbody tr:not(.seller):hover > * { background: var(--hover); }
table.analysis tbody tr:last-child > * { border-bottom: 0; }
.spark { display: block; overflow: visible; }
.spark .line { fill: none; stroke: #a3aca2; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark .dot { fill: #a3aca2; }
.spark .now { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.spark .hit { fill: transparent; }
/* ---------- sign-in page ---------- */
body.signin { display: grid; place-items: center; padding: 24px; }
body.signin main { width: min(360px, 100%); }
body.signin h1 { display: flex; align-items: center; gap: 10px; margin: 0; padding: 20px 18px 0; font: 500 22px/1.2 var(--serif); color: var(--ink); }
body.signin .form input { width: 100%; margin-bottom: 0; padding: 9px 12px; }
body.signin .row button { width: 100%; padding: 10px 16px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
