/* Merchant cabinet: a sidebar of stations and a working area. Builds on rublay.css (tokens, sign band, signs). */
body { display: flex; flex-direction: column; min-height: 100vh; }
/* the cabinet works with tables: wider than the landing's column, still capped so rows stay readable */
.wrap.wide { max-width: 1680px; padding-inline: clamp(16px, 3vw, 40px); }
.who { color: var(--on-navy); font-size: 16px; }
.out { margin: 0; }
.out button { background: none; border: 0; padding: 6px 0; color: #fff; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 0.22em; text-decoration-thickness: 2px; }
.out button:hover { text-decoration-thickness: 3px; }
.out button:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.cab { flex: 1; width: 100%; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 48px; padding-top: 40px; padding-bottom: 72px; align-items: start; }
.cab-main { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }

/* the sidebar is a short line: the current station is filled */
.cab-nav { display: grid; gap: 4px; position: sticky; top: 24px; padding-left: 20px; border-left: 6px solid var(--red); }
.cab-nav a { display: block; padding: 10px 14px; font-size: 18px; font-weight: 600; text-decoration: none; border-radius: 2px; }
.cab-nav a:hover { background: var(--panel); }
.cab-nav a[aria-current="page"] { background: var(--navy); color: #fff; }
.cab-nav a:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.cab-nav .side { margin-top: 16px; font-size: 16px; font-weight: 400; color: var(--navy-2); }

.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 24px; }
.cab h1 { font-size: clamp(28px, 3vw, 40px); line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.cab h2 { font-size: 22px; line-height: 1.2; font-weight: 700; }
.cab h3 { font-size: 18px; font-weight: 700; margin-top: 8px; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.sec-head a { font-size: 16px; }
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 0.85em; word-break: break-all; }
.muted { color: var(--navy-2); }
.empty { padding: 32px; background: var(--panel); border-radius: 2px; color: var(--navy-2); }
.sign.small { min-height: 48px; font-size: 17px; padding: 0 20px; }
button.sign { border: 0; cursor: pointer; font-family: inherit; }
.sign:active { translate: 0 1px; }
/* A submit button that says what is happening while htmx waits for the server. */
.sign .busy { display: none; }
.htmx-request .sign .idle { display: none; }
.htmx-request .sign .busy { display: inline; }
.sign:disabled { cursor: progress; opacity: 0.75; }

/* figures */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { display: grid; align-content: start; gap: 6px; padding: 20px 22px; background: var(--panel); border-radius: 2px; }
.tile.main { background: var(--navy); color: #fff; }
.tile-l { font-size: 15px; color: var(--navy-2); }
.tile.main .tile-l, .tile.main .tile-n { color: var(--on-navy); }
.tile-v { font-size: clamp(26px, 2.6vw, 38px); line-height: 1.1; font-weight: 800; letter-spacing: -0.02em; }
.tile-n { font-size: 15px; color: var(--navy-2); }
.tile-a { margin-top: 8px; color: #fff; font-weight: 700; justify-self: start; }
.tile-a:focus-visible { outline-color: #fff; }

/* plates and forms */
.plate { display: grid; gap: 18px; padding: 28px; border-radius: 2px; background: var(--panel); }
.plate > p { max-width: 70ch; text-wrap: pretty; }
.plate.capped { max-width: 720px; }
.plate.tight { gap: 14px; padding: 22px 28px; }
/* amount, address and the button in one row; the quote runs underneath */
.payout-form { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; gap: 8px 24px; align-items: start; }
.payout-form .quote { grid-column: 1 / -1; }
.spacer { font-size: 16px; line-height: 1.6; }
.payout-form .sign { min-height: 52px; font-size: 18px; padding: 0 28px; }
.plate.soon { opacity: 0.7; }
.stack { display: grid; gap: 18px; }
.narrow { max-width: 420px; }
.stack .sign, .plate > .sign { justify-self: start; }
.field { display: grid; gap: 8px; min-width: 0; }
.field.wide { flex: 1 1 320px; }
.field label { font-size: 16px; font-weight: 700; }
.field input, .field select {
  width: 100%; height: 52px; padding: 0 14px; border: 2px solid var(--navy-2); border-radius: 2px;
  background: #fff; color: var(--navy); font: 400 17px var(--font);
}
.field input:hover, .field select:hover { border-color: var(--navy); }
.field input:focus-visible, .field select:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; border-color: var(--navy); }
.field input[aria-invalid="true"] { border-color: var(--red-text); }
.field input[readonly] { background: var(--ground); font-family: ui-monospace, Menlo, monospace; font-size: 15px; }
.hint { font-size: 14px; line-height: 1.45; color: var(--navy-2); }
.plate code, .cab p code { font: 700 14px ui-monospace, Menlo, monospace; background: var(--ground); padding: 2px 6px; border-radius: 2px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: start; gap: 8px 16px; }
.inline-form .field { flex: 1 1 240px; }
.inline-form .field.go { flex: none; }
.inline-form .sign { min-height: 52px; }
.copy { display: flex; gap: 12px; align-items: stretch; }
.copy input { flex: 1; min-width: 0; }
.copy form { margin: 0; }
.quote { min-height: 44px; padding: 10px 16px; background: var(--ground); border-radius: 2px; }
.secret { padding: 16px; border: 2px solid var(--lock); border-radius: 2px; display: grid; gap: 10px; }
.secret input { height: 48px; padding: 0 12px; border: 2px solid var(--navy); border-radius: 2px; font: 600 15px ui-monospace, Menlo, monospace; background: #fff; color: var(--navy); width: 100%; }

.notice, .alert { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 2px; font-size: 16px; font-weight: 700; }
.notice { background: var(--navy); color: #fff; }
.notice .chip { width: 14px; height: 14px; border-radius: 50%; background: #fff; flex: none; }
.alert { background: var(--panel); color: var(--red-text); border: 2px solid var(--red); }

/* filter */
.filter { display: flex; flex-wrap: wrap; align-items: end; gap: 16px; }
.filter .field { flex: 1 1 200px; }
.filter .field:first-child { flex-basis: 280px; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--panel); border-radius: 2px; }
.table { width: 100%; border-collapse: collapse; font-size: 16px; }
.table th { text-align: left; font-size: 14px; font-weight: 700; color: var(--navy-2); padding: 12px 16px; background: var(--panel); border-bottom: 2px solid var(--navy); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }
.table .when { white-space: nowrap; color: var(--navy-2); font-size: 15px; }
.table .clip { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .act { text-align: right; }
.table .act form { margin: 0; }
.table tr.dim td { color: var(--navy-2); }
.link-danger { background: none; border: 0; padding: 4px 0; font: inherit; font-weight: 700; color: var(--red-text); cursor: pointer; text-decoration: underline; text-underline-offset: 0.22em; text-decoration-thickness: 2px; }
.link-danger:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 2px; font-size: 14px; font-weight: 700; white-space: nowrap; background: var(--ground); color: var(--navy); border: 2px solid var(--navy-2); }
.badge.big { font-size: 18px; padding: 6px 14px; }
.badge.paid, .badge.ok { background: var(--green); border-color: var(--green); color: #fff; }
.badge.pending, .badge.requested, .badge.waiting { background: #fff; border-color: var(--navy); }
.badge.failed, .badge.rejected { background: var(--red-text); border-color: var(--red-text); color: #fff; }
.badge.expired, .badge.cancelled { color: var(--navy-2); }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 16px; font-size: 16px; color: var(--navy-2); }

.facts { display: grid; gap: 0; }
.facts div { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-top: 1px solid var(--rule); }
.facts div:first-child { border-top: 0; }
.facts dt { font-size: 15px; color: var(--navy-2); }
.facts dd { font-weight: 600; word-break: break-word; }
.facts dd.clip { font-weight: 400; }

@media (prefers-reduced-motion: reduce) { .sign { transition: none; } }

@media (max-width: 1040px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .cab { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 16px; padding-bottom: 48px; }
  .cab-main { gap: 24px; }
  .cab-nav { position: static; display: flex; gap: 2px; padding: 0; border-left: 0; border-bottom: 6px solid var(--red); overflow-x: auto; scrollbar-width: none; }
  .cab-nav::-webkit-scrollbar { display: none; }
  .cab-nav a { flex: 1 1 auto; text-align: center; white-space: nowrap; padding: 12px 8px; font-size: 16px; }
  .cab-nav .side { display: none; }
  .who { display: none; }
}

@media (max-width: 760px) {
  .tiles, .tiles.two { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .tile { padding: 14px 16px; gap: 2px; }
  .plate { padding: 18px 16px; gap: 16px; }
  .plate.tight { padding: 18px 16px; }
  .facts div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .copy { flex-direction: column; }
  .payout-form { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .spacer { display: none; }
  .payout-form .sign, .inline-form .sign, .copy .sign, .copy form { width: 100%; justify-content: center; }
  .stack .sign, .plate > .sign { justify-self: stretch; justify-content: center; }
  .inline-form .field, .inline-form .field.go { flex: 1 1 100%; }
  .sec-head { flex-wrap: wrap; gap: 4px 16px; }
  .pager { font-size: 15px; }
  .pager span:empty { display: none; }
  .link-danger { min-height: 44px; }

  /* the heading and its action share a row; the action shrinks to fit */
  .page-head { flex-wrap: nowrap; gap: 12px; }
  .page-head h1 { min-width: 0; overflow-wrap: anywhere; }
  .page-head .sign { flex: none; min-height: 48px; padding: 0 16px; font-size: 16px; }
  .page-head a:not(.sign) { flex: none; font-size: 16px; }

  /* tables become cards: one row each, label and value side by side */
  .table-wrap { background: none; overflow: visible; }
  .table, .table tbody { display: block; }
  .table thead { position: absolute; left: -9999px; }
  .table tr { display: block; margin-bottom: 10px; padding: 6px 0; background: var(--panel); border-radius: 2px; }
  .table td { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; align-items: baseline; padding: 6px 16px; border: 0; }
  .table td::before { content: attr(data-label); font-size: 14px; color: var(--navy-2); }
  .table td .badge { justify-self: start; }
  .plate .table tr { background: var(--ground); }
  .table td:not([data-label]) { display: block; }
  .table td:not([data-label])::before { content: none; }
  .table .num, .table .act { text-align: left; }
  .table .clip { max-width: none; white-space: normal; overflow: visible; overflow-wrap: anywhere; }
  .table .mono, .table td a { overflow-wrap: anywhere; }
  .table .when { white-space: normal; }
}

/* two-factor enrolment */
.qr { width: 240px; max-width: 100%; }
.qr svg { display: block; width: 100%; height: auto; }
.codes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11ch, 1fr)); gap: 6px 16px; font: 600 15px ui-monospace, Menlo, monospace; }
