/* PRAI app UI kit — Shadcn-flavored tokens scoped to this kit. */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --primary: #2C3E50;
  --primary-fg: #ffffff;
  --accent: #C47D2B;
  --accent-light: #D4943F;
  --accent-subtle: #FDF5EB;
  --dark: #14202B;

  --fg-1: #1A2530;
  --fg-2: #5D7082;
  --fg-3: #94A3B4;
  --border: #DDD8CF;
  --border-soft: #EDEAE4;

  --bg-app: #FAFAF7;
  --bg-card: #FFFFFF;
  --bg-muted: #F2EFE8;
  --bg-secondary: #F7F4EF;

  --success: #2D8659; --success-light: #E8F5EF;
  --warning: #D4880F; --warning-light: #FEF7E6;
  --error:   #C0392B; --error-light:   #FDECEA;
  --info:    #2980B9; --info-light:    #E8F4FD;

  --sidebar-bg: #2C3E50;
  --sidebar-fg: #D0D7DD;
  --sidebar-accent: #3D5266;

  --radius: 8px;

  --shadow-xs: 0 1px 2px rgba(20,32,43,0.04);
  --shadow-md: 0 4px 12px rgba(20,32,43,0.08);
  --shadow-lg: 0 12px 32px rgba(20,32,43,0.12);

  --font-sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body, #root {
  margin: 0; padding: 0;
  height: 100%; width: 100%;
  font-family: var(--font-sans);
  color: var(--fg-1);
  background: var(--bg-app);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button { font-family: inherit; }

/* ----- Shell ----- */
.shell { display: flex; height: 100vh; overflow: hidden; }
.shell__sidebar {
  width: 248px; flex: 0 0 248px;
  background: var(--sidebar-bg); color: var(--sidebar-fg);
  display: flex; flex-direction: column;
  padding: 14px 10px; gap: 4px;
  overflow-y: auto;
}
.shell__main { flex: 1; overflow-y: auto; }
.shell__main-inner { padding: 24px 28px 48px; max-width: 1280px; }

/* ----- Sidebar ----- */
.sb-logo { padding: 4px 6px 10px; cursor: pointer; }
.sb-ws {
  background: var(--sidebar-accent); border-radius: 6px;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; font-size: 13px; margin-bottom: 8px;
  cursor: pointer;
}
.sb-ws:hover { background: #4A6079; }
.sb-ws .grow { flex: 1; text-align: left; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-group-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: rgba(255,255,255,0.45);
  padding: 10px 10px 4px;
}
.sb-divider { border-top: 1px solid rgba(255,255,255,0.06); margin: 8px 4px; }
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 6px;
  font-size: 13px; color: var(--sidebar-fg); cursor: pointer;
  background: none; border: 0; width: 100%; text-align: left;
}
.sb-item:hover { background: var(--sidebar-accent); color: #fff; }
.sb-item.active {
  background: var(--sidebar-accent); color: #fff;
  position: relative;
}
.sb-item.active::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 2px;
  background: var(--accent); border-radius: 1px;
}
.sb-item .caret { margin-left: auto; opacity: 0.6; transition: transform .15s; }
.sb-item .caret.open { transform: rotate(180deg); }
.sb-sub { padding: 2px 0 4px 26px; display: flex; flex-direction: column; gap: 2px; }
.sb-sub .sb-item { padding-left: 8px; font-size: 12.5px; }

.sb-footer { margin-top: auto; padding: 8px 4px 4px; }
.sb-tenant { font-size: 11px; color: var(--sidebar-fg); padding: 6px 10px; opacity: 0.8; }
.sb-user {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
  width: 100%; background: none; border: 0; color: var(--sidebar-fg); text-align: left;
}
.sb-user:hover { background: var(--sidebar-accent); }
.sb-user__avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--sidebar-accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; flex: 0 0 28px;
}
.sb-user__email { font-size: 12px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ----- Page primitives ----- */
.page-head { margin-bottom: 18px; }
.page-head h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.page-head .sub { color: var(--fg-2); font-size: 14px; margin-top: 4px; }
.page-eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--fg-2);
  margin-bottom: 6px;
}
.section-h2 { font-size: 18px; font-weight: 500; margin: 0; }

