:root {
  --sky: #11091B;
  --panel: #1E1127;
  --dusk: #63387B;
  --purple: #7615BF;
  --aurora: #B04FAA;
  --lilac: #BD94B8;
  --silver-white: #F8F7F8;
  --silver: #C3C2C5;
  --amber: #E0A458;
  --red: #EF4444;
  --green: #6FBF8E;
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Inter', system-ui, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--sky);
  color: var(--silver-white);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* Header */
.top {
  display: flex; align-items: center; gap: 24px;
  padding: 14px 24px;
  border-bottom: 1px solid color-mix(in srgb, var(--dusk) 50%, transparent);
  background: linear-gradient(90deg, rgba(99,56,123,.18), rgba(176,79,170,.08) 60%, transparent);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand img { filter: drop-shadow(0 0 10px rgba(118,21,191,.8)); }
.wordmark { font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: .02em;
  background: linear-gradient(180deg, #fff, var(--silver) 70%, #8d8b91);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { font-size: 12px; text-transform: uppercase; letter-spacing: .2em; color: var(--lilac); }
nav { display: flex; gap: 6px; flex: 1; }
nav a {
  color: var(--silver); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 8px 14px; border-radius: 999px; border: 1px solid transparent;
}
nav a:hover { color: var(--silver-white); }
nav a.active { color: var(--silver-white); border-color: var(--dusk); background: var(--panel);
  box-shadow: 0 0 14px rgba(176,79,170,.35); }
nav a.soon { opacity: .45; pointer-events: none; }
.conn { width: 10px; height: 10px; border-radius: 50%; background: var(--silver); opacity: .5; }
.conn.ok { background: var(--aurora); opacity: 1; box-shadow: 0 0 10px var(--aurora); }
.conn.bad { background: var(--red); opacity: 1; box-shadow: 0 0 12px var(--red); }

main { padding: 32px 24px 64px; max-width: 1100px; margin: 0 auto; }

/* Cards */
.card {
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  border: 1px solid color-mix(in srgb, var(--dusk) 60%, transparent);
  border-radius: 18px; padding: 24px;
}
.banner { border-radius: 12px; padding: 12px 16px; margin-bottom: 20px; font-size: 14px; }
.banner.bad { background: rgba(239,68,68,.12); border: 1px solid var(--red); color: #fecaca; }

/* DMs screen */
.dms-hero {
  position: relative; overflow: hidden; text-align: center;
  padding: 56px 24px 48px; border-radius: 22px;
  border: 1px solid color-mix(in srgb, var(--dusk) 70%, transparent);
  box-shadow: 0 0 40px rgba(118,21,191,.25);
}
.dms-hero::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background: url(assets/index-baggrund.webp) center / cover;
  opacity: .28;
}
.dms-hero::after {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background: radial-gradient(ellipse at 50% 30%, transparent, var(--sky) 85%);
}
.dms-hero > * { position: relative; z-index: 1; }
.label { font-size: 13px; text-transform: uppercase; letter-spacing: .22em; color: var(--lilac); }
.big {
  font-size: clamp(96px, 22vw, 200px); font-weight: 600; line-height: 1;
  margin: 12px 0 6px; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 30px rgba(176,79,170,.7), 0 0 80px rgba(118,21,191,.5);
}
.small-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.small-row .card { text-align: center; }
.mid { font-size: 52px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 6px; }
.foot { margin-top: 18px; font-size: 12px; color: var(--silver); text-align: center; opacity: .8; }

/* Setup screen */
.setup { max-width: 640px; margin: 40px auto; }
.setup h1 { font-family: var(--serif); font-weight: 600; font-size: 34px; margin: 0 0 8px; }
.setup p { color: var(--silver); line-height: 1.6; }
.btn {
  display: inline-block; margin-top: 12px; padding: 12px 22px; border-radius: 999px;
  background: var(--purple); color: var(--silver-white); text-decoration: none; font-weight: 600;
  box-shadow: 0 0 18px rgba(118,21,191,.6);
}

/* Network screen */
main:has(.net) { max-width: 1500px; }
.net-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.cmd-title {
  margin: 0; font-family: var(--serif); font-weight: 600; font-size: 26px;
  letter-spacing: .08em; text-transform: uppercase; color: var(--silver-white);
  text-shadow: 0 0 18px rgba(118,21,191,.7);
}
.cmd-title span { color: var(--aurora); }
.toggle, .pill {
  font: inherit; color: var(--silver-white); cursor: pointer;
  background: var(--panel); border: 1px solid var(--dusk); border-radius: 999px;
}
.toggle { padding: 9px 18px; font-size: 14px; font-weight: 500; white-space: nowrap; }
.toggle:hover { box-shadow: 0 0 14px rgba(176,79,170,.45); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px; font-size: 13px; color: var(--silver); }
.pill i { width: 9px; height: 9px; border-radius: 50%; background: radial-gradient(circle, #fff 0 20%, var(--c) 60%); box-shadow: 0 0 6px var(--c), 0 0 12px var(--c); }
.pill b { font-weight: 600; color: var(--silver-white); font-variant-numeric: tabular-nums; }
.pill.active { color: var(--silver-white); border-color: var(--c); box-shadow: 0 0 12px color-mix(in srgb, var(--c) 55%, transparent); }

.net-body { display: grid; grid-template-columns: 1fr 290px; gap: 16px; align-items: start; }
.map-wrap, .list-wrap { grid-column: 1; grid-row: 1; }
.map-wrap {
  position: relative; border-radius: 18px; overflow: hidden;
  border: 1px solid var(--dusk); box-shadow: 0 0 34px rgba(118,21,191,.3);
}
.map { height: min(72vh, 760px); background: var(--sky); isolation: isolate; }
.map .leaflet-tile-pane { filter: sepia(1) hue-rotate(228deg) saturate(2.6) brightness(.6) contrast(1.15); }
.map .map-labels { opacity: .75; pointer-events: none; }
.leaflet-container { font-family: var(--sans); }
/* Leaflet's own grey (#ddd) shows above/below the world on tall screens: make it night sky */
.map.leaflet-container { background: var(--sky); }
/* no white focus box when clicking a line or dot */
.leaflet-container path:focus, .leaflet-interactive:focus, .leaflet-marker-icon:focus { outline: none; }
.leaflet-control-zoom a { background: var(--panel) !important; color: var(--silver-white) !important; border-color: var(--dusk) !important; }
.leaflet-control-attribution { background: rgba(17,9,27,.75) !important; color: var(--silver) !important; }
.leaflet-control-attribution a { color: var(--lilac) !important; }

.tz-strip {
  position: absolute; z-index: 2; top: 0; left: 0; right: 0; height: 26px; cursor: pointer;
  background: rgba(14,7,22,.92);
  border-bottom: 1px solid color-mix(in srgb, var(--dusk) 70%, transparent);
  box-shadow: 0 1px 12px rgba(118,21,191,.25);
}
.tz-strip:hover { background: rgba(30,17,39,.95); }
.tz-strip span {
  position: absolute; top: 5px; transform: translateX(-50%); pointer-events: none;
  font-size: 11px; font-weight: 600; color: var(--lilac); font-variant-numeric: tabular-nums;
}
.tz-strip:hover span { color: var(--silver-white); }



/* Neon dots: white-hot core, coloured glow, a ring that pulses outwards */
.dot {
  position: relative; width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle, #fff 0 22%, var(--c) 55%);
  box-shadow: 0 0 3px #fff, 0 0 7px var(--c), 0 0 14px var(--c);
}
/* only the purple family pulses */
.dot.pulse { width: 14px; height: 14px; box-shadow: 0 0 4px #fff, 0 0 8px var(--c), 0 0 18px var(--c), 0 0 34px var(--c); animation: neon 2.4s ease-in-out infinite; }
.dot.pulse::after {
  content: ''; position: absolute; inset: -3px; border-radius: 50%;
  border: 1.5px solid var(--c); box-shadow: 0 0 8px var(--c);
  animation: ping 2.4s ease-out infinite;
}

/* Money / work lines */
.flow-hit { cursor: pointer; }
.flow { stroke-dasharray: 8 7; stroke-linecap: round; animation: flow 1.6s linear infinite; }
.flow-work { stroke-dasharray: 2 6; animation: none !important; }
.flow-contract { stroke-dasharray: 5 5; animation-duration: 2.6s; }
@keyframes flow { to { stroke-dashoffset: -15; } }
.flow-work { animation-name: flow-work; }
@keyframes flow-work { to { stroke-dashoffset: -10; } }
.flow-arrow {
  width: 0; height: 0; margin: 2px 0 0 2px;
  border-left: 8px solid var(--c); border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  filter: drop-shadow(0 0 4px var(--c));
}
.flow-legend {
  position: absolute; z-index: 5; left: 12px; bottom: 30px;
  display: flex; flex-direction: column; gap: 4px; padding: 8px 12px; border-radius: 10px;
  background: rgba(14,7,22,.82); border: 1px solid color-mix(in srgb, var(--dusk) 60%, transparent);
  font-size: 11px; color: var(--silver);
}
.flow-legend span { display: flex; align-items: center; gap: 8px; }
.flow-key { width: 22px; height: 0; border-top: 2.5px dashed var(--c); filter: drop-shadow(0 0 3px var(--c)); }
.flow-key-work { border-top-style: dotted; }
body.view-network .flow-legend { bottom: 34px; left: 18px; }
.dot.inner, .dot.pulse.inner { box-shadow: 0 0 4px #fff, 0 0 8px var(--c), 0 0 18px var(--c), 0 0 0 3px rgba(17,9,27,.9), 0 0 0 5px #D24DFF, 0 0 16px 5px #D24DFF; }
.dot.approx { opacity: .5; animation: none; }
.dot.approx::after { display: none; }
@keyframes neon {
  50% { box-shadow: 0 0 3px #fff, 0 0 5px var(--c), 0 0 10px var(--c), 0 0 20px var(--c); filter: brightness(.85); }
}
@keyframes ping { 0% { transform: scale(1); opacity: .9; } 100% { transform: scale(2.6); opacity: 0; } }

.hq { position: relative; width: 60px; height: 60px; }
.hq b {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%; background: radial-gradient(circle, #fff 0 20%, #B026FF 55%);
  box-shadow: 0 0 6px #fff, 0 0 14px #B026FF, 0 0 30px #B026FF;
}
.hq span {
  position: absolute; inset: 0; border-radius: 50%; border: 2px solid #B026FF; box-shadow: 0 0 10px #B026FF;
  opacity: 0; animation: radar 3s ease-out infinite;
}
.hq span:nth-child(2) { animation-delay: 1s; }
.hq span:nth-child(3) { animation-delay: 2s; }
@keyframes radar { 0% { transform: scale(.2); opacity: .9; } 100% { transform: scale(1); opacity: 0; } }

.leaflet-tooltip.mb-tip {
  background: var(--panel); color: var(--silver-white); border: 1px solid var(--dusk);
  border-radius: 10px; box-shadow: 0 0 14px rgba(118,21,191,.5); font-size: 13px;
}
.leaflet-tooltip.mb-tip::before { border-top-color: var(--dusk); border-bottom-color: var(--dusk); }
.leaflet-tooltip-left.mb-tip::before, .leaflet-tooltip-right.mb-tip::before { border-top-color: transparent; border-bottom-color: transparent; }
.leaflet-tooltip-left.mb-tip::before { border-left-color: var(--dusk); }
.leaflet-tooltip-right.mb-tip::before { border-right-color: var(--dusk); }

.clock { grid-column: 2; grid-row: 1; position: relative; padding: 20px; }
.clock-top { display: flex; align-items: center; gap: 12px; }
.flag { border-radius: 4px; box-shadow: 0 0 0 1px rgba(255,255,255,.15); flex: none; }
.flag.globe { display: grid; place-items: center; width: 40px; height: 30px; color: var(--lilac); font-size: 22px; }
.clock-city { font-family: var(--serif); font-size: 24px; font-weight: 600; line-height: 1.1; }
.clock-sub { font-size: 12px; color: var(--lilac); margin-top: 2px; }
.clock-time {
  font-size: 46px; font-weight: 600; margin-top: 16px; font-variant-numeric: tabular-nums;
  text-shadow: 0 0 20px rgba(176,79,170,.6);
}
.utc {
  position: absolute; top: 14px; right: 14px; font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 999px; border: 1px solid var(--aurora); color: var(--lilac);
}

.list-wrap { padding: 8px; overflow-x: auto; }
.people { width: 100%; border-collapse: collapse; font-size: 14px; }
.people th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--lilac); font-weight: 600; padding: 10px 12px; }
.people td { padding: 10px 12px; border-top: 1px solid color-mix(in srgb, var(--dusk) 45%, transparent); }
.people tbody tr { cursor: pointer; }
.people tbody tr:hover { background: rgba(176,79,170,.08); }
.people .num { font-variant-numeric: tabular-nums; }
.people a { color: var(--lilac); }
.swatch { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); box-shadow: 0 0 6px var(--c); margin-right: 9px; }
.tag { font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--dusk); color: var(--lilac); margin-left: 4px; }
.muted { color: var(--silver); opacity: .6; font-size: 12px; }

@media (max-width: 900px) {
  .net-body { grid-template-columns: 1fr; }
  .clock { grid-column: 1; grid-row: 1; }
  .map-wrap, .list-wrap { grid-row: 2; }
  .map { height: 62vh; }
  .cmd-title { font-size: 18px; }
}

/* Widget mode (borderless desktop program) */
body.widget { overflow-x: hidden; user-select: none; }
body.widget ::-webkit-scrollbar { width: 8px; }
body.widget ::-webkit-scrollbar-thumb { background: var(--dusk); border-radius: 8px; }
body.widget .top { cursor: grab; padding: 10px 12px; gap: 10px; }
body.widget .sub { display: none; }
body.widget .wordmark { font-size: 22px; }
body.widget main { padding: 16px 14px 28px; }
body.widget .cmd-title { font-size: 15px; letter-spacing: .06em; }
body.widget .toggle { padding: 6px 12px; font-size: 12px; }
body.widget .pills { gap: 6px; }
body.widget .pill { padding: 4px 10px; font-size: 12px; gap: 6px; }
body.widget .clock { padding: 14px 16px; }
body.widget .clock-time { font-size: 38px; margin-top: 10px; }
body.widget .people { font-size: 13px; }
body.widget .people th, body.widget .people td { padding: 8px; }
@media (max-width: 640px) {
  .people th:nth-child(5), .people td:nth-child(5) { display: none; }
}

/* Both widget windows fill exactly the window: no page scrolling */
html:has(body.widget), body.widget { height: 100%; overflow: hidden; }
body.widget { display: flex; flex-direction: column; }
body.widget .top { flex: none; flex-wrap: nowrap; }
body.widget main { flex: 1; min-height: 0; width: 100%; margin: 0; }

/* The small DM gadget: minimal */
body.view-dms .top { padding: 6px 8px 6px 12px; border-bottom: none; background: transparent; }
body.view-dms .brand img { width: 22px; height: 22px; }
body.view-dms .wordmark { font-size: 17px; }
body.view-dms .winbtns button { width: 24px; height: 24px; font-size: 12px; }
body.view-dms .wordmark { display: none; }
.winbtns { order: 2; }
.mini-clock { order: 1; display: flex; align-items: baseline; gap: 6px; pointer-events: none; min-width: 0; }
.mini-time { font-size: 17px; font-weight: 600; color: var(--silver-white); font-variant-numeric: tabular-nums; text-shadow: 0 0 10px rgba(176,79,170,.7); }
.mini-city { font-size: 11px; font-weight: 500; color: var(--lilac); max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.view-dms main { padding: 0 10px 10px; display: flex; flex-direction: column; max-width: none; }
body.view-dms .dms-hero {
  flex: 1; min-height: 0; padding: 6px; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
body.view-dms .label { font-size: 10px; letter-spacing: .2em; }
body.view-dms .big { font-size: min(44vh, 40vw); margin: 2px 0 0; }
body.view-dms .small-row { grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
body.view-dms .small-row .card { padding: 6px 8px; border-radius: 12px; display: flex; align-items: baseline; justify-content: center; gap: 8px; }
body.view-dms .mid { font-size: 20px; margin: 0; }
body.view-dms .foot { display: none; }
body.view-dms .banner { padding: 6px 10px; margin-bottom: 8px; font-size: 11px; }
body.view-dms .setup { margin: 0; padding: 14px; overflow: auto; }
body.view-dms .setup h1 { font-size: 22px; }
body.view-dms .setup p { font-size: 12px; }

/* The network window: full-screen map with panels floating on top */
body.view-network .top { padding: 8px 14px; background: #0B0612; border-bottom: 1px solid rgba(99,56,123,.35); backdrop-filter: none; }
body.view-network .tz-strip { background: #0B0612; border-bottom-color: rgba(99,56,123,.35); box-shadow: none; }
body.view-network main { padding: 0; max-width: none; position: relative; }
body.view-network .net, body.view-network .net-body { position: absolute; inset: 0; display: block; }
body.view-network .map-wrap { position: absolute; inset: 0; border-radius: 0; border: none; box-shadow: none; }
body.view-network .map { height: 100%; }
body.view-network .net-head { position: absolute; z-index: 10; top: 40px; left: 18px; right: 340px; margin: 0; justify-content: flex-start; }
body.view-network .cmd-title { font-size: 22px; }
body.view-network .pills { position: absolute; z-index: 10; top: 84px; left: 18px; right: 340px; margin: 0; }
body.view-network .pill { background: rgba(30,17,39,.82); backdrop-filter: blur(6px); }
body.view-network .clock { position: absolute; z-index: 10; top: 40px; right: 18px; width: 300px; background: rgba(30,17,39,.85); backdrop-filter: blur(8px); }
body.view-network .list-wrap { position: absolute; z-index: 10; top: 160px; left: 18px; right: 340px; bottom: 18px; overflow: auto; background: rgba(30,17,39,.92); }
body.view-network .net-foot { position: absolute; z-index: 10; left: 18px; bottom: 6px; margin: 0; text-align: left; text-shadow: 0 0 6px #000; }
.winbtns { display: flex; gap: 4px; margin-left: auto; }
.winbtns button {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid transparent;
  background: transparent; color: var(--silver); font: 14px var(--sans); cursor: pointer;
  display: grid; place-items: center; filter: grayscale(1);
}
.winbtns button:hover { background: var(--panel); border-color: var(--dusk); color: var(--silver-white); }
.winbtns button.on { filter: none; background: var(--panel); border-color: var(--aurora); box-shadow: 0 0 10px rgba(176,79,170,.5); }
.winbtns .x:hover { background: var(--red); border-color: var(--red); }
.grip {
  position: fixed; right: 0; bottom: 0; width: 18px; height: 18px; z-index: 2000; cursor: nwse-resize;
  background: linear-gradient(135deg, transparent 55%, var(--dusk) 55%, var(--dusk) 65%, transparent 65%, transparent 75%, var(--dusk) 75%, var(--dusk) 85%, transparent 85%);
}

@media (max-width: 640px) {
  .top { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
  nav { order: 3; flex-basis: 100%; }
  main { padding: 20px 16px 48px; }
  .small-row { grid-template-columns: 1fr; }
}
