body {
  font-family: system-ui, sans-serif;
  margin: 0;
  color: #1a1a1a;
  background-color: #ffffff;
}

nav {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid #ddd;
}

nav a {
  color: #1a1a1a;
  text-decoration: none;
}

nav a:hover {
  text-decoration: underline;
}

.logout-form {
  margin-left: auto;
}

main {
  padding: 1.5rem;
  max-width: 960px;
}

/* Wide data tables (Matches) -- each PO lists its seats beside it, which
   needs more room than a 960px text column. */
main.wide {
  max-width: none;
}

footer {
  padding: 0.75rem 1.5rem;
  border-top: 1px solid #ddd;
  color: #666;
  font-size: 0.8rem;
}

footer .version {
  color: #999;
}

form label {
  display: block;
  margin-bottom: 0.75rem;
}

.error {
  color: #b00020;
}

.ticket-detail {
  display: block;
  font-size: 0.8rem;
  line-height: 1.3;
  color: #666;
}

.card-last4 {
  font-size: 0.8rem;
  color: #666;
  white-space: nowrap;
}

/* The maple leaf (Canada), at text size. */
.maple-leaf svg {
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  fill: #d30505;
}

/* Matches: the Country column -- the charge's country solid, the other
   faded until hovered. */
td.country-cell {
  white-space: nowrap;
  text-align: center;
}

.country-set {
  display: inline-flex;
  gap: 0.15rem;
}

.country-region {
  display: block;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: #444;
}

.country-btn {
  background: none;
  border: none;
  padding: 0.1rem;
  cursor: pointer;
  opacity: 0.2;
  line-height: 1;
}

.country-btn.on {
  opacity: 1;
}

.country-btn:hover, .country-btn:focus-visible {
  opacity: 0.7;
}

.country-btn.on:hover {
  opacity: 1;
}

.quality-missing {
  display: block;
  font-size: 0.8rem;
  color: #666;
  white-space: nowrap;
}

.nowrap {
  white-space: nowrap;
}

.po-tickets summary {
  font-size: 0.8rem;
  color: #666;
  cursor: pointer;
}

/* Matches: each entry is its charge on a line of its own, then a line per
   purchase order under it, and a darker rule closing the entry. Every
   other entry is shaded so each reads as one block. */
tbody.entry:nth-of-type(even) td {
  background-color: #f4f5f7;
}

/* A duplicate of a charge already on file: highlighted, and tagged beside
   its description. */
tbody.entry.duplicate td {
  background-color: #fff4dc;
}

/* Signed off: the whole entry tinted green, whatever its shading. */
tbody.entry.signed-off td {
  background-color: #e8f5e9;
}

/* A Note on it: the charge line in notepad yellow, signed off or not. */
tbody.entry.has-note tr.txn-line td {
  background-color: #fff6b3;
}

/* A PO line passed over for the one picked: tinted red, whatever the
   entry's own shading. */
tbody.entry tr.po-line.rejected td {
  background-color: #fde8e8;
}

/* The POs Combined PO Matching found adding up to the charge: tinted
   blue, whatever the entry's own shading. */
tbody.entry tr.po-line.combined td {
  background-color: #e6f0fb;
}

/* Signed off: the PO lines it wasn't matched to, folded away until its
   "N other POs considered" toggle opens them. */
tbody.entry tr.po-line.considered {
  display: none;
}
tbody.entry.show-considered tr.po-line.considered {
  display: table-row;
}
.considered-open {
  background: none;
  border: none;
  padding: 0;
  color: #555;
  font-size: 0.85rem;
  cursor: pointer;
}
.considered-open:hover {
  text-decoration: underline;
}

.duplicate-tag {
  font-size: 0.75rem;
  font-weight: normal;
  color: #6b4100;
  background-color: #ffdf9e;
  border-radius: 3px;
  padding: 0 0.35rem;
  white-space: nowrap;
}

.duplicate-note {
  display: block;
  font-size: 0.8rem;
  color: #6b4100;
}

tr.txn-line td {
  border-bottom: none;
}

td.charge {
  font-weight: 600;
}

/* Each entry's own Note, on its charge line under Tickets: as wide as the
   column, a long one cut off with "..." (the whole of it on hover). */
