/* ============================================================================
   tagyra admin

   A different instrument from the passport, deliberately.

   The passport is read once, by a customer, in a moment of ceremony. This is
   used every working day by someone with fifty boxes and fifty rings in front
   of them, pairing one to the other. So: fast, keyboard-first, and quiet
   enough to stare at for an hour.

   Quiet luxury rather than dense tooling, since the 2026-09 redesign: a dark
   sidebar against a warm ivory page, a serif reserved for titles and figures,
   champagne used for state and never for decoration. Identifiers stay
   monospace — serials and UIDs are read character by character and must align
   in a column — but dates and counts do not, because monospace on a date only
   makes it look like a machine wrote it.

   No white-label here. This is tagyra's own surface, so the palette is fixed.

   TOKENS KEEP THEIR OLD NAMES ON PURPOSE. --paper, --ink, --rule and the rest
   are referenced from every view in app.js; changing the values and keeping
   the names re-skinned the whole portal without touching a line of markup,
   which is the difference between a redesign and a rewrite.
   ========================================================================= */

:root {
  /* Surfaces. --paper is the page, --card is what sits on it. */
  --paper:      #f4f1ec;
  --card:       #fbfaf7;
  --sidebar:    #181715;
  --sidebar-2:  #24221f;   /* hover */
  --sidebar-3:  #2c2925;   /* active */

  --ink:        #201f1c;
  --ink-2:      #716d66;
  --ink-3:      #9a958c;
  --on-dark:    #f5f1ea;
  --on-dark-2:  #afa99f;

  --rule:       #ded9d1;
  --rule-2:     #e9e5df;

  /* Champagne. State and emphasis, never decoration. */
  --accent:     #a9875a;
  --accent-2:   #8e7049;
  --accent-bg:  #eee4d5;

  --ok:         #3d6c4c;
  --ok-bg:      #e7efe9;
  --warn:       #866d3d;
  --warn-bg:    #f2ece0;
  --danger:     #8a4c45;
  --danger-bg:  #f3e7e4;
  --neutral-bg: #ece9e3;

  --mono:  "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans:  "Inter", system-ui, -apple-system, sans-serif;
  /* Titles and figures only. Never in a table: a serif digit in a column of
     serials is harder to scan, and scanning is what this page is for. */
  --serif: "Instrument Serif", "Cormorant Garamond", Georgia, serif;

  --r:     6px;    /* the old name, now the small radius */
  --r-md:  10px;
  --r-lg:  12px;

  --shadow: 0 1px 2px rgba(32, 31, 28, .04);

  --sidebar-w: 248px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.boot { padding: 64px; color: var(--ink-3); text-align: center; }

/* ------------------------------------------------------------------- shell */

/* Two columns: a dark rail that never moves, and the work. The contrast
   between them is the whole design — it is what stops this reading as a
   generic admin panel, and it costs nothing at runtime. */

.shell { display: flex; min-height: 100vh; }

.side {
  position: sticky; top: 0; align-self: flex-start;
  flex: 0 0 var(--sidebar-w); width: var(--sidebar-w); height: 100vh;
  display: flex; flex-direction: column;
  padding: 22px 16px;
  background: var(--sidebar); color: var(--on-dark);
}

.side__brand {
  display: flex; align-items: center; gap: 9px;
  padding: 0 8px 20px;
  font: 400 19px/1 var(--serif); letter-spacing: .04em;
  color: var(--on-dark);
}

/* The environment badge is not decoration. An operator who cannot tell dev
   from production will eventually edit the wrong database — so it stays
   visible, just quieter than it was: an outline instead of a block of colour. */
.env {
  font: 500 9.5px/1 var(--sans);
  letter-spacing: .12em; text-transform: uppercase;
  padding: 3px 6px; border-radius: 3px;
  border: 1px solid currentColor; background: transparent;
}
.env--dev { color: var(--on-dark-2); }
.env--production { color: #d9a2a2; }

/* ------------------------------------------------------ tenant switcher */

.tenant { margin-bottom: 22px; }
.tenant__label {
  display: block; padding: 0 8px 6px;
  font: 500 9.5px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase;
  color: var(--on-dark-2);
}
.tenant__box {
  position: relative;
  border: 1px solid #33302c; border-radius: var(--r);
  background: var(--sidebar-2);
}
.tenant__box::after {
  content: ""; position: absolute; right: 12px; top: 50%;
  width: 7px; height: 7px; margin-top: -5px; pointer-events: none;
  border-right: 1.5px solid var(--on-dark-2); border-bottom: 1.5px solid var(--on-dark-2);
  transform: rotate(45deg);
}
/* The select keeps doing the work; only its skin changes. A custom dropdown
   would mean re-implementing keyboard behaviour that already works. */
.tenantpick {
  appearance: none; -webkit-appearance: none;
  width: 100%; padding: 9px 30px 9px 11px;
  border: 0; background: transparent; color: var(--on-dark);
  font: 500 13.5px/1.2 var(--sans); cursor: pointer;
  max-width: none; border-radius: var(--r);
}
.tenantpick:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tenantpick option { color: var(--ink); background: var(--card); }
/* One tenant: no control, just the name. */
.tenant__one { padding: 9px 11px; font-weight: 500; font-size: 13.5px; }

/* ------------------------------------------------------------------- nav */

.nav { display: flex; flex-direction: column; gap: 1px; }
.nav a {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r);
  color: var(--on-dark-2); text-decoration: none;
  font-size: 13.5px; line-height: 1.2;
  transition: background 130ms, color 130ms;
}
.nav a svg { flex: 0 0 auto; width: 17px; height: 17px; opacity: .85; }
.nav a:hover { background: var(--sidebar-2); color: var(--on-dark); }
.nav a[aria-current] { background: var(--sidebar-3); color: var(--on-dark); }
/* The champagne edge marks the page you are on. It is the only place the
   accent appears in the rail. */
.nav a[aria-current]::before {
  content: ""; position: absolute; left: -16px; top: 6px; bottom: 6px;
  width: 2px; background: var(--accent); border-radius: 0 2px 2px 0;
}
.nav a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* --------------------------------------------------------------- account */

.who {
  margin-top: auto; padding-top: 18px;
  border-top: 1px solid #2b2825;
  display: flex; align-items: center; gap: 10px;
}
.who__id { min-width: 0; flex: 1 1 auto; }
.who__mail {
  display: block; font-size: 12px; color: var(--on-dark);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.who__role { display: block; font-size: 11px; color: var(--on-dark-2); margin-top: 1px; }
.who .b--ghost {
  color: var(--on-dark-2); border-color: #33302c; background: transparent;
  padding: 6px 9px;
}
.who .b--ghost:hover { background: var(--sidebar-2); color: var(--on-dark); }

/* --------------------------------------------------------------- content */

.main { flex: 1 1 auto; min-width: 0; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 44px 48px 96px; }

/* ----------------------------------------------------------- page header */

.ph { margin-bottom: 30px; }
.ph__bar { display: flex; align-items: flex-start; gap: 20px; }
.ph h1 { flex: 1 1 auto; }
.ph__acts { flex: 0 0 auto; display: flex; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- metrics */

.metrics {
  display: grid; gap: 16px; margin-bottom: 26px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.metric {
  padding: 18px 20px;
  background: var(--card); border: 1px solid var(--rule);
  border-radius: var(--r-md); box-shadow: var(--shadow);
}
.metric__label {
  font: 500 10.5px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3);
}
.metric__value {
  font: 400 32px/1.05 var(--serif); color: var(--ink);
  margin-top: 10px; font-variant-numeric: tabular-nums;
}
.metric__note { font-size: 12px; color: var(--ink-2); margin-top: 5px; }

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

.search { position: relative; flex: 1 1 280px; }
.search svg {
  position: absolute; left: 13px; top: 50%; margin-top: -8px;
  width: 16px; height: 16px; color: var(--ink-3); pointer-events: none;
}
.search input {
  width: 100%; height: 43px; padding: 0 14px 0 38px;
  border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--card); color: var(--ink); font: inherit;
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}

/* ------------------------------------------------------------ inline note */

/* For the sentence a page needs to say once and never repeat. */
.note {
  display: flex; gap: 10px; align-items: flex-start;
  margin-top: 18px; padding: 13px 15px;
  background: var(--neutral-bg); border-radius: var(--r-md);
  font-size: 12.5px; line-height: 1.6; color: var(--ink-2);
}
.note svg { flex: 0 0 auto; width: 15px; height: 15px; margin-top: 1px; color: var(--ink-3); }

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

/* The serif carries the page title and the figures, and nothing else. Used
   more widely it would slow the page down to read; used here it is what makes
   the portal feel like it belongs to a maison. */
h1 {
  font: 400 34px/1.1 var(--serif);
  margin: 0 0 6px; letter-spacing: 0;
}
h2 { font-size: 17px; font-weight: 500; margin: 0 0 14px; letter-spacing: -.01em; }
.sub { color: var(--ink-2); font-size: 14px; line-height: 1.6; margin: 0 0 24px; max-width: 66ch; }
.ph .sub { margin-bottom: 0; }

.mono { font-family: var(--mono); font-size: 12.5px; }

/* --------------------------------------------------------------------- card */

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.card--tight { padding: 0; }

.row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }
.row > .shrink { flex: 0 0 auto; }

/* ------------------------------------------------------------------- fields */

.f { display: block; margin-bottom: 14px; }
.f > span {
  display: block; margin-bottom: 5px;
  font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--ink-3);
}
.f input, .f select, .f textarea,
/* The document row's fields sit in a flex row rather than in a .f label, but
   they are the same control and must not look like a different one. */
