/* OrdrePortal — layout + komponenter
   Mobile-first per design.md hardblock. Sidebar collapser under 900 px. */

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: var(--font-base);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
html { font-size: 16px; }
body {
  min-height: 100vh;
  font-size: var(--fs-base);
  line-height: 1.45;
  background:
    var(--bg-ambient),
    var(--bg);
  background-attachment: fixed;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button { cursor: pointer; }
a { color: inherit; }

img { max-width: 100%; height: auto; display: block; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--ink) 25%, transparent);
  border-radius: 10px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--ink) 40%, transparent);
  background-clip: padding-box;
}

/* ─── Animations ─────────────────────────────────────── */
@keyframes dotpulse  { 0% { transform: scale(1); opacity: .5; } 100% { transform: scale(2.2); opacity: 0; } }
@keyframes livepulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
@keyframes orbpulse  { 0%,100% { transform: scale(1); opacity: .25; } 50% { transform: scale(1.08); opacity: .5; } }
@keyframes slideup   { 0% { transform: translateY(12px); opacity: 0; } 100% { transform: translateY(0); opacity: 1; } }
@keyframes wave      { from { transform: scaleY(.4); } to { transform: scaleY(1); } }

/* ─── App-shell layout ───────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 1fr;
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
}
.app__sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: var(--sp-4) 10px;
  overflow: auto;
  min-height: 100vh;
}
.app__main {
  display: flex; flex-direction: column;
  min-width: 0;
  min-height: 100vh;
  overflow: hidden;
}
.app__topbar {
  height: 72px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  gap: var(--sp-4);
}
.app__content {
  flex: 1; overflow: auto;
  padding: var(--sp-6);
  position: relative;
}

/* Mobile/portrait — sidebar bliver drawer */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .app__sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: min(86vw, 320px);
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-lift);
  }
  .app[data-drawer="open"] .app__sidebar { transform: translateX(0); }
  .app[data-drawer="open"]::before {
    content: "";
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 150;
  }
  .app__topbar { padding: 0 var(--sp-3); height: 64px; }
  .app__content { padding: var(--sp-4); }
}

/* ─── Sidebar ─────────────────────────────────────────── */
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px var(--sp-4);
}
.brand__mark {
  width: 34px; height: 34px;
  flex-shrink: 0;
  display: block;
}
.brand__mark img,
.brand__mark svg { width: 100%; height: 100%; display: block; }
.brand__name { font-size: 15px; font-weight: 700; letter-spacing: -.2px; line-height: 1; }
.brand__sub  { font-size: 11px; color: var(--ink-dim); margin-top: 2px; }

.nav { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: var(--sp-3); padding-top: 4px; }
.nav__group-label {
  font-size: 10.5px; font-weight: 700; color: var(--ink-dim);
  text-transform: uppercase; letter-spacing: .8px;
  padding: 4px 12px 6px;
}
.nav__items { display: flex; flex-direction: column; gap: 2px; }
.nav__item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  border: none;
  font-size: 14.5px; font-weight: 500;
  text-align: left;
  position: relative;
  min-height: var(--touch-min);
}
.nav__item:hover { background: var(--surface-2); }
.nav__item--active {
  background: var(--accent-soft);
  color: var(--accent-solid);
  font-weight: 600;
}
.nav__item--active::before {
  content: "";
  position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 2px;
  background: var(--accent-solid);
}
.nav__item-label { flex: 1; }

