:root {
  --bg: #f5f8f7;
  --surface: #ffffff;
  --surface-soft: #f8fbfa;
  --text: #102a32;
  --muted: #60737a;
  --line: #dde8e4;
  --blue: #0f4c5c;
  --blue-soft: #e6f1f2;
  --green: #6f9f58;
  --green-soft: #eef7ef;
  --orange: #b75e04;
  --orange-soft: #fff4e4;
  --red: #c03636;
  --red-soft: #ffecec;
  --shadow: 0 16px 40px rgba(16, 42, 50, .08);
  --radius: 8px;
  --sidebar: 280px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); color: var(--text); }
body { margin: 0; min-height: 100vh; font-size: 15px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar) 1fr; }
.sidebar {
  position: sticky; top: 0; height: 100vh; background: #0b2f38; color: #eef7f4;
  padding: 20px 14px; display: flex; flex-direction: column; gap: 22px; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 8px 10px; font-weight: 760; font-size: 18px; }
.brand-mark { width: 38px; height: 38px; border-radius: 8px; background: linear-gradient(135deg, #7fb069, #0f4c5c); display: grid; place-items: center; color: white; }
.brand-logo { width: 118px; height: 42px; object-fit: contain; flex: 0 0 auto; }
.brand-copy { display: grid; gap: 2px; min-width: 0; line-height: 1.05; }
.brand-copy strong { font-size: 17px; font-weight: 900; letter-spacing: .02em; }
.brand-copy small { color: #b8cdc9; font-size: 11px; font-weight: 650; line-height: 1.2; }
.nav { display: grid; gap: 6px; }
.nav a {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 12px;
  border-radius: var(--radius); color: #cbd5e1; transition: .18s ease;
}
.nav a:hover, .nav a.active { background: rgba(255,255,255,.1); color: #fff; }
.main { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 10; height: 72px; background: rgba(245,248,247,.9);
  backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); display: flex;
  align-items: center; justify-content: space-between; padding: 0 28px;
}
.menu-btn { display: none; }
.menu-lines {
  width: 16px;
  height: 12px;
  display: inline-block;
  position: relative;
  border-top: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}
.menu-lines::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 2px solid currentColor;
  transform: translateY(-50%);
}
.page { padding: 28px; max-width: 1480px; margin: 0 auto; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 22px; }
h1 { margin: 0; font-size: 30px; letter-spacing: 0; }
.subtitle { margin: 6px 0 0; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16,42,50,.04); padding: 18px;
}
.metric { display: flex; justify-content: space-between; align-items: center; min-height: 96px; }
.metric strong { font-size: 28px; display: block; }
.metric span { color: var(--muted); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.filter-actions {
  align-self: start;
  box-sizing: border-box;
  margin-bottom: 0;
  padding-top: 25px;
}
.filter-actions .btn {
  min-height: 54px;
}
.taxonomy-create-card {
  align-content: start;
}
.taxonomy-create-card .btn {
  align-self: start;
  justify-content: center;
  width: 100%;
  min-height: 54px;
}
.btn {
  border: 0; border-radius: var(--radius); min-height: 44px; padding: 0 16px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px; font-weight: 680; transition: .16s ease;
}
.btn.primary { background: var(--blue); color: white; }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn:hover { transform: translateY(-1px); }
.table-actions {
  gap: 8px;
  margin-bottom: 0;
  flex-wrap: nowrap;
}
.table-actions .btn {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 10px;
}
.icon-btn {
  width: 40px;
  padding: 0 !important;
  justify-content: center;
}
.doc-icon {
  position: relative;
  width: 16px;
  height: 20px;
  display: inline-block;
  border: 2px solid currentColor;
  border-radius: 3px;
}
.doc-icon::before {
  content: "";
  position: absolute;
  top: -2px;
  right: -2px;
  width: 7px;
  height: 7px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  background: var(--surface);
  transform: translate(-1px, 1px) rotate(0deg);
}
.field { display: grid; gap: 7px; }
.field label { font-size: 13px; color: var(--muted); font-weight: 700; }
.input, .select, .textarea {
  width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: var(--radius);
  background: white; color: var(--text); padding: 10px 12px; outline: none;
}
.textarea { min-height: 90px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: #7fb069; box-shadow: 0 0 0 4px var(--blue-soft); }
.input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.input-action .btn {
  min-height: 50px;
  justify-content: center;
}
.article-db-meta {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: -4px;
}
.article-modal-body {
  align-items: start;
  gap: 18px 22px;
}
.article-modal-body [hidden] {
  display: none !important;
}
.article-modal-body > .field {
  min-width: 0;
}
.article-modal-body .compound-ingredients {
  grid-column: 1 / -1;
  order: 110;
  padding: 16px;
  border: 1px solid #9ac889;
  border-radius: 14px;
  background: linear-gradient(180deg, #f3faf2, #ffffff);
  box-shadow: 0 10px 24px rgba(127, 176, 105, .12);
}
.compound-ingredients-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.compound-ingredients-head .subtitle {
  margin-top: 4px;
}
.ai-ingredients-upload {
  flex: 0 0 auto;
  min-height: 46px;
}
.ai-ingredients-upload.is-loading {
  pointer-events: none;
  opacity: .7;
}
.ai-ingredients-status {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #0f6b4b;
  background: #e9f8ef;
  font-weight: 750;
  line-height: 1.4;
}
.ai-ingredients-status.error {
  color: #b4232c;
  background: #fee8e8;
}
.prep-lot-summary {
  display: grid;
  gap: 6px;
  min-width: 260px;
  max-width: 430px;
}
.prep-lot-item,
.prep-lot-more {
  display: block;
  width: fit-content;
  max-width: 100%;
  padding: 6px 9px;
  border-radius: 10px;
  background: #eef6f3;
  color: #12343a;
  font-size: 13px;
  font-weight: 720;
  line-height: 1.3;
}
.prep-lot-more {
  background: #fff4df;
  color: #995f00;
}
.article-modal-body .article-cost-preview {
  grid-column: 1 / -1;
  order: 95;
  align-items: center;
}
.article-flag-field {
  order: 100;
  min-height: 66px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  grid-template-columns: 1fr auto;
  align-items: center;
}
.article-flag-field span {
  color: var(--text);
  font-size: 14px;
  font-weight: 760;
}
.article-flag-field input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--blue);
}
.discount-modal {
  width: min(560px, calc(100vw - 36px));
}
.discount-list {
  display: grid;
  gap: 10px;
}
.discount-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.discount-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}
.module-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.user-modules-field {
  grid-column: 1 / -1;
}
.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.module-option {
  min-height: 78px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, #fff, var(--surface-soft));
  cursor: pointer;
  transition: .16s ease;
}
.module-option:hover {
  border-color: #9ac889;
  box-shadow: 0 8px 18px rgba(15, 76, 92, .08);
}
.module-option input {
  width: 19px;
  height: 19px;
  margin-top: 1px;
  accent-color: var(--blue);
}
.module-option span {
  font-weight: 820;
  color: var(--text);
}
.module-option small {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
}
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { padding: 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: var(--surface-soft); }
tr:last-child td { border-bottom: 0; }
.bulk-actions { justify-content: space-between; align-items: center; }
.bulk-cell { width: 48px; text-align: center; }
.check-lg { width: 20px; height: 20px; accent-color: var(--blue); cursor: pointer; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 760; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.orange { background: var(--orange-soft); color: var(--orange); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.neutral { background: #edf4f2; color: var(--muted); }
.prep-bulk-card {
  display: grid;
  gap: 16px;
}
.prep-bulk-head,
.prep-bulk-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.prep-bulk-head h2 {
  margin: 0 0 4px;
}
.prep-filter-input {
  min-width: 280px;
}
.prep-bulk-table-wrap {
  border-radius: 16px;
}
.prep-bulk-table {
  min-width: 1080px;
}
.prep-bulk-table th:first-child,
.prep-bulk-table td:first-child {
  width: 58px;
  text-align: center;
}
.prep-bulk-table tr {
  transition: background .18s ease, box-shadow .18s ease;
}
.prep-bulk-table tr.is-selected {
  background: #f2fbf0;
  box-shadow: inset 5px 0 0 var(--sage);
}
.prep-recipe-cell strong {
  display: block;
  color: var(--text);
}
.prep-recipe-cell .subtitle {
  display: block;
  margin-top: 3px;
}
.prep-mobile-meta {
  display: none;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.prep-base-cell small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}
.modal-backdrop, .drawer-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.42); opacity: 0; pointer-events: none;
  transition: .18s ease; z-index: 40;
}
.modal-backdrop.open, .drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  position: fixed; inset: auto 18px 18px auto; width: min(720px, calc(100vw - 36px)); max-height: calc(100vh - 36px);
  overflow: auto; background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  z-index: 50; transform: translateY(18px); opacity: 0; pointer-events: none; transition: .2s ease;
}
.modal.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.modal-head, .modal-foot { padding: 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.modal-foot { border-top: 1px solid var(--line); border-bottom: 0; justify-content: flex-end; }
.modal-body { padding: 18px; }
.toast-stack { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 70; }
.toast { background: #0b2f38; color: white; border-radius: var(--radius); padding: 13px 15px; box-shadow: var(--shadow); }
.suggestions { position: relative; }
.suggestion-menu {
  position: absolute; z-index: 30; top: 100%; left: 0; right: 0; background: white; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; display: none;
}
.suggestion-menu.open { display: block; }
.suggestion-menu button { width: 100%; border: 0; background: white; padding: 12px; text-align: left; cursor: pointer; }
.suggestion-menu button:hover { background: var(--surface-soft); }
.suggestion-empty { padding: 14px; color: var(--muted); font-weight: 750; background: var(--surface-soft); }
.invoice-row { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 12px; }
.invoice-row.has-warning { border-color: #d97706; box-shadow: 0 0 0 4px var(--orange-soft); }
.row-actions { display: flex; gap: 8px; justify-content: flex-end; }
.dropzone {
  border: 2px dashed #b7cdc7; background: white; border-radius: var(--radius); padding: 32px; text-align: center;
}
.skeleton { background: linear-gradient(90deg,#edf4f2,#f8fbfa,#edf4f2); background-size: 200% 100%; animation: shine 1.2s infinite; }
@keyframes shine { to { background-position-x: -200%; } }
@media (max-width: 920px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; transform: translateX(-102%); transition: .2s ease; width: min(86vw, 320px); }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .page { padding: 18px 14px 28px; }
  .page-head, .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; display: grid; }
  h1 { font-size: 25px; }
  .modal { inset: auto 10px 10px 10px; width: auto; }
}

/* Modern app polish */
:root {
  --bg: #f5f8f7;
  --surface-soft: #f8fbfa;
  --line: #dde8e4;
  --text: #102a32;
  --muted: #60737a;
  --blue: #0f4c5c;
  --blue-dark: #0b3b48;
  --blue-soft: #e6f1f2;
  --green: #6f9f58;
  --green-soft: #eef7ef;
  --sidebar: 292px;
}

body {
  line-height: 1.35;
  -webkit-font-smoothing: antialiased;
}

.sidebar {
  background: #0b2f38;
  padding: 18px 12px;
  gap: 18px;
  box-shadow: 8px 0 30px rgba(11, 47, 56, .10);
}

.brand {
  min-height: 54px;
  font-size: 15px;
  border-radius: 10px;
}

.brand .brand-logo {
  width: 88px;
  height: 34px;
}

.brand-mark {
  flex: 0 0 auto;
  box-shadow: 0 10px 22px rgba(15, 76, 92, .28);
}

.nav {
  gap: 16px;
  overflow-y: auto;
  padding: 0 2px 18px;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.24) transparent;
}

.nav::-webkit-scrollbar {
  width: 6px;
}

.nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.22);
  border-radius: 999px;
}

.nav-direct {
  margin-bottom: 2px;
  border: 1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.055);
}