.docrow__title, .docrow__loc {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--card); color: var(--ink);
  font: inherit;
}
.f textarea { min-height: 80px; resize: vertical; line-height: 1.55; }
.f input.mono, .f--mono input { font-family: var(--mono); }
.f input:focus, .f select:focus, .f textarea:focus,
.docrow__title:focus, .docrow__loc:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg);
}

/* A list of checkboxes standing in for <select multiple>, which on macOS needs
   Cmd+click to add a second item and therefore reads as "only one allowed". */
.picks {
  border: 1px solid var(--rule);
  border-radius: var(--r);
  max-height: 210px;
  overflow-y: auto;
  padding: 4px;
}
.pick {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: var(--r);
  cursor: pointer;
  font-size: 13.5px;
}
.pick:hover { background: var(--rule-2); }
.pick input { width: 16px; height: 16px; flex: 0 0 auto; margin: 0; }
.pick:has(input:checked) { background: var(--accent-bg); }
.f--hint { font-size: 11px; color: var(--ink-3); margin-top: 4px; }

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

.b {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 10px 16px; border-radius: var(--r);
  border: 1px solid var(--ink); background: var(--ink); color: #fff;
  font: 500 13px/1 var(--sans); cursor: pointer;
  transition: background 130ms, border-color 130ms, color 130ms;
}
/* A link that looks like a button: the staff-hint switch navigates to the
   passport origin, because only that origin can set its own cookie. */
