/* ============================================================
   Transcore — Industrial / logistics theme
   Warm paper background, ink text, amber + deep-green accents,
   hard thin borders, tabular monospace numbers, square buttons.
   ============================================================ */
:root {
  --paper: #f0ebdf;       /* page background (warm cream) */
  --surface: #ffffff;     /* cards */
  --surface-2: #faf7f0;   /* inset / hover */
  --ink: #1a1a1a;         /* primary text */
  --ink-2: #6b6459;       /* secondary / muted (warm gray) */
  --line: #d8d0c0;        /* hairline borders */
  --line-2: #c4bba8;      /* slightly stronger border */
  --ink-line: #1a1a1a;    /* strong/structural border */
  --amber: #c2700a;       /* primary accent */
  --amber-dark: #a85f06;
  --amber-soft: #f6ead6;  /* amber tint fill */
  --green: #2d5a3d;       /* secondary accent / success */
  --green-soft: #e2ebe3;
  --red: #b23a2e;         /* failed / danger (brick) */
  --red-soft: #f4e0dc;
  --blue: #2f4d78;        /* in transit — a state, not a problem */
  --blue-soft: #e0e7f1;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--amber-dark); }

/* ---------- header / nav ---------- */
header {
  background: var(--surface);
  border-bottom: 2px solid var(--ink-line);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  height: 56px;
  position: sticky;
  top: 0;
  z-index: 10;
  overflow-x: auto;
}
header .brand {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  flex: 0 0 auto;
}
header .brand::before {
  content: "";
  width: 20px;
  height: 20px;
  background: url("/favicon.svg") center / contain no-repeat; /* the Transcore gem */
  display: inline-block;
}
header nav { display: flex; gap: 2px; height: 100%; align-items: stretch; flex: 0 0 auto; }
header nav a {
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}
header nav a:hover { color: var(--ink); }
header nav a.active { color: var(--ink); border-bottom-color: var(--amber); }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.tenant-switch {
  width: auto; padding: 5px 8px; font-size: 12px; font-weight: 600;
  border-radius: 3px; background: var(--surface-2); border-color: var(--line-2);
}
.userbox .who { font-size: 12px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 8px; text-decoration: none; }
.userbox .who:hover { color: var(--ink); }
.userbox .role {
  font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  background: var(--amber-soft); color: var(--amber-dark); padding: 2px 6px; border-radius: 2px;
  border: 1px solid #e6cfa6;
}

main { max-width: 1140px; margin: 32px auto; padding: 0 28px; }
h1 {
  font-size: 22px;
  margin: 0 0 4px;
  font-weight: 800;
  letter-spacing: -.01em;
}
.sub { color: var(--ink-2); margin: 0 0 26px; font-size: 13px; }

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 4px;
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: 0 1px 2px rgba(26, 22, 15, .04);
}
.card h2 {
  margin: 0 0 18px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-2);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

/* ---------- forms ---------- */
label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin: 16px 0 6px;
}
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 3px;
  color: var(--ink);
  font-size: 14px;
  font-family: var(--sans);
}
textarea { resize: vertical; line-height: 1.4; }
.keys-editor { display: flex; flex-direction: column; gap: 9px; }
.key-card { border: 1px solid var(--line); border-radius: 5px; padding: 10px 12px; background: var(--surface-2); }
.key-row { display: flex; align-items: center; gap: 10px; }
.key-row .key-on { width: auto; flex: 0 0 auto; margin: 0; }
.key-row .key-mask { flex: 0 0 116px; font-size: 12px; color: var(--ink-2); letter-spacing: .5px; white-space: nowrap; }
.key-row .key-new { flex: 1 1 200px; font-size: 12px; }
.key-row .key-remark { flex: 1 1 160px; min-width: 110px; }
.key-row .key-mode { flex: 0 0 150px; }
.key-row .key-del { flex: 0 0 auto; }
.key-card:has(.key-on:not(:checked)) .key-mask,
.key-card:has(.key-on:not(:checked)) .key-new,
.key-card:has(.key-on:not(:checked)) .key-remark,
.key-card:has(.key-on:not(:checked)) .key-detail { opacity: .5; }
.key-detail { display: flex; align-items: center; gap: 8px 20px; margin-top: 10px; padding: 9px 0 1px 28px;
  border-top: 1px solid var(--line); flex-wrap: wrap; }
