:root { color-scheme: light dark; }
body {
  margin: 0; font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: #f6f7f9; color: #15181d;
}
.layout { max-width: 68rem; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
header { display: flex; flex-wrap: wrap; gap: .75rem; align-items: baseline; justify-content: space-between; }
h1 { font-size: 1.3rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; margin-top: 0; }
.who { display: flex; gap: .75rem; align-items: center; color: #5b626d; font-size: .9rem; }
.center { display: grid; place-content: center; gap: .75rem; min-height: 70vh; text-align: center; }
.muted { color: #5b626d; }
.error { color: #b3261e; background: #fdecea; padding: .6rem .8rem; border-radius: .4rem; }
.warn { color: #7a4b00; background: #fff4d6; padding: .6rem .8rem; border-radius: .4rem; }
button {
  font: inherit; padding: .45rem .9rem; border-radius: .4rem; cursor: pointer;
  border: 1px solid #c6ccd4; background: #fff; min-height: 38px;
}
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: #1f3a5f; color: #fff; border-color: #1f3a5f; font-weight: 600; }
.card { background: #fff; border: 1px solid #e1e5ea; border-radius: .6rem; padding: 1.1rem; margin: 1rem 0; }
.grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
label { display: block; font-weight: 600; font-size: .88rem; }
label small { display: block; font-weight: 400; color: #5b626d; }
input, select {
  width: 100%; padding: .5rem .6rem; font: inherit; margin-top: .25rem;
  border: 1px solid #c6ccd4; border-radius: .4rem; background: #fff; color: inherit;
}
label.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; margin: .5rem 0; }
label.check input { width: auto; margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; }
table { width: 100%; border-collapse: collapse; margin-top: .75rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid #e8ebef; vertical-align: top; }
th { font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; color: #5b626d; }
table.kv th { width: 12rem; text-transform: none; font-size: .9rem; letter-spacing: 0; }
table.kv .total td, table.kv .total th { font-weight: 700; font-size: 1.05rem; }
code { background: #eef1f4; padding: .1rem .35rem; border-radius: .25rem; font-size: .9em; }
.pill { font-size: .78rem; padding: .15rem .55rem; border-radius: 999px; background: #e8ebef; text-transform: uppercase; letter-spacing: .04em; }
.pill.live, .pill.paid { background: #d6f0dd; color: #16603a; }
.pill.draft, .pill.pending { background: #fdf0d2; color: #7a4b00; }
.pill.closed { background: #e1e5ea; color: #3c434d; }
.pill.cancelled, .pill.refunded { background: #fadbd8; color: #8c1d18; }
@media (prefers-color-scheme: dark) {
  body { background: #14181d; color: #e6e8ea; }
  .card, input, select, button { background: #1d2228; border-color: #2e3640; color: #e6e8ea; }
  th, td { border-bottom-color: #262c34; }
  code, .pill { background: #262c34; }
  .muted, .who, label small, th { color: #9aa4af; }
}

.tabs { display: flex; gap: .4rem; margin: 1rem 0; flex-wrap: wrap; }
.tab { text-transform: capitalize; }
.tab.active { background: #1f3a5f; color: #fff; border-color: #1f3a5f; font-weight: 600; }
h4 { margin: 1.2rem 0 .3rem; font-size: .92rem; text-transform: uppercase; letter-spacing: .04em; color: #5b626d; }
code.break { word-break: break-all; display: inline-block; max-width: 100%; }
@media (prefers-color-scheme: dark) { .tab.active { background: #2f4f7a; border-color: #2f4f7a; } h4 { color: #9aa4af; } }

/* ---- Responsive tables -------------------------------------------------- */
/* Wide content must scroll inside its own box; the page itself never scrolls
   sideways, which is what hid the "Open" button off the right edge on a phone. */
.table-wrap { width: 100%; overflow-x: auto; }

@media (max-width: 46rem) {
  /* Below this width a row becomes a card: every cell is labelled and the row
     reads top to bottom, so nothing can sit outside the viewport. */
  .table-wrap { overflow-x: visible; }
  table.stacked thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stacked, table.stacked tbody, table.stacked tr, table.stacked td { display: block; width: 100%; }
  table.stacked tr {
    border: 1px solid #e1e5ea; border-radius: .6rem;
    padding: .6rem .8rem; margin-bottom: .75rem; background: #fff;
  }
  table.stacked td {
    border: none; padding: .3rem 0;
    display: grid; grid-template-columns: 7.5rem 1fr; gap: .75rem; align-items: baseline;
  }
  table.stacked td::before {
    content: attr(data-label);
    font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: #5b626d;
  }
  table.stacked td[data-label=""] { display: block; }
  table.stacked td[data-label=""]::before { content: none; }
  button.full { width: 100%; margin-top: .4rem; }
  table.kv th { width: auto; }
  .site-header, header { gap: .5rem; }
}

@media (prefers-color-scheme: dark) and (max-width: 46rem) {
  table.stacked tr { background: #1d2228; border-color: #2e3640; }
  table.stacked td::before { color: #9aa4af; }
}
