/* ————————————————————————————————————————
   CDXP — clean, lean dashboard
   shadcn-style components on one token set, in the Trace style:
   pale lime #E9EDA4 and obsidian ink on chalk, with olive and sage tones.
   Components never use raw colors — every color is a token below.
   ———————————————————————————————————————— */

:root {
  --font: "Geist", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 8px;

  --bg: #FCFDF7;
  --card: #FFFFFF;
  --surface-2: #FAFBF4;
  --line: #E3E4DA;
  --line-soft: #EFF0E8;
  --line-strong: #D3D4C8;
  --ink: #1A1A1A;
  --text: #3A3A36;
  --muted: #6E6F64;
  --faint: #9A9B8F;
  --shadow-rgb: 26, 26, 20;
  --overlay: rgba(26, 26, 26, .42);

  --primary: #1A1A1A;
  --primary-hover: #33332F;
  --on-primary: #F8FAEF;
  --btn-icon: #E9EDA4;

  --accent: #E9EDA4;
  --accent-hover: #CCCB6E;
  --on-accent: #1A1A1A;
  --accent-soft: #F3F5D2;
  --accent-line: #E6E9BE;
  --accent-deep: #726E42;
  --link-line: #CCCB6E;
  --focus-border: #8D9054;
  --focus-ring: rgba(204, 203, 110, .45);

  --hero-bg: #E9EDA4;
  --hero-line: transparent;
  --hero-ink: #1A1A1A;
  --hero-sub: #4A4B33;
  --hero-eyebrow: #5F6038;
  --band: #1A1A1A;

  --ok-bg: #E9EDA4;   --ok-fg: #1A1A1A;
  --warn-bg: #ECEAE5; --warn-fg: #474747;
  --info-bg: #ECECEC; --info-fg: #474747;
  --danger: #C2412D;  --danger-soft: #F7E3DE;
  --danger-hover: #A8371F; --on-danger: #FFFFFF;

  --chip-bg: #F1F2EA; --chip-fg: #474747;

  --grid-dot: rgba(26, 26, 26, .1);
  --wire: rgba(26, 26, 26, .16);
  --route: #1A1A1A;
  --dot: #1A1A1A;
  --dot-halo: #E9EDA4;
  --hub-bg: #1A1A1A;
  --hub-fg: #E9EDA4;

  --k-ev-bg: #E9EDA4;    --k-ev-fg: #1A1A1A;
  --k-prop-bg: #ECECEC;  --k-prop-fg: #474747;
  --k-cat-bg: #ECEAE5;   --k-cat-fg: #5B574D;
  --k-imp-line: #D6D7CB; --k-imp-fg: #474747;
  --k-exp-bg: #474747;   --k-exp-fg: #F8FAEF;

  --switch-off: #D9DACE; --switch-on: #1A1A1A;
  --knob: #FFFFFF;       --knob-on: #E9EDA4;

  --toast-bg: #1A1A1A; --toast-fg: #F8FAEF; --toast-dot: #E9EDA4;
  --badge-bg: #1A1A1A; --badge-fg: #E9EDA4;

  --bar: #1A1A1A;
  --meter: #8D9054;

  --side-bg: #F8FAEF;
  --side-hover: #FFFFFF;
  --wordmark: #1A1A1A;
  --menu-fg: #6E6F64;
  --menu-fg-hover: #1A1A1A;
  --menu-hover-bg: #F3F5D2;
  --menu-active-bg: #E9EDA4;
  --menu-active-fg: #1A1A1A;
  --ai-bg: #E9EDA4;
  --ai-fg: #1A1A1A;
  --ai-hover: #CCCB6E;

  /* color slots for source tiles, avatars and action icons */
  --tile-1-bg: #ECECEC; --tile-1-fg: #1A1A1A;
  --tile-2-bg: #E9EDA4; --tile-2-fg: #1A1A1A;
  --tile-3-bg: #B6B1A8; --tile-3-fg: #1A1A1A;
  --tile-4-bg: #1A1A1A; --tile-4-fg: #E9EDA4;
  --tile-5-bg: #8D9054; --tile-5-fg: #F8FAEF;
  --tile-6-bg: #CCCB6E; --tile-6-fg: #1A1A1A;
  --tile-7-bg: #474747; --tile-7-fg: #F8FAEF;
  --tile-8-bg: #726E42; --tile-8-fg: #F8FAEF;
  --tile-9-bg: #A0A164; --tile-9-fg: #1A1A1A;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  display: flex;
  min-height: 100vh;
  background-color: var(--bg);
  background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1.3px);
  background-size: 16px 16px;
  color: var(--text);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 6px; }

.num { font-variant-numeric: tabular-nums; }

/* ———— Sidebar (Unscribe menu structure) ———— */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 64px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  background-color: var(--side-bg);
  border-right: 1px solid var(--line);
  transition:
    background-color 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    border-right-color 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transition-delay: 0.03s;
  z-index: 10;
}

.sidebar:hover {
  background-color: var(--side-hover);
  transition-delay: 0s;
}

/* top-left corner: the Kvarts mark in a cell as tall as the top bar */
.side-top { display: flex; flex-direction: column; align-items: center; width: 100%; }

.brand {
  display: grid;
  place-items: center;
  width: 100%;
  height: 64px;
  border-bottom: 1px solid var(--line);
  color: var(--wordmark);
}

.wordmark {
  margin-top: 24px;
  writing-mode: vertical-rl;
  color: var(--wordmark);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-decoration: none;
}

