:root {
  --ink: #333333;
  --muted: #77736f;
  --paper: #f7f3ef;
  --surface: #fffdfa;
  --line: #eaded5;
  --orange: #d26c2e;
  --orange-dark: #b95822;
  --orange-soft: #fae2d3;
  --danger: #e64219;
  --shadow: 0 24px 70px rgba(69, 49, 37, .13);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 12% 5%, #fff 0, transparent 34%), radial-gradient(circle at 90% 16%, #fae9dc 0, transparent 28%), var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.grain { position: fixed; inset: 0; pointer-events: none; opacity: .22; background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitchTiles'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.06'/%3E%3C/svg%3E"); }
main { position: relative; z-index: 1; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(560px, 100%); padding: 46px; border: 1px solid var(--line); background: rgba(255,253,250,.95); box-shadow: var(--shadow); border-radius: 4px; }
.login-logo { display: block; width: min(300px, 85%); height: auto; margin: -35px 0 -18px; }
.eyebrow { margin: 0 0 8px; color: var(--orange); font-size: 11px; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 9px; font-size: clamp(30px, 5vw, 46px); line-height: 1; letter-spacing: -.055em; }
h1 span { color: var(--orange); }
h2 { margin: 0; font-size: clamp(24px, 4vw, 34px); letter-spacing: -.04em; }
.muted { color: var(--muted); line-height: 1.55; }
label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 800; }
input { width: 100%; min-height: 50px; border: 1px solid var(--line); border-radius: 2px; outline: none; background: #fff; color: var(--ink); padding: 13px 15px; }
input:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(210,108,46,.14); }
button { min-height: 46px; border: 0; border-radius: 2px; padding: 12px 20px; background: var(--ink); color: #fff; font-weight: 850; }
.login-row, .add-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.login-card form { margin-top: 28px; }
.error { min-height: 20px; margin: 10px 0 0; color: var(--danger); font-size: 13px; }
.app-shell { width: min(1020px, calc(100% - 40px)); margin: 0 auto; padding: 30px 0 22px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.brand { display: flex; align-items: center; gap: 16px; }
.brand img { width: 62px; height: 62px; object-fit: contain; }
.brand h1 { margin: 0; font-size: clamp(26px, 4vw, 38px); }
.ghost { border: 1px solid var(--line); background: rgba(255,253,250,.72); color: var(--ink); }
.add-card, .list-card { border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.add-card { padding: 28px; border-top: 5px solid var(--orange); }
.add-card > label { font-size: 18px; }
.primary { min-width: 145px; background: var(--orange); transition: transform .15s, background .15s; }
.primary:hover { background: var(--orange-dark); transform: translateY(-1px); }
.primary:disabled { opacity: .55; cursor: wait; transform: none; }
.form-message { min-height: 20px; margin: 10px 0 0; color: var(--orange); font-size: 13px; }
.form-message.error { color: var(--danger); }
.list-card { margin-top: 22px; overflow: hidden; }
.list-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; padding: 28px; border-bottom: 1px solid var(--line); }
.count { display: inline-grid; place-items: center; min-width: 34px; height: 27px; margin-left: 7px; padding: 0 8px; border-radius: 20px; background: var(--orange-soft); color: var(--orange); font-size: 13px; vertical-align: 4px; }
.cutoff { margin: 0; color: var(--muted); font-size: 13px; text-align: right; }
.items-list { margin: 0; padding: 5px 28px 28px; list-style: none; counter-reset: purchase; }
.item { counter-increment: purchase; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 12px; min-height: 64px; border-bottom: 1px solid #e4e4da; }
.item::before { content: counter(purchase); display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; background: var(--orange-soft); color: var(--orange-dark); font-size: 12px; font-weight: 850; }
.item-text { padding: 13px 0; font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
.delete { width: 36px; min-height: 36px; padding: 0; border: 1px solid transparent; background: transparent; color: #8b918b; font-size: 22px; }
.delete:hover { border-color: #efb99e; background: #fff4ed; color: var(--danger); }
.empty { padding: 60px 10px 34px; color: var(--muted); text-align: center; }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 18px 2px 0; color: var(--muted); font-size: 11px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 5; max-width: 360px; padding: 14px 18px; border-left: 4px solid #f29a5c; background: var(--ink); color: #fff; box-shadow: var(--shadow); transform: translateY(120px); opacity: 0; transition: .25s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.bad { border-left-color: #ff715f; }
@media (max-width: 700px) {
  .app-shell { width: min(100% - 24px, 1020px); padding-top: 18px; }
  .brand img { width: 50px; height: 50px; }
  .list-head { align-items: flex-start; flex-direction: column; }
  .cutoff { text-align: left; }
  footer { flex-direction: column; }
}
@media (max-width: 520px) {
  .login-card { padding: 32px 22px; }
  .login-logo { margin: -24px 0 -10px; }
  .login-row, .add-row { grid-template-columns: 1fr; }
  .primary { width: 100%; }
  .add-card, .list-head { padding: 22px; }
  .items-list { padding: 4px 20px 22px; }
  header .ghost { min-height: 40px; padding: 8px 12px; }
}

