:root {
  --ink: #1d2520;
  --ink-soft: #445048;
  --muted: #748078;
  --line: #e2e5df;
  --paper: #f7f7f2;
  --panel: #ffffff;
  --wood: #a86535;
  --wood-dark: #784522;
  --wood-pale: #f4e9df;
  --green: #284c3c;
  --green-mid: #3b6952;
  --green-pale: #e8f0eb;
  --red: #a84538;
  --red-pale: #fbecea;
  --amber: #a66c1d;
  --amber-pale: #fcf2dd;
  --shadow: 0 12px 34px rgba(32, 44, 36, .07);
  --radius: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: 248px;
  padding: 24px 16px 18px;
  color: #f7f4eb;
  background:
    radial-gradient(circle at 0 0, rgba(184, 123, 72, .22), transparent 32%),
    linear-gradient(155deg, #213d32, #172a23 60%, #11221b);
  display: flex;
  flex-direction: column;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.brand-mark { flex: 0 0 42px; }
.brand-mark, .story-brand-logo, .invoice-logo {
  width: 42px; height: 42px; border-radius: 12px 12px 12px 3px;
  display: grid; place-items: center; overflow: hidden; padding: 5px;
  background: #fff;
  box-shadow: inset 0 1px rgba(255,255,255,.28);
}
.brand-mark img, .story-brand-logo img, .invoice-logo img { width: 100%; height: 100%; display: block; object-fit: contain; }
.brand strong { display: block; letter-spacing: .04em; font-size: 16px; }
.brand small { display: block; color: #aebdb3; font-size: 11px; margin-top: 2px; }

.nav-main { flex: 1; }
.nav-section-title {
  margin: 14px 12px 7px; color: #8fa497; font-size: 10px;
  font-weight: 700; letter-spacing: .16em;
}
.nav-link {
  width: 100%; min-height: 42px; display: flex; align-items: center; gap: 11px;
  padding: 8px 11px; border: 0; border-radius: 9px; color: #c8d2ca;
  background: transparent; text-align: left; font-size: 13.5px;
  transition: background .16s ease, color .16s ease;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-link.active { color: #fff; background: rgba(255,255,255,.11); box-shadow: inset 2px 0 #cc8c56; }
.nav-icon {
  width: 26px; height: 26px; flex: 0 0 26px; display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.15); border-radius: 7px;
  color: #d7c0a7; font-family: Georgia, serif; font-size: 11px;
}
.nav-link.active .nav-icon { color: #fff; border-color: rgba(255,255,255,.24); background: rgba(255,255,255,.08); }
.nav-button { font-family: inherit; }
.sidebar-foot { border-top: 1px solid rgba(255,255,255,.09); padding-top: 10px; }
.logout-form { margin: 0; }

.main-wrap { grid-column: 2; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: 72px; padding: 0 32px; display: flex; align-items: center; gap: 20px;
  border-bottom: 1px solid var(--line); background: rgba(247,247,242,.92);
  position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px);
}
.topbar-context { flex: 1; color: var(--muted); font-size: 10px; letter-spacing: .13em; font-weight: 700; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip strong, .user-chip small { display: block; }
.user-chip strong { font-size: 13px; }
.user-chip small { color: var(--muted); font-size: 11px; }
.avatar {
  width: 36px; height: 36px; display: grid; place-items: center;
  color: var(--green); background: var(--green-pale); border: 1px solid #d7e2da;
  border-radius: 10px; font-weight: 700;
}
.language-switch {
  display: inline-flex; padding: 2px; border: 1px solid var(--line);
  border-radius: 7px; background: #fff; font-size: 9px; font-weight: 750;
}
.language-switch a { min-width: 29px; padding: 5px 7px; border-radius: 5px; color: var(--muted); text-align: center; }
.language-switch a.active { color: #fff; background: var(--green); }
.login-body > .language-switch { position: fixed; top: 20px; right: 24px; z-index: 5; }
.menu-toggle {
  display: none; border: 1px solid var(--line); background: #fff;
  width: 38px; height: 38px; border-radius: 9px; color: var(--ink);
}

.content { width: 100%; max-width: 1500px; margin: 0 auto; padding: 34px 32px 54px; flex: 1; }
.app-footer { padding: 14px 32px 24px; color: #949d96; font-size: 10.5px; text-align: right; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-head h1 { margin: 0; font-size: clamp(27px, 3vw, 38px); font-weight: 650; letter-spacing: -.035em; line-height: 1.18; }
.eyebrow { margin: 0 0 7px; color: var(--wood); font-size: 9.5px; font-weight: 800; letter-spacing: .18em; }
.page-subtitle { margin: 8px 0 0; max-width: 720px; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.page-actions form { margin: 0; }

.button {
  min-height: 40px; padding: 9px 16px; display: inline-flex; align-items: center;
  justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 9px;
  font-weight: 650; font-size: 12.5px; line-height: 1.2; transition: .16s ease;
  white-space: nowrap;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--green); border-color: var(--green); box-shadow: 0 7px 18px rgba(40,76,60,.15); }
.button-primary:hover { background: #1f3e30; }
.button-secondary { color: var(--green); background: var(--green-pale); border-color: #d7e2da; }
.button-dark { color: #fff; background: #303a34; border-color: #303a34; }
.button-quiet { color: var(--ink-soft); background: #fff; border-color: var(--line); }
.button-danger { color: #fff; background: var(--red); border-color: var(--red); }
.button-wide { width: 100%; }
.button-large { min-height: 48px; font-size: 13.5px; }
.button-small { min-height: 32px; padding: 6px 11px; font-size: 11px; }
.button:disabled { cursor: not-allowed; opacity: .48; transform: none; }
.text-link { color: var(--green-mid); font-size: 12px; font-weight: 700; }
.text-link:hover { text-decoration: underline; }

.notice {
  min-height: 44px; margin: -12px 0 20px; padding: 11px 14px; border-radius: 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border: 1px solid; font-size: 12.5px;
}
.notice button { border: 0; background: none; color: inherit; font-weight: 700; }
.notice-success { color: #28593f; background: #ebf4ee; border-color: #cce1d2; }
.notice-error { color: #883a31; background: var(--red-pale); border-color: #f0cfca; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 18px; }
.stat-card {
  min-height: 142px; padding: 20px 21px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--panel); box-shadow: 0 3px 10px rgba(40,50,42,.025);
  display: flex; flex-direction: column; justify-content: space-between;
}
.stat-card > span { color: var(--muted); font-size: 11.5px; font-weight: 650; }
.stat-card > strong { margin: 9px 0 2px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(25px, 2.4vw, 34px); font-weight: 500; letter-spacing: -.035em; }
.stat-card > small { color: #8a938c; font-size: 10.5px; }
.stat-card.accent { color: #fff; border-color: var(--green); background: linear-gradient(135deg, #315d48, #203f31); }
.stat-card.accent > span, .stat-card.accent > small { color: #bdd0c3; }
.stat-card.warning { border-color: #edd7ae; background: linear-gradient(145deg, #fffdf8, #fdf5e6); }
.stat-card.warning > strong { color: var(--amber); }
.report-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.mini-stats { display: flex; gap: 0; margin-bottom: 16px; border: 1px solid var(--line); border-radius: 11px; background: #fff; overflow: hidden; }
.mini-stats > div { flex: 1; padding: 13px 18px; border-right: 1px solid var(--line); display: flex; align-items: baseline; gap: 8px; }
.mini-stats > div:last-child { border-right: 0; }
.mini-stats span { color: var(--muted); font-size: 10.5px; }
.mini-stats strong { font-family: Georgia, serif; font-size: 18px; font-weight: 500; }
.mini-stats small { color: #929b94; font-size: 9.5px; }

.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }
.panel {
  min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 3px 10px rgba(40,50,42,.025);
}
.panel-head { padding: 18px 20px 14px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.panel-head h2 { margin: 0; font-size: 15px; letter-spacing: -.01em; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 10.5px; }
.panel-separator { height: 1px; background: var(--line); margin: 18px 20px 15px; }
.mini-heading { margin: 0 20px 9px; font-size: 11px; color: var(--ink-soft); }

.table-wrap { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  padding: 10px 14px; color: #8a938c; background: #fafaf7;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  text-align: left; font-size: 9.5px; font-weight: 750; letter-spacing: .035em;
  white-space: nowrap;
}
td { padding: 13px 14px; border-bottom: 1px solid #eceee9; vertical-align: middle; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfcf9; }
th:first-child, td:first-child { padding-left: 20px; }
th:last-child, td:last-child { padding-right: 20px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.cell-sub { display: block; margin-top: 3px; color: #909991; font-size: 9.5px; font-weight: 400; }
.table-link { color: var(--green-mid); font-weight: 700; }
.table-link:hover { text-decoration: underline; }
.package-link { display: inline-flex; flex-direction: column; color: var(--green-mid); }
.package-link strong { font-size: 11px; }
.package-link small { margin-top: 2px; color: var(--muted); font-size: 8.5px; }
.package-link:hover strong { text-decoration: underline; }
.table-foot { padding: 11px 20px; border-top: 1px solid var(--line); color: #8b948d; background: #fbfbf8; border-radius: 0 0 var(--radius) var(--radius); font-size: 9.5px; }
.pagination-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 18px; border-top: 1px solid var(--line); background: #fbfbf8; }
.pagination-bar > span { color: var(--muted); font-size: 10px; }
.pagination { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.page-button { min-width: 30px; min-height: 30px; padding: 5px 9px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink-soft); font-size: 10px; font-weight: 700; }
.page-button:hover { border-color: #9fb8a7; color: var(--green); }
.page-button.active { color: #fff; background: var(--green); border-color: var(--green); }
.page-button.disabled { color: #adb5af; background: #f3f4f1; cursor: not-allowed; }
.page-button.page-arrow { min-width: 78px; }
.page-ellipsis { padding: 0 3px; color: var(--muted); }
.stock-low { color: var(--red); }
.icon-danger { color: var(--red); background: var(--red-pale); border-color: #efcec9; }
.positive { color: #397050; }
.negative { color: var(--red); }
.muted { color: var(--muted); }

.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: 9.5px; font-weight: 750; white-space: nowrap; }
.badge-shipped, .badge-active, .badge-paid { color: #2e6347; background: #eaf3ed; }
.badge-partial { color: #8b621f; background: var(--amber-pale); }
.badge-unpaid { color: #8d3b32; background: var(--red-pale); }
.badge-canceled, .badge-inactive { color: #737b75; background: #eef0ec; }
.badge-preparing, .badge-submitted { color: #8b621f; background: var(--amber-pale); }
.badge-approved { color: #2e6347; background: #eaf3ed; }
.badge-rejected { color: #8d3b32; background: var(--red-pale); }
.badge-exported { color: #315f7a; background: #e8f0f5; }
.badge-local { color: #6a4c20; background: #f4ead8; }
.badge-reserved { color: #7a5622; background: #f5eee2; }

.channel-chart { padding: 2px 20px 8px; }
.channel-row { margin-bottom: 16px; }
.channel-label { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 11px; }
.channel-label strong { font-family: Georgia, serif; font-weight: 500; }
.channel-row small { display: block; margin-top: 5px; color: #909991; font-size: 9px; }
.progress { height: 5px; overflow: hidden; border-radius: 999px; background: #edf0ec; }
.progress i { display: block; height: 100%; min-width: 2px; border-radius: inherit; background: linear-gradient(90deg, var(--wood), #c99769); }

.stock-alerts { padding: 0 20px 18px; }
.stock-alert { display: flex; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid #eef0ec; }
.stock-alert:last-child { border-bottom: 0; }
.stock-alert strong { display: block; font-size: 11px; }
.stock-alert small { color: #909991; font-size: 9px; }
.stock-alert > span { color: var(--red); font-size: 10px; white-space: nowrap; }

.timeline { padding: 0 20px 16px; }
.timeline-item { display: grid; grid-template-columns: 7px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; }
.movement-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green-mid); box-shadow: 0 0 0 4px var(--green-pale); }
.movement-dot.type-out, .movement-dot.type-sale { background: var(--wood); box-shadow: 0 0 0 4px var(--wood-pale); }
.movement-dot.type-adjust { background: var(--amber); box-shadow: 0 0 0 4px var(--amber-pale); }
.timeline-item strong { display: block; font-size: 10.5px; }
.timeline-item small { color: #929b94; font-size: 8.8px; }
.timeline-item > span { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 10.5px; }

.workstation-card {
  padding: 26px; color: #e9efe9; border-color: #294b3c;
  background: radial-gradient(circle at 90% 20%, rgba(177,110,58,.23), transparent 30%), linear-gradient(140deg, #294a3b, #1b332a);
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, 1fr); gap: 35px; align-items: center;
}
.workstation-card h2 { margin: 0 0 8px; font-family: Georgia, serif; font-size: 23px; font-weight: 500; }
.workstation-card p:not(.eyebrow) { max-width: 570px; margin: 0; color: #bdccc1; font-size: 11px; line-height: 1.7; }
.workflow-steps { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.workflow-steps span { padding: 10px; border: 1px solid rgba(255,255,255,.13); border-radius: 8px; color: #d3ddd5; font-size: 10px; background: rgba(255,255,255,.035); }
.workflow-steps b { color: #d9a472; margin-right: 6px; font-family: Georgia, serif; }

.empty-state { padding: 55px 20px; text-align: center; }
.empty-mark { width: 46px; height: 46px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 14px 14px 14px 4px; color: #fff; background: #9b6b46; font-family: Georgia, serif; font-size: 22px; }
.empty-state h3 { margin: 0 0 5px; font-size: 14px; }
.empty-state p { margin: 0 0 14px; color: var(--muted); font-size: 10.5px; }
.empty-inline { padding: 24px; color: var(--muted); text-align: center; font-size: 10.5px; }

.species-flow-panel { margin: 0 0 18px; }
.species-flow-table th { padding: 10px 12px; text-align: center; white-space: nowrap; }
.species-flow-table td { padding: 9px 10px; text-align: center; vertical-align: middle; }
.species-flow-table td:first-child { text-align: left; }
.species-flow-metric {
  min-width: 112px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 2px 7px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}
.species-flow-metric strong { grid-row: span 2; font-family: Georgia, serif; font-size: 18px; }
.species-flow-metric span { color: var(--ink-soft); font-size: 8.5px; }
.species-flow-metric small { color: var(--muted); font-size: 9px; font-weight: 700; }
.species-flow-metric:hover { border-color: currentColor; filter: saturate(1.1); }
.species-flow-metric.is-stock { color: #2e6347; background: #eaf3ed; }
.species-flow-metric.is-reserved { color: #8b621f; background: #f7efdf; }
.species-flow-metric.is-export { color: #315f7a; background: #e8f0f5; }
.species-flow-metric.is-local { color: #6a4c20; background: #f4ead8; }
.species-flow-total td { border-top: 2px solid #bfc8c0; background: #fafbf8; }
.raw-species-summary { margin: 0 0 18px; }
.raw-species-summary th { padding: 10px 12px; white-space: nowrap; }
.raw-species-summary td { padding: 10px 12px; vertical-align: middle; }
.raw-species-summary td strong { color: var(--green); font-family: Georgia, serif; font-size: 16px; }
.raw-species-summary .positive { color: #2e6347; font-weight: 700; }
.raw-species-summary .negative { color: #9d4136; font-weight: 700; }
.raw-species-total td { border-top: 2px solid #bfc8c0; background: #fafbf8; }

.filter-bar { display: flex; align-items: center; gap: 9px; padding: 15px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.filter-bar select, .filter-bar input:not([type=checkbox]) { min-height: 38px; }
.package-export-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 18px; color: var(--muted); border-bottom: 1px solid var(--line);
  background: #f7f8f4; font-size: 10px;
}
.package-export-bar label { display: flex; align-items: center; gap: 6px; color: var(--ink); }
.package-export-bar span { margin-right: auto; }
.package-export-bar .button { margin-left: 0; }
.package-export-bar [data-package-selected-inputs] { display: none; }
.ave-bulk-selector {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #f7f8f4;
}
.ave-bulk-selector .field { flex: 1; min-width: 290px; }
.ave-bulk-selector .field > span { display: block; margin-bottom: 5px; }
.ave-bulk-selector .button { flex: none; }
.ave-bulk-result {
  flex-basis: 100%;
  padding: 9px 11px;
  color: var(--ink-soft);
  border: 1px solid #ccd8cf;
  border-radius: 8px;
  background: #fff;
  font-size: 10px;
  line-height: 1.5;
}
.ave-bulk-result p { margin: 0; }
.ave-bulk-summary { color: var(--green); font-weight: 700; }
.ave-bulk-errors { margin-top: 3px !important; color: #a84c3e; }
.sale-bulk-package-selector {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  flex-wrap: wrap;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #f7f8f4;
}
.sale-bulk-package-selector .field:first-child { flex: 1; min-width: 250px; }
.sale-bulk-package-selector .field:nth-child(2) { width: 190px; }
.sale-bulk-package-selector .field > span { display: block; margin-bottom: 5px; }
.sale-bulk-package-selector .button { flex: none; }
.sale-bulk-result {
  flex-basis: 100%;
  padding: 9px 11px;
  color: var(--ink-soft);
  border: 1px solid #ccd8cf;
  border-radius: 8px;
  background: #fff;
  font-size: 10px;
  line-height: 1.5;
}
.sale-bulk-result p { margin: 0; }
.sale-bulk-summary { color: var(--green); font-weight: 700; }
.sale-bulk-errors { margin-top: 3px !important; color: #a84c3e; }
.search-box { flex: 1; min-width: 210px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 8px; padding: 0 11px; background: #fff; }
.search-box span { color: #919a93; font-size: 18px; }
.search-box input { border: 0; background: transparent; outline: 0; width: 100%; min-height: 38px; }
.export-link { margin-left: auto; padding: 9px 2px; }
.check-field { display: flex; align-items: center; gap: 6px; color: var(--ink-soft); font-size: 11px; white-space: nowrap; }
input, select, textarea {
  min-height: 40px; padding: 9px 11px; color: var(--ink); border: 1px solid #d9ddd7;
  border-radius: 8px; background: #fff; outline: none; transition: border .15s, box-shadow .15s;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #6e947c; box-shadow: 0 0 0 3px rgba(60,105,81,.1); }
input[type=checkbox], input[type=radio] { min-height: auto; accent-color: var(--green); }
.form-nonce {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
.row-actions { display: flex; align-items: center; gap: 5px; }
.icon-button {
  min-width: 29px; height: 29px; padding: 0 6px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: 7px; color: var(--ink-soft);
  background: #fff; font-size: 9.5px; font-weight: 700;
}
.icon-button:hover { color: var(--green); border-color: #bfcfc3; background: var(--green-pale); }
.icon-button:disabled { opacity: .35; cursor: not-allowed; }
.inline-form { margin: 0; }

.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.form-main { display: grid; gap: 16px; min-width: 0; }
.form-aside { display: grid; gap: 14px; position: sticky; top: 92px; }
.form-section { min-width: 0; padding: 20px; }
.section-heading { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 17px; }
.section-heading > span { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; border-radius: 8px; background: var(--wood-pale); color: var(--wood-dark); font-family: Georgia, serif; font-size: 10px; font-weight: 700; }
.section-heading > div { flex: 1; }
.section-heading h3 { margin: 0; font-size: 14px; }
.section-heading p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-grid-4 { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { color: #525d55; font-size: 10.5px; font-weight: 700; }
.field small { color: #8b948d; font-size: 9px; }
.field input, .field select, .field textarea { width: 100%; }
.auto-customer-code {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 9px 11px;
  color: var(--green);
  border: 1px dashed #b8c8bd;
  border-radius: 8px;
  background: var(--green-pale);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  letter-spacing: .03em;
}
.field-help { line-height: 1.45; }
.company-logo-preview {
  min-height: 82px;
  display: grid;
  place-items: center;
  padding: 8px;
  overflow: hidden;
  color: var(--muted);
  background: #f7f8f4;
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 10px;
}
.company-logo-preview img {
  width: 100%;
  height: 64px;
  display: block;
  object-fit: contain;
}
.money-input { display: flex; align-items: center; border: 1px solid #d9ddd7; border-radius: 8px; background: #fff; overflow: hidden; }
.money-input:focus-within { border-color: #6e947c; box-shadow: 0 0 0 3px rgba(60,105,81,.1); }
.money-input b { padding-left: 11px; color: var(--muted); font-weight: 500; }
.money-input input { border: 0; box-shadow: none; }
.form-actions { display: grid; gap: 8px; }
.inline-actions { display: flex; justify-content: flex-end; }
.compact .section-heading { margin-bottom: 14px; }
.compact .field { margin-bottom: 12px; }
.locked-stock { margin: 0 20px 20px; padding: 12px 14px; display: flex; align-items: center; gap: 12px; border-radius: 9px; background: var(--green-pale); color: var(--green); font-size: 10.5px; }
.locked-stock span { flex: 1; color: var(--ink-soft); }
.locked-stock a { font-weight: 700; white-space: nowrap; }
.info-card { padding: 18px; border: 1px solid #ead9c7; border-radius: var(--radius); background: #fffaf3; }
.info-card strong { font-size: 12px; }
.info-card p { margin: 7px 0 0; color: #765d45; font-size: 10.5px; line-height: 1.65; }
.narrow-form { max-width: 720px; margin: 0 auto; display: grid; gap: 14px; }

.stock-context { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; max-width: 900px; margin: 0 auto 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--line); }
.stock-context > div { padding: 13px 15px; background: #fff; }
.stock-context span { display: block; color: var(--muted); font-size: 9.5px; }
.stock-context strong { font-size: 12px; }
.segmented { display: flex; padding: 3px; margin-bottom: 19px; border-radius: 9px; background: #f0f2ee; }
.segmented label { flex: 1; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { height: 34px; display: grid; place-items: center; border-radius: 7px; color: var(--muted); font-size: 11px; font-weight: 650; cursor: pointer; }
.segmented input:checked + span { color: var(--green); background: #fff; box-shadow: 0 2px 7px rgba(40,50,42,.07); }
.item-hero { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 0; margin-bottom: 16px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.item-hero > div { padding: 18px 20px; border-right: 1px solid var(--line); }
.item-hero > div:last-child { border-right: 0; }
.item-hero p, .item-hero span { margin: 0; color: var(--muted); font-size: 9.5px; }
.item-hero h2 { margin: 4px 0 0; font-family: Georgia, serif; font-size: 20px; font-weight: 500; }
.item-hero strong { display: block; margin-top: 3px; font-family: Georgia, serif; font-size: 22px; font-weight: 500; }
.item-hero small { font-family: inherit; font-size: 11px; }
.raw-value-hero { grid-template-columns: 1.4fr repeat(4, 1fr); }
.movement-tag { display: inline-flex; padding: 3px 7px; border-radius: 5px; background: #eef2ef; color: var(--green-mid); font-size: 9.5px; font-weight: 700; }
.movement-tag.type-sale, .movement-tag.type-out { color: var(--wood-dark); background: var(--wood-pale); }
.movement-tag.type-cancel_return { color: var(--red); background: var(--red-pale); }

.sale-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.sale-layout > div { display: grid; gap: 16px; }
.sale-summary { position: sticky; top: 92px; padding: 22px; }
.sale-summary h2 { margin: 0 0 17px; font-family: Georgia, serif; font-size: 23px; font-weight: 500; }
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; color: var(--ink-soft); font-size: 11px; }
.summary-row strong { color: var(--ink); }
.compact-field { margin: 10px 0; }
.summary-total { margin-top: 10px; padding-top: 15px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: baseline; }
.summary-total strong { font-family: Georgia, serif; font-size: 24px; font-weight: 500; }
.summary-warning { margin: 11px 0; padding: 8px; color: var(--red); background: var(--red-pale); border-radius: 7px; font-size: 9.5px; }
.summary-help { margin: 11px 0 0; color: #8b948d; font-size: 9px; line-height: 1.55; }
.sale-form .button-large { margin-top: 16px; }
.sale-lines-wrap { border-top: 1px solid var(--line); }
.sale-lines th:first-child, .sale-lines td:first-child { padding-left: 20px; }
.sale-lines td { padding-top: 9px; padding-bottom: 9px; }
.sale-lines select { min-width: 240px; }
.sale-lines input { width: 92px; min-height: 36px; }
.sale-lines textarea { width: min(280px, 28vw); min-height: 54px; resize: vertical; }
.custom-invoice-line input { width: 78px; }
.sale-lines .unit-cell { color: var(--muted); font-weight: 700; }
.sale-lines .line-total { min-width: 90px; white-space: nowrap; }
.available { display: block; min-height: 12px; margin-top: 2px; color: var(--muted); font-size: 8.5px; }
.available.low { color: var(--red); }
.export-fields[hidden] { display: none; }
.formula-strip, .production-formula {
  margin-top: 15px; padding: 13px 15px; display: grid; grid-template-columns: auto 1fr;
  gap: 3px 14px; align-items: baseline; border: 1px solid #dee4dc;
  border-radius: 9px; background: linear-gradient(135deg, #f2f7f3, #fbfcf9);
}
.formula-strip span, .production-formula span { color: var(--muted); font-size: 9.5px; font-weight: 700; }
.formula-strip strong, .production-formula strong { color: var(--green); font-family: Georgia, serif; font-size: 20px; font-weight: 500; }
.formula-strip small, .production-formula small { grid-column: 1 / -1; color: #7d887f; font-size: 9px; }
.raw-cost-total { margin-top: 13px; padding-top: 13px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); }
.raw-cost-total span { color: var(--muted); font-size: 10px; }
.raw-cost-total strong { font-family: Georgia, serif; font-size: 18px; font-weight: 500; }
.raw-measures-wrap { max-width: 100%; min-width: 0; margin-top: -4px; border: 1px solid var(--line); border-radius: 9px; }
.raw-measures { min-width: 1250px; }
.raw-measures th:first-child, .raw-measures td:first-child { padding-left: 12px; width: 38px; }
.raw-measures th:last-child, .raw-measures td:last-child { padding-right: 10px; width: 45px; }
.raw-measures td { padding: 7px 6px; }
.raw-measures input { min-width: 90px; min-height: 36px; padding: 7px 9px; }
.raw-measures td:nth-child(2) input, .raw-measures td:nth-child(3) input { min-width: 120px; }
.raw-measures td:nth-child(11) input { min-width: 170px; }
.measurement-line-no { color: var(--muted); font-family: Georgia, serif; text-align: center; }
.raw-total-strip > div { display: flex; align-items: baseline; gap: 7px; }
.raw-total-strip > div strong { margin-right: 2px; }
.raw-total-strip > div small { color: var(--muted); font-size: 9px; }
.raw-measurement-history { margin-bottom: 16px; }
.package-widths-wrap { margin-top: -4px; border: 1px solid var(--line); border-radius: 9px; }
.package-widths { min-width: 520px; }
.package-widths th:first-child, .package-widths td:first-child { width: 38px; padding-left: 12px; }
.package-widths th:last-child, .package-widths td:last-child { width: 46px; }
.package-widths td { padding: 7px 6px; }
.package-widths input { min-height: 36px; padding: 7px 9px; }
.table-add-row { display: flex; justify-content: flex-start; padding: 10px 0 14px; }
.package-total-strip > div { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.package-total-strip > div small { color: var(--muted); font-size: 9px; margin-right: 5px; }
.package-cube-card {
  margin-top: 13px; padding: 13px; display: flex; justify-content: space-between;
  align-items: baseline; border: 1px solid #d7e2da; border-radius: 9px; background: var(--green-pale);
}
.package-cube-card span { color: var(--muted); font-size: 9.5px; }
.package-cube-card strong { color: var(--green); font-family: Georgia, serif; font-size: 18px; font-weight: 500; }
.package-location-list { padding: 0 20px 16px; }
.package-location-list p { display: flex; justify-content: space-between; gap: 12px; margin: 0; padding: 9px 0; border-top: 1px solid #eef0ec; }
.package-location-list span { color: var(--muted); font-size: 10px; }
.package-location-list strong { font-size: 11px; }

.stage-pill {
  display: inline-flex; padding: 4px 8px; border: 1px solid #d8e2da;
  border-radius: 999px; color: var(--green-mid); background: var(--green-pale);
  font-size: 9px; font-weight: 750; white-space: nowrap;
}
.production-board {
  display: grid; grid-template-columns: 1fr 42px 1fr; gap: 0;
  align-items: stretch; margin-bottom: 16px;
}
.production-source, .production-output {
  padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff;
}
.production-source { background: linear-gradient(145deg, #fffaf4, #fff); }
.production-output { background: linear-gradient(145deg, #f3f7f4, #fff); }
.production-source h2, .production-output h2 { margin: 4px 0; font-family: Georgia, serif; font-size: 21px; font-weight: 500; }
.production-source p, .production-output p { margin: 0 0 10px; color: var(--muted); font-size: 10px; }
.production-source > strong, .production-output > strong { font-family: Georgia, serif; font-size: 26px; font-weight: 500; color: var(--green); }
.production-arrow { display: grid; place-items: center; color: var(--wood); font-size: 24px; }
.production-detail-grid { align-items: start; }
.production-kpis > div:not(.panel-head) { padding: 10px 20px; display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid #eef0ec; }
.production-kpis > div span { color: var(--muted); font-size: 10px; }
.production-kpis > div strong { font-family: Georgia, serif; font-size: 14px; font-weight: 500; }
.stage-track { padding: 0 20px 22px; display: flex; justify-content: space-between; gap: 4px; }
.stage-track-item { flex: 1; text-align: center; color: #9ba49d; font-size: 8.5px; }
.stage-track-item i { width: 100%; height: 4px; display: block; margin-bottom: 7px; border-radius: 99px; background: #e7ebe6; }
.stage-track-item.done { color: var(--green-mid); }
.stage-track-item.done i { background: linear-gradient(90deg, var(--green-mid), #7fa38d); }
.production-timeline-item { display: flex; gap: 9px; align-items: center; padding: 8px 0; }
.production-timeline-item small { display: block; margin-top: 2px; color: var(--muted); font-size: 8.5px; }
.inspection-form { display: flex; gap: 8px; align-items: end; }
.inspection-form .field { min-width: 150px; }

.import-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; margin-bottom: 16px; }
.import-form { display: grid; gap: 10px; }
.import-option {
  position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 13px 14px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer;
}
.import-option:has(input:checked) { border-color: #9db7a7; background: #f2f7f4; box-shadow: inset 3px 0 var(--green-mid); }
.import-option input { margin-top: 3px; }
.import-option strong, .import-option small { display: block; }
.import-option strong { font-size: 11px; }
.import-option small { margin-top: 2px; color: var(--muted); font-size: 9px; line-height: 1.45; }
.file-drop {
  min-height: 110px; padding: 20px; display: grid; place-items: center; text-align: center;
  border: 1px dashed #b8c8bb; border-radius: 10px; background: #fbfcf9; cursor: pointer;
}
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop strong { font-size: 11px; color: var(--green-mid); }
.file-drop span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.import-guide { padding: 20px; }
.import-guide h2 { margin: 0 0 14px; font-family: Georgia, serif; font-size: 20px; font-weight: 500; }
.import-guide p { margin: 0 0 11px; color: #667168; font-size: 10px; line-height: 1.65; }
.import-guide b { color: var(--ink); }
.import-summary {
  display: grid; grid-template-columns: 1.5fr repeat(3, 1fr); gap: 1px; margin-bottom: 16px;
  overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--line);
}
.import-summary > div { padding: 12px 16px; background: #fff; }
.import-summary span, .import-summary strong { display: block; }
.import-summary span { color: var(--muted); font-size: 9px; }
.import-summary strong { margin-top: 3px; font-family: Georgia, serif; font-size: 16px; font-weight: 500; }
.import-summary .error-number strong { color: var(--red); }
.import-row-error { background: #fff5f3 !important; }
.import-row-error td:last-child { color: var(--red); font-weight: 650; }

.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-form {
  position: absolute; z-index: 30; top: calc(100% + 7px); right: 0; width: 290px;
  padding: 18px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; box-shadow: var(--shadow);
}
.dropdown-form h3 { margin: 0 0 5px; font-size: 14px; }
.dropdown-form p { margin: 0 0 12px; color: var(--muted); font-size: 10px; line-height: 1.55; }
.dropdown-form .field { margin-bottom: 11px; }
.dropdown-danger .dropdown-form { border-color: #edcfcb; }

.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; align-items: start; }
.permission-guide { margin-top: 18px; padding-top: 15px; border-top: 1px solid var(--line); }
.permission-guide > strong { font-size: 11px; }
.permission-guide p { margin: 6px 0; color: var(--muted); font-size: 9.5px; }
.permission-guide b { color: var(--ink); }

.report-channels { padding: 4px 20px 20px; }
.report-channel { padding: 10px 0; border-bottom: 1px solid #eef0ec; }
.report-channel:last-child { border-bottom: 0; }
.report-channel > div:first-child, .report-channel { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.report-channel span { color: var(--muted); font-size: 9px; margin-left: 7px; }
.report-channel > b { font-family: Georgia, serif; font-size: 13px; font-weight: 500; }
.report-channel .progress { width: 100%; margin-top: 6px; }
.rank-list { padding: 0 20px 16px; }
.rank-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #eef0ec; }
.rank-row:last-child { border-bottom: 0; }
.rank-row strong, .rank-row small { display: block; }
.rank-row strong { font-size: 10.5px; }
.rank-row small { color: var(--muted); font-size: 8.5px; }
.rank-row > span { font-family: Georgia, serif; font-size: 12px; }
.report-filter { margin-bottom: 14px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.inline-field { display: grid; grid-template-columns: auto 140px; align-items: center; gap: 8px; }

/* Login */
.login-body { background: #eef0e8; }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(420px, .88fr); }
.login-story {
  position: relative; overflow: hidden; padding: clamp(30px, 5vw, 68px);
  display: flex; flex-direction: column; color: #f5f1e8;
  background:
    linear-gradient(155deg, rgba(30, 58, 47, .9), rgba(18, 37, 30, .97)),
    repeating-linear-gradient(112deg, #6c4d35 0 2px, #815c3e 2px 22px, #6c4a32 22px 24px);
}
.login-story::after {
  content: ""; position: absolute; inset: auto -10% -22% 35%; height: 65%;
  border-radius: 50%; background: radial-gradient(ellipse, rgba(193,126,70,.35), transparent 68%); pointer-events: none;
}
.story-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; font-size: 17px; letter-spacing: .04em; }
.story-brand-logo { width: 52px; height: 52px; border: 1px solid rgba(255,255,255,.32); border-radius: 14px 14px 14px 4px; }
.story-copy { position: relative; z-index: 1; margin: auto 0; max-width: 680px; }
.story-copy .eyebrow { color: #d6a173; }
.story-copy h1 { margin: 10px 0 20px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(42px, 5.8vw, 76px); font-weight: 400; line-height: 1.06; letter-spacing: -.045em; }
.story-copy > p:last-child { max-width: 550px; color: #bccdc1; font-size: clamp(13px, 1.3vw, 16px); line-height: 1.7; }
.story-metrics { position: relative; z-index: 1; display: flex; gap: 36px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.14); }
.story-metrics strong, .story-metrics span { display: block; }
.story-metrics strong { color: #e2b081; font-family: Georgia, serif; font-size: 21px; font-weight: 400; }
.story-metrics span { color: #a9bcb0; font-size: 10px; }
.story-foot { position: absolute; bottom: 25px; left: clamp(30px, 5vw, 68px); margin: 0; color: #81978a; font-size: 9px; letter-spacing: .04em; }
.login-panel { display: grid; place-items: center; padding: 35px; background: #f6f5ef; }
.login-card { width: 100%; max-width: 370px; }
.login-card h2 { margin: 0 0 4px; font-family: Georgia, serif; font-size: 30px; font-weight: 500; letter-spacing: -.025em; }
.login-card > .muted { margin: 0 0 23px; font-size: 11px; }
.login-card .notice { margin: 0 0 15px; }
.login-card .field { margin-bottom: 14px; }
.login-card .field input { min-height: 45px; }
.login-card .button { min-height: 46px; margin-top: 6px; }
.login-help { margin: 18px 0 0; color: #909a92; font-size: 9px; line-height: 1.6; }

/* Invoice: French / OHADA commercial invoice */
.invoice-toolbar { max-width: 1080px; margin: 0 auto 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.invoice-toolbar .page-actions { position: relative; }
.invoice-sheet {
  max-width: 1080px; min-height: 760px; margin: 0 auto; padding: 46px 50px 32px;
  border: 1px solid #d8d8d2; background: #fff; color: #1b211d;
  box-shadow: 0 15px 50px rgba(28,38,32,.09); font-size: 11px;
}
.invoice-header { padding-bottom: 22px; display: flex; justify-content: space-between; align-items: flex-start; gap: 32px; border-bottom: 3px double #2f473b; }
.invoice-company { display: flex; gap: 13px; align-items: flex-start; }
.invoice-logo { width: 52px; height: 52px; border-radius: 13px 13px 13px 3px; padding: 4px; }
.invoice-company h1 { margin: 0 0 3px; font-family: Georgia, serif; font-size: 20px; font-weight: 600; }
.invoice-company p { margin: 1px 0; color: #566158; font-size: 9.5px; }
.invoice-title { text-align: right; min-width: 240px; }
.invoice-title > span { color: var(--wood); font-size: 9px; font-weight: 800; letter-spacing: .2em; }
.invoice-title h2 { margin: 2px 0 3px; font-family: Georgia, serif; font-size: 28px; font-weight: 500; letter-spacing: .03em; }
.invoice-title > strong { display: block; font-size: 10px; letter-spacing: .04em; }
.invoice-parties { display: grid; grid-template-columns: 1.25fr 1fr; gap: 30px; padding: 22px 0; border-bottom: 1px solid #cfd4ce; }
.invoice-label { display: block; margin-bottom: 6px; color: #748078; font-size: 8px; font-weight: 800; letter-spacing: .14em; }
.invoice-parties h3 { margin: 0 0 5px; font-family: Georgia, serif; font-size: 16px; }
.invoice-parties p { margin: 2px 0; font-size: 9.5px; line-height: 1.5; }
.invoice-facts { padding-left: 22px; border-left: 1px solid #dce0db; }
.invoice-facts p { display: flex; justify-content: space-between; gap: 14px; margin: 4px 0; }
.invoice-facts p span { color: #68726b; }
.invoice-meta-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; margin: 15px 0; overflow: hidden; border: 1px solid #dfe2dd; background: #dfe2dd; }
.invoice-meta-grid > div { padding: 8px; background: #fafbf8; }
.invoice-meta-grid span, .invoice-meta-grid strong { display: block; }
.invoice-meta-grid span { color: #78817a; font-size: 7.5px; text-transform: uppercase; letter-spacing: .06em; }
.invoice-meta-grid strong { margin-top: 2px; font-size: 9px; }
.invoice-items { margin-top: 17px; }
.invoice-items th { padding: 9px 8px; color: #fff; background: #2f473b; border: 1px solid #2f473b; font-size: 8px; letter-spacing: .04em; }
.invoice-items th:first-child, .invoice-items td:first-child { padding-left: 9px; }
.invoice-items th:last-child, .invoice-items td:last-child { padding-right: 9px; }
.invoice-items td { padding: 10px 8px; border-color: #dce0db; font-size: 9px; }
.invoice-items td strong, .invoice-items td small { display: block; }
.invoice-items td small { margin-top: 2px; color: #7c857e; font-size: 7.5px; }
.invoice-bottom { display: grid; grid-template-columns: 1fr 300px; gap: 35px; padding-top: 20px; align-items: start; }
.amount-words { margin: 4px 0 18px; font-family: Georgia, serif; font-size: 13px; line-height: 1.5; }
.invoice-note { color: #566158; font-size: 8.5px; line-height: 1.5; }
.bank-box { padding: 10px; border: 1px solid #dbe0da; background: #fafbf8; font-size: 8.5px; }
.bank-box p { margin: 4px 0 0; }
.invoice-totals p { margin: 0; padding: 6px 0; display: flex; justify-content: space-between; border-bottom: 1px solid #e4e7e2; }
.invoice-totals p span { color: #69746c; }
.invoice-totals p.grand-total { margin: 5px 0; padding: 10px 9px; color: #fff; background: #2f473b; border: 0; font-size: 12px; }
.invoice-totals p.grand-total span { color: #dbe6de; }
.invoice-signatures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 25px; margin-top: 36px; }
.invoice-legal { margin-top: 20px; padding: 9px 11px; color: #5b675f; border: 1px solid #dce0db; background: #fafbf8; font-size: 7.8px; line-height: 1.55; }
.invoice-legal strong { color: #303b34; }
.invoice-signatures > div { min-height: 62px; padding-top: 8px; border-top: 1px solid #aeb7b0; }
.invoice-signatures span, .invoice-signatures strong { display: block; }
.invoice-signatures span { color: #7b857e; font-size: 8px; }
.invoice-signatures strong { margin-top: 22px; font-size: 9px; }
.invoice-footer { margin-top: 30px; padding-top: 10px; border-top: 1px solid #d5dad4; text-align: center; }
.invoice-footer p { margin: 0 0 3px; color: #647068; font-size: 8.5px; }
.invoice-footer small { color: #8b948d; font-size: 7.5px; }
.payment-history { max-width: 1080px; margin: 18px auto 0; }
.export-invoice .invoice-title h2 { letter-spacing: -.01em; }
.custom-invoice-description, .custom-invoice-note { white-space: pre-line; }
.delivery-info-table { width: 100%; margin-top: 14px; border-collapse: collapse; font-size: 9px; }
.delivery-info-table th, .delivery-info-table td { padding: 8px 10px; border: 1px solid #d7ddd8; vertical-align: middle; }
.delivery-info-table th { width: 18%; color: #284c3c; background: #eaf0ec; text-align: left; font-size: 8px; }
.delivery-info-table td:nth-child(2) { width: 32%; }
.delivery-info-table td:nth-child(4) { width: 32%; }
.delivery-items { margin-top: 18px; }
.delivery-items tfoot th { padding: 9px 8px; color: #284c3c; background: #eaf0ec; border: 1px solid #d7ddd8; font-size: 8.5px; }
.delivery-notes-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.delivery-notes-grid section { min-height: 92px; padding: 10px 12px; border: 1px solid #d7ddd8; }
.delivery-notes-grid h3 { margin: 0 0 8px; color: #284c3c; font-size: 8px; letter-spacing: .06em; }
.delivery-notes-grid p { margin: 0 0 5px; font-size: 9px; line-height: 1.5; white-space: pre-line; }
.delivery-signatures { width: 100%; margin-top: 16px; border-collapse: collapse; break-inside: avoid; }
.delivery-signatures th, .delivery-signatures td { width: 33.33%; border: 1px solid #d7ddd8; }
.delivery-signatures th { padding: 8px; color: #fff; background: #284c3c; font-size: 8px; text-align: center; }
.delivery-signatures td { min-height: 128px; padding: 11px 12px; vertical-align: top; font-size: 8.5px; }
.delivery-signatures p { margin: 7px 0 0; color: #5e6861; }
.delivery-signatures .signature-space { margin-top: 28px; }
.delivery-note .invoice-footer { margin-top: 14px; }

.ave-document {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 38px;
}
.ave-specification-page + .ave-specification-page {
  margin-top: 24px;
}
.ave-document-header {
  overflow: hidden;
  border: 1px solid #d2d9cf;
  border-top: 6px solid #244c3a;
}
.ave-commerce-top {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(230px, .75fr);
}
.ave-commerce-company {
  display: flex;
  gap: 15px;
  align-items: center;
  padding: 22px 26px 18px;
  background: #fffef9;
}
.ave-commerce-logo {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  flex: none;
  overflow: hidden;
  color: #fff;
  background: #244c3a;
  font-family: Georgia, serif;
  font-size: 20px;
  font-weight: 700;
}
.ave-commerce-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}
.ave-commerce-identity {
  min-width: 0;
}
.ave-commerce-company.no-logo .ave-commerce-identity {
  width: 100%;
}
.ave-commerce-identity h1 {
  margin: 0 0 4px;
  color: #2f473b;
  font-family: Georgia, serif;
  font-size: 23px;
  line-height: 1.12;
}
.ave-commerce-identity p {
  margin: 2px 0;
  color: #566158;
  font-size: 8.7px;
  line-height: 1.45;
}
.ave-commerce-identity p:first-of-type {
  color: #557a3d;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.ave-commerce-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px 24px;
  color: #fff;
  background: #244c3a;
}
.ave-commerce-title > span {
  color: #cfdfd3;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .17em;
  text-transform: uppercase;
}
.ave-commerce-title h2 {
  margin: 5px 0 6px;
  color: #fff;
  font-family: Georgia, serif;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: .03em;
}
.ave-commerce-title strong {
  color: #fff;
  font-size: 11px;
}
.ave-commerce-strip {
  display: grid;
  grid-template-columns: 1.5fr .85fr .95fr;
  gap: 1px;
  background: #cbd5c8;
  border-top: 1px solid #cbd5c8;
}
.ave-commerce-strip > div {
  min-width: 0;
  padding: 8px 14px;
  background: #eef2eb;
}
.ave-commerce-strip span,
.ave-commerce-strip strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ave-commerce-strip span {
  color: #6b776e;
  font-size: 7.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.ave-commerce-strip strong {
  margin-top: 2px;
  font-size: 9.5px;
}
.ave-document-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 12px 0;
  border-top: 1px solid #d4dad2;
  border-bottom: 1px solid #d4dad2;
}
.ave-document-facts p {
  margin: 3px 0;
  font-size: 10.2px;
  line-height: 1.4;
}
.ave-document-summary {
  display: flex;
  justify-content: flex-end;
  gap: 24px;
  margin: 12px 0 5px;
  font-size: 11px;
}
.ave-document-table td,
.ave-document-table th,
.ave-specification-table td,
.ave-specification-table th {
  font-size: 9.2px;
  padding: 6px 5px;
}
.ave-document-table tfoot th,
.ave-specification-table tfoot th {
  padding: 7px 5px;
  color: #fff;
  background: #2f473b;
  border-color: #2f473b;
}
.ave-document-note {
  margin: 10px 0;
  color: #5f6962;
  font-size: 8px;
}
.ave-species-summary {
  margin: 12px 0 8px;
  break-inside: avoid;
}
.ave-species-summary h3 {
  margin: 0 0 6px;
  color: #2f473b;
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.ave-species-summary-table th,
.ave-species-summary-table td {
  padding: 5px 6px;
  font-size: 9.2px;
}
.ave-species-subtotal td {
  padding-top: 6px;
  padding-bottom: 6px;
  color: #20352b;
  background: #edf2e9;
  border-top: 1px solid #8fa18f;
  border-bottom: 1px solid #8fa18f;
}
.ave-specification-title {
  margin: 14px 0 8px;
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
}
.ave-document-footer {
  margin-top: 0;
  padding-top: 8px;
  text-align: center;
  color: #5f6962;
  border-top: 1px solid #b9c4b8;
  font-size: 9px;
}
.ave-document-footer p { margin: 2px 0; }
.ave-document-signature {
  width: 70mm;
  margin: 0 0 10px auto;
  text-align: center;
  break-inside: avoid;
  page-break-inside: avoid;
}
.ave-signature-role {
  margin: 0;
  color: #273a30;
  font-size: 10px;
  font-weight: 700;
}
.ave-signature-space {
  height: 17mm;
  margin-top: 3px;
  padding-top: 3mm;
  color: #778179;
  border-bottom: 1px solid #657168;
  font-size: 8px;
}
.ave-page-number {
  margin: 5px 0 0;
  color: #657168;
  font-size: 8px;
  text-align: right;
}
.ave-document-bottom {
  margin-top: 30px;
  break-inside: avoid;
}

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .sidebar { width: 220px; }
  .content { padding-inline: 22px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid > .span-2 { grid-column: span 2; }
  .form-layout, .sale-layout, .settings-grid { grid-template-columns: minmax(0, 1fr) 270px; }
  .form-grid-4 { grid-template-columns: 1fr 1fr; }
  .workstation-card { grid-template-columns: 1fr; }
  .invoice-sheet { padding: 34px; }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 20px 0 50px rgba(0,0,0,.2); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { min-height: 100vh; }
  .menu-toggle { display: grid; place-items: center; }
  .topbar { padding: 0 18px; height: 64px; }
  .topbar-context { display: none; }
  .content { padding: 24px 16px 44px; }
  .page-head { align-items: flex-start; }
  .page-actions { flex-wrap: wrap; }
  .form-layout, .sale-layout, .settings-grid { grid-template-columns: 1fr; }
  .form-aside, .sale-summary { position: static; }
  .form-aside { grid-row: 2; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid > .span-2 { grid-column: span 1; }
  .operation-stats { display: grid; grid-template-columns: 1fr 1fr; }
  .operation-stats > div { min-width: 0; border-bottom: 1px solid var(--line); }
  .operation-stats > div:nth-child(2n) { border-right: 0; }
  .login-layout { grid-template-columns: 1fr; }
  .login-story { min-height: 43vh; padding: 30px; }
  .story-copy { margin: 50px 0 30px; }
  .story-copy h1 { font-size: 42px; }
  .story-foot { display: none; }
  .login-panel { padding: 45px 25px; }
  .invoice-bottom { grid-template-columns: 1fr; }
  .invoice-meta-grid { grid-template-columns: repeat(2, 1fr); }
  .ave-commerce-top { grid-template-columns: 1fr; }
  .ave-commerce-strip { grid-template-columns: 1fr; }
  .import-layout { grid-template-columns: 1fr; }
  .production-board { grid-template-columns: 1fr; gap: 10px; }
  .production-arrow { transform: rotate(90deg); min-height: 30px; }
}

@media (max-width: 620px) {
  .topbar .user-chip div { display: none; }
  .page-head { flex-direction: column; }
  .page-head h1 { font-size: 29px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .page-actions .button { flex: 1; }
  .stat-grid, .report-stats { grid-template-columns: 1fr; }
  .mini-stats { flex-direction: column; }
  .operation-stats { grid-template-columns: 1fr; }
  .operation-stats > div { border-right: 0; }
  .mini-stats > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .mini-stats > div:last-child { border-bottom: 0; }
  .form-grid, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
  .stock-context, .item-hero { grid-template-columns: 1fr 1fr; }
  .stock-context > div, .item-hero > div { border-bottom: 1px solid var(--line); }
  .locked-stock { align-items: flex-start; flex-direction: column; }
  .filter-bar > * { flex: 1; }
  .filter-bar .button, .filter-bar select { width: auto; }
  .pagination-bar { align-items: flex-start; flex-direction: column; }
  .pagination { width: 100%; }
  .export-link { margin-left: 0; }
  .sale-lines select { min-width: 190px; }
  .dropdown-form { position: fixed; top: auto; left: 14px; right: 14px; bottom: 14px; width: auto; }
  .invoice-toolbar { flex-direction: column; align-items: stretch; }
  .invoice-toolbar > .button { align-self: flex-start; }
  .invoice-sheet { padding: 22px 18px; min-height: 0; }
  .invoice-header, .invoice-parties { display: block; }
  .invoice-title { margin-top: 20px; text-align: left; }
  .invoice-facts { margin-top: 18px; padding: 15px 0 0; border-left: 0; border-top: 1px solid #dce0db; }
  .invoice-bottom { gap: 20px; }
  .invoice-signatures { gap: 10px; }
  .import-summary { grid-template-columns: 1fr 1fr; }
  .stage-track { overflow-x: auto; }
  .stage-track-item { min-width: 72px; }
  .inspection-form { align-items: stretch; flex-direction: column; }
  .login-story { min-height: 50vh; }
  .story-metrics { gap: 20px; }
}

@media print {
  @page { size: A4 portrait; margin: 8mm 9mm 7mm; }
  html, body { background: #fff !important; color: #000; font-size: 8pt; line-height: 1.28; }
  .sidebar, .topbar, .app-footer, .invoice-toolbar, .notice, .payment-history, .no-print { display: none !important; }
  .app-shell, .main-wrap { display: block !important; }
  .content { max-width: none; padding: 0; }
  .invoice-sheet {
    width: 100%; max-width: none; min-height: 0; margin: 0; padding: 0;
    border: 0; box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact;
    font-size: 8pt; line-height: 1.25;
  }
  .invoice-header { padding-bottom: 5mm; gap: 8mm; align-items: center; border-bottom-width: 2px; }
  .invoice-logo { width: 88px; height: 88px; border-radius: 12px 12px 12px 3px; padding: 5px; }
  .invoice-company { gap: 10px; }
  .invoice-company h1 { margin-bottom: 1px; font-size: 13.5pt; }
  .invoice-company p { font-size: 6.8pt; line-height: 1.3; }
  .invoice-title { min-width: 48mm; }
  .invoice-title > span { font-size: 6.5pt; letter-spacing: .14em; }
  .invoice-title h2 { margin: 1px 0; font-size: 20pt; }
  .invoice-title > strong { font-size: 7.5pt; }
  .invoice-parties { grid-template-columns: 1.2fr 1fr; gap: 7mm; padding: 3mm 0; }
  .invoice-label { margin-bottom: 1.5mm; font-size: 6.2pt; letter-spacing: .1em; }
  .invoice-parties h3 { margin-bottom: 1mm; font-size: 10.5pt; }
  .invoice-parties p { margin: .3mm 0; font-size: 7.2pt; line-height: 1.3; }
  .invoice-facts { padding-left: 5mm; }
  .invoice-facts p { margin: 1.1mm 0; gap: 3mm; }
  .invoice-meta-grid { margin: 2mm 0; }
  .invoice-meta-grid > div { padding: 1.5mm 2mm; }
  .invoice-meta-grid span { font-size: 5.8pt; }
  .invoice-meta-grid strong { margin-top: 1px; font-size: 7pt; }
  .invoice-items { margin-top: 3mm; }
  .invoice-items th { padding: 2.2mm 1.5mm; font-size: 6.5pt; }
  .invoice-items th:first-child, .invoice-items td:first-child { padding-left: 2mm; }
  .invoice-items th:last-child, .invoice-items td:last-child { padding-right: 2mm; }
  .invoice-items td { padding: 2.2mm 1.5mm; font-size: 7.2pt; line-height: 1.25; }
  .invoice-items td small { margin-top: 1px; font-size: 6pt; line-height: 1.25; }
  .invoice-items { break-inside: auto; }
  .invoice-items thead { display: table-header-group; }
  .invoice-items tr { break-inside: avoid; }
  .invoice-bottom {
    grid-template-columns: minmax(0, 1fr) 58mm; gap: 8mm;
    padding-top: 3mm; break-inside: avoid;
  }
  .amount-words { margin: 1mm 0 3mm; font-size: 9pt; line-height: 1.3; }
  .invoice-note, .bank-box { font-size: 6.8pt; }
  .bank-box { padding: 2mm; }
  .invoice-totals p { padding: 1.5mm 0; }
  .invoice-totals p.grand-total { margin: 1mm 0; padding: 2.2mm; font-size: 9pt; }
  .invoice-legal {
    margin-top: 3mm; padding: 2mm 2.5mm;
    font-size: 6.3pt; line-height: 1.3; break-inside: avoid;
  }
  .invoice-signatures {
    grid-template-columns: repeat(3, 1fr); gap: 7mm;
    margin-top: 6mm; break-inside: avoid;
  }
  .invoice-signatures > div { min-height: 11mm; padding-top: 1.5mm; }
  .invoice-signatures span { font-size: 6.2pt; }
  .invoice-signatures strong { margin-top: 5mm; font-size: 7pt; }
  .invoice-footer {
    margin-top: 3mm; padding-top: 2mm; break-inside: avoid;
    page-break-inside: avoid;
  }
  .invoice-footer p { margin-bottom: 1px; font-size: 6.8pt; }
  .invoice-footer small { font-size: 6pt; }
  .compact-invoice { font-size: 8.5pt; line-height: 1.36; }
  .compact-invoice .invoice-header { padding-bottom: 6mm; }
  .compact-invoice .invoice-company p { line-height: 1.45; }
  .compact-invoice .invoice-parties { padding: 5mm 0; }
  .compact-invoice .invoice-parties p { font-size: 7.6pt; line-height: 1.45; }
  .compact-invoice .invoice-items { margin-top: 5mm; }
  .compact-invoice .invoice-items td { padding-top: 3mm; padding-bottom: 3mm; font-size: 7.6pt; }
  .compact-invoice .invoice-bottom { padding-top: 6mm; }
  .compact-invoice .amount-words { margin: 2mm 0 5mm; }
  .compact-invoice .invoice-totals p { padding: 2.1mm 0; }
  .compact-invoice .invoice-legal { margin-top: 6mm; padding: 3mm; }
  .compact-invoice .invoice-signatures { margin-top: 14mm; }
  .compact-invoice .invoice-signatures > div { min-height: 17mm; }
  .compact-invoice .invoice-signatures strong { margin-top: 8mm; }
  .compact-invoice .invoice-footer { margin-top: 12mm; padding-top: 3mm; }
  .delivery-note .invoice-header { padding-bottom: 4mm; }
  .delivery-info-table { margin-top: 3mm; font-size: 7pt; }
  .delivery-info-table th, .delivery-info-table td { padding: 1.4mm 1.8mm; }
  .delivery-info-table th { font-size: 6.4pt; }
  .delivery-items { margin-top: 3.5mm; }
  .delivery-items tfoot th { padding: 2mm 1.5mm; font-size: 7pt; }
  .delivery-notes-grid { gap: 4mm; margin-top: 3mm; }
  .delivery-notes-grid section { min-height: 18mm; padding: 2mm 2.5mm; }
  .delivery-notes-grid h3 { margin-bottom: 1.5mm; font-size: 6.4pt; }
  .delivery-notes-grid p { margin-bottom: 1mm; font-size: 7pt; line-height: 1.35; }
  .delivery-signatures { margin-top: 4mm; }
  .delivery-signatures th { padding: 1.7mm; font-size: 6.6pt; }
  .delivery-signatures td { padding: 2.5mm; font-size: 7pt; }
  .delivery-signatures p { margin-top: 2mm; }
  .delivery-signatures .signature-space { margin-top: 11mm; }
  .delivery-note .invoice-footer { margin-top: 4mm; }
  .ave-document {
    min-height: 281mm;
    display: flex;
    flex-direction: column;
    padding: 0;
  }
  .ave-specification-page {
    min-height: 274mm;
    display: flex;
    flex-direction: column;
    break-after: page;
    page-break-after: always;
  }
  .ave-specification-page:last-child {
    break-after: auto;
    page-break-after: auto;
  }
  .ave-document-header { border-top-width: 1.5mm; }
  .ave-commerce-top { grid-template-columns: minmax(0, 1.24fr) minmax(45mm, .76fr); }
  .ave-commerce-company { gap: 4mm; padding: 4mm; align-items: center; }
  .ave-commerce-logo { width: 22mm; height: 22mm; font-size: 13pt; }
  .ave-commerce-identity h1 { margin-bottom: 1mm; font-size: 13pt; }
  .ave-commerce-identity p { margin: .35mm 0; font-size: 7.2pt; line-height: 1.4; }
  .ave-commerce-title { padding: 4mm 4.5mm; }
  .ave-commerce-title > span { font-size: 6.5pt; }
  .ave-commerce-title h2 { margin: 1.2mm 0; font-size: 17pt; }
  .ave-commerce-title strong { font-size: 8.2pt; }
  .ave-commerce-strip { grid-template-columns: 1.5fr .85fr .95fr; }
  .ave-commerce-strip > div { padding: 1.5mm 2.5mm; }
  .ave-commerce-strip span { font-size: 6.2pt; }
  .ave-commerce-strip strong { margin-top: .5mm; font-size: 7.4pt; }
  .ave-document-facts { gap: 6mm; padding: 2.4mm 0; }
  .ave-document-facts p { margin: .8mm 0; font-size: 7.9pt; line-height: 1.4; }
  .ave-document-summary { margin: 2.5mm 0 1.2mm; gap: 6mm; font-size: 8.6pt; }
  .ave-document-table td,
  .ave-document-table th,
  .ave-specification-table td,
  .ave-specification-table th {
    padding: 1mm 1.2mm;
    font-size: 7.4pt;
  }
  .ave-document-table tfoot th,
  .ave-specification-table tfoot th { padding: 1.8mm 1.2mm; font-size: 7.6pt; }
  .ave-document-note { margin: 2.2mm 0; font-size: 7pt; }
  .ave-species-summary { margin: 2mm 0 1.5mm; }
  .ave-species-summary h3 { margin-bottom: 1mm; font-size: 8.1pt; }
  .ave-species-summary-table th,
  .ave-species-summary-table td { padding: 1.3mm; font-size: 7.4pt; }
  .ave-species-subtotal td { padding-top: 1.6mm; padding-bottom: 1.6mm; }
  .ave-specification-title { margin: 2.8mm 0 1.7mm; font-size: 8.3pt; }
  .ave-document-signature { width: 68mm; margin: 0 0 1.5mm auto; }
  .ave-signature-role { font-size: 8pt; }
  .ave-signature-space {
    height: 12mm;
    margin-top: .8mm;
    padding-top: 1.2mm;
    font-size: 6.8pt;
  }
  .ave-document-bottom { margin-top: auto; break-inside: avoid; }
  .ave-specification-page .ave-document-bottom { margin-top: auto; }
  .ave-document-footer { margin-top: 0; padding-top: 1.8mm; font-size: 7pt; }
  .ave-page-number { margin-top: 1.2mm; font-size: 6.5pt; }
  .multi-page-invoice .invoice-bottom { break-before: auto; }
  .invoice-footer { break-inside: avoid; }
}