.menu {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.menu-list {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
}

.menu-item {
  width: 100%;
  aspect-ratio: 1 / 1;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  color: var(--menu-fg);
  transition: color 0.18s ease, background-color 0.18s ease;
}

.menu-item > svg { min-width: 20px; height: 20px; position: relative; z-index: 1; }

.menu-item-link {
  display: flex;
  width: 100%;
  height: 100%;
  justify-content: center;
  align-items: center;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

.menu-item:hover { color: var(--menu-fg-hover); }

/* hover and current section: a small rounded tile behind the icon */
.menu-item::before {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 10px;
  background: transparent;
  transition: background-color 0.18s ease;
}

.menu-item:hover::before { background: var(--menu-hover-bg); }

.menu-item.active { color: var(--menu-active-fg); }
.menu-item.active::before { background: var(--menu-active-bg); }

/* invisible hover bridge between the item and its flyout */
.menu-item:hover::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 8px solid transparent;
}

.menu-item:hover .menu-item-content,
.menu-item:focus-within .menu-item-content {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(calc(100% + 10px), -50%) scale(0.98);
}

/* after a click in the flyout it stays closed until the pointer leaves the item */
.menu-item.menu-closed .menu-item-content {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.menu-item-content {
  display: flex;
  flex-direction: column;
  position: absolute;
  right: 0;
  left: auto;
  top: 50%;
  bottom: auto;
  min-width: 200px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  transform: translate(calc(100% + 12px), -50%) scale(0.98);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform-origin: left center;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 34px -14px rgba(var(--shadow-rgb), .28);
}

.menu-item-title {
  font: 500 10px var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 10px 9px;
  margin-bottom: 4px;
  cursor: default;
}

.submenu-list { list-style: none; margin: 0; padding: 0; }

.submenu-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px;
  font: 400 13.5px var(--font);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  background: none;
  border: none;
  border-radius: 6px;
}

.submenu-item:hover .submenu-link { background: var(--menu-hover-bg); }

/* bottom block: last item is the AI square, flyouts anchor upward */
.menu-bottom .menu-list .menu-item:last-child {
  background-color: var(--ai-bg);
  color: var(--ai-fg);
}

.menu-bottom .menu-list .menu-item:last-child:hover {
  background-color: var(--ai-hover);
  color: var(--ai-fg);
}

.menu-bottom .menu-list .menu-item:last-child::before { content: none; }

.menu-bottom .menu-list .menu-item:last-child .menu-item-content {
  top: auto;
  bottom: 10px;
  transform: translate(calc(100% + 12px), 0) scale(0.98);
  transform-origin: left bottom;
}

.menu-bottom .menu-list .menu-item:last-child:hover .menu-item-content {
  transform: translate(calc(100% + 10px), 0) scale(0.98);
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
}

/* ———— Shell / top bar ———— */

.shell {
  flex: 1;
  margin-left: 64px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 9;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background: var(--side-bg);
  border-bottom: 1px solid var(--line);
}

.crumbs { font-size: 13px; color: var(--muted); }
.crumb-sep { margin: 0 9px; color: var(--line-strong); }
.crumb-here { color: var(--ink); font-weight: 500; }

.top-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  position: relative;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.icon-btn:hover { background: var(--line-soft); color: var(--ink); }

.icon-btn-danger { border: 1px solid var(--line); border-radius: 6px; background: var(--card); }
.icon-btn-danger:hover { border-color: var(--danger-soft); background: var(--danger-soft); color: var(--danger); }

.badge {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--badge-bg);
  color: var(--badge-fg);
  font-size: 9.5px;
  font-weight: 700;
  display: grid;
  place-items: center;
  box-shadow: 0 0 0 2px var(--bg);
}

.badge::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 999px;
  border: 2px solid var(--badge-bg);
  animation: ping 3.2s ease-out infinite;
}

.badge[hidden] { display: none; }

@keyframes ping {
  0%        { transform: scale(.6); opacity: .6; }
  35%, 100% { transform: scale(1.9); opacity: 0; }
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 13px/1 var(--font);
  cursor: pointer;
  margin-left: 4px;
}

/* ———— Content / pages ———— */

.content {
  width: 100%;
  padding: 16px 40px 72px;
}

.page { display: none; }
.page.active { display: block; }

.page.active .anim {
  animation: rise .5s cubic-bezier(.22, .9, .3, 1) both;
  animation-delay: calc(var(--i, 0) * 55ms);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 24px 0 24px;
}

h1 {
  margin: 0 0 6px;
  font-size: 28px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.035em;
  color: var(--ink);
}

.lede {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  max-width: 500px;
}

.head-actions { display: flex; gap: 10px; flex-shrink: 0; }

.eyebrow {
  margin: 0 0 12px;
  font: 500 10.5px var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

/* Simulation hero: a colored field with a living band of dashes (drawn by buildBand in app.js) */

.hero {
  position: relative;
  overflow: hidden;
  min-height: 172px;
  padding: 30px 32px;
  margin: 24px 0 16px;
  background: var(--hero-bg);
  border: 1px solid var(--hero-line);
  border-radius: 12px;
}

.hero-copy { position: relative; z-index: 1; max-width: 470px; }

.hero h1 { color: var(--hero-ink); }
.hero .lede { color: var(--hero-sub); }
.hero .eyebrow { color: var(--hero-eyebrow); }

.hero-band {
  position: absolute;
  top: 0;
  right: 0;
  width: 60%;
  height: 100%;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 38%);
  mask-image: linear-gradient(90deg, transparent, #000 38%);
}

/* ———— Controls ———— */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  border: none;
  border-radius: 6px;
  background: var(--primary);
  color: var(--on-primary);
  font: 500 13.5px/1 var(--font);
  box-shadow: 0 1px 2px rgba(var(--shadow-rgb), .08);
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}