a.b { text-decoration: none; }
.b:hover { background: #35322d; border-color: #35322d; }
.b:disabled { opacity: 0.35; cursor: default; }
.b:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.b--ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.b--ghost:hover { background: var(--rule-2); border-color: var(--rule); color: var(--ink); }
.b--accent { background: var(--accent); border-color: var(--accent); }
.b--accent:hover { background: var(--accent-2); border-color: var(--accent-2); }
.b--danger { background: var(--danger); border-color: var(--danger); }
.b--danger:hover { background: #74403a; border-color: #74403a; }
.b--sm { min-height: 32px; padding: 6px 11px; font-size: 12px; }

/* A row action is a destination, not a button. Chevron included so it reads
   as "opens something" without a box around every line of the table. */
.b--row {
  min-height: 30px; padding: 5px 4px; gap: 5px;
  background: transparent; border-color: transparent; color: var(--ink-2);
  font-size: 12.5px;
}
.b--row:hover { background: transparent; color: var(--accent); }
.b--row svg { width: 13px; height: 13px; }

/* ------------------------------------------------------------------- table */

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 12px 16px;
  font-size: 10.5px; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--ink-2); font-weight: 500;
  border-bottom: 1px solid var(--rule);
  background: var(--neutral-bg);
}
th:first-child { border-top-left-radius: var(--r-md); }
th:last-child  { border-top-right-radius: var(--r-md); }
td {
  padding: 15px 16px; border-bottom: 1px solid var(--rule-2);
  vertical-align: middle;
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f7f4ef; }
/* Right-aligned and tabular, but NOT monospace: a date in monospace only
   looks like a machine printed it. Identifiers get .mono, figures get this. */
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

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

