:root {
  --accent: #e6673e;
  --accent-hover: #d1552e;
  --accent-dark: #b54424;
  --peach: #fdecea;
  --peach-2: #f8d9d0;
  --ink: #1f1f1f;
  --ink-soft: #5c5c5c;
  --line: #eadfd9;
  --bg: #fff8f5;
  --paper: #ffffff;
  --danger: #c0392b;
  --danger-bg: #fdecea;
  --ok: #2e7d4f;
  --ok-bg: #e8f6ee;
  --warn: #b26a00;
  --warn-bg: #fff4e0;
  --info: #2c5aa0;
  --info-bg: #e8f0fb;
  --shadow: 0 12px 32px rgba(90, 40, 20, 0.08);
  --radius: 10px;
  --radius-sm: 8px;
  --container: 1180px;
  --header-h: 56px;
  --font: "Manrope", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
}

h1,
h2,
h3 {
  margin: 0 0 0.4em;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
  font-weight: 800;
}

h2 {
  font-size: 1.25rem;
  font-weight: 700;
}

p {
  margin: 0 0 1rem;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: min(var(--container), calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  background: var(--paper);
  box-shadow: 0 1px 0 var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
}

.brand:hover {
  color: inherit;
}

.brand-logo {
  width: 40px;
  height: 40px;
  display: block;
}

.brand-copy {
  display: flex;
  flex-direction: column;
}

.brand-company {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
}

.brand-title {
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  cursor: pointer;
  padding: 10px;
}

.nav-toggle span {
  display: block;
  height: 2px;
  background: var(--ink);
  margin: 5px 0;
  border-radius: 2px;
}

.header-nav {
  background: var(--peach);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}

.nav-links {
  display: flex;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
}

.nav-links a {
  display: block;
  padding: 6px 12px;
  color: var(--ink);
  font-weight: 600;
  border-radius: 999px;
  font-size: 0.92rem;
}

.nav-links a:hover,
.nav-links a.is-active {
  background: var(--paper);
  color: var(--accent);
}

.sub-nav {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.sub-nav-inner {
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-height: 42px;
  overflow-x: auto;
}

.sub-nav-inner a {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
}

.sub-nav-inner a:hover,
.sub-nav-inner a.is-active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-actions .nav-admin-link {
  padding: 6px 12px;
  color: var(--ink);
  font-weight: 600;
  border-radius: 999px;
  font-size: 0.92rem;
  text-decoration: none;
  white-space: nowrap;
}

.nav-actions .nav-admin-link:hover,
.nav-actions .nav-admin-link.is-active {
  background: var(--paper);
  color: var(--accent);
}

.nav-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border-radius: 999px;
  padding: 6px 12px 6px 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.nav-user-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--peach);
  color: var(--accent);
  display: grid;
  place-items: center;
}

