/* LuzeX Platform — design system. Rustige, Apple-achtige uitstraling (zie docs/enterprise-platform/09-backend-en-frontend-architectuur.md §10.4/§10.6). */

:root {
  color-scheme: light dark;

  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-translucent: rgba(255, 255, 255, 0.72);
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;

  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-active: #005fc4;
  --accent-tint: rgba(0, 113, 227, 0.1);
  --accent-ring: rgba(0, 113, 227, 0.35);

  --success: #248a3d;
  --success-tint: rgba(52, 199, 89, 0.14);
  --warning: #b25000;
  --warning-tint: rgba(255, 149, 0, 0.16);
  --danger: #d70015;
  --danger-tint: rgba(255, 59, 48, 0.12);
  --neutral-tint: rgba(0, 0, 0, 0.06);
  --purple: #6e40c9;
  --purple-tint: rgba(139, 92, 246, 0.14);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-pill: 980px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 1px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.14), 0 4px 12px rgba(0, 0, 0, 0.06);

  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --sidebar-width: 260px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --surface: #1c1c1e;
    --surface-translucent: rgba(28, 28, 30, 0.72);
    --border: rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #f5f5f7;
    --text-secondary: #98989d;
    --text-tertiary: #6e6e73;

    --accent: #0a84ff;
    --accent-hover: #379bff;
    --accent-active: #0060c7;
    --accent-tint: rgba(10, 132, 255, 0.16);
    --accent-ring: rgba(10, 132, 255, 0.45);

    --success: #32d74b;
    --success-tint: rgba(50, 215, 75, 0.16);
    --warning: #ff9f0a;
    --warning-tint: rgba(255, 159, 10, 0.18);
    --danger: #ff453a;
    --danger-tint: rgba(255, 69, 58, 0.16);
    --neutral-tint: rgba(255, 255, 255, 0.08);
    --purple: #bf5af2;
    --purple-tint: rgba(191, 90, 242, 0.18);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.55);
  }
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
  letter-spacing: -0.006em;
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
}

/* ---------- Login ---------- */

body.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 15% -10%, var(--accent-tint), transparent 60%),
    radial-gradient(900px 500px at 100% 110%, rgba(191, 90, 242, 0.08), transparent 60%),
    var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  animation: rise 0.5s var(--ease);
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(160deg, var(--accent), #5ac8fa);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 20px;
  box-shadow: 0 6px 16px rgba(0, 113, 227, 0.35);
}

.login-card h1 {
  font-size: 22px;
  margin-bottom: 4px;
}

.login-card .subtitle {
  margin-bottom: 28px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 13px;
}

label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 16px 0 6px;
}

label:first-of-type {
  margin-top: 0;
}

input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}

input::placeholder {
  color: var(--text-tertiary);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  background: var(--accent);
  color: white;
  transition: background 0.15s var(--ease), transform 0.1s var(--ease), box-shadow 0.15s var(--ease);
}

button:hover {
  background: var(--accent-hover);
}

button:active {
  background: var(--accent-active);
  transform: scale(0.98);
}

button.secondary {
  background: var(--neutral-tint);
  color: var(--text);
}

button.secondary:hover {
  background: var(--border-strong);
}

button.secondary:active {
  transform: scale(0.98);
}

.primary-action {
  width: 100%;
  margin-top: 26px;
  padding: 12px;
  font-size: 14.5px;
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.25);
}

.error {
  color: var(--danger);
  font-size: 12.5px;
  margin-top: 12px;
  min-height: 1em;
}

.success {
  color: var(--success);
  font-size: 12.5px;
  margin-top: 12px;
  min-height: 1em;
}

.text-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: none;
}

.text-link:hover {
  background: none;
  text-decoration: underline;
}

/* ---------- App shell (dashboards) ---------- */

body.dashboard-body {
  display: flex;
  align-items: stretch;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--surface-translucent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 22px;
}

.sidebar .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  margin: 0;
  font-size: 13px;
  box-shadow: 0 3px 8px rgba(0, 113, 227, 0.3);
}

.sidebar .brand-name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.sidebar .brand-role {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: -1px;
}

.sidebar-org {
  padding: 10px 12px;
  margin: 0 0 14px;
  border-radius: 10px;
  background: var(--surface-secondary, rgba(0, 0, 0, 0.03));
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow-wrap: break-word;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.12s var(--ease);
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.75;
}

.nav-item:hover {
  background: var(--neutral-tint);
}

.nav-item.active {
  background: var(--accent);
  color: white;
}

.nav-item.active svg {
  opacity: 1;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 14px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 12px;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--purple), var(--accent));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info {
  min-width: 0;
}

.user-email {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: capitalize;
}

#uitloggen-knop {
  width: 100%;
}

.content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  padding: 40px 48px 80px;
  max-width: 980px;
}

.content-header {
  margin-bottom: 28px;
}

.content-header h1 {
  font-size: 26px;
}

