:root {
  color-scheme: dark;
  --bg: #0a0f0c; --panel: #121a15; --panel2: #18221b; --ink: #edf4ee;
  --muted: #a6b4aa; --line: #304037; --accent: #d4f66e;
  --danger: #ff8e83; --warning: #f6c968; --ok: #78d5a0; --sidebar: 248px;
  font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }
a { color: var(--accent); text-underline-offset: .18em; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip { position: fixed; z-index: 200; left: 1rem; top: -5rem; padding: .7rem 1rem; background: var(--accent); color: #10170b; }
.skip:focus { top: 1rem; }
.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 60; inset: 0 auto 0 0; width: var(--sidebar); height: 100dvh; display: flex; flex-direction: column; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 24px 14px 17px; background: #0d1510; border-right: 1px solid var(--line); scrollbar-gutter: stable; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 10px 25px; color: var(--ink); font-size: 16px; font-weight: 900; line-height: 1.1; letter-spacing: .02em; text-decoration: none; }
.brand b, .mobile-brand b { color: var(--accent); }
.brand small { display: block; margin-top: 6px; color: var(--muted); font-size: 9px; letter-spacing: .16em; }
.brand-mark { width: 35px; height: 35px; display: grid; place-items: center; flex: none; border-radius: 10px; background: var(--accent); color: #0b130d; font-size: 25px; }
.side-nav { display: grid; gap: 3px; }
.side-nav p { margin: 14px 11px 8px; color: #7f9487; font-size: 10px; font-weight: 820; letter-spacing: .17em; text-transform: uppercase; }
.side-nav a { min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 10px 13px; border: 1px solid transparent; border-radius: 10px; color: #b7c6ba; font-size: 13px; font-weight: 670; text-decoration: none; }
.side-nav a:hover { background: var(--panel2); color: var(--ink); }
.side-nav a[aria-current="page"] { background: #25341f; border-color: #3a5428; color: var(--accent); }
.nav-icon { width: 20px; text-align: center; font-size: 20px; line-height: 1; }
.account-nav { margin-top: 5px; border-top: 1px solid var(--line); }
.account { display: grid; grid-template-columns: 35px minmax(0,1fr); gap: 9px; align-items: center; margin-top: auto; padding: 14px 9px 0; border-top: 1px solid var(--line); }
.account span:nth-child(2) { min-width: 0; }
.account small, .account strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account strong { font-size: 12px; }
.account form { grid-column: 1 / -1; }
.avatar { width: 35px; height: 35px; display: grid; place-items: center; border: 1px solid #49633f; border-radius: 10px; background: #30452f; color: var(--accent); font-weight: 800; }
.workspace { min-height: 100vh; margin-left: var(--sidebar); }
.topbar { position: sticky; z-index: 40; top: 0; height: 72px; display: flex; align-items: center; justify-content: space-between; padding: 0 34px; border-bottom: 1px solid var(--line); background: rgba(10,15,12,.96); backdrop-filter: blur(12px); }
.topbar-start, .top-actions { display: flex; align-items: center; gap: 13px; }
.breadcrumb { color: var(--muted); font-size: 13px; }
.breadcrumb strong { color: var(--ink); }
.freshness { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-size: 11px; }
.freshness i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.icon-button { width: 40px; height: 40px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 11px; background: var(--panel); color: var(--ink); font-size: 20px; text-decoration: none; cursor: pointer; }
.nav-open, .nav-close, .mobile-brand, .bottom-nav, .nav-backdrop { display: none; }
main { width: min(1300px,100%); margin: 0 auto; padding: 32px 35px 68px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 10px; font-weight: 850; letter-spacing: .19em; }
h1 { margin: 0 0 7px; font-size: clamp(26px,3vw,33px); line-height: 1.12; letter-spacing: -.035em; }
h2 { line-height: 1.2; }
.lede { max-width: 680px; margin: 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; gap: 9px; }
.button, button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 15px; border: 1px solid var(--accent); border-radius: 11px; background: var(--accent); color: #10170b; font-weight: 750; text-decoration: none; cursor: pointer; }
.secondary, .quiet { border-color: var(--line); background: transparent; color: var(--ink); }
.quiet { min-height: 36px; width: 100%; padding: 6px 10px; }
.link { min-height: auto; padding: 0; border: 0; background: transparent; color: var(--accent); }
.danger-button { border-color: var(--danger); background: transparent; color: var(--danger); }
.danger-text { color: var(--danger); }
.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 25px; margin: 0 0 20px; padding: 24px 27px; border: 1px solid #385036; border-radius: 17px; background: linear-gradient(110deg,#1c2b1c,#141e16); }
.hero::after { content: ""; position: absolute; right: -130px; top: -250px; width: 380px; height: 380px; border: 1px solid rgba(212,246,110,.08); border-radius: 50%; pointer-events: none; }
.hero h2 { margin: 0 0 5px; font-size: 21px; letter-spacing: -.03em; }
.hero p { margin: 0; color: #b8c9b9; font-size: 13px; }
.hero .button { z-index: 1; }
.summary-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 15px; }
.summary-card { min-width: 0; min-height: 205px; display: flex; flex-direction: column; gap: 11px; margin: 0; padding: 19px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); }
.summary-card:hover { border-color: #567044; }
.summary-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.summary-symbol { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 12px; background: #243526; color: var(--accent); font-size: 22px; }
.summary-total { display: flex; align-items: baseline; gap: 8px; color: var(--ink); text-decoration: none; }
.summary-total strong { font-size: 32px; line-height: 1; letter-spacing: -.05em; }
.summary-total span { color: var(--muted); font-size: 12px; }
.summary-card p { margin: 0; color: var(--muted); font-size: 12px; }
.summary-card progress { width: 100%; height: 6px; accent-color: var(--accent); }
.card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 750; text-decoration: none; }
.facts { margin: 0; }
.facts div { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; }
.facts a { color: inherit; text-decoration: none; }
.facts dd { margin: 0; font-weight: 800; }
.badge { display: inline-block; padding: 3px 8px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: capitalize; white-space: nowrap; }
.badge.expired, .badge.overdue { border-color: rgba(255,142,131,.4); color: var(--danger); }
.badge.expiring_soon, .badge.never_verified { border-color: rgba(246,201,104,.4); color: var(--warning); }
.badge.ok, .badge.no_expiry { border-color: rgba(120,213,160,.35); color: var(--ok); }
section, .protocol, .list-card { margin: 1.5rem 0; padding: 1.3rem; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); }
.dashboard-columns { margin-top: 15px; }
.split { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(280px,1fr); gap: 15px; }
.split > section { margin: 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-head h2 { margin: 0; font-size: 15px; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.rows, .tasks { margin: 12px 0 0; padding: 0; list-style: none; }
.rows li, .task { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-top: 1px solid var(--line); }
.rows span, .task > div { display: grid; gap: 3px; }
.rows strong { font-size: 13px; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 16px; }
.quick-grid a { min-height: 48px; display: flex; align-items: center; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: #18251b; color: var(--ink); font-size: 12px; font-weight: 740; text-decoration: none; }
.sync-note { margin: 16px -20px -20px; padding: 13px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.empty-state { padding: 38px 20px; text-align: center; }
.empty-state.compact { margin: 10px 0 0; padding: 24px 15px; border: 0; }
.empty-state p { max-width: 470px; margin: 7px auto 16px; color: var(--muted); }
.empty-icon { width: 42px; height: 42px; display: grid; place-items: center; margin: 0 auto 10px; border-radius: 12px; background: #253b2b; color: var(--ok); }
.muted, small { color: var(--muted); }
.notice { margin: 1rem 0; padding: 1rem; border-left: 4px solid var(--accent); border-radius: 6px; background: #17231b; }
.notice.danger, .danger-zone { border-color: var(--danger); }
.notice.success { border-color: var(--ok); }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr auto; align-items: end; gap: 10px; margin: 18px 0; padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
.inventory-filters { grid-template-columns: minmax(220px,2fr) minmax(180px,1fr) auto auto; }
.filters label, .editor label, .mini-editor label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
input, textarea, select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #0d1410; color: var(--ink); }
textarea { min-height: 105px; resize: vertical; }
.filter-disclosure { position: relative; align-self: end; }
.filter-disclosure summary { min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); cursor: pointer; }
.filter-panel { position: absolute; z-index: 12; right: 0; width: min(720px,90vw); display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel2); box-shadow: 0 20px 45px rgba(0,0,0,.35); }
.filter-actions, .actions, .row-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.view-switch { display: flex; justify-content: flex-end; gap: 6px; margin: 13px 0; }
.view-switch .button { min-height: 36px; padding: 6px 11px; }
.inventory-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.inventory-card { overflow: hidden; min-width: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.inventory-card:hover { border-color: #57734d; }
.inventory-visual { height: 50px; display: flex; align-items: center; justify-content: center; background: var(--panel2); color: var(--muted); font-size: 10px; letter-spacing: .2em; }
.inventory-card-body { display: grid; gap: 8px; padding: 15px; }
.inventory-card h2 { overflow: hidden; margin: 0; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.inventory-card-body .badge { justify-self: start; }
.quantity { font-size: 18px; }
.clamp { min-height: 3em; display: -webkit-box; overflow: hidden; margin: 0; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-facts { margin: 0; }
.card-facts div { display: grid; grid-template-columns: 1fr 1.35fr; gap: 7px; padding: 3px 0; font-size: 12px; }
.card-facts dd { margin: 0; overflow-wrap: anywhere; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 12px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
thead th { position: sticky; top: 0; background: var(--panel2); color: var(--muted); font-size: 11px; }
.inline { display: inline; }
.editor { max-width: 900px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.editor.grouped { grid-template-columns: 1fr; }
.editor fieldset { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; }
.editor legend { padding: 0 6px; color: var(--accent); font-weight: 800; }
.editor label:has(textarea), .editor fieldset > small, .editor .actions, .editor > button, .editor > p, .editor > h3 { grid-column: 1 / -1; }
.media-note { max-width: 900px; display: flex; gap: 13px; margin: 0 0 12px; padding: 13px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); }
.media-note div { display: grid; }
.danger-zone { max-width: 900px; }
.editor-backdrop { position: fixed; z-index: 89; inset: 0; background: rgba(0,0,0,.68); }
.editor-backdrop[hidden], .edit-drawer[hidden] { display: none; }
.edit-drawer { position: fixed; z-index: 90; inset: 0 0 0 auto; width: min(520px,100vw); display: flex; flex-direction: column; margin: 0; padding: 0; border: 0; border-left: 1px solid var(--line); border-radius: 0; background: var(--panel); box-shadow: -20px 0 55px rgba(0,0,0,.35); }
.edit-drawer > header { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.edit-drawer > header h2 { margin: 0; font-size: 19px; }
.edit-drawer > header .eyebrow { margin-bottom: 4px; }
.edit-drawer-body { min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 20px 22px; }
.edit-drawer-body .media-note { margin-top: 0; }
.edit-drawer-body .editor { width: 100%; padding: 0; border: 0; background: transparent; }
.edit-drawer-body .editor fieldset { grid-template-columns: 1fr; padding: 14px; }
.edit-drawer-body .danger-zone { margin-bottom: 0; }
.edit-drawer > footer { flex: none; display: flex; gap: 9px; padding: 14px 22px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--panel); }
.edit-drawer > footer > * { flex: 1; }
body.modal-active { overflow: hidden; }
.protocol { display: grid; grid-template-columns: minmax(210px,.6fr) 1fr auto; gap: 25px; }
.markdown, .draft { padding: 14px; border-radius: 9px; background: #0d1410; overflow-wrap: anywhere; }
.list-card { margin: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(280px,1fr)); gap: 14px; }
.task { display: grid; grid-template-columns: auto 1fr auto; }
.check { min-height: 38px; padding: 5px 10px; border-color: var(--line); background: transparent; color: var(--accent); }
.done { color: var(--muted); text-decoration: line-through; }
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin: 16px 0; }
.mini-editor { min-width: 280px; display: grid; gap: 9px; margin-top: 8px; padding: 13px; border-radius: 9px; background: var(--panel2); }
.error { color: var(--danger); }
.card { width: min(92%,420px); margin: 8vh auto; padding: 34px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); }
.card .brand { padding-left: 0; }
.card label { display: grid; gap: 5px; margin: 14px 0; color: var(--muted); }
.card h1 { font-size: 32px; }

@media (max-width: 1180px) {
  .inventory-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 1099px) {
  .sidebar { position: relative; inset: auto; width: 100%; height: auto; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .nav-close { display: none; }
  .js .sidebar { position: fixed; inset: 0 auto 0 0; width: min(var(--sidebar),88vw); height: 100dvh; max-height: 100dvh; border-right: 1px solid var(--line); border-bottom: 0; transform: translateX(-105%); transition: transform .2s ease; }
  .js .sidebar.open { transform: translateX(0); }
  .js .sidebar .nav-close { display: grid; }
  .nav-backdrop { position: fixed; z-index: 55; inset: 0; background: rgba(0,0,0,.65); }
  .js .nav-backdrop.open, .js .nav-open { display: grid; }
  .workspace { margin-left: 0; }
  .topbar { padding: 0 21px; }
  main { padding: 27px 22px 90px; }
  .filter-panel { right: auto; left: 0; }
  body.nav-active { overflow: hidden; overscroll-behavior: none; }
}
@media (max-width: 768px) {
  .summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .summary-card:last-child { grid-column: 1 / -1; min-height: 160px; }
  .split { grid-template-columns: 1fr; }
  .filters, .inventory-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .filter-panel { position: static; width: 100%; grid-template-columns: 1fr 1fr; box-shadow: none; }
  .protocol { grid-template-columns: 1fr; }
}
@media (max-width: 699px) {
  .topbar { height: 62px; padding: 0 15px; }
  .breadcrumb, .top-actions .avatar, .freshness { display: none; }
  .mobile-brand { display: block; color: var(--ink); font-size: 13px; font-weight: 900; text-decoration: none; }
  main { padding: 21px 16px calc(88px + env(safe-area-inset-bottom)); }
  .bottom-nav { position: fixed; z-index: 45; inset: auto 0 0; display: grid; grid-template-columns: repeat(4,1fr); padding-bottom: env(safe-area-inset-bottom); border-top: 1px solid var(--line); background: rgba(13,21,16,.98); }
  .js .bottom-nav { grid-template-columns: repeat(5,1fr); }
  .bottom-nav a, .bottom-nav button { min-width: 0; min-height: 60px; display: grid; align-content: center; justify-items: center; gap: 2px; padding: 4px 2px; border: 0; border-radius: 0; background: transparent; color: #97ad9a; font-size: 10px; text-decoration: none; }
  .bottom-nav span { font-size: 19px; line-height: 1; }
  .bottom-nav button { display: none; }
  .js .bottom-nav button { display: grid; }
  .bottom-nav [aria-current="page"] { color: var(--accent); }
  .page-head { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 20px; }
  .page-actions, .page-actions .button { width: 100%; }
  .hero { grid-template-columns: 1fr; padding: 20px; }
  .hero .button { width: 100%; }
  .summary-grid, .inventory-grid, .filters, .inventory-filters, .editor, .editor fieldset { grid-template-columns: 1fr; }
  .summary-card:last-child { grid-column: auto; }
  .summary-card { min-height: auto; padding: 17px; }
  .filter-panel { grid-template-columns: 1fr; }
  .editor label:has(textarea), .editor fieldset > small, .editor .actions, .editor > button, .editor > p, .editor > h3 { grid-column: auto; }
  .rows li { align-items: flex-start; flex-direction: column; }
  .task { grid-template-columns: auto 1fr; }
  .task .row-actions { grid-column: 2; }
  .actions .button, .actions button { flex: 1; }
  .card { padding: 24px; }
  .edit-drawer { inset: 0; width: 100vw; height: 100dvh; max-height: 100dvh; border-left: 0; }
  .edit-drawer > header { padding: 14px 16px; }
  .edit-drawer-body { padding: 16px; }
  .edit-drawer > footer { padding-left: 16px; padding-right: 16px; }
}
@media (max-height: 560px) and (max-width: 1099px) {
  .js .sidebar { padding-top: 10px; padding-bottom: 10px; }
  .brand { padding-bottom: 8px; }
  .side-nav p { margin-top: 7px; margin-bottom: 4px; }
  .side-nav a { min-height: 40px; padding-top: 7px; padding-bottom: 7px; }
  .account { position: static; margin-top: 10px; }
}
@media (max-width: 390px) {
  .quick-grid { grid-template-columns: 1fr; }
  .top-actions { gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
