:root{
  --bg:#0b1220;
  --panel:#101a2e;
  --card:#0f1a2c;
  --card2:#0d1627;
  --line:rgba(255,255,255,.10);
  --text:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.65);
  --accent:#2dd4bf;
  --danger:#ff4d6d;
  --warn:#fbbf24;
  --ok:#22c55e;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: radial-gradient(1200px 700px at 30% 10%, rgba(45,212,191,.18), transparent 60%), var(--bg);
  color:var(--text);
  overflow:hidden;
}
.topbar{
  height:64px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 14px;
  border-bottom:1px solid var(--line);
  background:rgba(16,26,46,.75);
  backdrop-filter: blur(10px);
}
.brand{display:flex; gap:10px; align-items:center}
.dot{width:12px;height:12px;border-radius:50%; background:var(--accent); box-shadow:0 0 0 6px rgba(45,212,191,.12)}
.title{font-weight:800; letter-spacing:.2px}
.subtitle{font-size:12px;color:var(--muted)}
.top-actions{display:flex; gap:8px; align-items:center; flex-wrap:wrap}

.btn{
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--text);
  padding:10px 12px;
  border-radius:12px;
  font-weight:650;
  cursor:pointer;
  user-select:none;
}
.btn:hover{background:rgba(255,255,255,.06)}
.btn:active{transform:translateY(1px)}
.btn.small{padding:7px 10px; border-radius:10px; font-size:13px}
.btn.primary{background:rgba(45,212,191,.16); border-color:rgba(45,212,191,.35)}
.btn.primary:hover{background:rgba(45,212,191,.22)}

.layout{
  height:calc(100% - 64px);
  display:grid;
  grid-template-columns: 46% 54%;
}
.left{
  border-right:1px solid var(--line);
  overflow:hidden;
}
.right{overflow:hidden; display:flex; flex-direction:column}

.grid{
  height:100%;
  overflow:auto;
  padding:12px;
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:12px;
}

.card{
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border:1px solid var(--line);
  border-radius:16px;
  padding:10px;
  min-height:150px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.card.danger{border-color: rgba(255,77,109,.35)}
.card-h{display:flex; align-items:center; justify-content:space-between; gap:10px}
.card-t{font-weight:800; letter-spacing:.2px}
.mini-actions{display:flex; gap:8px; align-items:center}

textarea{
  width:100%;
  min-height:120px;
  resize:vertical;
  border:1px solid var(--line);
  border-radius:12px;
  padding:10px;
  background:rgba(0,0,0,.16);
  color:var(--text);
  outline:none;
  line-height:1.25;
}
textarea:focus,.input:focus,select:focus{border-color:rgba(45,212,191,.45); box-shadow:0 0 0 4px rgba(45,212,191,.10)}

.input, select{
  width:100%;
  border:1px solid var(--line);
  border-radius:12px;
  padding:10px;
  background:rgba(0,0,0,.16);
  color:var(--text);
  outline:none;
}
.row{display:flex; gap:8px; align-items:center}
.lbl{color:var(--muted); font-size:13px; width:70px}

.chips{display:flex; gap:6px; align-items:center}
.chip{
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--text);
  padding:7px 10px;
  border-radius:999px;
  font-weight:800;
  font-size:12px;
  cursor:pointer;
}
.chip.active[data-prio="RØD"]{border-color:rgba(255,77,109,.55); background:rgba(255,77,109,.18)}
.chip.active[data-prio="GUL"]{border-color:rgba(251,191,36,.55); background:rgba(251,191,36,.15)}
.chip.active[data-prio="GRØN"]{border-color:rgba(34,197,94,.55); background:rgba(34,197,94,.14)}

.todo-list{display:flex; flex-direction:column; gap:8px}
.todo{
  border:1px solid var(--line);
  border-radius:14px;
  padding:8px;
  background:rgba(0,0,0,.14);
  display:grid;
  grid-template-columns: 1fr auto;
  gap:8px;
}
.todo .t{font-weight:750}
.todo .m{font-size:12px; color:var(--muted); margin-top:2px}
.todo .right{display:flex; flex-direction:column; gap:6px; align-items:flex-end}
.badge{font-size:11px; padding:4px 8px; border-radius:999px; border:1px solid var(--line); color:var(--muted)}
.badge.done{border-color:rgba(34,197,94,.45); color:rgba(34,197,94,.95)}
.badge.over{border-color:rgba(255,77,109,.55); color:rgba(255,77,109,.95)}