.btn svg { color: var(--btn-icon); }
.btn:hover { background: var(--primary-hover); }
.btn:active { transform: scale(.97); }

.btn-outline {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-outline:hover { background: var(--line-soft); }

.btn-danger { background: var(--danger); color: var(--on-danger); }
.btn-danger:hover { background: var(--danger-hover); }

.search { position: relative; display: inline-flex; }

.search input {
  height: 36px;
  width: 230px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  padding: 0 36px 0 13px;
  font: 400 13.5px var(--font);
  color: var(--ink);
  outline: none;
  box-shadow: 0 1px 2px rgba(var(--shadow-rgb), .04);
  transition: border-color .15s ease, box-shadow .15s ease;
}

.search input::placeholder { color: var(--faint); }

.search input:focus {
  border-color: var(--focus-border);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.search svg {
  position: absolute;
  right: 12px;
  top: 50%;
  translate: 0 -50%;
  color: var(--faint);
  pointer-events: none;
}

.text-link {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--link-line);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.text-link:hover { text-decoration-color: var(--ink); }

/* ———— Cards ———— */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(var(--shadow-rgb), .04);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

h2 { margin: 0; font-size: 16px; font-weight: 500; letter-spacing: -0.015em; color: var(--ink); }

.card-sub { margin: 4px 0 0; font-size: 12.5px; color: var(--muted); }

/* ———— Simulation (network stage straight on the dotted page) ———— */

.sim {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  margin: 4px 0 30px;
}

.net { display: flex; justify-content: center; min-width: 0; }

/* campaign picker in the top-left corner */

.sim-pick-label { display: block; margin-bottom: 6px; font-size: 12.5px; font-weight: 500; color: var(--ink); }

.sim-pick-row { display: flex; gap: 8px; }
.sim-pick-row .sim-select { flex: 1; min-width: 0; height: 38px; cursor: pointer; }

/* play-again sits on the value box's top-right corner; faded until a case has finished */
/* play-again sits at the end of the Case row and only shows once a run has finished */
.sim-replay {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 6px 14px -6px rgba(var(--shadow-rgb), .35);
  cursor: pointer;
  transition: background .15s ease;
}

.sim-replay[hidden] { display: none; }
.sim-replay svg { width: 16px; height: 16px; }
.sim-replay:hover { background: var(--accent-hover); }

/* no case chosen: a sketched arrow from "START" up to the dropdown, drawn on when the page loads */
.sim-start { position: relative; width: 100%; max-width: 300px; margin-top: -6px; color: var(--ink); }
.sim-start svg { display: block; width: 100%; height: auto; }
.sim-start-word { position: absolute; left: 0; bottom: 8px; font: 600 14px var(--mono); letter-spacing: .22em; }
.sim-start-line { stroke-dasharray: 140; stroke-dashoffset: 140; animation: sim-draw .9s ease-out .2s forwards; } /* dash set to the real length by JS */
.sim-start-line.ghost { opacity: .22; }
.sim-start-head { opacity: 0; animation: sim-fade .2s ease-out 1.05s forwards; }

@keyframes sim-draw { to { stroke-dashoffset: 0; } }
@keyframes sim-fade { to { opacity: 1; } }

.sim-info { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; margin-top: 16px; }

.sim-hint,
.sim-desc { margin: 0; font-size: 13px; line-height: 1.55; }
.sim-hint { color: var(--muted); }
.sim-desc { color: var(--text); }

/* the case's full example text, under the "Åbn casen" link, with its own small heading */
.sim-info .sim-example-label { margin-top: 18px; } /* .sim-info beats the generic .m-label reset */
.sim-example { margin: -4px 0 0; font-size: 13px; line-height: 1.6; color: var(--text); }

/* nodes for a newly chosen campaign fade in */

.net-node.fresh,
.net-lab.fresh,
.net-col.fresh { animation: net-in .45s ease both; }

@keyframes net-in { from { opacity: 0; } }

.net-sc { transform-origin: top left; }

.net-stage {
  position: relative;
  width: 1040px;
  height: 560px;
}

.net-wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* no lines until a connection is used; then it stays as a trail */
.net-wires path {
  fill: none;
  stroke: var(--wire);
  stroke-width: 1.2;
  opacity: 0;
  transition: opacity .35s ease;
}

.net-wires path.used { opacity: 1; }

.net-wires path.lit-g,
.net-wires path.lit-r {
  stroke-width: 1.8;
  stroke-dasharray: 1 5;
  stroke-linecap: round;
  animation: march .7s linear infinite;
}

.net-wires path.lit-g { stroke: var(--route); stroke-opacity: .85; }
.net-wires path.lit-r { stroke: var(--danger); stroke-opacity: .85; animation-direction: reverse; }

@keyframes march { to { stroke-dashoffset: -12; } }

.net-node {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(var(--shadow-rgb), .06);
  transition: box-shadow .25s ease, border-color .25s ease, opacity .4s ease;
  z-index: 2;
}

/* sources, events and channels the chosen campaign doesn't use */
.net-node.dim,
.net-lab.dim { opacity: .15; }

/* sources: the whole square in the source's colour, with its icon */
.nn-src { width: 54px; height: 54px; border-radius: 13px; border-color: transparent; }
.nn-src svg { width: 22px; height: 22px; }

.nn-hub {
  width: 84px;
  height: 84px;
  border-radius: 20px;
  z-index: 3;
  background: var(--hub-bg);
  border-color: var(--hub-bg);
  color: var(--hub-fg);
  font: 600 15px var(--font);
  letter-spacing: .06em;
}

.nn-act { width: 54px; height: 54px; border-radius: 13px; color: var(--ink); }
.nn-act svg { width: 22px; height: 22px; }

/* column 2: the events of the source in play */
.nn-ev {
  gap: 7px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  font: 500 10.5px var(--mono);
  color: var(--ink);
  white-space: nowrap;
}

.nn-ev .ev-dot { width: 7px; height: 7px; }
.nn-ev.on { border-color: var(--ink); box-shadow: 0 0 0 3px var(--accent); }

/* the value box: where the flow ends, a made-up user and what the campaign gave them */
.net-value {
  position: absolute;
  width: 236px;
  transform: translateY(-50%);
  z-index: 4;
}

.nv-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 22px 18px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--surface-2);
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  transition: border-color .25s ease, box-shadow .25s ease;
}