.user-card {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  display: flex; align-items: center; gap: 10px;
}
.user-card__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-solid);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}
.user-card__name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.user-card__role { font-size: 11px; color: var(--ink-dim); }
.user-card__settings {
  border: none; background: transparent; color: var(--ink-dim);
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.user-card__settings:hover { background: var(--surface-3); color: var(--ink); }

/* ─── Topbar ──────────────────────────────────────────── */
.topbar__title { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.topbar__subtitle { font-size: 12.5px; color: var(--ink-muted); margin-top: 1px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__right { display: flex; align-items: center; gap: var(--sp-3); flex-shrink: 0; }
.topbar__time-block { text-align: right; }
.topbar__time { font-size: 18px; font-weight: 700; letter-spacing: -.3px; line-height: 1; font-variant-numeric: tabular-nums; }
.topbar__date { font-size: 11px; color: var(--ink-dim); text-transform: capitalize; margin-top: 2px; }

.menu-toggle {
  display: none;
  width: var(--touch-min); height: var(--touch-min);
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  align-items: center; justify-content: center;
}
@media (max-width: 900px) {
  .menu-toggle { display: inline-flex; }
  .topbar__time-block { display: none; }
}

/* ─── Komponenter ─────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  padding: var(--sp-5);
}
.card--pad-0 { padding: 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  border: 1px solid transparent;
  border-radius: var(--r-md);
  font-weight: 600;
  letter-spacing: -.1px;
  background: var(--accent-solid);
  color: #fff;
  height: 48px;
  padding: 0 18px;
  font-size: 15px;
  min-width: var(--touch-min);
  transition: transform .08s, background .12s, border-color .12s;
}
.btn * { color: inherit; }
.btn:active { transform: scale(.98); }
.btn:hover { background: var(--accent-hover); }
.btn--sm { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn--lg { height: 60px; padding: 0 24px; font-size: 17px; border-radius: 14px; }
.btn--xl { height: 76px; padding: 0 28px; font-size: 18px; border-radius: 16px; }
.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn--ghost:hover { background: var(--surface-2); }
.btn--subtle {
  background: var(--surface-3);
  color: var(--ink);
}
.btn--subtle:hover { background: color-mix(in srgb, var(--surface-3) 80%, var(--ink) 4%); }
.btn--danger {
  background: transparent;
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
}
.btn--danger:hover { background: color-mix(in srgb, var(--danger) 8%, transparent); }
.btn--danger-solid { background: var(--danger); color: white; }
.btn--ok { background: var(--ok); color: white; }
.btn--full { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }

.icon-btn {
  width: var(--touch-min); height: var(--touch-min);
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  position: relative;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn__dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent-solid);
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-family: var(--font-sans);
  font-size: 12.5px; font-weight: 600; letter-spacing: .1px;
  height: 26px; white-space: nowrap;
  background: var(--surface-3); color: var(--ink);
  border: 1px solid transparent;
}
.chip--ok      { background: color-mix(in srgb, var(--ok) 14%, transparent);     color: var(--ok); }
.chip--warn    { background: color-mix(in srgb, var(--warn) 16%, transparent);   color: var(--warn); }
.chip--danger  { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.chip--accent  { background: var(--accent-soft); color: var(--accent-solid); }
.chip--accent-solid { background: var(--accent-solid); color: var(--accent-ink); }
.chip--ok-solid     { background: var(--ok); color: white; }
.chip--outline {
  background: transparent;
  color: var(--ink-muted);
  border-color: var(--line-strong);
}

.dot {
  position: relative;
  width: 8px; height: 8px;
  display: inline-block;
}
.dot__core { position: absolute; inset: 0; border-radius: 50%; background: var(--ok); }
.dot--ok    .dot__core { background: var(--ok); }
.dot--warn  .dot__core { background: var(--warn); }
.dot--danger .dot__core { background: var(--danger); }
.dot--info  .dot__core { background: var(--info); }
.dot--accent .dot__core { background: var(--accent-solid); }
.dot__pulse {
  position: absolute; inset: -4px; border-radius: 50%;
  opacity: .3;
  animation: dotpulse 1.8s ease-out infinite;
}
.dot--ok    .dot__pulse { background: var(--ok); }
.dot--warn  .dot__pulse { background: var(--warn); }
.dot--danger .dot__pulse { background: var(--danger); }
.dot--accent .dot__pulse { background: var(--accent-solid); }

.toggle {
  width: 48px; height: 28px;
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--ink) 12%, transparent);
  border: none; position: relative; padding: 0;
  transition: background .2s;
}
/* Touch-target hardblock: udvid hit-area til 44×44 uden at ændre visuel størrelse */
.toggle::before {
  content: "";
  position: absolute;
  inset: -8px;
  /* tilstrækkeligt så samlet hit-area > 44px */
}
.toggle--lg { width: 62px; height: 36px; }
.toggle__knob {
  position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: left .2s cubic-bezier(.5,1.6,.5,1);
}
.toggle--lg .toggle__knob { width: 28px; height: 28px; top: 4px; left: 4px; }
.toggle[aria-checked="true"] { background: var(--accent-solid); }
.toggle[aria-checked="true"] .toggle__knob { left: calc(100% - 22px - 3px); }
.toggle--lg[aria-checked="true"] .toggle__knob { left: calc(100% - 28px - 4px); }

.input-wrap {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 14px;
  height: 44px;
  color: var(--ink-muted);
}
.input-wrap input,
.input-wrap textarea {
  flex: 1; border: none; outline: none; background: transparent;
  color: var(--ink); height: 100%;
  font-size: 15px;
}
.input-wrap--block { width: 100%; }

.divider { height: 1px; background: var(--line); }

.metric {
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
}
.metric__label {
  font-size: 11.5px; font-weight: 600; letter-spacing: .6px;
  text-transform: uppercase; color: var(--ink-dim);
}
.metric__value-row { display: flex; align-items: baseline; gap: 6px; }
.metric__value {
  font-size: 32px; font-weight: 700; letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}
.metric__unit { font-size: 14px; color: var(--ink-muted); font-weight: 500; }
.metric__trend { font-size: 12px; color: var(--ink-muted); }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 14px;
  gap: var(--sp-3);
}
.section-head__eyebrow {
  font-size: 11px; font-weight: 700; color: var(--ink-dim);
  text-transform: uppercase; letter-spacing: .8px;
  margin-bottom: 2px;
}
.section-head__title { font-size: 20px; font-weight: 700; letter-spacing: -.4px; }

/* ─── Toast (ny ordre) ────────────────────────────────── */
.toast {
  position: absolute;
  top: 88px; right: 24px;
  z-index: 100;
  width: min(360px, calc(100vw - 32px));
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--accent-solid);
  border-radius: 18px;
  box-shadow: var(--shadow-lift);
  display: flex; align-items: center; gap: 14px;
  animation: slideup .4s ease-out;
}
.toast__icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-solid);
  display: flex; align-items: center; justify-content: center;
  position: relative; flex-shrink: 0;
}
.toast__icon::after {
  content: "";
  position: absolute; inset: -4px;
  border-radius: 16px;
  background: var(--accent-solid);
  opacity: .2;
  animation: orbpulse 1.4s ease-out infinite;
}
.toast__title { font-size: 11.5px; color: var(--accent-solid); font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }
.toast__name { font-size: 14px; font-weight: 600; }
.toast__sub { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }

/* ─── Modal-overlay ───────────────────────────────────── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(8,12,22,.55);
  backdrop-filter: blur(6px);
  z-index: 500;
  display: none;
  align-items: center; justify-content: center;
  padding: var(--sp-4);
}
.overlay[data-open="true"] { display: flex; }
.overlay__panel {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2xl);
  box-shadow: var(--shadow-lift);
  width: min(640px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: var(--sp-6);
  animation: slideup .25s ease-out;
}

/* Slide-in fra højre — 50% skærmbredde */
.overlay--slidein {
  align-items: stretch;
  justify-content: flex-end;
  padding: 0;
}
.overlay--slidein .overlay__panel {
  width: 50vw; max-width: 50vw; min-width: 480px;
  height: 100vh; max-height: 100vh;
  border-radius: 0;
  border-top: none; border-right: none; border-bottom: none;
  padding: 0;
  display: flex; flex-direction: column;
  animation: slidein-right .28s cubic-bezier(.2,.7,.2,1);
}
@keyframes slidein-right {
  from { transform: translateX(100%); opacity: .4; }
  to   { transform: translateX(0);    opacity: 1; }
}

/* Segmented control (filter-pills) */
.seg {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 4px;
  gap: 2px;
}
.seg__btn {
  padding: 8px 18px;
  border: none;
  background: transparent;
  border-radius: var(--r-pill);
  color: var(--ink-muted);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: color .15s, background .15s;
}
.seg__btn:hover { color: var(--ink); }
.seg__btn--active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-card);
}

