/* ------------------------------------------------------------------
   Shared theme for the small-business product family.
   Copy this file unchanged into each product; put product-specific
   rules in app.css. Change the look in one place: the tokens below.
   ------------------------------------------------------------------ */

:root {
  /* colour: warm paper, soft ink, one accent per shop */
  --paper: #faf8f4;
  --card: #ffffff;
  --ink: #26241f;
  --muted: #6b665c;
  --line: #e6e1d8;
  --line-strong: #cfc8bb;
  --accent: #2f7a5c;          /* overridden per shop from settings */
  --accent-ink: #ffffff;
  --accent-soft: #e4f1ea;
  --ok: #2f7a5c;
  --warn: #b7791f;
  --warn-soft: #fbf1dc;
  --bad: #b5443a;
  --bad-soft: #f9e5e2;
  --info: #3b6ea5;
  --info-soft: #e5eef8;

  /* type: a humanist sans for reading, a serif for headings */
  --font-body: "Avenir Next", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --font-head: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --size: 17px;

  /* shape */
  --radius: 8px;
  --radius-pill: 999px;
  --tap: 46px;
  --gutter: 16px;
  --shadow: 0 1px 2px rgba(38, 36, 31, 0.06), 0 1px 0 rgba(38, 36, 31, 0.03);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: var(--size); line-height: 1.45;
}
main { max-width: 44rem; margin: 0 auto; padding: 0 var(--gutter) 16px; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; letter-spacing: 0.005em; line-height: 1.2; }
h1 { font-size: 1.75rem; margin: 18px 0 10px; }
h2 { font-size: 1.25rem; margin: 24px 0 8px; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 1.05rem; margin: 18px 0 6px; }
p { margin: 6px 0; }
a { color: var(--accent); }
.meta { color: var(--muted); font-size: 0.88rem; }
.hint { font-style: italic; }
.empty { color: var(--muted); font-style: italic; padding: 10px 2px; }
.hidden { display: none !important; }
.count { background: var(--line); color: var(--ink); font-family: var(--font-body); font-size: 0.78rem; padding: 1px 8px; border-radius: var(--radius-pill); font-weight: 600; }
.flash { background: var(--accent-soft); color: var(--accent); padding: 8px 12px; border-radius: var(--radius); }
.flash.bad { background: var(--bad-soft); color: var(--bad); }
.note { background: var(--warn-soft); padding: 8px 12px; border-radius: var(--radius); }

/* header + bottom tabs */
.top {
  position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center;
  background: var(--card); border-bottom: 1px solid var(--line); padding: 10px var(--gutter);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-family: var(--font-head); font-weight: 600; font-size: 1.15rem; }
.brand img { height: 30px; width: auto; border-radius: 6px; }
.tabs {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 2; display: flex;
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a { flex: 1; text-align: center; padding: 12px 2px; min-height: var(--tap); text-decoration: none; color: var(--muted); font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.tabs a:nth-child(9) ~ a, .tabs a:nth-child(9) { font-size: 0.72rem; }
.tabs:has(a:nth-child(9)) a { font-size: 0.72rem; letter-spacing: -0.01em; }
.tabs a.on { color: var(--accent); box-shadow: inset 0 -3px 0 var(--accent); }
.tabs b { background: var(--bad); color: #fff; border-radius: var(--radius-pill); padding: 0 5px; font-size: 0.7rem; vertical-align: 1px; }
body { padding-bottom: calc(var(--tap) + 24px); }
@media (min-width: 700px) { .tabs a { font-size: 0.95rem; } }

/* buttons */
button, .btn {
  font: inherit; font-weight: 600; min-height: var(--tap); padding: 0 16px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); cursor: pointer;
  white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button:active, .btn:active { transform: translateY(1px); }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.tap { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.danger { color: var(--bad); border-color: var(--bad-soft); background: var(--card); }
.link { border: 0; background: none; color: var(--accent); padding: 0; min-height: 40px; text-decoration: underline; font-weight: 500; }
.big { width: 100%; font-size: 1.1rem; min-height: 54px; }
.pill { border-radius: var(--radius-pill); padding: 0 14px; min-height: 38px; font-size: 0.95rem; }

/* forms */
input, select, textarea {
  font: inherit; width: 100%; min-height: var(--tap); padding: 8px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius); background: var(--card); color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input[type=file] { padding: 10px 0; border: 0; background: none; }
input.big { font-size: 1.1rem; }
label { display: block; margin: 10px 0; font-weight: 600; }
label input, label select { margin-top: 4px; font-weight: 400; }
fieldset { min-inline-size: 0; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); padding: 10px 12px 12px; margin: 0 0 14px; box-shadow: var(--shadow); }
legend { font-weight: 600; padding: 0 6px; font-family: var(--font-head); font-size: 1.05rem; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; gap: 8px; margin-top: 8px; }
.row > * { flex: 1; min-width: 0; }
.row > button { flex: 0 0 auto; }

/* chips (quick picks) */
.chips { display: flex; max-width: 100%; flex-wrap: nowrap; gap: 6px; margin-top: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; min-height: 36px; padding: 4px 12px; border-radius: var(--radius-pill); font-size: 0.9rem; font-weight: 500; background: var(--paper); border-color: var(--line-strong); }
.chip:active, .chip.picked { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
@media (min-width: 700px) { .chips { flex-wrap: wrap; overflow: visible; } }

/* pickers (dropdown results) */
.results { position: relative; }
.picker { list-style: none; margin: 0; padding: 0; position: absolute; left: 0; right: 0; z-index: 3; background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(38, 36, 31, 0.14); overflow: hidden; }
.picker button { width: 100%; text-align: left; justify-content: flex-start; border: 0; border-radius: 0; border-top: 1px solid var(--line); font-weight: 500; }
.picker li:first-child button { border-top: 0; }

/* lists of things to act on */
.list ul { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; display: flex; flex-direction: column; text-decoration: none; color: inherit; }
.list .item { font-weight: 600; }
.list form { margin: 0; }
.list .actions { display: flex; gap: 6px; }
.plain li { padding: 12px; }

/* cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin: 10px 0; box-shadow: var(--shadow); }
.badge { font-size: 0.78rem; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--paper); border: 1px solid var(--line); white-space: nowrap; }

/* summary strip */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 8px 0 4px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 10px; box-shadow: var(--shadow); }
.stat b { display: block; font-family: var(--font-head); font-size: 1.35rem; font-weight: 600; line-height: 1.1; }
.stat span { font-size: 0.75rem; color: var(--muted); }
@media (max-width: 420px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* tables */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 0.95rem; box-shadow: var(--shadow); }
th, td { text-align: left; padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
thead th { border-top: 0; background: var(--paper); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.num { text-align: right; white-space: nowrap; }
tr.warn td:first-child { box-shadow: inset 4px 0 0 var(--warn); }
tr.bad td:first-child { box-shadow: inset 4px 0 0 var(--bad); }
.narrow { display: none; }
@media (max-width: 520px) { .wide { display: none; } .narrow { display: block; } }

/* sign-in page */
.login-body { padding-bottom: 0; }
.login { max-width: 22rem; margin: 12vh auto 0; padding: 0 var(--gutter); text-align: center; }
.login h1 { margin-bottom: 0; }
.login form { text-align: left; margin-top: 20px; }
.login-logo { width: 72px; height: 72px; border-radius: 16px; box-shadow: var(--shadow); }

/* print */
@media print {
  .top, .tabs, .no-print { display: none !important; }
  body { background: #fff; padding: 0; }
  main { max-width: none; padding: 0; }
  .card, table, fieldset { box-shadow: none; }
}