.pill {
  display: inline-flex; align-items: center;
  font: 600 10px/1 var(--sans);
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 5px 9px; border-radius: 999px;
  background: var(--neutral-bg); color: var(--ink-2);
}
.pill--provisioned { background: var(--rule-2); color: var(--ink-3); }
.pill--encoded     { background: var(--accent-bg); color: var(--accent); }
.pill--assigned    { background: var(--warn-bg); color: var(--warn); }
.pill--activated   { background: var(--ok-bg); color: var(--ok); }
.pill--stolen,
.pill--void        { background: var(--danger-bg); color: var(--danger); }
.pill--draft       { background: var(--rule-2); color: var(--ink-3); }
.pill--published   { background: var(--ok-bg); color: var(--ok); }
.pill--retired     { background: var(--rule-2); color: var(--ink-3); }

/* ------------------------------------------------------------------ notices */

.msg {
  padding: 13px 16px; border-radius: var(--r-md);
  border: 1px solid; font-size: 13px; margin-bottom: 18px;
}
.msg--ok    { background: var(--ok-bg);     border-color: #cfe0d5; color: var(--ok); }
.msg--err   { background: var(--danger-bg); border-color: #e6cfc9; color: var(--danger); }
.msg--info  { background: var(--accent-bg); border-color: #e0d0b8; color: #6f5836; }

.empty { padding: 56px 24px; text-align: center; color: var(--ink-3); font-size: 13.5px; }

/* --------------------------------------------------------------- pair view */

/* The daily loop gets the most room and the least chrome: type a serial,
   pick a product, record the stone, save, next. Everything else is upkeep. */
.pair { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 860px) { .pair { grid-template-columns: 340px 1fr; } }

.pair__found {
  padding: 12px 14px; border-radius: var(--r);
  background: var(--paper); border: 1px solid var(--rule);
  font-family: var(--mono); font-size: 12.5px; line-height: 1.7;
}
.pair__found b { font-weight: 500; color: var(--ink-3); font-size: 11px;
  letter-spacing: 0.06em; text-transform: uppercase; font-family: var(--sans); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.kv dt { color: var(--ink-3); font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; font-family: var(--sans); padding-top: 2px; }
.kv dd { margin: 0; font-family: var(--mono); font-size: 12.5px; }

/* ------------------------------------------------------------------ locales */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--rule); margin-bottom: 16px; }
.tabs button {
  padding: 7px 12px; border: 0; background: transparent; cursor: pointer;
  font: 500 12px/1 var(--mono); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* -------------------------------------------------------------------- login */

.login { max-width: 340px; margin: 14vh auto; }
.login h1 { text-align: center; margin-bottom: 6px; }
.login .sub { text-align: center; }

/* The brand mark. Sized by width, because the artwork is wider than it is tall
   once the transparent margin is cropped out, and the login card is 340px —
   width is the dimension that can run out. The file is 380px wide for the same
   reason a 2x asset exists at all: this is the first thing anyone sees.
   Transparent background, so it sits on --paper without a white box. */
.login__logo {
  display: block;
  width: 190px;
  height: auto;
  max-width: 100%;
  margin: 0 auto 10px;
}

.pairs-json { font-family: var(--mono); font-size: 12px; }

.right { text-align: right; }
.mt { margin-top: 16px; }
.muted { color: var(--ink-3); }

/* ============================================================================
   Added with the brand, media and tag-detail sections.
   ========================================================================= */

.tenantpick {
  padding: 5px 8px; border: 1px solid var(--rule); border-radius: var(--r);
  font: inherit; background: var(--card); color: var(--ink); max-width: 220px;
}

/* -------------------------------------------------------------- thumbnails */

.thumb {
  width: 40px; height: 40px; border-radius: 3px; object-fit: cover;
  border: 1px solid var(--rule); display: block; background: var(--paper);
}
/* Logos are usually transparent artwork on an odd aspect ratio: contain, not
   cover, or half the mark gets cropped away in the list. */
.thumb--logo { object-fit: contain; padding: 3px; }
.thumb--empty { background: repeating-linear-gradient(45deg,
  var(--paper), var(--paper) 4px, var(--rule-2) 4px, var(--rule-2) 8px); }

.warnflag {
  display: inline-block; margin-left: 6px;
  font: 500 10px/1 var(--mono); letter-spacing: .04em;
  padding: 3px 5px; border-radius: 3px;
  background: var(--warn-bg); color: var(--warn);
}

/* ------------------------------------------------------------------ gallery */

.gallery {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  margin-bottom: 12px;
}
.shot {
  margin: 0; position: relative; border: 1px solid var(--rule);
  border-radius: var(--r); overflow: hidden; background: var(--paper);
}
.shot img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.shot__badge {
  position: absolute; left: 6px; bottom: 6px;
  font: 500 9.5px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 6px; border-radius: 3px; background: var(--ink); color: var(--paper);
}
.shot__acts { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; }
.shot__acts .b { background: rgba(255,255,255,.94); border-color: var(--rule); }

.drop {
  display: flex; align-items: center; justify-content: center;
  padding: 18px; border: 1px dashed var(--rule); border-radius: var(--r);
  background: var(--paper); color: var(--ink-3); font-size: 13px;
  cursor: pointer; text-align: center;
}
.drop:hover { border-color: var(--ink-3); color: var(--ink-2); }
.drop--busy { opacity: .5; pointer-events: none; }

/* ------------------------------------------------- warranty documents */

/* One row per PDF: the mark, an editable title, the language it belongs to,
   a link that opens the file, and the two controls. The title and language are
   live inputs rather than a modal, because a document is two fields and a
   dialog for two fields is a dialog nobody wants twice. */
.docs { list-style: none; margin: 0 0 12px; padding: 0; }
.docrow {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--paper);
}
.docrow + .docrow { margin-top: 6px; }
.docrow__mark {
  flex: none; font: 500 9.5px/1 var(--mono); letter-spacing: .08em;
  padding: 5px 6px; border-radius: 3px; border: 1px solid var(--rule);
  color: var(--ink-2);
}
.docrow__title { flex: 1 1 200px; min-width: 0; width: auto; }
.docrow__loc { flex: 0 0 auto; width: auto; }
.docrow__link {
  flex: none; font: 400 11px/1 var(--mono); color: var(--ink-3);
  text-decoration: none; border-bottom: 1px solid var(--rule); padding-bottom: 2px;
}
.docrow__link:hover { color: var(--ink); }
/* A url the portal refuses to turn into a link: https only, same rule the
   passport applies twice. The row still shows, so the document can be removed. */
.docrow__link--bad { color: var(--danger); border-bottom-style: dotted; }
.docrow__acts { flex: none; display: flex; gap: 4px; }

@media (max-width: 40rem) {
  .docrow { flex-wrap: wrap; }
  .docrow__title { flex: 1 1 100%; order: -1; }
}

.logobox {
  flex: 0 0 auto; width: 150px; height: 84px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--rule); border-radius: var(--r); background: var(--card);
}
.logobox img { max-width: 86%; max-height: 72%; object-fit: contain; }

/* ------------------------------------------------------------ colour fields */

.colorrow { display: flex; gap: 8px; align-items: center; }
.colorrow input[type="color"] {
  width: 42px; height: 38px; padding: 2px; flex: 0 0 auto;
  border: 1px solid var(--rule); border-radius: var(--r);
  background: var(--card); cursor: pointer;
}
.colorrow input.mono { flex: 1 1 auto; }

/* ----------------------------------------------------------- theme preview */

/* Mirrors how the passport derives its scale: the muted tone below is mixed
   from the chosen text and surface colours, so a palette that fails here fails
   on the real page too. */
.pv {
  background: var(--s); color: var(--t);
  border: 1px solid var(--rule); border-radius: var(--r);
  padding: 26px 22px; max-width: 340px; text-align: center;
}
/* The brand mark, sized like .brand / .brand--logo on the passport: width
   leads and height is only a guard (web/app/globals.css explains why), scaled
   to this narrower box. */
.pv__brand {
  margin-bottom: 18px;
  font-size: 11px; letter-spacing: .28em; text-transform: uppercase;
  color: color-mix(in oklab, var(--t) 58%, var(--s));
}
.pv__brand--logo img {
  display: block; margin: 0 auto;
  width: 80%; height: auto; max-height: 160px; object-fit: contain;
}
.pv__name { font-size: 27px; line-height: 1.15; margin-bottom: 4px; }
.pv__sub {
  font-size: 13px; margin-bottom: 18px;
  color: color-mix(in oklab, var(--t) 58%, var(--s));
}
.pv__row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 7px 0; font-size: 12px;
  border-bottom: 1px solid color-mix(in oklab, var(--t) 12%, var(--s));
}
.pv__row span { color: color-mix(in oklab, var(--t) 45%, var(--s));
  text-transform: uppercase; letter-spacing: .1em; font-size: 10px; }
