:root {
  --bg: #e7dfd1;
  --ink: #1c1712;
  --muted: #5e564c;
  --card: #f7f3eb;
  --sage: #e3efe6;
  --clay: #f6e4d4;
  --mist: #e6ebf3;
  --line: rgba(28, 23, 18, 0.14);
  --accent: #1e6b45;
  --accent-ink: #f4fff8;
  --shadow: 0 24px 50px rgba(48, 32, 14, 0.12);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.5;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background:
    radial-gradient(900px 420px at 0% -10%, #f8f3ea 0%, transparent 55%),
    radial-gradient(700px 380px at 100% 0%, #efe4d4 0%, transparent 50%),
    var(--bg);
}
a { color: var(--accent); }
img { max-width: 100%; }
h1, h2, h3 { font-family: var(--serif); font-weight: 560; letter-spacing: -0.02em; line-height: 1.15; }
h1 { font-size: clamp(2.3rem, 5vw, 4.2rem); margin: 0 0 0.4em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0 0 0.4em; }
p { margin: 0 0 0.8em; }

.skip {
  position: absolute;
  left: 12px;
  top: -40px;
  background: white;
  padding: 8px 12px;
  z-index: 5;
}
.skip:focus { top: 12px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  background: transparent;
}
.logo { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 650; }
.mark {
  width: 18px;
  height: 22px;
  border-radius: 3px;
  background: var(--card);
  box-shadow: inset 0 0 0 1.5px var(--accent);
  position: relative;
}
.mark::after {
  content: "";
  position: absolute;
  left: 4px; right: 4px; top: 6px;
  height: 1.5px;
  background: var(--ink);
  box-shadow: 0 4px 0 var(--ink), 0 8px 0 var(--ink);
}
.nav-desktop { display: flex; gap: 16px; margin-right: auto; }
.nav-desktop a, .nav-mobile a { color: var(--ink); text-decoration: none; }
.nav-mobile { display: none; margin-left: auto; }
.top-actions { display: flex; gap: 8px; margin-left: auto; }

main { width: min(1120px, calc(100% - 32px)); margin: 0 auto 48px; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.95fr);
  gap: 36px;
  align-items: center;
  padding: 28px 0 12px;
}
.kicker { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; color: var(--muted); font-weight: 700; }
.lede { font-size: 1.12rem; max-width: 40rem; }
.hero-actions, .form-actions, .workspace-actions, .top-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 18px 0 0; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 750;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-draft { background: #ece7df; color: #5c564e; }
.chip-sent { background: #e4eef6; color: #1d4e72; }
.chip-viewed { background: #f8efd8; color: #8a5a12; }
.chip-overdue { background: #f8e4dc; color: #8d341f; }
.chip-paid { background: #e3f3e8; color: #1d6b45; }

.stage { position: relative; height: 460px; }
.sheet {
  position: absolute;
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.sheet-back { width: 74%; height: 340px; right: 0; top: 46px; transform: rotate(8deg); background: var(--sage); }
.sheet-mid { width: 76%; height: 360px; right: 24px; top: 24px; transform: rotate(-5deg); background: var(--clay); }
.sheet-front {
  width: min(100%, 380px);
  right: 42px;
  top: 0;
  background: #fffdf8;
  border: 1px solid var(--line);
}
.sheet-kicker, .sheet-label { font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.sheet-title { font-family: var(--serif); font-size: 1.4rem; margin: 0 0 10px; }
.sheet-head, .sheet-total { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.sheet-head p, .sheet-to, .sheet-note { margin: 0; color: var(--muted); }
.sheet table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.sheet td { padding: 8px 0; border-top: 1px solid var(--line); }
.sheet td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.sheet-total { border-top: 1px solid var(--ink); padding-top: 10px; }
.sheet-note { margin-top: 12px; font-size: 0.92rem; }

.band, .pricing, .leaving, .editor-section, #workspace { margin-top: 28px; }
.band { display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 16px; }
.panel {
  background: var(--card);
  border-radius: 22px;
  padding: 26px;
  box-shadow: 0 1px 0 rgba(255,255,255,0.7) inset, 0 16px 40px rgba(48, 32, 14, 0.05);
}
.panel-sage { background: var(--sage); }
.panel-clay { background: var(--clay); }
.panel-mist { background: var(--mist); }
.plain { padding-left: 1.1em; }
.plain li { margin: 0.35em 0; }
.fine { color: var(--muted); font-size: 0.92rem; }

.workspace-head, .editor-head, .items-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; }
.tabs { display: flex; gap: 8px; margin: 12px 0; }
.tab, button, .button {
  font: inherit;
  border-radius: 999px;
  border: 1px solid transparent;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  text-decoration: none;
  cursor: pointer;
}
.button.secondary, button.secondary, .tab {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.tab.is-on { background: var(--ink); color: #f7f3eb; border-color: var(--ink); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

label, legend { display: block; font-size: 0.86rem; font-weight: 650; margin-bottom: 10px; }
input, textarea, select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 11px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font: inherit;
}
fieldset { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 0; background: rgba(255,255,255,0.35); }
.grid-2, .grid-3 { display: grid; gap: 12px; margin-bottom: 12px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.item-row { display: grid; grid-template-columns: 1.6fr 0.5fr 0.7fr auto; gap: 8px; margin-bottom: 8px; }
.total-line { font-variant-numeric: tabular-nums; font-size: 1.15rem; }
.banner { background: #f8e4dc; border-radius: 12px; padding: 10px 12px; }
.card-list { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.card-list button.row, .client-row {
  width: 100%;
  text-align: left;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.empty { color: var(--muted); }

.leaving { max-width: 46rem; }
.footer { width: min(1120px, calc(100% - 32px)); margin: 0 auto 32px; color: var(--muted); }

dialog {
  border: 0;
  border-radius: 20px;
  padding: 22px;
  width: min(440px, calc(100% - 24px));
  background: var(--card);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(28, 23, 18, 0.4); }

.system-wrap { width: min(640px, calc(100% - 28px)); margin: 32px auto 64px; }
.system-card { background: var(--card); border-radius: 22px; padding: 26px; margin-top: 18px; }
.system-card .button { display: inline-block; }
.lines { width: 100%; border-collapse: collapse; margin: 12px 0; }
.lines th, .lines td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.lines td:nth-child(n+2), .lines th:nth-child(n+2) { text-align: right; }

@media (max-width: 860px) {
  .hero, .band, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .nav-desktop { display: none; }
  .nav-mobile { display: block; }
  .nav-mobile a { display: block; padding: 8px 0; }
  .top-actions { margin-left: 0; }
  .topbar { flex-wrap: wrap; }
  .stage { height: 420px; }
  .sheet-front { right: 0; width: min(100%, 340px); }
  .sheet-back, .sheet-mid { right: 8px; }
  .item-row { grid-template-columns: 1fr 1fr; }
  .workspace-head, .editor-head { flex-direction: column; align-items: flex-start; }
}