.key-detail label { display: flex; align-items: center; gap: 7px; margin: 0; text-transform: none; letter-spacing: normal; font-size: 12px; font-weight: 600; color: var(--ink); }
.key-detail input { width: 120px; }
.key-status { font-size: 12px; color: var(--ink-2); }
.key-exhausted { color: var(--red); font-weight: 600; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}
.row { display: flex; gap: 14px; }
.row > * { flex: 1; }

/* ---------- buttons ---------- */
button {
  padding: 9px 16px;
  border: 1px solid var(--amber);
  border-radius: 3px;
  background: var(--amber);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
  font-family: var(--sans);
  transition: background .1s, transform .02s;
}
button:hover { background: var(--amber-dark); border-color: var(--amber-dark); }
button:active { transform: translateY(1px); }
button.ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-2);
}
button.ghost:hover { background: var(--surface-2); border-color: var(--ink-2); }
button.danger {
  background: transparent;
  color: var(--red);
  border-color: var(--line-2);
  padding: 5px 9px;
}
button.danger:hover { background: var(--red); color: #fff; border-color: var(--red); }
button.sm { padding: 6px 11px; font-size: 11px; }
button[disabled] { opacity: .4; cursor: not-allowed; }
button[disabled]:active { transform: none; }
.actions { margin-top: 20px; display: flex; gap: 10px; align-items: center; }
.btn-upload {
  display: inline-block; padding: 8px 16px; border: 1px solid var(--green);
  border-radius: 3px; background: var(--green); color: #fff;
  font-weight: 700; font-size: 12px; letter-spacing: .05em; text-transform: uppercase;
}
.btn-upload:hover { background: #244b32; border-color: #244b32; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
th {
  color: var(--ink-2);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
  border-bottom: 2px solid var(--ink-line);
  background: var(--surface-2);
}
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
.mono { font-family: var(--mono); font-size: 12.5px; }

/* Small square actions that sit inside a table cell (+ add, ≈ alias).
   Styled on the shared .cell-btn class, never on the per-action classes —
   those exist for the click handlers, and a new one used to fall back to the
   full-size default button and tower over its neighbour. */
.prod-cell { display: inline-flex; align-items: center; gap: 6px; }
.cell-btn {
  padding: 0; width: 22px; height: 22px; line-height: 1; flex: 0 0 auto;
  font-size: 15px; font-weight: 700; border-radius: 3px;
  background: var(--green); border-color: var(--green); color: #fff;
}
.cell-btn:hover { background: #244b32; border-color: #244b32; }
/* aliasing is a softer action than creating a record — muted, not green */
.cell-btn.alias { background: var(--surface-2); border-color: var(--line-2); color: var(--ink-2); font-size: 13px; }
.cell-btn.alias:hover { background: var(--amber-soft); border-color: var(--amber); color: var(--amber-dark); }

/* Verify toggle */
button.verify {
  padding: 5px 10px; font-size: 10px; letter-spacing: .06em;
  background: var(--surface); color: var(--ink-2); border-color: var(--line-2);
}
button.verify:hover { background: var(--surface-2); color: var(--ink); border-color: var(--ink-2); }
button.verify.on {
  background: var(--green-soft); color: var(--green); border-color: #bcd2c0;
}
button.verify.on:hover { background: #d4e2d6; }
.vmark { color: var(--green); font-weight: 700; }
/* editable amount cell */
.amount-cell.editable { cursor: pointer; }
.amount-cell.editable:hover { background: var(--amber-soft); outline: 1px dashed var(--line-2); outline-offset: -2px; }

/* row state highlights */
tr.failed td { background: var(--red-soft); }
tr.failed:hover td { background: #efd5d0; }
tr.dup td { background: var(--amber-soft); }
tr.dup:hover td { background: #f0dcbf; }

/* ---------- pills / badges ---------- */
.pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  border: 1px solid transparent;
}
.pill.on { background: var(--green-soft); color: var(--green); border-color: #bcd2c0; }
.pill.off { background: var(--red-soft); color: var(--red); border-color: #e3b8b1; }
.pill.warn { background: var(--amber-soft); color: var(--amber-dark); border-color: #e6cfa6; }
.pill.info { background: var(--blue-soft); color: var(--blue); border-color: #bcc9dc; }

/* ---------- toolbar / filters ---------- */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar input { max-width: 340px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 3px; overflow: hidden; }
.seg button {
  background: var(--surface); color: var(--ink-2); border: none; border-radius: 0;
  padding: 8px 14px; font-weight: 700; font-size: 11px; letter-spacing: .05em;
  border-right: 1px solid var(--line-2);
}
.seg button:last-child { border-right: none; }
.seg button:hover { background: var(--surface-2); color: var(--ink); }
.seg button.active { background: var(--ink); color: #fff; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.dot.amber { background: var(--amber); }
.dot.red { background: var(--red); }
.dot.green { background: var(--green); }
.dot.blue { background: var(--blue); }

/* ---------- pager ---------- */
.pager {
  display: flex; align-items: center; gap: 16px; margin-top: 16px;
  justify-content: flex-end; flex-wrap: wrap;
  font-variant-numeric: tabular-nums;
}
.pager-ctrl { display: inline-flex; align-items: center; gap: 10px; }
.pager select { width: auto; padding: 6px 8px; display: inline-block; margin-left: 6px; }

/* ---------- inline editable cells ---------- */
.inline-edit {
  background: transparent; border: 1px solid transparent; padding: 4px 6px;
  width: auto; min-width: 84px; max-width: 280px; border-radius: 3px;
  field-sizing: content;
}
.inline-edit:hover { border-color: var(--line-2); background: var(--surface); }
.inline-edit:focus { min-width: 160px; box-shadow: none; }

/* ---------- resizable / reorderable results grid ---------- */
.grid-table { table-layout: fixed; }
.grid-table th { position: relative; user-select: none; }
.grid-table th[draggable="true"] { cursor: grab; }
.grid-table th[draggable="true"]:active { cursor: grabbing; }
.grid-table th.drag-over { box-shadow: inset 3px 0 0 var(--amber); }
.grid-table td, .grid-table th { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-table .inline-edit { width: 100%; min-width: 0; max-width: none; field-sizing: normal; box-sizing: border-box; }
.grid-table .col-sel { width: 36px; text-align: center; }
/* click a header to sort, double-click to pin the column */
.grid-table th[data-key] { cursor: pointer; }
.grid-table th .sort-ind { margin-left: 5px; opacity: .85; font-size: 9px; }
.grid-table th.sorted { color: var(--ink); }
/* pinned columns stay put while the rest scrolls under them. Backgrounds must be
   opaque (and match each row state) or the scrolling cells show through. */
.grid-table .lockcell { position: sticky; z-index: 3; background: var(--surface); }
.grid-table thead .lockcell { z-index: 6; background: var(--surface-2); }
tbody tr:hover .lockcell { background: var(--surface-2); }
tr.failed .lockcell { background: var(--red-soft); }
tr.failed:hover .lockcell { background: #efd5d0; }
tr.dup .lockcell { background: var(--amber-soft); }
tr.dup:hover .lockcell { background: #f0dcbf; }
.grid-table .lock-edge { box-shadow: 2px 0 0 var(--line-2); }
.grid-table th.lockcell::after {
  content: '📌'; position: absolute; top: 2px; right: 9px; font-size: 8px; opacity: .55;
}
.col-resize { position: absolute; top: 0; right: 0; width: 7px; height: 100%; cursor: col-resize; }
.col-resize:hover { background: var(--amber); opacity: .4; }
.col-menu {
  position: absolute; z-index: 60; background: var(--surface); border: 1px solid var(--line-2);
  border-radius: 4px; box-shadow: 0 10px 28px rgba(26,22,15,.2); padding: 10px 12px; min-width: 210px;
}
.col-menu label {
  display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: normal;
  font-size: 13px; color: var(--ink); font-weight: 500; margin: 5px 0; cursor: pointer;
}
.col-menu label input { width: auto; }
.col-menu .menu-actions { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }

/* ---------- table scroll ---------- */
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 1100px; }
.table-scroll th, .table-scroll td { white-space: nowrap; }
.table-scroll::-webkit-scrollbar { height: 11px; }
.table-scroll::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 2px; }
.table-scroll::-webkit-scrollbar-thumb:hover { background: var(--ink-2); }
.table-scroll::-webkit-scrollbar-track { background: var(--surface-2); }

/* alias picker */
.al-panel { background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px;
  padding: 20px 22px; width: min(460px, 92vw); box-shadow: 0 20px 60px rgba(26,22,15,.35); }
.al-list { max-height: 46vh; overflow: auto; border: 1px solid var(--line-2); border-radius: 4px; margin-top: 10px; }
.al-item { display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left;
  padding: 9px 12px; background: none; border: none; border-bottom: 1px solid var(--line);
  cursor: pointer; font-size: 13px; color: var(--ink); }
.al-item:last-child { border-bottom: none; }
.al-item:hover, .al-item.on { background: var(--surface-2); }
.al-item .al-alias { font-size: 11px; color: var(--ink-2); font-family: var(--mono); }
.al-empty { padding: 14px 12px; font-size: 13px; }

/* Link picker: wider than the alias one, because each row carries a photo and
   four columns of ticket detail. Cramped into 460px the ticket number wrapped
   onto two lines, which is the one thing you are reading the row for. */
#linkModal .al-panel { width: min(820px, 94vw); }
#linkModal .al-list { max-height: 56vh; }
.ln-item {
  display: grid; grid-template-columns: 56px minmax(120px, 1.1fr) 2fr auto;
  align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 8px 12px; background: none; border: none; border-bottom: 1px solid var(--line);
  cursor: pointer; font-size: 13px; color: var(--ink);
}
.ln-item:last-child { border-bottom: none; }
.ln-item:hover, .ln-item.on { background: var(--surface-2); }
.ln-thumb { width: 52px; height: 40px; object-fit: cover; border: 1px solid var(--line-2);
  border-radius: 2px; background: #fff; display: block; }
.ln-nothumb { width: 52px; height: 40px; border: 1px dashed var(--line-2); border-radius: 2px; }
.ln-no { font-family: var(--mono); font-weight: 700; white-space: nowrap; }
.ln-no .ln-seq { color: var(--ink-2); font-weight: 400; margin-right: 6px; }
.ln-meta { color: var(--ink-2); font-family: var(--mono); font-size: 11.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ln-date { color: var(--ink-2); font-family: var(--mono); font-size: 11.5px; white-space: nowrap; }

/* ---------- spinner ---------- */
.spin {
  display: inline-block; width: 14px; height: 14px; flex: 0 0 auto;
  border: 2px solid var(--line-2); border-top-color: var(--amber);
  border-radius: 50%; animation: spin .7s linear infinite;
}
.spin.lg { width: 22px; height: 22px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 2s; } }

/* ---------- misc ---------- */
.muted { color: var(--ink-2); font-size: 12px; }
.tag { color: var(--ink-2); font-size: 11px; font-family: var(--mono); }
.thumb {
  width: 44px; height: 44px; object-fit: cover; border-radius: 2px;
  border: 1px solid var(--line-2); cursor: zoom-in; display: block;
}
/* pickup + chop photos side by side; the chop is outlined so the pair reads at a glance */
.shots { display: flex; gap: 4px; }
.shots .thumb[data-which="delivery"] { border-color: var(--green); box-shadow: 0 0 0 1px var(--green-soft); }
#thumbHover {
  /* above the modals (95): the link picker previews its rows this way, and at
     z-index 80 the preview rendered behind the very dialog that opened it */
  position: fixed; z-index: 120; pointer-events: none; display: none;
  background: #fff; padding: 4px; border: 1px solid var(--line-2);
  border-radius: 3px; box-shadow: 0 14px 40px rgba(26, 22, 15, .3);
}
#thumbHover img { display: block; max-width: 340px; max-height: 340px; border-radius: 2px; }
.empty { text-align: center; color: var(--ink-2); padding: 44px; font-size: 13px; }
code { font-family: var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: 2px; border: 1px solid var(--line); font-size: 12px; }

/* ---------- toast ---------- */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: var(--ink);
  color: #fff; border: none; padding: 12px 18px; border-radius: 3px;
  box-shadow: 0 8px 24px rgba(26, 22, 15, .25); opacity: 0;
  transform: translateY(8px); transition: opacity .18s, transform .18s; z-index: 100;
  font-size: 13px; font-weight: 600;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { background: var(--red); }

/* ---------- image modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(26, 22, 15, .72);
  display: none; align-items: center; justify-content: center; z-index: 95;
}
.modal-bg.show { display: flex; }
.modal-inner { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; }
.modal-inner .modal-tools { position: relative; z-index: 2; margin-top: 12px; }
.modal-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center;
  background: var(--surface); padding: 6px 8px; border-radius: 4px; border: 1px solid var(--line-2); }
.modal-tools .mt-edit, .modal-tools .mt-zoom { display: inline-flex; gap: 4px; align-items: center; }
.modal-tools .mt-edit[hidden] { display: none; }
.modal-tools .mt-edit, .modal-tools .mt-zoom { padding-left: 6px; border-left: 1px solid var(--line); }
.mt-level { font-family: var(--mono); font-size: 12px; color: var(--ink-2); min-width: 44px; text-align: center; }
/* Icon-only square buttons — the labels were eating the space the photo needs. */
.icon-btn {
  width: 30px; height: 28px; padding: 0; line-height: 1; font-size: 15px;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line-2);
  border-radius: 4px; cursor: pointer;
}
.icon-btn:hover { border-color: var(--amber); color: var(--amber-dark); }
.icon-btn.on { background: var(--amber-soft); border-color: var(--amber); color: var(--amber-dark); }
/* The stage is the whole window, not a square box. It used to be square so a
   90°-rotated image could never overflow it, but that spent most of the screen
   on empty backdrop and made zooming feel like peering through a porthole.
   Rotation is handled instead by swapping the image's max dimensions (see
   applyTransform), which needs no wasted space. */
.modal-stage {
  position: absolute; inset: 60px 0 0; display: flex;
  align-items: center; justify-content: center;
  overflow: hidden; touch-action: none;
}
.modal-stage img {
  max-width: 100%; max-height: 100%; border: 3px solid #fff; border-radius: 2px;
  background: #fff; transition: transform .12s ease; transform-origin: center center;
}
.modal-stage.zoomed { cursor: grab; }
.modal-stage.zoomed img { transition: none; }
.modal-stage.dragging { cursor: grabbing; }
.be-panel { background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px;
  padding: 22px 24px; width: min(460px, 92vw); box-shadow: 0 20px 60px rgba(26, 22, 15, .35); }
.be-fields { display: flex; flex-direction: column; gap: 9px; }
.be-row { display: grid; grid-template-columns: 20px 130px 1fr; align-items: center; gap: 10px;
  margin: 0; text-transform: none; letter-spacing: normal; }
.be-row input[type="checkbox"] { width: auto; margin: 0; }
.be-row .be-label { font-size: 13px; color: var(--ink); font-weight: 600; }
.be-row .be-val { margin: 0; }
.be-row .be-val:disabled { background: var(--surface-2); opacity: .55; }
.be-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
/* product matched via alias → show canonical name in blue, original on hover */
.aliased { color: #2563eb; }
input.inline-edit.aliased { color: #2563eb; text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
span.aliased { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
span.prod-alias { cursor: text; }
/* instant custom tooltip (native title has a ~0.7s browser delay) */
#tip {
  position: fixed; z-index: 90; pointer-events: none; display: none;
  background: var(--ink); color: #fff; padding: 5px 9px; border-radius: 4px;
  font-size: 12px; line-height: 1.3; max-width: 340px; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(26, 22, 15, .3);
}
.drag-handle { cursor: grab; color: var(--ink-2); user-select: none; font-size: 15px; display: inline-block; padding: 0 2px; }
.drag-handle:active { cursor: grabbing; }
tr.merge-target > td { background: var(--amber-soft); box-shadow: inset 0 2px 0 var(--amber), inset 0 -2px 0 var(--amber); }

/* ---------- narrow screens (a phone, a half-width window) ----------
   The header used to be one row that scrolled sideways as a whole, hiding the
   user box and tenant switch off-screen. Here the menu gets its own row and
   only the menu scrolls; a wide table scrolls inside its card instead of
   dragging the whole page sideways. */
@media (max-width: 900px) {
  header { flex-wrap: wrap; height: auto; padding: 8px 14px 0; gap: 6px 14px; overflow: visible; }
  header .brand { min-height: 34px; }
  .userbox { flex-wrap: wrap; gap: 8px; }
  header nav { order: 3; flex: 1 0 100%; height: 40px; overflow-x: auto; scrollbar-width: none; }
  header nav::-webkit-scrollbar { display: none; }
  main { margin: 20px auto; padding: 0 14px; }
  .card { padding: 16px; }
  .card table { display: block; max-width: 100%; overflow-x: auto; }
  .card .table-scroll table { display: table; max-width: none; overflow: visible; }
}