.nv-empty p { margin: 0; }

.nv-empty-ic {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--line-soft);
  color: var(--faint);
}

.nv-card {
  padding: 14px 15px 13px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 34px -14px rgba(var(--shadow-rgb), .28);
  transition: border-color .25s ease, box-shadow .25s ease;
}

.net-value.show .nv-card { animation: nv-pop .5s cubic-bezier(.2, .9, .3, 1.2) both; }

@keyframes nv-pop {
  from { opacity: 0; transform: scale(.88); }
  to   { opacity: 1; transform: none; }
}

.net-value.pulse .nv-empty,
.net-value.pulse .nv-card { border-color: var(--route); box-shadow: 0 0 0 5px var(--dot-halo); }

.nv-head { display: flex; align-items: center; gap: 11px; margin-bottom: 12px; }

.nv-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--accent);
}

.nv-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }

.nv-initials {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 15px var(--font);
}

.nv-name { margin: 0; font-size: 14px; font-weight: 500; color: var(--ink); }
.nv-meta { margin: 1px 0 0; font-size: 11.5px; color: var(--muted); }

.nv-label {
  margin: 0 0 4px;
  font: 500 9.5px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-deep);
}

.nv-text { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--text); }

.nv-got {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 11px 0 0;
  padding: 7px 9px;
  border-radius: 8px;
  background: var(--chip-bg);
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--ink);
}

.nv-got svg { width: 15px; height: 15px; flex-shrink: 0; }

/* on a case page the card sits inside another card: a soft background instead of a border and shadow,
   like the persona strip on the Cases cards — and a darker tag so it still reads on that background */
#cd-persona .nv-card { background: var(--surface-2); border-color: var(--line-soft); box-shadow: none; }
#cd-persona .nv-got { background: var(--line); }

.net-lab {
  position: absolute;
  transform: translate(-50%, 0);
  font: 500 8.5px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  z-index: 2;
  transition: opacity .4s ease;
}

.src-lab { width: 104px; white-space: normal; text-align: center; line-height: 1.35; }

.net-col {
  position: absolute;
  transform: translate(-50%, 0);
  font: 600 9.5px var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.net-node.pulse-g { border-color: var(--route); box-shadow: 0 0 0 5px var(--dot-halo); }
.net-node.pulse-r { border-color: var(--danger); box-shadow: 0 0 0 5px var(--danger-soft); }

.net-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dot);
  box-shadow: 0 0 0 3px var(--dot-halo);
  transform: translate(-50%, -50%);
  opacity: 0;
  z-index: 5;
}

.net-dot.red { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }

/* the caption — what happens in the animation right now — sits in the case column, under the example text */
.net-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  width: 100%;
  max-width: 300px;
  margin-top: 18px;
  padding: 10px 14px 11px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12.5px;
  color: var(--ink);
  box-shadow: 0 8px 22px rgba(var(--shadow-rgb), .07);
}

.net-chip[hidden] { display: none; }
.net-chip b { font-weight: 500; line-height: 1.4; }
.net-sub { margin: -3px 0 0; font-size: 12px; line-height: 1.45; color: var(--muted); }

.net-chip .st {
  font: 600 9px var(--mono);
  letter-spacing: .07em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 3px 8px;
}

.net-chip .st.ok { background: var(--ok-bg); color: var(--ok-fg); }
.net-chip .st.no { background: var(--danger-soft); color: var(--danger); }
.net-chip .st.idle { background: var(--chip-bg); color: var(--chip-fg); }

/* data sources / events / actions panels */

.sim-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.sim-grid .card-head .text-link { white-space: nowrap; }

.tile.xs { width: 20px; height: 20px; border-radius: 6px; }

/* the Events panel is an event log (see .ev-row); the row the dot is on lights up */
#sim-events .ev.lit > .ev-row { background: var(--accent-soft); border-radius: 6px; }
.sim-grid .ev.open .ev-props { grid-template-columns: minmax(0, 1fr); }
.ev-attrs { grid-column: 1 / -1; display: flex; flex-wrap: wrap; }

.sima {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 2px;
  border-radius: 4px;
  transition: background .25s ease, box-shadow .25s ease;
}

.sima:not(:first-child) { border-top: 1px solid var(--line-soft); }

