:root{--bg:#f4f7fb;--card:#fff;--line:#dbe3ef;--text:#172033;--muted:#64748b;--blue:#2563eb;--green:#059669;--orange:#d97706;--red:#dc2626;--nav:#0f172a}
*{box-sizing:border-box} body{margin:0;font-family:Segoe UI,Arial,sans-serif;background:var(--bg);color:var(--text)}
header{background:linear-gradient(135deg,#0f172a,#1e3a8a);color:white;padding:18px 24px}
header h1{margin:0;font-size:24px} header p{margin:6px 0 0;color:#dbeafe;font-size:13px}
.app{display:grid;grid-template-columns:320px 1fr;min-height:calc(100vh - 84px)}
.sidebar{background:#fff;border-right:1px solid var(--line);padding:14px;overflow:auto}
.brand{font-weight:700;margin:2px 0 12px}.btn{display:block;width:100%;text-align:left;border:1px solid #cbd5e1;background:#fff;padding:9px 10px;margin:6px 0;border-radius:8px;cursor:pointer;font-size:13px}
.btn:hover{background:#eff6ff;border-color:#93c5fd}.btn.primary{background:#2563eb;color:#fff;border-color:#2563eb}.btn.green{background:#059669;color:white;border-color:#059669}
.btn.small{display:inline-block;width:auto;margin:3px;padding:7px 10px}.group-title{font-size:11px;text-transform:uppercase;color:#64748b;margin-top:14px;font-weight:700}
select,input[type=file],input[type=number]{width:100%;padding:8px;border:1px solid #cbd5e1;border-radius:7px;background:#fff}
.status{margin-top:10px;border-radius:8px;padding:10px;background:#f8fafc;border:1px solid #e2e8f0;font-size:12px;min-height:52px}
.main{padding:14px;overflow:auto}.tabs{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:10px}.tabbtn{border:1px solid #cbd5e1;padding:8px 12px;background:#fff;border-radius:8px;cursor:pointer}.tabbtn.active{background:#1e3a8a;color:#fff;border-color:#1e3a8a}
.tab{display:none}.tab.active{display:block}.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:10px}.kpi{background:#fff;border:1px solid var(--line);border-radius:10px;padding:14px}.kpi .label{font-size:12px;color:var(--muted)}.kpi .value{font-size:24px;font-weight:700;margin-top:4px}
.grid2{display:grid;grid-template-columns:2fr 1fr;gap:10px}.card{background:#fff;border:1px solid var(--line);border-radius:10px;padding:12px;margin-bottom:10px}.card h3{margin:0 0 8px;font-size:15px}
canvas{width:100%;height:300px;border:1px solid #edf2f7;border-radius:8px;background:#fff}
.tablewrap{overflow:auto;max-height:600px;border:1px solid var(--line);border-radius:8px}table{border-collapse:collapse;width:max-content;min-width:100%;font-size:11px}th,td{padding:6px 8px;border-bottom:1px solid #e5e7eb;white-space:nowrap}th{position:sticky;top:0;background:#f8fafc;z-index:1}
pre{white-space:pre-wrap;font-family:Consolas,monospace;font-size:12px;background:#0f172a;color:#e2e8f0;padding:12px;border-radius:8px;max-height:500px;overflow:auto}
.badge{display:inline-block;padding:2px 7px;border-radius:999px;font-size:11px;font-weight:600}.Normal{background:#dcfce7;color:#166534}.Caution{background:#fef3c7;color:#92400e}.Warning{background:#ffedd5;color:#9a3412}.Critical{background:#fee2e2;color:#991b1b}
.note{font-size:12px;color:#64748b;line-height:1.45}.toolbar{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:8px}
@media(max-width:900px){.app{grid-template-columns:1fr}.sidebar{border-right:none;border-bottom:1px solid var(--line)}.kpis{grid-template-columns:1fr 1fr}.grid2{grid-template-columns:1fr}}

.wait-overlay{
  position:fixed; inset:0; background:rgba(15,23,42,.38);
  display:none; align-items:center; justify-content:center; z-index:9999;
  backdrop-filter:blur(2px);
}
.wait-overlay.show{display:flex}
.wait-box{
  width:min(520px,88vw); background:#fff; border-radius:14px; padding:20px;
  box-shadow:0 20px 60px rgba(0,0,0,.22); border:1px solid #dbe3ef;
}
.wait-title{font-weight:700;font-size:16px;margin-bottom:8px}
.wait-msg{font-size:12px;color:#64748b;margin-bottom:12px}
.wait-track{
  width:100%; height:12px; background:#e2e8f0; border-radius:999px; overflow:hidden;
}
.wait-bar{
  width:0%; height:100%; background:linear-gradient(90deg,#2563eb,#06b6d4);
  transition:width .18s ease;
}
.wait-pct{font-size:12px;color:#475569;text-align:right;margin-top:6px}


.footer{
  text-align:center;
  padding:14px 10px 18px;
  color:#64748b;
  font-size:12px;
}
.footer strong{color:#334155}


/* ---- 3.5.0 additions ---- */
header .ver{font-size:14px;font-weight:600;color:#bfdbfe;margin-left:6px}
.group-title.first{margin-top:0}
.btn:disabled{opacity:.45;cursor:not-allowed;background:#f1f5f9;color:#64748b;border-color:#e2e8f0}
.btn.primary:disabled,.btn.green:disabled{background:#cbd5e1;border-color:#cbd5e1;color:#f8fafc}
.btn:focus-visible,.tabbtn:focus-visible,select:focus-visible,input:focus-visible{outline:2px solid #2563eb;outline-offset:2px}
.btn.danger{background:#fff;color:#b91c1c;border-color:#fca5a5}
.btn.danger:hover{background:#fef2f2}
.advanced-tools{margin-top:12px;border:1px solid #dbe3ef;border-radius:8px;padding:8px;background:#f8fafc}
.advanced-tools summary{cursor:pointer;font-weight:700;font-size:12px;color:#475569}
.note.slot{display:block;margin-top:6px}
#engineIndicator{margin-top:4px}
pre.st-error{border-left:4px solid #dc2626}
pre.st-warning{border-left:4px solid #d97706}
.wait-row{display:flex;justify-content:space-between;align-items:center;margin-top:8px}
.wait-row .wait-pct{margin-top:0}
[hidden]{display:none!important}

/* ---------- Live Berthing demo tab ---------- */
.tag-demo{font-size:10px;background:#fef3c7;color:#92400e;border-radius:6px;padding:1px 5px;margin-left:4px}
.live-intro{background:#f8fafc;font-size:13px;line-height:1.5}
.live-h{margin:14px 0 8px;font-size:14px;color:#334155}
.live-banner{border-radius:10px;padding:12px 14px;margin:10px 0;border:1px solid #cbd5e1;background:#f1f5f9;line-height:1.6}
.live-banner.lvl-Normal{background:#ecfdf5;border-color:#6ee7b7}
.live-banner.lvl-Caution{background:#fefce8;border-color:#fde047}
.live-banner.lvl-Warning{background:#fff7ed;border-color:#fdba74}
.live-banner.lvl-Critical{background:#fef2f2;border-color:#f87171}
.live-banner .badge{display:inline-block;padding:2px 10px;border-radius:999px;color:#fff;font-weight:600;margin-right:8px}
.badge.Normal{background:#059669}.badge.Caution{background:#ca8a04}.badge.Warning{background:#ea580c}.badge.Critical{background:#dc2626}
.shm-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:10px}
.shm-card{background:#fff;border:1px solid #e2e8f0;border-left:4px solid #22c55e;border-radius:10px;padding:10px 12px}
.shm-card.off{border-left-color:#94a3b8;opacity:.75}
.shm-card.fc{border-left-color:#6366f1}
.shm-head{display:flex;justify-content:space-between;font-size:11px;color:#64748b;gap:6px}
.shm-head span:first-child{font-weight:600;color:#0f172a}
.shm-val{font-size:22px;font-weight:700;margin:4px 0;color:#0f172a;word-break:break-word}
.shm-val small{font-size:12px;font-weight:500;color:#64748b}
.shm-sub{font-size:11px;color:#64748b}
.live-canvas{width:100%;height:280px;display:block}
.st-error{color:#dc2626}
.live-plan{width:100%;height:460px;display:block}
.plan-grid{display:grid;grid-template-columns:3fr 2fr;gap:10px}
@media (max-width:1100px){.plan-grid{grid-template-columns:1fr}}
.anim-canvas{height:520px}
#animGrid.single{grid-template-columns:1fr}
#animGrid.single #animZoomWrap{display:none}
.shm-bar{border-top:1px dashed #e2e8f0;padding-top:6px}
