/*
 * The partner portal's one stylesheet. The admin panel's quiet style (server/admin-client/panel.css):
 * the same tokens, the same 13px base with an 11px floor, a 26px gutter on a desktop and 16px on a
 * phone (the owner's UI standard of 2026-09-13). Nothing here is loaded from another origin, and no
 * rule depends on an inline style: the Content-Security-Policy allows neither.
 *
 * States are classes (.field--invalid, .msgbox--sent, .tag--attend …), never style properties set
 * from the script.
 */

:root {
  color-scheme: light dark;
  --ui: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --data: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;

  --t-micro: 11px;
  --t-small: 12px;
  --t-base: 13px;
  --t-mid: 14px;
  --t-figure: 17px;
  --t-large: 24px;

  --gutter: 26px;
  --width: 1120px;
  --radius: 6px;

  --sheet: #fbfcfd;
  --sunk: #f1f4f7;
  --raised: #fff;
  --ink: #0e1a20;
  --ink-2: #4a6069;
  --ink-3: #586c7a;
  --rule: #d5dde5;
  --rule-strong: #b9c6d0;
  --edge: #758a97;
  --mark: #00655c;
  --mark-line: #0e8c7e;
  --mark-wash: #e3f2ef;
  --alert: #a6231a;
  --alert-wash: #fbeceb;
  --attend: #8a5200;
  --attend-wash: #fcf2e3;
  --settled: #1c6b4b;
  --settled-wash: #e6f3ec;
  --on-mark: #fff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --sheet: #0b1116;
    --sunk: #070c10;
    --raised: #131c23;
    --ink: #dde7ea;
    --ink-2: #93a7b0;
    --ink-3: #7a909b;
    --rule: #25323b;
    --rule-strong: #34444f;
    --edge: #5d717d;
    --mark: #4cc3b3;
    --mark-line: #3aa596;
    --mark-wash: #0f2a27;
    --alert: #f08a80;
    --alert-wash: #2c1513;
    --attend: #e0a64f;
    --attend-wash: #2a1e0c;
    --settled: #6fcf9f;
    --settled-wash: #10261b;
    --on-mark: #04201c;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--sheet);
  color: var(--ink);
  font: 400 var(--t-base) / 1.5 var(--ui);
  overflow-x: hidden;
}

h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: var(--mark); text-underline-offset: 2px; }
a:hover { color: var(--mark-line); }

:focus-visible { outline: 2px solid var(--mark-line); outline-offset: 2px; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -40px;
  padding: 6px 10px;
  background: var(--raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  z-index: 10;
}
.skip:focus { top: 8px; }

/* ---------------------------------------------------------------- top bar and footer */

.top {
  background: var(--raised);
  border-bottom: 1px solid var(--rule);
}
.top__inner, .foot__inner, .main, .msgbox__inner {
  width: 100%;
  max-width: calc(var(--width) + 2 * var(--gutter));
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.top__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
  padding: 12px 0;
}
.brand:hover { color: var(--ink); }
.brand__mark { font-weight: 700; font-size: var(--t-mid); letter-spacing: 0.01em; }
.brand__sub { color: var(--ink-3); font-size: var(--t-small); }

.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav__link {
  display: inline-block;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--ink-2);
  text-decoration: none;
  font-weight: 500;
}
.nav__link:hover { background: var(--sunk); color: var(--ink); }
.nav__link[aria-current='page'] { color: var(--mark); background: var(--mark-wash); }

.main {
  flex: 1 0 auto;
  padding-top: 24px;
  padding-bottom: 32px;
  outline: none;
}