.entry-note-box {
  margin-top: 0.3rem;
}

.entry-note-box .note-label {
  display: block;
  margin: 0;
  font-size: 0.75rem;
  color: #555;
}

/* The note's box, then who added it -- "– alex" -- beside it. */
.entry-note-row {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

input.entry-note {
  flex: 1;
  width: 100%;
  min-width: 4rem;
  box-sizing: border-box;
  text-overflow: ellipsis;
}

.note-by {
  font-size: 0.8rem;
  color: #555;
  white-space: nowrap;
}

.note-status {
  display: block;
  font-size: 0.75rem;
  color: #666;
}

/* Each entry outlined as one box -- its charge line and every PO line
   under it -- so where one ends and the next starts is plain. */
.matches-table tbody.entry {
  border: 2px solid #8a94a0;
}

/* A darker rule closing each entry, under its last line. */
tbody.entry > tr:last-child td,
tr.group-end td {
  border-bottom: 1px solid #ccc;
}

.held-by {
  display: block;
  font-size: 0.8rem;
}

/* Manual Match window: wraps inside the PO # column, which doesn't. */
.manual-list .held-by {
  white-space: normal;
}

/* Matches: a PO's other show dates, listed on hover. */
.more-shows {
  text-decoration: underline dotted;
  cursor: help;
  white-space: nowrap;
}

/* Matches: a PO a twin charge holds that this one could just as well be. */
.also-fits {
  display: block;
  font-size: 0.8rem;
  color: #666;
}

/* Matches: a price that lines up once converted between CAD and USD. */
.fx-hit {
  display: block;
  font-size: 0.8rem;
  color: #1b5f9e;
  white-space: nowrap;
}

.fx-tolerance {
  width: 4.5rem;
}

.fx-on {
  font-size: 0.9rem;
}

/* Upload: every file ever uploaded, scrolling once it's long. */
.upload-log {
  margin-top: 2.5rem;
}

.upload-log-scroll {
  max-height: 24rem;
  overflow-y: auto;
  border: 1px solid #eee;
}

.upload-log th {
  position: sticky;
  top: 0;
  background: #fff;
}

/* Card & Email Reference: every Venue Matching row is edited in place. */
.venue-table input[type="text"] {
  width: 100%;
  box-sizing: border-box;
}

.venue-actions {
  white-space: nowrap;
}

/* A venue's country: a radio beside the maple leaf, one beside the flag. */
.country-picker {
  white-space: nowrap;
}

.country-picker label {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin: 0 0.5rem 0 0;
  cursor: pointer;
}

.filter-form .country-picker input {
  display: inline;
  margin-top: 0;
}

.country-field {
  font-size: 0.9rem;
}

.country-field .country-picker {
  display: block;
  margin-top: 0.25rem;
}

.us-flag svg {
  width: 1.5em;
  height: 0.8em;
  vertical-align: -0.05em;
  outline: 1px solid #ccc;
}

.venue-table input.region-input, input.region-input {
  width: 3.5em;
  text-transform: uppercase;
}

.venue-actions form {
  display: inline;
}

.placeholder {
  border: 1px dashed #ccc;
  padding: 1rem;
  color: #666;
}

section {
  margin-bottom: 2rem;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  text-align: left;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid #eee;
}

.summary-banner {
  background: #f0f7f0;
  border: 1px solid #cde5cd;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}

.summary-banner .warning {
  color: #b00020;
}

/* A question for the operator (e.g. the Matches page's venue prompt) --
   same shape as .summary-banner, different color so it reads as one. */
.prompt-banner {
  background: #fff8e1;
  border: 1px solid #ecd98a;
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
}

/* Matches: the venue prompt opens the entry it's about, right above it --
   and once answered, its confirmation shows in that spot, then folds away. */
tr.prompt-row td, tr.notice-row td {
  border-bottom: none;
  padding-top: 0.75rem;
}

tr.prompt-row .prompt-banner {
  margin-bottom: 0;
}

tr.notice-row td {
  transition: padding 0.4s;
}

tr.notice-row .summary-banner {
  margin-bottom: 0;
  max-height: 10rem;
  overflow: hidden;
  transition: opacity 0.4s, max-height 0.4s, padding 0.4s, border-width 0.4s;
}

tr.notice-row.fading td {
  padding-top: 0;
  padding-bottom: 0;
}

tr.notice-row.fading .summary-banner {
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
}

/* The prompt's answers, pushed to the banner's right edge. */
.prompt-actions {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-left: auto;
}

.filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 1rem;
}

.filter-form label {
  margin-bottom: 0;
  font-size: 0.9rem;
}

.filter-form input, .filter-form select {
  display: block;
  margin-top: 0.25rem;
}

/* Has a note: its checkbox beside its words, not above them. */
/* Has a note and Has combined POs, one above the other. */
.filter-form .checkbox-group {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.2rem;
}

.filter-form label.checkbox-filter {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.filter-form label.checkbox-filter input {
  display: inline;
  margin-top: 0;
}

.upload-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.upload-column {
  flex: 1;
  min-width: 220px;
}

.upload-box {
  border: 1px solid #ddd;
  border-radius: 4px;
  background: #fafafa;
  padding: 0.75rem 1rem;
  margin: 0;
}

.upload-box legend {
  font-weight: 600;
  padding: 0 0.4rem;
}

.upload-box p {
  margin-top: 0;
  font-size: 0.9rem;
  color: #555;
}

/* Upload page: CAD/USD converter -- two currency panels with a swap
   button between them. Amounts and both rates are editable in place. */
.fx-hint {
  font-size: 0.9rem;
  color: #555;
}

.fx-converter {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  max-width: 52rem;
  margin: 1rem 0 0.5rem;
}

.fx-converter.swapped {
  flex-direction: row-reverse;
}

.fx-side {
  flex: 1;
  min-width: 0;
}

.fx-currency {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #333;
}

.fx-flag {
  flex: none;
  box-shadow: 0 0 0 0.5px #999;
}

.fx-amount {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 1rem;
  padding: 0.2rem 0;
  border: none;
  border-bottom: 1px solid #bbb;
  background: transparent;
  font: inherit;
  font-size: 2rem;
  color: #0b63b6;
  text-align: center;
}

.fx-amount:focus {
  outline: none;
  border-bottom-color: #0b63b6;
}

.fx-rate {
  margin-top: 0.3rem;
  font-size: 0.85rem;
  color: #444;
  text-align: center;
}

.fx-rate input {
  width: 5em;
  border: none;
  border-bottom: 1px dashed #aaa;
  background: transparent;
  font: inherit;
}

.fx-swap {
  flex: none;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  border: 1.5px solid #0b63b6;
  background: #fff;
  color: #0b63b6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fx-status {
  font-size: 0.85rem;
  color: #555;
  margin: 0.25rem 0 1.25rem;
}

.fx-status.error {
  color: #b00020;
}

/* Sign off selected, in the table header's last cell -- the header stays
   in view while picking lines down the table. */
.matches-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background-color: #ffffff;
}

th.bulk-signoff {
  text-align: right;
  white-space: nowrap;
}

/* A line's radio for it, beside its own Sign off. */
.sign-off-cell {
  white-space: nowrap;
}

.sign-off-cell form {
  display: inline;
}

.bulk-pick {
  margin-right: 0.4rem;
  vertical-align: middle;
}

.prompt-queue {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-top: 0.5rem;
}

/* The venue prompt's country choice, beside its answers. */
.prompt-country {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

/* The Upload page's own-named Taekus slot: its name, then its file. */
.custom-source {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 0 0.75rem;
}

/* Matches table columns (and the Manual Match window's), resizable by
   dragging a header's right edge. */
table.resizable {
  table-layout: fixed;
}

table.resizable td {
  overflow-wrap: anywhere;
}

.col-resize {
  position: absolute;
  top: 0;
  right: -3px;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  z-index: 1;
  touch-action: none;
}

/* Always shown: a thin divider down the middle of the handle, bolder on
   hover or while dragging. */
.col-resize::after {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 2px;
  width: 3px;
  border-radius: 2px;
  background: #d0d4da;
}

.col-resize:hover::after,
.col-resize:active::after {
  top: 0;
  bottom: 0;
  background: #8a93a0;
}

.columns-reset {
  margin: 0;
  font-size: 0.85rem;
  text-align: right;
}

/* The Upload page's Run reconciliation, in its own box beside the files. */
.run-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  gap: 0.75rem;
  text-align: center;
}

.run-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 1.6rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: #ffffff;
  background-color: #1f7a3f;
  border: none;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: background-color 0.15s, transform 0.05s;
}

