* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: #faf7f2;
  color: #1f1a17;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 28px;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
}

.brand img { width: 56px; height: 56px; }
.brand img.brand-logo-full { width: 120px; height: auto; }

.brand h1 {
  font-size: 1.1rem;
  text-align: center;
  margin: 0;
  color: #b91c1c;
}

.brand p {
  margin: 0;
  font-size: 0.85rem;
  color: #6b6058;
}

label {
  display: block;
  font-size: 0.85rem;
  margin: 14px 0 4px;
  color: #4a423c;
}

input, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d8cfc5;
  border-radius: 8px;
  font-size: 1rem;
  background: #fff;
}

input:focus, select:focus {
  outline: none;
  border-color: #b91c1c;
}

button {
  width: 100%;
  margin-top: 20px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #b91c1c;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

button:hover { background: #991515; }

button.secondary {
  background: transparent;
  color: #b91c1c;
  border: 1px solid #b91c1c;
}

button.secondary:hover { background: #fdf1f1; }

.link-row {
  text-align: center;
  margin-top: 16px;
  font-size: 0.85rem;
  color: #6b6058;
}

.link-row a {
  color: #b91c1c;
  cursor: pointer;
  text-decoration: underline;
}

.msg {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
}

.msg.error { background: #fdecec; color: #a11; }
.msg.info { background: #eef6ee; color: #246; }

.hidden { display: none !important; }

/* ── Layout for form/dashboard pages ───────────────────────────────── */
.topbar {
  width: 100%;
  background: #b91c1c;
  color: #fff;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.topbar .brandline {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.topbar .brandline .brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.topbar .brandline .brand-tagline { font-size: 0.68rem; font-weight: 400; opacity: 0.85; }

.topbar img { width: 28px; height: 28px; }

.topbar nav { display: flex; gap: 14px; flex-wrap: wrap; }
.topbar nav a {
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  opacity: 0.9;
}
.topbar nav a:hover { opacity: 1; text-decoration: underline; }

.topbar button {
  width: auto;
  margin: 0;
  padding: 6px 14px;
  background: #fff;
  color: #b91c1c;
  font-size: 0.85rem;
}

.content {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 20px;
}

.wide-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 24px;
  margin-bottom: 20px;
}

.wide-card h2 {
  margin-top: 0;
  font-size: 1.1rem;
  color: #b91c1c;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

@media (max-width: 520px) {
  .row { grid-template-columns: 1fr; }
}

.field-note { font-size: 0.75rem; color: #8a7f75; margin-top: 2px; }

table.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.report-table th, table.report-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #eee2d8;
}
table.report-table th {
  background: #faf0ea;
  color: #6b2020;
}
table.report-table tfoot td {
  font-weight: 700;
  border-top: 2px solid #b91c1c;
}

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #fdecec;
  color: #a11;
}
.pill.ok { background: #eef6ee; color: #246; }

.actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.actions-row button { width: auto; }

/* ── Printable receipt ─────────────────────────────────────────────── */
#printArea { display: none; }

@media print {
  body * { visibility: hidden; }
  #printArea, #printArea * { visibility: visible; }
  #printArea {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
  }
}

.receipt-sheet {
  border: 2px solid #b91c1c;
  padding: 18px 22px;
  font-family: Georgia, "Times New Roman", serif;
  color: #1f1a17;
}
.receipt-sheet .r-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 2px solid #b91c1c;
  padding-bottom: 10px;
  margin-bottom: 12px;
}
.receipt-sheet .r-head .r-logo { display: flex; gap: 10px; align-items: center; }
.receipt-sheet .r-head .r-logo img.r-logo-full { width: auto; height: 60px; }
.receipt-sheet .r-head h2 { margin: 0; font-size: 1.2rem; color: #b91c1c; }
.receipt-sheet .r-head .r-reg { text-align: right; font-size: 0.72rem; color: #444; max-width: 320px; }
.receipt-sheet .r-head .r-reg .r-reg-number { white-space: nowrap; font-weight: 600; }
.receipt-sheet .r-title { text-align: center; font-size: 1rem; font-weight: bold; margin: 18px 0 14px; letter-spacing: 1px; }
.receipt-sheet .r-noDate { display: flex; justify-content: space-between; font-size: 0.9rem; margin-bottom: 10px; }
.receipt-sheet .r-line { margin: 14px 0; font-size: 0.92rem; }
.receipt-sheet .r-line .fill { display: inline-block; min-width: 260px; border-bottom: 1px solid #333; padding: 0 4px 2px; }
.receipt-sheet .r-amountbox { display: flex; justify-content: flex-end; margin: 10px 0; }
.receipt-sheet .r-amountbox .box { border: 1px solid #333; padding: 6px 16px; font-weight: bold; }
.receipt-sheet .r-note { font-size: 0.78rem; font-style: italic; margin-top: 8px; }
.receipt-sheet .r-sign { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 30px; }
.receipt-sheet .r-sign .for-trust { font-size: 0.85rem; text-align: right; }
.receipt-sheet .r-footer { margin-top: 16px; border-top: 1px solid #ccc; padding-top: 8px; font-size: 0.72rem; color: #555; text-align: center; }
