/* Tokens sampled from e-conomic's own UI (computed styles, Nov 2026). */
:root {
  --font: Helvetica, Arial, sans-serif;
  --ink: #1c1c1c;
  --ink-2: #5c5c5c;
  --ink-3: #9e9e9e;
  --canvas: #ffffff;
  --panel: #f5f7f9;          /* e-conomic sidebar */
  --line: #e1e1e1;           /* table/card border */
  --line-strong: #bebebe;    /* input border */
  --btn: #e1e1e1;            /* secondary button */
  --btn-hover: #d4d4d4;
  --btn-disabled: #eeeeee;
  --primary: #2f5dbd;
  --primary-hover: #264da0;
  --primary-tint: rgba(47, 93, 189, 0.1);   /* active sidebar item */
  --navy: #29283e;           /* top bar */
  --danger: #c0392b;
  --radius: 4px;
  --control: 32px;

  /* ICP: ordinal, so one hue light -> dark (5 = ideal = darkest). */
  --icp-0: #d9d9d9;
  --icp-1: #c9d6f0;
  --icp-2: #9db4e3;
  --icp-3: #6f8fd3;
  --icp-4: #2f5dbd;
  --icp-5: #1c3b80;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 14px/20px var(--font);
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
h1 { font-size: 28px; line-height: 42px; font-weight: 400; margin: 0; }
h2 { font-size: 18px; line-height: 26px; font-weight: 400; margin: 0; }
.muted { color: var(--ink-2); font-size: 13px; }
[hidden] { display: none !important; }

.page { padding: 16px 14px 32px; min-width: 0; }

/* --- KPI strip: mirrors e-conomic's "Total sendt (DKK)" header ------------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px 24px;
  padding: 0 12px 16px;
}
.kpi-label { font-size: 13px; color: var(--ink); }
.kpi-value { font-size: 18px; line-height: 26px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--ink-2); }
.meter { height: 4px; background: var(--btn-disabled); border-radius: 2px; margin-top: 6px; overflow: hidden; max-width: 220px; }
.meter > span { display: block; height: 100%; background: var(--primary); border-radius: 2px; }
.meter.over > span { background: var(--danger); }

.title-row { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }

/* --- Toolbar ----------------------------------------------------------------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.spacer { flex: 1; }
.btn {
  height: var(--control); padding: 0 12px; border: 0; border-radius: var(--radius);
  background: var(--btn); cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--btn-hover); }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn:disabled { background: var(--btn-disabled); color: var(--ink-3); cursor: default; }

.seg { display: inline-flex; border-radius: var(--radius); background: var(--btn); padding: 2px; gap: 2px; }
.seg button {
  height: 28px; padding: 0 10px; border: 0; border-radius: 3px; background: transparent; cursor: pointer;
}
.seg button:hover { background: var(--btn-hover); }
.seg button[aria-pressed="true"] { background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.seg button:disabled { color: var(--ink-3); cursor: default; background: transparent; }
.seg-wide { display: flex; }
.seg-wide button { flex: 1; }

.field { display: inline-flex; align-items: center; gap: 6px; }
.field > span { font-size: 13px; color: var(--ink-2); }
select, input[type=number], input[type=month], input[type=search] {
  height: var(--control); border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: #fff; padding: 0 8px;
}
select:focus, input:focus { outline: 2px solid var(--primary-tint); border-color: var(--primary); }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { accent-color: var(--primary); margin: 0; }
.search { position: relative; display: inline-flex; }
.search svg { position: absolute; left: 8px; top: 9px; width: 14px; height: 14px; color: var(--ink-2); }
.search input { padding-left: 28px; width: 180px; }

/* --- Kanban / timeline columns ---------------------------------------------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.col {
  flex: 1 0 260px; max-width: 360px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 220px);
}
.board.narrow .col { flex-basis: 220px; }
.col-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--line); background: #fff; border-radius: var(--radius) var(--radius) 0 0; }
.col-title { font-weight: 700; display: flex; justify-content: space-between; gap: 8px; }
.col-count { font-weight: 400; color: var(--ink-2); }
.col-sum { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.col-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 48px; }
.col-empty { color: var(--ink-3); font-size: 13px; text-align: center; padding: 12px 0; }

.card {
  display: block; width: 100%; text-align: left; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px 10px; cursor: pointer;
}
.card:hover { border-color: var(--line-strong); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.card.lost { opacity: .55; }
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.card-customer { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-title { color: var(--ink-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-amount { font-variant-numeric: tabular-nums; margin-top: 4px; display: flex; justify-content: space-between; gap: 8px; }
.card-amount .w { color: var(--ink-2); font-size: 13px; }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; font-size: 12px; color: var(--ink-2); }
.unrated { font-size: 12px; color: var(--ink-3); margin-top: 6px; }

.icp {
  display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 20px;
  padding: 0 6px; border-radius: 10px; font-size: 12px; font-weight: 700; white-space: nowrap;
  background: var(--panel); border: 1px solid var(--line); color: var(--ink);
}
.icp i { width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.stage { font-size: 12px; padding: 1px 6px; border-radius: 3px; background: var(--btn-disabled); white-space: nowrap; }
.stage.won { background: #e3f1e6; }
.stage.lost { background: #f7e1df; }

/* --- Capacity chart ---------------------------------------------------------- */
.panel { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: #fff; margin-bottom: 16px; }
.panel h2 { margin-bottom: 4px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); margin: 8px 0 12px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.legend .cap-key { width: 16px; height: 0; border-top: 2px dashed var(--ink); border-radius: 0; }

.chart { position: relative; height: 260px; margin-left: 40px; border-bottom: 1px solid var(--line-strong); }
.gridline { position: absolute; left: 0; right: 0; border-top: 1px solid var(--line); }
.gridline span { position: absolute; right: calc(100% + 6px); top: -8px; font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bars { position: absolute; inset: 0; display: flex; gap: 2px; align-items: flex-end; }
.bar-slot { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.bar { width: min(36px, 70%); display: flex; flex-direction: column-reverse; gap: 2px; }
.bar .seg-fill { width: 100%; min-height: 2px; }
.bar .seg-fill:last-child { border-radius: 4px 4px 0 0; }
.bar-total { font-size: 11px; color: var(--ink-2); margin-bottom: 2px; font-variant-numeric: tabular-nums; }
.bar-total.over { color: var(--danger); font-weight: 700; }
.cap-line { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--ink); pointer-events: none; }
.cap-line span { position: absolute; right: 0; top: -18px; font-size: 11px; background: #fff; padding: 0 2px; }
.x-labels { display: flex; gap: 2px; margin-left: 40px; }
.x-labels span { flex: 1; text-align: center; font-size: 11px; color: var(--ink-2); padding-top: 4px; white-space: nowrap; }

/* --- Tables (list view, capacity table) ------------------------------------- */
.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; background: #fff; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-weight: 700; height: 42px; user-select: none; }
th[data-sort] { cursor: pointer; }
th[data-sort]:hover { background: var(--panel); }
th .arrow { color: var(--ink-2); font-weight: 400; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--primary-tint); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.ellipsis { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
tfoot td { font-weight: 700; border-top: 1px solid var(--line-strong); border-bottom: 0; }

/* --- Drawer -------------------------------------------------------------------- */
.scrim { position: fixed; inset: 0; background: rgba(41, 40, 62, .25); opacity: 0; pointer-events: none; transition: opacity .15s; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(400px, 100vw); background: #fff;
  box-shadow: -4px 0 16px rgba(0,0,0,.12); transform: translateX(100%); transition: transform .18s ease-out;
  overflow-y: auto; z-index: 10;
}
body.drawer-open .drawer { transform: none; }
body.drawer-open .scrim { opacity: 1; pointer-events: auto; }
.drawer form { padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.drawer header { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.icon-btn { border: 0; background: transparent; font-size: 24px; line-height: 24px; cursor: pointer; padding: 4px 8px; border-radius: var(--radius); }
.icon-btn:hover { background: var(--btn); }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; margin: 0; padding: 12px; background: var(--panel); border-radius: var(--radius); font-size: 13px; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
legend { font-weight: 700; padding: 0; margin-bottom: 8px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row input[type=number] { width: 90px; }
.row .field { flex-direction: column; align-items: stretch; gap: 4px; flex: 1; }
.row .field input { width: 100%; }
.link { border: 0; background: none; color: var(--primary); cursor: pointer; padding: 0; }
.link:hover { text-decoration: underline; }
.drawer footer { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }

.tooltip {
  position: fixed; z-index: 20; pointer-events: none; background: var(--navy); color: #fff; font-size: 12px; line-height: 17px;
  padding: 6px 8px; border-radius: var(--radius); max-width: 260px; box-shadow: 0 2px 8px rgba(0,0,0,.2);
}

.notice { padding: 24px; text-align: center; color: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); }
.notice.error { color: var(--danger); }

@media (max-width: 720px) {
  .page { padding: 12px 16px 24px; }
  .spacer { display: none; }
  .search input { width: 140px; }
  .col { flex-basis: 240px; max-height: none; }
  .chart, .x-labels { margin-left: 32px; }
}