.content-header .subtitle {
  margin-top: 4px;
}

/* ---------- Cards / panels ---------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 24px;
  transition: box-shadow 0.2s var(--ease);
}

.panel h2 {
  font-size: 16px;
  margin-bottom: 4px;
}

.panel > .subtitle {
  margin-bottom: 18px;
}

.panel h2 + .subtitle {
  margin-top: 2px;
}

.panel-header-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
  margin-bottom: 4px;
}

.panel-header-row h2 {
  margin-bottom: 0;
  flex: 1 1 auto;
  min-width: 220px;
}

.panel-header-row .primary-action {
  flex: 0 0 auto;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.tarief-rij {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.tarief-rij .tarief-productcode,
.tarief-rij .tarief-bedrag {
  flex: 1;
}

.tarief-rij button {
  flex-shrink: 0;
}

/* ---------- Tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th, td {
  text-align: left;
  padding: 11px 10px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

tbody tr {
  transition: background 0.1s var(--ease);
}

tbody tr:hover {
  background: var(--neutral-tint);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ---------- Status badges ---------- */

.status-badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--neutral-tint);
  color: var(--text-secondary);
  white-space: nowrap;
}

.status-badge.status-actief,
.status-badge.status-goedgekeurd,
.status-badge.status-definitief,
.status-badge.status-betaald,
.status-badge.status-verwerkt {
  background: var(--success-tint);
  color: var(--success);
}

.status-badge.status-wacht_op_controle,
.status-badge.status-ingediend,
.status-badge.status-betaalbaar {
  background: var(--warning-tint);
  color: var(--warning);
}

.status-badge.status-afgekeurd,
.status-badge.status-geannuleerd,
.status-badge.status-verwerkt_met_fouten {
  background: var(--danger-tint);
  color: var(--danger);
}

.status-badge.status-concept,
.status-badge.status-vervangen {
  background: var(--neutral-tint);
  color: var(--text-secondary);
}

.status-badge.status-gefactureerd {
  background: var(--purple-tint);
  color: var(--purple);
}

/* ---------- Rows / lists (uren, facturen) ---------- */

.item-row {
  border-top: 1px solid var(--border);
  padding: 16px 2px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.item-row:first-child {
  border-top: none;
}

.item-row .item-main {
  font-size: 13.5px;
  line-height: 1.6;
}

.item-row .item-main strong {
  font-weight: 600;
}

.item-row .item-actions {
  white-space: nowrap;
  display: flex;
  gap: 8px;
}

.correctie-form {
  border-top: 1px solid var(--border);
  padding: 20px 2px;
}

.correctie-form:first-child {
  border-top: none;
}

.correctie-form p {
  margin: 0 0 12px;
  font-size: 13.5px;
}

.correctie-form button {
  margin-top: 14px;
}

/* ---------- Empty / loading states ---------- */

.empty-state {
  color: var(--text-tertiary);
  font-size: 13.5px;
  text-align: center;
  padding: 32px 0;
}

/* ---------- Dashboard (KPI-kaarten, periodefilter, trend) ---------- */

.periode-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.periode-filter label {
  margin: 0;
}

.periode-filter select,
.periode-filter input {
  width: auto;
  min-width: 160px;
}

.kpi-groep {
  margin-bottom: 28px;
}

.kpi-groep h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
}

.kpi-card {
  background: var(--neutral-tint);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.kpi-waarde {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.kpi-label {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.kpi-card.kpi-accent .kpi-waarde {
  color: var(--accent);
}

.kpi-card.kpi-warning .kpi-waarde {
  color: var(--warning);
}

.trend-chart {
  width: 100%;
  height: 120px;
  display: block;
}

.dashboard-tabellen {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.dashboard-tabellen .panel {
  margin-bottom: 0;
}

/* ---------- Misc ---------- */

.import-summary {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--neutral-tint);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.import-summary ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--danger);
}

@media (max-width: 860px) {
  /* Sidebar wordt een horizontale topbar i.p.v. volledig te verdwijnen — "alles mobiel
     bruikbaar" (zie docs/enterprise-platform/09-backend-en-frontend-architectuur.md §10.6)
     geldt ook voor navigatie en uitloggen, niet alleen voor de inhoud. */
  body.dashboard-body {
    flex-direction: column;
  }
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    padding: 10px 14px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar .brand {
    padding: 4px 10px 4px 0;
  }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    flex: 1 1 auto;
    gap: 2px;
  }
  .nav-item svg {
    width: 15px;
    height: 15px;
  }
  .sidebar-footer {
    border-top: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .user-chip {
    padding: 0;
  }
  .user-info {
    display: none;
  }
  #uitloggen-knop {
    width: auto;
  }
  .content {
    margin-left: 0;
    padding: 24px 20px 60px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .item-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  }
  .dashboard-tabellen {
    grid-template-columns: 1fr;
  }
}
