/* TWES back office – a conventional admin frame on top of ../styles.css tokens:
   dark sidebar, warm grey canvas, white cards. Brand yellow marks "where you are" and primary
   actions; two role colours run through every screen – Buyer (blue) and Seller (amber). */

body.admin {
  --canvas: #F3F1EC;
  --card: #FFFFFF;
  --edge: #E3DED3;
  --head: #F8F6F1;
  --buyer: #2F5C8F;
  --buyer-bg: #E7EEF7;
  --seller: #8A5A00;
  --seller-bg: #FBEFD3;
  --visitor: #5F6233;
  --visitor-bg: #EFEEDF;
  --exhibitor: #A8432C;
  --exhibitor-bg: #FBE6E0;
  --ok: #2E6B45;
  --ok-bg: #E3F1E7;
  --radius: 8px;
  --side: 248px;
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  min-height: 100vh;
  font-size: 15px;
  background: var(--canvas);
}
body.admin .muted {
  color: var(--muted);
}

/* ---------- Sidebar ---------- */
.admin-bar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  padding: 16px 14px 18px;
  overflow-y: auto;
  background: var(--ink);
  color: #F4F1EA;
}
.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--yellow);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.admin-brand img {
  height: 34px;
  width: auto;
}
.nav-label {
  margin: 6px 12px -8px;
  color: #A39E94;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.admin-nav {
  display: grid;
  gap: 2px;
}
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 6px;
  color: #F4F1EA;
  text-decoration: none;
  white-space: nowrap;
}
.admin-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
}
.admin-nav a[aria-current="page"] {
  background: var(--yellow);
  color: var(--ink);
  font-weight: 700;
}
.admin-nav svg,
.side-link svg {
  flex: none;
  width: 18px;
  height: 18px;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  color: #F4F1EA;
  font-size: 14px;
  text-decoration: none;
}
.side-link:hover {
  border-color: var(--yellow);
}
.admin-user {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 14px 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 14px;
}
.admin-who strong {
  display: block;
}
.role-chip {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(233, 184, 81, 0.18);
  color: var(--yellow);
  font-size: 12px;
}
.admin-user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.admin-user .header-links {
  font-size: 12px;
}
.admin-user .lang-toggle button {
  color: inherit;
}
.admin-user .text-button {
  color: inherit;
}

/* Not signed in yet (login, first password, 2-step): yellow top bar + one centred card. */
body.admin.is-bare {
  display: block;
}
body.admin.is-bare .admin-bar {
  position: static;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  height: auto;
  padding: 10px clamp(16px, 3vw, 40px);
  background: var(--yellow);
  color: var(--ink);
}
body.admin.is-bare .admin-brand {
  padding: 0;
}
body.admin.is-bare .admin-user {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  border: 0;
}
body.admin.is-bare .admin-main {
  max-width: 560px;
  margin: clamp(24px, 6vh, 64px) auto;
  padding: 28px clamp(18px, 4vw, 36px) 32px;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: var(--card);
}
body.admin.is-bare .auth-form {
  grid-template-columns: 1fr;
}
body.admin.is-bare .demo-panel {
  border-radius: var(--radius);
  background: var(--head);
}

/* ---------- Page frame ---------- */
.admin-main {
  min-width: 0;
  padding: 26px clamp(16px, 2.6vw, 36px) 56px;
}
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 24px;
  margin-bottom: 20px;
}
.page-head h1 {
  margin: 0;
  font-size: clamp(1.7rem, 2.4vw, 2.3rem);
  font-weight: 400;
  line-height: 1.1;
}
.page-head .muted {
  font-size: 14px;
}
.block {
  margin-top: 20px;
  padding: 18px 20px 20px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--card);
}
.block-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px 20px;
  margin: -2px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--edge);
}
.block-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}
.step-no {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font-size: 13px;
  vertical-align: 1px;
}

/* Inputs and buttons: boxed, like any admin tool */
body.admin .text-input,
body.admin .select-input {
  min-height: 40px;
  padding: 7px 12px;
  border: 1px solid #CFC9BC;
  border-radius: 6px;
  background-color: var(--card);
  font-size: 15px;
}
body.admin .select-input {
  padding-right: 34px;
  background-position: right 12px center;
}
body.admin .text-input:focus,
body.admin .select-input:focus {
  border-color: var(--ink);
  border-bottom-width: 1px;
  box-shadow: 0 0 0 3px rgba(233, 184, 81, 0.45);
}
body.admin .field-label {
  margin-bottom: 4px;
  font-size: 13px;
  font-weight: 700;
}
body.admin .split-button {
  min-height: 40px;
  overflow: hidden;
  border-radius: 6px;
}
body.admin .split-button .button-label {
  padding: 8px 14px;
}
body.admin .split-button .button-arrow {
  min-width: 40px;
  font-size: 18px;
}