.pv__row b { font-family: var(--mono); font-weight: 400; }
.pv__muted {
  margin-top: 16px; font-size: 12px;
  color: color-mix(in oklab, var(--t) 55%, var(--s));
}

/* ------------------------------------------------------------------ columns */

.cols { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .cols { grid-template-columns: 1fr 1fr; } }

.pill--owner  { background: var(--accent-bg); color: var(--accent); }
.pill--editor { background: var(--ok-bg); color: var(--ok); }
.pill--viewer { background: var(--rule-2); color: var(--ink-3); }
.pill--active { background: var(--ok-bg); color: var(--ok); }
.pill--suspended { background: var(--warn-bg); color: var(--warn); }
.pill--archived  { background: var(--rule-2); color: var(--ink-3); }
.pill--scan, .pill--activation { background: var(--ok-bg); color: var(--ok); }
.pill--scan_replay { background: var(--warn-bg); color: var(--warn); }
.pill--scan_invalid_cmac, .pill--scan_unknown_uid { background: var(--danger-bg); color: var(--danger); }
.pill--ownership_registered { background: var(--accent-bg); color: var(--accent); }


/* ------------------------------------------------------------------ login */

/* The signed-out screens render on their own, with no shell around them. */
.login .card { padding: 26px; }
.login h1 { font-size: 30px; text-align: center; }

