/* =============================================================================
   Meep :: Layer 5 (WEB UI)

   Plain stylised HTML. Mobile first: everything below is written for a phone,
   and the one media query at 760px widens it for a desk or a shop display.

   Almost no colour on purpose. White ground, a few greys for structure, one
   ink tone for text and links. Status is the only thing allowed a hue, and
   only as a small dot, so the thing that carries meaning is the thing that
   stands out. This follows "visual meaning" in the product brief without
   turning the page into a dashboard of competing colours.
   ============================================================================= */

:root {
  --ink: #1b1b1b;
  --ink-soft: #444;
  --muted: #6e6e6e;
  --line: #dcdcdc;
  --line-strong: #b9b9b9;
  --panel: #f6f6f6;
  --panel-deep: #ededed;
  --white: #fff;

  /* The only hues in the system. Muted on purpose. */
  --dot-grey: #9a9a9a;
  --dot-blue: #3d6b9c;
  --dot-green: #4a7c52;
  --dot-amber: #a8792c;
  --dot-red: #a2453d;

  --radius: 4px;
  --gap: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font: 16px/1.5 var(--font);
}

/* --- structure ----------------------------------------------------------- */

.wrap { padding: 0 14px 56px; max-width: 1180px; margin: 0 auto; }

header.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
}

.bar-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 1180px;
  margin: 0 auto;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 15px;
  color: var(--ink);
  text-decoration: none;
}

.brand span { color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }

.bar nav { display: flex; gap: 14px; flex-wrap: wrap; margin-left: auto; align-items: center; }
.bar nav a { font-size: 14px; }

.who { font-size: 13px; color: var(--muted); }

/* --- typography ---------------------------------------------------------- */

h1 { font-size: 22px; margin: 20px 0 4px; font-weight: 600; }
h2 { font-size: 17px; margin: 24px 0 8px; font-weight: 600; }
h3 { font-size: 14px; margin: 16px 0 6px; font-weight: 600; text-transform: uppercase;
     letter-spacing: 0.05em; color: var(--muted); }

p { margin: 8px 0; }
a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: #000; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: 13px; }
.lede { font-size: 17px; color: var(--ink-soft); max-width: 62ch; }

/* --- panels and cards ---------------------------------------------------- */

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 12px 0;
}

.card.tinted { background: var(--panel); }
.card.narrow { max-width: 420px; margin: 48px auto; }

.centred { display: block; }

.grid { display: grid; gap: var(--gap); grid-template-columns: 1fr; }

.rows > * + * { margin-top: 8px; }

.split { display: flex; gap: var(--gap); flex-wrap: wrap; align-items: flex-start; }
.split > * { flex: 1 1 260px; min-width: 0; }

/* --- the Magic Click counters -------------------------------------------- */

.counters { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }

.counter {
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  text-decoration: none;
  background: var(--white);
  color: var(--ink);
}

.counter:hover { background: var(--panel); border-color: var(--line-strong); }

.counter .n { font-size: 24px; font-weight: 600; line-height: 1.1; display: block; }
.counter .l { font-size: 12px; color: var(--muted); display: block; margin-top: 2px; }

.counter.exception { background: var(--panel-deep); border-color: var(--line-strong); }

/* --- status dots --------------------------------------------------------- */

.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--dot-grey);
  margin-right: 6px;
  vertical-align: baseline;
  flex: none;
}

.dot.blue { background: var(--dot-blue); }
.dot.green { background: var(--dot-green); }
.dot.amber { background: var(--dot-amber); }
.dot.red { background: var(--dot-red); }
.dot.grey { background: var(--dot-grey); }

.pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 9px 1px 7px;
  font-size: 12px;
  background: var(--white);
  white-space: nowrap;
}

.pill.flat { border: 0; padding-left: 0; background: none; }

/* --- lists --------------------------------------------------------------- */

.list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list > * + * { border-top: 1px solid var(--line); }

.row {
  display: block;
  padding: 11px 12px;
  text-decoration: none;
  color: inherit;
  background: var(--white);
}

a.row:hover { background: var(--panel); }