.site-main {
  flex: 1;
  padding: 16px 0 32px;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 0;
  flex-wrap: wrap;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.lead {
  color: var(--ink-soft);
  font-size: 0.95rem;
  max-width: 62ch;
  margin-bottom: 0.6rem;
}

.muted {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-weight: 700;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 0.9rem;
  text-decoration: none;
  transition: 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn-light {
  background: #fff;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.4);
}

.btn-light:hover {
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid #f3c4be;
}

.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.85rem;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

.card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.flash-stack {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.flash {
  border-radius: 10px;
  padding: 12px 14px;
  font-weight: 600;
}

.flash-error {
  background: var(--danger-bg);
  color: var(--danger);
}

.flash-success {
  background: var(--ok-bg);
  color: var(--ok);
}

.flash-warning {
  background: var(--warn-bg);
  color: var(--warn);
}

.flash-info {
  background: var(--info-bg);
  color: var(--info);
}

.hero {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 16px;
}

.hero-main {
  min-height: 340px;
  border-radius: var(--radius);
  padding: 36px 32px;
  color: #fff;
  background:
    linear-gradient(120deg, rgba(20, 12, 8, 0.72), rgba(230, 103, 62, 0.35)),
    radial-gradient(circle at 80% 20%, #f08a5a, transparent 40%),
    linear-gradient(160deg, #3a241c, #1a1210);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-main .lead {
  color: rgba(255, 255, 255, 0.86);
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.hero-side {
  display: grid;
  gap: 16px;
}

.promo-card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  background-image: linear-gradient(180deg, #fff, #fff8f4);
}

.promo-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.promo-mini {
  background: #2b211d;
  color: #fff;
  border-radius: var(--radius);
  padding: 18px;
  min-height: 120px;
}

.promo-mini h3 {
  color: #fff;
}

.promo-mini p {
  margin: 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
}

.auth-layout {
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 24px;
  align-items: start;
}

.auth-aside {
  padding: 12px 8px 0;
}

.auth-card h2 {
  margin-bottom: 16px;
}

.field {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 0.82rem;
}

.input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  background: #fff;
  outline: none;
}

.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(230, 103, 62, 0.12);
}

.input[readonly] {
  background: #f7f3f0;
  color: var(--ink);
  cursor: default;
}

.input-sm {
  padding: 6px 10px;
  border-radius: 8px;
}

.field-error {
  color: var(--danger);
  font-weight: 600;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 8px 0 12px;
  font-weight: 600;
  font-size: 0.82rem;
}

.check input {
  margin-top: 2px;
}

.auth-switch {
  margin: 16px 0 0;
  text-align: center;
  color: var(--ink-soft);
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
}

.count-pill {
  background: var(--peach);
  color: var(--accent-dark);
  font-weight: 700;
  border-radius: 999px;
  padding: 8px 14px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.module-card {
  min-height: 140px;
  display: flex;
  flex-direction: column;
}

.module-icon {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.badge {
  margin-top: auto;
  align-self: flex-start;
  background: var(--peach);
  color: var(--accent-dark);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}

a.card {
  color: inherit;
}

a.card:hover {
  color: inherit;
  transform: translateY(-2px);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  margin: 0 0 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 4px 16px;
}

.field-full {
  grid-column: 1 / -1;
}

.input-area {
  border-radius: 8px;
  min-height: 40px;
  padding: 8px 12px;
  resize: vertical;
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.filters-actions {
  padding-bottom: 14px;
}

.line-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  background: #fffaf8;
}

.block-title {
  margin: 14px 0 8px;
  font-size: 1.05rem;
}

.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--ink-soft);
}

.split-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.meta-list {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
}

.meta-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.stack-form .field {
  margin-bottom: 10px;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  display: grid;
  gap: 2px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.page-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.inline-qty-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-qty-form .input {
  width: 88px;
}

.kind-tag,
.status-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 3px 10px;
}

.status-tag-voided {
  background: #f1f1f1;
  color: #666;
  text-transform: none;
  font-weight: 700;
  letter-spacing: 0;
}

.op-row-voided {
  opacity: 0.62;
}

.card.is-voided {
  opacity: 0.85;
  outline: 1px dashed #c9b4aa;
}

.inline-void-form {
  display: inline;
  margin: 0;
}

.kind-tag-container {
  background: #f1f1f1;
  color: #444;
}

.kind-tag-raw {
  background: var(--info-bg);
  color: var(--info);
}

.kind-tag-filled {
  background: var(--peach);
  color: var(--accent-dark);
}

.kind-tag-lid {
  background: #efe8ff;
  color: #5b3fa0;
}

.fill-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--warn-bg);
  color: var(--warn);
  text-transform: lowercase;
}

.fill-switch {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.fill-switch label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--peach);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
}

.fill-switch input {
  accent-color: var(--accent);
}

.combo {
  position: relative;
  z-index: 1;
}

.combo:focus-within,
.combo.is-open,
.combo:has(.combo-list:not([hidden])) {
  z-index: 80;
}

.combo-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  max-height: 260px;
  overflow: auto;
  z-index: 80;
}

.combo-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 7px 10px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.combo-item .combo-item-name {
  display: block;
}

.combo-item-etiketka,
.stock-hint-etiketka {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.2;
}

