/* ====== GOODIE design system ====== */
:root {
  --lime: #B8D431;
  --lime-600: #9eba1f;
  --lime-50: #f4f9d8;
  --lime-100: #e8f2b1;
  --ink: #0d1117;
  --ink-2: #1f2937;
  --ink-3: #374151;
  --muted: #6b7280;
  --muted-2: #9aa3af;
  --bg: #ffffff;
  --bg-1: #fafafa;
  --bg-2: #f5f6f4;
  --line: #ececec;
  --line-2: #e2e2e0;
  --line-3: #d4d6d0;
  --danger: #e11d48;
  --warn: #f59e0b;
  --info: #2563eb;
  --ok: #16a34a;
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --shadow-sm: 0 1px 2px rgba(13,17,23,.04), 0 1px 1px rgba(13,17,23,.03);
  --shadow-md: 0 4px 14px -4px rgba(13,17,23,.08), 0 2px 6px -2px rgba(13,17,23,.05);
  --shadow-lg: 0 30px 60px -20px rgba(13,17,23,.18), 0 10px 25px -10px rgba(13,17,23,.1);
  --t: 200ms cubic-bezier(.22,.61,.36,1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: var(--lime); color: var(--ink); }

/* ====== layout ====== */
#app {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky; top: 0; align-self: start;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: #fdfdfd;
  display: flex; flex-direction: column;
  padding: 22px 14px;
}
.brand {
  padding: 8px 12px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand__logo {
  height: 28px; width: auto;
  filter: none;
}
.sidebar__close { display: none; }
.sidebar__backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(13, 17, 23, .35);
  backdrop-filter: blur(2px);
  z-index: 49;
  animation: fadein 200ms ease;
}
.sidebar__backdrop.is-open { display: block; }
.nav { flex: 1; overflow-y: auto; padding-right: 4px; }
.nav__group { margin-bottom: 18px; }
.nav__label {
  text-transform: uppercase;
  font-size: 11px; letter-spacing: .08em;
  color: var(--muted-2);
  padding: 0 12px 8px;
  font-weight: 600;
}
.nav__item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  font-weight: 500;
  margin-bottom: 2px;
  transition: background var(--t), color var(--t), transform var(--t);
  cursor: pointer;
  position: relative;
}
.nav__item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav__item:hover { background: var(--bg-2); color: var(--ink); }
.nav__item.is-active {
  background: var(--ink);
  color: #fff;
}
.nav__item.is-active svg { opacity: 1; }
.nav__item.is-active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 2px 2px 0;
  background: var(--lime);
}
.badge {
  margin-left: auto;
  font-size: 11px;
  background: var(--bg-2);
  color: var(--muted);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.nav__item.is-active .badge { background: rgba(255,255,255,.12); color: #fff; }
.badge--new:not(:empty) { background: var(--lime); color: var(--ink); }
.badge--pulse:not(:empty) { animation: badgePulse 1.6s ease-in-out infinite; }
@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(184,212,49,.6); }
  50% { box-shadow: 0 0 0 6px rgba(184,212,49,0); }
}

/* Unchecked-import marker on rows + cells */
.is-unchecked { background: rgba(225,29,72,.04); }
.is-unchecked td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.unchecked-pill {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(225,29,72,.08); color: var(--danger);
  padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700;
}

/* Order card collapsed/expanded chrome */
.order-card__head { gap: 12px; }
.order-card__head .icon-btn { color: var(--muted); }
.attachment__icon img { display: block; }
.sidebar__foot {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.user { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.user__avatar {
  width: 36px; height: 36px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--lime), var(--lime-600));
  color: var(--ink);
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
}
.user__name { font-weight: 600; font-size: 13px; }
.user__role { font-size: 12px; color: var(--muted); }

/* ====== top bar ====== */
.main {
  min-width: 0;
  display: flex; flex-direction: column;
}
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.85);
  backdrop-filter: saturate(160%) blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.topbar__menu { display: none; }
