/* Gribot kit: the look every Gribot Mini App shares (ECOSYSTEM.md 4.7). Tokens from the warehouse app, the darker
   logistics green as the accent: it holds its contrast in sunlight. One phone column: header, screen, one main button
   above the tab bar. No inline styles anywhere: pages run under a CSP without 'unsafe-inline'. */
:root {
  --bg: #f3f4f1; --card: #ffffff; --fill: #eef1ed; --fg: #18201a; --muted: #5f6a63; --line: #e3e7e2;
  --accent: #237a42; --accent-soft: #e1f2e6; --accent-text: #1d6b39; --on-accent: #ffffff;
  --bad: #cf4037; --bad-soft: #fce9e7; --bad-text: #b3322a;
  --warn-soft: #fcefd6; --warn-text: #8f5600;
  --skip: #5b6672; --skip-soft: #ebeef1;
  --shadow: 0 1px 2px rgb(16 24 18 / .05); --r-card: 16px; --r-ctl: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #121713; --card: #1b221d; --fill: #242c26; --fg: #e9eeea; --muted: #95a199; --line: #2b342d;
  --accent: #4fbb75; --accent-soft: #1f3a29; --accent-text: #6fd392; --on-accent: #08130c;
  --bad: #f0746a; --bad-soft: #3b2321; --bad-text: #f58d84;
  --warn-soft: #3a2e19; --warn-text: #ecb458;
  --skip: #9ba7b3; --skip-soft: #262e36;
  --shadow: none; color-scheme: dark }

* { box-sizing: border-box }
html, body { margin: 0 }
body { background: var(--bg); color: var(--fg); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent; -webkit-text-size-adjust: 100%; text-size-adjust: 100% }
button, input, textarea, select { font: inherit; color: inherit }
button { cursor: pointer; touch-action: manipulation }
button:disabled { cursor: default }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
[hidden] { display: none !important }
h1, h2, h3 { margin: 0; font: inherit }
.offscreen { position: fixed; left: -9999px; top: 0 }
.blk { display: block }

.app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column }
header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 4px; min-height: 54px; padding: 0 16px;
  padding-top: env(safe-area-inset-top, 0px); background: var(--bg) }
header h1 { font-size: 20px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.back { border: 0; background: none; color: var(--accent-text); font-weight: 600; min-height: 44px; padding: 0 8px 0 0 }

main { flex: 1; padding: 4px 16px 24px; display: flex; flex-direction: column; gap: 12px }
main.enter { animation: enter .18s ease-out }
@keyframes enter { from { opacity: 0; transform: translateY(6px) } }

/* surfaces: a hairline and a whisper of shadow, so cards read on the grey page in sunlight too */
.card, .list { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); box-shadow: var(--shadow) }
.card { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px }
.list { overflow: hidden }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 16px; min-height: 58px; border: 0; background: none; width: 100%;
  text-align: left; color: inherit }
.item + .item { border-top: 1px solid var(--line) }
.item .grow { flex: 1; min-width: 0; overflow-wrap: anywhere }
.item.col { flex-direction: column; align-items: stretch; gap: 8px }
.item, .chip, .btn, .mainbtn, .seg button { transition: transform .08s ease, background-color .12s ease, border-color .12s ease, color .12s ease }
button.item:active { background: var(--fill) }
.chip:active, .btn:active, .mainbtn:active:not(:disabled) { transform: scale(.97) }

.sect { font-size: 12px; line-height: 1.4; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 4px -4px; font-weight: 600 }
.row { display: flex; align-items: center; gap: 10px; min-width: 0 }
.row > .grow, .grow { flex: 1; min-width: 0 }
.wrap { flex-wrap: wrap }
.muted { color: var(--muted); font-size: 13px; line-height: 1.4 }
.title { font-weight: 600; font-size: 16px; line-height: 1.3; overflow-wrap: anywhere }
.pre { white-space: pre-wrap; overflow-wrap: anywhere }
.chev { flex: none; display: grid; place-items: center; width: 12px }
.chev::after { content: ""; width: 8px; height: 8px; border: solid var(--muted); border-width: 2px 2px 0 0; transform: rotate(45deg); opacity: .65 }
.center { text-align: center; padding: 40px 16px; color: var(--muted) }
.skel { height: 80px; border-radius: var(--r-card); background: linear-gradient(90deg, var(--fill) 25%, var(--card) 50%, var(--fill) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite }
.skel.s { height: 44px }
@keyframes shimmer { to { background-position: -200% 0 } }

.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 14px;
  letter-spacing: .02em; background: var(--accent-soft); color: var(--accent-text) }
.avatar.off { background: var(--skip-soft); color: var(--skip) }
.avatar.lg { width: 52px; height: 52px; font-size: 18px }