.sima-ic {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.sima-ic svg { width: 17px; height: 17px; }
.sima .status { margin-left: auto; flex-shrink: 0; }

.sima-name { margin: 0; font-size: 13px; font-weight: 500; color: var(--ink); }
.sima-desc { margin: 1px 0 0; font-size: 11.5px; color: var(--muted); }

.sima.lit {
  background: var(--accent-soft);
  box-shadow: 0 0 0 6px var(--accent-soft);
}

/* ———— Tiles (source icons) ———— */

.tile {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.tile.sm {
  width: 26px;
  height: 26px;
  border-radius: 8px;
}

.tile svg { width: 56%; height: 56%; }

/* ———— Table ———— */

.table-card { padding: 4px 0 2px; overflow: hidden; }

.table { width: 100%; border-collapse: collapse; }

.table th {
  text-align: left;
  font: 500 10.5px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 22px;
  border-bottom: 1px solid var(--line-soft);
}

.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: inherit;
  cursor: pointer;
  transition: color .15s ease;
}

.th-sort:hover { color: var(--ink); }

.th-sort .c-up, .th-sort .c-dn { opacity: .45; transition: opacity .15s ease; }
.th-sort.asc  { color: var(--ink); }
.th-sort.desc { color: var(--ink); }
.th-sort.asc  .c-up { opacity: 1; }
.th-sort.asc  .c-dn { opacity: .18; }
.th-sort.desc .c-dn { opacity: 1; }
.th-sort.desc .c-up { opacity: .18; }

.table td {
  padding: 15px 22px;
  border-top: 1px solid var(--line-soft);
  font-size: 13.5px;
  color: var(--text);
}

.table tbody tr:first-child td { border-top: 0; }

.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: var(--surface-2); }

.sw { display: flex; align-items: center; gap: 12px; }
.sw-name { margin: 0; font-size: 13.5px; font-weight: 500; color: var(--ink); }
.sw-cat  { margin: 1px 0 0; font-size: 12px; color: var(--muted); }

.cell-muted { color: var(--muted); }
.cell-desc { font-size: 13px; line-height: 1.5; color: var(--text); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag-link { text-decoration: none; transition: filter .15s ease; }
.tag-link:hover { filter: brightness(.94); }

/* whose data a source carries */
.p-zero  { color: var(--k-ev-fg);   background: var(--k-ev-bg); }
.p-first { color: var(--k-prop-fg); background: var(--k-prop-bg); }
.p-third { color: var(--k-exp-fg);  background: var(--k-exp-bg); }

.empty-row td {
  padding: 32px 22px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ———— Status pills ———— */

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 11px;
  border-radius: 999px;
  white-space: nowrap;
}

.status .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.st-ok,
.st-run   { color: var(--ok-fg); background: var(--ok-bg); }
.st-sync,
.st-pause { color: var(--warn-fg); background: var(--warn-bg); }
.st-sched { color: var(--info-fg); background: var(--info-bg); }
.st-draft { color: var(--muted); background: transparent; box-shadow: inset 0 0 0 1px var(--line); }

.st-sync .dot { animation: pulse-dot 1.6s ease-out infinite; }

@keyframes pulse-dot {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 35%, transparent); }
  70%  { box-shadow: 0 0 0 6px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* ———— Campaigns ———— */

.list-meta {
  margin: -8px 0 14px;
  font: 500 10.5px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.camp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.camp {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 20px 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1px 2px rgba(var(--shadow-rgb), .04);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.camp:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: 0 10px 22px -12px rgba(var(--shadow-rgb), .22);
}

.camp-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--chip-fg);
  background: var(--chip-bg);
  padding: 3px 9px;
  border-radius: 6px;
}

.camp h3 { margin: 0 0 4px; font-size: 15.5px; font-weight: 500; letter-spacing: -0.015em; color: var(--ink); }

.camp-desc { margin: 0 0 16px; font-size: 13px; color: var(--muted); }

/* the case's person and what they got — the story in one glance */
.camp-persona {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--surface-2);
}

.cp-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--accent);
}

.cp-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }

.cp-initials {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 12.5px var(--font);
}

.cp-text { min-width: 0; }

.cp-name { margin: 0; font-size: 13px; font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-meta { font-weight: 400; color: var(--muted); }

.cp-got {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  margin: 3px 0 0;
  font-size: 12.5px;
  line-height: 1.35;
  color: var(--text);
}

.cp-got svg { display: inline-block; width: 14px; height: 14px; margin-right: 5px; vertical-align: -2px; color: var(--accent-deep); }

.m-label {
  margin: 0;
  font: 500 10px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.m-value {
  margin: 3px 0 0;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.camp footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line-soft);
  padding-top: 12px;
  margin-top: auto;
}

.src-stack { display: flex; }

.src-stack .tile.sm {
  margin-right: -7px;
  box-shadow: 0 0 0 2px var(--card);
}

.src-stack .tile.sm:last-child { margin-right: 0; }


.camp-open {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--line-soft);
  color: var(--muted);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background .15s ease, color .15s ease;
}

.camp-open:hover,
.camp:hover .camp-open { background: var(--accent); color: var(--on-accent); }

/* ———— Campaign detail ———— */

.camp-back { display: inline-block; margin-bottom: 8px; font-size: 12px; }
.cd-sim { display: inline-block; margin-top: 10px; } /* same link as "Åbn casen" in the simulation, pointing back */

.cd-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
  align-items: start;
}