/* Faner */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--line);
}
.tabs__btn {
  padding: 10px 16px;
  background: transparent; border: none;
  color: var(--ink-muted);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.tabs__btn:hover { color: var(--ink); }
.tabs__btn--active {
  color: var(--accent-solid);
  border-bottom-color: var(--accent-solid);
}

/* Integration-fliser (Stripe, MobilePay osv.) */
.integration-tile {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.integration-tile__logo {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: white;
  flex-shrink: 0;
  letter-spacing: -.3px;
}
.integration-tile__body { flex: 1; min-width: 0; }
.integration-tile__name { font-weight: 600; font-size: 14px; }
.integration-tile__sub  { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }

/* ─── AI live-call banner ─────────────────────────────── */
.live-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 14px 8px 10px;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--accent-solid) 14%, transparent),
    color-mix(in srgb, var(--accent-solid) 6%, transparent));
  border: 1.5px solid var(--accent-solid);
  cursor: pointer; position: relative; overflow: hidden;
}
.live-banner__icon {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-solid); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center;
  position: relative; flex-shrink: 0;
}
.live-banner__icon::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%;
  background: var(--accent-solid); opacity: .3;
  animation: orbpulse 1.4s ease-out infinite;
}
.live-banner__wave { display: flex; align-items: center; gap: 2px; height: 18px; }
.live-banner__wave span {
  width: 2.5px; border-radius: 2px;
  background: var(--accent-solid);
  animation: wave .9s ease-in-out infinite alternate;
}
.live-banner__label { font-size: 11px; color: var(--accent-solid); font-weight: 700; letter-spacing: .5px; text-transform: uppercase; line-height: 1; }
.live-banner__name { font-size: 13px; font-weight: 600; margin-top: 2px; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Login ───────────────────────────────────────────── */
.login {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--sp-6);
}
.login__card {
  width: min(440px, 100%);
  padding: var(--sp-7);
  border-radius: var(--r-2xl);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lift);
}
.login__brand {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: var(--sp-6);
}
.login__title { font-size: 24px; font-weight: 700; letter-spacing: -.4px; }
.login__sub   { font-size: 14px; color: var(--ink-muted); margin-top: 4px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-4); }
.field__label { font-size: 12.5px; font-weight: 600; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .4px; }
.field__error { font-size: 13px; color: var(--danger); margin-top: 4px; }

/* ─── Hjælpeklasser ───────────────────────────────────── */
.row     { display: flex; align-items: center; gap: var(--sp-3); }
.col     { display: flex; flex-direction: column; gap: var(--sp-3); }
.stack-2 { display: flex; flex-direction: column; gap: var(--sp-2); }
.stack-3 { display: flex; flex-direction: column; gap: var(--sp-3); }
.stack-4 { display: flex; flex-direction: column; gap: var(--sp-4); }
.stack-5 { display: flex; flex-direction: column; gap: var(--sp-5); }
.spacer  { flex: 1; }
.between { justify-content: space-between; }
.tabular { font-variant-numeric: tabular-nums; }
.txt-sm  { font-size: 13px; }
.txt-xs  { font-size: 12px; }
.txt-dim { color: var(--ink-dim); }
.txt-mut { color: var(--ink-muted); }
.txt-accent { color: var(--accent-solid); }
.txt-warn { color: var(--warn); }
.txt-danger { color: var(--danger); }
.fw-700 { font-weight: 700; }
.fw-600 { font-weight: 600; }
.upper  { text-transform: uppercase; letter-spacing: .8px; font-size: 11px; font-weight: 700; }

/* ─── Visually hidden ─────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
