:root {
  color-scheme: light;
  --font-thermal-latin: "Courier Prime", "Courier New", monospace;
  --font-thermal-cjk: "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --font-thermal-mix: "Courier Prime", "Noto Serif TC", "Songti TC", "PMingLiU", serif;
  --bg: #f5f1ea;
  --bg-strong: #ece6db;
  --ink: #141414;
  --muted: rgba(20, 20, 20, 0.66);
  --faint: rgba(20, 20, 20, 0.36);
  --line: rgba(20, 20, 20, 0.12);
  --line-strong: rgba(20, 20, 20, 0.24);
  --paper: #fffdf8;
  --paper-shadow: rgba(31, 27, 21, 0.12);
  --accent: #1b1b1b;
  --radius: 28px;
  --ink-smudge: 0.02em 0 rgba(20, 20, 20, 0.22), -0.02em 0 rgba(20, 20, 20, 0.08);
  --line-thermal: 1;
  --line-ui: 1.2;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.8), transparent 32%),
    linear-gradient(180deg, #faf7f1 0%, #f0eadf 100%);
  color: var(--ink);
  font-family: var(--font-thermal-mix);
  letter-spacing: 0.01em;
  text-rendering: geometricPrecision;
}

button {
  font: inherit;
}

input,
textarea,
select {
  font: inherit;
}

body {
  min-height: 100vh;
  line-height: var(--line-ui);
}

body.sheet-open {
  overflow: hidden;
}

.page-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.8fr);
  gap: 24px;
  align-items: end;
  margin-bottom: 28px;
  overflow: visible;
}

.hero-copy {
  padding-top: 10px;
  padding-left: 8px;
  overflow: visible;
}

.eyebrow,
.hero-stat-label,
.panel-head p,
.day-item-meta,
.receipt-meta span,
.receipt-header-row,
.receipt-note,
.statement-row-head p,
.statement-metric span,
.overview-box span,
.legend-item p,
.venue-rank {
  font-family: var(--font-thermal-latin);
  letter-spacing: 0.08em;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.76rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--muted);
}

.eyebrow-link {
  display: inline-block;
  text-decoration: none;
  transition: color 160ms ease, transform 160ms ease;
}

.eyebrow-link:hover,
.eyebrow-link:focus-visible {
  color: var(--ink);
  transform: translateX(2px);
}

.hero h1 {
  margin: 0;
  font-family: "Special Elite", var(--font-thermal-latin);
  font-size: clamp(2.8rem, 5vw, 5rem);
  line-height: 1;
  letter-spacing: 0.01em;
  text-shadow: none;
  padding-top: 0.12em;
  padding-left: 0.08em;
  padding-bottom: 0.03em;
  overflow: visible;
}

.hero-title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.34em;
  align-items: baseline;
}

.title-token {
  appearance: none;
  border: none;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  text-shadow: inherit;
  transition: opacity 160ms ease, transform 160ms ease;
}

.title-token:hover,
.title-token:focus-visible {
  opacity: 0.72;
  transform: translateY(-1px);
}

.hero-note {
  display: none;
}

.hero-text {
  max-width: 42rem;
  margin: 14px 0 0;
  font-size: 1rem;
  line-height: 1.9;
  color: var(--muted);
  text-shadow: 0.01em 0 rgba(20, 20, 20, 0.08);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.hero-stat,
.panel {
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.82);
  backdrop-filter: blur(10px);
}

.hero-stat {
  padding: 16px 18px;
  min-height: 86px;
  grid-column: 3;
  border: none;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  clip-path: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  cursor: pointer;
}

.hero-stat::before {
  display: none;
}

.hero-stat-button {
  appearance: none;
}

.hero-stat-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
  text-align: right;
}

.hero-stat strong {
  display: block;
  margin-top: 10px;
  font-family: "Special Elite", var(--font-thermal-latin);
  font-size: 1.16rem;
  text-shadow: var(--ink-smudge);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 320px) 564px minmax(300px, 360px);
  gap: 22px;
  align-items: stretch;
  justify-content: center;
  height: calc(100vh - 168px);
  min-height: 720px;
}

.rail {
  display: grid;
  gap: 18px;
  justify-items: center;
  align-content: start;
  min-height: 0;
  padding: 0 6px;
}

.rail,
.preview-stage,
.rail-body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.rail::-webkit-scrollbar,
.preview-stage::-webkit-scrollbar,
.rail-body::-webkit-scrollbar {
  display: none;
}

