/* Joe QR — styling follows BRAND GUIDE - Final (2026-06-22).
   Compact, dense tables; Archivo Black for headings only. */

:root {
  --golden-roast: #b88917;
  --paper-cream: #fef8ec;
  --moss: #4d502c;
  --grove: #252610;
  --espresso: #000000;
  --charcoal: #2e2e2e;
  --stone: #7c7c7c;
  --steam: #f7f7f7;
  --white: #ffffff;
  --line: #e4e0d6;
  --danger: #a3341f;
  --radius: 8px;
}

* { box-sizing: border-box; }

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

h1, h2, h3, .brandmark {
  font-family: "Archivo Black", "Archivo", Helvetica, Arial, sans-serif;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--grove);
  margin: 0 0 .5rem;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; color: var(--stone); }

a { color: var(--moss); }
a:hover { color: var(--golden-roast); }

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

header.topbar {
  background: var(--charcoal);
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: .6rem 1.25rem;
}
header.topbar .brandmark { color: var(--white); font-size: 1.05rem; margin: 0; }
header.topbar nav { display: flex; gap: 1rem; margin-left: auto; align-items: center; }
header.topbar nav a { color: var(--steam); text-decoration: none; font-size: .9rem; }
header.topbar nav a:hover, header.topbar nav a.on { color: var(--golden-roast); }
header.topbar .who { color: var(--stone); font-size: .82rem; }

main { max-width: 1180px; margin: 0 auto; padding: 1.25rem; }

.page-head { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; }
.page-head .grow { flex: 1; }
.sub { color: var(--stone); font-size: .88rem; margin: 0; }

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

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: 1fr 1fr; }
.grid.side { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
@media (max-width: 860px) { .grid.two, .grid.side { grid-template-columns: 1fr; } }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--stone); font-weight: 700; }
tbody tr:hover { background: var(--steam); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* Clip long URLs on wide screens, where the full value is one hover away.
   The phone rules below deliberately undo this — there is no hover there, so
   truncating would simply destroy the information. */
td.truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--stone); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }

/* --- controls ------------------------------------------------------------- */

label { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
        color: var(--stone); font-weight: 700; margin-bottom: .25rem; }
input[type=text], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: .45rem .6rem; border: 1px solid var(--line);
  border-radius: 6px; background: var(--white); color: var(--charcoal);
  font: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--golden-roast); outline-offset: -1px; }