/* KPI cards */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}
.kpi {
  padding: 16px 18px;
  border: 1px solid var(--edge);
  border-top: 3px solid var(--yellow);
  border-radius: var(--radius);
  background: var(--card);
}
.kpi .label {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.kpi .value {
  display: block;
  margin-top: 6px;
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi .sub {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- Data tables ---------- */
.table-wrap {
  overflow: auto;
  max-width: 100%;
}
.block > .table-wrap,
.card-table {
  max-width: none;
  margin: 0 -20px -20px;
  border-top: 1px solid var(--edge);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 12px;
  border-bottom: 1px solid var(--edge);
  background: var(--head);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}
.data-table tbody th {
  position: static;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
  white-space: normal;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--edge);
  vertical-align: top;
}
.data-table tbody tr:hover td,
.data-table tbody tr:hover th {
  background: #FCFBF8;
}
.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.row-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--buyer);
  font-weight: 700;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.mono-id {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Status pills */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #EEEBE4;
  font-size: 13px;
  white-space: nowrap;
}
.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.status.confirmed {
  background: var(--ok-bg);
  color: var(--ok);
}
.status.pending {
  background: #FDF1D5;
  color: #85590B;
}
.status.waitlist {
  background: #E9EAF0;
  color: #44475A;
}
.status.rejected,
.status.cancelled {
  background: #F9E3E0;
  color: var(--error);
}

/* Who is who: one colour per kind of participant, used everywhere */
.kind {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.kind.buyer {
  background: var(--buyer-bg);
  color: var(--buyer);
}
.kind.seller {
  background: var(--seller-bg);
  color: var(--seller);
}
.kind.visitor {
  background: var(--visitor-bg);
  color: var(--visitor);
}
.kind.exhibitor {
  background: var(--exhibitor-bg);
  color: var(--exhibitor);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.mini-button {
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid #CFC9BC;
  border-radius: 6px;
  background: var(--card);
  font-size: 13px;
}
.mini-button:hover,
.mini-button:focus-visible {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}
.mini-button.solid {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}
.mini-button.danger {
  border-color: var(--error);
  color: var(--error);
}
.mini-button.danger:hover {
  background: var(--error);
  color: var(--paper);
}
.inline-msg {
  display: block;
  margin-top: 6px;
  font-size: 13px;
}
.inline-msg.warn {
  color: var(--error);
}

/* Capacity cells */
.cap {
  min-width: 110px;
}
.cap .bar {
  display: block;
  height: 5px;
  margin-top: 6px;
  border-radius: 3px;
  background: #ECE8DF;
}
.cap .bar span {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--ink);
}
.cap.hot {
  color: var(--coral);
}
.cap.hot .bar span {
  background: var(--coral);
}

.attention {
  margin: 0;
  padding: 0;
  list-style: none;
}
.attention li {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 20px;
  padding: 12px 0;
  border-bottom: 1px solid var(--edge);
}
.attention li:last-child {
  border-bottom: 0;
}

/* ---------- Tabs + filter bar ---------- */
.tabs,
.date-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 14px;
  padding: 4px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--card);
}
.tabs [role="tab"],
.date-tabs button {
  padding: 7px 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
}
.tabs [role="tab"]:hover,
.date-tabs button:hover {
  background: var(--head);
}
.tabs [role="tab"][aria-selected="true"],
.date-tabs button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  font-weight: 700;
}
.tabs .count,
.date-tabs .count {
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 999px;
  background: #EEEBE4;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.tabs [aria-selected="true"] .count,
.date-tabs [aria-pressed="true"] .count {
  background: rgba(255, 255, 255, 0.2);
  color: var(--paper);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 14px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--card);
}
.block .toolbar {
  padding: 0;
  border: 0;
}
.toolbar .field {
  min-width: 170px;
}
.toolbar .grow {
  flex: 1 1 240px;
}
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}
.seat-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 14px;
  padding: 12px 16px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--card);
}
.seat-line .meter-track {
  width: min(320px, 100%);
  height: 8px;
  margin: 0;
  border-radius: 4px;
  overflow: hidden;
  background: #ECE8DF;
}
.board-status,
.flash {
  min-height: 0;
  margin: 0 0 12px;
  font-size: 14px;
}
.board-status:not(:empty),
.flash:not(:empty) {
  padding: 10px 14px;
  border: 1px solid #C9D7E8;
  border-left: 4px solid var(--buyer);
  border-radius: 6px;
  background: #F3F7FC;
}
.board-status.warn:not(:empty) {
  border-color: #EBC5BF;
  border-left-color: var(--error);
  background: #FDF3F1;
  color: var(--error);
}