.panel {
  padding: 18px;
  box-shadow: 0 20px 40px -28px var(--paper-shadow);
}

.hero-stat,
.panel,
.month-chip,
.day-item,
.statement-row,
.overview-box,
.legend-item {
  position: relative;
  border-radius: 0;
  clip-path: polygon(
    0 12px,
    12px 0,
    calc(100% - 14px) 0,
    100% 10px,
    100% calc(100% - 14px),
    calc(100% - 10px) 100%,
    10px 100%,
    0 calc(100% - 10px)
  );
}

.hero-stat::before,
.panel::before,
.month-chip::before,
.day-item::before,
.statement-row::before,
.overview-box::before,
.legend-item::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 1px solid rgba(20, 20, 20, 0.08);
  clip-path: polygon(
    0 12px,
    12px 0,
    calc(100% - 14px) 0,
    100% 10px,
    100% calc(100% - 14px),
    calc(100% - 10px) 100%,
    10px 100%,
    0 calc(100% - 10px)
  );
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 16px;
}

.panel-head h2,
.subsection h3 {
  margin: 0;
  font-family: "Special Elite", var(--font-thermal-latin);
  font-size: 1.05rem;
  line-height: var(--line-thermal);
  letter-spacing: 0.05em;
  text-shadow: var(--ink-smudge);
}

#spent-sheet .panel-head,
#spent-sheet .subsection {
  overflow: visible;
}

#spent-sheet .panel-head h2,
#spent-sheet .subsection h3 {
  display: inline-block;
  font-family: "Special Elite", var(--font-thermal-latin);
  line-height: 1;
  letter-spacing: 0.05em;
  text-shadow: var(--ink-smudge);
  padding-top: 0.14em;
  padding-left: 0.12em;
  padding-bottom: 0.04em;
  overflow: visible;
}

.panel-head p,
.subsection p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.6;
}

.month-chips {
  display: grid;
  gap: 18px;
}