.foot {
  border-top: 1px solid var(--rule);
  background: var(--raised);
  color: var(--ink-3);
  font-size: var(--t-small);
}
.foot__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 20px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.foot__who { margin-left: auto; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- type */

.title { font-size: var(--t-large); font-weight: 600; line-height: 1.25; margin-bottom: 12px; }
.title--route { margin-bottom: 0; }
.lede { font-size: var(--t-mid); color: var(--ink-2); margin-bottom: 14px; max-width: 68ch; }
.meta { color: var(--ink-3); font-size: var(--t-small); }
.hint { color: var(--ink-3); font-size: var(--t-small); margin-top: 4px; }
.quiet { color: var(--ink-3); }
.mono, .codes { font-family: var(--data); }
.nowrap { white-space: nowrap; }
.codes { font-weight: 600; letter-spacing: 0.02em; }
.figure { font-family: var(--data); font-variant-numeric: tabular-nums; font-weight: 600; }
.figure--big { font-size: var(--t-large); margin: 4px 0 12px; }
.when { font-variant-numeric: tabular-nums; }
.loading { color: var(--ink-3); }
.empty { color: var(--ink-2); padding: 18px 0; }
.section-title {
  font-size: var(--t-micro);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 10px;
}
.block-title { font-size: var(--t-mid); font-weight: 600; margin-bottom: 8px; }
.label { display: block; font-weight: 600; margin-bottom: 4px; }
.back { margin-bottom: 10px; font-size: var(--t-small); }

/* ---------------------------------------------------------------- notices and tags */

.notice {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--sunk);
  border-left: 3px solid var(--edge);
  margin-bottom: 12px;
  max-width: 80ch;
}
.notice--alert { background: var(--alert-wash); border-left-color: var(--alert); }
.notice--attend { background: var(--attend-wash); border-left-color: var(--attend); }
.notice--settled { background: var(--settled-wash); border-left-color: var(--settled); }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: var(--t-micro);
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.tag--open { color: var(--settled); background: var(--settled-wash); border-color: var(--settled); }
.tag--attend { color: var(--attend); background: var(--attend-wash); border-color: var(--attend); }
.tag--quiet { color: var(--ink-3); background: var(--sunk); border-color: var(--rule-strong); }

.countdown { display: block; color: var(--attend); font-size: var(--t-small); font-weight: 600; }

/* ---------------------------------------------------------------- controls */

input[type='text'], input[type='email'], input[type='number'], input[type='date'], input[type='datetime-local'],
select, textarea {
  width: 100%;
  max-width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  font: inherit;
  font-size: var(--t-mid);
  color: var(--ink);
  background: var(--raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--mark-line); outline: 2px solid var(--mark-wash); outline-offset: 0; }
[aria-invalid='true'] { border-color: var(--alert); }
input.code-input { font-family: var(--data); font-size: var(--t-figure); letter-spacing: 0.3em; max-width: 14ch; }
.figure-input { font-family: var(--data); font-variant-numeric: tabular-nums; }

input[type='radio'], input[type='checkbox'] { accent-color: var(--mark); width: 16px; height: 16px; margin: 0; flex: none; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 14px;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
}
.button:hover:not(:disabled) { border-color: var(--edge); background: var(--sunk); }
.button:disabled { opacity: 0.55; cursor: not-allowed; }
.button--primary { color: var(--on-mark); background: var(--mark); border-color: var(--mark); }
.button--primary:hover:not(:disabled) { background: var(--mark-line); border-color: var(--mark-line); }
.button--danger { color: var(--alert); border-color: var(--alert); }
.button--danger:hover:not(:disabled) { background: var(--alert-wash); border-color: var(--alert); }
.button--quiet { border-color: transparent; background: transparent; color: var(--ink-2); }

.link-button {
  padding: 0;
  font: inherit;
  color: var(--mark);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.actions--stack { flex-direction: column; align-items: stretch; }

.field { min-width: 0; }
.field__error { color: var(--alert); font-size: var(--t-small); margin-top: 4px; }
.field__error:empty { display: none; }
/* The alert line sits on the group's own edge (offset 0) with the padding inside it, so it never
   runs through the hint printed just above the group (R3 U-3-1440). */
.field--invalid .choice-table, .field--invalid .schedules {
  outline: 1px solid var(--alert);
  outline-offset: 0;
  padding: 6px 10px;
  border-radius: var(--radius);
}
.hint + .field { margin-top: 8px; }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.choice { display: flex; flex-direction: column; gap: 6px; }
.choice--inline { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-bottom: 10px; }
.choice--inline > legend { float: left; margin-right: 8px; margin-bottom: 0; }
.choice__option { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.choice__option--block { align-items: flex-start; padding: 8px 0; }
.choice__option--block input { margin-top: 2px; }
.choice__main { display: block; font-weight: 600; }

/* ---------------------------------------------------------------- sign-in and the rules */

.door, .gate { max-width: 460px; }
.door__form { margin-top: 6px; }
.door__address { font-weight: 600; margin-bottom: 10px; overflow-wrap: anywhere; }
.door__again {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
}
.hint--wait { margin-top: 0; }

.rules {
  max-width: 76ch;
  margin: 14px 0 18px;
  padding: 18px 22px;
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: var(--t-mid);
  line-height: 1.6;
}
.rules__heading { font-size: var(--t-mid); font-weight: 600; margin: 18px 0 6px; }
.rules__heading--top { font-size: var(--t-figure); margin-top: 0; }
.rules__para { margin-bottom: 10px; white-space: pre-line; }
.rules__list { list-style: disc; padding-left: 20px; margin-bottom: 10px; }
.rules__list li { margin-bottom: 4px; }

.accept { max-width: 76ch; }
.accept__agree { display: flex; align-items: flex-start; gap: 10px; font-weight: 600; cursor: pointer; }
.accept__agree input { margin-top: 2px; }

/* ---------------------------------------------------------------- the invitations list */

.list { width: 100%; border-collapse: collapse; background: var(--raised); border: 1px solid var(--rule); border-radius: var(--radius); }
.list th {
  text-align: left;
  font-size: var(--t-micro);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--sunk);
}
.list td { padding: 12px 14px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.list tbody tr:last-child td { border-bottom: 0; }
.list tbody tr:hover { background: var(--sunk); }
.list .num { text-align: right; }
.list__link { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); }
.list__link .codes { color: var(--mark); font-size: var(--t-mid); }
.list__link:hover .codes { text-decoration: underline; }
.list__names { color: var(--ink-2); font-size: var(--t-small); }
.list__row--closed td, .list__row--not_bidding td { color: var(--ink-3); }

/* ---------------------------------------------------------------- one invitation */

.head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-bottom: 16px; }
.head__line { flex-basis: 100%; color: var(--ink-2); font-size: var(--t-mid); }