.nav-direct .nav-icon {
  background: rgba(255,255,255,.10);
}

.mobile-filter-toggle {
  display: none;
}

.mobile-filter-toggle strong {
  min-width: 26px;
  min-height: 26px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
}

.mobile-row-card {
  display: none;
}

.nav-section {
  display: grid;
  gap: 8px;
}

.nav-section-toggle {
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 12px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 10px;
  background: rgba(255,255,255,.045);
  color: #dce9e7;
  cursor: pointer;
  text-align: left;
  transition: .16s ease;
}

.nav-section-toggle:hover {
  background: rgba(255,255,255,.08);
}

.nav-section.is-open .nav-section-toggle {
  background: rgba(127,176,105,.14);
  border-color: rgba(127,176,105,.26);
}

.nav-title {
  color: #a8c6c1;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-section-meta {
  min-width: 24px;
  min-height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  color: #dce9e7;
  font-size: 11px;
  font-weight: 850;
}

.nav-chevron {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  opacity: .8;
  transition: .16s ease;
}

.nav-section.is-open .nav-chevron {
  transform: rotate(-135deg);
}

.nav-section-items {
  display: grid;
  gap: 6px;
}

.nav-section:not(.is-open) .nav-section-items {
  display: none;
}

.nav a {
  min-height: 46px;
  padding: 10px 12px;
  color: #dce9e7;
}