/* Sources and Events side by side, the same width — each keeps its own height */
.cd-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 14px; align-items: start; }

.cd-value {
  margin: 5px 0 0;
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.035em;
  color: var(--ink);
}

.cd-src { display: flex; align-items: center; gap: 11px; padding: 9px 0; }
.cd-src + .cd-src { border-top: 1px solid var(--line-soft); }

.cd-about-label {
  margin: 0 0 6px;
  font: 500 10.5px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.cd-about-text {
  margin: 0 0 18px;
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}

.cd-about-text:last-child { margin-bottom: 2px; }

/* case example timeline: each step with the tile of the system that does it, joined by a line */
.cd-timeline { list-style: none; margin: 0 0 18px; padding: 0; }

.cd-timeline li { position: relative; padding-bottom: 14px; }

.cd-timeline li:last-child { padding-bottom: 0; }

/* a step is a button: click it to see its event in the log */
.tl-step {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  column-gap: 12px;
  width: calc(100% + 12px);
  margin: -4px -6px;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease;
}

.tl-step:hover:not(:disabled) { background: var(--surface-2); }
.tl-step.on { background: var(--accent-soft); }
.tl-step:disabled { cursor: default; }

/* the row a timeline step points at */
.ev.hit > .ev-row { background: var(--accent-soft); border-radius: 6px; animation: hit-in .9s ease; }

@keyframes hit-in {
  from { box-shadow: 0 0 0 4px var(--accent); }
  to   { box-shadow: 0 0 0 0 transparent; }
}

.cd-timeline li:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 12.5px;
  top: 30px;
  bottom: 4px;
  width: 1px;
  background: var(--line-strong);
}

.tile.tl-hub { background: var(--hub-bg); color: var(--hub-fg); }

.tl-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 4px 0 2px; }
.tl-title { font-size: 13px; font-weight: 500; color: var(--ink); }
.tl-ev { font: 500 10.5px var(--mono); color: var(--muted); white-space: nowrap; }
.tl-text { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--text); }

/* ———— Dialogs (shadcn) ———— */

body.modal-open { overflow: hidden; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  animation: fadeIn .15s ease;
}

.modal-overlay[hidden] { display: none; }

.modal {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 18px 50px -14px rgba(var(--shadow-rgb), .3);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: modalIn .18s cubic-bezier(.22, .9, .3, 1);
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 20px 22px 14px;
}

.modal-body {
  padding: 2px 22px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--line-soft);
  margin-top: 10px;
}

.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 0; }

.field > span { font-size: 12.5px; font-weight: 500; color: var(--ink); }

.field input,
.field select,
.field textarea,
.sim-select {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  font: 400 13.5px var(--font);
  color: var(--ink);
  padding: 8px 11px;
  outline: none;
  box-shadow: 0 1px 2px rgba(var(--shadow-rgb), .04);
  transition: border-color .15s ease, box-shadow .15s ease;
  width: 100%;
}

.field input::placeholder,
.field textarea::placeholder { color: var(--faint); }

.field textarea { resize: vertical; min-height: 56px; line-height: 1.55; }

/* our own chevron, set in from the edge instead of the browser's arrow */
.field select,
.sim-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236E6F64' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 14px;
  cursor: pointer;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.sim-select:focus {
  border-color: var(--focus-border);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.field-row { display: flex; gap: 12px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* ———— Customer profile ———— */

.profile-id { display: flex; align-items: center; gap: 16px; }
.profile-id .lede { max-width: none; }

.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 17px var(--font);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin: -6px 0 20px;
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 10px 14px;
  font: 500 13.5px var(--font);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease;
}

.tab:hover { color: var(--ink); }

.tab.active {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.panel-tools { margin-bottom: 10px; }

.search-sm { display: flex; width: 100%; }
.search-sm input { width: 100%; height: 34px; font-size: 13px; }

/* attribute groups (left panel) */

.attr-group { border-top: 1px solid var(--line-soft); }
.attr-group:first-child { border-top: 0; }

.attr-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  padding: 11px 2px;
  font: 500 12.5px var(--font);
  color: var(--ink);
  cursor: pointer;
}

.attr-group-head .chev { color: var(--faint); transition: transform .18s ease; }
.attr-group.open .attr-group-head .chev { transform: rotate(90deg); }

.attr-count {
  margin-left: auto;
  font: 500 10.5px var(--mono);
  color: var(--muted);
  background: var(--line-soft);
  padding: 2px 8px;
  border-radius: 999px;
}

.attr-rows { display: none; padding: 0 2px 12px; }
.attr-group.open .attr-rows { display: block; }

.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6.5px 0;
  font-size: 13px;
}

.kv-k { color: var(--muted); }
.kv-v { color: var(--ink); font-weight: 500; text-align: right; overflow-wrap: anywhere; }

.empty-note { padding: 18px 2px; color: var(--muted); font-size: 13px; }

/* event timeline (right panel) */

.ev-date {
  font: 500 10.5px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 16px 2px 8px;
  border-bottom: 1px solid var(--line-soft);
}

.ev { border-bottom: 1px solid var(--line-soft); }

.ev-row {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  background: none;
  border: none;
  padding: 12px 2px;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.ev-row:hover .ev-name { color: var(--accent-deep); }

/* an event's dot has its source's tile colour; the faint ring keeps the light ones visible */
.ev-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(var(--shadow-rgb), .22); }
.ev-dot.cdxp { box-shadow: inset 0 0 0 2px var(--hub-bg); } /* CDXP's own events: lime with a black ring, like the hub */