.combo-item:hover {
  background: var(--peach);
}

.combo-create {
  color: var(--accent);
  font-weight: 700;
  border-top: 1px solid var(--line);
}

.combo-item-stock {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.combo-item-name {
  min-width: 0;
}

.combo-item-qty {
  flex: none;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.combo-item-qty.is-warn,
.stock-hint.is-warn,
.qty-warn {
  color: #c0392b;
}

.qty-warn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stock-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.82rem;
}

.stock-hint.is-warn {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.warn-icon {
  flex: none;
  color: #c0392b;
}

.pump-note {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff4ee;
  border: 1px solid #f0d4c8;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.45;
}

.pump-form .field {
  overflow: visible;
}

.local-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 8px;
  flex-wrap: wrap;
}

.local-tabs a {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-soft);
  background: #fff4ee;
  font-weight: 600;
  font-size: 0.82rem;
}

.local-tabs a.is-active {
  background: var(--accent, #e6673e);
  color: #fff;
}

.receipt-table-wide th:nth-child(3),
.receipt-table-wide td:nth-child(3),
.receipt-table-wide th:nth-child(4),
.receipt-table-wide td:nth-child(4) {
  min-width: 140px;
}

.page-head-compact {
  margin-bottom: 8px;
}

.page-head-compact h1 {
  margin-bottom: 0;
  font-size: 1.55rem;
}

.card-compact {
  padding: 10px 12px;
}

.receipt-form-compact .receipt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.receipt-form-compact .field-inline {
  margin: 0;
  min-width: 160px;
}

.receipt-form-compact .field-inline span {
  font-size: 0.72rem;
  margin-bottom: 2px;
}

.receipt-form-compact .field-grow {
  flex: 1 1 200px;
  min-width: 180px;
}

.receipt-form-compact .field-driver {
  min-width: 220px;
  flex: 1 1 240px;
}

.receipt-delivery-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 16px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.receipt-delivery-footer .field {
  margin: 0;
}

.receipt-delivery-footer .muted {
  display: block;
  margin-top: 2px;
  font-size: 0.7rem;
}

.receipt-actions-inline {
  margin-left: auto;
  gap: 10px;
}

.receipt-form-compact .receipt-grand {
  font-size: 0.95rem;
}

.input-xs {
  padding: 4px 7px;
  border-radius: 6px;
  font-size: 0.84rem;
  line-height: 1.25;
  min-height: 0;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.receipt-lines {
  display: grid;
  gap: 8px;
}

.receipt-line {
  border: 2px solid #c9b4aa;
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
  position: relative;
  z-index: 1;
}

.receipt-line.is-open,
.receipt-line:focus-within {
  z-index: 20;
}

.receipt-line-top {
  display: grid;
  grid-template-columns: 52px minmax(140px, 1.3fr) 48px minmax(118px, 1fr) 64px 28px;
  gap: 6px 8px;
  align-items: end;
}

#factory-app .receipt-line-top {
  grid-template-columns: minmax(140px, 1.2fr) 70px minmax(140px, 1fr) 80px 72px 28px;
  align-items: start;
}

.inventory-found-top {
  grid-template-columns: 88px minmax(140px, 1.2fr) 56px 72px minmax(120px, 0.9fr) 72px 28px;
}

#factory-app .qty-with-avail {
  display: grid;
  gap: 2px;
}

#factory-app .qty-avail {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink-soft);
}

.receipt-line-oil {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(180px, 1.4fr) 88px;
  gap: 6px 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  align-items: end;
}

.receipt-line-oil[hidden] {
  display: none !important;
}