.run-button:hover {
  background-color: #186332;
}

.run-button:active {
  transform: translateY(1px);
}

.run-button:focus-visible {
  outline: 3px solid #9fd3b0;
  outline-offset: 2px;
}

.run-hint {
  margin: 0;
  font-size: 0.85rem;
  color: #666;
}

/* The Card & Email page's Danger zone: a red box, red buttons. */
.danger-zone {
  border: 2px solid #c62828;
  border-radius: 8px;
  background-color: #fff5f5;
  padding: 0.5rem 1.25rem 1rem;
  margin-top: 2rem;
}

.danger-zone h2 {
  color: #b71c1c;
}

.danger-action + .danger-action {
  border-top: 1px solid #f1c4c4;
  margin-top: 1rem;
  padding-top: 0.5rem;
}

.danger-button {
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  font-weight: 600;
  color: #ffffff;
  background-color: #c62828;
  border: none;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.danger-button:hover {
  background-color: #a31f1f;
}

.danger-button:active {
  transform: translateY(1px);
}

.danger-button:disabled {
  background-color: #d9a3a3;
  box-shadow: none;
  cursor: not-allowed;
}

/* Matches: every entry in the system, under Export current view. */
.match-totals {
  margin-top: -0.5rem;
  color: #444;
}

/* Entries still to sign off, under the first column's heading. */
.left-count {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #1f7a3f;
  white-space: nowrap;
}

/* Select all, beside Sign off selected, on one line. */
th.bulk-signoff button {
  white-space: nowrap;
}

th.bulk-signoff button + button {
  margin-left: 0.4rem;
}

/* Matches: a Manual Match's Quality line says how many POs and their
   total; the POs after the first follow it. */
.manual-total {
  display: block;
  font-size: 0.8rem;
  color: #555;
  white-space: nowrap;
}

tbody.entry tr.po-line.manual-more td:nth-child(2) {
  font-size: 0.85rem;
  color: #555;
}

/* Flag: Office Expense and Manual Match, side by side
   (wrapping when the column's narrow). */
.entry-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

.entry-flags form {
  display: inline;
  margin: 0;
}

/* The Manual Match window: the charge on top, the POs to pick from in a
   list that scrolls on its own, and the running total with Sign off at
   the bottom. */
.manual-dialog {
  width: min(70rem, calc(100vw - 2rem));
  max-height: calc(100vh - 3rem);
  padding: 0;
  border: 1px solid #ccc;
  border-radius: 6px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

.manual-dialog::backdrop {
  background: rgba(0, 0, 0, 0.35);
}

.manual-body > .manual-loading, .manual-body > .error {
  display: block;
  padding: 1.25rem;
}

/* A steady height, so Show all and the searches don't move the window
   (or what's under the pointer) about as the list grows and shrinks. */
.manual-form, .split-form {
  display: flex;
  flex-direction: column;
  height: min(44rem, calc(100vh - 3rem));
}

.manual-form > *, .split-form > * {
  margin: 0;
  padding: 0 1.25rem;
}

.manual-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.9rem;
}

.manual-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.manual-head .manual-close {
  border: none;
  background: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: #555;
}

.manual-charge {
  padding-top: 0.25rem;
}

.manual-scope {
  padding-top: 0.6rem;
  font-size: 0.9rem;
  color: #444;
}

.manual-form label.manual-all {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0 0 0 0.75rem;
  white-space: nowrap;
  font-weight: 600;
  color: #1a1a1a;
}

.manual-search {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 0.6rem;
}

.manual-search label {
  margin: 0;
  font-size: 0.9rem;
}

.manual-search input {
  display: block;
  margin-top: 0.2rem;
  width: 12rem;
}

.manual-search {
  align-items: flex-end;
}

/* The Amount range: From and To side by side under its legend. */
.manual-range {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
  margin: 0;
  padding: 0.2rem 0.6rem 0.5rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.manual-range legend {
  font-size: 0.9rem;
  padding: 0 0.25rem;
}

.manual-range legend small {
  color: #666;
}

.manual-search .manual-range input {
  width: 7rem;
}

.manual-count {
  margin-left: auto;
  font-size: 0.85rem;
  color: #666;
  white-space: nowrap;
}

.manual-columns-reset {
  border: none;
  background: none;
  padding: 0;
  font-size: 0.85rem;
  color: #1b5f9e;
  text-decoration: underline;
  cursor: pointer;
}

/* The last column's handle stays inside the list, rather than sticking out
   past it into a sideways scrollbar. */
.manual-list th:last-child .col-resize {
  right: 0;
}

/* A PO's own total, struck through under the card's price accepted for it. */
.price-was {
  display: block;
  color: #888;
  font-size: 0.85em;
}

.manual-total .price-was {
  display: inline;
}

/* A PO's artist, on its own line above its tickets. */
.manual-artist {
  display: block;
  font-weight: 600;
}

/* Each section and row's seats on a line of its own. */
.manual-seats span {
  display: block;
  font-size: 0.85rem;
}

.manual-form .manual-list, .split-form .manual-list {
  flex: 1;
  min-height: 8rem;
  /* Sideways too, once its columns are dragged wider than the window. */
  overflow: auto;
  margin: 0.75rem 1.25rem 0;
  padding: 0;
  border: 1px solid #e3e3e3;
}

.manual-list th {
  position: sticky;
  top: 0;
  background: #f4f5f7;
  font-size: 0.85rem;
}

.manual-list td {
  font-size: 0.9rem;
}

.manual-list tbody tr {
  cursor: pointer;
}

.manual-list tbody tr:hover td {
  background-color: #f6f8fb;
}

.manual-list tbody tr.picked td {
  background-color: #e6f1e8;
}

.manual-list .num {
  text-align: right;
  white-space: nowrap;
}

.manual-empty {
  padding: 1rem;
  color: #666;
}

.manual-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  padding-top: 0.8rem;
  padding-bottom: 1rem;
  border-top: 1px solid #eee;
  margin-top: 0.75rem;
}

.manual-selected {
  flex: 1;
  margin: 0;
  font-size: 0.95rem;
}

.manual-sum {
  font-weight: 600;
}

.manual-fits {
  color: #1f7a3f;
  font-weight: 600;
}

.manual-actions {
  display: flex;
  gap: 0.6rem;
}

.manual-submit {
  font-weight: 600;
}

/* Matches: a line on each filter, under the heading -- a compact grid
   that folds away. */
.filter-guide {
  margin: -0.5rem 0 1rem;
  font-size: 0.85rem;
  color: #333;
}

.filter-guide summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.filter-guide dl {
  margin: 0;
}

.filter-guide dl div {
  margin: 0 0 0.2rem;
}

/* The guide in the same boxes, on the same grid, as the filters below. */
.guide-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

.guide-group h3 {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  color: #184f95;
}

.filter-guide dt {
  display: inline;
  font-weight: 700;
}

.filter-guide dt::after {
  content: " - ";
  font-weight: 400;
}

.filter-guide dd {
  display: inline;
  margin: 0;
}

/* Split PO: the PO split and the new one side by side, then its seats. */
.split-sides {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding-top: 0.6rem;
}

.split-sides fieldset {
  flex: 1 1 18rem;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 0.5rem 0.9rem;
  margin: 0;
  padding: 0.3rem 0.75rem 0.7rem;
  border: 1px solid #ddd;
  border-radius: 4px;
}

.split-sides legend {
  font-size: 0.9rem;
  font-weight: 600;
}

.split-sides label {
  margin: 0;
  font-size: 0.9rem;
}

.split-sides input {
  display: block;
  margin-top: 0.2rem;
  width: 11rem;
}

.split-sides p {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.9rem;
}

.split-count {
  font-weight: 600;
}

.split-fixed {
  color: #555;
}

.split-sum {
  padding-top: 0.5rem;
  font-size: 0.9rem;
}

.split-error, .split-done {
  margin: 0.6rem 1.25rem 0;
}

/* On a Matches PO line: how the PO was split (Split PO). */
.split-tag {
  display: block;
  font-size: 0.8rem;
  color: #5a3d8a;
  /* Wraps inside its column, though the PO # beside it doesn't. */
  white-space: normal;
}

/* Undo split, under a split-off PO's number in the Manual Match window. */
.split-undo {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.8rem;
}

.split-seats tbody tr {
  cursor: default;
}

/* Card & Email Reference: wider than the text pages, every section a
   panel, two to a row where they fit -- the wide one on the left, a narrow
   one beside it (Flags; Emails without a card). One column on a narrow
   window. */
main.reference {
  max-width: 1280px;
}

.reference-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 1.25rem;
}

