:root {
  color-scheme: light;
  --bg: #fff8ee;
  --card: #ffffff;
  --text: #24343a;
  --muted: #65777d;
  --honey: #edae49;
  --amaranth: #d1495b;
  --teal: #00798c;
  --accent: var(--amaranth);
  --accent-dark: #a93445;
  --border: #f1d9c0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
}

.brand,
a {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

a { color: var(--accent); }

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.container {
  width: min(960px, calc(100% - 2rem));
  margin: 2rem auto;
}

.hero {
  margin-bottom: 1.5rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 1.25rem;
  box-shadow: 0 18px 45px rgba(0, 121, 140, 0.08);
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.narrow {
  max-width: 420px;
  margin: 4rem auto;
}

.narrow-form {
  max-width: 720px;
}

.stack {
  display: grid;
  gap: 1rem;
}

label {
  display: grid;
  gap: 0.4rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.8rem 0.9rem;
  font: inherit;
  background: white;
}

textarea { resize: vertical; }

button {
  border: 0;
  border-radius: 999px;
  padding: 0.8rem 1rem;
  background: var(--amaranth);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button:hover { background: var(--accent-dark); }

.button {
  display: inline-block;
  border-radius: 999px;
  padding: 0.8rem 1rem;
  background: var(--amaranth);
  color: white;
}

.button:hover { background: var(--accent-dark); }

.link-button {
  background: transparent;
  color: var(--teal);
  padding: 0;
}

.danger { color: #a12424; }

.muted { color: var(--muted); }
.error { color: #a12424; font-weight: 700; }
.empty { margin: 0; color: var(--muted); }

.error-box {
  border: 1px solid #f0b6b6;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  background: #fff4f4;
  color: #8f1d1d;
  font-weight: 700;
}

.error-box p { margin: 0.25rem 0; }

.two-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th { color: var(--muted); font-size: 0.9rem; }

.actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  white-space: nowrap;
}

.receipt-sheet {
  max-width: 990px;
  margin: 0 auto 3rem;
  background: white;
  border: 1px solid #d7d7d7;
  color: #000;
  padding: 0 0 1.25rem;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
}

.receipt-sheet h1 {
  margin: 0;
  padding: 4px;
  background: #d1495b;
  color: white;
  font-size: 20px;
}

.receipt-sheet h2 {
  margin: 0;
  padding: 4px;
  font-size: 16px;
  font-weight: 400;
}

.receipt-sheet p {
  margin: 0;
  padding: 4px;
  min-height: 23px;
}

.receipt-sheet .law {
  font-weight: 700;
  border-top: 0;
}

.receipt-sheet .spacer {
  height: 23px;
}

.signature-space {
  height: 54px;
}

.signature-line {
  margin-top: 0;
  padding-top: 10px;
}

.stamp-code-line {
  margin-top: 28px !important;
}

.stamp-code-line span {
  display: inline-block;
  min-width: 16ch;
  letter-spacing: 0.08em;
  text-align: center;
}

.amounts {
  margin-top: 46px;
  max-width: 395px;
}

.amounts p {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.no-print {}

@media print {
  body { background: white; }
  .topbar,
  .no-print { display: none !important; }
  .container { width: 100%; margin: 0; }
  .receipt-sheet { border: 0; margin: 0; max-width: none; }
}

@media (max-width: 640px) {
  .page-header,
  .two-columns {
    grid-template-columns: 1fr;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }
}
