:root {
  --bg: #eef4f3;
  --surface: #ffffff;
  --surface-2: #f7faf9;
  --line: #dce8e5;
  --line-strong: #c4d7d3;
  --text: #173432;
  --muted: #6f8582;
  --primary: #0a8078;
  --primary-2: #19a392;
  --primary-soft: #e3f4f1;
  --blue: #3c7dd9;
  --orange: #ed9b36;
  --red: #dc5a5a;
  --yellow: #e1be43;
  --grey: #8b9a98;
  --shadow: 0 14px 38px rgba(33, 69, 65, .10);
  --sidebar-w: 82px;
  --header-h: 76px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: "Vazirmatn", Tahoma, Arial, sans-serif; background: var(--bg); color: var(--text); overflow: hidden; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.app-shell { height: 100vh; display: grid; grid-template-columns: 1fr var(--sidebar-w); grid-template-rows: var(--header-h) 1fr; }
.app-header { grid-column: 1 / 3; grid-row: 1; display: flex; align-items: center; justify-content: space-between; padding: 0 22px 0 18px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); box-shadow: 0 2px 14px rgba(30,70,66,.05); z-index: 20; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { width: 112px; height: 58px; object-fit: contain; }
.brand-text { border-right: 1px solid var(--line); padding-right: 14px; }
.brand-text h1 { margin: 0; font-size: 17px; font-weight: 800; }
.brand-text p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.demo-pill { padding: 7px 11px; background: #fff3dc; color: #9b6714; border: 1px solid #f5ddb3; border-radius: 999px; font-size: 11px; font-weight: 700; }
.icon-btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); width: 38px; height: 38px; border-radius: 11px; font-size: 20px; }
.icon-btn:hover { border-color: var(--primary); color: var(--primary); }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); }
.user-chip .avatar { display: grid; place-items: center; width: 33px; height: 33px; border-radius: 10px; background: linear-gradient(135deg,var(--primary),var(--primary-2)); color: white; font-weight: 800; }
.user-chip div { display: flex; flex-direction: column; }
.user-chip strong { font-size: 12px; }
.user-chip small { font-size: 10px; color: var(--muted); }
.right-sidebar { grid-column: 2; grid-row: 2; background: #173d3a; padding: 12px 8px; display: flex; flex-direction: column; gap: 7px; z-index: 15; }
.nav-item { border: 0; color: #bed0cd; background: transparent; border-radius: 13px; min-height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; width: 100%; }
.nav-item span { font-size: 21px; line-height: 1; }
.nav-item label { font-size: 9.5px; cursor: pointer; white-space: nowrap; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: #fff; color: var(--primary); box-shadow: 0 8px 22px rgba(0,0,0,.15); }
.sidebar-spacer { flex: 1; }
.main-area { grid-column: 1; grid-row: 2; min-width: 0; min-height: 0; position: relative; overflow: hidden; }
.page-view { height: 100%; }
.workspace-page { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 9px; }
.workspace-topline { min-height: 33px; display: flex; align-items: center; justify-content: space-between; padding: 0 5px; }
.breadcrumb { display: flex; gap: 7px; align-items: center; font-size: 12px; }
.breadcrumb button { border: 0; background: transparent; color: var(--primary); }
.workspace-meta { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 10.5px; }
.save-status { color: var(--primary); font-weight: 700; }
.save-status.dirty { color: var(--orange); }
.kpi-strip { display: grid; grid-template-columns: repeat(6,minmax(120px,1fr)); gap: 8px; }
.kpi-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 9px 12px; display: flex; align-items: center; gap: 10px; min-width: 0; }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-size: 17px; }
.kpi-card strong { display: block; font-size: 17px; line-height: 1.1; }
.kpi-card small { color: var(--muted); font-size: 9.5px; white-space: nowrap; }
.workspace-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 320px 1fr; gap: 9px; direction: ltr; }
.left-dock, .central-workspace { direction: rtl; }
.left-dock { display: grid; grid-template-rows: minmax(210px, .8fr) minmax(280px, 1.2fr); gap: 9px; min-height: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 6px 20px rgba(37,76,71,.05); min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.panel-head { padding: 11px 13px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.panel-head h3 { margin: 0; font-size: 13px; }
.panel-head small { color: var(--muted); font-size: 9.5px; }
.panel-collapse { width: 28px; height: 28px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 8px; color: var(--muted); }
.panel-body { min-height: 0; overflow: auto; }
.details-body { padding: 12px; }
.empty-details { height: 100%; min-height: 150px; display: grid; place-items: center; text-align: center; color: var(--muted); font-size: 11px; }
.empty-details .big { font-size: 34px; opacity: .45; display: block; margin-bottom: 8px; }
.property-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1 / 3; }
.field label { font-size: 9px; color: var(--muted); }
.field input, .field select { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 7px 8px; background: var(--surface-2); color: var(--text); font-size: 11px; }
.status-badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 4px 8px; font-size: 9px; font-weight: 700; }
.status-badge.ok { background:#e3f5ea;color:#257446; }.status-badge.warn{background:#fff1dc;color:#a96612}.status-badge.bad{background:#ffe3e3;color:#a73b3b}.status-badge.neutral{background:#eef2f1;color:#60716f}
.inventory-tabs { display: flex; padding: 8px 9px 0; gap: 4px; }
.inventory-tabs button { flex: 1; border: 0; border-bottom: 2px solid transparent; background: transparent; padding: 6px; font-size: 10px; color: var(--muted); }
.inventory-tabs button.active { color: var(--primary); border-color: var(--primary); font-weight: 700; }
.search-row { margin: 8px 9px; position: relative; }
.search-row input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px 8px 31px; background: var(--surface-2); font-size: 10px; }
.search-row button { position: absolute; left: 6px; top: 5px; border: 0; background: transparent; color: var(--muted); font-size: 18px; }
.quick-filters { padding: 0 9px 7px; display: flex; gap: 5px; overflow-x: auto; }
.quick-filters button { white-space: nowrap; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 8px; font-size: 8.5px; color: var(--muted); }
.quick-filters button.active { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.inventory-list { border-top: 1px solid var(--line); }
.inventory-item { padding: 9px 10px; border-bottom: 1px solid #edf3f1; display: grid; grid-template-columns: 1fr auto; gap: 6px; cursor: pointer; position: relative; }
.inventory-item:hover { background: #f7fbfa; }
.inventory-item.selected { background: var(--primary-soft); box-shadow: inset -3px 0 var(--primary); }
.inventory-item.dragging { opacity: .45; }
.inventory-item h4 { margin: 0; font-size: 10.5px; }
.inventory-item .meta { display: flex; flex-wrap: wrap; gap: 5px 9px; color: var(--muted); font-size: 8.5px; margin-top: 3px; }
.inventory-item .loc { text-align: left; font-size: 8.5px; color: var(--muted); }
.inventory-item .loc strong { display:block;color:var(--text);font-size:9px; }
.central-workspace { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.toolbar { min-height: 57px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 7px; padding: 7px 9px; background: #fbfdfd; overflow-x: auto; }
.tool-group { display: flex; gap: 3px; }
.tool-btn { min-width: 48px; height: 41px; border: 1px solid transparent; background: transparent; border-radius: 9px; color: var(--muted); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.tool-btn span { font-size: 16px; line-height: 1; }.tool-btn label { font-size: 8px; cursor:pointer; }
.tool-btn:hover { background: var(--surface); border-color: var(--line); color: var(--text); }
.tool-btn.active { background: var(--primary-soft); border-color: #b9e0d9; color: var(--primary); }
.tool-group.compact .tool-btn { min-width: 34px; width: 34px; }
.tool-btn.danger:hover { color: var(--red); border-color:#f0c7c7;background:#fff6f6; }
.tool-separator { width: 1px; height: 29px; background: var(--line); flex: 0 0 auto; }
.view-switcher { display:flex;border:1px solid var(--line);border-radius:10px;padding:2px;background:#f2f7f6; }
.view-switcher button { border:0;background:transparent;border-radius:7px;padding:6px 9px;font-size:9px;color:var(--muted); }
.view-switcher button.active { background:#fff;color:var(--primary);box-shadow:0 2px 7px rgba(31,76,71,.11);font-weight:700; }
.toolbar-spacer { flex: 1; }
.level-switcher, .snap-control { display:flex;align-items:center;gap:5px;color:var(--muted);font-size:8.5px;white-space:nowrap; }
.level-switcher select,.snap-control select { border:1px solid var(--line);border-radius:8px;background:#fff;padding:5px 7px;color:var(--text);font-size:9px; }
.primary-btn { border:0;border-radius:10px;background:linear-gradient(135deg,var(--primary),var(--primary-2));color:#fff;padding:8px 13px;font-weight:700;font-size:10px;box-shadow:0 7px 15px rgba(10,128,120,.18);white-space:nowrap; }
.primary-btn:hover { filter:brightness(.98);transform:translateY(-1px); }
.workspace-canvas-wrap { flex:1;min-height:0;position:relative;background:#f5f9f8;overflow:hidden;direction:ltr; }
#layoutCanvas,#babylonCanvas,#isoCanvas { width:100%;height:100%;display:block;touch-action:none; }
.babylon-host { position:absolute;inset:0;background:#f1f6f5; }
.babylon-host.split { left:50%;border-left:2px solid var(--line-strong); }
.workspace-canvas-wrap.split-mode #layoutCanvas { width:50%; }
.iso-fallback { position:absolute;inset:0; }
.three-status { position:absolute;top:12px;left:12px;padding:6px 9px;background:rgba(255,255,255,.9);border:1px solid var(--line);border-radius:9px;font-size:9px;color:var(--muted); }
.canvas-notice { position:absolute;top:10px;right:10px;z-index:6;background:rgba(255,255,255,.94);border:1px solid var(--line);box-shadow:0 5px 15px rgba(28,69,65,.09);border-radius:10px;padding:7px 10px;font-size:9px;color:var(--muted);pointer-events:none; }
.canvas-controls { position:absolute;left:11px;bottom:12px;display:flex;align-items:center;gap:3px;background:rgba(255,255,255,.94);border:1px solid var(--line);border-radius:10px;padding:4px;box-shadow:0 5px 16px rgba(30,70,66,.1);z-index:10;direction:ltr; }
.canvas-controls button { width:28px;height:28px;border:0;background:transparent;border-radius:7px;color:var(--text);font-size:15px; }.canvas-controls button:hover{background:var(--primary-soft);color:var(--primary)}
.canvas-controls span { font-size:8px;color:var(--muted);padding:0 5px;min-width:40px;text-align:center; }
.canvas-legend { position:absolute;right:11px;bottom:12px;display:flex;gap:10px;background:rgba(255,255,255,.94);border:1px solid var(--line);border-radius:10px;padding:7px 10px;font-size:8px;color:var(--muted);z-index:10;direction:rtl; }
.canvas-legend span { display:flex;align-items:center;gap:4px; }.state { width:9px;height:9px;border-radius:3px;display:inline-block; }.state.empty{background:#fff;border:1px solid #aac1bd}.state.occupied{background:#33a995}.state.warning{background:#e3bc46}.state.expired{background:#db5d5d}.state.blocked{background:#82918f}
.factory-overview { padding:18px;overflow:auto; }
.page-heading { display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:12px; }.page-heading h2{margin:0;font-size:20px}.page-heading p{margin:4px 0;color:var(--muted);font-size:11px}.legend{display:flex;gap:13px;font-size:9px;color:var(--muted)}.dot{width:9px;height:9px;border-radius:50%;display:inline-block;margin-left:4px}.dot.raw{background:#3588dd}.dot.finished{background:#d52c91}.dot.packaging{background:#4dad37}
.factory-map-card { max-width:1040px;margin:0 auto;background:#fff;border:1px solid var(--line);border-radius:18px;padding:12px;box-shadow:var(--shadow); }
.factory-map { position:relative;aspect-ratio:1/1;overflow:hidden;border-radius:12px;background:#f9fbfb;touch-action:none;user-select:none; }.factory-map img{width:100%;height:100%;object-fit:fill;display:block;pointer-events:none}.map-hotspots{position:absolute;inset:0;width:100%;height:100%}.warehouse-hotspot{stroke-width:8;cursor:pointer;transition:.2s;fill-opacity:.25}.warehouse-hotspot:hover{fill-opacity:.5;filter:drop-shadow(0 0 9px rgba(10,128,120,.35))}.warehouse-hotspot.raw{fill:#2783dc;stroke:#2783dc}.warehouse-hotspot.finished{fill:#d4258c;stroke:#d4258c}.warehouse-hotspot.packaging{fill:#56ad35;stroke:#56ad35}.map-instruction{position:absolute;top:12px;right:12px;background:rgba(255,255,255,.92);border:1px solid var(--line);border-radius:10px;padding:8px 11px;font-size:10px;color:var(--muted)}
.generic-page { display:grid;place-items:center;padding:30px; }.generic-card{background:#fff;border:1px solid var(--line);border-radius:20px;padding:40px;text-align:center;box-shadow:var(--shadow);max-width:470px}.generic-icon{font-size:48px;color:var(--primary)}.generic-card h2{margin:8px 0}.generic-card p{color:var(--muted);font-size:11px}
.modal-backdrop { position:fixed;inset:0;background:rgba(21,49,47,.35);backdrop-filter:blur(4px);z-index:100;display:grid;place-items:center;padding:20px; }.modal-card{background:#fff;border:1px solid var(--line);border-radius:21px;padding:28px;text-align:center;max-width:410px;box-shadow:0 28px 70px rgba(20,55,52,.25)}.modal-icon{width:60px;height:60px;border-radius:18px;background:var(--primary-soft);color:var(--primary);display:grid;place-items:center;font-size:30px;margin:0 auto 12px}.modal-card h3{margin:0 0 8px}.modal-card p{color:var(--muted);font-size:11px;line-height:2}.modal-actions{margin-top:16px}
.toast-container { position:fixed;left:18px;top:92px;z-index:200;display:flex;flex-direction:column;gap:7px; }.toast{background:#fff;border:1px solid var(--line);border-right:4px solid var(--primary);box-shadow:var(--shadow);border-radius:11px;padding:9px 12px;min-width:240px;font-size:10px;animation:toastIn .25s ease}.toast.error{border-right-color:var(--red)}.toast.warn{border-right-color:var(--orange)}@keyframes toastIn{from{opacity:0;transform:translateX(-15px)}to{opacity:1;transform:none}}
@media (max-width:1200px){:root{--sidebar-w:72px}.workspace-layout{grid-template-columns:285px 1fr}.kpi-strip{grid-template-columns:repeat(3,1fr)}.brand-text{display:none}.tool-btn label{display:none}.tool-btn{min-width:35px;width:35px}}
@media (max-width:900px){body{overflow:auto}.app-shell{min-height:100vh;height:auto;grid-template-columns:1fr;grid-template-rows:70px 1fr 65px}.app-header{grid-column:1;grid-row:1}.right-sidebar{position:fixed;bottom:0;left:0;right:0;height:64px;grid-column:1;grid-row:auto;flex-direction:row;padding:5px;z-index:50}.nav-item{min-height:52px}.nav-item label{font-size:8px}.sidebar-spacer{display:none}.main-area{grid-column:1;grid-row:2;height:calc(100vh - 134px)}.workspace-layout{grid-template-columns:1fr}.left-dock{display:none}.workspace-meta{display:none}.kpi-strip{display:none}.brand-logo{width:44px;height:52px}.user-chip div,.demo-pill{display:none}}

/* v0.2 overrides and additional components */
body { font-family: Vazirmatn, Tahoma, Arial, sans-serif; }
.workspace-meta { gap: 11px; }
.inline-setting { border: 1px solid var(--line); background: #fff; color: var(--primary); border-radius: 9px; padding: 5px 9px; font-size: 9px; font-weight: 700; }
.inline-setting:hover { background: var(--primary-soft); }
.workspace-layout { grid-template-columns: 345px 1fr; }
.left-dock { grid-template-rows: minmax(255px, .95fr) minmax(300px, 1.05fr); }
.inventory-tabs { gap: 1px; }
.inventory-tabs button { padding: 7px 2px; font-size: 9px; }
.multi-selection-info { margin: 0 9px 8px; padding: 7px 9px; border-radius: 9px; border: 1px dashed #92c8bf; background: var(--primary-soft); color: var(--primary); font-size: 9px; line-height: 1.7; }
.inventory-item { grid-template-columns: 18px 1fr auto; align-items: start; }
.selection-check { width: 16px; height: 16px; border: 1px solid var(--line-strong); border-radius: 5px; display: grid; place-items: center; color: white; font-size: 9px; margin-top: 1px; }
.inventory-item.multi-selected .selection-check { background: var(--primary); border-color: var(--primary); }
.inventory-item.multi-selected { background: #eff9f7; }
.inventory-item .meta { max-width: 210px; }
.inventory-item .loc { min-width: 86px; }
.tool-btn.aisle-tool span { color: #d95454; }
.state.aisle { background: rgba(237,104,104,.25); border: 1px dashed #d95353; }

.form-modal { width: min(520px, 94vw); max-width: 520px; text-align: right; padding: 22px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 15px; }
.modal-head h3 { margin: 0 0 3px; font-size: 15px; }
.modal-head p { margin: 0; color: var(--muted); font-size: 10px; }
.modal-x { border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); width: 32px; height: 32px; border-radius: 9px; font-size: 20px; }
.modal-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-form-grid label { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 10px; }
.modal-form-grid label.full { grid-column: 1 / 3; }
.modal-form-grid input, .modal-form-grid textarea, .modal-form-grid select { width: 100%; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 10px; padding: 9px 10px; resize: vertical; }
.check-row { display: flex; align-items: center; gap: 7px; margin-top: 13px; color: var(--text); font-size: 10px; }
.secondary-btn { border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 10px; padding: 8px 13px; font-size: 10px; }
.danger-primary { background: linear-gradient(135deg,#bd4949,#dc6666); }

.details-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.details-actions button { flex: 1; min-width: 120px; }
.row-summary-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.row-summary-head strong { font-size: 11px; }
.row-summary-head span { color: var(--muted); font-size: 9px; }
.row-adjuster { border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); padding: 9px; margin: 10px 0; }
.row-adjuster-head { display: flex; justify-content: space-between; align-items: center; font-size: 9px; color: var(--muted); margin-bottom: 7px; }
.row-adjuster-controls { display: grid; grid-template-columns: 1fr auto auto; gap: 6px; }
.row-adjuster-controls select, .row-adjuster-controls button { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 6px 8px; font-size: 9px; }
.row-adjuster-controls button { color: var(--primary); font-weight: 700; min-width: 36px; }
.level-summaries { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 9px; }
.level-summary { border: 1px solid var(--line); border-radius: 9px; padding: 7px 4px; background: #fff; text-align: center; }
.level-summary strong { display: block; font-size: 12px; }
.level-summary small { color: var(--muted); font-size: 7.5px; }
.slot-matrix { direction: ltr; display: grid; gap: 4px; overflow-x: auto; padding-bottom: 5px; }
.slot-matrix-row { display: grid; grid-template-columns: 34px repeat(var(--slots), minmax(25px,1fr)); gap: 3px; align-items: center; min-width: max-content; }
.slot-level-label { direction: rtl; color: var(--muted); font-size: 8px; text-align: right; }
.slot-cell { width: 25px; height: 25px; border: 1px solid var(--line-strong); border-radius: 6px; background: #fff; display: grid; place-items: center; font-size: 7px; color: var(--muted); cursor: pointer; }
.slot-cell.occupied { color: #fff; border-color: transparent; }
.slot-cell.ibc::after { content: 'I'; font-weight: 800; }
.slot-cell.drum::after { content: 'D'; font-weight: 800; }
.rect-kind-switch { display: flex; gap: 6px; }
.rect-kind-switch button { flex: 1; border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px; font-size: 9px; }
.rect-kind-switch button.active { background: var(--primary-soft); color: var(--primary); border-color: #aad8d0; }

#layoutCanvas { cursor: crosshair; }
.canvas-notice { max-width: 360px; }
.babylon-host.split { left: 50%; }
.workspace-canvas-wrap.split-mode #layoutCanvas { width: 50%; }
.three-status { direction: rtl; }

@media(max-width:1350px){.workspace-layout{grid-template-columns:315px 1fr}.toolbar{gap:4px}.tool-btn{min-width:43px}.workspace-meta span:nth-of-type(2){display:none}}
@media(max-width:1100px){.workspace-layout{grid-template-columns:280px 1fr}.level-summaries{grid-template-columns:repeat(2,1fr)}.toolbar-spacer{display:none}.workspace-meta{display:none}}


/* v0.3 — editable factory warehouse map and developer settings */
.factory-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.active-warehouse-chip { display:inline-flex; align-items:center; min-height:34px; padding:7px 11px; border:1px solid var(--line); border-radius:10px; background:#fff; color:var(--primary); font-size:10px; font-weight:700; }
.map-add-btn { min-height:34px; padding-inline:14px; }
.map-add-btn.active { background:#a34747; box-shadow:0 0 0 3px rgba(163,71,71,.13); }
.factory-map.adding-warehouse { cursor:crosshair; }
.factory-map.adding-warehouse .map-hotspots { cursor:crosshair; }
.warehouse-region { cursor:pointer; }
.warehouse-region .warehouse-shape { fill:rgba(255,255,255,.68); stroke:#536663; stroke-width:5; stroke-dasharray:14 9; vector-effect:non-scaling-stroke; transition:.18s ease; }
.warehouse-region:hover .warehouse-shape { fill:rgba(26,139,124,.12); stroke:var(--primary); stroke-width:7; }
.warehouse-region.active .warehouse-shape { fill:rgba(26,139,124,.18); stroke:var(--primary); stroke-width:8; stroke-dasharray:none; }
.warehouse-region.empty-workspace .warehouse-shape { fill:rgba(255,255,255,.54); }
.warehouse-region .warehouse-title { fill:#223b38; font-family:Vazirmatn,Tahoma,Arial,sans-serif; font-size:30px; font-weight:800; paint-order:stroke; stroke:rgba(255,255,255,.95); stroke-width:7px; stroke-linejoin:round; pointer-events:none; }
.warehouse-region .warehouse-status-text { fill:#536663; font-family:Vazirmatn,Tahoma,Arial,sans-serif; font-size:16px; font-weight:600; paint-order:stroke; stroke:rgba(255,255,255,.95); stroke-width:5px; pointer-events:none; }
.warehouse-region.active .warehouse-status-text { fill:var(--primary); }
.warehouse-editor-modal { max-width:600px; }
.warehouse-workspace-status { margin-top:14px; border:1px solid var(--line); border-radius:11px; background:var(--surface-2); padding:10px 12px; font-size:10px; color:var(--muted); line-height:1.9; }
.warehouse-workspace-status strong { color:var(--text); }
.warehouse-editor-actions { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.modal-action-spacer { flex:1; }
.warehouse-delete-btn { color:#b34848; border-color:#e5baba; }
.warehouse-delete-btn.hidden { display:none; }
.settings-content { width:min(680px,100%); text-align:right; }
.settings-content > h2 { margin:0 0 6px; }
.settings-content > p { margin:0 0 18px; color:var(--muted); }
.developer-card { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:14px; border:1px solid var(--line); border-radius:16px; background:var(--surface-2); padding:16px; text-align:right; }
.developer-avatar { width:54px; height:54px; display:grid; place-items:center; border-radius:16px; background:var(--primary-soft); color:var(--primary); font-size:20px; font-weight:800; }
.developer-info strong { display:block; font-size:14px; margin-bottom:3px; }
.developer-info span { display:block; color:var(--muted); font-size:10px; }
.developer-link { display:inline-flex; align-items:center; justify-content:center; min-height:36px; padding:8px 12px; border-radius:10px; background:#0a66c2; color:#fff; text-decoration:none; font-size:10px; font-weight:700; white-space:nowrap; }
.developer-link:hover { filter:brightness(.95); }
.settings-meta { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin-top:12px; }
.settings-meta div { border:1px solid var(--line); border-radius:11px; background:#fff; padding:10px 12px; }
.settings-meta small { display:block; color:var(--muted); margin-bottom:3px; }
.settings-meta strong { font-size:11px; }
@media(max-width:700px){.page-heading{align-items:flex-start;gap:12px;flex-direction:column}.developer-card{grid-template-columns:auto 1fr}.developer-link{grid-column:1/3}.settings-meta{grid-template-columns:1fr}.warehouse-editor-actions .modal-action-spacer{display:none}}


/* v0.4 — factory map editor, custom background, drag and resize */
.factory-map-card { max-width:1120px; }
.factory-map-meta { display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; padding:0 4px 10px; color:var(--muted); font-size:10px; }
.factory-map-meta span:first-child { color:var(--text); font-weight:700; }
.map-image-btn { min-height:34px; padding-inline:12px; white-space:nowrap; }
.warehouse-region { cursor:grab; touch-action:none; }
.warehouse-region:active { cursor:grabbing; }
.warehouse-region.selected .warehouse-shape { fill:rgba(26,139,124,.22); stroke:#0b6f63; stroke-width:9; stroke-dasharray:18 8; }
.warehouse-region .warehouse-code-text { fill:#38504d; font-family:Vazirmatn,Tahoma,Arial,sans-serif; font-size:14px; font-weight:700; paint-order:stroke; stroke:rgba(255,255,255,.95); stroke-width:4px; pointer-events:none; }
.warehouse-corner-handle { fill:#fff; stroke:#0b6f63; stroke-width:6; vector-effect:non-scaling-stroke; cursor:move; filter:drop-shadow(0 2px 3px rgba(16,65,59,.22)); }
.warehouse-region:not(.selected) .warehouse-corner-handle,.warehouse-region.locked .warehouse-corner-handle { display:none; }
.warehouse-region.locked { cursor:pointer; }
.warehouse-region.locked .warehouse-shape { stroke-dasharray:5 7; }
.warehouse-region.invalid-preview .warehouse-shape { fill:rgba(210,45,45,.22)!important; stroke:#c42d2d!important; stroke-width:9!important; stroke-dasharray:14 8!important; }
.warehouse-region.invalid-preview .warehouse-corner-handle { stroke:#c42d2d; fill:#fff0f0; }
.factory-map.invalid-factory-shape .map-instruction { color:#a52121; border-color:#e4a7a7; background:#fff2f2; opacity:1; }
.factory-lock-row { margin-top:3px; }
.factory-corner-note { border:1px dashed #bfd0cd; border-radius:10px; background:#f5f9f8; padding:10px 12px; color:var(--muted); font-size:10px; line-height:1.9; }
.factory-selection-toolbar { position:absolute; left:12px; bottom:12px; z-index:6; display:flex; align-items:center; gap:7px; flex-wrap:wrap; max-width:calc(100% - 24px); border:1px solid var(--line); border-radius:12px; background:rgba(255,255,255,.96); padding:8px 10px; box-shadow:0 10px 24px rgba(25,49,46,.13); backdrop-filter:blur(6px); }
.factory-selection-toolbar.hidden { display:none; }
.factory-selection-toolbar strong { margin-inline-end:4px; font-size:11px; }
.factory-selection-toolbar button { min-height:31px; padding:6px 9px; font-size:9px; }
.factory-map.dragging-warehouse .map-instruction { opacity:.25; }
.factory-map.adding-warehouse .warehouse-region { pointer-events:none; opacity:.75; }
.warehouse-editor-modal textarea { resize:vertical; }
@media(max-width:800px){.factory-actions{width:100%}.factory-actions button{flex:1}.active-warehouse-chip{width:100%;justify-content:center}.factory-map-meta{align-items:flex-start;flex-direction:column}.factory-selection-toolbar{right:8px;left:8px;bottom:8px}.factory-selection-toolbar button{flex:1}.warehouse-region .warehouse-title{font-size:24px}.warehouse-region .warehouse-status-text{font-size:14px}}

/* v0.5 — independent quadrilateral factory warehouse boundaries */
.warehouse-region .warehouse-shape{stroke-linejoin:round;stroke-linecap:round;}
#lockSelectedWarehouseBtn.active{background:#e8f4f1;border-color:#79aaa2;color:#075d54;}

/* Git-ready v0.5: helper text for free-form factory warehouse polygons */
.warehouse-shape-help {
  padding: 10px 12px;
  border: 1px dashed #bfd3cf;
  border-radius: 10px;
  background: #f5faf9;
  color: #4c6661;
  font-size: 12px;
  line-height: 1.9;
}


/* ========================================================================== */
/* Tank module v0.6 — scoped additions; previous components remain unchanged. */
/* ========================================================================== */
.kpi-strip.has-tanks { grid-template-columns: repeat(6,minmax(120px,1fr)); max-height: 128px; overflow-y:auto; padding-inline-end:3px; }
.kpi-card.tank-kpi .kpi-icon { background:rgba(33,138,116,.12); color:#176f5d; }
.tool-btn.tank-tool span { color:var(--primary); }
.canvas-legend .state.tank { border-radius:50%; background:linear-gradient(to top,#218a74 0 58%,#f7fbfa 58% 100%); border:1px solid #3f746d; }
.tank-fill-card { display:flex;align-items:center;gap:12px;border:1px solid var(--line);background:linear-gradient(145deg,#f8fcfb,#edf7f5);border-radius:14px;padding:10px;margin-bottom:10px; }
.tank-fill-card>div:last-child { display:flex;flex-direction:column;gap:2px;min-width:0; }
.tank-fill-card small,.tank-fill-card span { color:var(--muted);font-size:9px; }
.tank-fill-ring { --fill:0;--tank-color:#218a74;width:66px;height:66px;border-radius:50%;flex:0 0 66px;display:grid;place-items:center;background:conic-gradient(var(--tank-color) calc(var(--fill)*1%),#dce9e6 0);position:relative; }
.tank-fill-ring::after { content:"";position:absolute;inset:7px;border-radius:50%;background:#fff; }
.tank-fill-ring strong { position:relative;z-index:1;color:var(--text);font-size:12px; }
.inline-field-actions { display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:5px;align-items:center; }
.inline-field-actions select { min-width:0;width:100%; }
.inline-field-actions .secondary-btn { padding:7px 8px;font-size:8px; }
.tank-properties textarea { resize:vertical; }
@media(max-width:1350px){.kpi-strip.has-tanks{grid-template-columns:repeat(4,minmax(115px,1fr));max-height:170px}}