.reference-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

@media (max-width: 900px) {
  .reference-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.panel {
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fafafa;
  padding: 0.25rem 1rem 1rem;
  margin-bottom: 1.25rem;
  /* A table that still can't fit (a narrow window) scrolls inside it
     rather than spilling over the next panel. */
  overflow-x: auto;
}

.reference-row .panel {
  margin-bottom: 0;
}

.panel h2 {
  margin: 0.75rem 0 0.25rem;
  font-size: 1.3rem;
}

.panel-hint {
  font-size: 0.85rem;
  color: #555;
  margin: 0 0 0.75rem;
}

/* Inside a panel, what holds data or a form stands out white on its grey;
   its cells a little tighter than elsewhere. */
.panel table {
  background: #fff;
  border: 1px solid #e6e6e6;
}

.panel th, .panel td {
  padding: 0.35rem 0.5rem;
}

.panel .upload-box,
.panel .placeholder {
  background: #fff;
}

.panel .placeholder {
  margin: 0;
}

.panel .filter-form:last-child {
  margin-bottom: 0;
}

/* The Card & Email exports, on one line under the upload slots. */
.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  margin: 0.75rem 0 0;
  font-size: 0.9rem;
}

/* A new flag's name and its Add, on one line. */
.flag-new {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.flag-new input {
  flex: 1;
  min-width: 0;
}

/* Each flag's name edited in place. */
.flags-table input[type="text"] {
  width: 100%;
  box-sizing: border-box;
}

.flags-table th, .flags-table td {
  padding: 0.3rem 0.35rem;
}

.flags-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.flag-actions {
  white-space: nowrap;
  text-align: right;
}

.flag-actions form {
  display: inline;
}

.removed-flags {
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

.removed-flags summary {
  cursor: pointer;
  color: #555;
}

/* Venue Matching: the client's state and province codes, folded away,
   the two lists side by side once opened. */
.region-reference {
  margin-bottom: 1rem;
}

.region-reference summary {
  cursor: pointer;
  font-weight: 600;
}

.region-lists {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: flex-start;
}

.region-lists h3 {
  font-size: 1rem;
  margin: 0.75rem 0 0.4rem;
}

.region-lists table {
  width: auto;
  font-size: 0.9rem;
}

.region-lists td {
  padding: 4px 8px;
  border: 1px solid #ccc;
}

/* Matches: an entry's flags (Flags column) -- a pill each, its x taking it
   off, then "+ Flag". */
td.flags-cell {
  min-width: 7rem;
}

.flag-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}

.flag-pills:empty {
  display: none;
}

.flag-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.8rem;
  color: #0d366b;
  background-color: #cde2fb;
  border-radius: 999px;
  padding: 0.05rem 0.2rem 0.05rem 0.55rem;
  white-space: nowrap;
}

