/* ═══════════════════════════════════════════════════════════════════════
   Clerq — Design System
   Layered on top of DaisyUI v4 + Tailwind CDN. Never removes DaisyUI
   component classes — only overrides colours, radii, typography, structure.
════════════════════════════════════════════════════════════════════════ */

/* ── Brand tokens ────────────────────────────────────────────────────── */
:root {
  --c-ink:            #0B0E14;
  --c-panel:          #131822;
  --c-hairline:       #262D3A;
  --c-signal-blue:    #4C8DFF;
  --c-signal-blue-dim:#3A6FD1;
  --c-signal-amber:   #F5A623;
  --c-signal-green:   #34D399;
  --c-signal-red:     #F0546B;
  --c-border-light:   #E2E6ED;
  --c-muted-light:    #6B7585;
}

/* ── DaisyUI light theme colour override ─────────────────────────────── */
[data-theme=light] {
  --color-primary:          oklch(58% 0.19 258);
  --color-primary-content:  oklch(100% 0 0);
  --color-base-100:         oklch(100% 0 0);
  --color-base-200:         oklch(97.3% 0.004 260);
  --color-base-300:         oklch(90% 0.01 260);
  --color-base-content:     oklch(20% 0.02 260);
  --color-info:             oklch(58% 0.19 258);
  --color-info-content:     oklch(100% 0 0);
  --color-success:          oklch(68% 0.15 162);
  --color-success-content:  oklch(15% 0.03 162);
  --color-warning:          oklch(74% 0.15 68);
  --color-warning-content:  oklch(20% 0.05 68);
  --color-error:            oklch(58% 0.19 12);
  --color-error-content:    oklch(100% 0 0);
  --rounded-box:            0.375rem;
  --rounded-btn:            0.25rem;
  --rounded-badge:          0.25rem;
  --animation-btn:          0.1s;
  --animation-input:        0.1s;
}

/* ── DaisyUI dark theme colour override — full Clerq ink/panel palette ── */
[data-theme=dark] {
  --color-primary:          oklch(66% 0.19 258);
  --color-primary-content:  oklch(10% 0.02 258);
  --color-base-100:         oklch(16% 0.02 255);  /* panel #131822-ish */
  --color-base-200:         oklch(11% 0.015 255); /* ink   #0B0E14-ish */
  --color-base-300:         oklch(21% 0.02 255);  /* hairline-adjacent */
  --color-base-content:     oklch(93% 0.006 255);
  --color-info:             oklch(66% 0.19 258);
  --color-info-content:     oklch(10% 0.02 258);
  --color-success:          oklch(72% 0.15 162);
  --color-success-content:  oklch(15% 0.03 162);
  --color-warning:          oklch(75% 0.15 68);
  --color-warning-content:  oklch(18% 0.04 68);
  --color-error:            oklch(63% 0.19 12);
  --color-error-content:    oklch(97% 0.01 12);
  --rounded-box:            0.375rem;
  --rounded-btn:            0.25rem;
  --rounded-badge:          0.25rem;
}

/* NOTE for visual QA (Task 13): the oklch() triplets above are hand-tuned
   approximations of the hex swatches in --c-signal-*. Compare rendered
   badges/buttons against the hex values and nudge L/C/H if they read off. */

/* ── Typography ──────────────────────────────────────────────────────── */
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Display face — headings, nav, page title. Used with restraint: only
   structural/chrome text, never body copy or buttons. */
h1, h2, h3, h4,
.card-title,
.menu-label,
.page-title-display {
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
}

/* Monospace for metric values and data-adjacent labels — gives data a
   distinct register from prose. */