.ev-name {
  font: 500 12.5px var(--mono);
  color: var(--ink);
  white-space: nowrap;
}

.ev-sum {
  flex: 1;
  color: var(--muted);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ev-time { color: var(--muted); font-size: 12px; white-space: nowrap; }

.ev-chev { color: var(--faint); transition: transform .18s ease; flex-shrink: 0; }
.ev.open .ev-chev { transform: rotate(90deg); }

.ev-props {
  display: none;
  margin: 0 2px 13px 19px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
}

.ev.open .ev-props {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 28px;
}

.ev-props .kv { padding: 4px 0; font-size: 12.5px; }

.cd-pair .ev.open .ev-props { grid-template-columns: minmax(0, 1fr); } /* one column in the narrower case card */

/* ———— Events (catalog by category) ———— */

.ev-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 28px; }

.ev-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font: 500 13px var(--font);
  color: var(--text);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}

.ev-filter-btn span { font-size: 11.5px; color: var(--muted); }
.ev-filter-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.ev-filter-btn.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.ev-filter-btn.on span { color: var(--on-accent); }

.ev-cat + .ev-cat { margin-top: 34px; }

.ev-cat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }

.ev-cat-head h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.ev-cat-head .card-sub { margin: 2px 0 0; }
.ev-cat-head .src-stack { margin-left: auto; }

.ev-cat-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
  flex-shrink: 0;
}

.ev-cat-icon.hub { background: var(--hub-bg); color: var(--hub-fg); } /* CDXP's own events */

.ev-cat-count {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--chip-bg);
  font: 500 11px var(--mono);
  color: var(--muted);
}

.ev-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

.evc {
  display: flex;
  flex-direction: column;
  padding: 18px 18px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(var(--shadow-rgb), .04);
}

.evc-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.kind {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.k-ev   { color: var(--k-ev-fg); background: var(--k-ev-bg); }
.k-prop { color: var(--k-prop-fg); background: var(--k-prop-bg); }
.k-cat  { color: var(--k-cat-fg); background: var(--k-cat-bg); }
.k-imp  { color: var(--k-imp-fg); background: transparent; box-shadow: inset 0 0 0 1px var(--k-imp-line); }
.k-exp  { color: var(--k-exp-fg); background: var(--k-exp-bg); }

.evc-trig { font-size: 11.5px; color: var(--accent-deep); white-space: nowrap; }

.evc-name { margin: 0 0 4px; font: 500 14px var(--mono); color: var(--ink); overflow-wrap: anywhere; }

.evc-desc { margin: 0 0 14px; font-size: 13px; color: var(--muted); }

.evc-attrs { display: flex; flex-wrap: wrap; margin-bottom: 10px; }

.chip-attr {
  font: 500 11px var(--mono);
  color: var(--chip-fg);
  background: var(--chip-bg);
  padding: 3px 8px;
  border-radius: 6px;
  margin: 0 4px 4px 0;
}

.evc-none { font-size: 12px; color: var(--muted); }

.evc footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

.evc-src { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12.5px; color: var(--text); }
.evc-time { font-size: 12px; color: var(--muted); white-space: nowrap; }

.evc.flash { animation-name: flash-card; }

@keyframes flash-card {
  0%, 30% { background: var(--accent-soft); }
  100%    { background: var(--card); }
}

/* ———— New-item highlight ———— */

.flash { animation: flash 2.4s ease; }

@keyframes flash {
  0%, 30% { background: var(--accent-soft); }
  100%    { background: transparent; }
}

/* ———— Popovers (notifications, account, profile actions) ———— */

.pop-anchor { position: relative; display: inline-flex; }

.pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 14px 34px -14px rgba(var(--shadow-rgb), .28);
  z-index: 60;
  animation: popIn .14s ease;
}

.pop[hidden] { display: none; }

@keyframes popIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

.pop-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 8px 10px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}

.pop-title,
.pop-count {
  font: 500 10px var(--mono);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}

.pop-count { color: var(--accent-deep); }

.pop-item {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  font: 400 13.5px var(--font);
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.pop-item:hover { background: var(--menu-hover-bg); }

.pop-sep { height: 1px; margin: 4px 0; background: var(--line-soft); }

.pop-notes { width: 330px; }
.pop-account { width: 260px; }

.notes { max-height: 320px; overflow-y: auto; }

.note { display: flex; gap: 10px; padding: 9px 10px; border-radius: 6px; }
.note + .note { margin-top: 2px; }

.note-dot {
  width: 7px;
  height: 7px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--line-strong);
  flex-shrink: 0;
}

.note.unread { background: var(--accent-soft); }
.note.unread .note-dot { background: var(--ink); }

.note-text { margin: 0; font-size: 13px; color: var(--ink); }
.note-meta { margin: 2px 0 0; font-size: 11.5px; color: var(--muted); }

.pop-user { display: flex; align-items: center; gap: 11px; padding: 8px 10px; }
.pop-user .avatar { display: grid; place-items: center; margin: 0; cursor: default; }
.pop-name { margin: 0; font-size: 13.5px; font-weight: 500; color: var(--ink); }
.pop-sub  { margin: 1px 0 0; font-size: 12px; color: var(--muted); }

/* ———— Ask CDXP (assistant sheet) ———— */

.sheet {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 390px;
  max-width: 100vw;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 50px -26px rgba(var(--shadow-rgb), .35);
  transform: translateX(105%);
  transition: transform .3s cubic-bezier(.22, .9, .3, 1);
  z-index: 90;
}