.receipt-field {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.receipt-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.receipt-field-sum .line-sum {
  display: block;
  padding: 4px 0;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.receipt-remove {
  align-self: end;
  margin-bottom: 2px;
}

.kind-toggle {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  align-self: end;
  width: 52px;
}

.kind-chip {
  border: 1px solid var(--line);
  background: #fffaf8;
  color: var(--ink-soft);
  border-radius: 6px;
  padding: 3px 2px;
  font: inherit;
  font-size: 0.58rem;
  font-weight: 700;
  line-height: 1.05;
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
  width: 100%;
}

.kind-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.manual-check {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 0;
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-soft);
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
  position: relative;
  z-index: 2;
}

.manual-check input {
  margin: 0;
  width: 12px;
  height: 12px;
  cursor: pointer;
}

.price-control {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.price-control > .input,
.price-control > select {
  flex: 1 1 auto;
  min-width: 0;
}

.receipt-field-price {
  min-width: 0;
  position: relative;
  z-index: 2;
}

.icon-btn-sm {
  width: 24px;
  height: 24px;
}

.receipt-field-price .input[hidden],
.receipt-field-price select[hidden],
.price-control .input[hidden],
.price-control select[hidden] {
  display: none !important;
}

.receipt-line .price-hint:empty {
  display: none;
}

.receipt-line .price-hint {
  margin-top: 0;
  font-size: 0.65rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.receipt-grand-sm {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 0.85rem;
  font-weight: 700;
}

.fill-switch-compact {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
}

.fill-switch-compact label {
  gap: 4px;
  padding: 0;
  background: transparent;
}

.doc-line-top {
  grid-template-columns: minmax(140px, 1.1fr) 72px 80px 64px 68px 84px 68px 28px;
  align-items: start;
}

#sale-app .doc-line-top {
  grid-template-columns: minmax(130px, 1fr) 70px 78px 62px 68px 84px 68px 28px;
}

#sale-app .receipt-field-nom-sale {
  align-self: stretch;
}

#sale-app .sale-etiketka {
  margin-top: 4px;
}

#sale-app .sale-etiketka[hidden],
#sale-app .stock-hint-etiketka[hidden] {
  display: none !important;
}

#sale-app .qty-with-avail {
  display: grid;
  gap: 2px;
}

#sale-app .qty-avail {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

.transfer-table .qty-with-avail {
  display: grid;
  gap: 2px;
}

.transfer-table .qty-avail {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

#transfer-app .qty-with-avail {
  display: grid;
  gap: 2px;
}

#transfer-app .qty-avail {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

#transfer-app .transfer-line-top,
#transfer-app .doc-line-top {
  grid-template-columns: 52px minmax(160px, 1.4fr) 64px 28px;
}

.transfer-supplier-note {
  display: block;
  margin: 0 0 8px;
}

.transfer-supplier-note[hidden] {
  display: none !important;
}

#pump-app .pump-donor-line {
  margin-top: 4px;
}

#pump-app .pump-donor-top {
  grid-template-columns: 1fr;
}

#pump-app .pump-recipient-top,
#pump-app .doc-line-top.pump-recipient-top {
  grid-template-columns: minmax(160px, 1.4fr) 72px minmax(100px, 0.8fr) 28px;
}

.pump-note {
  margin: 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.35;
}

.combo-item-qty {
  flex: 0 0 auto;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-soft);
  white-space: nowrap;
}

#writeoff-app .doc-line-top {
  grid-template-columns: 52px minmax(150px, 1.3fr) 72px 72px 80px 28px;
}

.filters-compact {
  grid-template-columns: minmax(160px, 1.8fr) repeat(4, minmax(0, 1fr)) auto;
  gap: 8px 10px;
  margin-bottom: 10px;
  padding: 10px 12px;
  align-items: end;
}

.filters-compact .field-search {
  min-width: 0;
}

.filters-compact .field {
  margin-bottom: 0;
}

.filters-compact .field span {
  font-size: 0.7rem;
}

.filters-compact .filters-actions {
  padding-bottom: 0;
}

.stock-table-compact {
  font-size: 0.8rem;
}

.stock-table-compact th,
.stock-table-compact td {
  padding: 4px 6px;
  vertical-align: middle;
}

.stock-table-compact th {
  font-size: 0.65rem;
  letter-spacing: 0.03em;
}

.stock-table-compact .kind-tag,
.stock-table-compact .fill-tag {
  font-size: 0.65rem;
  padding: 1px 5px;
}

.stock-table-compact a {
  font-size: inherit;
}