.resources{display:flex; flex-wrap:wrap; gap:8px}
.unit{
  border:1px solid var(--line);
  border-radius:999px;
  padding:8px 10px;
  background:rgba(0,0,0,.14);
  display:flex;
  gap:8px;
  align-items:center;
  cursor:pointer;
  user-select:none;
}
.unit .name{font-weight:850}
.unit .type{font-size:12px;color:var(--muted)}
.unit .st{font-size:12px; padding:2px 8px; border-radius:999px; border:1px solid var(--line); color:var(--muted)}

.hazards{display:flex; flex-wrap:wrap; gap:8px}
.haz{
  border:1px solid rgba(255,77,109,.40);
  background:rgba(255,77,109,.14);
  padding:8px 10px;
  border-radius:999px;
  font-weight:900;
  letter-spacing:.3px;
  cursor:pointer;
  user-select:none;
}

.log{border:1px solid var(--line); border-radius:14px; padding:8px; background:rgba(0,0,0,.14); max-height:240px; overflow:auto; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size:12px}
.log .line{padding:6px 6px; border-bottom:1px dashed rgba(255,255,255,.08)}
.log .line:last-child{border-bottom:none}

.sketch-header{
  height:56px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:10px 12px;
  border-bottom:1px solid var(--line);
}
.sketch-title{font-weight:900}
.sketch-tools{display:flex; gap:8px; align-items:center; flex-wrap:wrap; justify-content:flex-end}
.sep{width:1px; height:22px; background:var(--line); margin:0 2px}

.sketch-wrap{
  position:relative;
  flex:1;
  padding:12px;
  overflow:hidden;
}
#sketch{
  width:100%;
  height:100%;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(0,0,0,.06));
  border:1px solid var(--line);
  border-radius:18px;
  touch-action:none;
}
.token-layer{position:absolute; inset:12px; pointer-events:none}
.token{
  position:absolute;
  pointer-events:auto;
  border:1px solid rgba(255,255,255,.18);
  background:rgba(16,26,46,.85);
  border-radius:14px;
  padding:8px 10px;
  min-width:120px;
  box-shadow: 0 12px 28px rgba(0,0,0,.35);
  cursor:grab;
  user-select:none;
}
.token:active{cursor:grabbing}
.token.selected{outline:3px solid rgba(45,212,191,.35)}
.token .n{font-weight:950}
.token .s{margin-top:2px; color:var(--muted); font-size:12px}
.token .sec{display:inline-block; margin-left:6px; font-size:11px; padding:2px 7px; border:1px solid var(--line); border-radius:999px; color:var(--muted)}

.status-strip{
  height:64px;
  border-top:1px solid var(--line);
  padding:10px 12px;
  display:flex;
  gap:8px;
  align-items:center;
  overflow:auto;
}
.strip-title{font-weight:900; margin-right:6px; white-space:nowrap}
.status{
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--text);
  padding:10px 12px;
  border-radius:999px;
  font-weight:900;
  cursor:pointer;
  white-space:nowrap;
}
.status:hover{background:rgba(255,255,255,.06)}
.strip-hint{color:var(--muted); font-size:12px; margin-left:auto; white-space:nowrap}

.toast{
  position:fixed;
  left:50%;
  bottom:18px;
  transform:translateX(-50%);
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:999px;
  background:rgba(16,26,46,.85);
  backdrop-filter: blur(8px);
  color:var(--text);
  opacity:0;
  pointer-events:none;
  transition:opacity .18s ease;
}
.toast.show{opacity:1}

.dlg{border:none; padding:0; background:transparent}
.dlg::backdrop{background:rgba(0,0,0,.55)}
.dlg-inner{
  width:min(520px, 92vw);
  background:rgba(16,26,46,.96);
  border:1px solid var(--line);
  border-radius:18px;
  padding:14px;
  color:var(--text);
}
.dlg-inner h3{margin:0 0 10px 0}
.dlg-inner label{display:block; margin:10px 0 6px; color:var(--muted); font-size:13px}
.dlg-actions{display:flex; justify-content:flex-end; gap:10px; margin-top:14px}

@media (max-width: 980px){
  body{overflow:auto}
  .layout{grid-template-columns:1fr; height:auto}
  .right{height:70vh}
  .grid{grid-template-columns:1fr}
}

@media print {
  body{background:white;color:black; overflow:visible}
  .topbar,.status-strip,.sketch-tools,.toast,dialog{display:none !important}
  .layout{height:auto; grid-template-columns: 50% 50%}
  .grid{overflow:visible}
  textarea,.input,select{background:white;color:black}
  #sketch{background:white}
}