textarea { min-height: 150px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
.field { margin-bottom: .85rem; }
.row { display: flex; gap: .75rem; }
.row > * { flex: 1; }

.btn {
  display: inline-block; padding: .45rem .9rem; border-radius: 6px; border: 1px solid transparent;
  background: var(--grove); color: var(--white); font-weight: 600; font-size: .88rem;
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--moss); color: var(--white); }
.btn.secondary { background: var(--white); color: var(--grove); border-color: var(--line); }
.btn.secondary:hover { background: var(--steam); color: var(--grove); }
.btn.gold { background: var(--golden-roast); color: var(--grove); }
.btn.danger { background: var(--white); color: var(--danger); border-color: var(--danger); }
.btn.small { padding: .25rem .6rem; font-size: .8rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* Print-only actions are visually separated from anything that changes state. */
.actions.print-only { padding-top: .6rem; margin-top: .6rem; border-top: 1px dashed var(--line); }

.pill { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .72rem;
        font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.pill.live { background: #e7efe0; color: var(--moss); }
.pill.paused { background: #f3e6c9; color: #7a5c0e; }
.pill.archived { background: var(--steam); color: var(--stone); }

/* --- flash ---------------------------------------------------------------- */

.flash { padding: .6rem .9rem; border-radius: 6px; margin-bottom: .75rem; font-size: .9rem; }
.flash.ok { background: #e7efe0; color: var(--moss); border: 1px solid #c9d8ba; }
.flash.error { background: #f7e4df; color: var(--danger); border: 1px solid #e3bfb6; }

/* --- QR preview ----------------------------------------------------------- */

.preview { text-align: center; }
.preview img { width: 100%; max-width: 280px; height: auto; border-radius: var(--radius); }
.swatches { display: flex; flex-wrap: wrap; gap: .4rem; }
.swatch { border: 2px solid var(--line); border-radius: 6px; padding: .25rem; cursor: pointer;
          display: flex; align-items: center; gap: .35rem; background: var(--white); font-size: .78rem; }
.swatch.on { border-color: var(--golden-roast); }
.swatch i { width: 18px; height: 18px; border-radius: 4px; display: block; border: 1px solid var(--line); }

/* --- chart ---------------------------------------------------------------- */

.bars { display: flex; align-items: flex-end; gap: 2px; height: 110px; padding-top: .5rem; }
.bars .bar { flex: 1; background: var(--golden-roast); border-radius: 2px 2px 0 0; min-height: 1px; }
.bars .bar.zero { background: var(--line); }
.chart-axis { display: flex; justify-content: space-between; font-size: .72rem; color: var(--stone); margin-top: .3rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: .75rem; }
.stat { background: var(--steam); border-radius: var(--radius); padding: .6rem .75rem; }
.stat .n { font-family: "Archivo Black", Helvetica, Arial, sans-serif; font-size: 1.5rem; color: var(--grove); line-height: 1.1; }
.stat .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--stone); font-weight: 700; }

.meter { background: var(--steam); border-radius: 4px; height: 8px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--moss); }

/* --- public pages --------------------------------------------------------- */

.public { max-width: 460px; margin: 12vh auto; text-align: center; padding: 1.25rem; }
.public img.logo { width: 84px; height: 84px; }

/* --- phones ----------------------------------------------------------------
   Staff use this on the floor, phone in hand, often one-handed. Dense tables
   are right on a desktop and wrong here: below 720px every `table.stack`
   becomes a list of cards, with the column header shown as a label on each
   value so nothing depends on a header row that has scrolled away. */

@media (max-width: 720px) {

  main { padding: .85rem; }

  header.topbar { flex-wrap: wrap; gap: .4rem .85rem; padding: .55rem .85rem; }
  header.topbar .brandmark { font-size: 1rem; }
  header.topbar nav {
    margin-left: 0;
    width: 100%;
    gap: .9rem;
    flex-wrap: wrap;
    row-gap: .35rem;
  }
  /* The signed-in address is reference information, not navigation — it goes
     last so the actual links stay within thumb reach. */
  header.topbar .who {
    order: 10;
    width: 100%;
    font-size: .72rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .page-head { flex-wrap: wrap; }
  .page-head .btn { width: 100%; text-align: center; }

  h1 { font-size: 1.3rem; }

  /* Stack multi-field rows; a three-across filter bar is unusable at 390px. */
  .row { flex-direction: column; gap: .5rem; }
  .row > * { width: 100%; }

  /* 16px minimum stops iOS zooming the whole page in on focus. */
  input[type=text], input[type=url], input[type=search], select, textarea { font-size: 16px; }

  .card { padding: .85rem; }

  /* An empty spacer label only exists to align buttons with inputs on a wide
     screen; on a phone it is dead vertical space. */
  .keep-inline .sr-hide { display: none; }

  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: .7rem .8rem;
    margin-bottom: .6rem;
  }
  table.stack tr:hover { background: none; }
  table.stack td {
    border: none;
    padding: .22rem 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
    text-align: right;
  }
  table.stack td::before {
    content: attr(data-label);
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--stone);
    font-weight: 700;
    flex: 0 0 auto;
    text-align: left;
  }
  /* The row's headline: full width, no label, left aligned. */
  table.stack td.lead {
    display: block;
    text-align: left;
    font-size: 1rem;
    padding-bottom: .4rem;
    margin-bottom: .3rem;
    border-bottom: 1px solid var(--line);
  }
  table.stack td.lead::before { display: none; }
  table.stack td.cta { display: block; text-align: left; padding-top: .5rem; }
  table.stack td.cta::before { display: none; }
  table.stack td.cta .btn { width: 100%; text-align: center; }
  /* Long URLs wrap instead of being clipped — on a phone there is no hover to
     reveal the rest, so truncation would simply lose the information. */
  table.stack td.wrap { display: block; text-align: left; overflow: visible; white-space: normal; }
  table.stack td.wrap::before { display: block; margin-bottom: .1rem; }
  table.stack td.wrap a { word-break: break-all; }
  table.stack td:empty { display: none; }

  /* Definition-style tables (Details, role explanations) keep two columns but
     lose the fixed widths that squeeze them. */
  table.pairs th, table.pairs td { display: block; width: 100%; }
  table.pairs th { border-bottom: none; padding-bottom: 0; }
  table.pairs td { padding-top: .1rem; }

  .stats { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .stat .n { font-size: 1.3rem; }

  .preview img { max-width: 240px; }

  .actions .btn { flex: 1 1 auto; text-align: center; }
}

/* Very narrow phones — keep two stat tiles per row but tighten everything. */
@media (max-width: 380px) {
  header.topbar nav { gap: .7rem; font-size: .85rem; }
  .stats { gap: .4rem; }
  .stat { padding: .45rem .55rem; }
}