.stock-hint {
  display: block;
  margin-top: 1px;
  font-size: 0.68rem;
  color: var(--ink-soft);
  font-weight: 600;
}

@media (max-width: 980px) {
  .doc-line-top,
  #writeoff-app .doc-line-top {
    grid-template-columns: 1fr 1fr;
  }

  .filters-compact {
    grid-template-columns: 1fr 1fr;
  }
}

.split-grid .field-full {
  grid-column: 1 / -1;
}

.pump-donor-block .check {
  margin-top: 0.65rem;
}

.price-hint {
  display: block;
  margin-top: 2px;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.72rem;
}

.icon-btn {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--danger);
  border-radius: 8px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
}

.icon-btn:hover {
  background: var(--danger-bg);
}

.icon-btn-history {
  color: var(--ink-soft);
}

.icon-btn-history:hover {
  background: var(--peach);
  color: var(--accent-dark);
}

.icon-btn-edit {
  color: var(--ink-soft);
}

.icon-btn-edit:hover {
  background: var(--peach);
  color: var(--accent-dark);
}

.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.cell-actions {
  width: 1%;
  white-space: nowrap;
}

.inline-form {
  display: inline;
  margin: 0;
}

.form-actions-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.catalog-panel > h2 {
  margin: 0;
}

.catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.catalog-toolbar h2 {
  margin: 0;
}

.catalog-add {
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 12px;
  background: #fff7f2;
  border: 1px solid #f0d8cb;
}

.catalog-add-form {
  margin: 0;
}

.catalog-inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px 10px;
  align-items: end;
  padding: 8px 0;
}

.catalog-inline-form .field {
  margin: 0;
}

.catalog-inline-form .field span {
  font-size: 0.7rem;
}

.catalog-inline-form .form-actions-inline {
  grid-column: 1 / -1;
}

.catalog-edit-hint {
  grid-column: 1 / -1;
  margin: 0;
}

.catalog-edit-row td {
  background: #fff7f2;
  border-top: 0;
}

.catalog-table tr[data-row-view].is-editing {
  opacity: 0.55;
}

.catalog-table tr[data-row-view].is-editing + .catalog-edit-row {
  box-shadow: inset 0 1px 0 #f0d8cb;
}

.muted-inline {
  color: var(--ink-soft);
  font-size: 0.85em;
  font-weight: 500;
}

.form-hint {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--peach);
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 600;
}

.op-unit-list {
  display: grid;
  gap: 4px;
}

.op-unit-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.op-unit-name {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.op-doc-link {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  text-decoration: none;
  color: inherit;
}

.op-doc-link:hover .op-doc-open,
.op-doc-link:focus-visible .op-doc-open {
  color: var(--accent);
}

.op-doc-open {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.op-pos-cell {
  position: relative;
  vertical-align: middle;
  padding-right: 2.25rem;
}

.op-pos {
  display: block;
  max-width: 360px;
  padding-right: 0;
}

.op-pos-short,
.op-pos-full {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: pre-line;
}

.op-pos-short[hidden],
.op-pos-full[hidden] {
  display: none !important;
}

.op-pos-cell .op-pos-toggle {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
}

.op-pos-toggle.is-active {
  color: var(--accent);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink-soft);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--accent);
}

.back-link svg {
  flex-shrink: 0;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(24, 14, 10, 0.45);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 16px;
}

.modal[hidden] {
  display: none !important;
}

.modal-card {
  width: min(460px, 100%);
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}

.receipt-table-wrap {
  overflow: visible;
}

.comment-row {
  margin-top: 10px !important;
  margin-bottom: 8px !important;
}

.comment-row .input-area {
  min-height: 36px;
}

.receipt-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.receipt-grand {
  font-size: 1.05rem;
  font-weight: 700;
}

.receipt-table {
  table-layout: fixed;
}

.receipt-table th:nth-child(1),
.receipt-table td:nth-child(1) {
  width: 16%;
}

.receipt-table th:nth-child(2),
.receipt-table td:nth-child(2) {
  width: 38%;
}