.flag-off {
  background: none;
  border: none;
  padding: 0 0.25rem;
  font-size: 0.9rem;
  line-height: 1;
  color: #184f95;
  cursor: pointer;
  border-radius: 999px;
}

.flag-off:hover, .flag-off:focus-visible {
  background-color: #9ec5f4;
}

select.flag-add {
  font-size: 0.8rem;
  max-width: 100%;
}

.flag-status {
  display: block;
  font-size: 0.75rem;
  color: #666;
}

/* Metrics: a row of headline tiles, then a table per breakdown with a bar
   beside each share. */
.metrics-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
}

.metrics-filter label {
  margin: 0;
}

.metrics-scope {
  color: #666;
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 2rem;
}

.kpi {
  border: 1px solid #e3e3e3;
  border-radius: 6px;
  padding: 0.75rem 0.9rem;
  background-color: #fcfcfb;
}

.kpi-label {
  font-size: 0.85rem;
  color: #52514e;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 600;
  margin: 0.15rem 0;
  color: #0b0b0b;
}

.kpi-sub {
  font-size: 0.8rem;
  color: #666;
}

.kpi .meter {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
}

.metrics-table th.num, .metrics-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.metrics-table tfoot td {
  font-weight: 600;
  border-top: 1px solid #ccc;
  border-bottom: none;
}

