/* ── Order book ──────────────────────────────────────────────────────────
   Admin chrome only. Loads after styles.css and borrows its palette and
   form controls; everything here is the denser, workbench version of the
   same shop. Nothing in this file is used by a public page.
   ──────────────────────────────────────────────────────────────────── */

body.admin {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
}

/* ── Top bar ─────────────────────────────────────────────────────────── */

.admin-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px clamp(16px, 4vw, 32px);
  background: var(--ink);
  color: var(--paper);
}
.admin-brand {
  font-family: var(--display);
  font-size: 20px;
  color: var(--paper);
  text-decoration: none;
  letter-spacing: .01em;
}
.admin-bar nav { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.admin-bar nav a {
  color: var(--paper-2);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
}
.admin-bar nav a:hover { color: #fff; }
.admin-bar nav a.btn { color: var(--paper); }

.btn-sm {
  padding: 9px 16px 8px;
  font-size: 11.5px;
  letter-spacing: .1em;
}

/* ── Page frame ──────────────────────────────────────────────────────── */

.admin-main {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 40px) clamp(16px, 4vw, 32px) 80px;
  /* styles.css makes body a flex column, so this is a flex item and its
     automatic min-width would refuse to shrink below the order table's
     min-content width, pushing the whole page sideways on a phone. */
  min-width: 0;
}
.admin-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 22px;
}
.admin-head h1 {
  font-family: var(--display);
  font-size: clamp(30px, 5vw, 40px);
  line-height: 1.05;
  margin: 0;
}
.muted { color: var(--ink-3); font-size: 14px; margin: 6px 0 0; }
.hint { color: var(--ink-3); font-size: 13.5px; margin: -8px 0 4px; }
.empty {
  padding: 40px 0;
  color: var(--ink-3);
  font-size: 17px;
  border-top: 1px solid var(--rule);
}

.search { display: flex; gap: 8px; }
.search input {
  background: #fffdf8;
  border: 1px solid var(--rule);
  border-bottom: 1.5px solid var(--ink-3);
  border-radius: 0;
  font-family: var(--body);
  font-size: 15px;
  padding: 9px 12px;
  min-width: min(260px, 54vw);
  appearance: none;
}
.search input:focus {
  outline: none;
  border-color: var(--rust);
  box-shadow: 0 0 0 3px rgba(163, 67, 28, .15);
}

/* ── Status filter chips ─────────────────────────────────────────────── */

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--ink-2);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none;
}
.chip span {
  font-weight: 700;
  color: var(--ink-3);
}
.chip:hover { border-color: var(--ink-3); }
.chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.chip.on span { color: var(--tag); }

/* ── The board ───────────────────────────────────────────────────────── */

/* A phone can't fit six columns, and losing the balance off the right
   edge is worse than a swipe. */
.orders-wrap { overflow-x: auto; }