.month-chip,
.day-item,
.statement-row {
  appearance: none;
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  color: inherit;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.month-chip:hover,
.day-item:hover,
.statement-row:hover {
  border-color: var(--line-strong);
}

.month-chip {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  display: grid;
  gap: 6px;
  text-align: left;
}

.month-chip[data-active="true"],
.month-chip.is-active {
  border-color: rgba(20, 20, 20, 0.46);
  box-shadow: 0 12px 24px -20px rgba(20, 20, 20, 0.5);
}

.month-chip[data-empty="true"] {
  opacity: 0.42;
}

.month-chip[data-month-state="past-empty"] {
  opacity: 1;
}

.month-chip[data-month-state="past-empty"] strong {
  color: var(--ink);
}

.month-chip[data-month-state="current"] strong,
.month-chip[data-month-state="future"] strong {
  color: var(--faint);
  text-shadow: none;
}

.month-chip[data-month-state="future"] {
  cursor: default;
  opacity: 1;
}

.month-chip.is-active {
  opacity: 1;
}

.month-chip.is-active .month-chip-label {
  color: var(--ink);
}

.month-chip.is-active strong,
.month-year-label.is-active {
  color: #8f241b;
  text-shadow: none;
}

.month-chip.is-active .month-chip-label,
.month-chip.is-active strong,
.month-year-label.is-active,
.day-item[data-active="true"] .day-item-date.is-active,
.statement-row[data-active="true"] .statement-date.is-active,
.statement-metric[aria-pressed="true"] span,
.statement-metric[aria-pressed="true"] strong,
.legend-item-button[aria-pressed="true"] strong,
.legend-item-button[aria-pressed="true"] p {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

.day-item[data-active="true"] .day-item-top > strong,
.statement-row[data-active="true"] .statement-total {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

.month-year-group {
  display: grid;
  gap: 10px;
}

.month-year-label {
  appearance: none;
  width: fit-content;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  margin: 0;
  font-family: "Special Elite", "Courier Prime", monospace;
  font-size: 1rem;
  line-height: var(--line-thermal);
  letter-spacing: 0.05em;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.month-chip-label {
  font-family: "Courier Prime", "Courier New", monospace;
  font-size: 0.76rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--faint);
}

.month-chip strong,
.overview-box strong,
.day-item-top strong,
.receipt-meta strong,
.receipt-section-head strong,
.receipt-row-price,
.statement-total,
.summary-pill strong,
.statement-metric strong,
.venue-item strong,
.receipt-total strong {
  text-shadow: var(--ink-smudge);
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.overview-box {
  padding: 14px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid rgba(20, 20, 20, 0.08);
}

.overview-box span {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.overview-box strong {
  display: block;
  margin-top: 10px;
  font-family: "Special Elite", "Courier Prime", monospace;
  font-size: 1.2rem;
  line-height: var(--line-thermal);
  letter-spacing: 0.03em;
}

.day-panel,
.statement-panel {
  min-height: 100%;
  width: min(100%, 320px);
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.day-panel {
  min-height: 100%;
  border: none;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  clip-path: none;
  padding: 0;
}

.day-panel::before,
.day-item::before {
  display: none;
}

.day-list,
.month-table,
.venue-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rail-head {
  position: sticky;
  top: 0;
  z-index: 2;
  margin-bottom: 0;
  padding-bottom: 16px;
  background: linear-gradient(180deg, #f5f1ea 0%, rgba(245, 241, 234, 0.86) 78%, rgba(245, 241, 234, 0) 100%);
}

.rail-body {
  min-height: 0;
  overflow-y: auto;
  padding-top: 2px;
  overflow-anchor: none;
}

.day-list {
  justify-content: flex-start;
}

.month-table {
  justify-content: flex-start;
}

.day-item {
  padding: 14px;
  text-align: left;
  line-height: 1.45;
  border: none;
  background: transparent;
  box-shadow: none;
  clip-path: none;
  transition: none;
}

.day-item-top,
.day-item-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.day-item-top strong {
  font-family: "Special Elite", "Courier Prime", monospace;
  line-height: var(--line-thermal);
  letter-spacing: 0.03em;
}

.day-item-date,
.statement-date {
  display: inline-flex;
  align-items: baseline;
  gap: 0.36em;
  font-family: "Special Elite", var(--font-thermal-latin);
  line-height: var(--line-thermal);
  letter-spacing: 0.03em;
  transition: transform 180ms ease, color 180ms ease;
}

.day-item:hover .day-item-date,
.day-item:focus-visible .day-item-date,
.statement-row:hover .statement-date,
.statement-row:focus-visible .statement-date {
  transform: translateX(2px);
  color: var(--ink);
}

.day-item[data-active="true"] .day-item-date.is-active,
.statement-row[data-active="true"] .statement-date.is-active,
.statement-metric[aria-pressed="true"] span,
.legend-item-button[aria-pressed="true"] p {
  color: #8f241b;
}

.statement-metric[aria-pressed="true"] strong {
  color: #8f241b;
}

.legend-item-button[aria-pressed="true"] strong {
  color: var(--ink);
}

.day-item-meta {
  margin-top: 8px;
  color: var(--faint);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.preview-stage {
  min-height: 0;
  height: 100%;
  overflow-y: auto;
  padding-right: 6px;
  overflow-anchor: none;
}

.phone-frame {
  position: relative;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 44px 22px 34px;
  border-radius: 48px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(247, 241, 233, 0.86)),
    var(--bg-strong);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    0 36px 56px -28px rgba(31, 27, 21, 0.42);
}

.printer-cap {
  position: absolute;
  top: 28px;
  left: 24px;
  right: 24px;
  height: 36px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2a2928 0%, #171615 100%);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.08);
}

.receipt-paper {
  position: relative;
  min-height: 860px;
  padding: 58px 34px 20px;
  border-radius: 26px 26px 18px 18px;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(20, 20, 20, 0.017) 0,
      rgba(20, 20, 20, 0.017) 1px,
      transparent 1px,
      transparent 28px
    ),
    var(--paper);
  box-shadow: 0 20px 35px -24px rgba(0, 0, 0, 0.18);
}

.receipt-paper::after {
  display: none;
}

.receipt-root {
  display: grid;
  gap: 26px;
  min-height: 100%;
}

.receipt-stack {
  display: grid;
  gap: 8px;
  min-height: 100%;
  perspective: 1800px;
}

.receipt-sheet {
  appearance: none;
  position: relative;
  border: none;
  padding: 0;
  width: 100%;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}

.receipt-sheet-pad {
  position: relative;
  z-index: 0;
  display: block;
  padding: 0;
  border-radius: 24px;
}

.receipt-sheet.is-editable .receipt-sheet-pad {
  box-shadow: none;
}

.receipt-sheet.is-monthly-view {
  cursor: default;
}

.receipt-brand {
  text-align: center;
}

.receipt-mark {
  display: block;
  margin-bottom: 18px;
  font-family: "Courier Prime", "Courier New", monospace;
  letter-spacing: 0.24em;
  font-size: 1rem;
}

.receipt-brand h2 {
  margin: 0 0 16px;
  font-family: "Special Elite", "Courier Prime", monospace;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: var(--line-thermal);
  letter-spacing: 0.08em;
  text-shadow: var(--ink-smudge);
}

.receipt-meta {
  display: grid;
  gap: 12px;
  padding: 22px 0 24px;
  border-top: 1px dashed var(--line-strong);
  border-bottom: 1px dashed var(--line-strong);
}

.receipt-meta p,
.receipt-meta-date,
.receipt-header-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: baseline;
  margin: 0;
}

.receipt-meta-date {
  width: 100%;
  min-height: 28px;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 6px 0;
  margin: -6px 0;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.receipt-meta span,
.receipt-header-row {
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.receipt-meta strong {
  font-family: "Special Elite", "Courier Prime", monospace;
  font-size: 0.94rem;
  line-height: var(--line-thermal);
  color: var(--ink);
  letter-spacing: 0.03em;
}

.receipt-header-row {
  grid-template-columns: 54px minmax(0, 1fr) 86px 64px;
  margin-top: 14px;
  padding: 0 0 16px;
  border-bottom: 1px dashed var(--line-strong);
}

.receipt-section {
  display: grid;
  gap: 14px;
  padding: 14px 0 24px;
  border-bottom: 1px dashed rgba(20, 20, 20, 0.16);
}

.receipt-section:last-of-type {
  border-bottom: 0;
}

.receipt-section-head,
.receipt-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 86px 64px;
  gap: 10px;
  align-items: start;
}

.receipt-section-head {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: baseline;
}

.receipt-venue {
  font-family: "Special Elite", var(--font-thermal-latin);
  line-height: var(--line-thermal);
}

.receipt-venue.has-cjk {
  font-family: var(--font-thermal-mix);
  font-weight: 600;
}

.receipt-section-total,
.receipt-row-price,
.statement-total,
.summary-pill strong {
  font-family: "Special Elite", var(--font-thermal-latin);
}

.receipt-row-price.is-gift {
  color: #8d8983;
  text-shadow: none;
}

.receipt-section-head span {
  font-family: "Courier Prime", "Courier New", monospace;
  font-size: 0.76rem;
  color: var(--faint);
}

.receipt-row {
  font-size: 0.92rem;
  line-height: 1.55;
}

.receipt-row-index,
.receipt-row-type {
  font-family: "Courier Prime", "Courier New", monospace;
  font-size: 0.74rem;
  color: var(--faint);
  letter-spacing: 0.05em;
}

.receipt-row-item {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.receipt-row-main {
  display: flex;
  gap: 9px;
  align-items: baseline;
  min-width: 0;
}

.receipt-row-main span:nth-child(2) {
  flex: 1;
  min-width: 0;
  line-height: var(--line-ui);
  overflow-wrap: anywhere;
  text-shadow: 0.01em 0 rgba(20, 20, 20, 0.06);
}

.receipt-row-sub {
  padding-left: 19px;
  color: var(--faint);
  font-size: 0.7rem;
  line-height: 1.45;
}

.receipt-dot,
.summary-dot,
.legend-swatch {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--dot, var(--swatch));
  margin-top: 0.36rem;
}

.receipt-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 16px;
}

.summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(20, 20, 20, 0.1);
  background: rgba(20, 20, 20, 0.02);
  font-family: "Courier Prime", "Courier New", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.receipt-footer {
  padding-top: 8px;
}

.receipt-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
  font-family: "Courier Prime", "Courier New", monospace;
  letter-spacing: 0.06em;
}

.receipt-total span {
  font-size: 0.84rem;
  letter-spacing: 0.18em;
}

.receipt-total strong {
  font-size: 1.34rem;
  line-height: var(--line-thermal);
}

.receipt-note {
  line-height: 1.7;
  color: var(--faint);
  font-size: 0.7rem;
}

.statement-row {
  padding: 16px;
  text-align: left;
  line-height: 1.55;
}

.statement-panel {
  border: none;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
  clip-path: none;
  padding: 0;
}

.statement-panel::before,
.statement-row::before {
  display: none;
}

.statement-row {
  border: none;
  background: transparent;
  box-shadow: none;
  clip-path: none;
  padding: 16px 0;
  transition: none;
}

.statement-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.statement-month-trigger,
.statement-metric {
  appearance: none;
  border: none;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.statement-month-trigger {
  width: 100%;
  cursor: pointer;
}

.statement-row-head strong {
  display: block;
}

.statement-row-head p {
  margin-top: 6px;
}

.statement-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.statement-metric {
  display: grid;
  gap: 6px;
  min-width: 0;
  cursor: pointer;
}

.statement-metric:hover span,
.statement-metric:focus-visible span {
  color: var(--ink);
  transform: translateX(2px);
}

.statement-metric span {
  display: inline-block;
  width: fit-content;
  transition: transform 180ms ease, color 180ms ease;
}

.statement-metric strong {
  font-family: "Special Elite", "Courier Prime", monospace;
  line-height: var(--line-thermal);
  font-size: 0.88rem;
  letter-spacing: 0.03em;
}

.statement-divider {
  display: flex;
  gap: 3px;
  align-items: center;
  flex-wrap: nowrap;
  margin-top: 16px;
  min-height: 2px;
}

.statement-divider-node {
  display: block;
  flex: 1 1 0;
  min-width: 4px;
  height: 1px;
  background: var(--divider-color, rgba(20, 20, 20, 0.18));
  border-radius: 999px;
}

.legend-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.legend-item {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(20, 20, 20, 0.08);
  background: rgba(255, 255, 255, 0.6);
}

.legend-item-button {
  appearance: none;
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: default;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  margin-top: 0.36rem;
}

.legend-item strong,
.venue-name {
  display: block;
  line-height: var(--line-ui);
  text-shadow: 0.01em 0 rgba(20, 20, 20, 0.06);
}

.legend-item p {
  margin: 2px 0 0;
  color: var(--faint);
}

.subsection {
  margin-top: 20px;
}

.venue-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed rgba(20, 20, 20, 0.1);
}

.venue-item strong {
  font-family: "Special Elite", "Courier Prime", monospace;
}

.empty-state {
  margin: 0;
  font-family: "Courier Prime", "Courier New", monospace;
  color: var(--muted);
  line-height: 1.8;
}

.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 20, 0.24);
  backdrop-filter: blur(8px);
}

.sheet-panel {
  position: relative;
  width: min(1120px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  overflow: auto;
  margin: 40px auto;
  padding: 22px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 24px 60px -30px rgba(31, 27, 21, 0.22);
}

#spent-sheet .sheet-panel {
  height: 100vh;
  max-height: 100vh;
  margin: 0 auto;
  border-radius: 0;
  box-shadow: none;
}

.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.sheet-header h2 {
  margin: 0;
  font-family: "Special Elite", "Courier Prime", monospace;
  font-size: 1.2rem;
  line-height: var(--line-thermal);
  letter-spacing: 0.05em;
}

.sheet-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  font-size: 1.8rem;
  line-height: 1;
}

.sheet-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 18px;
  align-items: start;
}

