/*
 * Chekiroku2Ledger — app.css
 * An Oshicue Keeps web app.
 *
 * Layout: an instax print that develops into the backup's member colours, beside a
 * merch-table price list. Brand: Oshicue Keeps.
 *   Ink            #0A0A0D  family dark (wordmark, undeveloped film, toasts)
 *   Warm White     #F4F3EE  family light (lettering on dark)
 *   Cue Pink       #FF3D6E  only the CUE of the wordmark
 *   Keeps Coral    #F26B52  product colour; #C7442C fills, #C0402A text
 *   Keeps light UI #20212B ink, #696873 muted, #EDEBE8 / #F8F7F5 / #FFFFFF surfaces
 * Member colours from the backup keep their own values everywhere.
 */

:root {
  --brand-ink: #0A0A0D;
  --brand-paper: #F4F3EE;
  --cue-pink: #FF3D6E;

  --coral: #F26B52;
  --coral-text: #C0402A;
  --coral-fill: #C7442C;
  --coral-fill-deep: #A83721;
  --coral-wash: #FDEFEB;

  --ink: #20212B;
  --muted: #696873;
  --faint: #A3A1AA;
  --warning: #945300;

  --table: #EDEBE8;
  --background: #F8F7F5;
  --surface: #FFFFFF;
  --surface-subtle: #F1F0ED;
  --line: #EAE8E5;
  --line-2: #D5D2CD;
  --line-3: #B8B5B1;

  --display: "Unbounded", -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", system-ui, sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Hiragino Sans", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "Segoe UI", system-ui, sans-serif;
  --rounded: ui-rounded, "SF Pro Rounded", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;

  --shadow-paper: 0 1px 1px rgba(32, 33, 43, 0.04), 0 14px 34px -20px rgba(32, 33, 43, 0.3);
  color-scheme: light;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--table);
  color: var(--ink);
  font: 400 14px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  font-kerning: normal;
}

[hidden] { display: none !important; }

button, input, select { font: inherit; color: inherit; }

button { cursor: pointer; }