.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 340px); gap: 16px; align-items: start; }
/* The side column is first in the document (a narrow screen shows it first); a wide one places it right. */
.detail > .detail__side { grid-column: 2; grid-row: 1; }
.detail > .detail__request { grid-column: 1; grid-row: 1; }
.detail__request, .detail__side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.card {
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px 18px;
  min-width: 0;
}
.card--note { border-left: 3px solid var(--mark-line); }
.note { white-space: pre-line; overflow-wrap: anywhere; }

.facts { display: grid; grid-template-columns: minmax(120px, 190px) minmax(0, 1fr); gap: 8px 16px; }
.fact { display: contents; }
.fact__key { color: var(--ink-3); }
.fact__value { overflow-wrap: anywhere; }
.fact__sub { display: block; color: var(--ink-3); font-size: var(--t-small); }
.facts--stacked { grid-template-columns: minmax(0, 1fr); gap: 2px; }
.facts--stacked .fact__key { font-size: var(--t-small); margin-top: 8px; }
.facts--stacked .fact:first-child .fact__key { margin-top: 0; }
.facts--tight { margin-top: 10px; }

.plain li { padding: 2px 0; }
.plain li::before { content: '· '; color: var(--ink-3); }

.cargo { width: 100%; border-collapse: collapse; }
.cargo th {
  text-align: left;
  font-size: var(--t-micro);
  font-weight: 600;
  color: var(--ink-3);
  padding: 6px 8px;
  border-bottom: 1px solid var(--rule);
}
.cargo td { padding: 8px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.cargo .num { text-align: right; }
.cargo__what { overflow-wrap: anywhere; }
.cargo__total { margin-top: 8px; color: var(--ink-2); font-weight: 600; }

.price { font-family: var(--data); font-size: var(--t-large); font-weight: 600; font-variant-numeric: tabular-nums; }
.rights { font-weight: 600; margin-top: 12px; }

.history { margin-top: 14px; border-top: 1px solid var(--rule); padding-top: 10px; }
.history summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.history__list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.history__row { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: var(--t-small); }
.history__kind { font-weight: 600; }
.history__when { color: var(--ink-3); }
.history__note { color: var(--ink-2); }
.history__note--alert { color: var(--alert); }

.board { display: flex; flex-direction: column; margin-bottom: 8px; }
.board__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--rule);
}
.board__row:last-child { border-bottom: 0; }
.board__row--own { font-weight: 700; color: var(--mark); }

/* ---------------------------------------------------------------- the bid form */

.bid {
  margin-top: 20px;
  padding: 20px 22px;
  background: var(--raised);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  scroll-margin-top: 16px;
}
.bid__title { font-size: var(--t-figure); font-weight: 600; margin-bottom: 12px; }
.bid__block { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--rule); }
.warnings { display: flex; flex-direction: column; gap: 0; }
.warnings .notice { max-width: none; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; margin-top: 6px; }
.field--wide { grid-column: 1 / -1; }
.grid .field input, .grid .field select { max-width: 420px; }
.grid .field--wide input, .grid .field--wide select { max-width: 520px; }

.ticks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.tick::before { content: '✓ '; color: var(--settled); font-weight: 700; }

.choice-table { display: flex; flex-direction: column; }
.choice--row {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 18px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
}
.choice--row:last-child { border-bottom: 0; }
.choice--row > legend { float: left; width: 190px; margin: 0; font-weight: 600; }

