:root {
  --ink: #17312c;
  --muted: #65746f;
  --line: #dce4e1;
  --paper: #ffffff;
  --canvas: #f1f4f2;
  --green: #19775e;
  --green-dark: #115441;
  --lime: #b8d957;
  --orange: #e99b47;
  --blue: #5c9cc7;
  --purple: #8a72b5;
  --danger: #c94e48;
  --shadow: 0 16px 42px rgba(30, 55, 48, .13);
  --soft-shadow: 0 8px 24px rgba(30, 55, 48, .1);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  min-width: 980px;
  background:
    radial-gradient(circle at 90% 0%, rgba(184, 217, 87, .08), transparent 24rem),
    var(--canvas);
  overflow-x: auto;
}

button, input { font: inherit; }

button { color: inherit; }

button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(25, 119, 94, .28);
  outline-offset: 2px;
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.screen-warning {
  display: none;
  padding: 7px 18px;
  text-align: center;
  background: #fff3d7;
  border-bottom: 1px solid #ebd197;
  color: #705319;
  font-size: 12px;
  font-weight: 700;
}

.topbar {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 25px;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(#173f35, #14372f);
  border-bottom: 4px solid var(--lime);
  box-shadow: 0 4px 18px rgba(16, 48, 40, .2);
  position: relative;
  z-index: 50;
}

.brand { display: flex; align-items: center; gap: 13px; }

.brand-mark {
  display: inline-flex;
  place-items: center;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 43px;
  height: 43px;
  border: 1px solid rgba(255,255,255,.34);
  border-radius: 10px;
  font-weight: 900;
  letter-spacing: -.08em;
  background: rgba(255,255,255,.08);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.04);
  line-height: 1;
  white-space: nowrap;
}

.brand-mark b { font: inherit; }
.brand-mark span { display: inline-block; color: var(--lime); }

.brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.brand-copy strong { font-size: 17px; letter-spacing: .08em; }
.brand-copy small { margin-top: 5px; font-size: 9px; letter-spacing: .16em; color: #c9d9d4; }
.brand-copy small i { margin-left: 11px; font-style: normal; color: #90b2a8; }

.top-actions { display: flex; align-items: center; gap: 5px; }

.active-user { min-height: 37px; display: flex; flex-direction: column; justify-content: center; align-items: flex-end; margin-right: 7px; padding-right: 12px; border-right: 1px solid rgba(255,255,255,.16); line-height: 1.1; }
.active-user span { color: #9fbbb2; font-size: 7px; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.active-user strong { max-width: 180px; margin-top: 3px; overflow: hidden; color: #fff; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }

.quiet-btn {
  min-height: 39px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #d7e5e1;
  background: transparent;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  transition: .18s ease;
}

.quiet-btn:hover { border-color: rgba(255,255,255,.15); background: rgba(255,255,255,.08); color: white; }
.quiet-btn.danger:hover { color: #ffd9d7; }

.app-shell {
  --palette-width: clamp(250px, 22vw, 420px);
  min-height: calc(100vh - 74px);
  display: grid;
  grid-template-columns: var(--palette-width) minmax(690px, 1fr);
  position: relative;
}

.palette {
  height: calc(100vh - 74px);
  min-height: 650px;
  padding: 21px 15px 14px;
  background: #fbfcfb;
  border-right: 1px solid #d7dfdc;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  z-index: 20;
  container: palette / inline-size;
  transition: opacity .25s ease, filter .25s ease;
}

.palette-resizer {
  position: absolute;
  z-index: 35;
  top: 0;
  bottom: 0;
  left: calc(var(--palette-width) - 6px);
  width: 12px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: col-resize;
  touch-action: none;
}

.palette-resizer::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 5px;
  width: 2px;
  background: #d7dfdc;
  transition: width .15s ease, left .15s ease, background .15s ease, box-shadow .15s ease;
}

.palette-resizer span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 42px;
  transform: translate(-50%, -50%);
  border: 1px solid #b8c9c3;
  border-radius: 8px;
  background: #f8fbfa;
  box-shadow: 0 2px 8px rgba(31,67,56,.12);
}

.palette-resizer span::before { content: "⋮"; position: absolute; inset: 0; display: grid; place-items: center; color: #6f8d83; font-size: 14px; line-height: 1; }
.palette-resizer:hover::before, .palette-resizer:focus-visible::before, .app-shell.palette-resizing .palette-resizer::before { left: 4px; width: 4px; background: var(--green); box-shadow: 0 0 0 3px rgba(25,119,94,.13); }
.palette-resizer:focus-visible { outline: none; }
.app-shell.palette-resizing, .app-shell.palette-resizing * { cursor: col-resize !important; user-select: none !important; }
.simulation-mode .palette-resizer { opacity: .25; pointer-events: none; }

.palette-heading { display: flex; align-items: flex-end; justify-content: space-between; padding: 0 5px; }
.eyebrow { color: var(--green); font-size: 9px; letter-spacing: .16em; font-weight: 900; }
.palette h1 { margin: 5px 0 0; font-size: 19px; line-height: 1.1; letter-spacing: -.025em; }
.placed-counter { min-width: 30px; height: 25px; padding: 0 8px; display: grid; place-items: center; border-radius: 20px; background: #e1eee9; color: var(--green-dark); font-size: 11px; font-weight: 900; }
.palette-intro { margin: 10px 5px 14px; color: var(--muted); font-size: 11px; line-height: 1.45; }

.search-box {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  margin: 0 4px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  color: #8a9893;
}

.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.search-box input::placeholder { color: #a0aca8; }

.palette-list {
  flex: 1;
  overflow: auto;
  padding: 0 3px 12px;
  scrollbar-width: thin;
  scrollbar-color: #c8d4d0 transparent;
}

.palette-group { margin-bottom: 14px; }
.palette-group-title { display: flex; align-items: center; gap: 7px; margin: 0 3px 7px; color: #72807b; font-size: 9px; letter-spacing: .14em; font-weight: 900; text-transform: uppercase; }
.palette-group-title::after { content: ""; height: 1px; background: #e1e7e5; flex: 1; }
.element-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }

.palette-item {
  min-height: 77px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 7px;
  border: 1px solid #dfe6e3;
  border-radius: 10px;
  background: #fff;
  cursor: grab;
  text-align: left;
  touch-action: none;
  user-select: none;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.palette-item:hover { transform: translateY(-2px); border-color: #a8c8bd; box-shadow: 0 7px 15px rgba(34, 74, 62, .1); }
.palette-item:active { cursor: grabbing; }
.palette-item .element-thumb { width: 43px; min-width: 43px; height: 43px; }
.palette-item span:last-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.palette-item strong { font-size: 10px; line-height: 1.15; font-weight: 800; }
.palette-item small { color: #82908b; font-size: 8px; text-transform: uppercase; letter-spacing: .07em; }

@container palette (max-width: 285px) {
  .element-grid { grid-template-columns: 1fr; }
  .palette-item { min-height: 58px; }
  .palette-item .element-thumb { width: 37px; min-width: 37px; height: 37px; }
}

@container palette (min-width: 455px) {
  .element-grid { grid-template-columns: repeat(3, 1fr); }
  .palette-item { min-height: 70px; }
}

.example-btn {
  min-height: 55px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px dashed #a9c3ba;
  border-radius: 11px;
  background: #f0f7f4;
  color: var(--green-dark);
  text-align: left;
  cursor: pointer;
}

.example-btn:hover { background: #e6f2ee; }
.example-btn > span:last-child { display: flex; flex-direction: column; }
.example-btn strong { font-size: 11px; }
.example-btn small { color: #6e817a; font-size: 9px; margin-top: 2px; }
.example-icon { width: 28px; height: 28px; display: grid; place-items: center; background: var(--green); color: white; border-radius: 50%; font-size: 9px; }

.workspace { min-width: 0; padding: 18px 20px 22px; }

.workspace-head {
  height: 43px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  margin-bottom: 12px;
}

.phase-title { display: flex; align-items: center; gap: 8px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(25,119,94,.12); }
.phase-title div { display: flex; flex-direction: column; }
.phase-title strong { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.phase-title small { margin-top: 3px; color: var(--muted); font-size: 10px; }

.design-progress { display: flex; align-items: center; gap: 8px; }
.progress-step { display: flex; align-items: center; gap: 5px; color: #96a19d; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.progress-step b { width: 21px; height: 21px; display: grid; place-items: center; border: 1px solid #cad4d0; border-radius: 50%; background: #fff; font-size: 9px; }
.progress-step.active { color: var(--green-dark); }
.progress-step.active b, .progress-step.done b { color: white; background: var(--green); border-color: var(--green); }
.progress-step.done { color: var(--green); }
.design-progress > i { width: 27px; height: 1px; background: #cad4d0; }

.zoom-note { justify-self: end; color: #8a9692; font-size: 9px; }
kbd { min-width: 19px; display: inline-grid; place-items: center; padding: 2px 4px; border: 1px solid #cad2cf; border-bottom-width: 2px; border-radius: 4px; background: white; color: #64736e; font-size: 8px; font-family: inherit; }

.board-wrap { position: relative; }

.warehouse-board {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 8.55;
  min-height: 485px;
  max-height: calc(100vh - 232px);
  overflow: hidden;
  border: 1px solid #aab7b2;
  border-radius: 4px;
  background:
    linear-gradient(rgba(28, 62, 52, .025) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgba(28, 62, 52, .025) 1px, transparent 1px) 0 0 / 24px 24px,
    #e7ebe8;
  box-shadow: 0 9px 25px rgba(26, 51, 44, .11);
  touch-action: none;
}

.warehouse-board::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 5px rgba(255,255,255,.68), inset 0 0 0 6px #c7d0cd;
  z-index: 16;
}

.warehouse-nameplate {
  position: absolute;
  top: 7px;
  left: 50%;
  z-index: 3;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 0 0 6px 6px;
  background: rgba(24,55,47,.88);
  color: #fff;
  font-size: 7px;
  letter-spacing: .12em;
}

.warehouse-nameplate span { color: #bed2cb; font-weight: 500; letter-spacing: .04em; }

.zones { position: absolute; inset: 0; z-index: 2; }

.zone {
  position: absolute;
  overflow: hidden;
  border: 1px solid rgba(62, 84, 77, .23);
  background: var(--zone-color);
  transition: box-shadow .16s ease, filter .16s ease, border-color .16s ease;
}

.zone::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,.34), transparent 38%);
  pointer-events: none;
}

.zone::after {
  content: attr(data-code);
  position: absolute;
  right: 6px;
  bottom: 3px;
  color: rgba(29,55,48,.25);
  font: 800 15px/1 ui-monospace, monospace;
}

.zone.compatible { border-color: #1b9a65; box-shadow: inset 0 0 0 3px rgba(27,154,101,.72), 0 0 0 2px rgba(255,255,255,.8); filter: saturate(1.08); }
.zone.incompatible { border-color: #e29238; box-shadow: inset 0 0 0 3px rgba(226,146,56,.7), 0 0 0 2px rgba(255,255,255,.8); }
.zone-label { position: absolute; top: 8px; left: 8px; right: 7px; z-index: 1; display: flex; align-items: center; gap: 6px; }
.zone-label i { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 5px; background: rgba(255,255,255,.62); font-style: normal; font-size: 9px; }
.zone-label span { display: flex; flex-direction: column; }
.zone-label strong { font-size: clamp(7px, .72vw, 10px); line-height: 1.05; letter-spacing: .06em; text-transform: uppercase; }
.zone-label small { margin-top: 2px; color: rgba(36,62,55,.59); font-size: clamp(5px, .5vw, 7px); }

.zone-mark { position: absolute; inset: 30px 8px 7px; opacity: .33; pointer-events: none; }
.zone-mark.rack-lines { background: repeating-linear-gradient(90deg, transparent 0 17%, rgba(42,71,63,.28) 17% 20%); border-top: 3px solid rgba(42,71,63,.25); border-bottom: 3px solid rgba(42,71,63,.25); }
.zone-mark.dock-lines { background: repeating-linear-gradient(90deg, rgba(255,255,255,.45) 0 15%, transparent 15% 30%); border-bottom: 5px solid rgba(46,64,59,.35); }
.zone-mark.office-lines { background: linear-gradient(90deg, transparent 48%, rgba(51,76,69,.2) 48% 52%, transparent 52%), linear-gradient(transparent 48%, rgba(51,76,69,.2) 48% 52%, transparent 52%); }
.zone.support-zone { border-style: dashed; }
.zone.support-zone .zone-label { top: 6px; left: 6px; gap: 4px; }
.zone.support-zone .zone-label i { width: 16px; height: 16px; min-width: 16px; }
.zone.support-zone .zone-label strong { font-size: clamp(6px, .62vw, 8px); }
.zone.support-zone .zone-label small { font-size: clamp(4px, .43vw, 6px); }

.route { position: absolute; z-index: 1; pointer-events: none; }
.route-main { left: 4%; right: 4%; top: 43.5%; height: 8%; border-top: 1px dashed rgba(58,78,72,.33); border-bottom: 1px dashed rgba(58,78,72,.33); background: rgba(255,255,255,.3); }
.route-main::before { content: "→  →  →  →  →  →  →  →  →"; position: absolute; inset: 0; display: grid; place-items: center; color: rgba(50,74,67,.28); font-size: clamp(8px, 1vw, 14px); letter-spacing: .8em; white-space: nowrap; }
.route-main span { position: absolute; left: 50%; top: -7px; transform: translateX(-50%); padding: 0 5px; background: #e7ebe8; color: rgba(45,67,61,.42); font-size: 5px; letter-spacing: .16em; }
.route-cross-a, .route-cross-b { width: 6%; top: 30%; bottom: 9%; border-left: 1px dashed rgba(58,78,72,.28); border-right: 1px dashed rgba(58,78,72,.28); background: rgba(255,255,255,.2); }
.route-cross-a { left: 25%; }
.route-cross-b { left: 73%; }

.flow-legend { position: absolute; z-index: 3; top: 39%; left: 3%; right: 3%; display: flex; align-items: center; gap: 5px; color: rgba(41,68,60,.45); font-size: 6px; font-weight: 900; letter-spacing: .1em; }
.flow-legend i { flex: 1; height: 1px; background: rgba(39,67,59,.2); position: relative; }
.flow-legend i::after { content: "›"; position: absolute; right: -2px; top: -7px; font-size: 11px; }

.placed-layer, .simulation-layer, .route-overlay { position: absolute; inset: 0; }
.placed-layer { z-index: 7; }
.route-overlay { z-index: 8; pointer-events: none; }
.simulation-layer { z-index: 10; pointer-events: none; }

.placed-element {
  --accent: #3c8c74;
  position: absolute;
  width: clamp(46px, 5.4vw, 70px);
  height: clamp(46px, 5.4vw, 70px);
  transform: translate(-50%, -50%) rotate(var(--rotation));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3px;
  border: 1px solid rgba(41,72,63,.32);
  border-radius: 9px;
  background: rgba(255,255,255,.9);
  box-shadow: 0 3px 9px rgba(34,58,51,.16);
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: box-shadow .14s ease, border-color .14s ease, opacity .2s ease;
}

.placed-element:hover { border-color: var(--accent); box-shadow: 0 7px 15px rgba(25,57,48,.2); }
.placed-element.dragging { cursor: grabbing; z-index: 30; box-shadow: 0 15px 28px rgba(24,52,44,.3); transition: none; }
.placed-element.selected { border: 2px solid var(--green); box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 0 0 5px rgba(25,119,94,.28), 0 9px 18px rgba(24,52,44,.2); z-index: 12; }
.placed-element.selected::after { content: ""; position: absolute; width: 6px; height: 6px; right: -5px; bottom: -5px; border: 2px solid #fff; border-radius: 50%; background: var(--green); }
.placed-element .element-thumb { width: 76%; height: 67%; }
.placed-element .placed-name { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: clamp(5px, .53vw, 7px); font-weight: 900; text-transform: uppercase; letter-spacing: .03em; }
.placed-element.rotated-label .placed-name { transform: rotate(calc(-1 * var(--rotation))); }
.placed-element.misplaced { border-color: #d88b39; }

.element-thumb { display: grid; place-items: center; color: var(--accent, #397c68); }
.element-thumb svg { width: 100%; height: 100%; display: block; overflow: visible; }
.element-thumb .svg-stroke { fill: none; stroke: currentColor; stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.element-thumb .svg-fill { fill: currentColor; opacity: .16; stroke: currentColor; stroke-width: 1.6; }
.element-thumb .svg-accent { fill: var(--accent, #3b8a72); }
.element-thumb .svg-dark { fill: #29473f; }
.element-thumb .svg-wheel { fill: #23332f; stroke: #fff; stroke-width: 1; }
.element-thumb .svg-box { fill: #f2aa4c; stroke: #835922; stroke-width: 1.2; }

.drag-ghost { position: fixed; z-index: 1000; width: 74px; height: 74px; display: grid; place-items: center; border: 1px solid var(--green); border-radius: 12px; background: rgba(255,255,255,.95); box-shadow: 0 18px 34px rgba(20,49,41,.25); pointer-events: none; transform: translate(-50%,-50%); }
.drag-ghost .element-thumb { width: 58px; height: 58px; }

.empty-hint { position: absolute; z-index: 6; left: 50%; top: 48%; transform: translate(-50%,-50%); display: flex; flex-direction: column; align-items: center; padding: 15px 22px; border: 1px dashed rgba(37,91,74,.36); border-radius: 12px; background: rgba(255,255,255,.78); color: var(--green-dark); pointer-events: none; box-shadow: 0 8px 20px rgba(35,65,56,.08); }
.empty-hint > span { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 50%; background: #dcece6; font-size: 20px; font-weight: 300; }
.empty-hint strong { margin-top: 7px; font-size: 11px; }
.empty-hint small { margin-top: 2px; color: #74857f; font-size: 8px; }

.inspector {
  position: absolute;
  z-index: 40;
  right: 12px;
  top: 12px;
  width: 260px;
  padding: 14px;
  border: 1px solid #d3ded9;
  border-radius: 12px;
  background: rgba(255,255,255,.97);
  box-shadow: var(--shadow);
  animation: inspectorIn .18s ease both;
}

@keyframes inspectorIn { from { opacity: 0; transform: translateX(8px); } }
.inspector-top { display: flex; align-items: flex-start; justify-content: space-between; }
.inspector-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 10px; background: #edf4f1; }
.inspector-icon .element-thumb { width: 45px; height: 45px; }
.icon-btn { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid #dfe6e3; border-radius: 7px; background: white; color: #71807b; cursor: pointer; }
.inspector-type { display: block; margin-top: 9px; color: var(--green); font-size: 8px; letter-spacing: .14em; font-weight: 900; text-transform: uppercase; }
.inspector h2 { margin: 4px 0 10px; font-size: 16px; line-height: 1.15; }
.inspector dl { margin: 0; }
.inspector dl div { padding: 7px 0; border-top: 1px solid #edf0ef; }
.inspector dt { color: #84918c; font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.inspector dd { margin: 3px 0 0; color: #40544e; font-size: 10px; line-height: 1.35; }
.inspector-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 10px; }
.inspector-actions button { min-height: 34px; border: 1px solid #d8e1de; border-radius: 7px; background: #f8faf9; color: #4c625b; font-size: 9px; font-weight: 800; cursor: pointer; }
.inspector-actions button:hover { background: #edf5f2; border-color: #aac9be; }
.inspector-actions .delete { grid-column: 1 / -1; color: #a54541; }

.bottom-console {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 11px 14px 0;
}

.design-summary { display: flex; align-items: center; gap: 9px; min-width: 0; }
.summary-symbol { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid #cbd8d3; border-radius: 9px; background: white; color: var(--green); font-size: 18px; }
.design-summary > div:last-child { display: flex; flex-direction: column; min-width: 0; }
.design-summary span { color: #81908b; font-size: 8px; font-weight: 900; letter-spacing: .12em; }
.design-summary strong { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 700; }
.primary-actions { display: flex; gap: 8px; }
.check-btn, .simulate-btn { min-height: 45px; padding: 0 19px; border-radius: 9px; font-size: 10px; letter-spacing: .06em; font-weight: 900; text-transform: uppercase; cursor: pointer; transition: .18s ease; }
.check-btn { border: 1px solid var(--green); background: #fff; color: var(--green-dark); }
.check-btn:hover { background: #edf7f3; }
.simulate-btn { border: 1px solid var(--green-dark); background: linear-gradient(135deg, #1d7c62, #125742); color: #fff; box-shadow: 0 7px 15px rgba(20,95,73,.22); }
.simulate-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 20px rgba(20,95,73,.3); }
.simulate-btn:disabled { opacity: .42; cursor: not-allowed; box-shadow: none; }
.check-btn span, .simulate-btn span { margin-right: 6px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(14, 36, 30, .67);
  backdrop-filter: blur(5px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}

.modal-backdrop.open { opacity: 1; visibility: visible; }

.modal {
  width: min(760px, 94vw);
  max-height: calc(100vh - 44px);
  overflow: auto;
  position: relative;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(10,31,25,.35);
  transform: translateY(12px) scale(.985);
  transition: transform .22s ease;
}

.modal-backdrop.open .modal { transform: none; }
.modal-close { position: absolute; z-index: 2; right: 15px; top: 15px; width: 31px; height: 31px; border: 1px solid #dce4e1; border-radius: 50%; background: #fff; color: #65766f; cursor: pointer; }
.modal-badge { color: var(--green); font-size: 9px; font-weight: 900; letter-spacing: .17em; text-transform: uppercase; }
.modal h2 { margin: 7px 0 9px; font-size: 27px; letter-spacing: -.04em; }
.modal p { color: #5d7069; font-size: 13px; line-height: 1.55; }
.modal-primary, .secondary-btn { min-height: 45px; padding: 0 20px; border-radius: 9px; font-size: 10px; font-weight: 900; letter-spacing: .06em; text-transform: uppercase; cursor: pointer; }
.modal-primary { border: 1px solid var(--green-dark); background: var(--green); color: white; box-shadow: 0 7px 16px rgba(25,119,94,.22); }
.modal-primary:hover { background: var(--green-dark); }
.modal-primary:disabled { border-color: #aab7b2; background: #aab7b2; box-shadow: none; cursor: not-allowed; opacity: .68; }
.modal-primary span { margin-left: 9px; }
.secondary-btn { border: 1px solid #ccd8d3; background: white; color: #4e635c; }
.secondary-btn:hover { background: #f3f7f5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.intro-modal { width: min(930px, 94vw); min-height: 590px; display: grid; grid-template-columns: .92fr 1.08fr; overflow: hidden; }
.intro-visual { min-height: 590px; position: relative; overflow: hidden; background: linear-gradient(145deg, #143c32, #1c624e); }
.intro-visual::before { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 30px 30px, linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px) 0 0 / 30px 30px; }
.intro-visual::after { content: ""; position: absolute; width: 300px; height: 300px; left: -70px; bottom: -150px; border-radius: 50%; background: var(--lime); opacity: .18; }
.intro-orbit { position: absolute; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; }
.orbit-a { width: 360px; height: 360px; left: 22px; top: 50px; }
.orbit-b { width: 235px; height: 235px; left: 84px; top: 112px; border-style: dashed; }
.intro-warehouse { position: absolute; left: 72px; right: 50px; bottom: 100px; height: 190px; background: #f3f2e9; clip-path: polygon(0 18%, 50% 0, 100% 18%, 100% 100%, 0 100%); box-shadow: 0 25px 40px rgba(4,22,17,.35); }
.intro-warehouse::before { content: ""; position: absolute; left: 0; right: 0; top: 35px; height: 12px; background: #c7d757; }
.intro-warehouse > span { position: absolute; top: 61px; left: 50%; transform: translateX(-50%); color: #244b40; font-size: 22px; font-weight: 900; letter-spacing: -.08em; }
.intro-warehouse i { position: relative; top: 112px; float: left; width: 22%; height: 68px; margin-left: 8.5%; border: 5px solid #688179; border-bottom: 0; background: repeating-linear-gradient(0deg, #526e66 0 5px, #789087 5px 12px); }
.intro-truck { position: absolute; z-index: 2; left: 52px; bottom: 65px; width: 130px; height: 58px; border-radius: 6px 2px 3px 3px; background: #fff; box-shadow: 0 12px 20px rgba(4,22,17,.3); }
.intro-truck::before { content: ""; position: absolute; right: -45px; bottom: 0; width: 46px; height: 45px; border-radius: 4px 10px 3px 0; background: #de8b42; }
.intro-truck::after { content: "FRUTAS DEL SUR"; position: absolute; left: 17px; top: 18px; color: #376155; font-size: 7px; font-weight: 900; letter-spacing: .08em; }
.intro-truck i { position: absolute; bottom: -11px; width: 23px; height: 23px; border: 6px solid #293b36; border-radius: 50%; background: #afbbb7; }
.intro-truck i:first-child { left: 20px; }.intro-truck i:last-child { right: -31px; }
.intro-fruit { position: absolute; z-index: 3; width: 31px; height: 31px; display: grid; place-items: center; border: 3px solid rgba(255,255,255,.8); border-radius: 50%; color: transparent; box-shadow: 0 6px 12px rgba(0,0,0,.18); }
.fruit-a { right: 38px; top: 80px; background: #d34542; }.fruit-b { left: 35px; top: 120px; background: #b6cf50; }.fruit-c { right: 70px; top: 205px; background: #e2a33e; }
.intro-copy { padding: 40px 58px 32px; display: flex; flex-direction: column; align-items: flex-start; overflow-y: auto; }
.intro-copy h2 { margin-top: 9px; font-size: 40px; text-transform: uppercase; }
.intro-copy p { margin: 0 0 10px; max-width: 470px; }
.learning-loop { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 5px; padding: 17px 0 21px; margin-top: 6px; border-top: 1px solid #e6ebe9; }
.learning-loop span { display: flex; align-items: center; gap: 4px; color: #425a53; font-size: 8px; font-weight: 850; text-transform: uppercase; }
.learning-loop b { width: 19px; height: 19px; display: grid; place-items: center; border-radius: 50%; background: #dcece6; color: var(--green); font-size: 8px; }
.learning-loop i { color: #afbbb7; font-style: normal; }
.intro-copy .modal-primary { width: 100%; }
.modal-link { align-self: center; margin-top: 13px; border: 0; background: transparent; color: var(--green); font-size: 10px; font-weight: 750; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

.user-start-form { width: 100%; display: grid; gap: 7px; margin-top: auto; }
.user-start-form > label { display: flex; justify-content: space-between; color: #405850; font-size: 9px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.user-start-form > label span { color: #ad6a20; font-size: 7px; }
.user-name-field { position: relative; }
.user-name-field > span { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--green); font-size: 9px; }
.user-name-field input { width: 100%; height: 45px; padding: 0 14px 0 37px; border: 1px solid #becdc8; border-radius: 9px; background: #fbfcfc; color: var(--ink); font-size: 12px; font-weight: 750; }
.user-name-field input:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 4px rgba(25,119,94,.09); outline: 0; }
.user-name-field input[aria-invalid="true"] { border-color: var(--danger); background: #fff8f7; }
.user-name-error { min-height: 15px; margin: -1px 0 0 !important; color: var(--danger) !important; font-size: 9px !important; font-weight: 750; }

.teacher-access-modal { width: min(440px, 92vw); padding: 38px 42px 30px; text-align: center; }
.teacher-lock { width: 62px; height: 62px; display: grid; place-items: center; margin: 0 auto 17px; border: 1px solid #cfe0da; border-radius: 50%; background: #edf6f2; color: var(--green-dark); font-size: 25px; box-shadow: 0 8px 22px rgba(25,119,94,.11); }
.teacher-access-modal > p { margin: 0 auto; max-width: 340px; }
.teacher-access-form { display: grid; gap: 9px; margin-top: 22px; text-align: left; }
.teacher-access-form label { color: #415a52; font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.teacher-code-field { position: relative; }
.teacher-code-field > span { position: absolute; left: 17px; top: 50%; transform: translateY(-54%); color: #91a09b; font-size: 11px; letter-spacing: .14em; pointer-events: none; }
.teacher-code-field input { width: 100%; height: 52px; padding: 0 17px 0 76px; border: 1px solid #bdccc7; border-radius: 10px; background: #fbfcfc; color: var(--ink); font-size: 21px; font-weight: 900; letter-spacing: .35em; transition: border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.teacher-code-field input:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 4px rgba(25,119,94,.09); outline: 0; }
.teacher-code-field input[aria-invalid="true"] { border-color: var(--danger); background: #fff8f7; box-shadow: 0 0 0 4px rgba(201,78,72,.08); }
.teacher-access-error { min-height: 18px; margin: -1px 0 0 !important; color: var(--danger) !important; font-size: 10px !important; font-weight: 750; text-align: left; }
.teacher-access-form .modal-primary { width: 100%; }
.teacher-access-note { margin-top: 17px !important; color: #81908b !important; font-size: 9px !important; }
.teacher-access-modal.denied { animation: teacherDenied .28s ease; }
@keyframes teacherDenied { 25% { transform: translateX(-7px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-3px); } }

.compact-modal { width: min(560px, 92vw); padding: 36px 40px 34px; }
.help-steps { display: grid; gap: 8px; margin: 20px 0; }
.help-steps > div { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid #e2e8e5; border-radius: 10px; background: #fafcfb; }
.help-steps b { color: var(--green); font-size: 15px; }
.help-steps span { display: flex; flex-direction: column; }.help-steps strong { font-size: 11px; }.help-steps small { margin-top: 2px; color: #71817b; font-size: 10px; }
.help-note { padding: 11px 13px; border-left: 3px solid var(--lime); background: #f4f7ea; font-size: 11px !important; }
.compact-modal > .modal-primary { width: 100%; margin-top: 5px; }

.evidence-modal { width: min(1040px, 96vw); padding: 30px 34px 27px; }
.evidence-heading { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: center; }
.evidence-heading h2 { margin-bottom: 5px; }
.evidence-heading p { max-width: 680px; margin: 0; }
.evidence-score { width: 94px; height: 76px; display: flex; align-items: baseline; justify-content: center; padding-top: 14px; border-radius: 13px; background: linear-gradient(135deg, #173f35, #1d684f); color: #fff; box-shadow: 0 10px 24px rgba(19,73,57,.2); }
.evidence-score strong { font-size: 34px; letter-spacing: -.06em; }
.evidence-score span { margin-left: 4px; color: #bdd2ca; font-size: 9px; }
.evidence-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 18px 0 10px; }
.evidence-meta > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 12px; border: 1px solid #dde6e2; border-radius: 9px; background: #f8faf9; }
.evidence-meta span { color: #81908a; font-size: 8px; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.evidence-meta strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.evidence-preview { padding: 8px; border: 1px solid #d9e3df; border-radius: 12px; background: #e9efec; box-shadow: inset 0 0 0 1px rgba(255,255,255,.8); }
.evidence-preview canvas { display: block; width: 100%; height: auto; max-height: 49vh; border-radius: 7px; background: #fff; object-fit: contain; }
.evidence-note { margin: 9px 0 0 !important; color: #7a8a84 !important; font-size: 9px !important; }
.evidence-modal .modal-actions { margin-top: 14px; }

.evaluation-modal { padding: 34px 38px; }
.evaluation-header { display: grid; grid-template-columns: 1fr 120px; gap: 20px; align-items: center; }
.evaluation-header p { margin: 0; }
.score-ring { --score-angle: 0deg; width: 112px; height: 112px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--green) var(--score-angle), #e5ece9 0); position: relative; }
.score-ring::before { content: ""; position: absolute; inset: 8px; border-radius: inherit; background: white; }
.score-ring > span { position: relative; display: flex; align-items: baseline; }.score-ring strong { font-size: 33px; letter-spacing: -.06em; }.score-ring small { color: #7d8b86; font-size: 10px; }
.score-breakdown { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 24px 0 17px; }
.score-part { padding: 9px; border: 1px solid #e0e7e4; border-radius: 9px; background: #fafcfb; }
.score-part span { display: block; min-height: 22px; color: #7a8984; font-size: 7px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.score-part strong { font-size: 15px; }.score-part small { color: #8c9894; font-size: 8px; }
.score-part i { display: block; height: 3px; margin-top: 6px; border-radius: 4px; background: #e0e7e4; overflow: hidden; }.score-part i b { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.feedback-list { display: grid; gap: 6px; }
.feedback-item { display: grid; grid-template-columns: 26px 88px 1fr; gap: 8px; align-items: center; min-height: 42px; padding: 7px 10px; border: 1px solid #e3e9e7; border-radius: 9px; background: #fff; }
.feedback-item > b:first-child { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 7px; font-size: 12px; }
.feedback-item .feedback-label { font-size: 8px; letter-spacing: .1em; text-transform: uppercase; }
.feedback-item p { margin: 0; font-size: 10px; line-height: 1.35; }
.feedback-item.ok > b:first-child { color: #177053; background: #def1e9; }.feedback-item.ok .feedback-label { color: #177053; }
.feedback-item.warning > b:first-child { color: #a66314; background: #fff0d9; }.feedback-item.warning .feedback-label { color: #a66314; }
.feedback-item.error > b:first-child { color: #b84742; background: #f9dfdd; }.feedback-item.error .feedback-label { color: #b84742; }
.feedback-item.tip > b:first-child { color: #5d56a5; background: #ece9fa; }.feedback-item.tip .feedback-label { color: #5d56a5; }
.feedback-item.change { border-color: #bfd9e7; background: #f4fafd; }
.feedback-item.change > b:first-child { color: #276f91; background: #dceef7; }.feedback-item.change .feedback-label { color: #276f91; }
.feedback-caveat { margin: 13px 0 0; color: #87938f !important; font-size: 9px !important; text-align: center; }

.toast-region { position: fixed; right: 20px; bottom: 20px; z-index: 400; display: grid; gap: 8px; pointer-events: none; }
.toast { min-width: 260px; max-width: 390px; padding: 12px 14px; border: 1px solid #cbd9d4; border-left: 4px solid var(--green); border-radius: 9px; background: #fff; box-shadow: var(--shadow); animation: toastIn .22s ease both; font-size: 11px; font-weight: 700; }
.toast.warning { border-left-color: #e5973f; }.toast.error { border-left-color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.simulation-mode .palette { opacity: .32; filter: grayscale(.3); pointer-events: none; }
.simulation-mode .placed-layer { opacity: .24; filter: grayscale(.4); }
.simulation-mode .empty-hint, .simulation-mode .inspector { display: none !important; }
.simulation-mode .warehouse-board { box-shadow: 0 0 0 3px rgba(25,119,94,.15), 0 12px 30px rgba(22,55,46,.16); }
.simulation-mode .bottom-console { display: none; }

.simulation-console { margin-top: 11px; border: 1px solid #d0dad6; border-radius: 12px; background: #fff; box-shadow: 0 8px 22px rgba(24,53,45,.08); overflow: hidden; }
.sim-controls { min-height: 61px; display: flex; align-items: center; gap: 7px; padding: 8px 12px; border-bottom: 1px solid #e3e9e6; background: #f8faf9; }
.control-btn { width: 39px; height: 39px; border: 1px solid #d1dcd8; border-radius: 8px; background: #fff; color: #405a52; font-size: 11px; font-weight: 900; cursor: pointer; }
.control-btn.primary { color: white; background: var(--green); border-color: var(--green); }
.stage-progress { flex: 1; display: grid; grid-template-columns: 86px 1fr; grid-template-rows: auto auto; align-items: center; margin-left: 7px; }
.stage-progress span { color: var(--green); font-size: 8px; font-weight: 900; letter-spacing: .12em; }
.stage-progress strong { font-size: 12px; }
.stage-progress i { grid-column: 1 / -1; height: 4px; margin-top: 7px; overflow: hidden; border-radius: 5px; background: #e1e8e5; }
.stage-progress i b { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), var(--lime)); transition: width .35s ease; }
.sim-grid { display: grid; grid-template-columns: 1.05fr 1.45fr 1fr; }
.sim-grid > section { min-height: 114px; padding: 11px 13px; border-right: 1px solid #e6ebe9; }.sim-grid > section:last-child { border: 0; }
.panel-label { color: #82908b; font-size: 7px; font-weight: 900; letter-spacing: .14em; }
.operation-head { display: flex; align-items: center; gap: 7px; margin-top: 7px; }.operation-head > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; background: #edf5f2; }.operation-head div { display: flex; flex-direction: column; }.operation-head strong { font-size: 10px; }.operation-head small { margin-top: 2px; color: #258267; font-size: 7px; font-weight: 900; }
.operation-card dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin: 8px 0 0; }.operation-card dl div { display: flex; flex-direction: column; }.operation-card dt { color: #929e99; font-size: 6px; text-transform: uppercase; }.operation-card dd { margin: 1px 0 0; font-size: 8px; font-weight: 800; }
.history-card ol { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 7px 0 0; padding: 0; list-style: none; }.history-card li { color: #778680; font-size: 8px; }.history-card li.done { color: #24775e; }.history-card li.current { color: var(--ink); font-weight: 900; }.history-card li::before { content: "○"; margin-right: 3px; }.history-card li.done::before { content: "✓"; }.history-card li.current::before { content: "→"; color: var(--green); }
.metric-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 7px; }.metric-grid div { display: flex; flex-direction: column; padding: 6px 8px; border-radius: 7px; background: #f2f6f4; }.metric-grid span { color: #87948f; font-size: 6px; text-transform: uppercase; }.metric-grid strong { margin-top: 1px; font-size: 10px; }

.sim-actor { --actor-color: #347c67; position: absolute; width: clamp(42px, 5vw, 67px); height: clamp(42px, 5vw, 67px); transform: translate(-50%,-50%); display: grid; place-items: center; filter: drop-shadow(0 5px 4px rgba(30,50,44,.22)); will-change: left, top, transform; }
.sim-actor .element-thumb { width: 100%; height: 100%; --accent: var(--actor-color); }
.sim-actor > small { position: absolute; top: 94%; padding: 2px 4px; border-radius: 3px; background: rgba(24,49,42,.88); color: #fff; white-space: nowrap; font-size: clamp(4px,.45vw,6px); font-weight: 800; letter-spacing: .04em; }
.sim-actor.truck-actor { width: clamp(85px, 10vw, 140px); height: clamp(48px, 5.5vw, 75px); }
.sim-actor.pallet-actor { width: clamp(38px, 4.5vw, 61px); height: clamp(38px, 4.5vw, 61px); }
.sim-actor.box-actor { width: 24px; height: 24px; font-size: 16px; }
.sim-actor.inspection { animation: inspectPulse .65s ease infinite alternate; }
.sim-actor.unstable { animation: unstable .3s ease-in-out infinite alternate; transform-origin: 50% 90%; }
.sim-actor.crash { animation: palletCrash 1.1s cubic-bezier(.5,-.1,.72,.3) forwards; }
.sim-actor.wrapped::after { content: ""; position: absolute; inset: 8% 10% 12%; border: 3px solid rgba(190,230,232,.82); border-radius: 5px; background: repeating-linear-gradient(0deg, rgba(210,245,246,.24) 0 4px, rgba(255,255,255,.38) 4px 6px); animation: wrapIn 1s ease both; }
.sim-actor.strapped::before { content: ""; position: absolute; z-index: 3; inset: 4% 24% 10%; border-left: 4px solid #344d7d; border-right: 4px solid #344d7d; animation: strapIn .55s ease both; }
@keyframes inspectPulse { to { filter: drop-shadow(0 0 9px #65d1a7) brightness(1.1); } }
@keyframes unstable { to { transform: translate(-50%,-50%) rotate(5deg); } }
@keyframes palletCrash { 25% { transform: translate(-50%,-50%) rotate(12deg); } 100% { transform: translate(-50%,50%) rotate(29deg); } }
@keyframes wrapIn { from { clip-path: inset(100% 0 0); } to { clip-path: inset(0); } }
@keyframes strapIn { from { opacity: 0; transform: scaleY(0); } }

.route-segment { position: absolute; height: 2px; transform-origin: left center; border-top: 2px dashed rgba(25,119,94,.66); opacity: .8; }
.route-segment::after { content: "›"; position: absolute; right: -3px; top: -9px; color: var(--green); font-weight: 900; }
.belt-visual { position: absolute; height: 22px; transform-origin: left center; border: 3px solid #4d655e; border-radius: 7px; background: repeating-linear-gradient(90deg, #b9c7c2 0 7px, #71857e 7px 9px); box-shadow: 0 4px 5px rgba(25,45,39,.2); }
.scan-beam { position: absolute; z-index: 2; width: 2px; height: 65px; background: #4ae2aa; box-shadow: 0 0 10px #2dcc91; animation: scan 1.3s ease-in-out infinite alternate; }
@keyframes scan { from { transform: translateX(-34px); } to { transform: translateX(34px); } }

.order-card-sim { position: absolute; z-index: 30; left: 50%; top: 50%; width: min(300px, 34%); transform: translate(-50%,-50%); padding: 15px; border: 1px solid #b8ccc4; border-top: 4px solid var(--green); border-radius: 10px; background: rgba(255,255,255,.97); box-shadow: var(--shadow); animation: orderIn .35s ease both; }
.order-card-sim > span { color: var(--green); font-size: 7px; font-weight: 900; letter-spacing: .15em; }.order-card-sim h3 { margin: 4px 0 1px; font-size: 15px; }.order-card-sim > small { color: #75847f; font-size: 8px; }.order-lines { display: grid; gap: 4px; margin-top: 10px; }.order-lines div { display: flex; justify-content: space-between; padding: 5px 7px; border-radius: 5px; background: #f1f5f3; font-size: 9px; }.order-lines b { color: var(--green-dark); }
@keyframes orderIn { from { opacity: 0; transform: translate(-50%,-45%) scale(.95); } }

.falling-item { position: absolute; z-index: 20; font-size: clamp(14px,1.8vw,25px); animation: fallBox 1s cubic-bezier(.4,0,.8,.3) forwards; }
@keyframes fallBox { 0% { transform: translate(0,0) rotate(0); } 70% { transform: translate(var(--fall-x), var(--fall-y)) rotate(var(--fall-r)); } 85% { transform: translate(var(--fall-x), calc(var(--fall-y) - 9px)) rotate(var(--fall-r)); } 100% { transform: translate(var(--fall-x), var(--fall-y)) rotate(var(--fall-r)); } }

.confetti { position: absolute; z-index: 30; width: 5px; height: 9px; background: var(--confetti-color); animation: confetti 1.5s ease-out forwards; }
@keyframes confetti { from { opacity: 1; transform: translate(0,0) rotate(0); } to { opacity: 0; transform: translate(var(--confetti-x), var(--confetti-y)) rotate(540deg); } }

.event-modal { width: min(570px, 92vw); padding: 39px 43px 34px; text-align: center; }
.event-symbol { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 50%; background: #fff0da; color: #bd701b; font-size: 25px; font-weight: 950; box-shadow: 0 0 0 8px #fff8ec; }
.event-modal.danger-event .event-symbol { background: #f8dddb; color: var(--danger); box-shadow: 0 0 0 8px #fdf0ef; }
.event-message { max-width: 460px; margin: 0 auto 14px; }
.concept-box { padding: 11px 13px; border-left: 3px solid var(--green); background: #f0f6f3; color: #40574f; font-size: 10px; line-height: 1.45; text-align: left; }
.concept-box strong { display: block; margin-bottom: 3px; color: var(--green-dark); font-size: 8px; letter-spacing: .1em; text-transform: uppercase; }
.incident-cost { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }.incident-cost div { padding: 10px; border: 1px solid #f0d0cd; border-radius: 8px; background: #fff6f5; display: flex; flex-direction: column; }.incident-cost span { color: #9a6865; font-size: 8px; text-transform: uppercase; }.incident-cost strong { margin-top: 2px; color: #a33e39; font-size: 16px; }
.event-modal .modal-actions { justify-content: center; }

.final-modal { width: min(740px, 94vw); padding: 36px 42px 34px; text-align: center; }
.success-seal { width: 54px; height: 54px; display: grid; place-items: center; margin: 0 auto 12px; border-radius: 50%; background: var(--green); color: #fff; font-size: 24px; box-shadow: 0 0 0 8px #e7f3ee; }
.final-modal > p { margin: 0; }
.final-metrics { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin: 20px 0 13px; }.final-metrics div { padding: 10px 5px; border: 1px solid #e1e8e5; border-radius: 9px; background: #f8faf9; display: flex; flex-direction: column; }.final-metrics span { color: #81908b; font-size: 7px; text-transform: uppercase; }.final-metrics strong { margin-top: 3px; font-size: 13px; }
.final-score-card { display: grid; grid-template-columns: 1fr 1fr; align-items: center; padding: 14px 18px; border-radius: 11px; background: linear-gradient(135deg,#163f34,#1b5a47); color: white; text-align: left; }.final-score-card > div:first-child { display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: center; }.final-score-card span { grid-column: 1; font-size: 8px; letter-spacing: .14em; color: #b8d0c8; }.final-score-card strong { grid-column: 1; font-size: 28px; }.final-score-card strong small { font-size: 9px; color: #bdd0ca; }.final-score-card b { grid-column: 2; grid-row: 1 / 3; color: var(--lime); font-size: 11px; letter-spacing: .08em; }.stars { justify-self: end; color: #e8c553; font-size: 22px; letter-spacing: 3px; }
.final-findings { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 12px; text-align: left; }.finding-box { padding: 10px; border: 1px solid #e1e8e5; border-radius: 8px; }.finding-box > strong { display: block; margin-bottom: 5px; color: var(--green); font-size: 8px; letter-spacing: .1em; text-transform: uppercase; }.finding-box.improve > strong { color: #b16d21; }.finding-box ul { margin: 0; padding-left: 15px; }.finding-box li { margin: 3px 0; color: #5a6d66; font-size: 9px; line-height: 1.35; }

.debug-panel { position: absolute; z-index: 80; left: 8px; bottom: 8px; width: 290px; max-height: 190px; overflow: auto; padding: 8px; border: 1px solid #3ed89f; border-radius: 5px; background: rgba(7,24,19,.9); color: #8df1ca; font: 8px/1.45 ui-monospace, monospace; white-space: pre-wrap; pointer-events: none; }

@media (max-width: 1180px) {
  .screen-warning { display: block; }
  .app-shell { grid-template-columns: var(--palette-width) minmax(700px, 1fr); }
  .palette { height: calc(100vh - 100px); }
  .brand-copy small i { display: none; }
  .workspace { padding-inline: 13px; }
  .palette-item { min-height: 58px; }
  .palette-item .element-thumb { width: 37px; min-width: 37px; height: 37px; }
  .quiet-btn span:last-child { display: none; }
  .active-user strong { max-width: 120px; }
}

@media (max-height: 780px) and (min-width: 1181px) {
  .topbar { height: 64px; }
  .app-shell { min-height: calc(100vh - 64px); }
  .palette { height: calc(100vh - 64px); padding-top: 14px; }
  .palette-intro { margin-block: 7px 9px; }
  .search-box { height: 34px; margin-bottom: 8px; }
  .workspace { padding-top: 11px; }
  .workspace-head { margin-bottom: 7px; height: 37px; }
  .warehouse-board { min-height: 425px; max-height: calc(100vh - 196px); }
  .bottom-console { min-height: 55px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* =========================================================
   EDITOR DE ZONAS · FASE 1
   ========================================================= */

.communication-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.zones { z-index: 4; }

.warehouse-board.phase-zones .route,
.warehouse-board.phase-zones .flow-legend,
.warehouse-board.phase-equipment .route,
.warehouse-board.phase-equipment .flow-legend { display: none; }

.warehouse-board.phase-zones {
  background:
    linear-gradient(rgba(28, 62, 52, .045) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(28, 62, 52, .045) 1px, transparent 1px) 0 0 / 32px 32px,
    #e9edea;
}

.warehouse-board.phase-zones::after {
  content: "NAVE DISPONIBLE · DISTRIBUYE LAS ZONAS";
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  color: rgba(36,66,57,.25);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .2em;
}

.zone-palette-group + .zone-palette-group { margin-top: 14px; }
.zone-palette-list { display: grid; gap: 7px; }

.zone-palette-item {
  --zone-preview: #dce7e2;
  width: 100%;
  min-height: 70px;
  display: grid;
  grid-template-columns: 49px 1fr 22px;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid #dbe4e0;
  border-radius: 10px;
  background: #fff;
  text-align: left;
  cursor: grab;
  touch-action: none;
  transition: .16s ease;
}

.zone-palette-item:hover:not(.placed) { transform: translateY(-1px); border-color: #9fc3b6; box-shadow: 0 7px 15px rgba(34,74,62,.09); }
.zone-palette-item.placed { opacity: .55; cursor: default; background: #f0f4f2; }
.zone-palette-item .zone-swatch { width: 48px; height: 42px; position: relative; display: grid; place-items: center; border: 2px solid rgba(37,66,57,.25); border-radius: 5px; background: var(--zone-preview); color: #365e51; font-size: 16px; box-shadow: inset 0 0 0 3px rgba(255,255,255,.35); }
.zone-palette-item .zone-swatch::after { content: ""; position: absolute; inset: 5px; border: 1px dashed rgba(46,78,69,.25); }
.zone-palette-item > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; }
.zone-palette-item strong { font-size: 10px; line-height: 1.15; }
.zone-palette-item small { margin-top: 3px; color: #7f8d88; font-size: 8px; line-height: 1.25; }
.zone-palette-item .zone-status { width: 21px; height: 21px; display: grid; place-items: center; border: 1px solid #d3ded9; border-radius: 50%; color: #91a09a; font-size: 9px; }
.zone-palette-item.placed .zone-status { border-color: var(--green); background: var(--green); color: #fff; }

.zone-ghost {
  position: fixed;
  z-index: 1000;
  width: 170px;
  height: 92px;
  transform: translate(-50%,-50%);
  display: grid;
  place-items: center;
  padding: 10px;
  border: 2px solid var(--green);
  border-radius: 10px;
  background: var(--zone-preview, #dbe9e3);
  color: var(--green-dark);
  box-shadow: 0 18px 34px rgba(20,49,41,.25);
  pointer-events: none;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.zone.draggable-zone { cursor: grab; touch-action: none; user-select: none; overflow: visible; }
.zone.draggable-zone:hover { border-color: #3d7e69; box-shadow: inset 0 0 0 2px rgba(61,126,105,.25), 0 7px 14px rgba(35,65,56,.12); }
.zone.draggable-zone.dragging { z-index: 30; cursor: grabbing; border-color: var(--green); box-shadow: 0 0 0 4px rgba(255,255,255,.85), 0 0 0 7px rgba(25,119,94,.28), 0 15px 30px rgba(28,56,48,.25); transition: none; }
.zone.draggable-zone .zone-label { pointer-events: none; }
.zone.draggable-zone .zone-mark { pointer-events: none; }
.zone.overlapping-zone,
.zone.draggable-zone.overlapping-zone:hover,
.zone.draggable-zone.overlapping-zone.dragging { z-index: 31; border-color: #c94e48; box-shadow: inset 0 0 0 3px rgba(201,78,72,.4), 0 0 0 3px rgba(255,255,255,.9), 0 0 0 6px rgba(201,78,72,.3), 0 12px 25px rgba(108,35,31,.2); }
.zone.overlapping-zone::before { background: repeating-linear-gradient(135deg, rgba(201,78,72,.13) 0 7px, transparent 7px 14px); }
.zone-overlap-badge { position: absolute; z-index: 8; left: 50%; bottom: 7px; transform: translateX(-50%); padding: 3px 7px; border-radius: 999px; background: #b83f3a; color: #fff; box-shadow: 0 3px 8px rgba(91,28,25,.24); font-size: 6px; font-weight: 950; letter-spacing: .09em; line-height: 1; text-transform: uppercase; pointer-events: none; white-space: nowrap; }
.zone-remove {
  position: absolute;
  z-index: 5;
  right: 5px;
  top: 5px;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(82,103,96,.25);
  border-radius: 50%;
  background: rgba(255,255,255,.82);
  color: #6f817a;
  cursor: pointer;
  font-size: 12px;
}
.zone-remove:hover { color: #a83f3b; background: #fff; }
.warehouse-board.phase-equipment .zone-remove { display: none; }
.warehouse-board.phase-equipment .zone { border-width: 2px; border-color: rgba(48,78,69,.28); }
.warehouse-board.phase-equipment .zone::after { opacity: .5; }

.communication-route {
  --route-color: #50776c;
  position: absolute;
  height: clamp(20px, 3.1vw, 38px);
  transform-origin: left center;
  border: 1px solid rgba(52,83,74,.27);
  border-radius: 8px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,.25) 0 10px, transparent 10px 19px),
    rgba(191,204,199,.77);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.26);
  opacity: .88;
}
.communication-route::before { content: "→  →  →  →  →  →"; position: absolute; inset: 0; display: grid; place-items: center; overflow: hidden; color: rgba(42,79,68,.48); font-size: 8px; letter-spacing: .9em; white-space: nowrap; }
.communication-route.service-route { height: clamp(14px, 2vw, 25px); border-style: dashed; opacity: .58; background: rgba(210,219,215,.7); }
.communication-route.service-route::before { content: "·  ·  ·  ·  ·  ·"; color: rgba(42,79,68,.38); }
.communication-route.service-route .route-label { padding: 2px 4px; font-size: 5px; }
.communication-route.service-route.layout-warning { border-color: #d4822a; opacity: .82; background: rgba(245,213,169,.78); box-shadow: inset 0 0 0 2px rgba(212,130,42,.22); }
.communication-route.service-route.layout-warning::before { color: rgba(159,91,22,.62); }
.communication-route.service-route.layout-warning .route-label { border-color: rgba(190,111,31,.42); background: #fff4e4; color: #a05d18; }
.communication-route.route-highlight { border-color: #1b9a65; box-shadow: inset 0 0 0 3px rgba(27,154,101,.35), 0 0 0 2px rgba(255,255,255,.8); }
.communication-route.route-warning { border-color: #e29238; box-shadow: inset 0 0 0 3px rgba(226,146,56,.35), 0 0 0 2px rgba(255,255,255,.8); }
.route-label {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  padding: 3px 6px;
  border: 1px solid rgba(65,89,82,.22);
  border-radius: 4px;
  background: rgba(248,250,249,.91);
  color: #526b63;
  font-size: 6px;
  font-weight: 900;
  letter-spacing: .08em;
  white-space: nowrap;
  text-transform: uppercase;
}

.phase-back-btn {
  min-height: 45px;
  padding: 0 13px;
  border: 1px solid #cad7d2;
  border-radius: 9px;
  background: #fff;
  color: #5f746d;
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
  cursor: pointer;
}
.phase-back-btn:hover { background: #f0f6f3; color: var(--green-dark); }

.zone-score-note { display: flex; align-items: center; gap: 7px; margin-top: 7px; color: #687b74; font-size: 9px; }
.zone-score-note b { color: var(--green); }

.placed-element.on-route { border-color: #58796e; background: rgba(244,248,246,.94); }
.placed-element.on-route::before { content: "VÍA"; position: absolute; left: 50%; top: -8px; transform: translateX(-50%) rotate(calc(-1 * var(--rotation))); padding: 1px 4px; border-radius: 3px; background: #526f66; color: #fff; font-size: 5px; font-weight: 900; letter-spacing: .08em; }

@media (max-width: 1180px) {
  .zone-palette-item { min-height: 61px; grid-template-columns: 42px 1fr 20px; }
  .zone-palette-item .zone-swatch { width: 41px; height: 35px; }
}