/* --------------------------------------------------------------- responsive */

/* The rail is the first thing to go. Below the breakpoint it becomes a strip
   along the top with the nav scrolling sideways — the same markup, no drawer
   to open and no state to get out of step. A drawer would need a toggle, an
   overlay and a focus trap; a horizontal rail needs none of them and is
   faster to reach on a bench next to a reader. */
@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .side {
    position: static; height: auto; width: auto; flex: 0 0 auto;
    padding: 14px 16px;
    display: grid; gap: 12px;
    grid-template-columns: auto 1fr;
    align-items: center;
  }
  .side__brand { padding: 0; }
  .tenant { margin: 0; grid-column: 2; justify-self: end; max-width: 220px; width: 100%; }
  .tenant__label { display: none; }
  .nav {
    grid-column: 1 / -1;
    flex-direction: row; gap: 4px;
    overflow-x: auto; scrollbar-width: none;
    margin: 0 -16px; padding: 0 16px 2px;
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
  .nav a[aria-current]::before { display: none; }
  .who {
    grid-column: 1 / -1; margin: 0; padding-top: 12px;
  }
  .wrap { padding: 28px 20px 72px; }
  h1 { font-size: 28px; }
  .metrics { gap: 12px; }
}

/* Tables keep their columns and scroll sideways instead of collapsing into
   cards: a serial broken across two lines is a serial nobody can check
   against the one printed on the box. */
.card--tight { overflow-x: auto; }
.card--tight table { min-width: 640px; }

