:root {
  --ink: #172322;
  --ink-soft: #2b3d3a;
  --brand: #b69056;
  --brand-dark: #8d6837;
  --canvas: #f5f3ef;
  --panel: #ffffff;
  --line: #e6e1d8;
  --muted: #6e7774;
  --mint: #e8f3ed;
  --danger: #b13d47;
  --danger-bg: #fff0f1;
  --amber: #9b671c;
  --amber-bg: #fff4dc;
  --radius: 16px;
  font-family: Inter, Aptos, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body { margin: 0; min-height: 100vh; background: var(--canvas); }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }

.shell { min-height: 100vh; }
.sidebar {
  background: var(--ink); color: #e9efec; position: fixed; inset: 0 auto 0 0;
  width: 246px; padding: 25px 14px 16px; display: flex; flex-direction: column; z-index: 20;
}
.brand { padding: 1px 14px 25px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-mark { color: white; font-family: Georgia, serif; font-size: 31px; letter-spacing: -1.8px; line-height: 1; }
.brand-sub { color: #d9b877; font-size: 10px; font-weight: 800; letter-spacing: .14em; margin-top: 8px; text-transform: uppercase; }
.brand-hint { color: #a8b4af; font-size: 11px; margin-top: 7px; }
.nav { padding: 21px 0; flex: 1; overflow: auto; }
.nav-label { color: #81908a; font-size: 10px; padding: 14px 14px 6px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.nav-link { align-items: center; background: transparent; border: 0; border-radius: 9px; color: #cad4cf; display: flex; gap: 11px; margin: 2px 0; padding: 10px 12px; text-align: left; width: 100%; font-size: 13px; }
.nav-link:hover { background: rgba(255,255,255,.08); color: white; }
.nav-link.active { background: var(--brand); color: #172322; font-weight: 800; }
.nav-icon { width: 19px; text-align: center; color: #d4b273; font-size: 16px; }
.nav-link.active .nav-icon { color: var(--ink); }
.nav-footer { border-top: 1px solid rgba(255,255,255,.1); color: #87928d; font-size: 11px; line-height: 1.6; padding: 15px 14px 0; }
.status-dot { background: #6fb58a; border-radius: 50%; display: inline-block; height: 7px; margin-right: 5px; width: 7px; }

.mobile-bar { display: none; }
.main { margin-left: 246px; min-height: 100vh; padding: 32px clamp(20px, 3.2vw, 54px) 48px; max-width: 1800px; }
.page-header { align-items: start; display: flex; gap: 24px; justify-content: space-between; margin-bottom: 25px; }
.eyebrow { color: var(--brand-dark); font-size: 10px; font-weight: 800; letter-spacing: .13em; margin-bottom: 7px; text-transform: uppercase; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(29px, 3vw, 42px); letter-spacing: -.6px; line-height: 1.04; margin: 0; }
.subtitle { color: var(--muted); font-size: 14px; margin: 8px 0 0; }
.header-actions, .toolbar, .bulk-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 9px; }

.button { align-items: center; background: var(--panel); border: 1px solid #d9d4cb; border-radius: 9px; color: var(--ink); display: inline-flex; font-size: 13px; font-weight: 700; gap: 7px; justify-content: center; min-height: 38px; padding: 8px 13px; text-decoration: none; transition: .16s ease; }
.button:hover { border-color: #ad9c80; box-shadow: 0 4px 11px rgba(23,35,34,.08); transform: translateY(-1px); }
.button.primary { background: var(--brand); border-color: var(--brand); color: #1a1d19; }
.button.primary:hover { background: #c59e60; border-color: #c59e60; }
.button.dark { background: var(--ink); border-color: var(--ink); color: white; }
.button.danger { background: var(--danger-bg); border-color: #f0bfc3; color: var(--danger); }
.button.small { font-size: 12px; min-height: 31px; padding: 5px 9px; }
.button .icon { font-size: 15px; line-height: 1; }

.kpis { display: grid; gap: 14px; grid-template-columns: repeat(5, minmax(0, 1fr)); margin-bottom: 19px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 8px rgba(42,36,28,.035); min-height: 125px; padding: 18px; position: relative; overflow: hidden; }
.kpi::after { background: var(--brand); border-radius: 5px; content: ""; height: 4px; left: 18px; position: absolute; top: 0; width: 35px; }
.kpi.danger::after { background: var(--danger); }
.kpi-value { font-size: 30px; font-weight: 800; letter-spacing: -.8px; margin-top: 13px; }
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 700; margin-top: 4px; }
.kpi-hint { color: #929993; font-size: 11px; margin-top: 11px; }

.grid-2 { display: grid; gap: 19px; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .9fr); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 10px rgba(42,36,28,.035); }
.card-head { align-items: center; border-bottom: 1px solid var(--line); display: flex; gap: 12px; justify-content: space-between; padding: 17px 19px; }
.card-title { font-size: 15px; font-weight: 800; }
.card-note { color: var(--muted); font-size: 12px; margin-top: 3px; }
.card-body { padding: 18px; }
.quick-list { list-style: none; margin: 0; padding: 0; }
.quick-list li { align-items: center; border-bottom: 1px solid #f0ede8; display: flex; gap: 12px; justify-content: space-between; padding: 12px 0; }
.quick-list li:last-child { border-bottom: 0; }
.code { color: #3c504b; font-family: Consolas, monospace; font-size: 12px; font-weight: 700; }
.small-text { color: var(--muted); font-size: 12px; }

.toolbar { background: #fbfaf8; border: 1px solid var(--line); border-radius: 13px; margin-bottom: 12px; padding: 12px; }
.search-wrap { flex: 1 1 230px; position: relative; }
.search-wrap .search-symbol { color: #89918d; left: 11px; position: absolute; top: 9px; }
.input, .select { background: white; border: 1px solid #d8d4cc; border-radius: 8px; color: var(--ink); font-size: 13px; min-height: 36px; outline: none; padding: 7px 10px; }
.input { width: 100%; }
.search-wrap .input { padding-left: 31px; }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(182,144,86,.16); }
.select { min-width: 136px; }
.bulk-actions { background: var(--mint); border: 1px solid #cae3d4; border-radius: 11px; margin-bottom: 12px; padding: 10px 12px; }
.bulk-note { color: #416254; font-size: 12px; font-weight: 700; margin-right: 3px; }
.spacer { flex: 1; }

.table-card { overflow: hidden; }
.table-scroll { max-height: calc(100vh - 273px); min-height: 300px; overflow: auto; }
table { border-collapse: separate; border-spacing: 0; font-size: 13px; width: 100%; }
thead th { background: #f7f5f1; border-bottom: 1px solid var(--line); color: #65706b; font-size: 10px; font-weight: 800; letter-spacing: .08em; padding: 11px 11px; position: sticky; text-align: left; text-transform: uppercase; top: 0; z-index: 1; white-space: nowrap; }
.table-sort { align-items: center; background: transparent; border: 0; color: inherit; cursor: pointer; display: inline-flex; font: inherit; font-weight: inherit; gap: 5px; letter-spacing: inherit; padding: 0; text-transform: inherit; }
.table-sort:hover, .table-sort.active { color: var(--brand-dark); }
.table-sort span { font-size: 12px; line-height: 1; }
tbody td { border-bottom: 1px solid #efede9; padding: 10px 11px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fbfaf7; }
tbody tr.order-beige td { background: #f5f0e6; }
tbody tr.order-beige:hover td { background: #eee6d7; }
tbody tr.selected td { background: #e8f1ec !important; }
.order-group td { background: #e8e3d9; border-bottom: 1px solid #d8d0c2; border-top: 2px solid #d6cab8; padding-bottom: 8px; padding-top: 8px; }
.order-group.order-beige td { background: #ded3c0; }
.order-group:hover td { background: #d8ccb8; }
.order-group-info { color: #625d54; font-size: 11px; margin-left: 13px; }
.working-order-head { align-items: center; display: flex; gap: 14px; justify-content: space-between; }
.work-order-banner { align-items: center; background: #e9e1d3; border: 1px solid #d6c8b4; border-radius: var(--radius); display: flex; gap: 20px; justify-content: space-between; margin-bottom: 18px; padding: 18px 20px; }
.work-order-banner .eyebrow { margin-bottom: 4px; }
.work-order-title { font-family: Consolas, monospace; font-size: 25px; letter-spacing: -.7px; margin: 0; }
.order-item.group-beige td { background: #f5f0e6; }
.order-item.group-beige:hover td { background: #eee6d7; }
.order-item.group-white td { background: #fff; }
.quantity-total .input { width: 86px; }
.quantity-help { margin: 10px 0 0; }
.stock-editor { align-items: center; display: flex; gap: 5px; justify-content: flex-end; min-width: 112px; }
.stock-editor .input { min-height: 31px; padding: 4px 6px; text-align: right; width: 78px; }
.stock-editor span { color: var(--muted); font-size: 11px; min-width: 13px; }
.warehouse-table td { white-space: nowrap; }
.compact-warehouse-table { table-layout: fixed; }
.compact-warehouse-table th:nth-child(1) { width: 4%; }
.compact-warehouse-table th:nth-child(2) { width: 22%; }
.compact-warehouse-table th:nth-child(3) { width: 18%; }
.compact-warehouse-table th:nth-child(4), .compact-warehouse-table th:nth-child(5) { width: 11%; }
.compact-warehouse-table th:nth-child(6), .compact-warehouse-table th:nth-child(7), .compact-warehouse-table th:nth-child(8) { width: 10%; }
.compact-warehouse-table th:nth-child(9) { width: 4%; }
.compact-warehouse-table td { white-space: normal; }
.compact-warehouse-table .stock-editor { min-width: 86px; }
.compact-warehouse-table .stock-editor .input { width: 57px; }
.fabric-cell, .supplier-info { overflow: hidden; }
.fabric-name, .supplier-info span { color: var(--muted); display: block; font-size: 11px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.supplier-info strong { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.supplier-cell { font-weight: 700; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.supplier-description { max-width: 380px; overflow: hidden; text-overflow: ellipsis; }
.padding-description { max-width: 440px; overflow: hidden; text-overflow: ellipsis; }
.variant-description { max-width: 310px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.number, th.number { text-align: right; font-variant-numeric: tabular-nums; }
.checkbox { accent-color: var(--brand-dark); height: 16px; width: 16px; }
.description { max-width: 420px; min-width: 220px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 60px 20px; text-align: center; }

.badge { border-radius: 999px; display: inline-block; font-size: 10px; font-weight: 800; padding: 4px 8px; white-space: nowrap; }
.badge.open { background: #e8eff4; color: #3e5c70; }
.badge.work { background: var(--amber-bg); color: var(--amber); }
.badge.done { background: #e5f2ea; color: #387151; }
.badge.alert { background: var(--danger-bg); color: var(--danger); }
.stock-negative { color: var(--danger); font-weight: 800; }
.stock-ok { color: #3d7655; font-weight: 800; }
.import-alert-card { border-color: #efc5c8; margin: 0 0 18px; }
.import-alert-card .card-head { background: var(--danger-bg); }
.import-event-card { border-color: #c5dfcb; margin: 0 0 18px; }
.import-event-card .card-head { background: #eef7f0; }
.import-alert-card .quick-list li { align-items: flex-start; }
.alert-count { color: var(--danger); font-size: 26px; }
.event-count { color: #387151; font-size: 26px; }
.alert-updated { margin-top: 12px; }

.modal-wrap { align-items: center; background: rgba(18,27,25,.5); display: flex; inset: 0; justify-content: center; padding: 16px; position: fixed; z-index: 100; }
.modal { background: white; border-radius: 18px; box-shadow: 0 22px 65px rgba(0,0,0,.25); max-height: 92vh; max-width: 720px; overflow: auto; padding: 24px; width: 100%; }
.modal h2 { font-family: Georgia, serif; font-size: 27px; margin: 0 0 6px; }
.modal p { color: var(--muted); font-size: 13px; margin: 0 0 18px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.field { display: grid; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #63706b; font-size: 10px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.modal-actions { border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; margin-top: 21px; padding-top: 16px; }
.delete-list { color: var(--ink); font-size: 13px; margin: 0; max-height: 190px; overflow: auto; padding-left: 20px; }
.delete-list li { margin: 7px 0; }
.zpl { background: #14201e; border-radius: 10px; color: #d7e9e0; font: 11px/1.45 Consolas, monospace; max-height: 280px; overflow: auto; padding: 13px; white-space: pre; }
.settings-grid { display: grid; gap: 18px; grid-template-columns: minmax(280px, .8fr) minmax(0, 1.3fr); }
.layout-preview { align-items: center; background: #e9e4db; border-radius: 12px; display: flex; justify-content: center; min-height: 320px; padding: 25px; }
.label-preview { background: #fff; box-shadow: 0 3px 12px rgba(0,0,0,.16); height: 250px; max-width: 400px; padding: 18px; position: relative; width: 100%; }
.label-logo { font-family: Georgia, serif; font-size: 38px; letter-spacing: -2px; text-align: center; }
.barcode { background: repeating-linear-gradient(90deg, #111 0 2px, transparent 2px 4px, #111 4px 5px, transparent 5px 8px); height: 54px; margin: 28px auto 10px; width: 70%; }
.label-code { font-family: Consolas, monospace; font-size: 16px; font-weight: 800; text-align: center; }
.label-desc { font-size: 12px; margin-top: 12px; text-align: center; }
.fieldsets { display: grid; gap: 10px; grid-template-columns: repeat(2, minmax(0,1fr)); }
.layout-fields { margin-top: 12px; }
.hidden { display: none !important; }
.print-top { margin-bottom: 18px; }
.print-connection { align-items: center; display: flex; gap: 16px; justify-content: space-between; margin-bottom: 14px; }
.print-toolbar { margin: 0; }
.copies-field { align-items: center; color: var(--muted); display: flex; font-size: 12px; font-weight: 700; gap: 6px; }
.copies-field .input { width: 68px; }
.print-workspace { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .8fr); }
.print-table { max-height: calc(100vh - 365px); }
.print-side { align-self: start; position: sticky; top: 18px; }
.print-actions { margin-top: 16px; }
.print-settings { align-items: start; }
.layout-editor-grid { display: grid; gap: 22px; grid-template-columns: minmax(260px, .82fr) minmax(320px, 1.18fr); }
.sample-fields { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 15px; }
.layout-controls { display: grid; gap: 9px; margin-top: 14px; max-height: 560px; overflow: auto; padding-right: 4px; }
.range-control { border-bottom: 1px solid #efede9; padding: 8px 0; }
.range-control label { color: #63706b; display: block; font-size: 11px; font-weight: 750; margin-bottom: 6px; }
.range-control > div { align-items: center; display: grid; gap: 10px; grid-template-columns: 1fr 88px; }
.range-control input[type="range"] { accent-color: var(--brand-dark); width: 100%; }
.range-control .input { min-height: 32px; padding: 5px 7px; text-align: right; }
.label-preview.order-summary { display: flex; flex-direction: column; justify-content: center; }
.label-order-line { font-family: Consolas, monospace; font-size: 27px; font-weight: 800; line-height: 1.1; text-align: center; }

.toast { background: #1c2b27; border-radius: 9px; bottom: 20px; box-shadow: 0 10px 30px rgba(0,0,0,.2); color: white; font-size: 13px; left: 50%; max-width: min(92vw, 620px); opacity: 0; padding: 11px 15px; pointer-events: none; position: fixed; transform: translate(-50%, 16px); transition: .22s ease; z-index: 200; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #8f3039; }

@media (max-width: 1130px) { .kpis { grid-template-columns: repeat(3, minmax(0,1fr)); } .grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .sidebar { display: none; } .main { margin-left: 0; padding: 20px 14px 35px; } .mobile-bar { align-items: center; background: var(--ink); color: white; display: flex; justify-content: space-between; padding: 13px 15px; position: sticky; top: 0; z-index: 10; }
  .mobile-bar button { background: none; border: 0; color: white; font-size: 20px; } .sidebar.open { display: flex; width: min(85vw, 280px); } .page-header { align-items: stretch; flex-direction: column; gap: 15px; } .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); } .kpi { min-height: 108px; padding: 14px; } .kpi-value { font-size: 25px; }
  .table-scroll { max-height: 62vh; } .toolbar > * { flex: 1 1 100%; } .toolbar .button, .toolbar .select { width: 100%; } .bulk-actions > * { flex: 1 1 auto; } .form-grid, .settings-grid { grid-template-columns: 1fr; } .field.full { grid-column: auto; } .fieldsets { grid-template-columns: 1fr; }
  .print-workspace, .layout-editor-grid { grid-template-columns: 1fr; } .print-side { position: static; } .print-connection, .work-order-banner, .working-order-head { align-items: stretch; flex-direction: column; } .copies-field { justify-content: space-between; }
}

@media print { .sidebar, .mobile-bar, .page-header, .toolbar, .bulk-actions, .no-print { display: none !important; } .main { margin: 0; padding: 0; } .card, .table-card { border: 0; box-shadow: none; } .table-scroll { max-height: none; overflow: visible; } }
