/* ── The Apothecary ─────────────────────────────────────────────────────
   Cream paper, botanical greens, ranunculus pink, a touch of honey.
   Colours live here; swap them and the whole thing re-themes.            */
:root {
  --paper:   #f7f1e8;
  --paper-2: #fffaf3;
  --ink:     #2f2a26;
  --muted:   #7d6f66;
  --line:    #e4d8c8;
  --olive:   #6b7d5b;
  --sage:    #8fb996;
  --petal:   #f5b0c0;
  --peach:   #ffd3b5;
  --honey:   #d9a441;
  --bad:     #d46a6a;
  --glass:   rgba(255, 255, 255, .62);
  --shadow:  0 1px 2px rgba(60, 40, 20, .06), 0 10px 30px -18px rgba(60, 40, 20, .35);
  --radius:  16px;
  --side:    232px;
  --pattern: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%236b7d5b' stroke-opacity='.10' stroke-width='1.2'%3E%3Cpath d='M30 20c-6-6-6-14 0-14s6 8 0 14zM30 20c6-6 14-6 14 0s-8 6-14 0zM30 20c6 6 6 14 0 14s-6-8 0-14zM30 20c-6 6-14 6-14 0s8-6 14 0z'/%3E%3Ccircle cx='30' cy='20' r='2'/%3E%3Cpath d='M85 70c10 8 12 22 4 32M89 82c6-2 10-1 13 4M86 92c-6 0-10 2-12 7'/%3E%3C/g%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1c221e; --paper-2: #232a25; --ink: #eee6da; --muted: #a79d92; --line: #35403a;
    --glass: rgba(35, 42, 37, .72); --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px -18px rgba(0,0,0,.6);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; color: var(--ink); background: var(--paper) var(--pattern);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh;
}
a { color: inherit; }
h1, h2, .brand b, .label-card b, .login h1 { font-family: Fraunces, Georgia, serif; font-weight: 500; letter-spacing: -.01em; }
h1 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); margin: 0; line-height: 1.1; }
h2.section { font-size: 1.15rem; margin: 2rem 0 .8rem; color: var(--olive); font-style: italic; }
h2.section::before { content: "✿ "; color: var(--petal); font-style: normal; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: .82rem; margin-top: 1.5rem; }
code { font: .86em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--glass); border: 1px solid var(--line); padding: .05em .35em; border-radius: 6px; }
.flower { font-size: .8em; }

/* ── sidebar ── */
.side {
  position: sticky; top: 0; height: 100vh; padding: 1.4rem 1rem; display: flex; flex-direction: column; gap: 1.2rem;
  background: var(--glass); backdrop-filter: blur(10px); border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; padding: .2rem .4rem; }
.brand span { display: flex; flex-direction: column; line-height: 1.1; }
.brand b { font-size: 1.15rem; }
.brand small { color: var(--muted); font-size: .72rem; letter-spacing: .06em; }
.nav { display: flex; flex-direction: column; gap: .2rem; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 10px; text-decoration: none; color: var(--muted); }
.nav a i { font-style: normal; width: 1.4em; text-align: center; }
.nav a:hover { background: var(--paper-2); color: var(--ink); }
.nav a.on { background: var(--petal); color: #2f2a26; font-weight: 600; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: .3rem; font-size: .85rem; color: var(--muted); padding: 0 .4rem; }
.logout { text-decoration: none; } .logout:hover { color: var(--bad); }

/* ── main ── */
.main { padding: 2rem clamp(1rem, 4vw, 3rem) 4rem; min-width: 0; }
.head { margin-bottom: .5rem; }
.head p { margin: .3rem 0 0; }
.head.slim { margin-bottom: .8rem; }

/* ── jar-label cards ── */
.label-card {
  position: relative; display: flex; flex-direction: column; gap: .15rem;
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.1rem 1.15rem 1rem; text-decoration: none; color: inherit;
  transition: transform .15s, box-shadow .15s;
}
.label-card::before {   /* inner rule, like a printed label */
  content: ""; position: absolute; inset: 6px; border: 1px solid var(--line); border-radius: calc(var(--radius) - 6px); pointer-events: none; opacity: .8;
}
.label-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(60,40,20,.06), 0 18px 34px -18px rgba(60,40,20,.4); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .9rem; }
.app .no { position: absolute; top: .8rem; left: 1rem; font-size: .68rem; letter-spacing: .12em; color: var(--muted); }
.app .dot { position: absolute; top: .9rem; right: 1rem; width: 9px; height: 9px; border-radius: 50%; background: var(--line); }
.app .dot.ok { background: var(--sage); box-shadow: 0 0 0 3px rgba(143,185,150,.25); }
.app .dot.bad { background: var(--bad); box-shadow: 0 0 0 3px rgba(212,106,106,.25); }
.app .icon { font-style: normal; font-size: 2rem; margin: 1rem 0 .4rem; line-height: 1; }
.app b { font-size: 1.15rem; }
.app small { color: var(--muted); font-size: .84rem; }
.app .open { margin-top: .6rem; font-size: .78rem; color: var(--olive); }
.app.tool .icon { color: var(--olive); }

