/* PriceMyBake: a kitchen ledger. Warm paper, cocoa ink, and a till receipt for the numbers. */
:root {
  --paper: #f5ecdd;
  --card: #fffaf1;
  --ink: #2a1a12;
  --cocoa: #6f5445;
  --rule: #d8c8b1;
  --jam: #b0273f;
  --jam-dark: #8c1b30;
  --butter: #f2c14e;
  --pistachio: #3d6b3a;
  --serif: 'Young Serif', Georgia, 'Times New Roman', serif;
  --sans: 'Instrument Sans', 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'DM Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.5 var(--sans);
  /* faint flour-dust grain so the page reads as paper, not a flat fill */
  background-image: radial-gradient(rgba(111, 84, 69, .07) 1px, transparent 1px);
  background-size: 14px 14px;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 400; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 2rem; line-height: 1.15; }
h2 { font-size: 1.2rem; margin: 28px 0 10px; }
h3 { font-size: 1.05rem; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.muted { color: var(--cocoa); }
.mono { font-family: var(--mono); font-size: .9rem; }
i { font-style: normal; color: var(--cocoa); }

.abrindo { padding: 40vh 24px 0; text-align: center; font-family: var(--serif); font-size: 1.2rem; color: var(--cocoa); }

/* ---- shell ---- */
.top { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 2px solid var(--ink); background: var(--paper); position: sticky; top: 0; z-index: 5; }
.brand { font-family: var(--serif); font-size: 1.25rem; display: flex; align-items: center; gap: 10px; }
.brand.large { font-size: 1.6rem; }
.brand-mark { width: 22px; height: 22px; border-radius: 50%; background: var(--jam); box-shadow: inset 0 0 0 5px var(--paper), 0 0 0 2px var(--ink); }
.sync { width: 10px; height: 10px; border-radius: 50%; background: var(--pistachio); }
.sync.saving { background: var(--butter); }
.sync.off { background: var(--cocoa); }
.demo { background: var(--butter); padding: 8px 20px; font-size: .9rem; border-bottom: 2px solid var(--ink); }
main { max-width: 1040px; margin: 0 auto; padding: 22px 20px 110px; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--ink); padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
.tabs button { background: none; border: 0; color: #cdb9a4; padding: 15px 4px 13px; font-weight: 600; font-size: .92rem; border-top: 4px solid transparent; }
.tabs button.on { color: var(--paper); border-top-color: var(--butter); }
@media (min-width: 900px) {
  .tabs { position: static; max-width: 1040px; margin: 0 auto; background: none; grid-template-columns: repeat(4, auto); justify-content: start; gap: 6px; padding: 0 20px; order: -1; }
  .tabs button { color: var(--cocoa); border-top: 0; border-bottom: 3px solid transparent; padding: 14px 14px 10px; }
  .tabs button.on { color: var(--ink); border-bottom-color: var(--jam); }
  #app { display: flex; flex-direction: column; }
  .top { order: -3; } .demo { order: -2; }
  main { width: 100%; padding-bottom: 60px; }
}

/* ---- common pieces ---- */
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.btn { background: var(--ink); color: var(--paper); border: 2px solid var(--ink); border-radius: 3px; padding: 11px 18px; font-weight: 600; box-shadow: 3px 3px 0 var(--butter); transition: transform .08s, box-shadow .08s; }
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--butter); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--butter); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: none; }
.btn.ghost:hover { background: var(--card); }
.btn.danger { background: transparent; color: var(--jam-dark); border-color: transparent; box-shadow: none; text-decoration: underline; padding-inline: 6px; }
.btn.wide { width: 100%; }
#lines + .btn, #packs + .btn, #items + .btn { margin-bottom: 20px; }
.link { background: none; border: 0; padding: 0; color: var(--jam-dark); text-decoration: underline; font-weight: 600; }
.link.back { text-decoration: none; margin-bottom: 14px; display: inline-block; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; align-items: center; }
.empty { border: 2px dashed var(--rule); padding: 28px 22px; border-radius: 4px; color: var(--cocoa); max-width: 520px; }
.note { background: #fbe9b6; border-left: 4px solid var(--butter); padding: 10px 14px; font-size: .92rem; margin: 0 0 16px; }
.warn { background: #f8dcdf; border-left: 4px solid var(--jam); padding: 9px 12px; font-size: .9rem; margin: 0 0 10px; }
.tag { font-style: normal; font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; background: var(--butter); padding: 2px 6px; border-radius: 2px; vertical-align: middle; font-family: var(--sans); font-weight: 600; }
.chip { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; border: 1.5px solid var(--ink); padding: 2px 7px; border-radius: 99px; }
.grow { flex: 1; min-width: 0; }

.field { display: block; margin-bottom: 14px; min-width: 0; }
.field > span { display: block; font-size: .82rem; font-weight: 600; color: var(--cocoa); margin-bottom: 4px; }
.field small { display: block; font-size: .8rem; color: var(--cocoa); margin-top: 4px; }
input, select, textarea { width: 100%; background: var(--card); border: 1.5px solid var(--ink); border-radius: 3px; padding: 10px 11px; min-height: 44px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 3px solid var(--butter); outline-offset: 1px; }
input[type=range] { padding: 0; border: 0; background: none; accent-color: var(--jam); min-height: 34px; }
.field.big input { font-family: var(--serif); font-size: 1.5rem; border-width: 0 0 2px; border-radius: 0; background: transparent; padding-left: 0; }
.row { display: flex; gap: 12px; }
.row > .field { flex: 1; }
.row > .field.grow { flex: 2; }

/* ---- lists and cards ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { text-align: left; background: var(--card); border: 2px solid var(--ink); border-radius: 4px; padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 6px; box-shadow: 4px 4px 0 var(--rule); transition: transform .1s, box-shadow .1s; }
.card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--jam); }
.card-title { font-family: var(--serif); font-size: 1.15rem; line-height: 1.25; }
.card-sub { color: var(--cocoa); font-size: .9rem; }
.card-nums { display: flex; justify-content: space-between; font-family: var(--mono); font-size: .92rem; border-top: 1.5px dashed var(--rule); padding-top: 9px; margin-top: 6px; }
.card-nums .strong { font-weight: 500; color: var(--jam-dark); }
.list { border-top: 2px solid var(--ink); }
.list.faded { opacity: .6; }
.rowitem { width: 100%; text-align: left; background: none; border: 0; border-bottom: 1.5px dashed var(--rule); padding: 13px 4px; display: flex; gap: 12px; align-items: center; }
.rowitem:hover { background: var(--card); }
.rowitem small { display: block; color: var(--cocoa); font-size: .84rem; }
.rowitem .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.order.s-ready .chip, .order.s-confirmed .chip { background: var(--butter); }
.order.s-baking .chip { background: var(--jam); color: #fff; border-color: var(--jam); }

/* ---- editor ---- */
.editor { display: grid; gap: 26px; }
@media (min-width: 900px) { .editor { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; } .receipt { position: sticky; top: 84px; } }
.form.narrow { max-width: 560px; }
.line { display: grid; grid-template-columns: minmax(0, 1fr) 74px 88px 34px; gap: 6px; margin-bottom: 8px; }
.line.pack { grid-template-columns: minmax(0, 1fr) 92px 62px 34px; }
.line.orderline { grid-template-columns: minmax(0, 1fr) 62px 92px 34px; }
.line.orderline select:has(+ input:not([hidden])) { grid-column: 1 / -1; }
.x { background: none; border: 0; font-size: 1.4rem; line-height: 1; color: var(--cocoa); border-radius: 3px; }
.x:hover { color: var(--jam); background: var(--card); }

/* ---- the receipt ---- */
.receipt { background: #fffdf8; border: 2px solid var(--ink); padding: 20px 18px 26px; font-family: var(--mono); font-size: .9rem; position: relative; box-shadow: 6px 6px 0 var(--rule); }
/* torn bottom edge, like a slip pulled from the till */
.receipt::after { content: ''; position: absolute; left: -2px; right: -2px; bottom: -12px; height: 12px; background: linear-gradient(135deg, #fffdf8 6px, transparent 0) 0 0 / 12px 12px repeat-x, linear-gradient(-135deg, #fffdf8 6px, transparent 0) 0 0 / 12px 12px repeat-x; filter: drop-shadow(0 2px 0 var(--ink)); }
.receipt h3 { font-family: var(--serif); font-size: 1.15rem; text-align: center; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1.5px dashed var(--ink); }
.r { display: flex; align-items: baseline; gap: 6px; padding: 3px 0; }
.r .dots { flex: 1; border-bottom: 1.5px dotted var(--rule); transform: translateY(-3px); min-width: 12px; }
.r b { font-weight: 500; white-space: nowrap; }
.r.small { font-size: .82rem; color: var(--cocoa); }
.r.sum { margin-top: 8px; padding-top: 8px; border-top: 1.5px dashed var(--rule); }
.r.total { margin-top: 8px; padding-top: 9px; border-top: 2px solid var(--ink); font-size: 1rem; }
.r.gain b { color: var(--pistachio); }
.price { margin: 16px -18px; padding: 14px 18px; background: var(--ink); color: var(--paper); display: flex; justify-content: space-between; align-items: baseline; }
.price span { font-family: var(--sans); font-weight: 600; font-size: .9rem; }
.price strong { font-family: var(--serif); font-weight: 400; font-size: 2.1rem; color: var(--butter); line-height: 1; }
.hourly { font-family: var(--sans); margin: 14px 0 0; font-size: .92rem; }
.verdict { font-family: var(--sans); font-weight: 600; margin: 14px 0 0; padding: 11px 12px; border: 2px solid var(--ink); font-size: .95rem; }
.verdict.bad { background: var(--jam); color: #fff; border-color: var(--jam-dark); }
.verdict.thin { background: #fbe9b6; }
.verdict.good { background: #dcead6; }

/* ---- sheet and sign in ---- */
.veil { position: fixed; inset: 0; background: rgba(42, 26, 18, .55); z-index: 20; }
.panel { position: fixed; z-index: 21; left: 50%; bottom: 0; transform: translateX(-50%); width: min(540px, 100%); background: var(--paper); border: 2px solid var(--ink); border-bottom: 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); max-height: 92vh; overflow: auto; animation: rise .18s ease-out; }
.panel h2 { margin-top: 0; }
@keyframes rise { from { transform: translate(-50%, 30px); opacity: 0; } }
@media (min-width: 700px) { .panel { bottom: auto; top: 50%; transform: translate(-50%, -50%); border-bottom: 2px solid var(--ink); box-shadow: 8px 8px 0 var(--jam); animation: none; } }
.panel.flat { position: static; transform: none; width: 100%; border: 2px solid var(--ink); background: var(--card); box-shadow: 6px 6px 0 var(--butter); animation: none; margin: 22px 0 18px; }
.panel.flat .link { display: block; margin-top: 14px; }
.login { max-width: 440px; margin: 0 auto; padding: 9vh 22px 40px; }
.login h1 { margin-top: 26px; font-size: 2.3rem; }

#toast { position: fixed; left: 50%; bottom: 84px; transform: translate(-50%, 20px); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 3px; opacity: 0; pointer-events: none; transition: .2s; z-index: 40; font-size: .92rem; max-width: 90vw; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
