    :root {
      --bg: #f4f7fb;
      --card: #ffffff;
      --line: #d7deea;
      --text: #1f2937;
      --muted: #6b7280;
      --accent: #2563eb;
      --accent-soft: #e0ecff;
      --danger: #dc2626;
      --danger-soft: #fee2e2;
      --success: #16a34a;
      --success-soft: #dcfce7;
      --warning: #c2410c;
      --warning-soft: #fff7ed;
      --selected-outline: #facc15;
      --selected-bg: transparent;
      --selected-pattern-a: rgba(255, 216, 77, 0.42);
      --selected-pattern-b: rgba(0, 28, 61, 0.20);
      --shadow: 0 10px 30px rgba(0,0,0,0.08);
      --item-text: #0f172a;
      --item-divider: rgba(15,23,42,0.18);
      --item-badge-bg: rgba(255,255,255,0.95);
      --item-badge-border: #d7deea;
      --item-badge-text: #0f172a;
      --color-preview-text: #111827;
    }

    * { box-sizing: border-box; }
    body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); }
    .app { display: grid; grid-template-columns: minmax(312px,328px) minmax(0,1fr); gap: 16px; min-height: 100vh; padding: 16px; align-items:start; max-width: 1960px; margin: 0 auto; }
    .top-project-bar { grid-column: 1 / -1; background: var(--card); border: 1px solid #eef2f7; border-radius: 16px; box-shadow: var(--shadow); padding: 14px 18px; }
    .project-top-row { display:flex; gap:16px; align-items:end; justify-content:space-between; flex-wrap:wrap; }
    .project-title-field { max-width:520px; flex:1 1 320px; }
    .project-actions { display:flex; gap:8px; align-items:end; justify-content:flex-end; flex-wrap:wrap; }
    .project-actions button { height:40px; white-space:nowrap; }
    .panel, .main-card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); border: 1px solid #eef2f7; }
    .panel { padding: 14px; display: flex; flex-direction: column; gap: 12px; position:sticky; top:18px; max-height:calc(100vh - 36px); overflow:auto; min-width:0; }
    .main-card { padding: 18px; overflow: auto; min-width:0; }
    h1 { font-size: 20px; margin: 0 0 4px 0; letter-spacing: -0.02em; }
    h2 { font-size: 13px; margin: 0 0 8px 0; letter-spacing: 0.01em; }
    .muted { color: var(--muted); font-size: 12px; line-height: 1.35; }
    .section { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #fbfdff; }
    .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: start; }
    label { font-size: 11px; color: var(--muted); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
    input, select, button, textarea { font: inherit; }
    input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: white; }
    textarea { resize: vertical; min-height: 48px; }
    button { border: none; border-radius: 10px; padding: 9px 12px; cursor: pointer; font-weight: 600; transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease; }
    button:hover { transform: translateY(-1px); }
    .primary { background: var(--accent); color: white; }
    .soft { background: #f6f9fc; color: #183b67; border: 1px solid rgba(0,28,61,0.10); box-shadow: none; }
    .danger { background: var(--danger-soft); color: var(--danger); }
    .success { background: var(--success-soft); color: var(--success); }
    .warning { background: var(--warning-soft); color: var(--warning); }
    .btn-row { display: grid; gap: 8px; }
    .btn-row.two-col { grid-template-columns: 1fr 1fr; }
    .toolbar-top { display: flex; justify-content: flex-end; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }

    .canvas-wrap { background: linear-gradient(180deg, #fcfdff 0%, #f5f9ff 100%); border: 1px solid var(--line); border-radius: 16px; padding: 16px; overflow-x: hidden; overflow-y: auto; }
    .cargo-sheet { margin-bottom: 16px; width: 100%; max-width: 100%; overflow: hidden; }
    .cargo-sheet-title { font-size: 13px; font-weight: 700; margin-bottom: 8px; color: #334155; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
    .cargo-remove-btn { padding: 6px 10px; font-size: 12px; border-radius: 8px; background: var(--danger-soft); color: var(--danger); }
    .cargo-add-btn { padding: 6px 10px; font-size: 12px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); }
    .cargo-area-shell { width: 100%; max-width: 100%; position: relative; overflow: hidden; }
    .cargo-area { display:block; position: relative; width: 1360px; height: 240px; border: 3px solid #334155; border-radius: 8px; background-color: white; background-image: linear-gradient(to right, rgba(37,99,235,0.10) 1px, transparent 1px), linear-gradient(to bottom, rgba(37,99,235,0.10) 1px, transparent 1px); background-size: 20px 20px; overflow: hidden; transform-origin: top left; }
    .compound-markers { position:absolute; inset:0; pointer-events:none; z-index:5; }
    .compound-divider-band { position:absolute; top:0; bottom:0; width:18px; transform:translateX(-50%); background:rgba(148,163,184,0.14); border-left:2px solid rgba(71,85,105,0.45); border-right:2px solid rgba(71,85,105,0.45); }
    .compound-divider-label { position:absolute; top:50%; transform:translate(-50%,-50%) rotate(-90deg); transform-origin:center; font-size:11px; font-weight:700; color:#475569; background:rgba(255,255,255,0.92); border:1px solid rgba(148,163,184,0.45); padding:3px 8px; border-radius:999px; white-space:nowrap; }
    .compound-segment-label { position:absolute; top:10px; transform:translateX(-50%); font-size:11px; font-weight:700; color:#334155; background:rgba(255,255,255,0.86); border:1px solid rgba(148,163,184,0.35); padding:2px 8px; border-radius:999px; white-space:nowrap; }
    .hidden { display:none !important; }
    .flash-focus { animation: flashFocus 2.4s ease-out; }
    .flash-item-focus { animation: flashItemFocus 2.2s ease-out; }
    @keyframes flashFocus { 0% { box-shadow: 0 0 0 0 rgba(250,204,21,0.0); } 35% { box-shadow: 0 0 0 8px rgba(250,204,21,0.32); } 100% { box-shadow: 0 0 0 0 rgba(250,204,21,0.0); } }
    @keyframes flashItemFocus { 0% { box-shadow: 0 0 0 0 rgba(250,204,21,0.0), inset 0 0 0 0 rgba(250,204,21,0.0); } 35% { box-shadow: 0 0 0 6px rgba(250,204,21,0.22), inset 0 0 0 2px rgba(250,204,21,0.45); } 100% { box-shadow: 0 0 0 0 rgba(250,204,21,0.0), inset 0 0 0 0 rgba(250,204,21,0.0); } }
    .sidebar-focus { animation: sidebarFocus 1.25s ease-out; }
    @keyframes sidebarFocus {
      0% { box-shadow: 0 0 0 0 rgba(250,204,21,0); border-color: var(--line); background: var(--card); }
      35% { box-shadow: 0 0 0 8px rgba(250,204,21,0.18); border-color: rgba(250,204,21,0.55); background: rgba(255, 247, 200, 0.35); }
      100% { box-shadow: 0 0 0 0 rgba(250,204,21,0); border-color: var(--line); background: var(--card); }
    }
    .axle-marker { position: absolute; bottom: 0; width: 2px; height: 42px; background: rgba(15,23,42,0.22); z-index: 6; pointer-events: none; }
    .cargo-label, .cargo-dim-top, .cargo-dim-side, .meter-label { position: absolute; font-size: 12px; background: rgba(255,255,255,0.95); padding: 3px 6px; border-radius: 6px; pointer-events: none; }
    .cargo-label { top: 8px; left: 10px; z-index: 10; }
    .cargo-dim-top { top: 8px; left: 50%; transform: translateX(-50%); z-index: 10; }
    .cargo-dim-side { top: 50%; right: 8px; transform: translateY(-50%) rotate(-90deg); z-index: 10; }
    .meter-line { position: absolute; top: 0; width: 0; height: 240px; border-left: 1px dashed rgba(15,23,42,0.12); pointer-events: none; z-index: 1; }
    .meter-label { top: 24px; transform: translateX(-50%); font-size: 10px; color: rgba(51,65,85,0.45); background: rgba(255,255,255,0.55); z-index: 1; opacity: 0.75; }
    .length-end-line { position: absolute; top: 0; bottom: 0; width: 3px; background: rgba(220,38,38,0.9); pointer-events: none; z-index: 15; }
    .length-end-label { position: absolute; top: 44px; transform: translateX(-50%); font-size: 11px; background: rgba(255,255,255,0.98); border: 1px solid #fecaca; color: #991b1b; padding: 2px 6px; border-radius: 6px; z-index: 50; pointer-events: none; }
    .zone { position: absolute; top: 0; bottom: 0; pointer-events: none; z-index: 3; }
    .ralla-zone { left: 67px; width: 200px; background: rgba(59, 130, 246, 0.08); border-left: 2px dashed rgba(59, 130, 246, 0.4); border-right: 2px dashed rgba(59, 130, 246, 0.4); }
    .tridem-zone { left: 799px; width: 262px; background: rgba(239, 68, 68, 0.14); border-left: 2px dashed rgba(239, 68, 68, 0.55); border-right: 2px dashed rgba(239, 68, 68, 0.55); }
    .item { z-index: 10; position: absolute; border: 2px solid #1d4ed8; background: rgba(37,99,235,0.20); border-radius: 8px; cursor: grab; user-select: none; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 11px; font-weight: 700; color: var(--item-text); padding: 4px; overflow: hidden; line-height: 1.2; white-space: normal; }
    .item.selected {
      border-color: var(--selected-outline) !important;
      outline: 3px solid var(--selected-outline);
      outline-offset: 2px;
      z-index: 20;
      animation: none;
      box-shadow:
        0 0 0 2px rgba(0, 28, 61, 0.36),
        0 10px 24px rgba(0, 28, 61, 0.22),
        inset 0 0 0 2px rgba(255, 255, 255, 0.62);
    }
    .item.selected::before {
      content: "";
      position: absolute;
      inset: 0;
      z-index: 1;
      pointer-events: none;
      border-radius: 6px;
      background:
        repeating-linear-gradient(
          -45deg,
          var(--selected-pattern-a) 0,
          var(--selected-pattern-a) 7px,
          transparent 7px,
          transparent 14px
        ),
        linear-gradient(135deg, transparent 0%, var(--selected-pattern-b) 100%);
      mix-blend-mode: multiply;
    }
    .item.selected > * {
      position: relative;
      z-index: 2;
    }
    .stack-split { display:flex; width:100%; height:100%; }
    .stack-split > div { flex:1; display:flex; align-items:center; justify-content:center; text-align:center; padding:4px; border-right:2px solid var(--item-divider); }
    .stack-split > div:last-child { border-right:none; }
    .stack-badge { position: absolute; left: 4px; top: 4px; font-size: 10px; line-height: 1; background: var(--item-badge-bg); border: 1px solid var(--item-badge-border); color: var(--item-badge-text); border-radius: 999px; padding: 2px 5px; pointer-events: none; }
    @keyframes selectedInnerPulse { 0% { box-shadow: inset 0 0 0 0 rgba(239,68,68,0.05); } 50% { box-shadow: inset 0 0 22px 10px rgba(239,68,68,0.24); } 100% { box-shadow: inset 0 0 0 0 rgba(239,68,68,0.05); } }
    .item.dragging { cursor: grabbing; z-index: 30; }
    .item.stack-target-pending { box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.28), inset 0 0 0 2px rgba(245, 158, 11, 0.55); }
    .item.stack-target-pending::after,
    .item.stack-target-ready::after {
      position: absolute;
      left: 50%;
      bottom: calc(100% + 10px);
      transform: translateX(-50%);
      padding: 6px 10px;
      border-radius: 999px;
      font-size: 11px;
      font-weight: 700;
      line-height: 1;
      white-space: nowrap;
      pointer-events: none;
      z-index: 60;
      box-shadow: 0 10px 24px rgba(15,23,42,0.18);
    }
    .item.stack-target-pending::after {
      content: 'Attendi 0,5s per sovrapporre';
      background: rgba(255,247,237,0.98);
      color: #c2410c;
      border: 1px solid rgba(245,158,11,0.35);
    }
    .item.stack-target-ready { box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.20), inset 0 0 0 2px rgba(37, 99, 235, 0.55); }
    .item.stack-target-ready::after {
      content: 'Rilascia per Sovrapporre';
      background: rgba(239,246,255,0.98);
      color: #1d4ed8;
      border: 1px solid rgba(37,99,235,0.28);
    }
    .item.locked { cursor: not-allowed; box-shadow: inset 0 0 0 2px rgba(15,23,42,0.18); }
    .lock-badge { position: absolute; top: 4px; right: 4px; font-size: 12px; line-height: 1; background: var(--item-badge-bg); border: 1px solid var(--item-badge-border); color: var(--item-badge-text); border-radius: 999px; padding: 2px 4px; pointer-events: none; }
    .legend-grid { display:flex; flex-direction:column; gap:8px; }
    .legend-card { border:1px solid var(--line); border-radius:12px; background:rgba(255,255,255,0.96); padding:9px 10px; display:grid; grid-template-columns: minmax(0,1.7fr) minmax(250px,1fr); gap:10px; align-items:start; min-width:0; }
    .legend-card-head { display:flex; gap:10px; align-items:center; justify-content:space-between; min-width:0; }
    .legend-card-title { display:flex; gap:8px; align-items:center; min-width:0; font-weight:700; }
    .legend-card-title-text { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
    .legend-card-swatch { width:12px; height:12px; border-radius:4px; flex:0 0 12px; }
    .legend-card-qty { font-size:11px; color:var(--muted); white-space:nowrap; }
    .legend-card-meta { display:flex; flex-direction:column; gap:3px; font-size:11px; margin-top:6px; color:var(--muted); line-height:1.35; }
    .legend-card-meta-line { color:var(--muted); }
    .legend-card-meta-line strong { color:var(--text); font-weight:700; }
    .legend-card-side { display:flex; flex-direction:column; gap:7px; align-items:stretch; }
    .legend-note-input { min-height: 32px; max-height: 32px; padding:6px 8px; font-size:11px; }
    .group-actions { display:flex; flex-wrap:wrap; gap:4px; justify-content:flex-start; align-items:center; }
    .group-actions button, .group-actions select { min-height: 32px; padding:4px 8px; font-size:11px; border-radius:8px; border:1px solid rgba(0,28,61,0.10); background:#f8fafc; color:#334155; width:auto; min-width:0; box-shadow:none; }
    .group-actions button:hover { background:#eef4fa; transform:none; }
    .group-actions .danger-mini { border-color:#fecaca; background:#fff5f5; color:#b91c1c; }
    .tiny { font-size: 11px; color: var(--muted); }
    .context-menu { position: fixed !important; background: white; border: 1px solid #d7deea; border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,0.12); z-index: 9999; min-width: min(620px, calc(100vw - 24px)); width: min(700px, calc(100vw - 24px)); max-width: calc(100vw - 24px); max-height: calc(100vh - 24px); font-size: 12px; overflow: hidden; display: none; top: 0; left: 0; flex-direction: column; }
    .context-menu .menu-header { padding: 9px 12px; border-bottom: 1px solid #eef2f7; background:#fffbea; font-weight:700; color:#92400e; border-radius: 12px 12px 0 0; }
    .context-menu .menu-info-strip { display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap:8px; padding:10px 12px; border-bottom:1px solid #eef2f7; background:#fcfdff; }
    .context-menu .menu-info-chip { min-width:0; border:1px solid #eef2f7; border-radius:10px; padding:7px 8px; background:#fff; }
    .context-menu .menu-info-label { display:block; font-size:10px; text-transform:uppercase; letter-spacing:0.03em; color:#6b7280; margin-bottom:3px; }
    .context-menu .menu-info-value { display:block; font-size:12px; font-weight:700; color:#111827; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .context-menu .menu-body { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(0,0.9fr) minmax(0,0.9fr); gap: 0; align-items: stretch; max-height: calc(100vh - 140px); overflow: auto; }
    .context-menu .menu-col { padding: 10px 11px; min-width:0; }
    .context-menu .menu-col + .menu-col { border-left: 1px solid #eef2f7; }
    .context-menu .menu-actions-grid { display: grid; grid-template-columns: 1fr; gap: 6px; }
    .context-menu button { width: 100%; text-align: left; background: #f8fafc; border: 1px solid rgba(0,28,61,0.10); border-radius: 9px; padding: 8px 10px; color: #1f2937; font-size: 11px; line-height: 1.2; box-shadow:none; }
    .context-menu button:hover { transform: none; background: #eef4fa; }
    .context-menu .menu-move-btn { text-align:center; font-weight:800; min-height:40px; border-color: rgba(0,94,184,0.18); background: linear-gradient(135deg, rgba(0,28,61,0.96) 0%, rgba(0,94,184,0.96) 100%); color:#fff; box-shadow: 0 6px 18px rgba(0,94,184,0.16); }
    .context-menu .menu-move-btn:hover { background: linear-gradient(135deg, rgba(0,28,61,1) 0%, rgba(0,94,184,1) 100%); color:#fff; }
    .context-menu .menu-move-btn[data-ready="false"] { background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%); color:#64748b; border-color:#d7deea; box-shadow:none; }
    .menu-section-title { font-size: 10px; font-weight: 700; letter-spacing: 0.02em; margin-bottom: 8px; text-transform: uppercase; color:#6b7280; }
    .menu-edit-grid { display:grid; gap:7px; }
    .menu-field { font-size:11px; color:#6b7280; display:flex; flex-direction:column; gap:4px; }
    .menu-inline-field { margin-bottom: 2px; }
    .menu-field input, .menu-field select { border:1px solid #d7deea; border-radius:8px; padding:7px 9px; background:#fff; color:#111827; }
    .menu-primary-btn { font-weight:700; }
    .stack-hover-card { position:fixed; z-index:10020; width:300px; max-width:calc(100vw - 24px); display:none; border:1px solid var(--line); border-radius:14px; background:var(--card); box-shadow:0 18px 38px rgba(0,0,0,0.18); padding:12px; pointer-events:none; }
    .stack-hover-title { font-size:13px; font-weight:700; color:var(--text); }
    .stack-hover-sub { font-size:11px; color:var(--muted); margin-top:3px; }
    .stack-hover-rows { display:grid; gap:7px; margin-top:10px; }
    .stack-hover-row { display:grid; grid-template-columns:52px minmax(0,1fr); gap:9px; align-items:center; }
    .stack-hover-visual { position:relative; height:28px; border-radius:8px; }
    .stack-hover-visual::after { content:''; position:absolute; inset:5px 7px; border:1px dashed rgba(255,255,255,0.42); border-radius:5px; }
    .stack-hover-copy { min-width:0; }
    .stack-hover-level { font-size:10px; font-weight:700; text-transform:uppercase; letter-spacing:0.03em; color:var(--muted); }
    .stack-hover-name { font-size:12px; font-weight:700; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
    .stack-hover-meta { font-size:11px; color:var(--muted); line-height:1.25; }
    .area-quick-menu { position: fixed !important; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 34px rgba(0,0,0,0.16); z-index: 10000; min-width: min(290px, calc(100vw - 24px)); width: min(320px, calc(100vw - 24px)); max-width: calc(100vw - 24px); display: none; overflow: hidden; }
    .area-quick-header { padding: 12px 14px; background: #fffbea; border-bottom: 1px solid #eef2f7; }
    .area-quick-title { font-size: 13px; font-weight: 700; color: #92400e; }
    .area-quick-sub { font-size: 11px; color: var(--muted); margin-top: 3px; }
    .area-quick-body { padding: 12px; display: grid; gap: 8px; }
    .area-quick-btn { width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--card); color: var(--text); cursor: pointer; }
    .area-quick-btn:hover { transform: none; background: #f8fafc; }
    .area-quick-btn strong { display:block; font-size: 13px; margin-bottom: 2px; }
    .area-quick-btn small { display:block; color: var(--muted); font-size: 11px; }
    .length-bar-wrap { margin-top: 10px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; max-width: 1360px; }
    .length-bar { position: relative; width: 100%; height: 14px; background: #e5e7eb; border-radius: 999px; overflow: hidden; margin-top: 6px; }
    .length-bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #60a5fa 0%, #2563eb 100%); border-radius: 999px; width: 0%; }

    .vehicle-quick { display:flex; gap:10px; align-items:end; flex-wrap:wrap; margin-top:12px; }
    .vehicle-quick > button { height:36px; padding:8px 10px; font-size:13px; white-space:nowrap; align-self:end; }
    .vehicle-quick > button { height: 40px; align-self: end; white-space: nowrap; }
    .vehicle-quick .quick-field { min-width: min(180px, 100%); max-width: 100%; flex: 1 1 180px; }
    .vehicle-quick .quick-field.start-cue { position: relative; }
    .vehicle-quick .quick-field.start-cue::after {
      content: '';
      position: absolute;
      inset: -4px;
      border-radius: 14px;
      border: 1px solid rgba(234,179,8,0.42);
      box-shadow: 0 0 0 6px rgba(250,204,21,0.14);
      background: linear-gradient(180deg, rgba(254,249,195,0.30), rgba(254,240,138,0.12));
      pointer-events: none;
      animation: startCuePulse 2s ease-in-out infinite;
    }
    @keyframes startCuePulse {
      0%, 100% { opacity: .55; transform: scale(1); }
      50% { opacity: 1; transform: scale(1.01); }
    }

    .start-cue-select {
      border-color: rgba(234,179,8,0.68) !important;
      box-shadow: 0 0 0 4px rgba(250,204,21,0.16);
      background: linear-gradient(180deg, #fffef3 0%, #ffffff 100%) !important;
      animation: startCueSelectPulse 1.8s ease-in-out infinite;
    }
    @keyframes startCueSelectPulse {
      0%, 100% { box-shadow: 0 0 0 4px rgba(250,204,21,0.12); }
      50% { box-shadow: 0 0 0 7px rgba(250,204,21,0.24); }
    }
    
    .vehicle-badge { display:inline-flex; align-items:center; gap:6px; padding:5px 9px; border:1px solid var(--line); border-radius:999px; background:#f8fafc; font-size:11px; color:#334155; }
    .readonly-lite { background:#f8fafc; color:#64748b; }
    .area-meta-badge { display:inline-flex; align-items:center; gap:8px; padding:5px 9px; border:1px solid var(--line); border-radius:999px; background:#f8fafc; font-size:11px; color:#334155; }
    .area-meta-badge strong { color:#0f172a; }
    .area-meta-line { font-size:12px; color:#64748b; margin-top:4px; }
    .toolbar-switches { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
    .toolbar-toggle { display:inline-flex; align-items:center; gap:6px; padding:6px 9px; border:1px solid var(--line); border-radius:999px; background:#f8fafc; font-size:11px; color:#334155; }
    .toolbar-toggle input { width:auto; margin:0; }
    .template-status-row { display:flex; gap:8px; align-items:center; flex-wrap:wrap; margin-top:10px; }
    .template-status-row .vehicle-badge strong { color:#0f172a; }
    .cargo-sheet.active-sheet .cargo-area { box-shadow: 0 0 0 4px rgba(37,99,235,0.14); }
    .cargo-area.grid-hidden { background-image:none; }
    .area-status-wrap { margin-top:10px; display:grid; gap:8px; }
    .area-status-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:8px; }
    .area-status-card { border:1px solid var(--line); border-radius:14px; background:#fff; padding:10px 12px; min-height:86px; display:flex; flex-direction:column; justify-content:space-between; }
    .area-status-card .label { font-size:11px; color:var(--muted); margin-bottom:6px; text-transform:uppercase; letter-spacing:.04em; font-weight:700; }
    .area-status-card .value { font-size:18px; font-weight:800; color:#0f172a; line-height:1.1; }
    .area-status-card .value-sub { font-size:12px; color:#64748b; margin-top:5px; line-height:1.25; }
    .area-status-card.kpi-weight-used { background:linear-gradient(135deg, rgba(37,99,235,0.10) 0%, rgba(191,219,254,0.24) 100%); border-color:rgba(37,99,235,0.24); }
    .area-status-card.kpi-weight-remaining { background:linear-gradient(135deg, rgba(22,163,74,0.10) 0%, rgba(220,252,231,0.34) 100%); border-color:rgba(22,163,74,0.24); }
    .area-status-card.kpi-weight-remaining.danger { background:linear-gradient(135deg, rgba(220,38,38,0.10) 0%, rgba(254,226,226,0.34) 100%); border-color:rgba(220,38,38,0.24); }
    .area-status-card.kpi-weight-used .value { color:#1d4ed8; }
    .area-status-card.kpi-weight-remaining .value { color:#16a34a; }
    .area-status-card.kpi-weight-remaining.danger .value { color:#dc2626; }
    .flow-hint { display:flex; align-items:center; gap:8px; font-size:11px; color:#64748b; background:#f8fafc; border:1px solid var(--line); padding:7px 9px; border-radius:9px; margin-top:8px; }
    .preview-box { margin-top:10px; background:#f8fafc; border:1px solid var(--line); border-radius:12px; padding:10px 12px; }
    .preview-title { font-size:12px; font-weight:700; color:#334155; margin-bottom:6px; text-transform:uppercase; letter-spacing:.02em; }
    .preview-main { font-size:14px; font-weight:700; color:#0f172a; margin-bottom:6px; }
    .preview-sub { font-size:12px; color:#64748b; }
    .legend-toolbar { display:flex; gap:10px; align-items:end; flex-wrap:wrap; margin-bottom:12px; }
    .legend-toolbar label { min-width:180px; }
    .legend-totals { display:flex; gap:10px; flex-wrap:wrap; margin:10px 0 12px; }
    .legend-total-chip { display:inline-flex; align-items:center; gap:6px; background:#f8fafc; border:1px solid var(--line); border-radius:999px; padding:7px 12px; font-size:12px; color:#334155; }

    .top-project-bar { background: linear-gradient(135deg, #ffffff 0%, #f6f9ff 100%); }
    .primary:disabled { opacity:.5; cursor:not-allowed; transform:none; }
    .swatch-palette { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-top:6px; }
    .swatch-grid { display:flex; gap:6px; flex-wrap:wrap; align-items:center; }
    .swatch-btn { width:24px; height:24px; border-radius:999px; border:2px solid transparent; cursor:pointer; padding:0; box-shadow: inset 0 0 0 1px rgba(15,23,42,.08); transition:transform .12s ease, border-color .12s ease, box-shadow .12s ease; }
    .swatch-btn:hover { transform: translateY(-1px) scale(1.04); }
    .swatch-btn.active { border-color:#0f172a; box-shadow: 0 0 0 3px rgba(37,99,235,.14); }
    .palette-other-row { display:flex; align-items:center; gap:6px; margin-left:2px; }
    .palette-other-row input[type="color"] { width:24px; height:24px; padding:0; border-radius:999px; border:1px solid var(--line); background:#fff; overflow:hidden; }
    .palette-other-row .other-color-trigger {
      width:24px; height:24px; border-radius:999px; border:1px dashed rgba(15,23,42,.25);
      display:inline-flex; align-items:center; justify-content:center; font-size:14px; color:#475569; background:#fff;
      pointer-events:none;
    }
    @media (max-width: 1024px) {
      .app { grid-template-columns: 1fr; }
      .panel { position:static; max-height:none; }
    }

    @media (max-width: 980px) {
      .app { grid-template-columns: 1fr; }
      .cargo-sheet-title { flex-direction: column; align-items: stretch; }
      .context-menu { min-width: 340px; max-width: calc(100vw - 24px); }
      .context-menu .menu-info-strip { grid-template-columns: 1fr 1fr; }
      .context-menu .menu-body { grid-template-columns: 1fr; }
      .context-menu .menu-col + .menu-col { border-left:none; border-top:1px solid #eef2f7; }
      .area-quick-menu { min-width: 250px; max-width: calc(100vw - 24px); }
    }

    /* Operational UI cleanup */
    .top-project-bar {
      border-radius: 18px;
      padding: 12px 16px;
      box-shadow: 0 10px 28px rgba(15,23,42,0.07);
    }
    .project-top-row {
      gap: 12px;
      align-items: center;
    }
    .project-title-field {
      max-width: 460px;
      flex: 1 1 280px;
    }
    .project-title-field input {
      min-height: 38px;
      padding: 8px 10px;
      font-size: 13px;
    }
    .project-actions {
      gap: 6px;
      align-items: center;
    }
    .project-actions button,
    .toolbar-top button,
    .btn-row button,
    .vehicle-quick > button {
      min-height: 34px;
      height: 34px;
      padding: 0 11px;
      border-radius: 9px;
      font-size: 12px;
      font-weight: 700;
      line-height: 1;
    }
    .panel {
      padding: 12px;
      gap: 10px;
    }
    .main-card {
      padding: 16px 18px;
    }
    .section {
      border-radius: 14px;
      padding: 9px 10px;
      box-shadow: none;
    }
    .soft {
      background: #f7fafc;
      color: #173458;
      border: 1px solid rgba(0,28,61,0.09);
    }
    .soft:hover {
      background: #eff5fa;
      transform: none;
    }
    .primary {
      box-shadow: 0 6px 16px rgba(0,94,184,0.14);
    }
    .primary:hover,
    .success:hover,
    .danger:hover,
    .warning:hover {
      transform: translateY(-1px);
    }
    .danger {
      background: #fff2f2;
      color: #b91c1c;
      border: 1px solid rgba(185,28,28,0.12);
    }
    button:focus-visible,
    input:focus-visible,
    select:focus-visible,
    textarea:focus-visible {
      outline: 2px solid rgba(0,94,184,0.26);
      outline-offset: 1px;
    }
    button:disabled,
    button[disabled] {
      opacity: .48;
      cursor: not-allowed;
      transform: none;
      box-shadow: none;
    }
    .item.selected {
      outline-width: 2px;
      background: rgba(250, 204, 21, 0.28) !important;
      animation: none;
      box-shadow: 0 0 0 2px rgba(250,204,21,0.28);
    }
    .cargo-sheet {
      margin-bottom: 14px;
    }
    .cargo-sheet-title {
      margin-bottom: 10px;
      gap: 8px;
    }
  

    /* Premium layout refresh */
    body {
      background:
        radial-gradient(circle at top left, rgba(37,99,235,0.10), transparent 28%),
        radial-gradient(circle at top right, rgba(124,58,237,0.08), transparent 22%),
        linear-gradient(180deg, #eef4ff 0%, #f6f9ff 42%, #eef3fb 100%);
    }
    .top-project-bar {
      background: linear-gradient(135deg, rgba(255,255,255,0.96) 0%, rgba(242,248,255,0.96) 100%);
      border: 1px solid rgba(148,163,184,0.22);
      box-shadow: 0 22px 52px rgba(15,23,42,0.10);
      border-radius: 22px;
      padding: 18px 22px;
    }
    .panel, .main-card {
      border: 1px solid rgba(148,163,184,0.18);
      box-shadow: 0 18px 45px rgba(15,23,42,0.08);
      border-radius: 24px;
      background: rgba(255,255,255,0.94);
      backdrop-filter: blur(10px);
    }
    .panel {
      padding: 16px;
      gap: 14px;
    }
    .main-card { padding: 24px; }
    .section {
      border-radius: 18px;
      background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
      border: 1px solid rgba(148,163,184,0.16);
      padding: 12px;
    }
    .control-premium {
      background: linear-gradient(135deg, rgba(20,184,166,0.10) 0%, rgba(37,99,235,0.08) 100%);
      border-color: rgba(37,99,235,0.18);
    }
    .control-premium-head {
      display:flex; justify-content:space-between; gap:12px; align-items:flex-start;
    }
    .premium-pill {
      display:inline-flex; align-items:center; padding:6px 10px; border-radius:999px;
      background: rgba(15,23,42,0.92); color:#fff; font-size:11px; font-weight:700; letter-spacing:.06em; text-transform:uppercase;
      white-space:nowrap;
    }
    .target-chip {
      margin-top:10px; display:flex; align-items:center; gap:8px; flex-wrap:wrap;
      padding:10px 12px; border-radius:14px; background: rgba(255,255,255,0.82);
      border:1px solid rgba(37,99,235,0.14); color:#0f172a; font-size:13px;
    }
    .target-chip strong { color: var(--accent); }
    .canvas-wrap {
      background: linear-gradient(180deg, #ffffff 0%, #f4f8ff 100%);
      border-radius: 22px;
      border: 1px solid rgba(148,163,184,0.16);
      padding: 18px;
    }
    .stats {
      display:grid;
      grid-template-columns: repeat(4, minmax(150px, 1fr));
      gap:12px;
      width:min(100%, 1040px);
    }
    .stat {
      min-width:0;
      padding:14px 16px;
      border-radius:18px;
      background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(240,246,255,0.96) 100%);
      border:1px solid rgba(96,165,250,0.18);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.7), 0 8px 24px rgba(37,99,235,0.08);
      display:flex;
      flex-direction:column;
      gap:6px;
    }
    .toolbar-top button, .vehicle-quick > button, .btn-row button {
      border-radius: 12px;
      box-shadow: 0 8px 18px rgba(15,23,42,0.06);
    }
    .vehicle-quick { gap:12px; }
    .vehicle-badge {
      background: rgba(255,255,255,0.88);
      border-color: rgba(148,163,184,0.20);
    }
    .cargo-sheet {
      background: linear-gradient(180deg, rgba(255,255,255,0.96) 0%, rgba(248,251,255,0.96) 100%);
      border:1px solid rgba(148,163,184,0.14);
      border-radius:20px;
      padding:14px;
      box-shadow: 0 12px 28px rgba(15,23,42,0.06);
    }
    .cargo-sheet-title { margin-bottom: 12px; }
    .area-meta-badge, .length-bar-wrap {
      background: rgba(248,250,252,0.92);
      border-color: rgba(148,163,184,0.18);
      border-radius: 14px;
    }
    .length-bar { height: 16px; background: #dbe6f4; }
    .length-bar-fill {
      background: linear-gradient(90deg, #38bdf8 0%, #2563eb 46%, #1d4ed8 100%);
    }
    .preview-box {
      margin-top:10px; padding:10px 12px; border-radius:14px; background: rgba(15,23,42,0.03); border:1px solid rgba(148,163,184,0.18);
      font-size:12px; color:#334155;
    }
    .display-toggles-wrap { margin-top:8px; }
    .display-toggles-label { font-size:12px; color:var(--muted); margin-bottom:6px; font-weight:700; }
    .display-toggles {
      display:flex;
      flex-wrap:wrap;
      gap:8px;
      margin-top:0;
    }
    .display-toggle {
      display:inline-flex;
      align-items:center;
      gap:6px;
      padding:6px 8px;
      border:1px solid var(--line);
      border-radius:10px;
      background:#fff;
      font-size:12px;
      color:var(--text);
      white-space:nowrap;
    }
    .display-toggle input {
      width:auto;
      margin:0;
      accent-color: var(--accent);
    }
    .flow-hint {
      margin-top:8px; padding:8px 10px; border-radius:12px; background: rgba(37,99,235,0.06); color:#1d4ed8; font-size:12px; font-weight:600;
    }
    .color-select-native {
      position:absolute !important;
      width:1px !important;
      height:1px !important;
      padding:0 !important;
      margin:-1px !important;
      overflow:hidden !important;
      clip:rect(0,0,0,0) !important;
      white-space:nowrap !important;
      border:0 !important;
      opacity:0 !important;
      pointer-events:none !important;
    }
    .swatch-palette {
      margin-top:6px;
      padding:8px 10px;
      border-radius:14px;
      background: rgba(248,250,252,0.92);
      border:1px solid rgba(148,163,184,0.18);
      display:flex;
      align-items:center;
      gap:10px;
      flex-wrap:wrap;
    }
    .swatch-grid {
      display:flex;
      flex-wrap:wrap;
      gap:6px;
      align-items:center;
      flex:1 1 120px;
      min-width:0;
    }
    .swatch-btn {
      width:22px;
      height:22px;
      border-radius:8px;
      border:2px solid transparent;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.4);
      flex: 0 0 auto;
    }
    .swatch-btn.active { transform: scale(1.02); box-shadow: 0 0 0 2px rgba(37,99,235,0.16); }
    .swatch-preview-row {
      display:flex;
      align-items:center;
      gap:6px;
      margin-bottom:0;
      font-size:11px;
      color:#475569;
      white-space:nowrap;
      flex:0 0 auto;
      min-width:0;
    }
    .swatch-preview-label {
      max-width:86px;
      white-space:nowrap;
      overflow:hidden;
      text-overflow:ellipsis;
      font-weight:600;
    }
    .swatch-preview-dot {
      width:14px;
      height:14px;
      border-radius:999px;
      border:2px solid rgba(15,23,42,0.15);
      background:#2563eb;
      flex: 0 0 auto;
    }
    .palette-other-row {
      margin-top:0;
      display:flex;
      align-items:center;
      justify-content:flex-end;
      gap:8px;
      font-size:11px;
      color:#64748b;
      white-space:nowrap;
      flex:0 0 auto;
    }
    .palette-other-row input[type="color"] { width:24px; height:24px; padding:0; border-radius:999px; }
    #legendSection {
      border-radius: 20px;
      background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
      padding: 14px;
    }
    .legend-toolbar {
      display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:10px; margin-bottom:10px;
    }
    .legend-totals {
      display:flex; flex-wrap:wrap; gap:10px; margin-bottom:10px;
    }
    .legend-totals > span,
    .legend-total-chip {
      padding:7px 10px; border-radius:999px; background:#eef4ff; border:1px solid rgba(96,165,250,0.18); font-size:12px; color:#334155;
    }
    #legendWrap {
      border:1px solid rgba(148,163,184,0.18);
      border-radius:16px;
      background:#fff;
      max-height: 430px;
      overflow:auto;
    }
    .legend-table {
      width:100%;
      table-layout:fixed;
      font-size:12px;
      min-width:0;
    }
    .legend-table th,
    .legend-table td {
      padding: 7px 8px;
      border-color: rgba(148,163,184,0.16);
      word-break: break-word;
    }
    .legend-table th {
      position: sticky;
      top: 0;
      z-index: 2;
      background: #f6f9fe;
      box-shadow: inset 0 -1px 0 rgba(148,163,184,0.16);
    }
    .legend-table tbody tr:nth-child(even) { background: rgba(248,250,252,0.75); }
    .legend-note-input {
      min-height: 34px;
      max-height: 72px;
      padding: 6px 8px;
      font-size: 12px;
      border-radius: 10px;
    }
    .group-actions button {
      padding: 5px 9px;
      font-size: 11px;
      border-radius: 9px;
    }
    @media (max-width: 1024px) {
      .app { grid-template-columns: 1fr; }
      .panel { position: static; max-height:none; }
      .stats { grid-template-columns: repeat(2, minmax(0,1fr)); width:100%; }
      .project-actions { width:100%; justify-content:flex-start; }
    }
    @media (max-width: 760px) {
      .stats { grid-template-columns: 1fr; }
      .legend-toolbar { grid-template-columns: 1fr; }
      .legend-card { grid-template-columns: 1fr; }
      .legend-card-side { grid-template-columns: 1fr; }
      .group-actions { justify-content:flex-start; }
    }


    html[data-theme="light"] { color-scheme: light; }
    html[data-theme="dark"] {
      color-scheme: dark;
      --bg: #0b1220;
      --card: rgba(15, 23, 42, 0.94);
      --line: rgba(148, 163, 184, 0.22);
      --text: #e5eefb;
      --muted: #9fb0c9;
      --accent: #7db3ff;
      --accent-soft: rgba(59, 130, 246, 0.18);
      --danger: #f87171;
      --danger-soft: rgba(239, 68, 68, 0.18);
      --success: #4ade80;
      --success-soft: rgba(34, 197, 94, 0.16);
      --warning: #fb923c;
      --warning-soft: rgba(251, 146, 60, 0.15);
      --selected-outline: #fde047;
      --selected-bg: rgba(250, 204, 21, 0.24);
      --shadow: 0 18px 40px rgba(0,0,0,0.34);
      --item-text: #f8fbff;
      --item-divider: rgba(226,232,240,0.24);
      --item-badge-bg: rgba(8,15,28,0.92);
      --item-badge-border: rgba(148,163,184,0.26);
      --item-badge-text: #f8fbff;
      --color-preview-text: #f8fbff;
    }
    html[data-theme="dark"] body {
      background:
        radial-gradient(circle at top left, rgba(59,130,246,0.16), transparent 32%),
        radial-gradient(circle at top right, rgba(168,85,247,0.12), transparent 26%),
        linear-gradient(180deg, #07111f 0%, #0a1424 45%, #0b1322 100%);
      color: var(--text);
    }
    html[data-theme="dark"] .top-project-bar {
      background: linear-gradient(135deg, rgba(15,23,42,0.98) 0%, rgba(13,27,49,0.98) 100%);
      border-color: rgba(148,163,184,0.16);
      box-shadow: 0 22px 52px rgba(0,0,0,0.30);
    }
    html[data-theme="dark"] .panel,
    html[data-theme="dark"] .main-card,
    html[data-theme="dark"] .cargo-sheet,
    html[data-theme="dark"] #legendSection,
    html[data-theme="dark"] .context-menu {
      background: rgba(15,23,42,0.96);
      border-color: rgba(148,163,184,0.16);
      box-shadow: 0 18px 45px rgba(0,0,0,0.28);
    }
    html[data-theme="dark"] .section,
    html[data-theme="dark"] .stat,
    html[data-theme="dark"] .area-status-card,
    html[data-theme="dark"] .length-bar-wrap,
    html[data-theme="dark"] .vehicle-badge,
    html[data-theme="dark"] .area-meta-badge,
    html[data-theme="dark"] .target-chip,
    html[data-theme="dark"] .legend-total-chip,
    html[data-theme="dark"] .legend-totals > span,
    html[data-theme="dark"] .swatch-palette {
      background: rgba(15,23,42,0.72);
      border-color: rgba(148,163,184,0.16);
      color: var(--text);
    }
    html[data-theme="dark"] .canvas-wrap {
      background: linear-gradient(180deg, rgba(10,20,36,0.96) 0%, rgba(12,24,44,0.96) 100%);
      border-color: rgba(148,163,184,0.16);
    }
    html[data-theme="dark"] input,
    html[data-theme="dark"] select,
    html[data-theme="dark"] textarea {
      background: rgba(10,18,33,0.96);
      color: var(--text);
      border-color: rgba(148,163,184,0.22);
    }
    html[data-theme="dark"] input::placeholder,
    html[data-theme="dark"] textarea::placeholder { color: #7f93b0; }
    html[data-theme="dark"] .cargo-area {
      border-color: #93a4bd;
      background-color: #0c1729;
      background-image: linear-gradient(to right, rgba(125,179,255,0.12) 1px, transparent 1px), linear-gradient(to bottom, rgba(125,179,255,0.12) 1px, transparent 1px);
    }
    html[data-theme="dark"] .cargo-label,
    html[data-theme="dark"] .cargo-dim-top,
    html[data-theme="dark"] .cargo-dim-side,
    html[data-theme="dark"] .meter-label,
    html[data-theme="dark"] .length-end-label {
      background: rgba(15,23,42,0.92);
      color: #dbe7f7;
      border-color: rgba(148,163,184,0.18);
    }
    html[data-theme="dark"] select,
    html[data-theme="dark"] select option,
    html[data-theme="dark"] select optgroup {
      background: #0f172a;
      color: #f8fbff;
    }
    html[data-theme="dark"] #vehicleTypeSelect,
    html[data-theme="dark"] #vehicleModelSelect,
    html[data-theme="dark"] #legendAreaFilter,
    html[data-theme="dark"] #legendSort {
      background: rgba(10,18,33,0.96);
      color: var(--text);
      border-color: rgba(148,163,184,0.22);
    }
    html[data-theme="dark"] #legendSection {
      background: linear-gradient(180deg, rgba(15,23,42,0.98) 0%, rgba(12,22,40,0.98) 100%);
      border-color: rgba(148,163,184,0.16);
    }
    html[data-theme="dark"] #legendWrap {
      background: rgba(10,18,33,0.96);
      border-color: rgba(148,163,184,0.18);
      color: var(--text);
    }
    html[data-theme="dark"] .legend-toolbar label,
    html[data-theme="dark"] #legendSection h2,
    html[data-theme="dark"] #legendWrap,
    html[data-theme="dark"] #legendWrap .muted,
    html[data-theme="dark"] .legend-totals,
    html[data-theme="dark"] .legend-total-chip {
      color: var(--text);
    }
    html[data-theme="dark"] .legend-table,
    html[data-theme="dark"] .legend-table th,
    html[data-theme="dark"] .legend-table td {
      background: transparent;
      color: var(--text);
    }
    html[data-theme="dark"] .legend-table th {
      background: #14233a;
      box-shadow: inset 0 -1px 0 rgba(148,163,184,0.16);
    }
    html[data-theme="dark"] .legend-table tbody tr:nth-child(even) { background: rgba(255,255,255,0.03); }
    html[data-theme="dark"] .legend-note-input {
      background: rgba(10,18,33,0.96);
      color: var(--text);
      border-color: rgba(148,163,184,0.22);
    }
    html[data-theme="dark"] .legend-note-input::placeholder {
      color: #7f93b0;
    }
    html[data-theme="dark"] .legend-table th,
    html[data-theme="dark"] .legend-table td,
    html[data-theme="dark"] .group-actions button,
    html[data-theme="dark"] .context-menu button {
      border-color: rgba(148,163,184,0.16);
      color: var(--text);
    }
    html[data-theme="dark"] .context-menu .menu-move-btn { background: linear-gradient(135deg, #0d3b6f 0%, #1f7fd4 100%); color:#fff; border-color: rgba(96,165,250,0.28); box-shadow: 0 12px 28px rgba(2,132,199,0.22); }
    html[data-theme="dark"] .context-menu .menu-move-btn:hover { background: linear-gradient(135deg, #0b4b89 0%, #2890ea 100%); color:#fff; }
    html[data-theme="dark"] .context-menu .menu-move-btn[data-ready="false"] { background: rgba(15,23,42,0.82); color:#94a3b8; border-color: rgba(148,163,184,0.16); box-shadow:none; }
    html[data-theme="dark"] .group-actions button,
    html[data-theme="dark"] .context-menu button {
      background: rgba(15,23,42,0.76);
      box-shadow:none;
    }
    html[data-theme="dark"] .context-menu .menu-header {
      background: rgba(251,191,36,0.14);
      color: #fcd34d;
      border-bottom-color: rgba(148,163,184,0.16);
    }
    html[data-theme="dark"] .context-menu .menu-col + .menu-col { border-left-color: rgba(148,163,184,0.14); }
    html[data-theme="dark"] .context-menu .menu-info-strip { background:#111827; border-bottom-color: rgba(148,163,184,0.14); }
    html[data-theme="dark"] .context-menu .menu-info-chip,
    html[data-theme="dark"] .stack-hover-card { background:#0b1220; border-color: rgba(148,163,184,0.18); }
    html[data-theme="dark"] .context-menu .menu-info-value,
    html[data-theme="dark"] .stack-hover-title,
    html[data-theme="dark"] .stack-hover-name { color: var(--text); }
    html[data-theme="dark"] .menu-field input,
    html[data-theme="dark"] .menu-field select { background:#0f172a; color:var(--text); border-color:#334155; }
    html[data-theme="dark"] .area-quick-menu { background: var(--card); border-color: rgba(148,163,184,0.22); box-shadow: 0 14px 36px rgba(0,0,0,0.42); }
    html[data-theme="dark"] .area-quick-header { background: rgba(245,158,11,0.14); border-bottom-color: rgba(148,163,184,0.14); }
    html[data-theme="dark"] .area-quick-title { color: #fcd34d; }
    html[data-theme="dark"] .area-quick-btn { background: rgba(15,23,42,0.7); border-color: rgba(148,163,184,0.18); color: var(--text); }
    html[data-theme="dark"] .area-quick-btn:hover { background: rgba(30,41,59,0.9); }
    html[data-theme="dark"] .toolbar-top button,
    html[data-theme="dark"] .vehicle-quick > button,
    html[data-theme="dark"] .btn-row button,
    html[data-theme="dark"] .project-actions button {
      box-shadow: 0 10px 22px rgba(0,0,0,0.22);
    }
    html[data-theme="dark"] .soft { background: rgba(15,23,42,0.82); color: #dbeafe; border: 1px solid rgba(148,163,184,0.16); box-shadow:none; }
    html[data-theme="dark"] .primary { background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%); color:#fff; }
    html[data-theme="dark"] .success { background: rgba(34,197,94,0.16); color:#9ef3bb; }
    html[data-theme="dark"] .warning { background: rgba(251,146,60,0.15); color:#fdba74; }
    html[data-theme="dark"] .danger { background: rgba(239,68,68,0.16); color:#fca5a5; }
    html[data-theme="dark"] .muted,
    html[data-theme="dark"] label,
    html[data-theme="dark"] .tiny,
    html[data-theme="dark"] .area-meta-line,
    html[data-theme="dark"] .swatch-preview-row,
    html[data-theme="dark"] .palette-other-row,
    html[data-theme="dark"] .menu-section-title {
      color: var(--muted);
    }
    html[data-theme="dark"] .stat strong,
    html[data-theme="dark"] .premium-pill,
    html[data-theme="dark"] .area-meta-badge strong {
      color: var(--text);
    }
    html[data-theme="dark"] .legend-card,
    html[data-theme="dark"] .legend-meta-box,
    html[data-theme="dark"] .ralla-zone { background: rgba(59,130,246,0.14); border-left-color: rgba(125,179,255,0.40); border-right-color: rgba(125,179,255,0.40); }
    html[data-theme="dark"] .tridem-zone { background: rgba(239,68,68,0.16); border-left-color: rgba(248,113,113,0.42); border-right-color: rgba(248,113,113,0.42); }
    html[data-theme="dark"] .axle-marker { background: rgba(203,213,225,0.30); }
    html[data-theme="dark"] .start-cue-select {
      border-color: rgba(250,204,21,0.72) !important;
      box-shadow: 0 0 0 4px rgba(250,204,21,0.14);
      background: linear-gradient(180deg, rgba(66,48,5,0.62) 0%, rgba(10,18,33,0.96) 100%) !important;
      animation: startCueSelectPulse 1.8s ease-in-out infinite;
    }
    html[data-theme="dark"] .swatch-btn.active { box-shadow: 0 0 0 3px rgba(125,179,255,0.22); }
    html[data-theme="dark"] .display-toggle {
      background: rgba(10,18,33,0.96);
      border-color: rgba(148,163,184,0.22);
      color: var(--text);
    }
    html[data-theme="dark"] .item,
    html[data-theme="dark"] .item * { color: var(--item-text); }
    html[data-theme="dark"] .context-menu label { color: var(--muted) !important; }
    html[data-theme="dark"] .context-menu input,
    html[data-theme="dark"] .context-menu select,
    html[data-theme="dark"] .context-menu textarea {
      background: rgba(10,18,33,0.96) !important;
      color: var(--text) !important;
      border-color: rgba(148,163,184,0.22) !important;
    }
    html[data-theme="dark"] .context-menu select option {
      background: #0f172a;
      color: #f8fbff;
    }

  
    .app-footer { max-width: 1960px; margin: 0 auto 16px auto; padding: 14px 18px; border: 1px solid #eef2f7; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); color: var(--muted); font-size: 12px; line-height: 1.5; text-align: center; }
    .app-footer strong { color: var(--text); }
    .app-footer .footer-title { font-size: 12px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
    html[data-theme="dark"] .app-footer { border-color: rgba(255,255,255,0.08); background: rgba(15,23,42,0.92); }