.metrics-table tfoot small {
  font-weight: normal;
  color: #666;
}

.metrics-table tr.empty td {
  color: #999;
}

.metrics-table td.bar-cell {
  white-space: nowrap;
  min-width: 12rem;
}

.bar-figure {
  display: inline-block;
  min-width: 4.5rem;
  margin-left: 0.5rem;
  font-size: 0.85rem;
  color: #52514e;
  font-variant-numeric: tabular-nums;
}

/* A share as a bar: the fill on a lighter track of the same blue. */
.meter {
  display: inline-block;
  vertical-align: middle;
  width: 10rem;
  height: 8px;
  border-radius: 4px;
  background-color: #cde2fb;
  overflow: hidden;
}

.meter > span {
  display: block;
  height: 100%;
  background-color: #2a78d6;
  border-radius: 4px;
}

/* Matches: the filters in labeled boxes on a grid -- as many to a row as
   fit -- two fields to a row inside each. A field changed from its default
   is outlined blue, and its box's heading counts them. */
.match-filters {
  margin-bottom: 1.25rem;
}

.filter-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
}

/* Six boxes, so always a full row: all six on a wide screen, three and
   three, then two, then one as the window narrows (the guide's too). */
@media (min-width: 1800px) {
  .filter-groups, .guide-groups {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .filter-groups, .guide-groups {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .filter-groups, .guide-groups {
    grid-template-columns: minmax(0, 1fr);
  }
}

.filter-group {
  min-width: 0;
  margin: 0;
  padding: 0.3rem 0.75rem 0.75rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: #fafafa;
}

.filter-group.has-set {
  border-color: #9ec5f4;
}

.filter-group legend {
  padding: 0 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
}

.group-count {
  display: inline-block;
  min-width: 1.1rem;
  margin-left: 0.2rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: #2a78d6;
  color: #fff;
  font-size: 0.72rem;
  line-height: 1.1rem;
  text-align: center;
}

.group-count:empty {
  display: none;
}

.filter-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.5rem 0.6rem;
  /* Side by side fields line up even when one's label takes two lines. */
  align-items: end;
}

.filter-fields .span-2 {
  grid-column: 1 / -1;
}

.filter-fields label {
  min-width: 0;
  margin: 0;
  font-size: 0.8rem;
  color: #444;
}

.filter-fields input:not([type="checkbox"]),
.filter-fields select {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-top: 0.2rem;
  padding: 0.25rem 0.4rem;
  border: 1px solid #c8cdd3;
  border-radius: 4px;
  background: #fff;
  font: inherit;
  font-size: 0.85rem;
  color: #1a1a1a;
}

.filter-fields input:not([type="checkbox"]):focus,
.filter-fields select:focus {
  outline: 2px solid #86b6ef;
  outline-offset: 0;
  border-color: #2a78d6;
}

.filter-fields .is-set > input:not([type="checkbox"]),
.filter-fields .is-set > select {
  border-color: #2a78d6;
  background: #eef5fd;
}

.filter-checks {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.filter-fields label.checkbox-filter {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: #1a1a1a;
  cursor: pointer;
}

.filter-fields label.checkbox-filter input {
  margin: 0;
}

.filter-fields label.checkbox-filter.is-set {
  font-weight: 600;
  color: #184f95;
}

.filter-fields .error {
  font-size: 0.8rem;
}

/* Filter, Clear all and how many are set, under the boxes. */
.filter-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
}

.filter-submit {
  padding: 0.4rem 1.6rem;
  border: 1px solid #1c5cab;
  border-radius: 4px;
  background: #2a78d6;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.filter-submit:hover {
  background: #256abf;
}

.filter-summary {
  font-size: 0.85rem;
  color: #555;
}
