:root {
  --ink: #241c16;
  --muted: #5e534a;
  --paper: #fbf7f0;
  --desk: #e6dccb;
  --line: #e4d3c0;
  --teal: #14685c;
  --amber: #f0b45a;
  --chestnut: #8c4a2f;
  --hole: #d9cdb8;
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.45), transparent 28%),
    linear-gradient(180deg, #efe4d2 0%, var(--desk) 40%, #ddd0bc 100%);
  font-family: "Avenir Next", "Segoe UI", "Trebuchet MS", sans-serif;
  font-size: 1.05rem;
  line-height: 1.4;
}

button, input, select { font: inherit; color: inherit; }

.app {
  width: min(100%, 34rem);
  margin: 0 auto;
  padding: 1rem 1rem 2.5rem;
}

.top, .brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand-row { justify-content: flex-start; }

h1, h2, p { margin: 0; }

h1 { font-size: 1.7rem; letter-spacing: -0.03em; }

h2 { font-size: 1.25rem; }

.brand {
  color: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.mark { width: 2.6rem; height: 2.6rem; flex: none; }

.lede, .note, .kind, .line-label, .foot { color: var(--muted); }

.lede { margin: 0.35rem 0 1rem; }

.sheet {
  background: var(--paper);
  border: 1px solid #efe6da;
  border-radius: 1.1rem 0.7rem 0.9rem 1rem;
  box-shadow: 0 10px 24px rgba(60, 36, 18, 0.08);
  padding: 1rem 1rem 1rem 1.7rem;
  background-image:
    radial-gradient(circle at 0.55rem 1.3rem, var(--hole) 0 0.28rem, transparent 0.32rem),
    radial-gradient(circle at 0.55rem 50%, var(--hole) 0 0.28rem, transparent 0.32rem),
    radial-gradient(circle at 0.55rem calc(100% - 1.3rem), var(--hole) 0 0.28rem, transparent 0.32rem);
}

.binder-list, .form, .settings, .binder-sheet { margin-top: 0.8rem; }

.binder-card {
  display: block;
  color: inherit;
  text-decoration: none;
  margin-bottom: 0.7rem;
}

.binder-card h2 { margin-top: 0.15rem; }

.kind {
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tally-row {
  display: flex;
  gap: 0.8rem;
  margin-top: 0.7rem;
  font-size: 0.95rem;
}

.tally-row b {
  display: block;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

label, .file { display: grid; gap: 0.25rem; margin: 0.55rem 0; }

label.check {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin: 0.8rem 0;
}

label.check input {
  width: 1.35rem;
  min-height: 1.35rem;
  margin-top: 0.15rem;
  flex: none;
}

.settings p { margin-top: 0.7rem; }

.add-line {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.6rem;
  margin-top: 0.8rem;
  position: sticky;
  top: 0.4rem;
  z-index: 2;
  background: var(--paper);
  padding-bottom: 0.6rem;
}

.add-line button,
.add-line h2,
.add-line .usage,
.add-line .alert,
.add-line .refund { grid-column: 1 / -1; }

.add-line .alert,
.add-line .refund {
  margin: 0;
  padding: 0.35rem 0.6rem;
  font-size: 0.92rem;
}

.search { margin-top: 0.2rem; }

input, select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid #ddcbb6;
  border-radius: 0.7rem;
  background: #fffdf9;
}

button {
  min-height: 2.75rem;
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  background: var(--teal);
  color: white;
  cursor: pointer;
}

button:disabled { opacity: 0.45; cursor: not-allowed; }

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

.text-link, .foot a, summary.as-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.text-link { color: var(--teal); font-weight: 700; padding: 0 0.35rem; }

.top { flex-wrap: wrap; }

summary.as-button {
  border: 1px solid #ddcbb6;
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  background: transparent;
  color: var(--ink);
}

.line-more { margin-top: 0.35rem; }

.usage { margin-top: 0.45rem; font-weight: 700; }

.filters, .stamps, .stepper, .confirm { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.filters { margin: 0.8rem 0; }

.filters button, .stamps button, .quiet, .stepper button {
  background: transparent;
  color: var(--ink);
  border: 1px solid #ddcbb6;
}

.filters button[aria-pressed="true"], .stamps button[aria-pressed="true"] {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
}

.stamps button[data-status="dupe"][aria-pressed="true"] {
  background: var(--amber);
  color: var(--ink);
  border-color: var(--amber);
}

.lines { list-style: none; padding: 0; margin: 0.4rem 0 0; }

.line {
  padding: 0.85rem 0;
  border-top: 1px dashed var(--line);
}

.line-name { font-weight: 700; }

.line-label { font-size: 0.92rem; }

.stamps { margin-top: 0.55rem; }

.extra-count, .stepper { margin: 0.45rem 0 0; }

.quiet { margin-top: 0.45rem; }

.empty { margin: 0.2rem 0 0.8rem; }

.alert {
  background: #fff4e4;
  border: 1px solid var(--amber);
  border-radius: 0.8rem;
  padding: 0.7rem 0.8rem;
  margin: 0.6rem 0;
}

.foot { margin-top: 1.2rem; font-size: 0.85rem; }

.foot a { color: var(--teal); font-weight: 700; padding-right: 0.35rem; }

a.buy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  margin: 0.4rem 0;
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  background: var(--teal);
  color: white;
  font-weight: 700;
  text-decoration: none;
}

.unlock-code {
  margin-top: 0.8rem;
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
  font-size: 1.25rem;
  letter-spacing: 0.04em;
  background: #fffdf9;
  border: 1px dashed var(--line);
  border-radius: 0.7rem;
  padding: 0.8rem;
  user-select: all;
}

.add-line, .rename form, .form { display: grid; }

summary { cursor: pointer; min-height: 2.75rem; display: flex; align-items: center; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 640px) {
  .app { padding-inline: 0.75rem; }
  .stamps button, .filters button { flex: 1; }
}
