/* ============================================================
   AMflow — design tokens & layout
   Base palette derives from the AMflow logo (blue -> turquoise)
   and the AMdev house style. Per-client instances override
   --color-primary / --color-accent (injected in base.html);
   all tints derive from those via color-mix().
   ============================================================ */
:root {
  /* Brand — overridable per client instance */
  --color-primary: #0077ff;
  --color-accent: #1fc8c8;

  /* Derived from --color-primary */
  --color-primary-hover: color-mix(in srgb, var(--color-primary) 84%, #000);
  --color-primary-soft: color-mix(in srgb, var(--color-primary) 10%, #fff);
  --color-primary-tint: color-mix(in srgb, var(--color-primary) 16%, #fff);
  --gradient-brand: linear-gradient(135deg, var(--color-primary), var(--color-accent));

  /* Neutrals (AMdev house style) */
  --color-bg: #f8fafb;
  --color-surface: #ffffff;
  --color-border: #e8ecf2;
  --color-text: #0f1729;
  --color-text-muted: #8492a6;

  /* Status */
  --color-success: #00c853;
  --color-warning: #f5a623;
  --color-danger: #e5484d;

  /* Typography */
  --font-heading: "Outfit", sans-serif;
  --font-body: "DM Sans", sans-serif;

  /* Shape, spacing, elevation */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --space: 12px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 41, 0.06);
  --shadow: 0 4px 16px rgba(15, 23, 41, 0.08);
  --shadow-brand: 0 6px 20px rgba(0, 119, 255, 0.22);

  --sidebar-width: 248px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

/* Font-scale preset (Voorkeuren). rem-based components scale with this. */
html { font-size: 15px; }
html[data-font-scale="klein"] { font-size: 13.5px; }
html[data-font-scale="groot"] { font-size: 16.5px; }

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

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.25;
  margin: 0 0 0.4em;
}

a { color: var(--color-primary); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

/* Drag-handle on the sidebar's right edge (see app.js). */
.sidebar-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 20;
}

.sidebar-resizer:hover {
  background: var(--color-primary-tint);
}

body.is-resizing { user-select: none; }
body.is-resizing * { cursor: col-resize !important; }

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px var(--space);
  flex-shrink: 0;
}

.brand-logo { width: 56px; height: 56px; object-fit: contain; flex-shrink: 0; }

.brand-name {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  /* Truncate a long per-instance naam i.p.v. de zijbalk te laten overlopen. */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px;
  flex: 1 1 auto;
  overflow-y: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: background 0.12s, color 0.12s;
}

.nav-link:hover { background: var(--color-bg); color: var(--color-text); }

.nav-link.is-active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: 600;
}

.sidebar-foot {
  margin-top: auto;
  padding: 8px;
  border-top: 1px solid var(--color-border);
  flex-shrink: 0;
}

.nav-link--muted { font-size: 0.85rem; }

.sidebar-version {
  padding: 6px 12px 2px;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

/* ---------- Main area ---------- */
.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space);
  padding: 18px 28px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.topbar-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0;
}

.topbar-actions { display: flex; gap: 10px; }

.content { padding: 28px; }

/* Sidebar user + logout */
.sidebar-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
}

.sidebar-user-name {
  font-weight: 600;
  font-size: 0.9rem;
  /* Truncate i.p.v. de rol-badge uit de zijbalk te duwen. */
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-user .badge { flex-shrink: 0; }

.nav-link--button {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.95rem;
}

/* Utility */
.text-muted { color: var(--color-text-muted); }
.text-overdue { color: var(--color-danger); font-weight: 600; }
.stack > * + * { margin-top: var(--space); }

/* Clickable table rows (klanten- en communicatielijst) */
.row-clickable { cursor: pointer; }

/* ---------- Print (CEO-rapport) ---------- */
@media print {
  .sidebar,
  .topbar,
  .ceo-controls,
  .flash-stack { display: none !important; }

  .app-shell,
  .main-area { display: block; }

  .content { padding: 0; }

  .card {
    border: none;
    box-shadow: none;
    padding: 0;
  }

  .ceo-item { page-break-inside: avoid; }

  body { background: #fff; }
}