.orders {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.orders thead th {
  text-align: left;
  padding: 0 12px 10px;
  border-bottom: 1.5px solid var(--ink-3);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.orders td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.orders tbody tr:hover { background: var(--card); }
.orders td small {
  display: block;
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 12.5px;
}
.orders td a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid var(--rust-lt);
}
.orders td a:hover { border-bottom-color: var(--rust); }
.orders .num, .orders .id {
  font-family: var(--mono);
  font-size: 13px;
  white-space: nowrap;
}
.orders th.num, .orders td.num { text-align: right; }
/* The row's own action: right of everything, but not a figure. */
.orders td.go { text-align: right; white-space: nowrap; }

.pill {
  display: inline-block;
  padding: 4px 10px 3px;
  border: 1px solid var(--rule);
  background: var(--card);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.pill.s-received   { border-color: var(--ink-3); color: var(--ink-2); }
.pill.s-in_process { border-color: var(--tag); background: #fbf2d9; color: #6d5410; }
.pill.s-whitening  { border-color: var(--tag); background: #fbf2d9; color: #6d5410; }
.pill.s-ready      { border-color: var(--rust); background: var(--rust-lt); color: var(--rust-2); }
.pill.s-picked_up  { border-color: var(--rule); background: transparent; color: var(--ink-3); }

/* ── Ticket form ─────────────────────────────────────────────────────── */

.ticket fieldset {
  border: 1px solid var(--rule);
  background: var(--card);
  padding: 24px clamp(18px, 3vw, 28px) 8px;
  margin: 0 0 22px;
}
.ticket legend {
  padding: 0 10px;
  margin-left: -4px;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--rust-2);
}
.ticket .row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

/* styles.css styles `.field label`; here the label IS the field, so the
   caption lives in a span and needs the same treatment. */
.ticket .field { display: block; }
.ticket .field > span {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 7px;
}
.ticket .field textarea { min-height: 84px; }
.ticket .check { align-items: center; margin-bottom: 20px; }
.ticket .check > span { font-size: 14.5px; line-height: 1.5; color: var(--ink-2); }

.actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* However many species carry a published price. */
.ticket .row-auto { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.saved {
  border: 1px solid var(--rule);
  border-left: 4px solid var(--tag);
  background: var(--card);
  padding: 13px 18px;
  margin-bottom: 22px;
  color: var(--ink-2);
  font-size: 15px;
}

.problems {
  border: 1px solid var(--rust);
  border-left-width: 4px;
  background: var(--rust-lt);
  padding: 14px 18px;
  margin-bottom: 22px;
}
.problems ul { margin: 0; padding-left: 18px; }
.problems li { color: var(--rust-2); font-size: 15px; }
.problems li + li { margin-top: 4px; }

/* ── Review request ──────────────────────────────────────────────────── */

.review {
  border: 1px solid var(--rust);
  border-left-width: 4px;
  background: var(--rust-lt);
  padding: 20px clamp(18px, 3vw, 26px) 22px;
  margin-bottom: 24px;
}
.review h2 {
  font-family: var(--display);
  font-size: 21px;
  margin: 0 0 12px;
  color: var(--rust-2);
}
.review-msg {
  margin: 0 0 16px;
  padding: 12px 14px;
  background: #fffdf8;
  border: 1px solid var(--rule);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink-2);
  /* The review URL is one long unbreakable token on a phone. */
  overflow-wrap: anywhere;
}
.review .hint { margin: 14px 0 0; }

/* ── Figures ─────────────────────────────────────────────────────────── */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  gap: 10px;
  margin-bottom: 26px;
}
.stat {
  border: 1px solid var(--rule);
  background: var(--card);
  padding: 16px 18px 14px;
}
.stat b {
  display: block;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(24px, 4vw, 30px);
  line-height: 1.1;
}
.stat span {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}

h2.section {
  font-family: var(--display);
  font-size: 22px;
  padding: 0;
  margin: 34px 0 14px;
}

/* ── Customer ────────────────────────────────────────────────────────── */

.detail {
  margin: -6px 0 22px;
  font-size: 15.5px;
  color: var(--ink-2);
}
.detail a { color: var(--ink); }

/* ── Returning-customer lookup ───────────────────────────────────────── */

.lookup {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px solid var(--rule);
  background: var(--card);
  padding: 16px 18px;
  margin-bottom: 24px;
}
.lookup .field { margin: 0; }
.lookup .field > span {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 7px;
}
.lookup input { min-width: min(280px, 58vw); }

/* ── Photos ──────────────────────────────────────────────────────────── */

.photos { margin-bottom: 26px; }
.photos h2.section { margin-top: 0; }

.snap-group { margin-bottom: 20px; }
.snap-group h3 {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--rust-2);
  margin: 0 0 10px;
  padding: 0;
}

.snaps {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 12px;
}
.snaps .muted { margin: 0; }

.snap {
  width: 160px;
  margin: 0;
  border: 1px solid var(--rule);
  background: var(--card);
  padding: 7px;
}
.snap img {
  display: block;
  width: 100%;
  /* Phone photos come out portrait, so give the crop some height. */
  height: 150px;
  object-fit: cover;
  background: var(--paper-2);
}
.snap figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.snap figcaption form { margin: 0; }
.snap .send,
.snap .texter {
  flex: 1 0 100%;
  justify-content: center;
}
.snap-hint {
  flex: 1 0 100%;
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--ink-2);
}