.search {
  flex: 1;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-1);
  transition: border-color var(--t), background var(--t);
  max-width: 640px;
}
.search:focus-within { border-color: var(--ink); background: #fff; }
.search svg { width: 16px; height: 16px; color: var(--muted); flex-shrink: 0; }
.search input { flex: 1; border: 0; background: none; outline: none; color: var(--ink); }
.search input::placeholder { color: var(--muted); }
.search kbd, .cmdk__search kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--muted);
}
.topbar__right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  position: relative;
  transition: background var(--t), color var(--t);
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .dot {
  position: absolute; top: 9px; right: 9px;
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--lime); box-shadow: 0 0 0 2px #fff;
}

/* ====== buttons ====== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px;
  border-radius: var(--r-sm);
  font-weight: 600; font-size: 13px;
  transition: transform var(--t), box-shadow var(--t), background var(--t), color var(--t), border-color var(--t);
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--lime); color: var(--ink); }
.btn--primary:hover { background: var(--lime-600); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn--ghost { background: transparent; color: var(--ink-3); }
.btn--ghost:hover { background: var(--bg-2); color: var(--ink); }
.btn--outline { background: #fff; color: var(--ink); border: 1px solid var(--line-2); }
.btn--outline:hover { border-color: var(--ink); }
.btn--dark { background: var(--ink); color: #fff; }
.btn--dark:hover { background: var(--ink-2); }
.btn--sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn--danger { background: #fff; color: var(--danger); border: 1px solid #fecaca; }
.btn--danger:hover { background: #fee2e2; }
.btn--icon { padding: 0; width: 38px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; pointer-events: none; }

/* ====== route container ====== */
.route { padding: 28px 28px 60px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head__title { display: flex; align-items: center; gap: 16px; }
.page-head h1 {
  margin: 0; font-size: 26px; letter-spacing: -.02em; font-weight: 700;
}
.page-head__sub { color: var(--muted); margin-top: 4px; font-size: 14px; max-width: 720px; }
.page-head__count {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 999px;
  background: var(--lime-50); color: #647e0b;
  font-weight: 700; font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ====== toolbar ====== */
.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 16px;
}
.toolbar__search {
  flex: 1; min-width: 200px;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.toolbar__search:focus-within { border-color: var(--ink); }
.toolbar__search svg { width: 14px; height: 14px; color: var(--muted); }
.toolbar__search input { border: 0; background: none; outline: none; flex: 1; }
.chip {
  height: 32px; padding: 0 12px;
  border-radius: 999px; font-size: 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-2); background: #fff;
  color: var(--ink-3);
  transition: all var(--t);
  cursor: pointer;
}
.chip:hover { border-color: var(--ink-3); }
.chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip__count { opacity: .6; font-variant-numeric: tabular-nums; }

/* ====== card / table ====== */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.card + .card { margin-top: 16px; }
.card__head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
}
.card__head h3 { margin: 0; font-size: 15px; }
.card__body { padding: 18px; }