/* ----- Button ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; white-space: nowrap;
  border-radius: 6px; border: 1px solid transparent;
  font-size: 14px; font-weight: 500; cursor: pointer;
  font-family: inherit; transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--default { height: 40px; padding: 0 16px; }
.btn--sm      { height: 36px; padding: 0 12px; font-size: 13px; }
.btn--lg      { height: 44px; padding: 0 32px; }
.btn--icon    { height: 40px; width: 40px; padding: 0; }
.btn--block   { width: 100%; }

.btn-primary  { background: var(--primary); color: var(--primary-fg); }
.btn-primary:hover { background: #283747; }
.btn-accent   { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #B66F22; }
.btn-outline  { background: var(--bg-app); color: var(--fg-1); border-color: var(--border); }
.btn-outline:hover { background: var(--accent-subtle); }
.btn-secondary{ background: var(--bg-secondary); color: var(--fg-1); }
.btn-ghost    { background: transparent; color: var(--fg-1); }
.btn-ghost:hover { background: var(--accent-subtle); }
.btn-destructive { background: var(--error); color: #fff; }

/* ----- Card ----- */
.ui-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-xs);
}
.ui-card--interactive { cursor: pointer; transition: transform .2s, box-shadow .2s, border-color .2s; }
.ui-card--interactive:hover {
  transform: translateY(-2px); box-shadow: var(--shadow-md);
  border-color: rgba(44,62,80,0.3);
}
.ui-card__head { padding: 22px 24px 0; display: flex; flex-direction: column; gap: 6px; }
.ui-card__title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: var(--fg-1); line-height: 1.3; }
.ui-card__title--lg { font-size: 22px; }
.ui-card__desc  { font-size: 13px; color: var(--fg-2); }
.ui-card__body  { padding: 18px 24px 0; }
.ui-card__foot  { padding: 18px 24px 22px; display: flex; gap: 8px; align-items: center; }