.pill { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 10px; font-size: 12px; line-height: 1.4; font-weight: 600; white-space: nowrap }
.pills { display: flex; flex-wrap: wrap; gap: 6px }
.p-ok { background: var(--accent-soft); color: var(--accent-text) }
.p-bad { background: var(--bad-soft); color: var(--bad-text) }
.p-warn { background: var(--warn-soft); color: var(--warn-text) }
.p-skip { background: var(--skip-soft); color: var(--skip) }

.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 8px 14px; min-height: 40px; font-size: 14px; font-weight: 500 }
.chip.act { align-self: flex-start; border-color: var(--accent-soft); background: var(--accent-soft); color: var(--accent-text); font-weight: 600 }
.seg { display: flex; background: var(--fill); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px }
.seg button { flex: 1; border: 0; background: none; border-radius: 9px; padding: 8px 4px; min-height: 40px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap }
.seg button.on { background: var(--card); color: var(--fg); box-shadow: 0 1px 3px rgb(0 0 0 / .12) }

input[type=text], input[type=tel], input[type=search], input[type=url], textarea {
  width: 100%; border: 1px solid var(--line); background: var(--fill); border-radius: var(--r-ctl); padding: 11px 12px;
  font-size: 16px; color: var(--fg); min-width: 0; -webkit-appearance: none; appearance: none;
  transition: border-color .12s ease, background-color .12s ease }  /* under 16px iOS zooms the page in on focus */
input:focus, textarea:focus { outline: 0; border-color: var(--accent); background: var(--card) }
input[readonly] { color: var(--muted) }
input[type=search]::-webkit-search-decoration { -webkit-appearance: none }
::placeholder { color: var(--muted); opacity: .75 }
textarea { resize: vertical; min-height: 76px; line-height: 1.4 }
textarea.short { min-height: 46px }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--muted) }

/* a whole row is the tap target: the label holds the text and the control */
.switch, .check { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 16px; cursor: pointer }
.switch { justify-content: space-between }
.switch + .switch, .check + .check, .switch + .check, .check + .switch { border-top: 1px solid var(--line) }
.switch > span, .check > span { flex: 1; min-width: 0; overflow-wrap: anywhere }
.switch input, .check input { -webkit-appearance: none; appearance: none; flex: none; margin: 0; cursor: pointer; position: relative }
.switch input { width: 46px; height: 28px; border-radius: 14px; background: var(--line); transition: background-color .15s ease }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / .3); transition: transform .15s ease }
.switch input:checked { background: var(--accent) }
.switch input:checked::after { transform: translateX(18px) }
.check input { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--muted); background: var(--card); order: -1 }
.check input:checked { background: var(--accent); border-color: var(--accent) }
.check input:checked::after { content: ""; position: absolute; left: 6px; top: 2px; width: 6px; height: 12px; border: solid var(--on-accent);
  border-width: 0 2.5px 2.5px 0; transform: rotate(45deg) }
.switch input:disabled, .check input:disabled { opacity: .5; cursor: default }
.card > .switch, .card > .check { margin: 0 -16px; padding-left: 16px; padding-right: 16px }

.btn { border: 0; border-radius: var(--r-ctl); padding: 12px 14px; min-height: 46px; font-weight: 600; background: var(--accent-soft); color: var(--accent-text); width: 100% }
.btn.danger { background: var(--bad-soft); color: var(--bad-text) }
.btn.plain { background: var(--fill); color: var(--fg) }

.dock { position: sticky; bottom: 0; z-index: 5; background: var(--bg); padding-bottom: env(safe-area-inset-bottom, 0px) }
.mainbtn { display: block; width: calc(100% - 32px); margin: 8px 16px 10px; border: 0; border-radius: 14px; padding: 14px; min-height: 52px;
  background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 16px; box-shadow: 0 6px 14px -8px var(--accent) }
.mainbtn:disabled { background: var(--line); color: var(--muted); box-shadow: none }  /* grey, not a pale green: «not yet» must not look tappable */
nav { display: flex; background: var(--card); border-top: 1px solid var(--line) }
nav button { flex: 1; min-width: 0; border: 0; background: none; padding: 6px 2px 8px; min-height: 56px; font-size: 11px; font-weight: 500; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px }
nav .ic { width: 52px; max-width: 100%; height: 30px; border-radius: 15px; display: grid; place-items: center; transition: background-color .15s ease }
nav button.on { color: var(--accent-text); font-weight: 700 }
nav button.on .ic { background: var(--accent-soft) }
nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round }

.toast { position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  background: var(--fg); color: var(--bg); padding: 11px 16px; border-radius: 14px; font-size: 14px; font-weight: 500; z-index: 20;
  width: max-content; max-width: calc(100% - 32px); text-align: center; box-shadow: 0 8px 24px rgb(0 0 0 / .25); animation: toast .18s ease-out }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 8px) } }
.toast.err { background: var(--bad-text); color: var(--card) }  /* --bad under white text is 4.4:1, short of AA */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important } }