.stat-value,
.stat-title,
.data-mono {
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

/* ── Sidebar — always-dark console panel ─────────────────────────────── */
/* Intentionally ignores data-theme: the sidebar is a permanent control
   surface that stays dark regardless of the content area's theme. */
.sidebar-console {
  background-color: var(--c-ink) !important;
  border-color: var(--c-hairline) !important;
}

.sidebar-console .logo-area {
  border-bottom: 1px solid var(--c-hairline);
}

.sidebar-console .menu a {
  color: #9CA3AF;
  border-radius: 0.25rem;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.sidebar-console .menu a:hover {
  background-color: rgba(255, 255, 255, 0.06);
  color: #E5E7EB;
}

.sidebar-console .menu a.active {
  background-color: rgba(76, 141, 255, 0.16);
  color: var(--c-signal-blue);
}

.sidebar-console .menu-title {
  color: #4B5563 !important;
  font-size: 0.625rem !important;
  letter-spacing: 0.1em !important;
}

/* Badges on dark background — dark-safe tints of the signal colours */
.sidebar-console .badge-warning {
  background-color: rgba(245, 166, 35, 0.18);
  color: var(--c-signal-amber);
  border-color: transparent;
}

.sidebar-console .badge-error {
  background-color: rgba(240, 84, 107, 0.18);
  color: var(--c-signal-red);
  border-color: transparent;
}

.sidebar-footer {
  border-top: 1px solid var(--c-hairline);
  color: #4B5563;
}

/* ── Logo mark (shared between sidebar and auth pages) ───────────────── */
.logo-mark {
  width: 2rem;
  height: 2rem;
  border-radius: 0.375rem;
  background-color: var(--c-signal-blue);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── Topbar ──────────────────────────────────────────────────────────── */
.topbar-meridian {
  border-bottom: 1px solid var(--c-border-light) !important;
  box-shadow: none !important;
}

[data-theme=dark] .topbar-meridian {
  border-bottom-color: var(--c-hairline) !important;
}

/* ── Cards ───────────────────────────────────────────────────────────── */
.card {
  border-radius: 0.375rem !important;
}

.card.shadow {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.04) !important;
}

/* ── Status rail — signature element ─────────────────────────────────── */
/* A 3px left-edge accent applied to any card/container that represents
   something with a lifecycle (a pending review, a merge suggestion). One
   base class + one state modifier, used identically everywhere the state
   applies. Table-row status lists (Runs tables in email.html/
   knowledge_manager.html) intentionally do NOT get this treatment — a left
   border on a <tr> is a CSS/browser-support risk for little visual gain;
   those lists already carry the same signal colours through their
   badge-warning/success/error/info pills, which this file re-themes too. */
.status-rail {
  border: 1px solid var(--c-border-light) !important;
  border-left-width: 3px !important;
  border-radius: var(--rounded-box) !important;
  box-shadow: none !important;
}

[data-theme=dark] .status-rail {
  border-color: var(--c-hairline) !important;
}

.status-rail--wartet { border-left-color: var(--c-signal-amber) !important; }
.status-rail--fertig { border-left-color: var(--c-signal-green) !important; }
.status-rail--fehler { border-left-color: var(--c-signal-red)   !important; }
.status-rail--laeuft { border-left-color: var(--c-signal-blue)  !important; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  border-radius: 0.25rem !important;
  font-weight: 500 !important;
  letter-spacing: -0.005em !important;
}

/* ── Inputs / Select / Textarea ──────────────────────────────────────── */
.input,
.select,
.textarea {
  border-radius: 0.25rem !important;
}

/* ── Sidebar collapse — icon-only (desktop only) ────────────────────── */
.sidebar-console {
  transition: width 0.2s ease;
}

/* On mobile, collapse has no effect — DaisyUI drawer handles visibility */
@media (min-width: 1024px) {
  .sidebar-console.collapsed {
    width: 3.5rem !important; /* 56px */
  }
}

/* Hide text labels and section headers when collapsed */
.sidebar-console.collapsed .menu-label,
.sidebar-console.collapsed .menu-title {
  display: none !important;
}

/* Center the icons */
.sidebar-console.collapsed .menu a {
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

/* Rotate collapse button arrow */
.sidebar-console.collapsed .sidebar-collapse-icon {
  transform: rotate(180deg);
}

/* Collapse toggle button */
.sidebar-collapse-btn {
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 0.25rem;
  background: none;
  border: none;
  cursor: pointer;
  color: #4B5563;
  transition: color 0.12s, background-color 0.12s;
  flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
  color: #9CA3AF;
  background-color: rgba(255, 255, 255, 0.06);
}

.sidebar-collapse-icon {
  transition: transform 0.2s ease;
}

/* ── Auth pages (login / register / verify) ──────────────────────────── */
.auth-bg {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background-color: #F1F4F9;
  background-image: radial-gradient(
    ellipse 70% 40% at 50% -10%,
    rgba(76, 141, 255, 0.09) 0%,
    transparent 70%
  );
}

.auth-panel {
  width: 100%;
  max-width: 22rem;
  background: #ffffff;
  border: 1px solid var(--c-border-light);
  border-radius: 0.5rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.04);
  padding: 2rem;
}

.auth-panel .input,
.auth-panel .select {
  border-color: var(--c-border-light);
}

.auth-panel .btn-primary {
  background-color: var(--c-signal-blue) !important;
  border-color: var(--c-signal-blue) !important;
  width: 100%;
  margin-top: 0.375rem;
}

.auth-panel .btn-primary:hover:not(:disabled) {
  background-color: var(--c-signal-blue-dim) !important;
  border-color: var(--c-signal-blue-dim) !important;
}

[data-theme=dark] .auth-bg {
  background-color: var(--c-ink);
  background-image: radial-gradient(
    ellipse 70% 40% at 50% -10%,
    rgba(76, 141, 255, 0.14) 0%,
    transparent 70%
  );
}

[data-theme=dark] .auth-panel {
  background: var(--c-panel);
  border-color: var(--c-hairline);
}