/* ── health tiles ── */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .8rem; margin-top: 1.2rem; }
.tile { background: var(--paper-2); border: 1px solid var(--line); border-radius: 14px; padding: .8rem .95rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .2rem; }
.tile.wide { grid-column: span 2; }
.tile .k { font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tile b { font-family: Fraunces, Georgia, serif; font-weight: 500; font-size: 1.5rem; line-height: 1.1; }
.tile small { color: var(--muted); font-size: .8rem; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin: .3rem 0 .1rem; }
.bar i { display: block; height: 100%; width: 0; background: var(--sage); border-radius: 99px; transition: width .6s; }
.bar i.warn { background: var(--honey); } .bar i.bad { background: var(--bad); }
.banner { margin-top: 1rem; padding: .7rem 1rem; border-radius: 12px; background: var(--peach); color: #2f2a26; font-weight: 600; }
.banner.bad { background: var(--bad); color: #fff; }

/* ── services ── */
.svc { display: flex; flex-direction: column; gap: .4rem; }
.svc-row { display: grid; grid-template-columns: 14px 1fr auto; gap: .7rem; align-items: center; padding: .6rem .9rem; background: var(--paper-2); border: 1px solid var(--line); border-radius: 12px; }
.svc-row .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.svc-row .dot.ok { background: var(--sage); } .svc-row .dot.bad { background: var(--bad); } .svc-row .dot.meh { background: var(--honey); }
.svc-row b { font-weight: 600; } .svc-row small { color: var(--muted); display: block; font-size: .8rem; }
.svc-row .btns { display: flex; gap: .3rem; }
.btn { font: inherit; font-size: .85rem; padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--paper-2); color: var(--ink); cursor: pointer; }
.btn:hover { border-color: var(--petal); background: var(--glass); }
.btn.small { padding: .25rem .6rem; font-size: .78rem; }
.btn:disabled { opacity: .5; cursor: wait; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: 1rem; }
.actions .fine { margin: 0; flex-basis: 100%; }
.console { margin-top: 1rem; background: #1f1a1c; color: #f4e9ec; border-radius: 14px; overflow: hidden; border: 1px solid #3a3034; }
.console-head { display: flex; justify-content: space-between; align-items: center; padding: .5rem .9rem; background: #2a2326; font-size: .85rem; }
.console pre { margin: 0; padding: .9rem; max-height: 50vh; overflow: auto; font-size: .8rem; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }

/* ── editor / shell frames ── */
.page-frame .main { display: flex; flex-direction: column; height: 100vh; padding-bottom: 1rem; }
.frame { flex: 1; width: 100%; border: 1px solid var(--line); border-radius: 14px; background: #1f1a1c; box-shadow: var(--shadow); min-height: 300px; }

/* ── login ── */
.page-login { display: grid; place-items: center; padding: 1rem; grid-template-columns: 1fr; }
.login { width: min(380px, 100%); text-align: center; padding: 2rem 1.8rem 1.6rem; gap: .4rem; }
.login-mark { margin: 0 auto .4rem; }
.eyebrow { margin: 0; font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.login h1 { font-size: 2rem; }
.login label { display: block; text-align: left; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: .9rem; }
.login input { display: block; width: 100%; margin-top: .3rem; font: 1rem inherit; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); }
.login input[readonly] { color: var(--muted); }
.login input:focus { outline: 2px solid var(--petal); border-color: transparent; }
.login button { margin-top: 1.2rem; width: 100%; font: inherit; font-weight: 600; padding: .7rem; border: 0; border-radius: 999px; background: var(--petal); color: #2f2a26; cursor: pointer; }
.login button:hover { background: var(--peach); }
.login .error { margin: .8rem 0 0; color: var(--bad); font-weight: 600; }
.login .fine { margin-top: 1rem; }

/* ── phone ── */
@media (max-width: 760px) {
  body { grid-template-columns: 1fr; }
  .side { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; align-items: center; gap: 0; padding: .3rem .4rem calc(.3rem + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); z-index: 20; }
  .brand, .side-foot .who { display: none; }
  .nav { flex-direction: row; flex: 1; justify-content: space-around; }
  .nav a { flex-direction: column; gap: .1rem; padding: .35rem .5rem; font-size: .68rem; }
  .nav a i { font-size: 1.25rem; }
  .side-foot { margin: 0; padding: 0 .4rem; }
  .main { padding: 1.2rem 1rem 6rem; }
  .page-frame .main { height: 100vh; padding-bottom: 4.6rem; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
  .tile.wide { grid-column: span 1; }
  .svc-row { grid-template-columns: 14px 1fr; }
  .svc-row .btns { grid-column: 2; }
}