.receipt-table th:nth-child(3),
.receipt-table td:nth-child(3) {
  width: 10%;
}

.receipt-table th:nth-child(4),
.receipt-table td:nth-child(4) {
  width: 14%;
}

.receipt-table th:nth-child(5),
.receipt-table td:nth-child(5) {
  width: 14%;
}

.receipt-table th:nth-child(6),
.receipt-table td:nth-child(6) {
  width: 8%;
}

.transfer-table th:nth-child(1),
.transfer-table td:nth-child(1) {
  width: 18%;
}

.transfer-table th:nth-child(2),
.transfer-table td:nth-child(2) {
  width: 58%;
}

.transfer-table th:nth-child(3),
.transfer-table td:nth-child(3) {
  width: 14%;
}

.transfer-table th:nth-child(4),
.transfer-table td:nth-child(4) {
  width: 10%;
}

.receipt-actions:has(> .btn:only-child),
.transfer-actions {
  justify-content: flex-end;
}

.receipt-table td {
  vertical-align: top;
  position: relative;
  z-index: 1;
}

.receipt-table tr:focus-within td,
.receipt-table tr.is-open td,
.receipt-table td:has(.combo-list:not([hidden])) {
  z-index: 40;
}

.status-available {
  background: var(--ok-bg);
  color: var(--ok);
}

.status-consumed {
  background: #eee;
  color: #666;
}

.status-sold {
  background: var(--warn-bg);
  color: var(--warn);
}

.status-panel {
  text-align: center;
  padding: 48px 24px;
  max-width: 640px;
  margin: 24px auto;
}

.status-mark {
  font-size: 2rem;
  margin-bottom: 8px;
}

.table-wrap {
  overflow: auto;
  padding: 0;
}

.table-wrap.receipt-table-wrap {
  overflow: visible;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.data-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  background: #fffaf8;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.stock-row-full td {
  background: #e8f6ee;
}

.stock-row-empty td {
  background: #eceff1;
}

.stock-row-partial td {
  background: #fff6d9;
}

.stock-row-full:hover td {
  background: #d9f0e3;
}

.stock-row-empty:hover td {
  background: #e2e6e9;
}

.stock-row-partial:hover td {
  background: #ffefb8;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.7rem;
  background: var(--peach);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 2px 8px;
  font-weight: 800;
  text-transform: uppercase;
}

@media (max-width: 960px) {
  .hero,
  .auth-layout,
  .card-grid,
  .stat-grid,
  .split-grid,
  .form-grid,
  .filters {
    grid-template-columns: 1fr;
  }

  .hero-main {
    min-height: 280px;
  }
}

.field-op-date input[type="datetime-local"] {
  min-width: 11.5rem;
}

.warehouse-delete-warn {
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
  border-radius: 8px;
  background: #fff4ee;
  border: 1px solid var(--line);
}

.warehouse-delete-form {
  margin-top: 0.5rem;
}

@media (max-width: 760px) {
  .container {
    width: min(var(--container), calc(100% - 24px));
  }

  .nav-toggle {
    display: inline-block;
  }

  .header-nav {
    display: none;
  }

  .header-nav.is-open {
    display: block;
  }

  .nav-inner {
    flex-direction: column;
    align-items: stretch;
    padding: 8px 0 16px;
  }

  .nav-links {
    flex-direction: column;
  }

  .nav-actions {
    justify-content: space-between;
  }

  .sub-nav-inner {
    margin: 0 -12px;
    padding: 0 12px;
  }

  .promo-row {
    grid-template-columns: 1fr;
  }

  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    display: grid;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
  }

  .stock-row-full {
    background: #e8f6ee;
  }

  .stock-row-empty {
    background: #eceff1;
  }

  .stock-row-partial {
    background: #fff6d9;
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 0;
    border: 0;
  }

  .data-table td::before {
    content: attr(data-label);
    color: var(--ink-soft);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
  }

  .receipt-table,
  .receipt-table th,
  .receipt-table td {
    width: auto;
  }

  .receipt-table {
    table-layout: auto;
  }
  }
}
