/* Plant Business Dashboard — v0.5 "LIFE" skin.
   Modern botanical: warm cream paper, deep greenhouse greens, terracotta
   accents, layered cards with soft shadows. System font stack only —
   zero external resources; the app stays fully local/offline.
   Variable names are kept from earlier versions on purpose: feature CSS
   (e.g. the v0.4 photo-identify block) references them. */
:root {
  --bg: #f4eedd;
  --bg2: #efe7d2;
  --panel: #fffdf6;
  --panel2: #f3eedd;
  --line: #ddd2b8;
  --ink: #233626;
  --muted: #6b7a5e;
  --leaf: #2e7d46;
  --leaf-dim: #6da377;
  --amber: #c07f1f;
  --terra: #bc5633;
  --radius: 14px;
  --green-900: #173d27;
  --green-800: #1f4d33;
  --green-700: #2a6242;
  --cream: #f7f1e3;
  --ring: rgba(46, 125, 70, 0.30);
  --shadow-sm: 0 1px 2px rgba(35, 54, 32, 0.05), 0 6px 16px -8px rgba(35, 54, 32, 0.16);
  --shadow-md: 0 1px 2px rgba(35, 54, 32, 0.05), 0 14px 30px -14px rgba(35, 54, 32, 0.25);
  --font: "Avenir Next", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background:
    radial-gradient(1100px 520px at 18% -8%, #fdf6df 0%, rgba(253, 246, 223, 0) 55%),
    radial-gradient(900px 500px at 105% 0%, #e6efdb 0%, rgba(230, 239, 219, 0) 50%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16.5px;
  line-height: 1.5;
}
button, input, select, textarea { font-family: inherit; }
::selection { background: #cfe3bd; }
:focus-visible { outline: 3px solid var(--ring); outline-offset: 2px; }
input[type="checkbox"] { accent-color: var(--green-700); }

h1, h2, h3 { font-family: var(--font); letter-spacing: -0.01em; }
h3 { color: var(--green-800); font-size: 19px; font-weight: 700; margin: 1.3em 0 0.55em; }

/* ---- Header: the shop sign ---- */
.topbar {
  position: sticky; top: 0; z-index: 10; overflow: hidden;
  background:
    radial-gradient(640px 240px at 88% -30%, rgba(143, 206, 110, 0.38) 0%, rgba(143, 206, 110, 0) 60%),
    linear-gradient(118deg, #143325 0%, var(--green-800) 46%, var(--green-700) 78%, #35704b 100%);
  border-bottom: none;
  border-radius: 0 0 22px 22px;
  box-shadow: 0 10px 28px -10px rgba(23, 61, 39, 0.55);
  padding: 16px 18px 15px;
}
.topbar-art {
  position: absolute; top: 0; right: 0; height: 100%;
  width: 300px; max-width: 62%; opacity: 0.15; pointer-events: none;
}
.topbar .brand, .topbar .tabs { position: relative; z-index: 1; }
.brand { display: flex; align-items: center; gap: 13px; }
.leaf {
  flex: none; width: 52px; height: 52px; border-radius: 15px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #fdfaf1 0%, #f1e8d2 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28), inset 0 1px 0 #ffffff;
}
.brand h1 { margin: 0; font-size: 26px; font-weight: 750; color: #fbf7ec; letter-spacing: -0.015em; }
.title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.exp-badge {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 1px;
  color: #8a5f0d; border: 1px solid #d9a441; border-radius: 999px;
  padding: 3px 9px; background: rgba(240, 182, 74, 0.16); white-space: nowrap;
}
.topbar .exp-badge { color: #ffd98a; border-color: rgba(255, 217, 138, 0.7); background: rgba(240, 182, 74, 0.14); }
.owner { color: #cfe0c2; font-size: 14.5px; margin-top: 1px; }

/* ---- Tabs: pill bar (bottom bar on narrow screens) ---- */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tabbtn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 15.5px; font-weight: 600; cursor: pointer;
  border-radius: 999px; padding: 9px 15px;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.06s ease, box-shadow 0.15s ease;
}
.tabbtn svg {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round;
}
.tabbtn:hover { border-color: var(--leaf-dim); }
.tabbtn:active { transform: scale(0.97); }
.tabbtn.active { background: var(--green-700); border-color: var(--green-700); color: #fdfaf0; }
.topbar .tabbtn {
  background: rgba(247, 241, 227, 0.14); color: #f2eedd;
  border: 1px solid rgba(247, 241, 227, 0.30); box-shadow: none;
}
.topbar .tabbtn:hover { background: rgba(247, 241, 227, 0.24); border-color: rgba(247, 241, 227, 0.45); }
.topbar .tabbtn.active {
  background: var(--cream); border-color: var(--cream); color: var(--green-900);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.28);
}

main { max-width: 1100px; margin: 0 auto; padding: 22px 16px 48px; }
.hidden { display: none !important; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
main > section:not(.hidden) { animation: rise 0.18s ease-out; }

/* ---- Stat tiles ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 14px; }
.stat {
  background: linear-gradient(180deg, #fffefa 0%, var(--panel) 100%);
  border: 1px solid var(--line); border-top: 3px solid var(--leaf);
  border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.stat-label { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.09em; }
.stat-big { font-size: 27px; font-weight: 750; letter-spacing: -0.01em; margin-top: 5px; color: var(--green-900); line-height: 1.2; font-variant-numeric: tabular-nums; }

/* ---- Tables ---- */
.tbl {
  width: 100%; border-collapse: collapse;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden; box-shadow: var(--shadow-sm);
}
.tbl th, .tbl td { padding: 11px 12px; text-align: left; border-bottom: 1px solid #eae1c8; vertical-align: top; }
.tbl th {
  background: var(--panel2); color: var(--green-800);
  font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: #fbf7ea; }
.tbl tr.tot td { font-weight: 700; color: var(--green-900); background: #e9f1e0; }
.tbl select {
  font-size: 14px; padding: 5px 8px; border-radius: 9px;
  border: 1px solid var(--line); background: #fffefa; color: var(--ink);
}
.sub { color: var(--muted); font-size: 13.5px; }
.thumb {
  width: 56px; height: 56px; object-fit: cover; border-radius: 12px;
  float: left; margin-right: 12px;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm); background: var(--panel2);
}

/* ---- Forms ---- */
.form-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 13px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 20px; box-shadow: var(--shadow-sm);
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field span { color: #5d7050; font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.field input, .field select {
  background: #fffefa; color: var(--ink);
  border: 1px solid #d5c9a8; border-radius: 11px;
  padding: 10px 12px; font-size: 16px; width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus {
  border-color: var(--leaf); box-shadow: 0 0 0 3px var(--ring); outline: none;
}
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; grid-column: 1 / -1; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  background: #fffefa; color: var(--green-900);
  border: 1px solid #b9c9a6; border-radius: 12px;
  padding: 10px 18px; font-size: 15.5px; font-weight: 650; cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.06s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn:hover { border-color: var(--leaf); transform: translateY(-1px); }
.btn:active { transform: scale(0.98); }
.btn.primary {
  background: linear-gradient(180deg, #35804f 0%, #27663f 100%);
  color: #fdfaf0; border-color: #27663f;
  box-shadow: 0 8px 18px -8px rgba(31, 77, 51, 0.6);
}
.btn.primary:hover { filter: brightness(1.08); border-color: #27663f; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); box-shadow: none; }
.btn.ghost:hover { color: var(--ink); border-color: var(--leaf-dim); }
.btn.danger { background: transparent; border-color: #d8a48f; color: var(--terra); box-shadow: none; }
.btn.danger:hover { background: rgba(188, 86, 51, 0.07); border-color: var(--terra); }
.btn.small { padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn.big { font-size: 20px; padding: 15px 20px; width: 100%; border-radius: 14px; }
.rowbtns { white-space: nowrap; }
.rowbtns .btn { margin-right: 6px; }

/* ---- Panels, hints, empty states ---- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 18px; padding: 20px; margin-top: 18px; box-shadow: var(--shadow-sm);
}
.panel > h3:first-child { margin-top: 0; }
.panel ul { margin: 6px 0; padding-left: 20px; }
.panel li { margin: 5px 0; }
.hint { color: var(--muted); font-size: 14px; }
.filebtn { display: inline-block; cursor: pointer; }

.empty {
  text-align: center; padding: 44px 22px; margin-top: 16px;
  background: linear-gradient(180deg, #fffefa 0%, var(--panel) 100%);
  border: 1.5px dashed #b7cfa4; border-radius: 20px; box-shadow: var(--shadow-sm);
}
.empty-plant {
  display: block; width: 78px; height: 78px; line-height: 78px;
  margin: 0 auto; font-size: 38px; text-align: center;
  background: #e9f1e0; border-radius: 50%;
  box-shadow: inset 0 0 0 1px #cfe0bd;
}
.empty h3 { color: var(--green-800); font-size: 20px; margin: 14px 0 6px; }
.empty p { color: var(--muted); max-width: 560px; margin: 0 auto; }

/* ---- Deals ---- */
.deal {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px 18px; margin-bottom: 12px; box-shadow: var(--shadow-sm);
}
.deal-main { flex: 1; }
.deal-check { display: inline-flex; align-items: center; gap: 8px; color: var(--green-800); font-weight: 650; white-space: nowrap; cursor: pointer; }
.deal-check input[type="checkbox"] { width: 20px; height: 20px; cursor: pointer; }
.deal.done { opacity: 0.68; }
.deal.done .deal-check { color: var(--leaf); cursor: default; }

/* ---- Show Mode: the dark board — high contrast under show lights ---- */
#view-show {
  background:
    radial-gradient(900px 420px at 15% -10%, #2c5c3c 0%, rgba(44, 92, 60, 0) 55%),
    linear-gradient(160deg, #1d4730 0%, #122b1d 72%);
  border-radius: 22px; padding: 22px;
  box-shadow: 0 20px 42px -18px rgba(18, 43, 29, 0.65);
  color: #f5efdc;
}
#view-show h3 { color: #fdf8ea; }
#view-show .hint, #view-show .sub { color: #bcd6b2; }
#view-show .empty { box-shadow: none; }
.show-head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: baseline; margin-bottom: 18px; }
.show-biz { font-size: 36px; font-weight: 800; letter-spacing: -0.01em; color: #fdf8ea; }
.show-total { font-size: 21px; font-weight: 650; color: #ffcf87; }
.show-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.show-card {
  background: linear-gradient(180deg, #245239 0%, #1a3d29 100%);
  border: 2px solid #5ea874; border-radius: 20px; padding: 20px; text-align: center;
  box-shadow: 0 14px 28px -12px rgba(0, 0, 0, 0.55);
}
.show-photo { width: 100%; height: 180px; object-fit: cover; border-radius: 12px; margin-bottom: 12px; border: 1px solid rgba(247, 241, 227, 0.25); }
.show-name { font-size: 30px; font-weight: 750; line-height: 1.15; color: #fdf8ea; }
.show-var { color: #bcd6b2; font-size: 18.5px; font-style: italic; }
.show-price { font-size: 46px; font-weight: 800; color: #ffb84d; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.show-qty { color: #bcd6b2; margin-bottom: 14px; }
#view-show .btn.primary.big {
  background: linear-gradient(180deg, #79c48c 0%, #57a773 100%);
  color: #0e2a1a; border-color: #8fce6e; font-weight: 800;
  box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.6);
}

/* ---- Knowledge tab ---- */
.subnav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.small-chip { padding: 6px 13px; font-size: 14px; }
.care-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 12px; }
.care-card { border-top: 3px solid var(--leaf); }
.care-field { background: var(--panel2); border: 1px solid #e6dcc0; border-radius: 13px; padding: 12px 14px; }
.care-label { color: var(--green-700); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 4px; }
.conflict { display: inline-block; background: rgba(188, 86, 51, 0.12); color: var(--terra); border: 1px solid #d8a48f; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 600; }
.safety-note { margin-top: 12px; background: rgba(188, 86, 51, 0.10); border: 1px solid #d8a48f; border-radius: 13px; padding: 12px 14px; }
.safety-card { border-color: #d8a48f; }
.month-now { border: 2px solid var(--leaf); background: linear-gradient(180deg, #f4f9ec 0%, var(--panel) 100%); }
.ship-banner { background: rgba(217, 154, 43, 0.14); border: 1px solid #d9a441; color: #7c5410; font-weight: 600; border-radius: 12px; padding: 11px 13px; margin: 10px 0; }
.protect-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid #eae1c8; }
.band ul, .lore-band ul { margin: 6px 0; padding-left: 20px; }
.lore-band { border-style: dashed; border-color: #d9a441; background: #fdf6e3; }
.lore-item { margin-top: 10px; }
.lore-item p { margin: 4px 0 0; color: var(--muted); }
.lore-label { display: inline-block; background: rgba(217, 154, 43, 0.16); color: #8a5f0d; border: 1px solid #d9a441; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 600; margin-right: 8px; }
.tbl tr.month-cur td { background: #e9f1e0; }
.sell-sheet { text-align: center; border: 2px solid var(--leaf); }
.sell-price { font-size: 42px; font-weight: 800; color: var(--green-900); font-variant-numeric: tabular-nums; }
.cluster-hit { color: var(--leaf); font-weight: 650; margin-top: 4px; }

/* ---- Photo identify (v0.4, EXPERIMENTAL) — restyled to the v0.5 skin ---- */
.idbox {
  grid-column: 1 / -1;
  background: linear-gradient(180deg, #f8f3df 0%, var(--bg2) 100%);
  border: 1.5px dashed #9dbb8d; border-radius: 14px; padding: 14px 16px;
}
.idhead { display: flex; align-items: center; gap: 10px; color: var(--green-800); font-weight: 700; font-size: 16.5px; }
.idpreview { display: block; max-width: 220px; max-height: 220px; object-fit: cover; border-radius: 12px; margin: 10px 0 2px; border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.idcand {
  display: flex; align-items: center; gap: 12px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 13px; padding: 11px 13px; margin-top: 9px; box-shadow: var(--shadow-sm);
}
.idcand-main { flex: 1; }
.idscore {
  color: #8a5f0d; font-weight: 700; white-space: nowrap; font-size: 13.5px;
  background: rgba(217, 154, 43, 0.16); border-radius: 999px; padding: 3px 9px;
}
.askprompt {
  width: 100%; font-size: 14px; line-height: 1.45;
  padding: 10px 12px; border-radius: 11px;
  border: 1px solid #d5c9a8; background: #fffefa; color: var(--ink);
}

.foot { text-align: center; color: var(--muted); font-size: 14px; padding: 20px; }
.version-label { display: block; margin-top: 4px; font-size: 12px; opacity: .7; }

/* ---- Narrow screens: bottom tab bar ---- */
@media (max-width: 760px) {
  .topbar { padding: 14px 14px 13px; border-radius: 0 0 18px 18px; }
  .brand h1 { font-size: 21px; }
  .leaf { width: 44px; height: 44px; border-radius: 12px; }
  .leaf svg { width: 25px; height: 25px; }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    margin: 0; padding: 8px 10px calc(8px + env(safe-area-inset-bottom, 0px));
    background: rgba(20, 46, 30, 0.97);
    box-shadow: 0 -8px 26px rgba(18, 43, 29, 0.4);
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs .tabbtn { flex-direction: column; gap: 3px; font-size: 11.5px; padding: 6px 11px; flex: 0 0 auto; }
  body { padding-bottom: 72px; }
  main { padding: 18px 12px 34px; }
  .tbl { display: block; overflow-x: auto; }
  .tbl th, .tbl td { padding: 8px; font-size: 15px; }
  .stat-big { font-size: 24px; }
  #view-show { padding: 16px; border-radius: 18px; }
  .show-biz { font-size: 28px; }
  .show-name { font-size: 26px; }
  .show-price { font-size: 38px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- v0.6 "Paper": posture line, Show Mode prep list, print ---- */

/* The one-line posture statement in Settings → About. */
.posture {
  background: var(--panel2); border: 1px solid var(--line);
  border-left: 4px solid var(--leaf); border-radius: 10px;
  padding: 10px 14px; margin: 12px 0;
}

/* Show Mode pre-show checklist — sits on the dark board, so it is
   styled for the board (large tick targets for show conditions). */
.show-prep {
  border: 2px solid rgba(247, 241, 227, 0.35); border-radius: 16px;
  padding: 14px 18px 10px; margin-bottom: 18px;
  background: rgba(247, 241, 227, 0.06);
}
.show-prep h3 { margin: 0 0 4px; font-size: 20px; }
.show-prep-note { color: #bcd6b2; font-size: 14.5px; margin: 0 0 8px; }
.prep-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 9px 4px; font-size: 17px; line-height: 1.4; cursor: pointer;
  border-top: 1px solid rgba(247, 241, 227, 0.14);
}
.prep-item input[type="checkbox"] {
  width: 26px; height: 26px; flex: 0 0 auto; margin-top: 1px;
  accent-color: #79c48c;
}
.prep-item input[type="checkbox"]:checked + span { color: #bcd6b2; text-decoration: line-through; }

/* Print staging: invisible on screen, the ONLY thing on paper. */
#printArea { display: none; }

@page { margin: 12mm; }

@media print {
  .topbar, main, .foot { display: none !important; }
  body { background: #fff !important; }
  #printArea {
    display: block; color: #111;
    font-family: var(--font);
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }

  /* Pot label — sized for small label stock, sits cleanly on letter
     paper too. The dashed edge is the cut guide. */
  .pot-label {
    width: 3.4in; max-width: 100%;
    border: 1.5pt dashed #8a8a8a; border-radius: 6pt;
    padding: 10pt 12pt; text-align: center;
    page-break-inside: avoid;
  }
  .pot-biz { font-size: 8.5pt; letter-spacing: 0.14em; text-transform: uppercase; color: #444; margin-bottom: 3pt; }
  .pot-name { font-size: 21pt; font-weight: 800; line-height: 1.15; }
  .pot-var { font-size: 11.5pt; font-style: italic; color: #333; }
  .pot-size { font-size: 9.5pt; color: #444; margin-top: 2pt; }
  .pot-price { font-size: 23pt; font-weight: 800; margin: 4pt 0 2pt; }
  .pot-care { font-size: 8.5pt; color: #333; line-height: 1.35; }

  /* Customer care card — a bag-stuffer card (~5in wide on letter,
     full-width on 4×6 card stock). */
  .care-card-print {
    width: 5in; max-width: 100%;
    border: 1.2pt solid #9a9a9a; border-radius: 8pt;
    padding: 14pt 16pt;
    page-break-inside: avoid;
  }
  .ccp-from { font-size: 9pt; letter-spacing: 0.12em; text-transform: uppercase; color: #444; }
  .ccp-name { font-size: 19pt; font-weight: 800; line-height: 1.2; margin-top: 2pt; }
  .ccp-botanical { font-size: 11pt; font-style: italic; color: #333; margin-bottom: 6pt; }
  .ccp-row { display: flex; gap: 10pt; padding: 5pt 0; border-top: 0.6pt solid #ccc; }
  .ccp-label { flex: 0 0 0.85in; font-size: 8.5pt; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: #444; padding-top: 2pt; }
  .ccp-body { font-size: 11pt; line-height: 1.4; }
  .ccp-safety { margin-top: 8pt; font-size: 10pt; border: 0.8pt solid #999; border-radius: 5pt; padding: 6pt 8pt; }
  .ccp-foot { margin-top: 10pt; font-size: 10.5pt; color: #333; }
}