/* ---------- Side panel ---------- */
.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  width: min(560px, 100%);
  overflow: auto;
  padding: 22px 24px 40px;
  background: var(--card);
  box-shadow: -12px 0 32px rgba(35, 31, 32, 0.18);
}
.side-panel h2 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 400;
}
.side-panel h3 {
  margin: 22px 0 8px;
  font-size: 15px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin: -22px -24px 18px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--edge);
  background: var(--head);
}
.panel-head .eyebrow {
  margin: 0 0 4px;
}
.panel-scrim {
  position: fixed;
  inset: 0;
  z-index: 39;
  background: rgba(35, 31, 32, 0.35);
}
.side-panel .review-list {
  grid-template-columns: 150px 1fr;
}
.side-panel .fields-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}
.panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}
.panel-step {
  margin: 0 0 18px;
}
.panel-step > p {
  margin: 0 0 8px;
}
.check-line {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
}
.check-line input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--ink);
}
.import-file {
  display: block;
  width: 100%;
  padding: 14px;
  border: 1px dashed #BDB6A7;
  border-radius: 6px;
  background: var(--head);
}
.import-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}
.import-table td {
  font-size: 13px;
}
.import-table .bad {
  color: var(--error);
}
.import-table .good {
  color: var(--ok);
}

/* ---------- Matching board ---------- */
.match-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 14px;
}
.match-toolbar .date-tabs {
  margin: 0;
}
.match-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.match-layout {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.match-layout > * {
  min-width: 0;
}
.match-layout > .block {
  margin-top: 0;
}
.pane-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.pane-hint {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.queue summary {
  list-style: none;
  cursor: pointer;
}
.queue summary::-webkit-details-marker {
  display: none;
}
.queue-tools {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}
.queue-list {
  max-height: calc(100vh - 330px);
  margin: 0 -20px -20px;
  overflow: auto;
  border-top: 1px solid var(--edge);
}
.queue-group {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 0;
  padding: 8px 20px;
  border-bottom: 1px solid var(--edge);
  background: var(--head);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.buyer-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 10px;
  width: 100%;
  padding: 10px 16px 10px 17px;
  border: 0;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--edge);
  background: var(--card);
  text-align: left;
}
.buyer-row:hover {
  background: #F6F9FD;
}
.buyer-row[aria-pressed="true"] {
  border-left-color: var(--buyer);
  background: var(--buyer-bg);
}
.buyer-row .co {
  font-weight: 700;
}
.buyer-row .meta {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}
.buyer-row .need {
  color: var(--coral);
  font-weight: 700;
}
.meter-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  white-space: nowrap;
}
.meter-dots i {
  width: 8px;
  height: 8px;
  border: 1px solid var(--buyer);
  border-radius: 50%;
}
.meter-dots i.on {
  background: var(--buyer);
}
.meter-dots i.sug {
  border-style: dashed;
}
.suggest-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 0 0 12px;
  padding: 10px 14px;
  border: 1px dashed var(--buyer);
  border-radius: 6px;
  background: #F6F9FD;
}
.board-wrap {
  /* Positioning context so visually hidden labels stay inside the scroll box. */
  position: relative;
  overflow: auto;
  max-height: calc(100vh - 300px);
  margin: 0 -20px;
  border-top: 1px solid var(--edge);
  border-bottom: 1px solid var(--edge);
}
.board {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 900px;
  width: 100%;
  font-size: 13px;
}
.board th,
.board td {
  border-bottom: 1px solid var(--edge);
  border-right: 1px solid var(--edge);
}
.board thead th {
  position: sticky;
  z-index: 2;
  padding: 7px 8px;
  background: var(--head);
  font-weight: 400;
  text-align: left;
}
.board thead tr:first-child th {
  top: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.board thead tr:nth-child(2) th {
  top: 31px;
}
.board thead th strong {
  display: block;
  font-size: 14px;
}
.board thead th.busy-col {
  background: #FDF3F1;
  color: var(--error);
}
.board thead th .col-flag {
  display: block;
  font-size: 11px;
  font-weight: 700;
}
.board .seller-cell {
  position: sticky;
  left: 0;
  z-index: 1;
  min-width: 210px;
  max-width: 250px;
  padding: 8px 12px 8px 20px;
  background: var(--card);
  text-align: left;
  font-weight: 400;
}
.board thead .seller-cell {
  z-index: 3;
  background: var(--head);
}
.seller-cell .tno {
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--seller-bg);
  color: var(--seller);
  font-size: 12px;
  font-weight: 700;
}
.seller-cell .co {
  font-weight: 700;
}
.seller-cell .cat {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}
.board tr.met .seller-cell {
  background: #FDF6F4;
}
.seller-cell .row-flag {
  display: inline-block;
  margin-top: 4px;
  color: var(--error);
  font-size: 11px;
  font-weight: 700;
}
.board td {
  padding: 0;
  min-width: 100px;
  height: 58px;
}
.board td.off {
  background: repeating-linear-gradient(135deg, #F7F5F0 0 6px, #ECE8DF 6px 7px);
}
.cell {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 58px;
  padding: 6px 8px;
  border: 0;
  background: var(--card);
  text-align: left;
  font-size: 12px;
  line-height: 1.25;
}
.cell .plus {
  opacity: 0;
  font-size: 18px;
}
.cell:hover .plus,
.cell:focus-visible .plus {
  opacity: 1;
}
/* A booked slot = a buyer sitting at the seller's table: shown in the buyer colour. */
.cell.assigned {
  border-left: 3px solid var(--buyer);
  background: var(--buyer-bg);
  color: var(--ink);
}
.cell.assigned strong {
  color: var(--buyer);
  font-size: 12px;
}
.cell.assigned.mine {
  background: var(--buyer);
  color: var(--paper);
}
.cell.assigned.mine strong {
  color: var(--paper);
}
.cell.suggested {
  outline: 2px dashed var(--buyer);
  outline-offset: -5px;
  background: #F6F9FD;
}
.cell.valid {
  background: #FFF6DF;
  box-shadow: inset 0 0 0 1px var(--yellow);
}
.cell.valid .plus {
  opacity: 1;
}
.cell .fit {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.cell .why {
  color: var(--error);
  font-size: 11px;
  font-weight: 700;
}
.board.picking .cell.blocked {
  background: repeating-linear-gradient(135deg, #FDF6F4 0 6px, #F6E3DF 6px 7px);
}
.board.picking .cell:not(.valid):not(.assigned):not(.blocked):not(.outside),
.board.picking td.off {
  opacity: 0.45;
}
/* Outside the buyer's chosen time: only after staff unlock it */
.unlock-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin: -4px 0 12px;
  padding: 10px 14px;
  border: 1px dashed #D9A35C;
  border-radius: 6px;
  background: #FFF8EC;
  font-size: 13px;
}
.unlock-bar.is-open {
  border-style: solid;
  border-color: #E08A2C;
  background: #FFF0DC;
}
.cell.outside {
  background: #FFE6C7;
  box-shadow: inset 0 0 0 2px #E08A2C;
}
.cell.outside .why {
  color: #A85A12;
}
.board.picking .cell.outside {
  opacity: 1;
}
.cell .outside-tag {
  display: inline-block;
  margin-top: 3px;
  padding: 0 5px;
  border-radius: 3px;
  background: #E08A2C;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  align-self: flex-start;
}
.legend-row .l-outside::before {
  background: #FFE6C7;
  border-color: #E08A2C;
}
.buyer-row .other-day {
  color: #A85A12;
  font-weight: 700;
}
.popover .outside-note {
  padding: 8px 10px;
  border-left: 3px solid #E08A2C;
  background: #FFF0DC;
  font-size: 13px;
}
.outside-dialog {
  width: min(560px, calc(100vw - 32px));
}
.outside-body {
  padding: 16px 20px 6px;
  overflow: auto;
}
.outside-body .review-list {
  grid-template-columns: 130px 1fr;
  margin-bottom: 14px;
}
.reason-set {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}
.cell .sent-mark {
  position: absolute;
  top: 5px;
  right: 6px;
  color: var(--ok);
  font-size: 11px;
  font-weight: 700;
}
.cell.assigned.mine .sent-mark {
  color: var(--paper);
}
.cell:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: -2px;
}
.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0;
  padding: 14px 0 0;
  font-size: 13px;
}
.legend-row span::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 6px;
  vertical-align: -2px;
  border: 1px solid var(--edge);
  border-radius: 3px;
}
.legend-row .l-assigned::before {
  border-left: 3px solid var(--buyer);
  background: var(--buyer-bg);
}
.legend-row .l-mine::before {
  background: var(--buyer);
}
.legend-row .l-suggested::before {
  border: 2px dashed var(--buyer);
}
.legend-row .l-valid::before {
  border-color: var(--yellow);
  background: #FFF6DF;
}
.legend-row .l-blocked::before {
  background: repeating-linear-gradient(135deg, #FDF6F4 0 3px, #F0CFC8 3px 4px);
}
.legend-row .l-off::before {
  background: repeating-linear-gradient(135deg, #F7F5F0 0 3px, #D9D3C6 3px 4px);
}
.legend-row .l-sent::before {
  content: "✓";
  border: 0;
  color: var(--ok);
  font-weight: 700;
}

/* Popover anchored to a board cell */
.popover {
  position: fixed;
  z-index: 50;
  width: min(330px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 12px 30px rgba(35, 31, 32, 0.2);
}
.popover h3 {
  margin: 0 0 10px;
  font-size: 15px;
}
.popover p {
  margin: 0 0 8px;
  font-size: 14px;
}

/* ---------- Send dialog ---------- */
.send-dialog {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 20px 50px rgba(35, 31, 32, 0.3);
}
.send-dialog[open] {
  display: flex;
  flex-direction: column;
}
.send-dialog::backdrop {
  background: rgba(35, 31, 32, 0.45);
}
.dialog-head,
.dialog-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 20px;
  padding: 14px 20px;
}
.dialog-head {
  border-bottom: 1px solid var(--edge);
  background: var(--head);
}
.dialog-head h2 {
  margin: 0;
  font-size: 20px;
}
.dialog-foot {
  border-top: 1px solid var(--edge);
}
.dialog-body {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  min-height: 0;
}
.dialog-body > * {
  min-height: 0;
}
.recipients {
  overflow: auto;
  border-right: 1px solid var(--edge);
}
.recipient {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--edge);
}
.recipient.is-active {
  background: var(--head);
}
.recipient input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--ink);
}
.recipient button {
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}
.recipient small {
  display: block;
  color: var(--muted);
}
.email-preview {
  overflow: auto;
  padding: 18px 22px;
  font-size: 15px;
}
.email-preview .subject {
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--edge);
}