#spent-sheet .panel,
#spent-sheet .overview-box,
#spent-sheet .month-chip,
#spent-sheet .legend-item {
  border: none;
  background: transparent;
  box-shadow: none;
  clip-path: none;
}

#spent-sheet .panel::before,
#spent-sheet .overview-box::before,
#spent-sheet .month-chip::before,
#spent-sheet .legend-item::before {
  display: none;
}

#spent-sheet .overview-panel,
#spent-sheet .legend-panel {
  padding: 0;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
}

.dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 20, 20, 0.24);
  backdrop-filter: blur(8px);
}

.dialog-panel {
  position: relative;
  width: min(520px, calc(100vw - 32px));
  margin: 48px auto;
  padding: 22px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 24px 60px -30px rgba(31, 27, 21, 0.22);
}

.entry-panel {
  width: min(660px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  padding: 0;
}

.date-picker-panel {
  width: min(360px, calc(100vw - 32px));
}

#receipt-date-layer {
  display: grid;
  place-items: center;
  padding: 20px;
}

#receipt-date-layer[hidden] {
  display: none;
}

#receipt-date-layer .date-picker-panel {
  width: min(360px, 100%);
  margin: 0;
}

.date-picker-panel .field input {
  font-family: "Courier Prime", monospace;
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.entry-panel .dialog-header {
  margin: 0;
  padding: 20px 22px 18px;
  border-bottom: 1px dashed rgba(20, 20, 20, 0.18);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.dialog-header h2 {
  margin: 0;
  font-family: "Special Elite", "Courier Prime", monospace;
  font-size: 1.16rem;
  line-height: var(--line-thermal);
  letter-spacing: 0.05em;
}

.dialog-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  font-size: 1.8rem;
  line-height: 1;
}

.dialog-form,
.admin-actions {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field span {
  font-size: 0.76rem;
  line-height: var(--line-ui);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid rgba(20, 20, 20, 0.12);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 12px 14px;
  font: inherit;
  line-height: var(--line-ui);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: rgba(120, 32, 28, 0.72);
  box-shadow: 0 0 0 3px rgba(120, 32, 28, 0.08);
}

.field textarea {
  resize: vertical;
}

.price-input-row {
  display: flex;
  gap: 8px;
}

.price-input-row input {
  min-width: 0;
}

.free-toggle {
  flex: 0 0 auto;
  border: 1px solid rgba(20, 20, 20, 0.18);
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
  cursor: pointer;
  font: 700 0.78rem "Noto Serif TC", serif;
  letter-spacing: 0;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.free-toggle[aria-pressed="true"] {
  border-color: rgba(120, 32, 28, 0.76);
  background: #7d2922;
  color: #fffdf8;
}

.entry-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 20px 22px 22px;
}

.entry-form .field-date {
  grid-column: 1 / -1;
}

.entry-form .field-date input {
  border: 0;
  border-bottom: 1px solid rgba(20, 20, 20, 0.24);
  background: transparent;
  padding: 6px 0 12px;
  font-family: "Courier Prime", monospace;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
}

.entry-form .dialog-submit {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.dialog-submit {
  appearance: none;
  border: 1px solid rgba(20, 20, 20, 0.12);
  background: var(--ink);
  color: #fffdf8;
  padding: 13px 14px;
  cursor: pointer;
  transition: opacity 160ms ease, transform 160ms ease;
}

.dialog-submit:hover,
.dialog-submit:focus-visible {
  opacity: 0.86;
  transform: translateY(-1px);
}

.dialog-submit-secondary {
  background: transparent;
  color: var(--ink);
}

.dialog-message {
  min-height: 1.4em;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.dialog-message[data-tone="error"] {
  color: #9b2e18;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
    min-height: 0;
  }

  .preview-stage {
    order: -1;
    position: static;
    height: auto;
    overflow: visible;
    padding-right: 0;
  }

  .phone-frame {
    width: min(100%, 640px);
  }

  .rail {
    overflow: visible;
    padding-right: 0;
  }
}

@media (max-width: 800px) {
  .workspace {
    display: block;
    height: auto;
    min-height: 0;
  }

  .workspace > .rail {
    display: none;
  }

  .preview-stage {
    width: 100%;
  }

  .page-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 18px;
  }

  .hero {
    grid-template-columns: 1fr;
  }

  .hero-title {
    gap: 0.28em;
  }

  .hero-stats {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 16px;
    border-radius: 22px;
  }

  .phone-frame {
    padding: 34px 12px 22px;
    border-radius: 34px;
  }

  .printer-cap {
    left: 12px;
    right: 12px;
  }

  .receipt-paper {
    min-height: auto;
    padding: 94px 18px 26px;
  }

  .receipt-header-row,
  .receipt-row {
    grid-template-columns: 44px minmax(0, 1fr) 70px 54px;
    font-size: 0.82rem;
  }

  .entry-form {
    grid-template-columns: 1fr;
  }

  #spent-sheet .sheet-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  #spent-sheet .overview-panel,
  #spent-sheet .legend-panel {
    min-width: 0;
  }

  #spent-sheet .overview-panel {
    order: 1;
  }

  #spent-sheet .legend-panel {
    order: 2;
  }

  #spent-sheet .legend-item-button {
    cursor: pointer;
  }

  #spent-sheet .month-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }

  #spent-sheet .month-chip {
    gap: 3px;
    padding: 6px 4px;
  }

  #spent-sheet .month-chip-label {
    font-size: 0.68rem;
    letter-spacing: 0.08em;
  }

  #spent-sheet .month-chip strong {
    font-size: 0.78rem;
    letter-spacing: 0;
    white-space: nowrap;
  }

  .dialog-panel,
  .entry-panel,
  .sheet-panel {
    width: min(calc(100vw - 20px), 100%);
    margin: 20px auto;
  }
}