/* ----- Badge ----- */
.bd {
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 9999px; padding: 2px 10px;
  font-size: 11px; font-weight: 600; border: 1px solid transparent;
}
.bd--default { background: var(--primary); color: #fff; }
.bd--secondary { background: var(--bg-muted); color: var(--fg-1); }
.bd--destructive { background: var(--error); color: #fff; }
.bd--outline { background: transparent; color: var(--fg-1); border-color: var(--border); }
.bd--success { background: var(--success-light); color: var(--success); }
.bd--warning { background: var(--warning-light); color: var(--warning); }
.bd--info    { background: var(--info-light); color: var(--info); }
.bd--error   { background: var(--error-light); color: var(--error); }

/* ----- Form ----- */
.field { display: flex; flex-direction: column; gap: 6px; }
.lbl   { font-size: 13px; font-weight: 500; color: var(--fg-1); }
.input, .textarea, .select {
  height: 40px; width: 100%; box-sizing: border-box;
  background: var(--bg-app); border: 1px solid var(--border); border-radius: 6px;
  padding: 0 12px; font-size: 14px; font-family: inherit; color: var(--fg-1);
}
.textarea { height: auto; padding: 10px 12px; min-height: 80px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(196,125,43,0.25);
}
.input::placeholder, .textarea::placeholder { color: var(--fg-3); }
.hint { font-size: 12px; color: var(--fg-2); }
.checkbox {
  display: inline-flex; align-items: flex-start; gap: 8px;
  font-size: 14px; color: var(--fg-1); cursor: pointer;
}
.checkbox .box {
  width: 16px; height: 16px; border: 1.5px solid var(--border); border-radius: 3px;
  background: #fff; display: inline-flex; align-items: center; justify-content: center;
  margin-top: 1px; flex: 0 0 16px;
}
.checkbox.checked .box { background: var(--primary); border-color: var(--primary); }
.checkbox .box svg { stroke: #fff; width: 11px; height: 11px; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* ----- Table ----- */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.tbl th, table.tbl td { padding: 12px 16px; text-align: left; vertical-align: middle; }
table.tbl thead th { font-size: 12px; font-weight: 500; color: var(--fg-2); border-bottom: 1px solid var(--border); background: var(--bg-app); height: 44px; padding-top: 0; padding-bottom: 0; }
table.tbl tbody tr { border-bottom: 1px solid var(--border-soft); transition: background .15s ease; }
table.tbl tbody tr:last-child { border-bottom: 0; }
table.tbl tbody tr:hover { background: rgba(242,239,232,0.5); cursor: pointer; }
table.tbl td.title { font-weight: 500; color: var(--fg-1); }

/* ----- Tabs ----- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.tab {
  background: none; border: 0;
  padding: 10px 14px; font-size: 13px; color: var(--fg-2);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
  font-family: inherit;
}
.tab:hover { color: var(--fg-1); }
.tab.active { color: var(--fg-1); border-bottom-color: var(--accent); font-weight: 500; }

/* ----- Alerts ----- */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 6px; font-size: 13px; line-height: 1.5; }
.alert--warn { background: var(--warning-light); color: var(--warning); }
.alert--ok   { background: var(--success-light); color: var(--success); }
.alert--info { background: var(--info-light); color: var(--info); }
.alert--err  { background: rgba(192,57,43,0.10); color: var(--error); border: 1px solid rgba(192,57,43,0.20); }

/* ----- Misc ----- */
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-2); }
.data-label { font-size: 12px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; color: var(--fg-2); }
.muted { color: var(--fg-2); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.row { display: flex; gap: 12px; align-items: stretch; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.divider { height: 1px; background: var(--border-soft); margin: 18px 0; }
.spacer-y-6 > * + * { margin-top: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }

.dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; display: inline-block; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 2.5px solid var(--border); border-top-color: var(--fg-2); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================================
   Dashboard — Levende variant. Large 2×2 module cards that double as
   mini-dashboards.
   ============================================================================ */
.dash-levende {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
.lvc {
  /* button reset */
  font-family: inherit; text-align: left; cursor: pointer; appearance: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-xs);
  padding: 22px 24px 20px;
  display: flex; flex-direction: column;
  gap: 18px;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  color: var(--fg-1);
  width: 100%;
}
.lvc:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(196, 125, 43, 0.5);   /* accent border-tint */
}
.lvc:hover .lvc__arrow { background: var(--accent); color: #fff; transform: translateX(2px); }
.lvc:focus-visible { outline: none; box-shadow: 0 0 0 2px rgba(196,125,43,0.35), var(--shadow-md); }

.lvc__head { display: flex; align-items: center; gap: 16px; }
.lvc__icon {
  width: 52px; height: 52px; border-radius: 12px;
  background: var(--primary); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 52px;
  position: relative;
  transition: background-color .2s ease;
}
.lvc__icon::after {
  /* Tiny kobber dot top-right — echoes the logo's i-dot. Signature. */
  content: ""; position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  opacity: 0.9;
}
.lvc:hover .lvc__icon { background: #1F2D3C; }

.lvc__title-wrap { flex: 1; min-width: 0; }
.lvc__eyebrow {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--fg-2);
  margin-bottom: 4px;
}
.lvc__headline {
  display: flex; align-items: baseline; gap: 8px;
  flex-wrap: wrap;
}
.lvc__headline-value {
  font-size: 32px; font-weight: 600;
  letter-spacing: -0.025em;
  color: var(--fg-1);
  line-height: 1;
}
.lvc__headline-noun {
  font-size: 15px; font-weight: 400;
  color: var(--fg-2);
  line-height: 1.2;
}
.lvc__arrow {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--fg-2);
  background: var(--bg-muted);
  transition: background-color .2s ease, color .2s ease, transform .2s ease;
  flex: 0 0 38px;
}

.lvc__stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
}
.lvc__stat-value { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; color: var(--fg-1); line-height: 1; }
.lvc__stat-label { font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg-2); margin-top: 6px; }
.lvc__stat--em .lvc__stat-value { color: var(--accent); }

