/* Nahla Receipts. Palette from the Nahla letterhead: burgundy, tan, navy on warm paper. */
:root {
  --paper: #F7F4EF;
  --surface: #FFFFFF;
  --ink: #1B2131;
  --muted: #5D6272;
  --line: #E2DACE;
  --burgundy: #5C2441;
  --burgundy-dark: #481B33;
  --tan: #BD9C73;
  --tan-soft: #F3EBDF;
  --danger: #A32020;
  --radius: 8px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* the letterhead's bar */
.strip { height: 6px; background: linear-gradient(90deg, var(--burgundy) 0%, #8F5A58 55%, var(--tan) 100%); }

.top {
  display: flex; align-items: center; gap: 24px;
  max-width: 1080px; margin: 0 auto; padding: 18px 24px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand img { display: block; border-radius: 9px; }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.brand-name span { font-weight: 400; color: var(--burgundy); }

.tabs { display: flex; gap: 4px; margin-left: auto; }
.tab {
  appearance: none; border: 0; background: none; cursor: pointer;
  font: inherit; font-weight: 600; color: var(--muted);
  padding: 10px 14px; border-radius: var(--radius); border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { color: var(--burgundy); border-bottom-color: var(--tan); border-radius: var(--radius) var(--radius) 0 0; }
.link { appearance: none; border: 0; background: none; cursor: pointer; font: inherit; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; padding: 10px 4px; }
.link:hover { color: var(--ink); }

main { max-width: 1080px; margin: 0 auto; padding: 8px 24px 56px; }
section { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 32px; }
section.narrow { max-width: 440px; margin: 40px auto 0; }
h1 { font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -0.015em; margin: 0 0 6px; outline: none; }
.lede { margin: 0 0 26px; color: var(--muted); max-width: 62ch; }
.loading { color: var(--muted); padding: 40px 0; text-align: center; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 24px; }
.field.wide { grid-column: 1 / -1; }
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
input[type="text"], input[type="password"], input[type="date"], input[type="search"] {
  width: 100%; min-height: 46px; padding: 10px 12px;
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid #C9BFB0; border-radius: var(--radius);
}
input::placeholder { color: #9A968F; }
input:focus-visible, button:focus-visible, .tab:focus-visible, a:focus-visible { outline: 2px solid var(--burgundy); outline-offset: 2px; }
input[aria-invalid="true"] { border-color: var(--danger); }
input.upper { text-transform: uppercase; }
input.upper::placeholder { text-transform: none; }
.hint { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.words { margin: 6px 0 0; font-size: 13.5px; font-style: italic; font-weight: 600; color: var(--burgundy); min-height: 1.5em; }
.error { margin: 6px 0 0; font-size: 14px; color: var(--danger); }
.error:empty { display: none; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; align-items: center; }
button.primary, button.secondary {
  appearance: none; cursor: pointer; font: inherit; font-weight: 600;
  min-height: 46px; padding: 10px 22px; border-radius: var(--radius);
}
button.primary { background: var(--burgundy); color: #FFFFFF; border: 1px solid var(--burgundy); }
button.primary:hover { background: var(--burgundy-dark); }
button.secondary { background: var(--surface); color: var(--ink); border: 1px solid #C9BFB0; }
button.secondary:hover { border-color: var(--ink); }
button:disabled { opacity: 0.55; cursor: default; }

/* review */
.review { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.sheet { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.sheet div { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.sheet div:last-child { border-bottom: 0; }
.sheet dt { color: var(--muted); font-size: 14px; padding-top: 2px; }
.sheet dd { margin: 0; font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.sheet dd.italic { font-style: italic; }
.sheet dd.regular { font-weight: 400; font-style: italic; }
.sheet dd.none { font-weight: 400; color: var(--muted); font-size: 15px; }
.preview { margin: 0; }
.paper svg { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #FFFFFF; }
.paper text { font-weight: 400; font-style: normal; font-kerning: none; font-feature-settings: "kern" 0, "liga" 0, "clig" 0; }
.preview.solo { margin-top: 28px; max-width: 640px; }
.notice { margin-top: 22px; padding: 14px 16px; background: var(--tan-soft); border: 1px solid var(--tan); border-radius: var(--radius); }
.notice strong { display: block; margin-bottom: 4px; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.confirm { display: flex; gap: 12px; align-items: flex-start; margin-top: 24px; padding: 16px; border: 1px solid #C9BFB0; border-radius: var(--radius); cursor: pointer; font-weight: 600; font-size: 16px; }
.confirm input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--burgundy); flex: none; }

/* history */
.search { max-width: 460px; }
.count { margin: 16px 0 10px; color: var(--muted); font-size: 14px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); background: #FBF9F6; white-space: nowrap; }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.name { font-weight: 600; }
td.name small { display: block; font-weight: 400; font-style: italic; color: var(--muted); }
td.when { color: var(--muted); white-space: nowrap; font-size: 14px; }
td.acts { white-space: nowrap; text-align: right; }
td.acts button { appearance: none; cursor: pointer; font: inherit; font-size: 14px; font-weight: 600; color: var(--burgundy); background: none; border: 1px solid transparent; border-radius: 6px; padding: 6px 10px; }
td.acts button:hover { border-color: var(--tan); }
.empty { color: var(--muted); padding: 28px 0 4px; }

.foot { max-width: 1080px; margin: 0 auto; padding: 0 24px 32px; color: var(--muted); font-size: 13px; }

@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: 8px 16px; padding: 14px 16px; }
  .tabs { order: 3; width: 100%; margin-left: 0; }
  .tab { flex: 1; text-align: center; }
  .link { margin-left: auto; }
  main { padding: 4px 12px 40px; }
  section { padding: 22px 18px; }
  section.narrow { margin-top: 16px; }
  h1 { font-size: 23px; }
  .grid { grid-template-columns: 1fr; }
  .review { grid-template-columns: 1fr; }
  .sheet div { grid-template-columns: 1fr; gap: 2px; }
  .actions button { flex: 1 1 100%; }
  /* history rows become cards */
  .table-wrap { border: 0; overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  thead { display: none; }
  tbody tr { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
  td { border: 0; padding: 3px 0; }
  td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-weight: 400; font-size: 13px; }
  td.num { text-align: left; }
  td.acts { text-align: left; padding-top: 8px; }
  td.acts button { border-color: var(--tan); margin-right: 8px; }
  .foot { padding: 0 16px 24px; }
}