@media (max-width: 560px) {
  .wrap { padding: 22px 14px 64px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric { padding: 14px 16px; }
  .metric__value { font-size: 26px; }
}

/* --------------------------------------------------------------- a11y */

/* Focus is never removed, only restyled: this portal is used with a keyboard
   all day, and the outline is how you know where you are. */
a:focus-visible, button:focus-visible, select:focus-visible,
input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ------------------------------------------------------------------ letture */

/* A bar in a table row, not a chart. The share of reads is a proportion, and a
   proportion reads faster as a length than as a second number beside the first
   one. Champagne, like every other piece of state. */
.bar {
  display: block; height: 6px; border-radius: 999px;
  background: var(--rule-2); overflow: hidden; min-width: 80px;
}
.bar__fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

.trend { font-weight: 600; }
.trend--up { color: var(--ok); }
.trend--down { color: var(--danger); }

/* The period buttons are a choice, so the chosen one has to look chosen —
   aria-pressed carries it for a screen reader and the style follows it, rather
   than the two being set independently and drifting apart. */
.ph__acts .b[aria-pressed="true"] {
  background: var(--ink); border-color: var(--ink); color: #fff;
}

/* -------------------------------------------------------------- mappamondo */

/* The map is an illustration of the table under it, not a control: nothing is
   clickable, and the only interaction is the browser's own tooltip from the
   <title> each shape carries. */
.mapcard { padding: 20px 22px 14px; }

.worldmap svg { display: block; width: 100%; height: auto; }

/* Land with no reads. Present but recessive — a country nobody has tapped is
   part of the picture, and a blank map would say less than a pale one. */
.worldmap .mainland,
.worldmap path { fill: var(--rule-2); stroke: var(--card); stroke-width: .5; }

/* Five steps of champagne. Deliberately not a continuous ramp: a shade three
   percent lighter than its neighbour is a difference the eye cannot name.
   
   Each step is written twice, for the element AND for its descendants. In this
   file 37 countries are a <g> holding several <path> — anything with islands:
   Italy, Spain, Canada, China, Australia. The class lands on the group, but
   the fill is taken by the children from `.worldmap path` above, which wins by
   being set on the element itself. Italy has the most reads on dev and stayed
   grey, which is how this was noticed. */
.worldmap .wm--1, .worldmap .wm--1 path { fill: #e8dcc8; }
.worldmap .wm--2, .worldmap .wm--2 path { fill: #d8c3a1; }
.worldmap .wm--3, .worldmap .wm--3 path { fill: #c4a77c; }
.worldmap .wm--4, .worldmap .wm--4 path { fill: #ad8b5c; }
.worldmap .wm--5, .worldmap .wm--5 path { fill: #8e7049; }
.worldmap .wm { transition: fill 130ms; }

.maplegend {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; font-size: 11px; color: var(--ink-3);
}
.maplegend__scale {
  flex: 1 1 auto; height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, #e8dcc8, #d8c3a1, #c4a77c, #ad8b5c, #8e7049);
}

@media (max-width: 560px) {
  .mapcard { padding: 14px 14px 10px; }
}

/* ------------------------------------------------ logo from a photo (D-062)

   A full-screen sheet over the portal, built for a phone held at a client's
   table: the photo with its four handles on top, the cleaned logo under it,
   the few choices below. The page behind does not scroll while it is open. */
body.cap-open { overflow: hidden; }
.cap {
  position: fixed; inset: 0; z-index: 100; overflow-y: auto;
  background: var(--paper); padding: 12px 16px 28px;
  display: flex; flex-direction: column; gap: 12px;
}
.cap__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cap__bar .b[data-x="use"] { width: 100%; min-height: 48px; font-size: 15px; }
.cap__hint { margin: 0; font-size: 13px; color: var(--ink-3); }
.cap__stage { display: flex; justify-content: center; }
.cap__photo {
  max-width: 100%; max-height: 52vh; border-radius: var(--r);
  /* The finger drags a handle, not the page. */
  touch-action: none;
}
.cap__out {
  display: flex; align-items: center; justify-content: center; min-height: 120px;
  padding: 16px; border: 1px solid var(--rule); border-radius: var(--r);
  /* Transparency shown as transparency, so a leftover patch of paper is seen. */
  background: repeating-conic-gradient(#e6e3dd 0 25%, #ffffff 0 50%) 0 0 / 16px 16px;
}
.cap__result { max-width: 100%; max-height: 28vh; }
.cap__empty { margin: 0; font-size: 13px; color: var(--ink-2); text-align: center; }
.cap__range { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-2); }
.cap__range input { flex: 1 1 auto; }
.cap__seg { display: flex; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.cap__seg button {
  flex: 1 1 0; min-height: 40px; border: 0; background: var(--card); color: var(--ink-2);
  font: 500 13px/1 var(--sans); cursor: pointer;
}
.cap__seg button + button { border-left: 1px solid var(--rule); }
.cap__seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