.schedules { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.schedule {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  align-content: start;
  gap: 6px 10px;
  padding: 12px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  cursor: pointer;
}
.schedule:has(input:checked) { border-color: var(--mark); background: var(--mark-wash); }
.schedule input { margin-top: 2px; }
.schedule__name { font-weight: 700; }
.schedule__steps { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 4px; font-size: var(--t-small); }
.schedule__pct { display: block; }
.schedule__when { display: block; color: var(--ink-2); }

/* ---------------------------------------------------------------- dialogs */

.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 22px 24px;
  color: var(--ink);
  background: var(--raised);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  overflow: auto;
}
.dialog::backdrop { background: rgb(14 26 32 / 45%); }
.dialog__title { font-size: var(--t-figure); font-weight: 600; margin-bottom: 8px; }
.dialog .lede { margin-top: 12px; }
.dialog textarea { margin-bottom: 4px; }
.dialog .choice { margin: 6px 0 12px; }
.dialog .warnings > .label { margin-top: 14px; }

/* ---------------------------------------------------------------- messages */

.msgbox { border-top: 1px solid var(--rule); background: var(--sunk); }
.msgbox__inner { padding-top: 20px; padding-bottom: 24px; }
.msgbox__title { font-size: var(--t-mid); font-weight: 600; margin-bottom: 10px; }
.msgbox__form { max-width: 640px; }
.msgbox__status { margin-top: 10px; color: var(--settled); font-weight: 600; }
.msgbox__status:empty { display: none; }

.messages { display: flex; flex-direction: column; gap: 12px; max-width: 760px; }
.message { background: var(--raised); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px 14px; }
.message__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; color: var(--ink-3); font-size: var(--t-small); margin-bottom: 6px; }
.message__body { white-space: pre-line; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- tablet and phone */

@media (max-width: 900px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
  .detail > .detail__side, .detail > .detail__request { grid-column: auto; grid-row: auto; }
  .schedules { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .title { font-size: 20px; }
  .main { padding-top: 16px; }
  .top__inner { gap: 0 12px; }
  .brand { padding: 10px 0 6px; }
  .nav { width: 100%; margin: 0 -10px 6px; }
  .foot__who { margin-left: 0; flex-basis: 100%; }

  .grid { grid-template-columns: minmax(0, 1fr); }
  .grid .field input, .grid .field select { max-width: none; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .facts .fact__key { font-size: var(--t-small); margin-top: 8px; }
  .facts .fact:first-child .fact__key { margin-top: 0; }
  .card, .bid { padding: 14px; }
  .rules { padding: 14px; font-size: var(--t-base); }
  .choice--row > legend { float: none; width: 100%; }

  /* Tables become cards: each cell carries its column name in data-label. */
  .list, .list tbody, .list tr, .list td,
  .cargo, .cargo tbody, .cargo tr, .cargo td { display: block; width: 100%; }
  .list thead, .cargo thead { display: none; }
  .list { border: 0; background: none; }
  .list tr {
    background: var(--raised);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    margin-bottom: 10px;
    padding: 6px 0;
  }
  .list td, .cargo td {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 8px;
    padding: 5px 12px;
    border: 0;
    text-align: left;
  }
  .list .num, .cargo .num { text-align: left; }
  .list td::before, .cargo td::before {
    content: attr(data-label);
    color: var(--ink-3);
    font-size: var(--t-micro);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding-top: 2px;
    /* The label is the column's name: the UI face and free to wrap, whatever the value's cell says. */
    font-family: var(--ui);
    white-space: normal;
  }
  .list td.list__route { grid-template-columns: minmax(0, 1fr); }
  .list td.list__route::before { display: none; }
  .cargo tr { border-bottom: 1px solid var(--rule); padding: 6px 0; }
  .cargo td { padding: 3px 0; }
  .dialog { padding: 18px 16px; }

  /* Tap targets of at least 44 px on a phone (R3 A1): every control, and every radio row's label. */
  input[type='text'], input[type='email'], input[type='number'], input[type='date'], input[type='datetime-local'],
  select, .button { min-height: 44px; }
  .nav__link, .link-button { display: inline-flex; align-items: center; min-height: 44px; }
  .choice__option, .accept__agree { min-height: 44px; padding-right: 8px; }
  .choice__option:not(.choice__option--block), .accept__agree { align-items: center; }
  .accept__agree input { margin-top: 0; }
  .choice--row { padding: 4px 0; }
  .schedule { min-height: 44px; }

  /* The whole invitation card opens the invitation, not only its route line. */
  .list tr { position: relative; }
  .list__link::after { content: ''; position: absolute; inset: 0; border-radius: var(--radius); }
  .list__link:focus-visible { outline: none; }
  .list__link:focus-visible::after { outline: 2px solid var(--mark); outline-offset: 2px; }
}