.dialog-lang {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 10px 20px;
  border-top: 1px solid var(--edge);
  background: var(--head);
  font-size: 13px;
}
.dialog-lang .field-label {
  margin: 0;
}
.dialog-lang .select-input {
  width: auto;
  min-width: 220px;
}
.lang-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border: 1px solid var(--edge);
  border-radius: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

/* ---------- Check-in ---------- */
.checkin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.checkin-grid > div {
  padding: 18px 20px 20px;
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  background: var(--card);
}
.scan-button {
  width: 100%;
  min-height: 72px !important;
  font-size: 22px;
}
.scan-button .button-label {
  flex: 1 1 auto;
  justify-content: center;
}
.scanner {
  margin-top: 4px;
}
.viewfinder {
  position: relative;
  aspect-ratio: 1;
  max-width: 520px;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--ink);
}
.viewfinder::before,
.viewfinder::after,
.viewfinder .corners::before,
.viewfinder .corners::after {
  content: "";
  position: absolute;
  width: 18%;
  height: 18%;
  border: 4px solid var(--yellow);
}
.viewfinder::before {
  top: 10%;
  left: 10%;
  border-right: 0;
  border-bottom: 0;
}
.viewfinder::after {
  top: 10%;
  right: 10%;
  border-left: 0;
  border-bottom: 0;
}
.viewfinder .corners::before {
  bottom: 10%;
  left: 10%;
  border-right: 0;
  border-top: 0;
}
.viewfinder .corners::after {
  bottom: 10%;
  right: 10%;
  border-left: 0;
  border-top: 0;
}
.viewfinder video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.viewfinder.paused video,
.viewfinder.paused .scanline {
  display: none;
}
.cam-status {
  margin: 8px 0 0;
  font-size: 14px;
}
.cam-status.warn {
  color: var(--error);
}
.viewfinder .scanline {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 50%;
  height: 2px;
  background: var(--yellow);
  animation: scan 2.2s ease-in-out infinite alternate;
}
@media (prefers-reduced-motion: reduce) {
  .viewfinder .scanline {
    animation: none;
  }
}
.viewfinder .hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4%;
  color: var(--paper);
  font-size: 14px;
  text-align: center;
}
@keyframes scan {
  from {
    top: 14%;
  }
  to {
    top: 86%;
  }
}
.manual-lookup {
  margin-top: 18px;
}
.lookup-results {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}
.lookup-results button {
  width: 100%;
  padding: 10px 4px;
  border: 0;
  border-bottom: 1px solid var(--edge);
  background: transparent;
  text-align: left;
}
.lookup-results button:hover {
  background: var(--head);
}
.checkin-grid .verify-card {
  margin: -18px -20px -20px;
  border: 0;
}
.verify-card {
  padding: 22px 24px;
  border-radius: var(--radius);
}
.verify-card .ask {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.verify-card .who {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  font-weight: 400;
  line-height: 1.05;
}
.verify-card .ids {
  margin: 8px 0 16px;
  font-weight: 700;
}
.verify-card .warning {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #EBC5BF;
  border-left: 4px solid var(--error);
  border-radius: 6px;
  background: #FDF3F1;
}
.verify-card .warning strong {
  display: block;
  color: var(--error);
}
.verify-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.verify-card.success {
  background: var(--ok);
  color: var(--paper);
}
.verify-card.success .ask {
  color: var(--paper);
}
.verify-card.success .split-button {
  border-color: var(--paper);
}
.verify-empty {
  margin: 0;
  padding: 18px 0;
  color: var(--muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 1199px) {
  .match-layout {
    grid-template-columns: 1fr;
  }
  .queue-list {
    max-height: 380px;
  }
  .board-wrap {
    max-height: 70vh;
  }
}
@media (max-width: 999px) {
  body.admin {
    display: block;
  }
  .admin-bar {
    position: sticky;
    z-index: 20;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    height: auto;
    padding: 10px 16px;
  }
  .admin-brand {
    padding: 6px 10px;
  }
  .admin-brand img {
    height: 28px;
  }
  .nav-label,
  .side-link {
    display: none;
  }
  .admin-nav {
    display: flex;
    order: 3;
    width: 100%;
    overflow-x: auto;
  }
  .admin-nav a {
    padding: 8px 10px;
  }
  .admin-user {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 0 auto;
    padding: 0;
    border: 0;
  }
  .admin-user .admin-who {
    display: none;
  }
  .checkin-grid {
    grid-template-columns: 1fr;
  }
  .dialog-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 180px) minmax(0, 1fr);
  }
  .recipients {
    max-height: 180px;
    border-right: 0;
    border-bottom: 1px solid var(--edge);
  }
  /* Tables recompose into stacked rows */
  .data-table.stack thead {
    display: none;
  }
  .data-table.stack,
  .data-table.stack tbody,
  .data-table.stack tr,
  .data-table.stack td {
    display: block;
    width: 100%;
  }
  .data-table.stack tr {
    padding: 10px 16px;
    border-bottom: 1px solid var(--edge);
  }
  .data-table.stack td {
    display: grid;
    grid-template-columns: 38% 1fr;
    gap: 10px;
    padding: 3px 0;
    border: 0;
  }
  .data-table.stack td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
  }
  .side-panel {
    width: 100%;
  }
  .side-panel .fields-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .admin-main {
    padding: 18px 16px 48px;
  }
  .block {
    padding: 14px 16px 16px;
  }
  .block > .table-wrap,
  .card-table,
  .queue-list {
    margin: 0 -16px -16px;
  }
  .board-wrap {
    margin: 0 -16px;
  }
  .toolbar-actions {
    margin-left: 0;
  }
  .tabs,
  .date-tabs {
    display: flex;
  }
}
