/* =====================================================================
 * style.css — Load Planner · Expedição
 * Estilo industrial: menu escuro, área de trabalho clara, alta legibilidade.
 * ===================================================================== */
:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --border: #d9dee4;
  --border-strong: #b9c2cc;
  --text: #16202a;
  --text-2: #4a5663;
  --muted: #7a8794;
  --primary: #2a78d6;
  --primary-ink: #ffffff;
  --primary-soft: #e3eefb;
  --side: #17212b;
  --side-2: #202d3a;
  --side-text: #c6d0da;
  --good: #1f8a4c;  --good-soft: #e3f4ea;
  --warn: #b86e00;  --warn-soft: #fff1d6;
  --crit: #c62828;  --crit-soft: #fde5e5;
  --info-soft: #e6f0fb;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 32, .06), 0 1px 3px rgba(16, 24, 32, .08);
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
a { color: var(--primary); }
.ic { flex: none; vertical-align: middle; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 236px; background: var(--side); color: var(--side-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex: none; z-index: 30; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px 14px; border-bottom: 1px solid #263442; }
.brand-logo { width: 36px; height: 36px; border-radius: 8px; background: var(--primary); display: grid; place-items: center; color: #fff; overflow: hidden; flex: none; }
.brand-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.brand-name { color: #fff; font-weight: 600; font-size: 13.5px; line-height: 1.2; }
.brand-sub { font-size: 11px; color: #8796a5; text-transform: uppercase; letter-spacing: .08em; }
nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 6px; color: var(--side-text); text-decoration: none; font-weight: 500; margin-bottom: 2px; }
nav a:hover { background: var(--side-2); color: #fff; }
nav a.active { background: var(--primary); color: #fff; }
nav .num { margin-left: auto; font-size: 11px; background: #2c3b4a; border-radius: 10px; padding: 0 7px; color: #d8e1ea; }
nav a.active .num { background: rgba(255, 255, 255, .25); }
.sidebar-foot { padding: 12px 16px; font-size: 11px; color: #7d8b99; border-top: 1px solid #263442; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 60px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 22px; position: sticky; top: 0; z-index: 20; }
.topbar h1 { font-size: 18px; }
.crumb { font-size: 12px; color: var(--muted); }
.topbar-title { flex: 1; min-width: 0; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
main { padding: 20px 22px 40px; outline: none; }
.only-tablet { display: none; }

/* ---------- componentes ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card > header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card > header h3 { font-size: 14px; flex: 1; }
.card-body { padding: 16px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt-s { margin-top: 8px; }

.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 500 13px var(--font); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-2); border-color: #9aa6b2; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(.94); }
.btn.go { background: #16803f; border-color: #16803f; color: #fff; font-weight: 600; letter-spacing: .02em; }
.btn.go:hover { filter: brightness(.94); }
.btn.danger { color: var(--crit); border-color: #e7b3b3; }
.btn.danger:hover { background: var(--crit-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.icon { width: 34px; padding: 0; justify-content: center; }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12px; }
.btn.sm.icon { width: 28px; }
.btn.lg { height: 42px; padding: 0 20px; font-size: 14px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 6px 6px 0; }
.btn-group .btn.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); z-index: 1; }

label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-2); font-weight: 500; }
input, select, textarea { font: 13.5px var(--font); color: var(--text); border: 1px solid var(--border-strong); border-radius: 6px; padding: 7px 9px; background: #fff; min-width: 0; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
input[type=number] { text-align: right; }
textarea { resize: vertical; min-height: 60px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; cursor: pointer; user-select: none; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .span2 { grid-column: span 2; } .form-grid .span4 { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px 14px; margin: 0 0 14px; }
legend { font-size: 12px; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; padding: 0 6px; }
.search { position: relative; }
.search .ic { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 32px; width: 260px; }

/* tabelas */
.table-wrap { overflow: auto; max-width: 100%; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-2); background: var(--surface-2); padding: 8px 10px; border-bottom: 1px solid var(--border); position: sticky; top: 0; white-space: nowrap; z-index: 1; }
table.t td { padding: 7px 10px; border-bottom: 1px solid #edf0f3; vertical-align: middle; }
table.t tr:hover td { background: #f8fafc; }
table.t tr.sel td { background: var(--primary-soft); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.t .actions { white-space: nowrap; text-align: right; }
table.t input, table.t select { padding: 4px 6px; font-size: 13px; }
table.t tfoot td { font-weight: 600; background: var(--surface-2); }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: #eef1f4; color: var(--text-2); }
.badge.good { background: var(--good-soft); color: var(--good); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.crit { background: var(--crit-soft); color: var(--crit); }
.badge.info { background: var(--info-soft); color: #1f5fae; }
.chip { display: inline-block; padding: 1px 7px; border-radius: 4px; background: #eef1f4; font-size: 11.5px; color: var(--text-2); margin: 1px 2px 1px 0; }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.crit { background: var(--crit-soft); color: var(--crit); }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; }

/* KPIs */
.kpi { padding: 14px 16px; }
.kpi .lbl { font-size: 11.5px; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.kpi .val { font-size: 26px; font-weight: 600; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.kpi.accent { border-left: 4px solid var(--primary); }
.kpi.good { border-left: 4px solid var(--good); } .kpi.warn { border-left: 4px solid var(--warn); } .kpi.crit { border-left: 4px solid var(--crit); }
.meter { height: 7px; background: #e6eaee; border-radius: 4px; overflow: hidden; margin-top: 8px; }
.meter > div { height: 100%; background: var(--primary); border-radius: 4px; }
.meter.warn > div { background: var(--warn); } .meter.crit > div { background: var(--crit); }

.alert { display: flex; gap: 10px; padding: 10px 12px; border-radius: 6px; font-size: 13px; align-items: flex-start; }
.alert.info { background: var(--info-soft); color: #1f4f8a; }
.alert.warn { background: var(--warn-soft); color: #7a4a00; }
.alert.crit { background: var(--crit-soft); color: #8e1c1c; }
.alert.good { background: var(--good-soft); color: #155f35; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }

/* charts (SVG) */
.chart { width: 100%; display: block; }
.chart .grid-l { stroke: #e7ebef; }
.chart .axis-t { fill: var(--muted); font-size: 11px; }
.chart .bar { fill: var(--primary); }
.chart .bar:hover, .chart .bar.hl { fill: #1f5fae; }
.chart .lbl-t { fill: var(--text-2); font-size: 11px; font-weight: 600; }
.tip { position: fixed; pointer-events: none; background: #16202a; color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 5px; z-index: 200; box-shadow: var(--shadow); white-space: nowrap; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(15, 23, 32, .45); display: flex; align-items: flex-start; justify-content: center; z-index: 100; padding: 5vh 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 10px; width: 560px; max-width: 100%; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); display: flex; flex-direction: column; max-height: 90vh; }
.modal.wide { width: 920px; } .modal.xwide { width: 1320px; }
.modal header { display: flex; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal header h3 { flex: 1; font-size: 16px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 10px 10px; }

/* toasts & busy */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 300; max-width: 420px; }
.toast { display: flex; gap: 9px; align-items: flex-start; background: #16202a; color: #fff; padding: 11px 14px; border-radius: 7px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); font-size: 13px; transition: opacity .3s, transform .3s; }
.toast.error { background: #8e1c1c; } .toast.success { background: #155f35; }
.toast.out { opacity: 0; transform: translateY(8px); }
#busy { position: fixed; inset: 0; background: rgba(255, 255, 255, .55); display: none; align-items: center; justify-content: center; z-index: 250; }
.busy-card { background: #16202a; color: #fff; padding: 14px 20px; border-radius: 8px; display: flex; gap: 12px; align-items: center; }
.spinner { width: 20px; height: 20px; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 8px; overflow-x: auto; background: var(--surface); }
.tabs button { background: none; border: none; padding: 11px 10px; font: 500 13px var(--font); color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .count { background: var(--crit); color: #fff; border-radius: 9px; font-size: 10.5px; padding: 0 6px; }

/* ---------- planejador ---------- */
.planner { display: grid; grid-template-columns: 270px minmax(0, 1fr) 280px; gap: 14px; align-items: start; }
.planner .side { display: flex; flex-direction: column; gap: 14px; }
.planner .stage { min-height: 560px; display: flex; flex-direction: column; overflow: hidden; }
.stage-toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.viewport3d { position: relative; height: 560px; background: linear-gradient(#f4f7fa, #dfe5eb); }
.viewport3d canvas { display: block; width: 100%; height: 100%; }
.viewport3d .legend { position: absolute; left: 10px; bottom: 10px; background: rgba(255, 255, 255, .92); border: 1px solid var(--border); border-radius: 6px; padding: 7px 9px; font-size: 11.5px; max-height: 45%; overflow: auto; }
.viewport3d .hint { position: absolute; right: 10px; bottom: 10px; max-width: 55%; text-align: right; font-size: 11px; color: var(--text-2); background: rgba(255, 255, 255, .85); padding: 4px 8px; border-radius: 4px; }
.viewport3d .no3d { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-2); text-align: center; padding: 30px; }
.viewport3d .drag-tip { position: absolute; left: 50%; top: 10px; transform: translateX(-50%); font-size: 12.5px; font-weight: 600; padding: 7px 12px; border-radius: 6px; pointer-events: none; box-shadow: 0 2px 8px rgba(0,0,0,.15); max-width: 80%; text-align: center; }
.viewport3d .drag-tip.ok { background: #e8f5e9; color: #1b5e20; border: 1px solid #81c784; }
.viewport3d .drag-tip.bad { background: #ffebee; color: #b71c1c; border: 1px solid #e57373; }
.viewport3d .drag-tip span { font-weight: 400; font-size: 11.5px; }
.action-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; font-size: 13px; }
.kv dt { color: var(--text-2); } .kv dd { margin: 0; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; }
.ind { padding: 10px 14px; border-bottom: 1px solid #edf0f3; }
.ind:last-child { border-bottom: none; }
.ind .h { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.ind .big { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ind .det { font-size: 12px; color: var(--muted); }
.adjust .pad { display: grid; grid-template-columns: repeat(3, 34px); gap: 4px; justify-content: center; }
.sim-banner { background: repeating-linear-gradient(45deg, #fff1d6, #fff1d6 10px, #ffe7b3 10px, #ffe7b3 20px); border: 1px solid #f0c36a; color: #6b4200; padding: 8px 14px; border-radius: 6px; display: flex; gap: 10px; align-items: center; margin-bottom: 12px; font-weight: 500; }
.vehicle-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.seq-list { max-height: 560px; overflow: auto; }
.stepno { display: inline-grid; place-items: center; min-width: 26px; height: 22px; border-radius: 4px; background: #16202a; color: #fff; font: 600 12px var(--mono); padding: 0 4px; }
.view2d-grid { display: grid; grid-template-columns: 1fr; gap: 14px; padding: 14px; }
.view2d-grid .v2 { border: 1px solid var(--border); border-radius: 6px; background: #fff; padding: 8px; }
.view2d-grid h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); margin-bottom: 6px; }
svg.v2d text { font-family: var(--font); }

/* assistente */
.chat { display: flex; flex-direction: column; height: 520px; }
.chat-log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.msg { max-width: 86%; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; line-height: 1.5; }
.msg.user { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 3px; }
.msg.bot { align-self: flex-start; background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 3px; }
.msg.bot ul { margin: 4px 0; padding-left: 18px; }
.msg .src { font-size: 11px; color: var(--muted); margin-top: 6px; border-top: 1px dashed var(--border); padding-top: 4px; }
.chat-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.chat-input input { flex: 1; }
.suggest { display: flex; gap: 6px; flex-wrap: wrap; padding: 8px 10px 0; }
.suggest button { font: 12px var(--font); border: 1px solid var(--border-strong); background: #fff; border-radius: 14px; padding: 4px 10px; cursor: pointer; color: var(--text-2); }
.suggest button:hover { border-color: var(--primary); color: var(--primary); }

/* checklist */
.checklist h4 { margin: 14px 0 8px; font-size: 13px; text-transform: uppercase; color: var(--text-2); letter-spacing: .05em; }
.checklist label { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; margin-bottom: 6px; cursor: pointer; background: #fff; }
.checklist label.done { background: var(--good-soft); border-color: #b9e2c8; }

/* importação */
.steps { display: flex; gap: 0; margin-bottom: 16px; }
.steps div { flex: 1; padding: 8px 12px; background: #e6eaee; color: var(--text-2); font-size: 12.5px; font-weight: 600; position: relative; }
.steps div.on { background: var(--primary); color: #fff; }
.steps div.done { background: #cfe1f6; color: #1f5fae; }
.drop { border: 2px dashed var(--border-strong); border-radius: 10px; padding: 40px; text-align: center; color: var(--text-2); cursor: pointer; background: var(--surface-2); }
.drop.over { border-color: var(--primary); background: var(--primary-soft); }
.map-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; }
.err-row td { background: var(--crit-soft) !important; }

/* relatório */
.report { background: #fff; max-width: 1000px; margin: 0 auto; padding: 28px 32px; border: 1px solid var(--border); border-radius: 8px; }
.report h2 { font-size: 22px; letter-spacing: .02em; }
.report .rh { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 3px solid #16202a; padding-bottom: 12px; margin-bottom: 14px; gap: 16px; }
.report .rh img { max-height: 48px; max-width: 160px; }
.report h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; margin: 20px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.report .rgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 20px; font-size: 13px; }
.report .rgrid b { color: var(--text-2); font-weight: 500; display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.report table.t td, .report table.t th { padding: 5px 7px; font-size: 12px; }
.report .sig { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; margin-top: 50px; font-size: 12px; text-align: center; }
.report .sig div { border-top: 1px solid #333; padding-top: 5px; }
.disclaimer { font-size: 11.5px; color: var(--text-2); background: var(--surface-2); border-left: 3px solid var(--warn); padding: 8px 10px; margin-top: 12px; }

/* ---------- responsivo ---------- */
@media (max-width: 1560px) {
  .planner { grid-template-columns: 280px minmax(0, 1fr); }
  .planner .side.rightside { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 1100px) {
  .g4, .g5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .planner { grid-template-columns: 1fr; }
  .planner .stage { order: -1; }
  .map-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  .only-tablet { display: inline-flex; }
  main { padding: 14px 16px 30px; }
  .topbar { padding: 0 16px; }
  .g2 { grid-template-columns: 1fr; }
  .search input { width: 180px; }
  .report .rgrid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .g3, .g4, .g5, .form-grid, .map-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: auto; }
}

/* ---------- impressão ---------- */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print, #toasts { display: none !important; }
  main { padding: 0; }
  .report { border: none; padding: 0; max-width: none; }
  .report h3 { break-after: avoid; }
  table { break-inside: auto; } tr { break-inside: avoid; }
  .print-break { break-before: page; }
}

/* ---------- cadastro por desenho ---------- */
.dw-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; align-items: start; }
.dw-layout > .side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 74px; }
.dw-q { padding: 9px 14px; border-bottom: 1px solid #edf0f3; cursor: pointer; }
.dw-q:hover { background: var(--surface-2); }
.dw-q.on { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.dw-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; align-items: start; }
.dw-viewer .dw-img { background: #f4f6f8; min-height: 360px; display: grid; place-items: center; padding: 8px; }
.dw-viewer .dw-img img { width: 100%; height: auto; border: 1px solid var(--border); background: #fff; }
.dw-chip { cursor: pointer; border: 1px solid var(--border-strong); background: #fff; font: 600 12px var(--mono); padding: 2px 8px; }
.dw-chip:hover { border-color: var(--primary); color: var(--primary); }
input.dw-focus { outline: 2px solid var(--primary); outline-offset: 0; }
.dw-bom td { padding: 5px 8px; }
.dw-bom input, .dw-bom select { padding: 3px 5px; font-size: 12.5px; }
@media (max-width: 1250px) { .dw-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .dw-layout { grid-template-columns: 1fr; } .dw-layout > .side { position: static; } }
.dw-preview { height: 320px; border: 1px solid var(--border); border-radius: 6px; background: linear-gradient(#f4f7fa, #dfe5eb); margin-top: 6px; }
.dw-preview canvas { display: block; width: 100%; height: 100%; }
.dw-vthumb { width: 130px; height: 80px; border: 1px dashed var(--border-strong); border-radius: 6px; display: grid; place-items: center; background: #fff; overflow: hidden; }
.dw-vthumb img { max-width: 100%; max-height: 100%; }
.dw-crop { position: relative; display: inline-block; cursor: crosshair; user-select: none; touch-action: none; }
.dw-crop img { max-width: 100%; display: block; border: 1px solid var(--border); }
#cropRect { position: absolute; display: none; border: 2px solid var(--primary); background: rgba(42, 120, 214, .12); pointer-events: none; }