.nav a.active {
  background: #ffffff;
  color: #0f4c5c;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(127, 176, 105, .16);
  color: inherit;
  font-size: 12px;
  font-weight: 850;
}

.nav a.active .nav-icon {
  background: var(--green-soft);
  color: var(--green);
}

.topbar {
  height: 68px;
  background: rgba(245, 248, 247, .88);
  padding: 0 24px;
}

.top-title {
  display: grid;
  line-height: 1.05;
  min-width: 0;
}

.top-title span {
  font-weight: 850;
}

.top-title small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.top-mobile-logo {
  display: none;
}

.tenant-switch {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tenant-label {
  display: none;
}

.tenant-switch .select {
  width: min(280px, 34vw);
  min-height: 42px;
  font-size: 14px;
}

.company-pill {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  max-width: min(280px, 34vw);
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.page {
  width: 100%;
  padding: 26px;
}

.page-head h1 {
  font-size: clamp(26px, 3vw, 38px);
  font-weight: 850;
}

.card {
  border-radius: 10px;
  padding: 20px;
}

.btn {
  min-height: 46px;
  border-radius: 10px;
  white-space: nowrap;
}

.btn.primary {
  background: var(--blue);
  box-shadow: 0 12px 22px rgba(15, 76, 92, .20);
}

.btn.primary:hover {
  background: var(--blue-dark);
}

.menu-btn {
  display: none;
}

.input, .select, .textarea {
  min-height: 50px;
  border-radius: 10px;
  font-size: 16px;
}

.field label {
  font-size: 12px;
  text-transform: none;
}

.badge {
  min-height: 30px;
  border-radius: 999px;
  font-size: 12px;
}

.dropzone {
  min-height: 170px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff, #f8fbfa);
}

.dropzone input {
  max-width: 100%;
}
.document-type-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.document-type-switch label {
  min-height: 96px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 10px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: .16s ease;
}
.document-type-switch label.active,
.document-type-switch label:has(input:checked) {
  border-color: #7fb069;
  background: linear-gradient(180deg, #f3faf2, #fff);
  box-shadow: 0 10px 22px rgba(127, 176, 105, .14);
}
.document-type-switch input {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--blue);
}
.document-type-switch span {
  color: var(--text);
  font-size: 16px;
  font-weight: 850;
}
.document-type-switch small {
  grid-column: 2;
  color: var(--muted);
  font-size: 12px;
}

input[type="file"] {
  width: min(100%, 440px);
  color: var(--muted);
  font-size: 14px;
}

input[type="file"]::file-selector-button {
  min-height: 42px;
  margin-right: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  padding: 0 14px;
  font-weight: 750;
}

.ai-loading-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid #bfd7ce;
  border-radius: 12px;
  background: linear-gradient(180deg, #f6fbf8, #ffffff);
  box-shadow: 0 14px 30px rgba(15, 76, 92, .08);
}

.ai-loading-panel[hidden] {
  display: none;
}

.ai-loading-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-progress {
  position: relative;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e3efeb;
}

.ai-progress span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 44%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f4c5c, #7fb069, #0f4c5c);
  animation: ai-progress-slide 1.05s ease-in-out infinite;
}

@keyframes ai-progress-slide {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(240%); }
}

