:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-alt: #edf2ec;
  --text: #1d261f;
  --muted: #657168;
  --line: #d7dfd7;
  --accent: #27643d;
  --accent-hover: #1d4e2e;
  --accent-soft: #e3f0e6;
  --danger: #a22f2f;
  --danger-soft: #f9e8e6;
  --radius: 10px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 16px; line-height: 1.5; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
button, a.button { min-height: 44px; }
:focus-visible { outline: 3px solid #e2a527; outline-offset: 3px; }
.skip-link { position: fixed; left: 1rem; top: -5rem; z-index: 10; background: var(--text); color: white; padding: .75rem 1rem; }
.skip-link:focus { top: 1rem; }
.topbar { min-height: 76px; padding: 0 clamp(1rem, 3vw, 2.5rem); background: var(--surface); border-bottom: 1px solid var(--line); display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: clamp(.75rem, 1.5vw, 1.5rem); }
.brand { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: .75rem; font-weight: 750; letter-spacing: -.02em; }
.brand small { display: block; color: var(--muted); font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: #fff; font-size: .86rem; letter-spacing: .04em; }
.main-nav { min-width: 0; display: flex; justify-content: center; gap: .1rem; }
.main-nav a, .main-nav summary, .mobile-nav a, .mobile-nav > summary { color: var(--text); text-decoration: none; padding: .7rem .7rem; border-radius: 8px; font-weight: 600; }
.main-nav a:hover, .main-nav summary:hover, .mobile-nav a:hover, .mobile-nav > summary:hover { background: var(--surface-alt); }
.main-nav a[aria-current="page"], .mobile-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
.nav-more { position: relative; }
.nav-more summary, .mobile-nav > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; list-style: none; }
.nav-more summary::-webkit-details-marker, .mobile-nav > summary::-webkit-details-marker { display: none; }
.nav-more summary::after { content: "▾"; margin-left: .35rem; font-size: .7rem; }
.nav-more > div { position: absolute; z-index: 5; right: 0; top: calc(100% + .25rem); min-width: 210px; padding: .4rem; display: grid; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 14px 32px rgba(29, 38, 31, .13); }
.mobile-nav { display: none; }
.account { display: flex; align-items: center; gap: 1rem; text-align: right; }
.account small { display: block; color: var(--muted); font-size: .72rem; }
.account form { margin: 0; }
.account-profile { color: var(--text); text-decoration: none; }
.page-shell { width: min(1360px, calc(100% - 2rem)); margin: 0 auto; padding: 2.25rem 0 5rem; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 1rem; margin-bottom: 2rem; }
.page-actions { display: flex; gap: .75rem; }
.page-heading.compact { margin-bottom: 1.5rem; }
.page-heading h1 + p { margin: .75rem 0 0; }
.list-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1.5rem; }
.list-filters input { flex: 1 1 320px; width: auto; }
.list-filters select { flex: 0 1 260px; width: auto; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.05; letter-spacing: -.045em; }
h2 { margin-bottom: 1rem; font-size: 1.3rem; letter-spacing: -.02em; }
.kicker { margin-bottom: .4rem; color: var(--accent); font-size: .76rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.muted { color: var(--muted); }
.button { border: 1px solid transparent; border-radius: 8px; padding: .65rem 1rem; display: inline-flex; align-items: center; justify-content: center; color: var(--text); background: transparent; text-decoration: none; font-weight: 700; cursor: pointer; white-space: nowrap; }
.button:active { transform: translateY(1px); }
.button-primary { color: #fff; background: var(--accent); }
.button-primary:hover { background: var(--accent-hover); }
.button-quiet { border-color: var(--line); background: var(--surface); }
.button-quiet:hover { background: var(--surface-alt); }
.button-danger-quiet { color: var(--danger); }
.button-danger-quiet:hover { background: var(--danger-soft); }
.button-large { padding: .85rem 1.35rem; }
.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 2.5rem; }
.dashboard-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.code-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.metric { min-height: 145px; padding: 1.4rem; background: var(--surface); color: var(--text); text-decoration: none; display: flex; flex-direction: column; justify-content: space-between; }
.metric span { color: var(--muted); font-weight: 650; }
.metric strong { font-size: 2.6rem; font-variant-numeric: tabular-nums; }
.metric-status strong { font-size: 1.35rem; line-height: 1.25; }
.metric:hover { background: var(--accent-soft); }
.content-section { margin-top: 2rem; }
.ozon-sale-systems { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr)); gap: 1rem; margin: 1rem 0; }
.ozon-sale-systems > section { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow-wrap: anywhere; }
.ozon-sale-systems h3 { margin: 0 0 .5rem; }
.ozon-sale-systems p { margin: .35rem 0 0; }
.ozon-sale-systems form { margin-top: .75rem; }
.ozon-sale-confirmed { color: #245f38; }
.section-heading { display: flex; justify-content: space-between; align-items: center; }
.section-heading > a, .page-heading p a { min-height: 44px; display: inline-flex; align-items: center; }
.table-wrap { max-width: 100%; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: .95rem 1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); background: #fafbfa; font-size: .75rem; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcf9; }
.numeric, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, "Cascadia Mono", monospace; }
.status { display: inline-flex; border-radius: 6px; background: var(--surface-alt); padding: .25rem .5rem; color: #445149; font-size: .76rem; font-weight: 800; white-space: nowrap; }
.status-draft { background: #f1ece0; color: #6d5417; }
.status-cancelled { background: var(--danger-soft); color: var(--danger); }
.row-muted { opacity: .62; }
.actions { display: flex; justify-content: flex-end; align-items: center; gap: .25rem; }
.actions form { margin: 0; }
.table-subtext { display: block; color: var(--muted); }
.empty-state { padding: 4rem 1.5rem; text-align: center; background: var(--surface); border: 1px dashed #b9c5ba; border-radius: var(--radius); }
.empty-state h2, .empty-state h3 { margin-bottom: .4rem; }
.empty-state p { margin: 0; color: var(--muted); }
.error-page { min-height: 45vh; display: grid; place-content: center; justify-items: center; gap: 1rem; }
.alert { margin-bottom: 1rem; padding: .9rem 1rem; border-radius: var(--radius); border: 1px solid; }
.alert-success { color: #245f38; background: var(--accent-soft); border-color: #a7cfb1; }
.alert-error { color: #7f2424; background: var(--danger-soft); border-color: #e1afaa; white-space: pre-line; }
.alert-info { color: #365443; background: #edf3ee; border-color: #bdcbbf; }
.stock-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .8rem; }
.stock-cards a { display: grid; gap: .25rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); background: var(--surface); text-decoration: none; }
.stock-cards a:hover { background: var(--accent-soft); }
.stock-cards strong { font-size: 2rem; }
.stock-cards small { color: var(--muted); }
.warning-list { display: grid; gap: .65rem; }
.warning-card { display: grid; gap: .25rem; padding: .9rem 1rem; border: 1px solid; border-radius: var(--radius); color: var(--text); background: var(--surface); text-decoration: none; }
.warning-card span { color: var(--muted); }
.warning-warning { border-color: #d4ae61; background: #fffaf0; }
.warning-critical { border-color: #d99c96; background: var(--danger-soft); }
.compact-empty { padding: 1.5rem; }
.editor-form { max-width: 860px; }
/* Shared layout for manufacturer, production addresses and declarations. */
.settings-page { max-width: 960px; }
.settings-page-wide { max-width: 1180px; }
.settings-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.settings-heading h1 { font-size: clamp(1.8rem, 3.5vw, 2.6rem); margin: 0; text-wrap: balance; }
.settings-heading .button { flex-shrink: 0; }
.settings-tabs { display: flex; flex-wrap: wrap; gap: .35rem; padding: .4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.settings-tabs a { display: flex; align-items: center; justify-content: center; min-height: 46px; padding: .65rem 1rem; border-radius: 7px; text-decoration: none; font-weight: 600; color: var(--muted); }
.settings-tabs a:hover { background: var(--accent-soft); color: var(--accent); }
.settings-tabs a[aria-current="page"] { background: var(--accent); color: white; }
.settings-intro { margin: 1.25rem 0 1.75rem; max-width: 78ch; }
.settings-intro p { margin: 0 0 .5rem; text-wrap: pretty; }
.settings-records { margin-bottom: 1.75rem; }
.settings-records-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: .75rem; }
.settings-records-heading h2 { margin: 0; font-size: 1rem; }
.settings-record-list { display: flex; flex-wrap: wrap; gap: .5rem; }
.settings-record-list a { display: flex; align-items: center; min-height: 44px; padding: .6rem .85rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); text-decoration: none; overflow-wrap: anywhere; max-width: 100%; }
.settings-record-list a:hover, .settings-record-list a[aria-current="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.settings-record-list a[aria-current="true"] { font-weight: 700; }
.settings-form { max-width: none; }
.settings-form .form-grid { align-items: start; gap: 1.25rem; }
.settings-form label { align-content: start; min-width: 0; gap: .5rem; font-size: .9rem; font-weight: 600; }
.settings-form input:not([type="hidden"]), .settings-form select { height: 48px; min-height: 48px; font-weight: 400; }
.settings-form textarea { min-height: 96px; font-weight: 400; resize: vertical; }
.settings-form .field-help { font-weight: 400; }
.settings-actions { display: flex; align-items: center; padding-top: .25rem; }
.costing-settings-nav { position: sticky; top: .5rem; z-index: 2; display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 1.25rem; padding: .4rem; border: 1px solid var(--line); border-radius: var(--radius); background: rgb(255 255 255 / .96); }
.costing-settings-nav a { min-height: 42px; display: inline-flex; align-items: center; padding: .55rem .8rem; border-radius: 7px; color: var(--text); font-weight: 700; text-decoration: none; }
.costing-settings-nav a:hover { color: var(--accent); background: var(--accent-soft); }
.settings-section { margin: 0 0 1.25rem; padding: 1.4rem; scroll-margin-top: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.settings-section-heading { display: flex; justify-content: space-between; align-items: start; gap: 1rem; margin-bottom: 1rem; }
.settings-section-heading h2 { margin-bottom: .25rem; }
.settings-section-heading p { margin: 0; color: var(--muted); max-width: 68ch; }
.settings-section-heading .button { flex-shrink: 0; }
.settings-inline-form, .settings-equipment-form, .settings-recurring-form { display: grid; gap: .75rem; align-items: end; padding: 1rem; border-radius: 8px; background: var(--surface-alt); }
.settings-inline-form { grid-template-columns: minmax(180px, .7fr) minmax(240px, 1fr) auto; }
.settings-equipment-form { grid-template-columns: repeat(2, minmax(160px, 1fr)) minmax(140px, .65fr) minmax(180px, 1fr) auto; }
.settings-recurring-form { grid-template-columns: repeat(3, minmax(170px, 1fr)); }
.settings-recurring-form .button { justify-self: start; }
.settings-compact-list { margin-top: 1rem; border-top: 1px solid var(--line); }
.settings-compact-list > article { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-bottom: 1px solid var(--line); }
.settings-compact-list article > span, .settings-compact-list article small { color: var(--muted); }
.recurring-settings-row { align-items: center; }
.recurring-settings-row > div { display: grid; gap: .2rem; }
.recurring-settings-row form { display: flex; align-items: end; gap: .5rem; margin: 0; }
.recurring-settings-row form label { min-width: 170px; }
.settings-workflow-note { margin-top: 1.5rem; padding: 1.1rem 1.25rem; border-left: 4px solid var(--accent); background: var(--accent-soft); }
.settings-workflow-note h2 { margin-bottom: .35rem; font-size: 1.05rem; }
.settings-workflow-note p { margin: 0; }
@media (max-width: 900px) {
  .settings-equipment-form, .settings-recurring-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .settings-heading { align-items: flex-start; flex-direction: column; }
  .settings-tabs a { flex: 1 1 100%; justify-content: flex-start; }
  .settings-form .form-grid { grid-template-columns: 1fr; }
  .settings-form .span-2 { grid-column: auto; }
  .settings-actions .button { width: 100%; }
  .costing-settings-nav { position: static; }
  .costing-settings-nav a { flex: 1 1 100%; }
  .settings-section { padding: 1rem; }
  .settings-section-heading { flex-direction: column; }
  .settings-section-heading .button { width: 100%; }
  .settings-inline-form, .settings-equipment-form, .settings-recurring-form { grid-template-columns: 1fr; }
  .settings-recurring-form .button { width: 100%; }
  .settings-compact-list > article, .recurring-settings-row form { align-items: stretch; flex-direction: column; }
  .recurring-settings-row form label { min-width: 0; }
}

/* Помощник: отдельное рабочее место внутри производственной программы. */
.assistant-layout { display: grid; grid-template-columns: minmax(210px, 260px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.assistant-conversations, .assistant-workspace { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.assistant-conversations { max-height: calc(100dvh - 100px); padding: 1rem; overflow-y: auto; }
.assistant-conversations h2 { font-size: 1rem; margin: 0 0 .75rem; }
.assistant-conversations > a { display: block; padding: .8rem; border-radius: 7px; color: var(--text); text-decoration: none; border: 1px solid transparent; }
.assistant-conversations > a:hover, .assistant-conversations > a[aria-current="page"] { border-color: var(--line); background: var(--surface-alt); }
.assistant-conversations strong, .assistant-conversations small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assistant-conversations small { color: var(--muted); margin-top: .2rem; }
.assistant-heading-actions { display: flex; flex-wrap: wrap; gap: .4rem; }
.assistant-workspace { display: flex; flex-direction: column; min-height: 580px; overflow: hidden; }
.assistant-thread-head { display: flex; gap: .5rem; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.assistant-thread-head h2 { margin: 0; font-size: 1.05rem; }
.assistant-thread-head span { color: var(--muted); font-size: .85rem; }
.assistant-messages { flex: 1; padding: 1.2rem; display: flex; flex-direction: column; gap: 1rem; max-height: min(66vh, 820px); overflow-y: auto; }
.assistant-message { flex-shrink: 0; max-width: min(100%, 780px); padding: 1rem 1.15rem; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); }
.assistant-message-user { align-self: flex-end; background: var(--accent-soft); border-color: #cbdccc; }
.assistant-message-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem .8rem; margin-bottom: .45rem; font-size: .78rem; color: var(--muted); }
.assistant-message-meta strong { color: var(--text); }
.assistant-message-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.assistant-sources { display: flex; flex-wrap: wrap; gap: .35rem .65rem; align-items: center; margin-top: .9rem; padding-top: .7rem; border-top: 1px solid var(--line); font-size: .82rem; }
.assistant-sources strong { color: var(--muted); }
.assistant-attachments { padding-left: 1.1rem; margin-bottom: 0; }
.assistant-attachments small { color: var(--muted); }
.assistant-hints { margin: .35rem 0; padding: .5rem; border-left: 3px solid var(--accent); background: var(--accent-soft); font-size: .8rem; }
.assistant-hints span { display: block; }
.assistant-extracted { margin: .35rem 0 .6rem; }
.assistant-extracted summary { cursor: pointer; font-size: .8rem; font-weight: 700; }
.assistant-extracted .assistant-message-text { max-height: 16rem; overflow: auto; padding: .65rem; border: 1px solid var(--line); background: var(--surface-alt); font-size: .8rem; }
.assistant-alert { margin: .75rem 0 0; color: var(--danger); font-weight: 700; }
.assistant-empty { flex: 1; min-height: 0; padding: 2rem; }
.assistant-empty h2 { font-size: 1.45rem; }
.assistant-compose { padding: 1rem 1.2rem; border-top: 1px solid var(--line); background: #f9fbf8; }
.assistant-compose > label { display: block; font-weight: 700; margin-bottom: .4rem; }
.assistant-compose textarea { width: 100%; min-height: 100px; resize: vertical; border: 1px solid var(--line); border-radius: 7px; padding: .75rem; background: var(--surface); }
.assistant-input-wrap { position: relative; }
.assistant-input-wrap textarea { display: block; padding-right: 3.8rem; }
.assistant-send { position: absolute; right: .55rem; bottom: .55rem; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 8px; background: var(--accent); color: #fff; cursor: pointer; }
.assistant-send:hover { background: var(--accent-hover); }
.assistant-send:focus-visible { outline: 3px solid #e2a527; outline-offset: 2px; }
.assistant-send:disabled { opacity: .6; cursor: progress; }
.assistant-send svg { width: 20px; height: 20px; }
.assistant-compose-bottom { display: flex; gap: .75rem; align-items: center; justify-content: space-between; margin-top: .65rem; }
.assistant-file-label { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; font-weight: 700; }
.assistant-file-label input { max-width: 300px; font-size: .85rem; }
.assistant-file-count { color: var(--muted); font-size: .8rem; }
.assistant-compose .muted { font-size: .79rem; margin: .6rem 0 0; }
.assistant-knowledge { max-width: 920px; }
.assistant-memory { border-top: 1px solid var(--line); padding: 1rem 1.2rem; }
.assistant-memory > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 700; }
.assistant-memory form { display: grid; gap: .7rem; margin: .8rem 0; }
.assistant-memory label { display: grid; gap: .3rem; font-weight: 700; }
.assistant-memory input, .assistant-memory textarea { width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: .6rem; }
.assistant-memory-item { border-top: 1px solid var(--line); padding: .8rem 0; }
.assistant-memory-item p { margin: .25rem 0; }
.assistant-memory-item small { color: var(--muted); }
.assistant-memory-item form { display: flex; flex-wrap: wrap; }
@media (max-width: 900px) { .assistant-layout { grid-template-columns: 1fr; } .assistant-conversations { max-height: 150px; overflow-y: auto; } .assistant-workspace { min-height: 60vh; } .assistant-messages { max-height: 55vh; } .assistant-compose-bottom { align-items: stretch; flex-direction: column; } .assistant-compose-bottom .button { align-self: flex-end; } }
.assistant-page-context { margin: -.3rem 0 1rem; padding: .65rem .85rem; border-left: 3px solid var(--accent); background: var(--accent-soft); font-size: .86rem; }
.assistant-chat-switcher { display: flex; align-items: center; gap: .5rem; min-width: 0; margin: .2rem 0 .55rem; font-size: .82rem; font-weight: 700; }
.assistant-chat-switcher select { flex: 1; min-width: 0; min-height: 40px; padding: .45rem .6rem; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); font: inherit; }
.assistant-show-target { display: inline-flex; padding: .4rem .65rem; border: 1px solid var(--accent); border-radius: 6px; font-weight: 700; text-decoration: none; }
.assistant-launcher { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 40; display: flex; align-items: center; gap: .4rem; width: auto; min-height: 60px; padding: .25rem .95rem .25rem .2rem; border: 1px solid #253968; border-radius: 34px; background: #263769; color: #fff; box-shadow: 0 8px 25px rgba(26, 42, 83, .24); cursor: pointer; font: inherit; font-weight: 700; }
.assistant-launcher:hover, .assistant-launcher.assistant-open { background: #1b2a56; }
.assistant-bot { width: 52px; height: 52px; flex: none; overflow: visible; animation: assistant-breathe 3.2s ease-in-out infinite; }
.assistant-bot-eyes { transform-box: fill-box; transform-origin: center; animation: assistant-blink 5s ease-in-out infinite; }
.assistant-bot-arm { transform-box: fill-box; transform-origin: 0 10%; }
.assistant-launcher:hover .assistant-bot-arm, .assistant-launcher.assistant-open .assistant-bot-arm { animation: assistant-wave .7s ease-in-out 2; }
@keyframes assistant-breathe { 50% { transform: translateY(-2px) scale(1.02); } }
@keyframes assistant-blink { 0%, 93%, 97%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes assistant-wave { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-25deg); } }
.assistant-drawer[hidden] { display: none; }
.assistant-drawer { position: fixed; right: 1rem; bottom: 5.5rem; z-index: 41; width: min(460px, calc(100vw - 2rem)); height: min(740px, calc(100dvh - 7rem)); display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 18px 50px rgba(20, 45, 35, .24); overflow: hidden; }
.assistant-drawer-head { display: flex; flex: none; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem .75rem; border-bottom: 1px solid var(--line); }
.assistant-drawer-head .button { min-height: 38px; }
.assistant-drawer iframe { flex: 1; min-height: 0; width: 100%; border: 0; background: var(--surface); }
.assistant-focus-status { position: fixed; left: 50%; bottom: 1rem; z-index: 45; width: max-content; max-width: calc(100vw - 2rem); transform: translateX(-50%); padding: .75rem 1rem; border-radius: 8px; background: #234f41; color: white; box-shadow: 0 8px 24px rgba(20, 45, 35, .24); font-weight: 700; text-align: center; }
.assistant-focused { outline: 4px solid #e2a527 !important; outline-offset: 4px; scroll-margin: 110px; animation: assistant-pulse 1.5s ease-out 2; }
@keyframes assistant-pulse { 50% { box-shadow: 0 0 0 9px rgba(226, 165, 39, .22); } }
.assistant-embedded .topbar, .assistant-embedded .sidebar, .assistant-embedded .skip-link { display: none; }
.assistant-embedded, .assistant-embedded .app-layout { height: 100dvh; overflow: hidden; }
.assistant-embedded .app-layout { display: block; }
.assistant-embedded .page-shell { width: 100%; max-width: none; height: 100%; display: flex; flex-direction: column; margin: 0; padding: .65rem; overflow: hidden; }
.assistant-embedded .page-heading { flex-direction: row; justify-content: flex-end; margin-bottom: .35rem; }
.assistant-embedded .page-heading > div:first-child { display: none; }
.assistant-embedded .assistant-heading-actions { width: 100%; flex-wrap: nowrap; }
.assistant-embedded .assistant-heading-actions .button { flex: 1; width: auto; min-height: 34px; justify-content: center; padding: .35rem .55rem; font-size: .8rem; }
.assistant-embedded .page-heading, .assistant-embedded .assistant-page-context { flex: none; }
.assistant-embedded .assistant-chat-switcher { flex: none; }
.assistant-embedded .assistant-chat-switcher + .assistant-page-context { margin-top: 0; }
.assistant-embedded .page-heading h1 { font-size: 1.2rem; }
.assistant-embedded .page-heading .muted { display: none; }
.assistant-embedded .assistant-layout { display: block; flex: 1; min-height: 0; overflow: hidden; }
.assistant-embedded .assistant-conversations { display: none; }
.assistant-embedded .assistant-thread-head, .assistant-embedded .assistant-memory { display: none; }
.assistant-embedded .assistant-workspace { height: 100%; min-height: 0; border: 0; }
.assistant-embedded .assistant-messages { min-height: 0; flex-basis: 0; max-height: none; padding: .75rem; }
.assistant-embedded .assistant-empty { overflow-y: auto; padding: .8rem; }
.assistant-embedded .assistant-empty h2 { font-size: 1rem; margin: 0 0 .3rem; }
.assistant-embedded .assistant-empty p { font-size: .82rem; margin: 0; }
.assistant-embedded .assistant-compose { flex: none; padding: .75rem; }
.assistant-embedded .assistant-compose > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.assistant-embedded .assistant-compose textarea { height: 76px; min-height: 76px; resize: none; font-size: .9rem; }
.assistant-embedded .assistant-compose-bottom { flex-direction: row; justify-content: flex-start; margin-top: .4rem; }
.assistant-embedded .assistant-file-label { position: relative; display: inline-flex; min-height: 40px; padding: .45rem .65rem; border: 1px solid var(--line); border-radius: 7px; font-size: .8rem; cursor: pointer; }
.assistant-embedded .assistant-file-label:focus-within { outline: 3px solid #e2a527; outline-offset: 2px; }
.assistant-embedded .assistant-file-label input { position: absolute; width: 1px; height: 1px; padding: 0; opacity: 0; }
.assistant-embedded .assistant-compose .muted { display: none; }
.assistant-embedded .assistant-compose .muted { display: none; }
@media (prefers-reduced-motion: reduce) { .assistant-focused, .assistant-bot, .assistant-bot-eyes, .assistant-launcher:hover .assistant-bot-arm, .assistant-launcher.assistant-open .assistant-bot-arm { animation: none; } .assistant-focused { scroll-behavior: auto; } }
@media (max-width: 640px) { .assistant-drawer { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; } .assistant-launcher { right: .75rem; bottom: .75rem; } }
fieldset { margin: 0 0 1.25rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
legend { padding: 0 .5rem; font-weight: 800; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.span-2 { grid-column: span 2; }
label { display: grid; align-content: start; gap: .4rem; color: #3d4940; font-weight: 700; }
input, select, textarea { width: 100%; min-height: 46px; border: 1px solid #aeb9af; border-radius: 8px; padding: .65rem .75rem; background: #fff; color: var(--text); }
input[type="checkbox"], input[type="radio"] { width: 1.15rem; height: 1.15rem; min-height: 0; padding: 0; margin: 0; flex: none; accent-color: var(--accent); }
.check-row, .cost-form label.check-row { display: flex; flex-direction: row; align-items: center; gap: .6rem; min-height: 44px; }
textarea { resize: vertical; }
input:disabled { background: var(--surface-alt); color: var(--muted); }
.field-help { color: var(--muted); font-size: .8rem; font-weight: 500; }
.form-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.calculation-note { margin: 0 0 1.25rem; padding: 1rem 1.25rem; display: grid; gap: .2rem; border-left: 4px solid var(--accent); background: var(--accent-soft); }
.calculation-note span { color: #445149; }
.batch-product { margin: .7rem 0 0; }
.upload-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr); gap: 2rem; align-items: end; margin: 1.5rem 0 2.5rem; padding: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.upload-panel h2, .upload-panel p { margin-bottom: .4rem; }
.upload-panel p { color: var(--muted); }
.upload-form { display: grid; grid-template-columns: minmax(200px, 1fr) auto; align-items: end; gap: .75rem; }
.print-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .7fr); gap: 2rem; align-items: end; margin: 1.5rem 0 2.5rem; padding: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.print-panel h2, .print-panel p { margin-bottom: .4rem; }
.print-panel p { color: var(--muted); }
.print-form { display: grid; grid-template-columns: minmax(120px, 1fr) auto; align-items: end; gap: .75rem; }
.print-complete { align-self: center; font-weight: 700; }
.import-report { margin: 0 0 1.5rem; padding: 1.25rem; border: 1px solid; border-radius: var(--radius); background: var(--surface); }
.report-ok { border-color: #a7cfb1; }
.report-error { border-color: #e1afaa; }
.report-grid, .detail-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); }
.report-grid div, .detail-grid div { padding: .8rem 1rem; background: var(--surface); }
.report-grid dt, .detail-grid dt { color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .045em; text-transform: uppercase; }
.report-grid dd, .detail-grid dd { margin: .25rem 0 0; font-size: 1.15rem; font-weight: 750; }
.error-list { margin: 1rem 0 0; padding-left: 1.3rem; color: var(--danger); }
.detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.code-value { overflow-wrap: anywhere; white-space: pre-wrap; font-size: .85rem !important; }
.split-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 2rem; align-items: start; }
.split-layout > * { min-width: 0; }
.side-form { padding: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.stack-form { display: grid; gap: 1rem; }
.login-page { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; background: #eaf0e9; }
.login-panel { width: min(430px, 100%); padding: clamp(1.5rem, 5vw, 2.5rem); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(39, 70, 48, .11); }
.login-brand { margin-bottom: 2.5rem; }
.login-panel h1 { margin-bottom: .65rem; font-size: 2.25rem; }
.login-panel .button { width: 100%; margin-top: .25rem; }
.sr-only { position: absolute; top: 0; left: 0; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

.packaging-page { display: grid; gap: 1.5rem; }
.packaging-heading { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; }
.packaging-heading h1 { font-size: clamp(2.2rem, 4.5vw, 4.5rem); }
.packaging-batch { margin: .8rem 0 0; font-size: 1.25rem; }
.packaging-heading-actions { display: flex; align-items: center; gap: .75rem; }
.status-large { padding: .65rem .8rem; font-size: .9rem; }
.packaging-metrics { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); gap: 1px; }
.packaging-metrics div { min-height: 118px; padding: 1rem; display: flex; flex-direction: column; justify-content: space-between; background: var(--surface); }
.packaging-metrics span { color: var(--muted); font-size: .82rem; font-weight: 750; }
.packaging-metrics strong { font-size: 2.4rem; font-variant-numeric: tabular-nums; }
.packaging-metrics .metric-applied { background: var(--accent-soft); }
.packaging-metrics .metric-rejected { background: var(--danger-soft); }
.scan-result { min-height: 190px; padding: 1.5rem 2rem; display: grid; align-content: center; justify-items: center; text-align: center; border: 3px solid var(--line); border-radius: 16px; background: var(--surface); }
.scan-result strong { font-size: clamp(2.4rem, 6vw, 5.5rem); line-height: 1; }
.scan-result span { margin-top: .75rem; font-size: clamp(1.25rem, 2.5vw, 2rem); font-weight: 750; white-space: pre-line; }
.result-ready { border-color: #839087; }
.result-success { border-color: var(--accent); background: var(--accent-soft); }
.result-warning { border-color: #a56b00; background: #fff1cf; }
.result-error { border-color: var(--danger); background: var(--danger-soft); }
.scanner-form { display: grid; gap: .55rem; padding: 1.25rem; border: 2px solid var(--accent); border-radius: var(--radius); background: var(--surface); }
.scanner-form > label { font-size: 1.05rem; }
.scanner-input-row { display: grid; grid-template-columns: 1fr auto; gap: .75rem; }
.scanner-input-row input { min-height: 70px; border-width: 2px; font-family: ui-monospace, "Cascadia Mono", monospace; font-size: 1.25rem; }
.scanner-panel, .incident-panel { margin: 1.5rem 0; padding: 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.scanner-panel { display: grid; grid-template-columns: minmax(260px, .75fr) minmax(360px, 1.25fr); gap: 2rem; align-items: end; }
.scanner-panel h2 { margin-bottom: .5rem; }
.incident-panel summary { cursor: pointer; font-weight: 800; }
.incident-panel[open] summary { margin-bottom: 1rem; }
.stack-form { display: grid; gap: .85rem; }
.scanner-form p { margin: 0; color: var(--muted); }
.scan-feedback { padding:18px; border:2px solid currentColor; border-radius:var(--radius); font-size:1.15rem; font-weight:800; }
.scan-feedback-ok { color:#1f6a3e; background:#e8f5ed; }
.scan-feedback-error { color:#a12b25; background:#fff0ee; }
.scan-button { min-width: 190px; font-size: 1.05rem; }
.packaging-work-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 1.5rem; }
.reject-panel, .completion-panel { padding: 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.reject-panel > div > p:last-child { color: var(--muted); }
.reject-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; gap: .75rem; }
.damaged-label-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .75rem; }
.reject-button { min-width: 120px; color: #fff; background: var(--danger); }
.reject-button:hover { background: #7f2424; }
.completion-panel { display: grid; grid-template-columns: 1fr minmax(210px, .65fr); gap: 1.25rem; align-items: end; }
.completion-check { margin: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.completion-check div { padding: .7rem; background: var(--surface); }
.completion-check dt { color: var(--muted); font-size: .7rem; font-weight: 750; }
.completion-check dd { margin: .2rem 0 0; font-size: 1.35rem; font-weight: 800; }
.complete-form { display: grid; gap: .75rem; }
.complete-form button:disabled, .reject-form button:disabled { cursor: not-allowed; opacity: .45; }
.packaging-complete { min-height: 260px; display: grid; place-content: center; justify-items: center; gap: 1rem; border: 3px solid var(--accent); border-radius: 16px; background: var(--accent-soft); text-align: center; }
.packaging-complete strong { font-size: clamp(2rem, 5vw, 4.5rem); }
.packaging-complete span { font-size: 1.5rem; font-weight: 750; }
.workflow-grid { display: grid; gap: 1rem; }
.workflow-grid .workflow-step { margin: 0; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; }
.workflow-grid .workflow-step > * { min-width: 0; margin: 0; }
.workflow-grid .workflow-step .mono { overflow-wrap: anywhere; }

.stock-heading p:last-child { max-width: 720px; color: var(--muted); }
.circulation-panel, .stock-filter-panel { padding: 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.circulation-panel > p { color: var(--muted); }
.circulation-list { display: grid; gap: .7rem; }
.circulation-row { display: grid; grid-template-columns: minmax(210px, 1.3fr) minmax(120px, .6fr) minmax(100px, .5fr) minmax(150px, .7fr) minmax(220px, 1fr) auto; gap: 1rem; align-items: center; padding: 1rem; border: 1px solid var(--line); border-radius: 9px; }
.circulation-row > div { display: grid; gap: .2rem; }
.circulation-row span { color: var(--muted); font-size: .8rem; }
.circulation-confirm { display: flex; gap: .6rem; align-items: center; font-weight: 650; }
.circulation-confirm input, .checkbox-filter input { width: 1.1rem; height: 1.1rem; }
.risk-confirm { grid-column: 1 / -1; padding: .65rem; border: 1px solid #d99c96; border-radius: 8px; color: var(--danger); background: var(--danger-soft); }
.stock-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); gap: 1px; }
.stock-metrics div { min-height: 115px; padding: 1rem; display: flex; flex-direction: column; justify-content: space-between; background: var(--surface); }
.stock-metrics span { color: var(--muted); font-size: .82rem; font-weight: 750; }
.stock-metrics strong { font-size: 2.4rem; font-variant-numeric: tabular-nums; }
.stock-metrics .metric-applied { background: var(--accent-soft); }
.stock-metrics .metric-rejected { background: var(--danger-soft); }
.stock-filters { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: .9rem; align-items: end; }
.checkbox-filter { min-height: 45px; display: flex; flex-direction: row; align-items: center; gap: .55rem; }
.filter-actions { display: flex; gap: .55rem; }
.cell-note { display: block; margin-top: .2rem; color: var(--muted); font-size: .82rem; }
.fefo-row { background: #f1f8f2; }
.fefo-badge { display: inline-block; margin-left: .45rem; padding: .2rem .4rem; border-radius: 5px; color: #fff; background: var(--accent); font-size: .68rem; font-weight: 850; letter-spacing: .06em; }
.pagination { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1rem; }

.shipment-form-heading p:last-child { max-width: 760px; color: var(--muted); }
.shipment-form { display: grid; gap: 1.25rem; }
.form-section { padding: 1.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.form-section > div:first-child { margin-bottom: 1rem; }
.field-hint, .table-note { color: var(--muted); font-size: .82rem; }
.shipment-item-form { border-color: #a9c5b0; background: #f5f9f5; }
.shipment-item-row { grid-template-columns: minmax(240px, 1.5fr) minmax(120px, .55fr) minmax(190px, .8fr) minmax(210px, 1fr); align-items: end; padding: 1rem 0; border-top: 1px solid var(--line); }
.shipment-item-row:first-child { padding-top: 0; border-top: 0; }
.shipment-availability { min-height: 46px; display: grid; align-content: center; gap: .1rem; padding: .55rem .75rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.shipment-availability span { color: var(--muted); font-size: .72rem; font-weight: 750; text-transform: uppercase; }
.shipment-availability strong { font-size: .9rem; }
.order-availability-summary { margin-top: 1rem; padding: .8rem 1rem; border-left: 4px solid var(--line); background: var(--surface); font-weight: 700; }
.availability-enough { border-color: #8bb89a; background: var(--accent-soft); color: #245f38; }
.availability-shortage { border-color: #d4ae61; background: #fffaf0; color: #795112; }
.shipment-form-actions { align-items: center; flex-wrap: wrap; }
.shipment-heading { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; }
.shipment-heading h1 { font-size: clamp(2rem, 4vw, 4rem); }
.shipment-heading p:last-child { margin-top: .65rem; color: var(--muted); font-size: 1.2rem; }
.shipment-heading-actions, .shipment-actions { display: flex; align-items: center; gap: .7rem; flex-wrap: wrap; }
.shipment-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--line); }
.shipment-summary div { min-height: 105px; padding: 1rem; display: flex; flex-direction: column; justify-content: space-between; background: var(--surface); }
.shipment-summary span { color: var(--muted); font-size: .76rem; font-weight: 750; }
.shipment-summary strong { font-size: 1.15rem; }
.shipment-actions-panel { display: grid; grid-template-columns: 1fr auto; gap: 1.25rem; padding: 1.4rem; border: 2px solid var(--accent); border-radius: var(--radius); background: var(--surface); }
.shortage-panel { border-color: #b77718; background: #fffaf0; }
.economics-summary { margin-top: 1rem; }
.document-form { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: .8rem; align-items: end; }
.document-status-form { display: grid; grid-template-columns: minmax(130px, .7fr) minmax(160px, 1fr); gap: .45rem; min-width: 360px; }
.document-status-form button { justify-self: start; }
.cell-error { display: block; margin-top: .35rem; color: var(--danger); font-size: .78rem; }
.ship-confirm-form { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.ship-confirm-form label { display: flex; flex-direction: row; align-items: center; gap: .6rem; }
.ship-confirm-form input { width: 1.15rem; height: 1.15rem; }

@media (max-width: 900px) {
  .topbar { grid-template-columns: 1fr auto; padding: .75rem 1rem; gap: 1rem; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .split-layout { grid-template-columns: minmax(0, 1fr); }
  .upload-panel, .upload-form, .print-panel, .print-form { grid-template-columns: 1fr; }
  .packaging-metrics, .dashboard-metrics { grid-template-columns: repeat(2, 1fr); }
  .packaging-work-grid, .completion-panel { grid-template-columns: 1fr; }
  .scanner-panel { grid-template-columns: 1fr; }
  .reject-form { grid-template-columns: 1fr; }
  .circulation-row { grid-template-columns: 1fr 1fr; }
  .stock-filters { grid-template-columns: repeat(2, 1fr); }
  .shipment-summary { grid-template-columns: repeat(2, 1fr); }
  .document-form { grid-template-columns: repeat(2, 1fr); }
  .shipment-item-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .page-shell { width: min(100% - 1rem, 1360px); padding-top: 1.25rem; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .packaging-heading, .packaging-heading-actions, .page-actions { align-items: stretch; flex-direction: column; }
  .packaging-metrics { grid-template-columns: repeat(2, 1fr); }
  .stock-metrics { grid-template-columns: repeat(2, 1fr); }
  .circulation-row, .stock-filters { grid-template-columns: 1fr; }
  .shipment-heading, .shipment-heading-actions { align-items: stretch; flex-direction: column; }
  .shipment-summary, .shipment-actions-panel { grid-template-columns: 1fr; }
  .document-form, .document-status-form { grid-template-columns: 1fr; }
  .ship-confirm-form { grid-column: auto; align-items: stretch; flex-direction: column; }
  .scanner-input-row { grid-template-columns: 1fr; }
  .completion-check { grid-template-columns: 1fr 1fr; }
  .page-heading .button { width: 100%; }
  .metrics, .form-grid, .report-grid, .detail-grid { grid-template-columns: 1fr; }
  .shipment-item-row { grid-template-columns: 1fr; }
  .list-filters > * { flex: 1 1 100%; }
  .shipment-form-actions .button { width: 100%; }
  .span-2 { grid-column: auto; }
  .metric { min-height: 115px; }
  .topbar { grid-template-columns: minmax(0, 1fr) auto auto; }
  .main-nav { display: none; }
  .mobile-nav { position: relative; display: block; }
  .mobile-nav > summary { border: 1px solid var(--line); background: var(--surface); }
  .mobile-nav > nav { position: absolute; z-index: 8; right: 0; top: calc(100% + .4rem); width: min(280px, calc(100vw - 2rem)); max-height: calc(100dvh - 90px); padding: .45rem; display: grid; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 14px 32px rgba(29, 38, 31, .16); }
  .account { gap: .4rem; }
  .account-profile { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
.report-heading {
  align-items: flex-end;
}

.report-export-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.report-tabs {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin: 0 0 1.25rem;
}

.report-tabs a {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  padding: 0.55rem 0.9rem;
  text-decoration: none;
}

.report-tabs a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.report-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.report-summary div {
  padding: 0.9rem 1rem;
  border-right: 1px solid var(--line);
}

.report-summary span,
.report-summary strong {
  display: block;
}

.report-summary span {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.report-summary strong {
  margin-top: 0.3rem;
  font-size: 1.15rem;
}

.report-table-wrap {
  max-height: 62vh;
}

.report-table-wrap table {
  min-width: max-content;
}

.report-table-wrap th,
.report-table-wrap td {
  white-space: nowrap;
}

.report-table-wrap thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

@media (max-width: 640px) {
  .report-heading { align-items: flex-start; }
}

.cost-hero,
.cost-breakdown,
.cost-averages {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  margin: 1rem 0;
}

.cost-hero > div,
.cost-breakdown > div,
.cost-averages > div {
  padding: 1rem 1.1rem;
  border-right: 1px solid var(--line);
}

.cost-hero span,
.cost-breakdown span,
.cost-averages span {
  display: block;
  color: var(--muted);
  font-size: .76rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.cost-hero strong { display: block; font-size: 1.3rem; margin-top: .35rem; }
.cost-breakdown strong, .cost-averages strong { display: block; margin-top: .3rem; }
.cost-closed { border-color: #71a986; background: #f5fbf7; }

.costing-tabs {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
  margin: 1rem 0;
}

.costing-tabs a {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .5rem .8rem;
  background: #fff;
}

.costing-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.costing-grid > * { min-width: 0; }

.cost-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.cost-form.horizontal { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.cost-form label { display: grid; gap: .35rem; color: var(--muted); font-size: .82rem; }
.cost-form button { align-self: end; }

.cost-ledger {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.cost-ledger > div { border-left: 3px solid var(--accent); padding-left: 1rem; }
.cost-ledger h3 { margin-top: 0; }
.cost-ledger p { color: var(--muted); }
.cost-ledger details { margin: -.25rem 0 .75rem; }
.cost-ledger summary { color: var(--accent); cursor: pointer; font-size: .82rem; }
.ledger-edit { display: grid; gap: .4rem; margin-top: .55rem; }

.cost-close-panel {
  margin: 1.5rem 0;
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff9ea;
}

.cost-close-panel form { display: flex; gap: 1rem; align-items: end; flex-wrap: wrap; }
.cost-close-panel label { display: grid; gap: .35rem; min-width: 280px; }
.cost-status-grid { display: grid; gap: .65rem; }
.cost-status-row { display: grid; grid-template-columns: minmax(190px, 1fr) auto auto; gap: .75rem; align-items: center; padding: .65rem 0; border-top: 1px solid var(--line); }
.cost-status-row form { margin: 0; }
.status-not_filled { background: #fff0dc; color: #7a4300; }
.status-accounted { background: #e3f2e7; color: var(--accent); }
.status-not_applicable { background: #eef0ed; color: var(--muted); }
.load-preview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .65rem; padding: .85rem; border: 1px solid var(--line); border-radius: 12px; background: #f7f8f5; }
.load-preview[hidden] { display: none; }
.load-preview div { display: grid; gap: .25rem; }
.load-preview span { color: var(--muted); font-size: .78rem; }
.load-preview strong { font-size: 1rem; }
.field-error { color: #9e2f24 !important; }
.clean-list { list-style: none; margin: 1rem 0 0; padding: 0; }
.clean-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .65rem 0; border-top: 1px solid var(--line); }
.clean-list small, .clean-list span { color: var(--muted); }

@media (max-width: 640px) {
  .costing-grid, .cost-form { grid-template-columns: 1fr; }
  .cost-close-panel form { align-items: stretch; flex-direction: column; }
  .cost-status-row { grid-template-columns: 1fr; }
  .load-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.label-template-tabs {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
  margin: 0 0 1.25rem;
}

.label-template-tabs a {
  padding: .55rem .8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.label-template-tabs a.active { background: var(--accent); color: #fff; }
.label-editor-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(360px, .75fr); gap: 1.5rem; align-items: start; }
.label-template-form { max-width: none; }
.label-analysis-grid { display: grid; gap: .65rem; margin-top: .75rem; }
.label-analysis-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; align-items: end; padding: .8rem; border: 1px solid var(--line); border-radius: var(--radius); }
.label-analysis-row input, .label-analysis-row select { height: 48px; min-height: 48px; }
.label-analysis-row label { font-size: .9rem; }
.label-analysis-row button { grid-column: 1 / -1; justify-self: start; }
#analysis-add { margin-top: .75rem; }
.label-warning-panel > label:last-child { margin-top: .75rem; }
.label-preview-panel { position: sticky; top: 1rem; display: grid; gap: 1rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.label-preview-panel h2 output { font: inherit; font-variant-numeric: tabular-nums; }
.label-size-help { margin: -.2rem 0 .2rem; }
.label-preview-status { min-height: 1.4em; margin: 0; color: var(--muted); font-size: .82rem; }
.label-preview-status[data-state="loading"] { color: var(--accent); }
.label-preview-status[data-state="error"] { color: var(--danger); font-weight: 600; }
.label-preview-stage { width: 100%; min-height: 360px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #e8ece8; transition: aspect-ratio .2s ease; }
.label-preview-panel iframe { display: block; width: 100%; height: 100%; min-height: 360px; border: 0; background: #e8ece8; }
.label-preview-actions { flex-wrap: wrap; }
.label-symbol-toggles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-top: 1rem; }
.check-label { display: flex; align-items: center; gap: .55rem; min-height: 46px; }
.check-label input { width: 20px; min-height: 20px; }
.label-field-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: .15rem .65rem;
}
.label-template-form .label-field-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: .6rem;
  min-height: 40px;
  padding: .35rem .5rem;
  border-radius: 6px;
  line-height: 1.3;
  cursor: pointer;
}
.label-field-option:hover { background: var(--accent-soft); }
.label-template-form .label-field-option input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  cursor: inherit;
}
.label-analysis-row .label-field-option { grid-column: 1 / -1; justify-self: start; }
.label-warning { color: #725313; background: #fff8e4; border-color: #d8b869; }
.label-manufacturer-card { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1.25rem; margin-bottom: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.label-manufacturer-card > div { display: grid; gap: .3rem; min-width: 0; overflow-wrap: anywhere; }
.label-manufacturer-card .button { flex-shrink: 0; min-height: 44px; font-size: .85rem; }
.label-codes-grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); align-items: start; gap: 1rem; }
.label-codes-grid label { align-content: start; min-width: 0; }
.label-codes-grid input, .label-codes-grid select { height: 48px; min-height: 48px; font-weight: 500; }
.label-declaration-field { min-width: 0; }
.label-declaration-meta { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: space-between; gap: .25rem .75rem; margin-top: .5rem; }
.label-declaration-meta a { display: inline-flex; align-items: center; min-height: 40px; font-size: .8rem; font-weight: 600; }
.label-symbol-heading { display: grid; gap: .2rem; border-top: 1px solid var(--line); margin-top: 1.25rem; padding-top: 1.25rem; }
.label-codes-panel .label-symbol-toggles { gap: .65rem; margin-top: .8rem; }
.label-symbol-option { display: grid; grid-template-columns: 40px minmax(0, 1fr) 20px; align-items: center; gap: .75rem; min-height: 64px; padding: .6rem .8rem; border: 1px solid var(--line); border-radius: 9px; font-size: .9rem; font-weight: 600; cursor: pointer; background: var(--surface); }
.label-symbol-option:has(input:checked) { background: var(--accent-soft); border-color: #9fbdab; }
.label-symbol-option:hover { border-color: var(--accent); }
.label-symbol-option:has(input:focus-visible) { outline: 3px solid var(--accent); outline-offset: 2px; }
.label-symbol-option:has(input:disabled) { opacity: .6; cursor: wait; }
.label-symbol-option input { width: 20px; height: 20px; min-height: 20px; margin: 0; padding: 0; accent-color: var(--accent); cursor: inherit; }
.label-symbol-preview { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 5px; border-radius: 6px; background: #fff; }
.label-symbol-preview img { width: 100%; height: 100%; object-fit: contain; }
.label-code-preview { font-size: .7rem; font-weight: 800; letter-spacing: .02em; color: var(--muted); }
@media (max-width: 640px) {
  .label-codes-grid { grid-template-columns: 1fr; }
  .label-codes-panel .label-symbol-toggles { grid-template-columns: 1fr; }
  .label-manufacturer-card { align-items: flex-start; flex-wrap: wrap; }
}
.label-print-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

@media (max-width: 900px) {
  .label-editor-layout { grid-template-columns: 1fr; }
  .label-preview-panel { position: static; }
  .label-preview-stage { max-width: 540px; }
}
.assembly-counter { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.assembly-box { border: 1px solid #d4dfd7; border-radius: 12px; padding: 20px; margin: 16px 0; background: white; }
.assembly-controls, .assembly-scan, .assembly-package { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin: 12px 0; }
.assembly-scan label { flex: 1 1 250px; min-width: 0; }
.assembly-package { align-items: center; justify-content: space-between; border-bottom: 1px solid #d4dfd7; padding-bottom: 8px; }
.assembly-package span { overflow-wrap: anywhere; min-width: 0; }
.assembly-panel summary { cursor: pointer; padding: 12px 0; }
.workflow-start { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:20px; margin:24px 0; }
.stock-tabs { display:flex; gap:12px; flex-wrap:wrap; margin:20px 0; }
.stock-tabs [aria-current="page"] { background:#e2f0e7; border-color:#28643f; color:#1d5032; }
.workflow-start article { padding:24px; border:1px solid #d4dfd7; border-radius:12px; background:white; display:flex; flex-direction:column; align-items:flex-start; }
.workflow-start article p { max-width:60ch; }
.workflow-start article .button { margin-top:auto; }
.workflow-tasks { display:grid; gap:10px; }
.workflow-tasks a { display:flex; justify-content:space-between; gap:16px; padding:16px; border-bottom:1px solid #d4dfd7; flex-wrap:wrap; }
.workflow-task { display:grid; grid-template-columns:minmax(0, 1fr) auto; align-items:center; gap:12px; border-bottom:1px solid #d4dfd7; }
.workflow-task > a { border-bottom:0; }
.workflow-task form { margin-right:12px; }
.workflow-steps { list-style:none; padding:0; max-width:960px; }
.workflow-step { display:flex; gap:20px; padding:24px; margin:16px 0; background:white; border:1px solid #d4dfd7; border-radius:12px; }
.workflow-step p { max-width:65ch; }
.workflow-step h2 { margin:4px 0 12px; }
.workflow-number { font-size:1.4rem; color:#28643f; font-variant-numeric:tabular-nums; }
.workflow-current { border-left:4px solid #28643f; }
.workflow-manual { border-left:4px solid #bc852f; }
@media (max-width: 640px) { .workflow-start { grid-template-columns:1fr; } .workflow-step { padding:16px; gap:12px; } }

.row-actions-menu { position: relative; }
.row-actions-menu > summary { min-width: 72px; list-style: none; }
.row-actions-menu > summary::-webkit-details-marker { display: none; }
.row-actions-popover { position: absolute; z-index: 6; right: 0; top: calc(100% + .4rem); width: min(300px, calc(100vw - 2rem)); padding: .45rem; display: grid; gap: .2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 14px 32px rgba(29, 38, 31, .16); }
.row-actions-popover > a, .cancel-batch-action > summary { min-height: 44px; padding: .65rem .75rem; display: flex; align-items: center; border-radius: 7px; color: var(--text); text-decoration: none; font-weight: 650; cursor: pointer; }
.row-actions-popover > a:hover, .cancel-batch-action > summary:hover { background: var(--accent-soft); color: var(--accent); }
.cancel-batch-action { border-top: 1px solid var(--line); }
.cancel-batch-action > summary { color: var(--danger); list-style: none; }
.cancel-batch-action > summary::-webkit-details-marker { display: none; }
.cancel-batch-action form { display: grid; gap: .6rem; padding: .35rem .75rem .75rem; }
.cancel-batch-action label { font-size: .8rem; }

.overhead-summary { grid-template-columns: repeat(5, minmax(150px, 1fr)); }
.expense-form-panel h2, .recurring-month-summary h2 { margin-bottom: .35rem; }
.recurring-month-summary .clean-list { margin-top: 0; }
.recurring-month-summary:only-child { grid-column: 1 / -1; }
.empty-state.compact { min-height: 150px; padding: 1.5rem; }

@media (max-width: 900px) {
  .overhead-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .overhead-summary { grid-template-columns: 1fr; }
}

/* Report totals remain readable without horizontal scrolling. */
.finance-summary { min-width: 0; }
.finance-summary th { width: 62%; white-space: normal; overflow-wrap: anywhere; }
.finance-summary td { text-align: right; white-space: normal; overflow-wrap: anywhere; }

/* Compact production workspace. The existing form and table styles remain shared. */
.topbar { position: sticky; top: 0; z-index: 20; min-height: 60px; padding: .45rem 1.15rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; }
.account-profile strong { font-size: .88rem; }
.account-profile small:last-child { display: none; }
.app-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100dvh - 60px); }
.sidebar { background: #f0f3ee; border-right: 1px solid var(--line); }
.sidebar nav { position: sticky; top: 60px; max-height: calc(100dvh - 60px); overflow-y: auto; padding: 1.15rem .65rem 2rem; }
.nav-group + .nav-group { margin-top: 1.15rem; padding-top: .85rem; border-top: 1px solid var(--line); }
.nav-group-label { display: block; padding: .25rem .7rem .45rem; color: var(--muted); font-size: .67rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.sidebar a { min-height: 42px; padding: .55rem .7rem; display: flex; align-items: center; border-radius: 7px; color: var(--text); font-size: .89rem; font-weight: 600; text-decoration: none; }
.sidebar a:hover { background: #e3e9e0; }
.sidebar a[aria-current="page"] { color: var(--accent); background: #dcebdd; font-weight: 750; }
.app-layout > .page-shell { width: min(1480px, calc(100% - 3rem)); margin: 0 auto; padding: 1.55rem 0 4rem; min-width: 0; }
.app-layout .page-heading { margin-bottom: 1.25rem; }
.app-layout .page-heading h1 { font-size: clamp(1.65rem, 2.5vw, 2.35rem); }
.app-layout .page-heading .kicker { margin-bottom: .2rem; }
.workspace-heading { align-items: center; }
.dashboard-metrics { margin-bottom: 1rem; }
.dashboard-metrics .metric { min-height: 96px; padding: .8rem 1rem; gap: .2rem; }
.dashboard-metrics .metric span { font-size: .8rem; }
.dashboard-metrics .metric strong { font-size: 1.7rem; line-height: 1; }
.dashboard-metrics .metric small { color: var(--muted); font-size: .72rem; }
.work-status-links { margin: -.3rem 0 1rem; display: flex; gap: 1.25rem; flex-wrap: wrap; }
.work-status-links a { color: var(--muted); font-size: .78rem; text-decoration: none; }
.work-status-links a:hover { color: var(--accent); text-decoration: underline; }
.work-status-links strong { margin-left: .25rem; color: var(--text); font-variant-numeric: tabular-nums; }
.work-actions { padding: .6rem .75rem; display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.work-actions > span { margin-right: .5rem; color: var(--muted); font-size: .76rem; font-weight: 750; text-transform: uppercase; }
.work-actions .button { min-height: 38px; padding: .4rem .7rem; font-size: .84rem; }
.work-board { padding: 1rem 1.1rem .3rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.work-board .section-heading { gap: 1rem; flex-wrap: wrap; }
.work-board .section-heading h2 { margin-bottom: .4rem; }
.work-board h3 { margin: 1.15rem 0 .45rem; color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.work-rows { border-top: 1px solid var(--line); }
.work-row { min-height: 62px; padding: .6rem .1rem; display: grid; grid-template-columns: minmax(190px, 1fr) minmax(110px, auto) 90px minmax(155px, auto); align-items: center; gap: .75rem; border-bottom: 1px solid var(--line); color: var(--text); text-decoration: none; }
.work-row:hover { background: #f7faf6; }
.work-row-title { color: var(--text); font-weight: 700; text-decoration: none; }
.work-row-title small { display: block; color: var(--muted); font-size: .76rem; font-weight: 400; }
.work-row .numeric { text-align: right; white-space: nowrap; }
.work-row .status { justify-self: start; }
.work-row-next { justify-self: end; color: var(--accent); font-size: .82rem; font-weight: 700; text-align: right; }
.work-row form { justify-self: end; }
.work-row form .button { min-height: 40px; font-size: .8rem; }
.work-board-limit { margin: .7rem 0 0; }
.board-empty { margin: .6rem 0; }
.production-tabs { margin: .8rem 0 1rem; display: flex; gap: .4rem; flex-wrap: wrap; }
.production-tabs a { min-height: 40px; padding: .5rem .8rem; display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--text); font-size: .85rem; font-weight: 700; text-decoration: none; }
.production-tabs a:hover { border-color: var(--accent); color: var(--accent); }
.drying-overview { scroll-margin-top: 76px; }
.drying-overview h2 { margin-bottom: .7rem; }
.drying-overview p { margin-bottom: .8rem; color: var(--muted); font-size: .88rem; }
.drying-overview .table-wrap { border: 0; }
.drying-overview table { min-width: 650px; }
.drying-overview th, .drying-overview td { padding: .7rem .8rem; }
.drying-history > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 700; }
.drying-history .table-wrap { margin-top: .75rem; }
@media (max-width: 900px) {
  .work-row { grid-template-columns: minmax(160px, 1fr) auto auto; }
  .work-row-next, .work-row form { grid-column: 1 / -1; justify-self: start; }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .app-layout { display: block; }
  .mobile-nav { position: relative; display: block; }
  .mobile-nav > summary { border: 1px solid var(--line); background: var(--surface); }
  .mobile-nav > nav { position: absolute; z-index: 25; right: 0; top: calc(100% + .4rem); width: min(320px, calc(100vw - 2rem)); max-height: calc(100dvh - 75px); padding: .45rem; display: grid; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 14px 32px rgba(29, 38, 31, .16); }
  .mobile-nav .nav-group-label { padding-top: .8rem; }
  .topbar { display: flex; }
}
@media (max-width: 640px) {
  .app-layout > .page-shell { width: calc(100% - 1rem); padding-top: 1rem; }
  .account-profile { display: none; }
  .workspace-heading { align-items: flex-start; flex-wrap: wrap; }
  .dashboard-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-metrics .metric { min-height: 88px; }
  .work-board { padding: .8rem; }
  .work-row { grid-template-columns: minmax(0, 1fr) auto; gap: .3rem .6rem; }
  .work-row-title { grid-column: 1 / -1; }
  .work-row .numeric { grid-column: 2; grid-row: 2; }
  .work-row-next, .work-row form { grid-column: 1 / -1; }
  .mobile-nav > nav { position: fixed; top: 60px; left: 0; right: auto; width: min(320px, 100vw); max-height: calc(100dvh - 60px); border-radius: 0 0 9px 0; }
  .drying-overview table { min-width: 0; }
  .drying-overview thead { display: none; }
  .drying-overview tbody { display: grid; gap: .5rem; }
  .drying-overview tr { display: grid; gap: .25rem; padding: .7rem; border: 1px solid var(--line); border-radius: 7px; }
  .drying-overview td { display: flex; justify-content: space-between; gap: .75rem; padding: .1rem 0; border: 0; text-align: right; }
  .drying-overview td:first-child { font-weight: 700; }
  .drying-overview td::before { color: var(--muted); font-size: .76rem; font-weight: 700; text-align: left; }
  .drying-overview td:nth-child(1)::before { content: "Сушка"; }
  .drying-overview td:nth-child(2)::before { content: "Сырьё"; }
  #in-progress td:nth-child(3)::before { content: "Сушилки"; }
  #in-progress td:nth-child(4)::before { content: "Загрузка"; }
  #dry-stock td:nth-child(3)::before { content: "Выход"; }
  #dry-stock td:nth-child(4)::before { content: "Остаток"; }
  .drying-overview td:nth-child(5)::before { content: "Действие"; }
  .drying-overview td[colspan]::before { content: none; }
}


.supply-line {display:grid;grid-template-columns:minmax(200px,2fr) repeat(3,minmax(130px,1fr)) auto;gap:12px;align-items:end;margin:16px 0;padding-bottom:16px;border-bottom:1px solid var(--border,#d5ddd5)}
.supply-line label{display:flex;flex-direction:column;gap:6px}.supply-use{padding:12px 0;border-bottom:1px solid var(--border,#d5ddd5)}
@media(max-width:900px){.supply-line{grid-template-columns:1fr 1fr}.supply-line label:first-child{grid-column:1/-1}}
@media(max-width:480px){.supply-line{grid-template-columns:1fr}}

.row-actions-popover[popover] { position: fixed; inset: auto; margin: 0; width: min(280px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow-y: auto; box-sizing: border-box; }
.row-actions-popover[popover]:not(:popover-open) { display: none; }

.suz-order-metrics .metric { min-width: 0; min-height: 110px; justify-content: flex-start; gap: .65rem; }
.suz-order-metrics .metric-status strong { font-size: 1.1rem; line-height: 1.35; overflow-wrap: anywhere; }
.suz-order-metrics .suz-order-id strong { font-size: .9rem; line-height: 1.5; overflow-wrap: anywhere; font-weight: 600; }
@media (max-width: 600px) { .suz-order-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.batch-context { position: sticky; top: 66px; z-index: 12; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .7rem; padding: .8rem 1rem; margin-bottom: 1rem; background: #f0f6ed; border: 1px solid #c8d8c3; border-radius: 10px; }
.batch-context strong { display: block; font-size: 1.05rem; }
.batch-context small { display: block; overflow-wrap: anywhere; }
.batch-context nav { display: flex; flex-wrap: wrap; gap: .8rem; }
.workflow-next { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem; margin-bottom: 1rem; border: 1px solid #c8d8c3; border-radius: 10px; background: #f0f6ed; }
.workflow-next > div { flex: 1 1 240px; }
@media(max-width:600px) { .batch-context { position: static; } }

/* Marking results keep status prominent and technical references secondary. */
.marking-flow .workflow-step { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .65rem 1.5rem; padding: 1.25rem; }
.marking-flow .workflow-step h3 { font-size: 1.1rem; }
.marking-flow .workflow-step > p { grid-column: 2; grid-row: 1; }
.marking-flow .document-reference { grid-column: 1 / -1; order: 3; color: var(--muted, #60716a); font-size: .875rem; }
.marking-flow .document-reference summary { cursor: pointer; width: fit-content; }
.marking-flow .document-reference p { margin-top: .5rem; }
.marking-flow .workflow-step > form, .marking-flow .workflow-step > .alert { grid-column: 1 / -1; }
.marking-flow .workflow-step > form { justify-self: start; }
@media (max-width: 600px) {
  .marking-flow .workflow-step { grid-template-columns: minmax(0, 1fr); }
  .marking-flow .workflow-step > p { grid-column: 1; grid-row: auto; }
}

@media (min-width: 1200px) {
  .dashboard-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}
@media (min-width: 901px) and (max-width: 1199px) {
  .dashboard-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* The same operator frame remains visible throughout a batch. */
.production-workspace-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:1rem; margin-bottom:1rem; }
.production-workspace-heading h1 { font-size:clamp(1.5rem,2.7vw,2.3rem); margin:.25rem 0; }
.production-workspace-heading p { margin:.35rem 0; }
.production-progress ol { list-style:none; display:flex; padding:0; margin:0 0 1.5rem; border-bottom:1px solid var(--border,#d4dfd2); }
.production-progress li { flex:1; min-width:0; }
.production-progress a,.production-step-disabled { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; padding:.85rem .65rem; min-height:64px; color:inherit; text-decoration:none; border-bottom:3px solid transparent; }
.production-progress a > span,.production-step-disabled > span { border:1px solid currentColor; border-radius:50%; width:1.6rem; height:1.6rem; display:grid; place-items:center; flex-shrink:0; }
.production-progress .is-current a { color:#216740; border-bottom-color:#216740; background:#edf4eb; font-weight:700; }
.production-progress .is-done a { color:#216740; }
.production-progress small { display:block; width:100%; font-size:.75rem; }
.production-step-disabled { color:#69746c; }
.production-instruction { padding:1rem 1.25rem; border-left:4px solid #216740; background:#edf4eb; margin-bottom:1.5rem; }
.production-instruction h2 { margin:.25rem 0 .5rem; }
.production-reference { margin-bottom:1rem; padding:1rem; border:1px solid #d4dfd2; border-radius:12px; }
.production-workspace .packaging-heading { display:none; }
@media(max-width:700px) { .production-workspace-heading { display:block; } .production-progress ol { flex-direction:column; } .production-progress a,.production-step-disabled { min-height:44px; padding:.5rem; } .production-progress small { width:auto; margin-left:auto; } .production-instruction { padding:1rem; } }
