/* MANNA PANEL — shared styles.
   Visual language carried over from the v2 dashboard; view-specific styles
   live in their own files (tools.css, labels.css, recipes.css). */

:root {
  --bg: #f5f3ee; --panel: #fff; --panel2: #faf9f6; --panel3: #f3f0ea; --ink: #22231f; --muted: #6d6b64; --line: #ded9cf; --line2: #ebe6dd;
  --green: #2f5b46; --green2: #47745d; --greenSoft: #eaf2ed;
  --plum: #6d4166; --plumSoft: #f3eaf2; --berry: #864552; --berrySoft: #f8e9ec;
  --gold: #a16b18; --goldSoft: #fbf1d8; --red: #973d39; --redSoft: #fae9e7;
  --amber: #b4561f; --amberSoft: #fbeee4; --rose: #a4506f; --roseSoft: #f9ebf1; --slate: #46586b; --slateSoft: #e9eef3;
  --accent: var(--green); --accentSoft: var(--greenSoft);
  --shadow: 0 7px 24px rgba(20, 30, 24, .07);
  --radius: 17px;
  --navH: 66px;
  --sideW: 232px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  line-height: 1.45; min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--green); }
h1, h2, h3, h4 { line-height: 1.15; }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.22em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid rgba(47, 91, 70, .45); outline-offset: 2px; }