:focus-visible { outline: 2px solid var(--coral-fill); outline-offset: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.num, .tnum { font-variant-numeric: tabular-nums; }

/* ---------- Oshicue Keeps lockup ---------- */

/* Same construction as the Keeps top bar: OSHI + CUE at full size, the product name at 0.56×. */
.lockup {
  --size: 18px;
  margin: 0;
  display: inline-flex; align-items: baseline; gap: 0.28em;
  font-family: var(--display); font-weight: 900; line-height: 1;
  color: var(--brand-ink);
  white-space: nowrap;
}
.lockup-family { font-size: var(--size); letter-spacing: 0.02em; }
.lockup-cue { color: var(--cue-pink); }
.lockup-product { font-size: calc(var(--size) * 0.56); letter-spacing: 0.06em; }
.lockup--hero { --size: 22px; }
.lockup--rail { --size: 15px; }

.product-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.05;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.product-title--hero {
  margin-top: 16px;
  white-space: nowrap; overflow-wrap: normal;
  /* The name is 11.64em wide in Unbounded 800: size it to the column so it never breaks. */
  font-size: clamp(24px, 2.9vw, 40px);
  font-size: min(42px, 8.4cqi);
}
.product-title--rail { margin-top: 8px; font-size: 13px; font-weight: 700; letter-spacing: 0; color: var(--muted); }

/* ---------- buttons & fields ---------- */

.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 14px; line-height: 1;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s;
}
.btn:hover { border-color: var(--line-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; transform: none; }

.btn-primary { background: var(--coral-fill); border-color: var(--coral-fill); color: #fff; }
.btn-primary:hover { background: var(--coral-fill-deep); border-color: var(--coral-fill-deep); }

.btn-film { background: var(--brand-paper); border-color: transparent; color: var(--brand-ink); min-height: 40px; padding: 0 18px; }
.btn-film:hover { background: #fff; border-color: transparent; }

.btn-small { min-height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { background: transparent; border-color: var(--line-2); color: var(--ink); }
.btn-block { width: 100%; min-height: 44px; font-size: 15px; }

.btn-text {
  appearance: none; border: 0; background: none; padding: 2px 0;
  color: var(--muted); font-size: 13px; font-weight: 500;
  text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px;
}
.btn-text:hover { color: var(--ink); text-decoration-color: currentColor; }

.select, .input, .search, .date {
  appearance: none;
  height: 34px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: 8px;
  background-color: var(--surface); color: var(--ink);
  font-size: 14px;
}
.select {
  padding-right: 28px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23696873' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.select:hover, .input:hover, .search:hover, .date:hover { border-color: var(--line-3); }
.input[aria-invalid="true"], .date[aria-invalid="true"] { border-color: var(--warning); box-shadow: inset 0 0 0 1px var(--warning); }

.check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink); user-select: none; }
.check input, .radio input { accent-color: var(--coral-fill); width: 16px; height: 16px; margin: 0; }

/* ---------- the instax print ---------- */

/* instax mini: 54 × 86 mm frame, 46 × 62 mm picture, borders 4 / 6.5 / 17.5 mm */
.print {
  --w: 300px;
  position: relative;
  width: var(--w);
  aspect-ratio: 54 / 86;
  padding: calc(var(--w) * 0.12) calc(var(--w) * 0.074) calc(var(--w) * 0.324);
  border-radius: calc(var(--w) * 0.035);
  background: linear-gradient(180deg, #fff 0%, #FDFCFA 60%, #F6F5F2 100%);
  box-shadow:
    0 0 0 1px rgba(32, 33, 43, 0.06),
    0 2px 3px rgba(32, 33, 43, 0.1),
    0 22px 44px -22px rgba(32, 33, 43, 0.5);
}

/* Undeveloped film in the family dark. */
.print-photo {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: 1px;
  background: radial-gradient(130% 90% at 28% 18%, #2B2B33 0%, #15151A 56%, var(--brand-ink) 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.print-gloss {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(118deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.035) 26%, rgba(255, 255, 255, 0) 44%);
}

.print-image { position: absolute; inset: 0; }
.print-image svg { display: block; width: 100%; height: 100%; }

.print-caption {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(var(--w) * 0.324);
  display: flex; align-items: center; justify-content: center;
}

.caption-date {
  font-family: var(--display);
  font-weight: 700;
  font-size: calc(var(--w) * 0.085);
  letter-spacing: 0.02em;
  color: var(--brand-ink);
  transform: rotate(-3deg);
  font-variant-numeric: tabular-nums;
}

/* Developing: the colour comes up out of the dark film. */
.print.is-developing .print-image { animation: develop 2.8s cubic-bezier(0.25, 0.1, 0.2, 1) both; }
@keyframes develop {
  0% { opacity: 0; filter: saturate(0) brightness(0.55); }
  25% { opacity: 0.3; filter: saturate(0.15) brightness(0.6); }
  65% { opacity: 0.85; filter: saturate(0.7) brightness(0.9); }
  100% { opacity: 1; filter: none; }
}

/* ---------- intro ---------- */

.intro {
  min-height: 100vh;
  display: grid;
  grid-template-columns: auto minmax(0, 520px);
  justify-content: center;
  align-items: center;
  gap: clamp(40px, 8vw, 112px);
  padding: 48px clamp(20px, 5vw, 64px);
}

.intro-print { display: flex; justify-content: center; }

.print--hero {
  --w: clamp(240px, 25vw, 320px);
  transform: rotate(-3deg);
  transition: transform 0.25s ease;
}

.hero-drop {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 20px; text-align: center;
}
.hero-drop-title { margin: 0; color: var(--brand-paper); font-size: 15px; font-weight: 500; letter-spacing: 0.02em; }
.hero-status { margin: 0; min-height: 3.2em; max-width: 22em; color: #B9B7BF; font-size: 13px; line-height: 1.6; }
.hero-status.is-error { color: #FFB5A4; }

.print--hero.is-over { transform: rotate(-1deg) scale(1.02); }
.print--hero.is-over .print-photo { background: radial-gradient(130% 90% at 28% 18%, #3A3A44 0%, #24242B 58%, #17171C 100%); box-shadow: inset 0 0 0 2px var(--coral); }
.print--hero.is-busy .btn-film { visibility: hidden; }

.intro-copy { max-width: 34em; container-type: inline-size; }
.intro-lede { margin: 18px 0 0; font-size: 19px; line-height: 1.55; font-weight: 500; }

.intro-steps { list-style: none; margin: 28px 0 0; padding: 0; display: grid; gap: 12px; }
.intro-steps li { display: flex; align-items: baseline; gap: 14px; font-size: 16px; }
.step-n {
  flex: none;
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  border: 1.5px solid var(--ink);
  font-family: var(--display); font-weight: 700; font-size: 11px;
  transform: translateY(-1px);
}
.step-where { color: var(--muted); }

.intro-note { margin: 28px 0 0; color: var(--muted); font-size: 14px; line-height: 1.75; max-width: 36em; }
.intro-saved { margin-top: 12px; color: var(--ink); }
.intro-more { margin: 20px 0 0; }

/* ---------- workspace ---------- */

.workspace {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
  padding: 26px 22px 32px 28px;
  display: flex; flex-direction: column; gap: 22px;
  scrollbar-width: thin;
}

.rail-brand { display: grid; }

.rail-backup { display: flex; gap: 16px; align-items: flex-start; }

.print--rail { --w: 112px; flex: none; transform: rotate(-2.5deg); margin: 4px 0 0 2px; }

.rail-file { min-width: 0; padding-top: 2px; }
.file-name { margin: 0; font-weight: 600; font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.file-meta { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.meta-line { display: block; }
.file-actions { margin: 10px 0 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }

.receipt-block { display: grid; gap: 14px; }
.receipt { margin: 0; display: grid; gap: 7px; font-variant-numeric: tabular-nums; }
.receipt > div { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.receipt dt { flex: 1 1 auto; display: flex; align-items: baseline; gap: 8px; min-width: 0; color: var(--muted); font-size: 13px; white-space: nowrap; }
.receipt dt::after { content: ""; flex: 1; min-width: 10px; border-bottom: 1px dotted var(--line-3); transform: translateY(-4px); }
.receipt dd { flex: none; margin: 0; font-size: 13px; font-weight: 600; text-align: right; }
.receipt--money { padding-top: 12px; border-top: 1px solid var(--line-2); }
.receipt--money dt { font-weight: 600; color: var(--ink); letter-spacing: 0.02em; }
.receipt--money dd { font-family: var(--rounded); font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.receipt--money .is-empty { font-family: var(--sans); color: var(--faint); font-weight: 500; font-size: 14px; }

.receipt-status { margin: 0; font-size: 13px; color: var(--muted); }
.receipt-status .btn-text { color: var(--coral-text); font-weight: 600; font-size: 13px; text-decoration-color: currentColor; }

.rail-export { display: grid; gap: 6px; }
.export-name { margin: 0; color: var(--muted); font-size: 12px; text-align: center; overflow-wrap: anywhere; }
.export-hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; text-align: center; }

.rail-config { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line-2); }
.rail-h { margin: 0; font-size: 13px; font-weight: 700; }
.rail-config-note { margin: 4px 0 10px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.rail-config-actions { margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }

.desk { min-width: 0; padding: 22px 28px 64px 4px; }

.sheet {
  max-width: 1160px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-paper);
  padding: 0 28px 32px;
}

/* ---------- tabs ---------- */

.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line-2); margin: 0 -28px; padding: 0 28px; }
.tab {
  appearance: none; border: 0; background: none;
  position: relative;
  padding: 18px 0 14px;
  font-size: 16px; font-weight: 600; color: var(--muted);
  display: inline-flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); }
.tab[aria-selected="true"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--coral);
}
.tab-flag { width: 7px; height: 7px; border-radius: 50%; background: var(--coral); }
.tab-count { color: var(--faint); font-weight: 500; font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------- panels ---------- */

.panel { padding-top: 22px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; }
.panel-title { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; }
.panel-hint { margin: 8px 0 0; max-width: 46em; color: var(--muted); font-size: 13px; line-height: 1.75; }
.inline-field { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }

/* ---------- price table ---------- */

.table-wrap { margin-top: 18px; }
.table-wrap.is-scroll { overflow-x: auto; }

.price-table { width: 100%; border-collapse: separate; border-spacing: 0; }

.price-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface);
  padding: 10px 10px 9px;
  border-bottom: 1px solid var(--line-2);
  text-align: left; vertical-align: bottom;
  font-size: 13px; font-weight: 600; color: var(--muted);
  white-space: nowrap;
}
.table-wrap.is-scroll .price-table thead th { position: static; }
.price-table thead th:first-child { padding-left: 0; }
.col-head { display: flex; flex-direction: column; gap: 2px; }
.col-name { color: var(--ink); font-size: 14px; }
.col-fill { align-self: flex-start; font-size: 12px; }

.pgroup > tr > th, .pgroup > tr > td { padding: 14px 10px; vertical-align: top; text-align: left; }
.pgroup > tr > th { padding-left: 0; font-weight: 400; }
.pgroup > tr:first-child > * { border-top: 1px solid var(--line); }
.pgroup:first-of-type > tr:first-child > * { border-top: 0; }
.pgroup.is-quiet .pg-title { color: var(--muted); }

.pg-name { min-width: 200px; }
.pg-title { margin: 0; font-size: 16px; font-weight: 650; line-height: 1.35; overflow-wrap: anywhere; }
.pg-members { list-style: none; margin: 7px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 5px 12px; font-size: 13px; color: var(--muted); }
.pg-members li { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.pg-meta { margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pg-total { color: var(--ink); font-weight: 600; }
.pg-actions { margin: 6px 0 0; }

.dot {
  flex: none; display: inline-block;
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--c, var(--faint));
  box-shadow: inset 0 0 0 1px rgba(32, 33, 43, 0.2);
}
.avatar {
  flex: none; display: block;
  width: 22px; height: 22px; border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1.5px var(--surface), 0 0 0 3px var(--c, var(--faint));
  margin: 2px 2px 2px 3px;
}

.pc-cur { width: 92px; }
.pc-cur .select { width: 82px; }
.pc-price { width: 150px; min-width: 104px; }
.pc-label { display: none; }

/* A price input is a ticket: stub with the currency, perforation, then the amount. */
.ticket {
  --stub: 38px;
  display: flex; align-items: stretch;
  width: 100%; max-width: 148px; height: 40px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  -webkit-mask:
    radial-gradient(circle 4.5px at var(--stub) 0, #0000 95%, #000) top / 100% 51% no-repeat,
    radial-gradient(circle 4.5px at var(--stub) 100%, #0000 95%, #000) bottom / 100% 51% no-repeat;
  mask:
    radial-gradient(circle 4.5px at var(--stub) 0, #0000 95%, #000) top / 100% 51% no-repeat,
    radial-gradient(circle 4.5px at var(--stub) 100%, #0000 95%, #000) bottom / 100% 51% no-repeat;
  transition: background-color 0.15s, border-color 0.15s;
}
.ticket-stub {
  flex: none; width: var(--stub);
  display: grid; place-items: center;
  border-right: 1px dashed var(--line-2);
  color: var(--muted);
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
}
.ticket-input {
  flex: 1; min-width: 0; width: 100%;
  border: 0; background: transparent; outline: none;
  padding: 0 10px 0 6px;
  text-align: right;
  font-family: var(--rounded);
  font-size: 17px; font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.ticket-input::placeholder { color: var(--faint); font-weight: 500; }

.ticket.is-idle { border-style: dashed; background: transparent; }
.ticket.is-needed { border-style: dashed; border-color: var(--coral); background: var(--coral-wash); }
.ticket.is-needed .ticket-stub { color: var(--coral-text); border-right-color: rgba(242, 107, 82, 0.5); }
.ticket.is-set { border-color: var(--line-3); }
.ticket.is-invalid { border-color: var(--warning); box-shadow: inset 0 0 0 1px var(--warning); background: #fff; }
.ticket:focus-within { border-style: solid; border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: #fff; }

.ticket-note { min-height: 18px; margin-top: 4px; font-size: 12px; line-height: 1.5; color: var(--muted); font-variant-numeric: tabular-nums; }
.ticket-note.is-needed { color: var(--coral-text); font-weight: 600; }
.ticket-note.is-invalid { color: var(--warning); font-weight: 600; }

/* price periods hang under their group */
.prow--period > th, .prow--period > td { padding-top: 4px !important; padding-bottom: 12px !important; border-top: 0 !important; }
.pp-range { position: relative; padding-left: 18px !important; }
.pp-range::before {
  content: ""; position: absolute; left: 4px; top: -6px; bottom: 18px;
  width: 9px; border-left: 1.5px solid var(--line-2); border-bottom: 1.5px solid var(--line-2);
  border-bottom-left-radius: 6px;
}
.pp-dates { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; color: var(--muted); }
.date { width: 140px; height: 34px; padding: 0 8px; font-size: 13px; font-variant-numeric: tabular-nums; }
.pp-foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 14px; margin-top: 6px; }
.pp-sub { font-size: 12px; color: var(--muted); line-height: 1.5; font-variant-numeric: tabular-nums; }
.pp-sub.is-invalid { color: var(--warning); font-weight: 600; }
.pp-foot .btn-text { font-size: 12px; }

/* ---------- records ---------- */

.records-summary { margin: 0; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.records-summary strong { color: var(--ink); font-weight: 600; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 16px 0 6px; }
.filters .select { max-width: 200px; }
.search { width: 220px; }
.search::placeholder { color: var(--faint); }

.ledger-table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 10px; font-size: 14px; }
.ledger-table thead th {
  text-align: left; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 8px 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
.ledger-table thead th:first-child { padding-left: 0; }
.ledger-table .num { text-align: right; }

.month-row th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface);
  padding: 18px 0 8px; text-align: left;
  border-bottom: 1px solid var(--line-2);
}
.month-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; }
.month-name { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.month-meta { display: inline-flex; flex-wrap: wrap; gap: 2px 14px; font-size: 12px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.month-meta b { color: var(--ink); font-weight: 600; }

.lrow > td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lrow > td:first-child { padding-left: 0; }
.lc-date { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; width: 1%; }
.lc-who { min-width: 160px; }
.who-line { display: flex; align-items: baseline; gap: 7px; }
.who-line .dot { transform: translateY(-1px); }
.who-name { font-weight: 600; }
.who-with { color: var(--muted); font-size: 13px; }
.who-group { display: block; margin: 1px 0 0 16px; color: var(--muted); font-size: 12px; }
.lc-cat { white-space: nowrap; }
.lc-qty { white-space: nowrap; width: 1%; }
.lc-sub { white-space: nowrap; font-weight: 600; }
.lc-note { color: var(--muted); font-size: 13px; min-width: 140px; }
.note-event { display: block; color: var(--ink); }
.note-place { display: block; font-size: 12px; }
.note-memo { display: block; }

.price-btn {
  appearance: none; border: 1px solid transparent; background: none;
  border-radius: 6px; padding: 3px 6px; margin: -4px -7px -4px 0;
  display: inline-flex; flex-direction: column; align-items: flex-end;
  font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right;
}
.price-btn:hover { border-color: var(--line-2); background: #fff; }
.price-tag { font-size: 11px; line-height: 1.3; color: var(--muted); font-weight: 500; }
.price-btn.is-manual .price-tag { color: var(--coral-text); font-weight: 600; }
.price-btn.is-unpriced { color: var(--coral-text); font-weight: 600; border: 1px dashed var(--coral); background: var(--coral-wash); padding: 2px 8px; }

.records-more { display: flex; justify-content: center; padding: 20px 0 0; }
.records-empty { padding: 48px 0 24px; text-align: center; color: var(--muted); }
.records-empty p { margin: 0 0 12px; }

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

.dlg {
  border: 0; padding: 0; border-radius: 16px;
  width: min(460px, calc(100vw - 32px));
  background: var(--surface); color: var(--ink);
  box-shadow: 0 30px 70px -24px rgba(10, 10, 13, 0.55), 0 0 0 1px rgba(32, 33, 43, 0.06);
}
.dlg::backdrop { background: rgba(10, 10, 13, 0.4); }
.dlg-body { padding: 22px 24px 20px; }
.dlg-title { margin: 0; font-size: 18px; font-weight: 700; line-height: 1.4; }
.dlg-subject { margin: 10px 0 0; font-weight: 600; }
.dlg-text { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.dlg-text strong { color: var(--ink); }
.dlg-fields { display: flex; gap: 12px; margin-top: 16px; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.field--grow { flex: 1; }
.field .input { height: 40px; font-family: var(--rounded); font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; width: 100%; }
.field .select { height: 40px; }
.dlg-error { min-height: 1.5em; margin: 8px 0 0; color: var(--warning); font-size: 13px; font-weight: 600; }
.dlg-actions { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.dlg-spacer { flex: 1; }
.choice { border: 0; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.radio { display: flex; align-items: center; gap: 10px; font-size: 14px; }

/* ---------- drop veil & toast ---------- */

.veil {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(237, 235, 232, 0.9);
}
.veil-frame { position: absolute; inset: 14px; border: 2px dashed var(--coral); border-radius: 20px; }
.veil p { margin: 0; font-size: 20px; font-weight: 700; color: var(--coral-text); }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60;
  max-width: min(560px, calc(100vw - 32px));
  padding: 11px 18px; border-radius: 12px;
  background: var(--brand-ink); color: var(--brand-paper);
  font-size: 14px; line-height: 1.5;
  opacity: 0; transform: translate(-50%, 10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */

@media (max-width: 980px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .rail {
    position: static; height: auto; overflow: visible;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px 28px; padding: 20px 20px 4px;
  }
  .rail > .rail-brand { grid-column: 1 / -1; }
  .rail-export { grid-column: 2; align-self: start; }
  .rail-config { grid-column: 1 / -1; margin-top: 0; }
  .desk { padding: 12px 12px 48px; }
}

@media (max-width: 760px) {
  .intro { grid-template-columns: minmax(0, 1fr); gap: 36px; padding: 32px 20px 48px; }
  .intro-copy { order: -1; }
  .print--hero { --w: min(260px, 70vw); }
  .intro-lede { font-size: 17px; }

  .rail { grid-template-columns: minmax(0, 1fr); }
  .rail-export { grid-column: 1; }

  .sheet { padding: 0 16px 24px; border-radius: 14px; }
  .tabs { margin: 0 -16px; padding: 0 16px; }

  /* price table becomes stacked blocks */
  .price-table, .price-table tbody, .price-table tr, .price-table th, .price-table td { display: block; width: auto; }
  .price-table thead { display: none; }
  .pgroup { padding: 14px 0 6px; border-top: 1px solid var(--line); }
  .pgroup:first-of-type { border-top: 0; }
  .pgroup > tr > th, .pgroup > tr > td { border-top: 0 !important; padding: 0; }
  .price-table tr.prow { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px 12px; padding-bottom: 12px; }
  .prow > th { grid-column: 1 / -1; }
  .pg-name { min-width: 0; }
  .pc-price { width: auto; min-width: 0; }
  .pc-label { display: block; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
  .pc-cur .select { width: 100%; height: 40px; }
  .ticket { max-width: none; }
  .price-table tr.prow--period { padding-left: 16px; border-left: 1.5px solid var(--line-2); margin-left: 4px; }
  .pp-range { padding-left: 0 !important; }
  .pp-range::before { display: none; }
  .ticket-note:empty { display: none; }

  .filters .select, .search { flex: 1 1 140px; max-width: none; width: auto; }

  .ledger-table thead { display: none; }
  .ledger-table, .ledger-table tbody, .ledger-table tr, .ledger-table td, .ledger-table th { display: block; }
  .month-row th { padding-top: 16px; }
  .lrow {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "date who sub" "date cat price" "date note note";
    column-gap: 12px; row-gap: 2px;
    padding: 10px 0; border-bottom: 1px solid var(--line);
  }
  .lrow > td { padding: 0 !important; border: 0 !important; min-width: 0; }
  .lc-date { grid-area: date; width: auto; }
  .lc-who { grid-area: who; min-width: 0; }
  .lc-cat { grid-area: cat; color: var(--muted); font-size: 13px; }
  .lc-qty { display: none !important; }
  .lc-cat::after { content: " ×" attr(data-qty); }
  .lc-price { grid-area: price; text-align: right; }
  .lc-sub { grid-area: sub; text-align: right; }
  .lc-note { grid-area: note; min-width: 0; }
  .lc-note:empty { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .print.is-developing .print-image { animation: none; }
}