.lvc__activity { display: flex; flex-direction: column; gap: 4px; }
.lvc__act {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 4px;
  border-radius: 4px;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border-soft);
}
.lvc__act:first-child { border-top: 0; padding-top: 4px; }
.lvc__act-dot {
  width: 6px; height: 6px; border-radius: 50%;
  margin-top: 7px; flex: 0 0 6px;
  background: var(--fg-3);
}
.lvc__act--warning .lvc__act-dot { background: var(--warning); }
.lvc__act--success .lvc__act-dot { background: var(--success); }
.lvc__act--info    .lvc__act-dot { background: var(--info); }
.lvc__act--muted   .lvc__act-dot { background: var(--fg-3); }

.lvc__act-text { flex: 1; min-width: 0; }
.lvc__act-primary { font-size: 13px; font-weight: 500; color: var(--fg-1); line-height: 1.4; }
.lvc__act-secondary { font-size: 12px; color: var(--fg-2); margin-top: 2px; line-height: 1.4; }
.lvc__act--warning .lvc__act-primary   { color: var(--warning); }
.lvc__act--warning .lvc__act-secondary { color: var(--warning); opacity: 0.8; }
.lvc__act--success .lvc__act-primary   { color: var(--success); }
.lvc__act--success .lvc__act-secondary { color: var(--success); opacity: 0.8; }
.lvc__act--info    .lvc__act-primary   { color: var(--info); }
.lvc__act--info    .lvc__act-secondary { color: var(--info); opacity: 0.8; }

@media (max-width: 980px) {
  .dash-levende { grid-template-columns: 1fr; }
}

/* ----- Empty-state version of the Levende card ----- */
/* Icon-tile keeps the SAME primary-blue treatment + kobber dot as the data
   state. Consistency wins — "waiting for data" is communicated by the
   headline and CTA, not by greying out the brand mark. */
.lvc--empty .lvc__icon { background: var(--primary); color: #fff; }
.lvc--empty:hover .lvc__icon { background: #1F2D3C; }

.lvc__headline-empty {
  font-size: 22px; font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--fg-1);
  line-height: 1.2;
}

.lvc__empty-hint {
  font-size: 13px; color: var(--fg-2);
  line-height: 1.55;
  padding: 14px 16px;
  background: var(--bg-secondary);
  border-radius: 8px;
}

.lvc__empty-foot {
  display: flex; justify-content: space-between; align-items: center;
  padding-top: 4px;
}
.lvc__cta-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600;
  color: var(--accent);
  transition: gap .2s ease;
}
.lvc:hover .lvc__cta-link { gap: 10px; }
.lvc__step {
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--fg-3);
}

/* ----- Pop/Auth ----- */
.auth-shell { display: flex; align-items: center; justify-content: center; height: 100vh; padding: 16px; background: var(--bg-app); }
.auth-card  { width: 100%; max-width: 380px; }

.popover {
  position: absolute; background: #fff; border: 1px solid var(--border);
  border-radius: 6px; box-shadow: var(--shadow-md);
  padding: 6px; min-width: 220px; z-index: 50;
}
.popover .row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 4px; font-size: 13px; cursor: pointer;
}
.popover .row:hover { background: var(--accent-subtle); }
.popover .row.active { background: var(--accent-subtle); }
.popover .row.active svg.check { color: var(--accent); }