.row .top { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.row .title { font-weight: 500; }
.row .meta { font-size: 12px; color: var(--muted); margin-top: 3px;
             display: flex; gap: 10px; flex-wrap: wrap; }

.row.dim { background: var(--panel); }
.row.dim .title { color: var(--muted); }

.code { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* --- tables (wide screens; they scroll on a phone) ----------------------- */

.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
tbody tr:hover { background: var(--panel); }

/* --- forms --------------------------------------------------------------- */

label { display: block; font-size: 13px; color: var(--ink-soft); margin: 10px 0 3px; font-weight: 500; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 16px;            /* 16px stops iOS zooming on focus */
}

textarea { min-height: 80px; resize: vertical; }

input:focus, select:focus, textarea:focus, button:focus, .counter:focus, a:focus {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

.field-note { font-size: 12px; color: var(--muted); margin-top: 3px; }

button, .button {
  display: inline-block;
  padding: 9px 14px;
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  background: var(--ink);
  color: var(--white);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

button:hover, .button:hover { background: #000; color: var(--white); }

button.secondary, .button.secondary {
  background: var(--white);
  color: var(--ink);
  border-color: var(--line-strong);
}
button.secondary:hover, .button.secondary:hover { background: var(--panel); color: var(--ink); }

button.small, .button.small { padding: 5px 10px; font-size: 13px; }

button:disabled { opacity: 0.45; cursor: not-allowed; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* --- status transition buttons: the one- and two-click path -------------- */

.moves { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.moves button { background: var(--white); color: var(--ink); border-color: var(--line-strong); }
.moves button:hover { background: var(--panel-deep); color: var(--ink); }

/* --- messages ------------------------------------------------------------ */

.note {
  border: 1px solid var(--line-strong);
  border-left-width: 3px;
  background: var(--panel);
  padding: 9px 11px;
  border-radius: var(--radius);
  font-size: 14px;
  margin: 10px 0;
}

.note.bad { border-left-color: var(--dot-red); }
.note.good { border-left-color: var(--dot-green); }
.note[hidden] { display: none; }

.empty { padding: 28px 14px; text-align: center; color: var(--muted); font-size: 14px; }

/* --- history ------------------------------------------------------------- */

.timeline { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.timeline li { padding: 7px 0 7px 14px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before {
  content: ""; position: absolute; left: -5px; top: 14px;
  width: 8px; height: 8px; background: var(--line-strong); border-radius: 50%;
}
.timeline .when { color: var(--muted); font-size: 12px; }

/* --- search -------------------------------------------------------------- */

.searchbar { display: flex; gap: 8px; margin: 12px 0; }
.searchbar input { flex: 1; }

/* --- utility ------------------------------------------------------------- */

.hide { display: none !important; }
.right { margin-left: auto; }
.nowrap { white-space: nowrap; }
.stack > * + * { margin-top: 14px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

.badge {
  display: inline-block; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.05em; border: 1px solid var(--line-strong);
  border-radius: 3px; padding: 1px 5px; color: var(--muted);
}

.impersonating {
  background: var(--panel-deep);
  border-bottom: 1px solid var(--line-strong);
  padding: 7px 14px;
  font-size: 13px;
}

/* --- wider screens ------------------------------------------------------- */

@media (min-width: 760px) {
  body { font-size: 15px; }
  .wrap { padding: 0 24px 64px; }
  h1 { font-size: 26px; margin-top: 26px; }
  .counters { grid-template-columns: repeat(4, 1fr); }
  .grid.two { grid-template-columns: 3fr 2fr; }
  .grid.three { grid-template-columns: repeat(3, 1fr); }
  .row .meta { gap: 16px; }
  input[type=text], input[type=email], input[type=password], input[type=number],
  input[type=search], select, textarea { font-size: 15px; }
}

@media (min-width: 1100px) {
  .counters { grid-template-columns: repeat(6, 1fr); }
}

/* --- print --------------------------------------------------------------- */

@media print {
  header.bar, .actions, .moves, .searchbar { display: none; }
  .card { border-color: #999; break-inside: avoid; }
}