.invoice-row {
  border-radius: 12px;
  padding: 18px;
  gap: 16px;
  box-shadow: 0 12px 30px rgba(16, 42, 50, .04);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease;
}

.ai-preview-lines {
  gap: 20px;
}

.ai-preview-card {
  position: relative;
  overflow: hidden;
}

.ai-preview-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: var(--orange);
}

.ai-preview-card.is-processed::before {
  background: var(--green);
}

.ai-preview-card.needs-link::before {
  width: 8px;
  background: var(--red);
}

.invoice-row.needs-link {
  border-color: #f1a6a6;
}

.ai-preview-card.needs-attention::before {
  width: 8px;
  background: var(--red);
}

.invoice-row.is-processed {
  border-color: #9ac889;
  background: linear-gradient(180deg, #fbfefb, #f1f8ef);
  box-shadow: 0 16px 34px rgba(127, 176, 105, .15);
}

.invoice-row.is-processed.is-collapsed {
  padding-block: 12px;
  gap: 8px;
  background: #f4fbf2;
  box-shadow: 0 10px 24px rgba(127, 176, 105, .12);
}

.invoice-row.is-processed.is-collapsed .preview-grid,
.invoice-row.is-processed.is-collapsed .create-article-card,
.invoice-row.is-processed.is-collapsed .calc-strip {
  display: none !important;
}

.invoice-row.is-processed.is-collapsed .row-last-data {
  display: none;
}

.invoice-row.is-processed.is-collapsed .weak-suggestion {
  display: none !important;
}

.invoice-row.is-processed.is-collapsed > .toolbar:first-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.invoice-row.is-processed.is-collapsed .row-actions-bar {
  margin: 0;
}

.invoice-row.is-processed.is-collapsed .row-actions-bar .btn:not([data-toggle-row-details]) {
  display: none;
}

.invoice-row.is-processed > .toolbar:first-child {
  border-bottom-color: #d8ead1;
}

.invoice-row.needs-attention {
  border-color: #f1a6a6;
  background: linear-gradient(180deg, #fffafa, #fff5f5);
  box-shadow: 0 0 0 4px var(--red-soft), 0 18px 34px rgba(192, 54, 54, .10);
}

.invoice-row.needs-attention > .toolbar:first-child {
  border-bottom-color: #ffd3d3;
}

.invoice-row.is-creating-article {
  border-color: #9ac889;
  background: linear-gradient(180deg, #fbfefb, #f3faf2);
  box-shadow: 0 16px 34px rgba(127, 176, 105, .13);
}

.invoice-row.is-creating-article::before {
  background: var(--green);
}

.invoice-row.is-creating-article [data-associa-articolo],
.invoice-row.is-creating-article .weak-suggestion {
  display: none !important;
}

.invoice-row.is-creating-article .row-status-text {
  color: #256b37;
}

.invoice-row > .toolbar:first-child {
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.invoice-row > .toolbar:first-child .subtitle {
  margin: 0;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.row-status-text {
  color: var(--text);
  font-weight: 750;
}

.weak-suggestion {
  color: var(--orange);
  font-weight: 750;
}

.row-actions-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 0;
}

.row-actions-bar .btn {
  min-width: 112px;
  justify-content: center;
}

.preview-grid {
  grid-template-columns: minmax(240px, 1.2fr) minmax(260px, 1.5fr) minmax(160px, .8fr);
  align-items: end;
}

.create-article-card {
  background: #fbfdfc;
  border-style: dashed;
  margin-top: 2px;
}

.create-article-actions {
  grid-column: 1 / -1;
  margin: 0;
  padding-top: 2px;
  align-items: center;
  justify-content: flex-start;
}

.create-article-actions .btn {
  min-width: 230px;
  justify-content: center;
}

.recipe-ingredient-row {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.recipe-ingredient-row.is-processed {
  border-color: #9ac889;
  background: linear-gradient(180deg, #fbfefb, #f1f8ef);
}

.recipe-ingredient-row.needs-attention {
  border-color: #f1a6a6;
  background: linear-gradient(180deg, #fffafa, #fff5f5);
}

.recipe-line-breakdown {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border: 1px solid #c8ddd7;
  border-radius: 12px;
  background: #fff;
}

.recipe-line-breakdown span {
  display: grid;
  gap: 4px;
  min-height: 50px;
  align-content: center;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface-soft);
}

.recipe-line-breakdown small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 780;
}

.recipe-line-breakdown strong {
  color: var(--text);
  font-size: 14px;
}

.recipe-article-field {
  grid-column: 1 / -1;
}

.recipe-article-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.recipe-row-statusbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}

.recipe-row-statusbar .subtitle {
  margin: 0;
  flex: 1 1 260px;
}

.recipe-fix-btn {
  min-height: 38px;
  padding: 8px 14px;
  color: var(--blue);
  background: #fff;
}

.recipe-article-label {
  cursor: pointer;
  background: #fff;
}

.recipe-iva-editable {
  border-color: #d97706;
  background: #fff8ed;
  box-shadow: 0 0 0 3px var(--orange-soft);
}

.recipe-picker-modal {
  width: min(1040px, calc(100vw - 36px));
}

.recipe-picker-results {
  display: grid;
  gap: 10px;
  max-height: min(58vh, 560px);
  overflow: auto;
}

.recipe-picker-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  padding: 14px;
  display: grid;
  gap: 7px;
  text-align: left;
  cursor: pointer;
  transition: .16s ease;
}

.recipe-picker-item:hover {
  border-color: var(--blue);
  box-shadow: 0 10px 24px rgba(15, 76, 92, .12);
  transform: translateY(-1px);
}

.recipe-picker-main {
  font-size: 16px;
  font-weight: 780;
  color: var(--text);
}

.recipe-picker-meta,
.recipe-picker-supplier,
.recipe-picker-empty {
  color: var(--muted);
  font-size: 13px;
}

.recipe-picker-supplier {
  color: var(--blue);
}

.recipe-picker-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.allergen-card {
  border-color: #c8ddd7;
}

.allergen-suggestions {
  margin: 12px 0 16px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.allergen-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.allergen-option {
  min-height: 62px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 12px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 10px;
  align-items: start;
  cursor: pointer;
  transition: .16s ease;
}

.allergen-option input {
  width: 20px;
  height: 20px;
  accent-color: var(--blue);
}

.allergen-option span {
  font-weight: 760;
}

.allergen-option small {
  grid-column: 2;
  color: var(--muted);
}

.allergen-option.is-suggested {
  border-color: var(--blue);
  background: var(--blue-soft);
  box-shadow: 0 0 0 3px rgba(15,76,92,.08);
}

.allergen-none {
  border-color: #9ac889;
  background: #f3faf2;
}

.calc-strip {
  margin-bottom: 0;
  padding-top: 2px;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 8;
  margin: 10px -4px 0;
  padding: 12px 4px;
  background: linear-gradient(180deg, rgba(245,248,247,0), var(--bg) 35%);
}

.summary-card {
  align-items: end;
}

@media (max-width: 1100px) {
  .preview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 920px) {
  .sidebar {
    z-index: 60;
    padding-top: 16px;
    border-right: 1px solid rgba(255,255,255,.08);
  }

  .topbar {
    height: auto;
    min-height: 126px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px 12px;
    align-items: center;
    padding: 12px;
    background: linear-gradient(135deg, #0b2f38, #0f4c5c);
    border-bottom: 0;
    box-shadow: 0 14px 34px rgba(11, 47, 56, .24);
  }

  .top-title {
    min-height: 48px;
    align-content: center;
    gap: 4px;
  }

  .top-title small {
    display: none;
  }

  .top-mobile-logo {
    min-width: 96px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 18px rgba(11, 47, 56, .18);
  }

  .top-mobile-logo img {
    width: 78px;
    height: 34px;
    object-fit: contain;
  }

  .tenant-switch {
    grid-column: 1 / -1;
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 8px;
    justify-content: stretch;
    padding: 8px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 12px;
    background: rgba(255,255,255,.09);
  }

  .tenant-label {
    display: block;
    grid-column: 1 / -1;
    color: #d7e8e4;
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .08em;
  }

  .tenant-switch .select,
  .company-pill {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 48px;
    font-size: 15px;
    font-weight: 850;
    border-color: rgba(255,255,255,.18);
    box-shadow: 0 8px 20px rgba(11, 47, 56, .18);
  }

  .tenant-switch .btn {
    min-height: 48px;
    padding: 0 16px;
    justify-content: center;
    background: rgba(255,255,255,.1);
    color: #fff;
    border-color: rgba(255,255,255,.22);
  }

  .menu-btn {
    display: inline-flex;
    min-width: 96px;
    min-height: 48px;
    padding: 0 16px;
    justify-content: center;
    background: rgba(255,255,255,.12);
    color: #fff;
    border-color: rgba(255,255,255,.2);
    box-shadow: 0 8px 18px rgba(11, 47, 56, .18);
  }

  .top-action {
    min-width: 44px;
    padding: 0 12px;
  }

  .top-title span {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 20px;
    color: #fff;
    font-weight: 900;
  }

  .page {
    padding: 18px 12px 28px;
  }

  .page-head {
    margin-bottom: 14px;
  }

  .mobile-filter-toggle {
    display: inline-flex;
    width: 100%;
    min-height: 52px;
    margin: 0 0 12px;
    justify-content: space-between;
    background: #fff;
    border-color: var(--line);
    color: var(--text);
  }

  .mobile-filter-toggle.is-open {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff;
  }

  .mobile-filter-toggle.is-open strong {
    background: rgba(255,255,255,.16);
    color: #fff;
  }

  .mobile-filter-panel {
    display: none !important;
  }

  .mobile-filter-panel.is-open {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 14px;
  }

  .mobile-filter-panel.article-filters {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
  }

  .mobile-filter-panel .input,
  .mobile-filter-panel .select,
  .mobile-filter-panel .btn {
    width: 100%;
    max-width: none !important;
  }

  .table-wrap:has(.mobile-card-table),
  .prep-bulk-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
    width: 100%;
    max-width: 100%;
  }

  .mobile-card-table,
  .mobile-card-table tbody,
  .mobile-card-table tr,
  .mobile-card-table td {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .mobile-card-table thead {
    display: none;
  }

  .mobile-card-table tr {
    position: relative;
    margin: 0 0 14px;
    padding: 16px;
    width: 100%;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(16, 42, 50, .07);
    overflow: hidden;
  }

  .mobile-card-table td {
    display: none;
    border: 0;
    padding: 0;
  }

  .mobile-card-table td.bulk-cell {
    display: block;
    position: absolute;
    top: 17px;
    left: 14px;
    width: auto;
  }

  .mobile-card-table td.mobile-main-cell {
    display: block;
    padding-left: 40px;
    max-width: 100%;
    overflow: hidden;
  }

  .mobile-card-table:not(.articles-mobile-table) td.mobile-main-cell {
    padding-left: 0;
  }

  .mobile-card-table td.mobile-row-actions {
    display: block;
    margin-top: 14px;
    padding-left: 0;
    max-width: 100%;
  }

  .mobile-card-table .desktop-cell-text {
    display: none;
  }

  .mobile-row-card {
    display: grid;
    gap: 10px;
    min-width: 0;
  }

  .mobile-row-card > strong {
    color: var(--text);
    font-size: 19px;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .mobile-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .mobile-row-meta span {
    max-width: 100%;
    min-width: 0;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text);
    font-size: 13px;
    font-weight: 750;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
  }

  .mobile-row-meta span:nth-child(3) {
    width: 100%;
    border-radius: 12px;
  }

  .mobile-row-card details {
    margin-top: 2px;
  }

  .mobile-row-card summary {
    width: fit-content;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--blue);
    font-weight: 850;
    cursor: pointer;
  }

  .mobile-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px 12px;
    margin-top: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
  }

  .mobile-detail-grid span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  .mobile-detail-grid strong {
    font-size: 13px;
    text-align: right;
    overflow-wrap: anywhere;
  }

  .mobile-card-table .toolbar.nowrap,
  .mobile-card-table .toolbar.table-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 0;
    width: 100%;
    max-width: 100%;
  }

  .mobile-card-table .toolbar.nowrap .btn,
  .mobile-card-table .toolbar.table-actions .btn,
  .mobile-card-table .toolbar.table-actions .icon-btn {
    width: 100%;
    max-width: 100%;
    justify-content: center;
  }

  .mobile-card-table .toolbar.nowrap form,
  .mobile-card-table .toolbar.table-actions form {
    width: 100%;
    min-width: 0;
  }

  .prep-bulk-table,
  .prep-bulk-table tbody,
  .prep-bulk-table tr,
  .prep-bulk-table td {
    display: block;
    width: 100%;
  }

  .prep-bulk-table thead {
    display: none;
  }

  .prep-bulk-table tr {
    position: relative;
    margin: 0 0 14px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(16, 42, 50, .07);
  }

  .prep-bulk-table tr.is-selected {
    border-color: var(--green);
    background: var(--green-soft);
  }

  .prep-bulk-table td {
    border: 0;
    padding: 0;
  }

  .prep-bulk-table .prep-check-cell {
    position: absolute;
    top: 18px;
    left: 16px;
    width: auto;
  }

  .prep-bulk-table .prep-recipe-cell {
    padding-left: 48px;
    margin-bottom: 14px;
  }

  .prep-bulk-table .prep-recipe-cell strong {
    display: block;
    font-size: 19px;
    line-height: 1.15;
  }

  .prep-bulk-table .prep-base-cell {
    display: none;
  }

  .prep-bulk-table td:nth-child(4),
  .prep-bulk-table td:nth-child(5),
  .prep-bulk-table td:nth-child(6) {
    display: grid;
    gap: 6px;
    margin-top: 10px;
  }

  .prep-bulk-table td:nth-child(4)::before {
    content: "Qta preparata";
  }

  .prep-bulk-table td:nth-child(5)::before {
    content: "Unita";
  }

  .prep-bulk-table td:nth-child(6)::before {
    content: "Note";
  }

  .prep-bulk-table td:nth-child(4)::before,
  .prep-bulk-table td:nth-child(5)::before,
  .prep-bulk-table td:nth-child(6)::before {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: .04em;
  }

  .card {
    padding: 14px;
  }

  .prep-bulk-head,
  .prep-bulk-footer {
    display: grid;
    grid-template-columns: 1fr;
  }

  .prep-bulk-head .toolbar,
  .prep-bulk-footer .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .prep-filter-input {
    min-width: 0;
    width: 100%;
  }

  .prep-bulk-table {
    min-width: 0;
  }

  .prep-bulk-table th,
  .prep-bulk-table td {
    padding: 0;
  }

  .prep-bulk-table th:nth-child(3),
  .prep-bulk-table td:nth-child(3) {
    display: none;
  }

  .prep-bulk-table tr.is-selected {
    box-shadow: inset 8px 0 0 var(--sage);
  }

  .prep-recipe-cell {
    min-width: 220px;
  }

  .prep-mobile-meta {
    display: flex;
  }

  .prep-bulk-footer .btn {
    width: 100%;
    justify-content: center;
  }

  .toolbar {
    gap: 8px;
    margin-bottom: 12px;
  }

  .filter-actions {
    align-self: stretch;
    margin-bottom: 0;
    padding-top: 0;
  }

  .filter-actions .btn {
    flex: 1;
    justify-content: center;
  }

  .dropzone {
    min-height: 138px;
    padding: 20px 12px;
  }

  .document-type-switch {
    grid-template-columns: 1fr;
  }

  .invoice-row {
    padding: 16px 14px 18px;
    gap: 18px;
    border-radius: 18px;
    box-shadow: 0 18px 38px rgba(16, 42, 50, .10);
    margin-bottom: 10px;
  }

  .invoice-row > .toolbar:first-child {
    display: grid;
    justify-content: stretch;
    gap: 12px;
    padding-bottom: 14px;
  }

  .ai-row-head .row-meta {
    gap: 8px;
  }

  .ai-row-head .badge {
    min-height: 34px;
    padding: 0 13px;
    font-size: 13px;
  }

  .row-status-text {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    background: #edf4f2;
    color: #0b2f38;
    font-size: 16px;
    font-weight: 900;
  }

  .is-processed .row-status-text {
    background: #e5f4e2;
    color: #256b37;
  }

  .needs-attention .row-status-text {
    background: #ffecec;
    color: #a12b2b;
  }

  .invoice-row.needs-link .ai-row-head .badge:not(.row-processed-badge),
  .invoice-row.needs-link .row-status-text {
    display: none;
  }

  .invoice-row.needs-link.is-creating-article .row-status-text {
    display: block;
    background: #e5f4e2;
    color: #256b37;
  }

  .ai-preview-card.needs-link::before,
  .ai-preview-card.needs-attention::before {
    width: 10px;
  }

  .weak-suggestion {
    width: 100%;
    margin-top: 2px !important;
    padding: 9px 11px;
    border-radius: 12px;
    background: var(--orange-soft);
    color: var(--orange);
  }

  .row-last-data {
    display: none;
  }

  .row-actions-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    order: 6;
    gap: 10px;
    margin-top: 2px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }

  .row-actions-bar .btn {
    width: 100%;
    min-width: 0;
    min-height: 54px;
    font-size: 16px;
  }

  .invoice-row.is-processed.is-collapsed {
    padding: 12px 14px;
    border-radius: 14px;
  }

  .invoice-row.is-processed.is-collapsed .ai-row-head {
    padding-bottom: 0;
  }

  .invoice-row.is-processed.is-collapsed .row-status-text {
    font-size: 15px;
    padding: 9px 10px;
  }

  .invoice-row.is-processed.is-collapsed .row-actions-bar {
    display: flex;
    padding-top: 0;
    border-top: 0;
  }

  .invoice-row.is-processed.is-collapsed .row-actions-bar .btn[data-toggle-row-details] {
    min-height: 40px;
    width: auto;
    padding-inline: 14px;
    font-size: 14px;
  }

  .preview-grid {
    grid-template-columns: 1fr;
    order: 2;
    gap: 12px;
  }

  .ai-read-field {
    order: -20;
  }

  .ai-associated-field {
    order: -10;
  }

  .preview-grid .field {
    gap: 5px;
  }

  .preview-grid .field label {
    font-size: 12px;
    letter-spacing: 0;
  }

  .ai-read-field,
  .ai-associated-field {
    padding: 12px;
    border-radius: 14px;
    background: #f7fbfa;
    border: 1px solid #d7e7e2;
  }

  .ai-read-field {
    background: #eef7ef;
    border-color: #9ac889;
  }

  .ai-read-field .input,
  .ai-associated-field .input {
    min-height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    color: #102a32;
    font-size: 17px;
    font-weight: 850;
    line-height: 1.25;
  }

  .ai-read-field .input {
    font-size: 19px;
    font-weight: 900;
    color: #0b2f38;
  }

  .ai-read-field .input:focus,
  .ai-associated-field .input:focus {
    box-shadow: none;
    border-color: transparent;
  }

  .preview-grid .field:not(.ai-read-field):not(.ai-associated-field) .input,
  .preview-grid .field:not(.ai-read-field):not(.ai-associated-field) .select {
    min-height: 54px;
    border-color: #cfe0db;
    background: #fff;
  }

  .preview-grid .input-action {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .preview-grid .input-action .btn {
    width: auto;
    min-width: 92px;
  }

  .create-article-card {
    grid-template-columns: 1fr !important;
    order: 5;
    padding: 14px;
    border-radius: 16px;
    border-color: #9ac889;
    background: #f3faf2;
    box-shadow: inset 0 0 0 1px rgba(127, 176, 105, .10);
  }

  .create-article-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .calc-strip {
    order: 3;
    gap: 8px;
    padding: 12px;
    border-radius: 14px;
    background: #f8fbfa;
    border: 1px solid var(--line);
  }

  .calc-strip .badge {
    flex: 1 1 140px;
    justify-content: center;
    min-height: 36px;
    font-size: 13px;
  }

  .sticky-actions {
    position: static;
    bottom: auto;
    z-index: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 22px 0 0;
    padding: 0;
    background: transparent;
  }

  .sticky-actions .btn {
    justify-content: center;
    min-height: 58px;
  }

  table {
    min-width: 760px;
  }

  .allergen-grid {
    grid-template-columns: 1fr;
  }

  .module-grid {
    grid-template-columns: 1fr;
  }

  .recipe-line-breakdown {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.auth-page {
  background: radial-gradient(circle at top left, #e6f1f2, transparent 34%), radial-gradient(circle at bottom right, #eef7ef, transparent 28%), var(--bg);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.auth-card {
  width: min(440px, 100%);
  display: grid;
  gap: 18px;
  padding: 26px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.auth-brand {
  padding: 0;
  color: var(--text);
}

.auth-brand .brand-logo {
  width: 126px;
  height: 46px;
}

.auth-brand .brand-copy small {
  color: var(--muted);
}

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }

  .topbar {
    min-height: 128px;
    padding: 10px;
    gap: 8px;
  }

  .top-title span {
    max-width: 100%;
    font-size: 19px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-title small {
    display: none;
  }

  .top-mobile-logo,
  .menu-btn {
    min-width: 92px;
  }

  .top-mobile-logo img {
    width: 74px;
  }

  .menu-btn,
  .tenant-switch .btn {
    min-height: 46px;
  }

  .tenant-switch {
    grid-template-columns: minmax(0, 1fr) 70px;
    padding: 7px;
  }

  .tenant-switch .select,
  .company-pill {
    min-height: 46px;
    font-size: 14px;
    padding-inline: 11px;
  }

  .page-head h1 {
    font-size: 25px;
  }

  .subtitle {
    font-size: 14px;
  }

  .btn {
    min-height: 48px;
  }

  .input, .select, .textarea {
    min-height: 52px;
  }

  .input-action,
  .discount-row {
    grid-template-columns: 1fr;
  }

  .input-action .btn {
    width: 100%;
  }

  .article-modal-body {
    gap: 14px;
  }

  .article-flag-field {
    min-height: 76px;
    padding: 14px;
  }

  .compound-ingredients-head {
    display: grid;
  }

  .ai-ingredients-upload {
    width: 100%;
    justify-content: center;
  }

  .recipe-line-breakdown {
    grid-template-columns: 1fr;
  }

  .row-actions-bar {
    grid-template-columns: 1fr;
  }

  .sticky-actions {
    grid-template-columns: 1fr;
  }
}

.voice-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 16px;
}

.prep-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.grid .full {
  grid-column: 1 / -1;
}

.muted {
  color: var(--muted);
}

.card .muted {
  display: block;
  margin-bottom: 4px;
}

.cook-start-card {
  min-height: 220px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.cook-start-card .btn {
  justify-content: center;
  width: fit-content;
  min-width: 220px;
}

.cook-service {
  display: grid;
  gap: 18px;
  border-color: #9ac889;
  background: linear-gradient(180deg, #ffffff, #f6fbf7);
}

.cook-service-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.cook-mic-btn {
  min-height: 58px;
  min-width: 180px;
  justify-content: center;
  font-size: 17px;
}

.cook-understood {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.cook-transcript {
  min-height: 92px;
}

.cook-live-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.cook-live-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.cook-drafts-card {
  border-color: #f0b36a;
  background: linear-gradient(180deg, #fffdf8, #fff7ed);
  box-shadow: 0 16px 34px rgba(217, 119, 6, .10);
}

.cook-draft-list {
  display: grid;
  gap: 12px;
}

.cook-draft-item {
  display: grid;
  grid-template-columns: minmax(180px, .7fr) minmax(0, 1.5fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid rgba(217, 119, 6, .22);
  border-radius: var(--radius);
  background: white;
}

.cook-draft-item strong {
  display: block;
  margin-top: 4px;
}

.cook-complete-box {
  display: grid;
  gap: 10px;
  min-width: min(100%, 760px);
}

.cook-complete-box .toolbar {
  justify-content: flex-start;
}

.prep-source-mini {
  display: grid;
  grid-template-columns: minmax(170px, 1.2fr) minmax(90px, .7fr) minmax(78px, .45fr);
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.prep-source-mini .subtitle {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 13px;
  font-weight: 800;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.metric-card {
  min-height: 96px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  display: grid;
  align-content: center;
  gap: 8px;
}

.metric-card span {
  color: var(--muted);
  font-weight: 700;
}

.metric-card strong {
  color: var(--text);
  font-size: clamp(26px, 3vw, 38px);
  line-height: 1;
}

.metric-card.warn {
  background: #fff8ed;
  border-color: #f4c98d;
}

.shopping-page table td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.shopping-needed {
  background: #fffdf8;
}

.shopping-covered {
  opacity: .72;
}

@media print {
  .sidebar,
  .topbar,
  .page-head .toolbar,
  .shopping-page form,
  .shopping-page .check-lg {
    display: none !important;
  }

  .app-shell,
  .main {
    display: block;
  }

  .page {
    padding: 0;
  }

  .card,
  .metric-card {
    box-shadow: none;
  }
}

@media (max-width: 920px) {
  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }

  .voice-card {
    grid-template-columns: 1fr;
  }

  .voice-card .toolbar,
  .prep-summary {
    display: grid;
    grid-template-columns: 1fr;
  }

  .voice-card .btn,
  .prep-summary .badge {
    justify-content: center;
    width: 100%;
  }

  .cook-service-head,
  .cook-live-item,
  .cook-draft-item,
  .cook-complete-box .toolbar,
  .prep-source-mini {
    grid-template-columns: 1fr;
    display: grid;
  }

  .cook-service-head .toolbar,
  .cook-mic-btn,
  .cook-start-card .btn,
  .cook-understood .badge {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 560px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }
}