/* A button that reads as a link: removing a photo is not a headline act. */
.linky {
  border: 0;
  padding: 0;
  background: none;
  color: var(--ink-3);
  font-family: var(--body);
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}
.linky:hover { color: var(--rust-2); }

.danger-link { color: var(--ink-3); }
.danger-link:hover { color: #9b2c1f; }
.btn-danger,
.btn-danger:hover { background: #9b2c1f; border-color: #9b2c1f; color: #fff; }

.snap-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.snap-form .state { font-size: 14px; color: var(--ink-3); }
label.btn { cursor: pointer; }

/* styles.css gives .btn a display, which outranks the browser's own rule
   for [hidden] — so a button the script hides would otherwise stay put. */
.btn[hidden] { display: none; }

/* The input stays in the page so that tapping the label still opens the
   camera; it is only hidden from sight. */
.file {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* ── Narrow screens ──────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .ticket .row { grid-template-columns: 1fr; gap: 0; }
  .orders { font-size: 14px; }
  .orders td, .orders thead th { padding-left: 8px; padding-right: 8px; }
  /* Columns worth losing before the balance slides off the right edge.
     Marked in the markup rather than counted, because the same table is
     drawn with and without the customer column. */
  .orders .when { display: none; }
  /* Six links and a button do not fit a phone on one line; let them
     wrap rather than carry the whole page sideways with them. */
  .admin-bar { gap: 10px; }
  .admin-bar nav { gap: 14px; row-gap: 10px; }
  .admin-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .search { width: 100%; }
  .search input { flex: 1; min-width: 0; width: 100%; }
}

/* The quote hint belongs to the row above it, so give the next row air. */
.ticket .hint + .row { margin-top: 16px; }

/* -- The website editor --------------------------------------------------- */
.site-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 22px; }
.site-nav .pill { text-decoration: none; color: var(--ink-2); }
.site-nav .pill.on { border-color: var(--rust); background: var(--rust-lt); color: var(--rust-2); }
.theme-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.theme-card { display: grid; gap: 6px; padding: 14px 16px; border: 1px solid var(--rule); background: var(--card); cursor: pointer; }
.theme-card.on { border-color: var(--rust); box-shadow: inset 0 0 0 1px var(--rust); }
.theme-card span { font-size: 14.5px; color: var(--ink-2); }
.orders td small { display: block; color: var(--ink-3); font-size: 13px; }
.orders tr.muted td { color: var(--ink-3); }
.orders td.go form { display: inline; }
.orders td.go .linky { margin-left: 10px; }
.ticket.block { margin-bottom: 14px; }
.ticket .actions .linky { margin-left: 8px; }
.site-tile { width: 220px; display: grid; gap: 8px; }
.site-tile .field input { width: 100%; }
.site-tile .actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ticket input[type="color"] { width: 72px; height: 40px; padding: 2px; border: 1px solid var(--rule); background: var(--card); cursor: pointer; }
code { font-family: var(--mono); font-size: 13px; background: var(--paper-2); padding: 1px 5px; word-break: break-all; }

/* Inbox: messages from the shop's website */
.inbox-card header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 10px; }
.inbox-card header h2 { font-size: 22px; margin: 0; }
.inbox-card header .tag { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--rust-2); }
.inbox-card header time { color: var(--ink-3); font-size: 13.5px; margin-left: auto; }
.inbox-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0 0 10px; }
.inbox-card dt { color: var(--ink-3); font-size: 13.5px; }
.inbox-card dd { margin: 0; }
.inbox-card .inbox-message { white-space: pre-line; margin: 0 0 12px; }
.inbox-card .snap img { max-width: 280px; }
.inbox-card .warn { color: var(--rust-2); font-weight: 600; }
.inbox-card.done { opacity: .7; }
.inbox-card .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.count { display: inline-block; min-width: 1.5em; padding: 0 5px; border-radius: 9px; background: var(--rust); color: #fff; font-size: 12px; text-align: center; }
.field-check { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; }
.field-check input { width: 18px; height: 18px; accent-color: var(--rust); }
.field-check .hint { grid-column: 2; margin: 0; }