table.tbl {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
table.tbl th {
  text-align: left; font-weight: 600; color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  padding: 12px 16px; background: var(--bg-1);
  border-bottom: 1px solid var(--line);
}
table.tbl td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.tbl tr.is-clickable:hover td { background: var(--bg-1); cursor: pointer; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl .actions { text-align: right; white-space: nowrap; }
.tbl-empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.tbl-empty h4 { margin: 0 0 8px; color: var(--ink); }

/* ====== tags / status ====== */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--bg-2); color: var(--ink-3);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.tag--lime { background: var(--lime-50); color: #5d7409; border-color: #d5e68a; }
.tag--ink { background: var(--ink); color: #fff; border-color: var(--ink); }
.tag--warn { background: #fef3c7; color: #92400e; border-color: #fcd34d; }
.tag--danger { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.tag--blue { background: #dbeafe; color: #1e3a8a; border-color: #93c5fd; }
.tag--phase { background: #111; color: var(--lime); border-color: #111; padding: 2px 7px; font-family: 'JetBrains Mono', monospace; }

.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 999px; background: var(--muted); }
.status-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.status-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(245,158,11,.15); }
.status-dot.danger { background: var(--danger); box-shadow: 0 0 0 3px rgba(225,29,72,.15); }

.stars { display: inline-flex; gap: 2px; color: #d4d4d4; }
.stars .on { color: #f59e0b; }
.stars svg { width: 14px; height: 14px; }

/* ====== thumb ====== */
.thumb {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--lime-50), #fff);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}
.thumb--lg { width: 60px; height: 60px; }
.thumb__init {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700; font-size: 13px;
  color: var(--ink-3);
  letter-spacing: -.02em;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ====== form ====== */
.form { display: grid; gap: 14px; }
.form__row { display: grid; gap: 6px; }
.form__row--2 { grid-template-columns: 1fr 1fr; gap: 12px; }
.form__row--3 { grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form__label {
  font-size: 12px; font-weight: 600; color: var(--ink-3);
  display: flex; align-items: center; justify-content: space-between;
}
.form__label .hint { font-weight: 500; color: var(--muted); font-size: 11px; }
.form__input, .form__select, .form__textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: #fff;
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  font-size: 13px;
  color: var(--ink);
}
.form__input:focus, .form__select:focus, .form__textarea:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px rgba(184,212,49,.18);
}
.form__textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.form__select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'><path d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 32px;
}
.form__hint { font-size: 12px; color: var(--muted); }
.form__error { font-size: 12px; color: var(--danger); }

.tagger {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: #fff;
  min-height: 42px;
}
.tagger input {
  flex: 1; min-width: 100px;
  border: 0; outline: none; padding: 4px;
  font-size: 13px; background: none;
}
.tagger .tag {
  cursor: default; padding-right: 4px;
  display: inline-flex; align-items: center; gap: 4px;
}
.tagger .tag button {
  width: 16px; height: 16px;
  display: grid; place-items: center;
  border-radius: 999px;
  color: var(--muted);
}
.tagger .tag button:hover { color: var(--danger); background: #fff; }

.dropzone {
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-md);
  padding: 18px;
  text-align: center;
  color: var(--muted);
  background: var(--bg-1);
  transition: all var(--t);
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-drag { border-color: var(--lime); background: var(--lime-50); color: var(--ink-3); }
.dropzone__icon { width: 28px; height: 28px; margin: 0 auto 8px; opacity: .6; }
.attachments { display: grid; gap: 6px; margin-top: 10px; }
.attachment {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  font-size: 12px;
}
.attachment__icon { width: 28px; height: 28px; border-radius: 6px; background: var(--lime-50); display: grid; place-items: center; }
.attachment__name { flex: 1; font-weight: 500; }
.attachment__size { color: var(--muted); }
.attachment button { color: var(--muted); padding: 4px; }
.attachment button:hover { color: var(--danger); }

/* ====== modal ====== */
.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 32px;
  animation: fadein 200ms ease;
}
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute; inset: 0;
  background: rgba(13,17,23,.45);
  backdrop-filter: blur(6px);
}
.modal__panel {
  position: relative;
  width: min(720px, 100%);
  max-height: calc(100vh - 64px);
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: pop 240ms cubic-bezier(.22,1.2,.36,1);
}
.modal__panel--lg { width: min(960px, 100%); }
.modal__panel--xl { width: min(1200px, 100%); }
.modal__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
}
.modal__head h3 { margin: 0; font-size: 17px; }
.modal__body { padding: 22px; overflow-y: auto; flex: 1; }
.modal__foot {
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  background: var(--bg-1);
}
.modal__foot__left { display: flex; gap: 8px; }
.modal__foot__right { display: flex; gap: 8px; margin-left: auto; }

@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* ====== toast ====== */
.toasts {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  min-width: 220px;
  animation: slidein 240ms cubic-bezier(.22,1.2,.36,1);
  pointer-events: auto;
}
.toast--ok { border-left: 3px solid var(--lime); }
.toast--err { border-left: 3px solid var(--danger); }
.toast--info { border-left: 3px solid var(--info); }
.toast svg { width: 16px; height: 16px; }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ====== command palette ====== */
.cmdk {
  position: fixed; inset: 0; z-index: 150;
  display: grid; place-items: start center;
  padding-top: 12vh;
}
.cmdk[hidden] { display: none; }
.cmdk__bd { position: absolute; inset: 0; background: rgba(13,17,23,.4); backdrop-filter: blur(6px); }
.cmdk__panel {
  position: relative;
  width: min(640px, 92%);
  background: #fff;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pop 200ms cubic-bezier(.22,1.2,.36,1);
}
.cmdk__search {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.cmdk__search svg { width: 18px; height: 18px; color: var(--muted); }
.cmdk__search input {
  flex: 1; border: 0; outline: none; font-size: 16px; background: none;
}
.cmdk__list { max-height: 420px; overflow-y: auto; padding: 8px; }
.cmdk__group { padding: 4px; }
.cmdk__group__label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600;
  padding: 8px 10px 4px;
}
.cmdk__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background var(--t);
}
.cmdk__item:hover, .cmdk__item.is-active { background: var(--bg-2); }
.cmdk__item .thumb { width: 30px; height: 30px; }
.cmdk__item__title { font-weight: 500; flex: 1; }
.cmdk__item__sub { color: var(--muted); font-size: 12px; }
.cmdk__empty { padding: 40px 20px; text-align: center; color: var(--muted); }

/* ====== dashboard ====== */
.dash-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(4, 1fr);
}
.dash-grid--3 { grid-template-columns: repeat(3, 1fr); }
.dash-grid--2 { grid-template-columns: repeat(2, 1fr); }
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px;
  display: flex; flex-direction: column; gap: 6px;
  position: relative;
  overflow: hidden;
}
.kpi__label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi__value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi__sub { font-size: 12px; color: var(--muted); }
.kpi__delta { font-size: 12px; font-weight: 600; }
.kpi__delta.up { color: var(--ok); }
.kpi__delta.down { color: var(--danger); }
.kpi--lime { background: var(--lime); }
.kpi--lime .kpi__label { color: rgba(13,17,23,.6); }
.kpi--lime .kpi__value { color: var(--ink); }
.kpi--dark { background: var(--ink); color: #fff; }
.kpi--dark .kpi__label { color: rgba(255,255,255,.5); }
.kpi--dark .kpi__value { color: #fff; }

.spark {
  width: 100%; height: 36px; margin-top: 4px;
}
.spark path { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ====== recipe ====== */
.recipe {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}
@media (max-width: 1100px) { .recipe { grid-template-columns: 1fr; } }
.recipe-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.recipe-table th {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600;
  padding: 8px 12px; text-align: left;
  border-bottom: 1px solid var(--line);
}
.recipe-table td { padding: 6px 12px; border-bottom: 1px solid var(--line); }
.recipe-row { transition: background var(--t); }
.recipe-row:hover { background: var(--bg-1); }
.recipe-row .grip {
  cursor: grab; color: var(--muted-2); width: 16px;
  display: inline-grid; place-items: center;
}
.recipe-row.dragging { opacity: .35; }
.recipe-row.over { box-shadow: inset 0 2px 0 0 var(--lime); }
.recipe-phase td {
  background: #111;
  color: var(--lime);
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 8px;
}
.recipe-phase td .grip { color: rgba(255,255,255,.4); }
.recipe-total td {
  background: var(--lime-50);
  font-weight: 700; color: #4d6308;
  border-top: 2px solid var(--lime);
}
.recipe-total td.error { background: #fee2e2; color: #b91c1c; border-color: var(--danger); }

.steps { padding-left: 22px; counter-reset: step; }
.steps li {
  list-style: none; position: relative;
  padding: 12px 14px 12px 14px;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: -14px; top: 14px;
  width: 26px; height: 26px;
  border-radius: 999px;
  background: var(--ink); color: #fff;
  font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
  font-family: 'JetBrains Mono', monospace;
}
.steps li.is-checkpoint {
  background: #fff8e1; border-color: #fde68a;
}
.steps li.is-checkpoint::before {
  background: var(--warn);
}
.step-actions { display: flex; gap: 4px; }

/* ====== calendar ====== */
.cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line);
}
.cal__head {
  background: var(--bg-1);
  padding: 12px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 600; color: var(--muted); text-align: center;
}
.cal__day {
  background: #fff;
  padding: 10px;
  min-height: 110px;
  display: flex; flex-direction: column; gap: 6px;
  cursor: pointer;
  transition: background var(--t);
}
.cal__day:hover { background: var(--bg-1); }
.cal__day--out { background: var(--bg-2); color: var(--muted); }
.cal__day--today .cal__date {
  background: var(--ink); color: #fff;
  width: 24px; height: 24px; border-radius: 999px;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}
.cal__date { font-size: 13px; font-weight: 600; }
.cal__event {
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 4px;
  background: var(--lime-50);
  color: #4d6308;
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-left: 3px solid var(--lime);
  cursor: pointer;
  transition: transform var(--t);
}
.cal__event:hover { transform: translateX(2px); }
.cal-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.cal-toolbar__title { font-size: 18px; font-weight: 700; min-width: 200px; }

/* ====== detail / right rail ====== */
.detail {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
}
@media (max-width: 1000px) { .detail { grid-template-columns: 1fr; } }
.detail__rail {
  display: flex; flex-direction: column; gap: 16px;
}
.fact-list { display: grid; gap: 10px; font-size: 13px; }
.fact { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.fact__k { color: var(--muted); font-size: 12px; }
.fact__v { font-weight: 600; text-align: right; }
.fact__v.muted { color: var(--muted); font-weight: 400; }

.history { display: grid; gap: 6px; }
.history__row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px;
  padding: 8px 0; font-size: 13px;
  border-bottom: 1px dashed var(--line);
}
.history__row:last-child { border: 0; }
.history__date { color: var(--muted); font-size: 12px; }
.history__price { font-weight: 700; font-variant-numeric: tabular-nums; }
.history__delta { font-size: 11px; font-weight: 600; }

/* ====== protocol print ====== */
.protocol {
  background: #fff;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.protocol__head {
  display: grid; grid-template-columns: 1fr auto;
  gap: 14px; padding-bottom: 18px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 20px;
}
.protocol__head h2 { margin: 0; font-size: 22px; }
.protocol__meta {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px;
}
.protocol__meta dt { color: var(--muted); }
.protocol__meta dd { margin: 0; font-weight: 600; }
.protocol-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.protocol-table th, .protocol-table td {
  padding: 8px 10px;
  border: 1px solid var(--line-2);
  text-align: left;
  vertical-align: top;
}
.protocol-table th { background: var(--bg-1); font-weight: 600; }
.protocol-table .empty { height: 32px; }
.protocol h4 { margin: 22px 0 8px; font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

@media print {
  body * { visibility: hidden; }
  .protocol, .protocol * { visibility: visible; }
  .protocol { position: absolute; left: 0; top: 0; width: 100%; border: 0; padding: 0; }
  @page { size: A4 landscape; margin: 12mm; }
  .no-print { display: none !important; }
}

/* ====== misc ====== */
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  font-size: 13px;
  margin-bottom: 14px;
}
.alert--warn { background: #fef3c7; color: #92400e; border-left: 3px solid var(--warn); }
.alert--info { background: #dbeafe; color: #1e3a8a; border-left: 3px solid var(--info); }
.alert--ok { background: var(--lime-50); color: #4d6308; border-left: 3px solid var(--lime); }
.alert--danger { background: #fee2e2; color: #991b1b; border-left: 3px solid var(--danger); }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; }

.divider { height: 1px; background: var(--line); margin: 16px 0; }
.flex { display: flex; gap: 8px; align-items: center; }
.flex-1 { flex: 1; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.bold { font-weight: 600; }
.tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: 'JetBrains Mono', monospace; }

.combobox { position: relative; }
.combobox__list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-md);
  z-index: 5;
  max-height: 240px; overflow-y: auto;
}
/* Portal variant: rendered into <body> with fixed positioning so it never
   gets clipped by overflow:hidden cards or scrolling modal bodies. */
.combobox__list--portal {
  position: fixed; left: 0; top: 0; right: auto;
  z-index: 250;
  overflow-y: auto;
}
.combobox__opt {
  padding: 10px 12px;
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  font-size: 13px;
  min-height: 38px;
}
.combobox__opt:hover, .combobox__opt.is-active { background: var(--bg-2); }
.combobox__opt--new { color: var(--info); font-weight: 600; }

/* ====== segmented control ====== */
.seg {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 2px;
}
.seg__btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  border-radius: 6px;
  white-space: nowrap;
  transition: background var(--t), color var(--t);
}
.seg__btn:hover { color: var(--ink); }
.seg__btn.is-active { background: var(--ink); color: #fff; }

/* ====== prep / orders item rows ====== */
.prep-items td { vertical-align: middle; }
.prep-item--child td:first-child {
  position: relative;
  padding-left: 28px;
}
.prep-item--child td:first-child::before {
  content: "";
  position: absolute;
  left: 14px; top: 0; bottom: 0;
  border-left: 2px dotted var(--line-3);
}
.prep-item--child td { background: var(--bg-1); }
.prep-item--converted td { opacity: .55; text-decoration: line-through; }
.prep-item--converted .tag { text-decoration: none; opacity: 1; }

/* ====== prep / orders log ====== */
.prep-log {
  display: grid; gap: 8px;
  font-size: 13px;
  max-height: 260px; overflow-y: auto;
}
.prep-log__row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px;
  padding: 8px 12px;
  background: var(--bg-1);
  border-radius: var(--r-sm);
  border-left: 3px solid var(--lime);
}
.prep-log__date { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.prep-log__text { color: var(--ink-3); }

/* ====== bulk-action bar ====== */
.bulk-bar {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  z-index: 80;
  display: flex; align-items: center; gap: 14px;
  font-size: 13px;
  animation: slidein 220ms cubic-bezier(.22,1.2,.36,1);
}
.bulk-bar select { color: var(--ink); height: 30px; padding: 0 10px; font-size: 12px; }
.bulk-bar .btn--ghost { color: rgba(255,255,255,.8); }
.bulk-bar .btn--ghost:hover { background: rgba(255,255,255,.1); color: #fff; }

/* ====== order card ====== */
.order-card .card__head { cursor: pointer; transition: background var(--t); }
.order-card .card__head:hover { background: var(--bg-1); }

/* ====== responsive ====== */

/* Tablet — under 900px */
@media (max-width: 900px) {
  #app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0;
    z-index: 50; width: 280px; max-width: 86vw;
    transform: translateX(-100%);
    transition: transform var(--t);
    overflow-y: auto;
  }
  .sidebar.is-open { transform: none; box-shadow: var(--shadow-lg); }
  .sidebar__close { display: grid; }
  .topbar__menu { display: grid; }

  .topbar { padding: 12px 16px; gap: 10px; }
  .route { padding: 18px 16px 60px; }
  .search { max-width: none; }
  .search kbd { display: none; }

  .page-head { margin-bottom: 18px; gap: 12px; }
  .page-head h1 { font-size: 22px; }
  .toolbar { padding: 10px; gap: 8px; }

  .dash-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .dash-grid--3 { grid-template-columns: 1fr; }
  .dash-grid--2 { grid-template-columns: 1fr; }

  .form__row--2, .form__row--3 { grid-template-columns: 1fr; }

  /* tables horizontally scroll inside their card so all columns stay readable */
  .card { overflow-x: auto; overflow-y: visible; -webkit-overflow-scrolling: touch; }
  table.tbl { min-width: 640px; }

  /* modal goes near full-screen */
  .modal { padding: 0; }
  .modal__panel,
  .modal__panel--lg,
  .modal__panel--xl {
    width: 100%; max-width: 100%;
    height: 100vh; max-height: 100vh;
    border-radius: 0;
  }
  .modal__head { padding: 14px 16px; }
  .modal__head h3 { font-size: 15px; }
  .modal__body { padding: 16px; }
  .modal__foot { padding: 12px 16px; flex-wrap: wrap-reverse; gap: 8px; }
  .modal__foot__left, .modal__foot__right { width: 100%; gap: 8px; }
  .modal__foot__right { justify-content: flex-end; margin-left: 0; }
  .modal__foot__right .btn { flex: 1; min-width: 0; }

  /* command palette padding */
  .cmdk { padding-top: 6vh; }
  .cmdk__panel { width: 95%; }
}

/* Phone — under 640px */
@media (max-width: 640px) {
  .route { padding: 14px 12px 56px; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .topbar__right .btn { display: none; }
  .search { padding: 8px 12px; }
  .search input { font-size: 16px; /* prevents iOS zoom */ }

  .page-head { flex-direction: column; align-items: stretch; margin-bottom: 14px; }
  .page-head__title h1 { font-size: 20px; }
  .page-head__sub { font-size: 13px; }
  .page-head__actions { gap: 6px; }
  .page-head__actions .btn { flex: 1; justify-content: center; }

  .toolbar { border-radius: var(--r-sm); padding: 8px; }
  .toolbar__search { flex-basis: 100%; min-width: 0; }
  .chip { font-size: 11px; padding: 0 10px; height: 28px; }

  .dash-grid { grid-template-columns: 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi__value { font-size: 22px; }

  /* forms */
  .form { gap: 12px; }
  .form__input, .form__select, .form__textarea { font-size: 16px; padding: 11px 12px; }
  .form__row--2, .form__row--3 { grid-template-columns: 1fr; gap: 10px; }

  /* details / recipe column stacking */
  .detail { grid-template-columns: 1fr; gap: 12px; }
  .recipe { grid-template-columns: 1fr; }

  /* cards */
  .card__head { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .card__head h3 { font-size: 14px; }
  .card__body { padding: 14px; }

  /* recipe table — stay readable */
  .recipe-table { font-size: 12px; }
  .recipe-table th, .recipe-table td { padding: 6px 8px; }
  /* horizontal scroll for recipe table on tiny screens */
  .card__body { overflow-x: auto; }

  /* tables tighter */
  table.tbl th, table.tbl td { padding: 10px 12px; font-size: 12px; }

  /* tap-friendly */
  .btn { height: 42px; padding: 0 16px; font-size: 13px; }
  .btn--sm { height: 32px; padding: 0 12px; }
  .icon-btn { width: 40px; height: 40px; }

  /* combobox dropdown clamp to viewport (overrides inline JS positioning) */
  .combobox__list--portal {
    max-width: calc(100vw - 16px) !important;
    min-width: 0 !important;
  }

  /* toasts span full width */
  .toasts { bottom: 12px; right: 12px; left: 12px; }
  .toast { min-width: 0; }

  /* bulk action bar */
  .bulk-bar {
    bottom: 12px; left: 12px; right: 12px; transform: none;
    border-radius: var(--r-md); flex-wrap: wrap; padding: 10px 14px;
  }

  /* calendar */
  .cal__day { min-height: 68px; padding: 6px 4px; gap: 3px; }
  .cal__date { font-size: 11px; }
  .cal__event { font-size: 10px; padding: 2px 4px; border-left-width: 2px; }
  .cal__head { padding: 8px 4px; font-size: 10px; }
  .cal-toolbar { flex-wrap: wrap; gap: 8px; }
  .cal-toolbar__title { min-width: 0; font-size: 16px; flex: 1; }

  /* protocol print */
  .protocol__head { grid-template-columns: 1fr; }
  .protocol { padding: 16px; }

  /* prep log compact */
  .prep-log__row { grid-template-columns: 1fr; gap: 4px; padding: 8px 10px; }

  /* history rows */
  .history__row { grid-template-columns: 1fr auto; row-gap: 2px; }
  .history__delta { grid-column: 2; text-align: right; }

  /* attachment item layout */
  .attachment { padding: 10px; }
  .attachment__name { font-size: 13px; word-break: break-word; }

  /* segmented control — wrap */
  .seg { flex-wrap: wrap; }
  .seg__btn { padding: 8px 10px; }

  /* hide global ⌘K hint indicator on mobile */
  .search kbd { display: none; }
}

/* Very tiny phones */
@media (max-width: 380px) {
  .page-head h1 { font-size: 18px; }
  .kpi__value { font-size: 20px; }
  .route { padding: 12px 10px 50px; }
  .topbar { padding: 8px 10px; }
  .modal__foot { flex-direction: column-reverse; }
  .modal__foot__right .btn { width: 100%; }
}

/* ============== additions: PR detail, sklad surovin, faktury ============== */
/* key/value rows in the status section cards */
.kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.kv:last-child { border-bottom: 0; }
.kv .muted { font-size: 12px; }

/* compact table variant used by the PR item tracking grid */
.tbl--compact th,
.tbl--compact td { padding: 8px 10px; font-size: 12.5px; }
.tbl--compact thead th { white-space: nowrap; }

/* simple history timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  padding: 6px 0 6px 18px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
}
.timeline li:last-child { border-bottom: 0; }
.timeline li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 12px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
}

/* invoice upload dropzone */
.invoice-drop {
  border: 2px dashed var(--line-3);
  border-radius: var(--r-md);
  background: var(--bg-1);
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  transition: border-color var(--t), background var(--t);
}
.invoice-drop svg { width: 32px; height: 32px; stroke: var(--muted-2); }
.invoice-drop.is-over { border-color: var(--lime-600); background: var(--lime-50); }

/* demo-mode banner (fixed, full-width) */
.demo-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 1000;
  background: var(--warn);
  color: #1f1300;
  font-weight: 700;
  font-size: 13px;
  text-align: center;
  padding: 8px 16px;
  box-shadow: 0 -2px 10px rgba(0,0,0,.12);
}
body.has-demo-banner .main { padding-bottom: 44px; }

/* ============== gv.docx — workflow v3 ============== */
.dot-status { display: inline-flex; align-items: center; gap: 6px; }
.dot-status__c { width: 9px; height: 9px; border-radius: 999px; display: inline-block; flex: 0 0 auto; }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg__btn { border: 0; background: #fff; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--muted); }
.seg__btn + .seg__btn { border-left: 1px solid var(--line); }
.seg__btn.is-active { background: var(--ink, #0d1117); color: #fff; }

.unchecked-pill { display: inline-block; background: #fee2e2; color: #dc2626; font-weight: 700; font-size: 11px; padding: 2px 8px; border-radius: 999px; letter-spacing: .02em; }

.invoice-actions { white-space: nowrap; }
.invoice-actions .btn { margin: 0 2px; }

.lnk { color: #2563eb; cursor: pointer; text-decoration: none; font-size: 13px; }
.lnk:hover { text-decoration: underline; }
.lnk svg { width: 13px; height: 13px; vertical-align: -1px; }