.sheet.open { transform: none; }

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.sheet-head .eyebrow { margin-bottom: 8px; }
.eyebrow-note { color: var(--muted); }

.sheet-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 22px;
  background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1.3px);
  background-size: 16px 16px;
}

.msg {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  animation: rise .3s cubic-bezier(.22, .9, .3, 1) both;
}

.msg.user { align-self: flex-end; background: var(--primary); color: var(--on-primary); border-bottom-right-radius: 4px; }
.msg.bot  { align-self: flex-start; background: var(--accent-soft); color: var(--ink); border: 1px solid var(--accent-line); border-bottom-left-radius: 4px; }

.msg.typing { display: flex; gap: 4px; padding: 13px 14px; }
.msg.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-deep); animation: blink 1s ease-in-out infinite; }
.msg.typing span:nth-child(2) { animation-delay: .15s; }
.msg.typing span:nth-child(3) { animation-delay: .3s; }

@keyframes blink {
  0%, 80%, 100% { opacity: .25; transform: translateY(0); }
  40%           { opacity: 1;   transform: translateY(-2px); }
}

.sheet-suggest { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 22px 0; }

.suggest {
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font: 400 12.5px var(--font);
  color: var(--ink);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

.suggest:hover { background: var(--accent-soft); border-color: var(--accent-line); }

.sheet-input { display: flex; gap: 8px; padding: 14px 22px 20px; }

.sheet-input input {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  font: 400 13.5px var(--font);
  color: var(--ink);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.sheet-input input::placeholder { color: var(--faint); }
.sheet-input input:focus { border-color: var(--focus-border); box-shadow: 0 0 0 3px var(--focus-ring); }

/* ———— Customer profile: overview & consents tabs ———— */

.tab-panel[hidden] { display: none; }

.ov-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: auto 1fr; /* a long properties card grows the events row, never the top one */
  grid-template-areas:
    "props int pred"
    "props ev  ev";
  column-gap: 14px; /* rows are spaced by the cards' own bottom margin */
  align-items: start;
}

.ov-props { grid-area: props; }
.ov-int   { grid-area: int; }
.ov-pred  { grid-area: pred; }
.ov-ev    { grid-area: ev; }

.bars { display: flex; flex-direction: column; gap: 11px; }

.bar-row {
  display: grid;
  grid-template-columns: 80px 1fr 40px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink);
}

.bar-track { height: 6px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.bar-fill  { display: block; height: 100%; border-radius: 999px; background: var(--bar); }
.bar-pct   { font: 500 11.5px var(--mono); color: var(--muted); text-align: right; }

.persona {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 500;
}

.meter { height: 6px; margin: 7px 0 14px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--meter); }

.consent-head { padding: 18px 22px 0; margin-bottom: 6px; }

.switch {
  display: inline-flex;
  vertical-align: middle;
  width: 36px;
  height: 20px;
  padding: 2px;
  border: 0;
  border-radius: 999px;
  background: var(--switch-off);
  cursor: pointer;
  transition: background .18s ease;
}

.switch span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--knob);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
  transition: transform .18s ease, background .18s ease;
}

.switch.on { background: var(--switch-on); }
.switch.on span { transform: translateX(16px); background: var(--knob-on); }

.consent-state { margin-left: 10px; font-size: 12.5px; color: var(--muted); vertical-align: middle; }

/* ———— About dialog ———— */

.modal-sm { max-width: 460px; }

.about-text, .modal-text { margin: 0; font-size: 14px; line-height: 1.6; color: var(--text); }

.about-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}

.about-note { margin: 0; font-size: 12.5px; color: var(--muted); }

/* ———— Toast ———— */

.toast {
  position: fixed;
  bottom: 22px;
  right: 22px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--toast-bg);
  color: var(--toast-fg);
  font-size: 13px;
  padding: 11px 16px;
  border-radius: 8px;
  box-shadow: 0 12px 30px -10px rgba(var(--shadow-rgb), .45);
  opacity: 0;
  translate: 0 8px;
  transition: opacity .25s ease, translate .25s ease;
  pointer-events: none;
}

.toast::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--toast-dot);
  flex-shrink: 0;
}

.toast.on { opacity: 1; translate: 0 0; }

/* ———— Responsive ———— */

@media (max-width: 1460px) {
  .camp-grid, .ev-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 1200px) {
  .sim { grid-template-columns: 1fr; gap: 18px; }
  .sim-pick { max-width: 560px; }
}

@media (max-width: 1120px) {
  .camp-grid, .ev-grid { grid-template-columns: repeat(2, 1fr); }
  .cd-pair { grid-template-columns: minmax(0, 1fr); }
  .ov-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "props int" "props pred" "props ev";
  }
}

@media (max-width: 980px) {
  .content { padding: 10px 20px 56px; }
  .topbar { padding: 0 20px; }
  .camp-grid, .ev-grid { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .hero { padding: 24px 22px; }
  .hero-band { width: 100%; opacity: .35; }
  .search input { width: 100%; }
  .table-card { overflow-x: auto; }
  .table { min-width: 640px; }
  .ev-cat-head .src-stack { display: none; }
  .sim-grid { grid-template-columns: 1fr; }
  .cd-grid { grid-template-columns: 1fr; }
  .ov-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas: "props" "int" "pred" "ev";
  }
  .field-row { flex-direction: column; gap: 13px; }
}

/* ———— Reduced motion ———— */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
