:root {
  --bg: #f4f7f6;
  --panel: #ffffff;
  --ink: #16241f;
  --ink-soft: #5a6b64;
  --muted: #8a978f;
  --line: #e2eae7;
  --line-soft: #eef3f1;
  --brand: #0f766e;
  --brand-dark: #0b5750;
  --brand-soft: #e6f3f1;
  --accent: #f59e0b;
  --danger: #c0392b;
  --ok: #15803d;
  --ok-soft: #dcf3e3;
  --sidebar: #102a26;
  --sidebar-soft: #1b3a35;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 30px rgba(16, 42, 38, .10);
  --shadow-sm: 0 2px 8px rgba(16, 42, 38, .06);
  --font-head: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

svg { display: block; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 600; line-height: 1.15; margin: 0; }
button { font: inherit; cursor: pointer; }
a { color: var(--brand-dark); text-decoration: none; }

/* ---------- Demo ribbon ---------- */
.demo-ribbon {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  background: var(--accent); color: #3a2400;
  font-size: .8rem; font-weight: 600; text-align: center;
  padding: 6px 14px; display: flex; gap: 14px; justify-content: center; align-items: center;
}
.demo-ribbon a { color: #3a2400; text-decoration: underline; font-weight: 700; }

/* ---------- Login ---------- */
.login-screen {
  min-height: 100vh; padding: 70px 20px 40px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(1200px 600px at 50% -10%, #d8ece9, var(--bg));
}
.login-card {
  width: 100%; max-width: 430px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 18px; padding: 34px 30px;
  box-shadow: var(--shadow);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-name { display: block; font-family: var(--font-head); font-size: 1.15rem; font-weight: 600; }
.login-sub { display: block; font-size: .82rem; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.login-card h1 { font-size: 1.7rem; margin-bottom: .2em; }
.login-hint { color: var(--ink-soft); font-size: .95rem; margin: 0 0 22px; }
.login-users { display: grid; gap: 12px; }
.login-user {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; transition: border-color .15s, transform .12s, box-shadow .15s;
}
.login-user:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.avatar {
  width: 44px; height: 44px; flex: 0 0 44px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 1.05rem;
}
.login-user .lu-name { font-weight: 600; }
.login-user .lu-role { font-size: .85rem; color: var(--ink-soft); }
.login-user .lu-go { margin-left: auto; color: var(--brand); font-size: 1.3rem; }
.login-secure {
  display: flex; align-items: center; gap: 8px; color: var(--ok);
  font-size: .82rem; margin: 24px 0 0; padding-top: 18px; border-top: 1px solid var(--line-soft);
}
.login-footnote { color: var(--muted); font-size: .82rem; max-width: 430px; text-align: center; }

/* ---------- App shell ---------- */
.app { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; padding-top: 31px; }

.sidebar {
  background: var(--sidebar); color: #cfe0dc; padding: 22px 16px;
  display: flex; flex-direction: column; gap: 8px;
  position: sticky; top: 31px; height: calc(100vh - 31px);
}
.sb-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-family: var(--font-head); font-size: 1.05rem; padding: 4px 6px 16px; }
.sb-brand strong { font-weight: 600; }
.sb-nav { display: flex; flex-direction: column; gap: 3px; }
.sb-nav a {
  display: flex; align-items: center; gap: 11px; color: #aebfba;
  padding: 11px 13px; border-radius: 10px; font-weight: 500; font-size: .95rem;
  transition: background .15s, color .15s;
}
.sb-nav a:hover { background: var(--sidebar-soft); color: #fff; }
.sb-nav a.active { background: var(--brand); color: #fff; }
.sb-ico { font-size: 1rem; width: 20px; text-align: center; }

.sb-integrations { margin-top: auto; padding: 14px 13px; border-top: 1px solid rgba(255,255,255,.1); }
.sb-int-title { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: #7e918c; margin: 0 0 9px; }
.sb-int { display: flex; align-items: center; gap: 9px; font-size: .85rem; color: #c4d4d0; padding: 3px 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.dot.ok { background: #34d399; box-shadow: 0 0 0 3px rgba(52,211,153,.18); }

.sb-user { display: flex; align-items: center; gap: 11px; padding: 12px 8px 4px; border-top: 1px solid rgba(255,255,255,.1); }
.sb-user .su-name { font-size: .9rem; font-weight: 600; color: #fff; }
.sb-user .su-role { font-size: .78rem; color: #8aa39d; }

.sidebar-scrim { display: none; }

.main-area { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 31px; z-index: 40;
  background: rgba(244,247,246,.85); backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 26px; height: 64px;
}
.topbar-title { font-family: var(--font-head); font-size: 1.3rem; font-weight: 600; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.role-badge {
  display: inline-flex; align-items: center; gap: 7px; font-size: .82rem; font-weight: 600;
  padding: 6px 12px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark);
}
.role-badge.emp { background: #fdeccb; color: #8a5a00; }
.btn-switch { background: none; border: 1.5px solid var(--line); color: var(--ink-soft); padding: 7px 14px; border-radius: 999px; font-size: .85rem; font-weight: 600; transition: border-color .15s, color .15s; }
.btn-switch:hover { border-color: var(--brand); color: var(--brand-dark); }

.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: 0; padding: 6px; }
.hamburger span { width: 22px; height: 2px; background: var(--ink); border-radius: 2px; }

.content { padding: 26px; max-width: 1180px; width: 100%; }

/* ---------- Generic UI ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: .92rem; padding: 10px 18px; border-radius: 10px;
  border: 1.5px solid transparent; transition: background .15s, transform .12s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); box-shadow: 0 8px 20px rgba(15,118,110,.28); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-dark); }
.btn-sm { padding: 6px 12px; font-size: .82rem; border-radius: 8px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .ph-sub { color: var(--ink-soft); margin: 4px 0 0; font-size: .95rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .74rem; font-weight: 700; color: var(--brand); margin: 0 0 4px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.panel-head h3 { font-size: 1.1rem; }
.panel-body { padding: 18px 20px; }

.grid { display: grid; gap: 18px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: 1.4fr 1fr; }

/* KPI cards */
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow-sm); }
.kpi .kpi-label { font-size: .82rem; color: var(--ink-soft); font-weight: 500; }
.kpi .kpi-num { font-family: var(--font-head); font-size: 2rem; font-weight: 600; margin-top: 4px; }
.kpi .kpi-foot { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.kpi.accent { background: var(--brand); border-color: var(--brand); color: #fff; }
.kpi.accent .kpi-label, .kpi.accent .kpi-foot { color: #cdeae6; }

/* Status pills */
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.pill.planlagt { background: #e7eef9; color: #2b5fb3; }
.pill.udfoert { background: var(--ok-soft); color: var(--ok); }
.pill.faktureret { background: #ede9f7; color: #6b46c1; }
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

/* Task / booking list */
.tasklist { display: flex; flex-direction: column; }
.task {
  display: flex; align-items: center; gap: 14px; padding: 13px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.task:last-child { border-bottom: 0; }
.task .t-time { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--brand-dark); width: 52px; flex: 0 0 52px; }
.task .t-main { min-width: 0; flex: 1; }
.task .t-title { font-weight: 600; }
.task .t-meta { font-size: .85rem; color: var(--ink-soft); }
.task .t-side { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 13px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .12s; }
table.data tbody tr:hover { background: var(--line-soft); }
.t-strong { font-weight: 600; }
.t-sub { font-size: .82rem; color: var(--ink-soft); }
.cell-actions { display: flex; gap: 8px; justify-content: flex-end; }

.empty { text-align: center; color: var(--muted); padding: 40px 20px; }
.empty .emoji { font-size: 2rem; }

.mini-avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: .78rem; font-weight: 700; flex: 0 0 28px; }
.who { display: inline-flex; align-items: center; gap: 8px; }

/* Forms */
.field { margin-bottom: 15px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  font: inherit; color: var(--ink); background: #fcfdfd;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); }
.field textarea { resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

.note { background: var(--brand-soft); border: 1px solid #c8e6e1; border-radius: var(--radius-sm); padding: 12px 14px; font-size: .88rem; color: var(--brand-dark); display: flex; gap: 10px; }
.note.amber { background: #fef3e0; border-color: #f6dcb0; color: #8a5a00; }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.cal-day { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; min-height: 180px; }
.cal-day h4 { font-family: var(--font-body); font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 10px; display: flex; justify-content: space-between; }
.cal-day h4 .d-num { color: var(--ink); font-weight: 700; }
.cal-day.today { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.cal-event { background: var(--brand-soft); border-left: 3px solid var(--brand); border-radius: 6px; padding: 6px 8px; margin-bottom: 7px; font-size: .8rem; }
.cal-event .ce-time { font-weight: 700; color: var(--brand-dark); }
.cal-event .ce-title { display: block; color: var(--ink); }
.cal-event.synced::after { content: "↻ synket"; display: block; font-size: .66rem; color: var(--brand); margin-top: 2px; }

.legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: .85rem; color: var(--ink-soft); margin-top: 14px; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 300; background: rgba(16,42,38,.45); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: #fff; }
.modal-head h2 { font-size: 1.25rem; }
.modal-close { background: none; border: 0; font-size: 1.6rem; line-height: 1; color: var(--muted); padding: 0 4px; }
.modal-close:hover { color: var(--ink); }
.modal-body { padding: 22px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px;
  font-size: .9rem; font-weight: 500; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 400; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.ok { background: var(--ok); }

.detail-row { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: .92rem; }
.detail-row:last-child { border-bottom: 0; }
.detail-row .dr-k { color: var(--ink-soft); }
.detail-row .dr-v { font-weight: 600; text-align: right; }

.hide { display: none !important; }

/* Dinero-integration */
.connect-panel { border-color: #e2d9f5; }
.dinero-head { display: flex; align-items: center; gap: 10px; font-size: .92rem; color: var(--ink-soft); margin-bottom: 14px; }
.dinero-head svg { flex: 0 0 22px; }
.dinero-steps { display: flex; flex-direction: column; gap: 4px; }
.dstep { display: flex; align-items: center; gap: 11px; padding: 9px 4px; color: var(--muted); font-size: .95rem; transition: color .2s; }
.dstep.active { color: var(--ink); font-weight: 600; }
.dstep.done { color: var(--ink-soft); }
.dstep-ico { width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; border-radius: 50%; font-size: .8rem; font-weight: 700; background: var(--line-soft); color: var(--muted); }
.dstep.active .dstep-ico { background: #ede9f7; color: #6b46c1; }
.dstep.done .dstep-ico { background: var(--ok-soft); color: var(--ok); }
.scope-list { list-style: none; padding: 0; margin: 14px 0; display: flex; flex-direction: column; gap: 8px; }
.scope-list li { position: relative; padding-left: 28px; color: var(--ink-soft); font-size: .92rem; }
.scope-list li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 20px; height: 20px; background: #ede9f7; color: #6b46c1; border-radius: 50%; display: grid; place-items: center; font-size: .72rem; font-weight: 700; }

/* ---------- Responsive ---------- */
@media (max-width: 920px) {
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .cal { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 31px; left: 0; bottom: 0; width: 256px; z-index: 60;
    transform: translateX(-100%); transition: transform .25s ease; height: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim.show { display: block; position: fixed; inset: 31px 0 0; background: rgba(0,0,0,.4); z-index: 55; }
  .hamburger { display: flex; }
  .content { padding: 18px 16px; }
  .topbar { padding: 0 16px; }
  .btn-switch { display: none; }
  .cols-4 { grid-template-columns: 1fr 1fr; }
  .field-row { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