/* ---------- boot / auth screens ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); font-weight: 700; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px 14px; background:
  radial-gradient(circle at 20% 0%, #e8efe9 0, transparent 45%), radial-gradient(circle at 100% 100%, #f1e7ef 0, transparent 45%), var(--bg); }
.auth-card { width: min(100%, 440px); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 24px; }
.auth-card h1 { margin: 10px 0 4px; font-size: 24px; }
.auth-card p { color: var(--muted); margin: 0 0 16px; }
.auth-card .stack { gap: 12px; }
.auth-card .google-btn { background: #fff; color: #1f1f1f; border: 1px solid #c9cbd0; display: flex; justify-content: center; gap: 10px; text-decoration: none; }
.auth-card .google-btn:hover { background: #f4f5f7; }
.auth-card .google-btn .icon { width: 20px; height: 20px; }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 14px 0; color: var(--muted); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.brand-mark { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: linear-gradient(135deg, #23392f, #4d745f); color: #fff; }
.brand-mark .icon { width: 26px; height: 26px; }
.profile-list { display: grid; gap: 8px; margin: 12px 0; }
.profile-btn { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; text-align: left; font-weight: 800; }
.profile-btn:hover { border-color: var(--green); }

/* ---------- shell ---------- */
.shell { min-height: 100vh; }
.sidebar { display: none; }
.main { min-width: 0; padding-bottom: calc(var(--navH) + env(safe-area-inset-bottom) + 12px); }
.topbar {
  position: sticky; top: 0; z-index: 50;
  padding: calc(9px + env(safe-area-inset-top)) 14px 9px;
  background: rgba(245, 243, 238, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(222, 217, 207, .8);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; min-width: 0; text-decoration: none; color: inherit; }
.topbar .brand .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
.topbar .brand .brand-mark .icon { width: 20px; height: 20px; }
.topbar h1 { font-size: 17px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar small { display: block; color: var(--muted); font-weight: 600; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.icon-btn:hover { border-color: #c8c2b6; }
.icon-btn .count {
  position: absolute; top: -5px; right: -5px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 99px;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; border: 2px solid var(--bg);
}
.sync-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800; color: var(--muted); padding: 6px 9px; border-radius: 99px; background: var(--panel3); white-space: nowrap; }
.sync-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--green2); }
.sync-dot.offline::before { background: var(--red); }
.sync-dot.local::before { background: var(--gold); }
.avatar {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: #fff; font-weight: 800; font-size: 14px;
  background: var(--green); flex: none; text-transform: uppercase; border: 2px solid rgba(255, 255, 255, .8);
}
.avatar.sm { width: 22px; height: 22px; font-size: 10.5px; border-width: 1px; }
.avatar.lg { width: 44px; height: 44px; font-size: 18px; }
.user-btn { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 3px 10px 3px 3px; font-weight: 800; font-size: 13px; }
.user-btn .name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.banner-host:empty { display: none; }
.banner-host { padding: 10px 14px 0; max-width: 1180px; margin: 0 auto; }
.due-banner { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 13px; background: var(--goldSoft); border: 1px solid #efd9a3; }
.due-banner.overdue { background: var(--redSoft); border-color: #efc5c0; }
.due-banner .grow { flex: 1; min-width: 0; }
.due-banner strong { display: block; }

.view-host { max-width: 1180px; margin: 0 auto; padding: 14px 14px 28px; }
.footer { color: var(--muted); font-size: 12px; text-align: center; margin: 8px 5px 24px; }

.bottom-nav {
  position: fixed; z-index: 100; left: 0; right: 0; bottom: 0;
  height: calc(var(--navH) + env(safe-area-inset-bottom));
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.bottom-nav button, .bottom-nav a {
  position: relative; border: 0; background: transparent; border-radius: 12px; padding: 5px 2px; color: #6f6c66;
  font-size: 10.5px; font-weight: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none;
}
.bottom-nav .icon { width: 23px; height: 23px; }
.bottom-nav .active { background: var(--greenSoft); color: var(--green); }
.bottom-nav .count { position: absolute; top: 2px; right: calc(50% - 22px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--red); color: #fff; font-size: 10px; display: grid; place-items: center; }

.nav-group { margin: 14px 0 4px; padding: 0 12px; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: #8a877f; }
.nav-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin: 1px 8px; border-radius: 11px; color: #3d3b36;
  text-decoration: none; font-weight: 750; font-size: 14px; border: 0; background: none; width: calc(100% - 16px); text-align: left;
}
.nav-link:hover { background: var(--panel3); }
.nav-link.active { background: var(--greenSoft); color: var(--green); }
.nav-link .count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--red); color: #fff; font-size: 11px; display: grid; place-items: center; }

.more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.more-grid .nav-tile {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 14px; border: 1px solid var(--line);
  background: #fff; font-weight: 800; font-size: 12.5px; text-decoration: none; color: var(--ink); text-align: center;
}
.more-grid .nav-tile .icon { width: 24px; height: 24px; color: var(--green); }

/* ---------- typography & layout helpers ---------- */
.section-title { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin: 22px 2px 10px; flex-wrap: wrap; }
.section-title:first-child { margin-top: 4px; }
.section-title h2 { margin: 0; font-size: 23px; }
.section-title p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin: 2px 2px 14px; }
.page-head h2 { margin: 0; font-size: 25px; }
.page-head p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; }
.crumbs { font-size: 12.5px; font-weight: 700; margin-bottom: 6px; }
.crumbs a { text-decoration: none; }
.mini { font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }
.strong { font-weight: 800; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.stack { display: grid; gap: 10px; }
.stack.lg { gap: 14px; }
.row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.row > * { min-width: 0; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mt { margin-top: 13px; }
.mt-sm { margin-top: 8px; }
.mb { margin-bottom: 13px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 15px 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card h2, .card h3, .card h4 { margin-top: 0; }
.card h3 { margin-bottom: 8px; }
.card.flat { box-shadow: none; }
.card.tight { padding: 12px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.card-head h3 { margin: 0; }

.hero {
  border-radius: 20px; padding: 22px; color: #fff; background: linear-gradient(135deg, #23392f, #4d745f);
  box-shadow: var(--shadow); margin-bottom: 14px;
}
.hero h2 { margin: 0 0 6px; font-size: 27px; line-height: 1.08; }
.hero p { margin: 6px 0; opacity: .92; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-top: 15px; }
.kpi { background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18); border-radius: 13px; padding: 10px; }
.kpi b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; opacity: .8; }
.kpi span { display: block; font-size: 18px; font-weight: 800; margin-top: 2px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--greenSoft); color: var(--green); font-size: 12px; font-weight: 800; white-space: nowrap; }
.pill.gold { background: var(--goldSoft); color: var(--gold); }
.pill.red { background: var(--redSoft); color: var(--red); }
.pill.plum { background: var(--plumSoft); color: var(--plum); }
.pill.grey { background: var(--panel3); color: #57544d; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 7px 12px; font-weight: 800; font-size: 13px; color: var(--ink); text-decoration: none; white-space: nowrap;
}
.chip.active, .chip[aria-pressed="true"] { background: var(--green); color: #fff; border-color: var(--green); }
.chips { display: flex; gap: 7px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.badge { display: inline-block; padding: 2px 7px; border-radius: 7px; font-size: 11px; font-weight: 800; background: var(--panel3); color: #57544d; white-space: nowrap; }
.badge.green { background: var(--greenSoft); color: var(--green); }
.badge.gold { background: var(--goldSoft); color: var(--gold); }
.badge.red { background: var(--redSoft); color: var(--red); }
.badge.plum { background: var(--plumSoft); color: var(--plum); }
.badge.slate { background: var(--slateSoft); color: var(--slate); }

.notice { padding: 13px 14px; border-left: 4px solid var(--gold); background: var(--goldSoft); border-radius: 11px; margin: 12px 0; }
.notice.red { border-left-color: var(--red); background: var(--redSoft); }
.notice.green { border-left-color: var(--green); background: var(--greenSoft); }
.notice.slate { border-left-color: var(--slate); background: var(--slateSoft); }
.notice > :first-child { margin-top: 0; }
.notice > :last-child { margin-bottom: 0; }

.empty { text-align: center; padding: 26px 16px; color: var(--muted); border: 1px dashed #d3cdc1; border-radius: 15px; background: rgba(255, 255, 255, .5); }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.empty .btn { margin-top: 10px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 0; background: var(--green); color: #fff; border-radius: 11px; padding: 10px 13px; font-weight: 800; text-decoration: none; line-height: 1.2;
  min-height: 40px;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled, .btn.busy { opacity: .6; cursor: progress; }
.btn.alt { background: var(--greenSoft); color: var(--green); }
.btn.ghost { background: #f2efe9; color: #3d3b36; }
.btn.outline { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.danger { background: var(--redSoft); color: var(--red); }
.btn.danger.solid { background: var(--red); color: #fff; }
.btn.gold { background: var(--goldSoft); color: var(--gold); }
.btn.small { font-size: 12.5px; padding: 7px 10px; min-height: 34px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn .icon { width: 1.15em; height: 1.15em; }
.link-btn { border: 0; background: none; padding: 0; color: var(--green); font-weight: 800; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- forms ---------- */
label.field { display: block; font-size: 12px; font-weight: 800; color: var(--muted); margin-bottom: 5px; }
.req::after { content: " *"; color: var(--red); }
input[type=text], input[type=number], input[type=date], input[type=datetime-local], input[type=time], input[type=password],
input[type=search], input[type=url], input[type=email], select, textarea {
  width: 100%; border: 1px solid #cbc6bc; border-radius: 10px; background: #fff; color: var(--ink); padding: 10px 11px; outline: none; min-height: 42px;
}
input[type=color] { width: 48px; height: 40px; border: 1px solid #cbc6bc; border-radius: 10px; background: #fff; padding: 3px; }
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47, 91, 70, .10); }
input:disabled, select:disabled, textarea:disabled { background: var(--panel3); color: var(--muted); }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fields.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.fields .span-2 { grid-column: span 2; }
.fields .span-all { grid-column: 1 / -1; }
.check-line { display: flex; gap: 9px; align-items: flex-start; font-weight: 700; font-size: 14px; }
.check-line input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--green); flex: none; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.input-group { display: flex; gap: 6px; }
.input-group > :first-child { flex: 1; min-width: 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background: #fff; }
.seg button { border: 0; background: none; padding: 8px 12px; font-weight: 800; font-size: 13px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--green); color: #fff; }
.stars { display: inline-flex; gap: 2px; }
.stars label { cursor: pointer; font-size: 26px; line-height: 1; color: #d6d0c4; }
.stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars label.on { color: #c98a1b; }
.stars input:focus-visible + span { outline: 2px solid var(--green); }
.rating { color: #c98a1b; letter-spacing: 1px; white-space: nowrap; }

/* ---------- batch cards ---------- */
.accent-green { --accent: var(--green); --accentSoft: var(--greenSoft); }
.accent-plum { --accent: var(--plum); --accentSoft: var(--plumSoft); }
.accent-berry { --accent: var(--berry); --accentSoft: var(--berrySoft); }
.accent-gold { --accent: var(--gold); --accentSoft: var(--goldSoft); }
.accent-amber { --accent: var(--amber); --accentSoft: var(--amberSoft); }
.accent-rose { --accent: var(--rose); --accentSoft: var(--roseSoft); }
.accent-slate { --accent: var(--slate); --accentSoft: var(--slateSoft); }
.batch-card { border-top: 6px solid var(--accent); }
.batch-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.batch-head h3 { margin: 0 0 4px; font-size: 18px; }
.batch-head h3 a { color: inherit; text-decoration: none; }
.batch-head h3 a:hover { text-decoration: underline; }
.status { border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px; min-width: 124px; font-weight: 700; width: auto; min-height: 38px; }
.status-pill { display: inline-block; padding: 4px 9px; border-radius: 99px; background: var(--accentSoft); color: var(--accent); font-size: 12px; font-weight: 800; }
.progress { height: 8px; background: #eeeae2; border-radius: 99px; overflow: hidden; margin: 13px 0 10px; }
.progress span { display: block; height: 100%; background: var(--accent); width: 0; border-radius: 99px; }
.metric { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.metric b { font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .03em; display: block; }
.metric strong { font-size: 20px; display: block; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric small { color: var(--muted); font-size: 11.5px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; }
.metrics.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.calc-result { margin-top: 10px; background: var(--greenSoft); border-radius: 10px; padding: 10px; font-weight: 800; }

/* ---------- tables & lists ---------- */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 7px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
.qty { font-weight: 800; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.list { display: grid; gap: 8px; }
.list-item {
  display: flex; gap: 11px; align-items: flex-start; padding: 11px 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; min-width: 0;
}
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 800; }
.list-item .sub { font-size: 12.5px; color: var(--muted); }
.list-item.done .title { text-decoration: line-through; color: #8a877f; }
.list-item.overdue { border-color: #e6b9b3; background: #fffafa; }
.list-item.due { border-color: #ecd49b; background: #fffdf6; }
.by { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; }

.reading-list { display: grid; gap: 8px; }
.reading {
  border: 1px solid var(--line); border-radius: 12px; padding: 11px; background: #fff;
  display: grid; grid-template-columns: 1.4fr repeat(4, .75fr) auto; gap: 8px; align-items: center;
}
.reading small { color: var(--muted); }
.reading .val { font-weight: 800; }

.phase { margin: 12px 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.phase-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 13px; background: var(--panel3); font-weight: 850; }
.phase-body { padding: 10px 13px 13px; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px dashed var(--line2); }
.check:last-child { border-bottom: 0; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--green); flex: none; }
.check.done .text { text-decoration: line-through; color: #8a877f; }
.check .who { display: block; font-size: 11.5px; color: var(--muted); font-weight: 700; text-decoration: none; }

details { border: 1px solid var(--line); border-radius: 13px; background: #fff; margin: 8px 0; overflow: hidden; }
summary { padding: 12px 13px; font-weight: 850; cursor: pointer; background: var(--panel2); }
details > div { padding: 12px 13px; }

.tabs { display: flex; gap: 6px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 14px 0 12px; padding-bottom: 0; scrollbar-width: none; }
.tabs button { border: 0; background: none; padding: 9px 12px; font-weight: 800; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--green); border-bottom-color: var(--green); }
.tabs .n { font-size: 11px; background: var(--panel3); padding: 1px 6px; border-radius: 99px; margin-left: 4px; }

.timeline { display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line2); }
.tl-item:last-child { border-bottom: 0; }
.tl-dot { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--panel3); color: var(--green); }
.tl-dot .icon { width: 16px; height: 16px; }
.tl-item .meta { font-size: 12px; color: var(--muted); }
.tl-item .body { white-space: pre-wrap; overflow-wrap: anywhere; }

.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.chart-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.chart-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c, var(--green)); margin-right: 5px; vertical-align: -1px; }

.stock-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.size-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.size-chip { font-size: 12px; font-weight: 800; padding: 3px 8px; border-radius: 8px; background: var(--panel3); }
.qty-big { font-size: 26px; font-weight: 850; line-height: 1; }
.low { color: var(--red); font-weight: 800; }

/* ---------- jugs (secondary splits) & additions ---------- */
.jug-strip { display: grid; gap: 6px; margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--line2); }
.jug-strip.flush { margin-top: 0; padding-top: 0; border-top: 0; }
.jug-row { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel2); color: inherit; text-decoration: none; min-width: 0; }
.jug-row:hover, .jug-row:focus-visible { border-color: var(--accent); }
.jug-row .grow { flex: 1; min-width: 0; display: grid; gap: 1px; }
.jug-row .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jug-size { flex: none; min-width: 48px; text-align: center; font-size: 12px; font-weight: 800; padding: 4px 6px; border-radius: 8px; background: var(--accentSoft); color: var(--accent); }
.jug-flag { flex: none; display: inline-flex; color: var(--gold); }
.jug-edit { border: 1px solid var(--line); border-radius: 13px; padding: 10px 12px; background: var(--panel2); }
.add-list { display: grid; gap: 6px; }
.add-row { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 11px; background: #fff; min-width: 0; }
.add-row .grow { flex: 1 1 220px; min-width: 0; }
.add-row .sub { display: block; font-size: 12px; color: var(--muted); }
.add-row.removed { background: var(--panel2); }
.add-row.removed > .grow > strong { color: var(--muted); }
.add-row .badge .icon { width: 12px; height: 12px; vertical-align: -2px; }
.notice.attn { display: flex; gap: 10px; align-items: flex-start; }
.notice.attn > .icon { flex: none; width: 20px; height: 20px; color: var(--gold); margin-top: 1px; }
.flat-list { margin: 4px 0 0; padding-left: 18px; }
.tl-dot.warn { color: var(--gold); background: var(--goldSoft); }
.attn-jugs { display: grid; gap: 6px; margin-top: 6px; }
.attn-jug { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; padding-top: 6px; border-top: 1px dashed var(--line2); }
.attn-jug .grow { flex: 1 1 220px; min-width: 0; }
.attn-jug .sub { font-size: 12.5px; color: var(--muted); }
button.pill { border: 0; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }

/* ---------- modal & toasts ---------- */
dialog.modal {
  border: 0; padding: 0; border-radius: 20px; width: min(620px, calc(100vw - 20px)); max-height: calc(100vh - 30px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .25); background: var(--panel); color: var(--ink);
}
dialog.modal-sm { width: min(430px, calc(100vw - 20px)); }
dialog.modal-lg { width: min(880px, calc(100vw - 20px)); }
dialog.modal::backdrop { background: rgba(24, 28, 26, .45); backdrop-filter: blur(2px); }
.modal-form { display: flex; flex-direction: column; max-height: calc(100vh - 30px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 15px 16px 10px; border-bottom: 1px solid var(--line2); }
.modal-head h2 { margin: 0; font-size: 19px; }
.modal-x { border: 0; background: var(--panel3); width: 34px; height: 34px; border-radius: 10px; font-size: 15px; }
.modal-body { padding: 14px 16px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; gap: 8px; padding: 11px 16px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line2); flex-wrap: wrap; }
.confirm-msg { margin: 0; white-space: pre-wrap; }
.toasts { position: fixed; z-index: 1000; left: 50%; transform: translateX(-50%); bottom: calc(var(--navH) + 14px + env(safe-area-inset-bottom)); display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: #1d231f; color: #fff; padding: 11px 14px; border-radius: 12px; font-size: 14px; font-weight: 650; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.success { background: #234a37; }
.toast.error { background: #7c2d29; }

/* ---------- responsive ---------- */
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: var(--sideW) minmax(0, 1fr); }
  .sidebar {
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto;
    border-right: 1px solid var(--line); background: #fbfaf7; padding: 14px 0 18px;
  }
  .sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 4px 16px 8px; text-decoration: none; color: inherit; }
  .sidebar .brand h1 { font-size: 16px; margin: 0; }
  .sidebar .brand small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 600; }
  .sidebar .side-foot { margin-top: auto; padding: 12px 16px 0; font-size: 11.5px; color: var(--muted); }
  .topbar .brand { display: none; }
  .topbar .page-name { display: block; }
  .bottom-nav { display: none; }
  .main { padding-bottom: 0; }
  .toasts { bottom: 22px; left: auto; right: 22px; transform: none; }
  .view-host { padding: 18px 22px 30px; }
  .banner-host { padding: 12px 22px 0; }
}
@media (max-width: 899px) {
  .topbar .page-name { display: none; }
}
@media (max-width: 760px) {
  .view-host { padding: 10px 10px 24px; }
  .topbar { padding-left: 11px; padding-right: 11px; }
  .hero { padding: 18px; border-radius: 16px; }
  .hero h2 { font-size: 24px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .grid, .grid.three, .grid.four { grid-template-columns: 1fr; }
  .fields, .fields.three, .fields.four { grid-template-columns: 1fr 1fr; }
  .fields .span-2 { grid-column: 1 / -1; }
  .metrics, .metrics.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reading { grid-template-columns: 1fr 1fr; }
  .reading .wide { grid-column: 1 / -1; }
  .reading .remove { justify-self: end; }
  th, td { padding: 8px 5px; }
  .user-btn .name { display: none; }
  .user-btn { padding: 2px; }
  .sync-dot .txt { display: none; }
  .page-head h2 { font-size: 22px; }
  .stock-row { grid-template-columns: 1fr auto; }
  .stock-row .sizes { grid-column: 1 / -1; }
  dialog.modal { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 20px 20px 0 0; max-height: 92vh; }
  .modal-form { max-height: 92vh; }
}
@media (max-width: 430px) {
  .fields, .fields.three, .fields.four { grid-template-columns: 1fr; }
  .bottom-nav button, .bottom-nav a { font-size: 9.5px; }
  .metric strong { font-size: 18px; }
}

/* ---------- print (normal pages; label printing is handled by labels.css) ---------- */
@media print {
  body:not(.printing-label) { background: #fff; }
  body:not(.printing-label) .sidebar,
  body:not(.printing-label) .topbar,
  body:not(.printing-label) .bottom-nav,
  body:not(.printing-label) .banner-host,
  body:not(.printing-label) .toasts,
  body:not(.printing-label) .no-print,
  body:not(.printing-label) dialog { display: none !important; }
  body:not(.printing-label) .shell { display: block; }
  body:not(.printing-label) .main { padding: 0; }
  body:not(.printing-label) .view-host { max-width: none; padding: 0; }
  body:not(.printing-label) .card { box-shadow: none; break-inside: avoid; }
  body:not(.printing-label) .hero { background: #fff; color: #000; border: 2px solid #333; box-shadow: none; }
  body:not(.printing-label) .kpi { border-color: #999; }
  body:not(.printing-label) a { color: inherit; text-decoration: none; }
  body:not(.printing-label) .print-only { display: block !important; }
}
.print-only { display: none; }

/* ---------- chart tooltip ---------- */
.chart-wrap { position: relative; }
.chart-wrap svg:focus-visible { outline: 3px solid rgba(47, 91, 70, .35); border-radius: 8px; }
.chart-tip {
  position: absolute; transform: translate(-50%, -100%); background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 9px; font-size: 12px; color: var(--muted); box-shadow: var(--shadow); pointer-events: none; white-space: nowrap; z-index: 2;
}
.chart-tip strong { color: var(--ink); font-size: 13.5px; display: block; }
@media print { body:not(.printing-label) .tab-panel { display: block !important; } body:not(.printing-label) .tabs { display: none; } }
.tab-panel.inactive { display: none; }
