/* =========================================================
   Ticketportaal — Modern UI
   Geïnspireerd op moderne SaaS-stylings (donker met heldere accenten)
   ========================================================= */

:root {
  /* Brand */
  --brand: #0f766e;          /* teal-700 */
  --brand-2: #14b8a6;        /* teal-500 */
  --brand-soft: #ccfbf1;
  --brand-ink: #042f2e;

  /* Neutral */
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;

  /* Status */
  --status-todo: #64748b;
  --status-progress: #2563eb;
  --status-done: #10b981;
  --status-cancelled: #6b7280;

  /* Priority */
  --p-low: #64748b;
  --p-normal: #2563eb;
  --p-high: #f59e0b;
  --p-urgent: #ef4444;

  /* Effects */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.08);

  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark sidebar als signature */
:root {
  --sidebar-bg: #0b1220;
  --sidebar-bg-2: #111a2e;
  --sidebar-text: #cbd5e1;
  --sidebar-text-active: #ffffff;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: rgba(20, 184, 166, 0.15);
  --sidebar-border: rgba(255, 255, 255, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 0.5em; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; letter-spacing: -0.02em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

/* =====  LAYOUT  ===== */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text);
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--sidebar-border);
}

.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  padding: 6px 10px 18px;
  letter-spacing: -0.01em;
}
.sidebar .brand .logo {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand));
  border-radius: 8px;
  display: grid; place-items: center;
  color: #fff; font-weight: 700;
  box-shadow: 0 4px 14px rgba(20, 184, 166, 0.3);
}

.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  transition: var(--transition);
}
.sidebar nav a:hover { background: var(--sidebar-hover); color: #fff; text-decoration: none; }
.sidebar nav a.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  box-shadow: inset 2px 0 0 var(--brand-2);
}
.sidebar nav .group {
  padding: 18px 12px 6px;
  text-transform: uppercase;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: rgba(203, 213, 225, 0.55);
}
.sidebar nav svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }

.sidebar .user-card {
  margin-top: auto;
  padding: 14px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: saturate(180%) blur(12px);
  background-color: rgba(255, 255, 255, 0.85);
}
.topbar .title { font-size: 1.15rem; font-weight: 600; }
.topbar .actions { display: flex; align-items: center; gap: 10px; }

.content { padding: 28px; max-width: 1500px; width: 100%; margin: 0 auto; }

/* ===== Avatar ===== */
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  flex-shrink: 0;
}
.avatar.lg { width: 40px; height: 40px; font-size: 0.9rem; }
.avatar.sm { width: 24px; height: 24px; font-size: 0.65rem; }

/* ===== Cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px; }
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h2, .card-header h3 { margin: 0; }
.card-body { padding: 22px; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.btn-primary:hover { background: #0d6660; transform: translateY(-1px); box-shadow: var(--shadow); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-icon { width: 36px; height: 36px; padding: 0; }

/* ===== Forms ===== */
.field { margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 0.85rem; font-weight: 500; color: var(--text); }
.field .hint { margin-top: 4px; font-size: 0.78rem; color: var(--text-muted); }

.input, .select, .textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: var(--transition);
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* ===== Badges & Status ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge::before {
  content: '';
  display: block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.badge-todo { color: var(--status-todo); background: #f1f5f9; border-color: #e2e8f0; }
.badge-in_progress { color: var(--status-progress); background: #dbeafe; border-color: #bfdbfe; }
.badge-done { color: var(--status-done); background: #d1fae5; border-color: #a7f3d0; }
.badge-cancelled { color: var(--status-cancelled); background: #f3f4f6; border-color: #e5e7eb; }

.priority {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}
.priority-low { color: var(--p-low); }
.priority-normal { color: var(--p-normal); }
.priority-high { color: var(--p-high); }
.priority-urgent { color: var(--p-urgent); font-weight: 600; }
.priority::before {
  content: '';
  display: block;
  width: 8px; height: 8px;
  border-radius: 2px;
  background: currentColor;
}

/* ===== Tables ===== */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.table thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background var(--transition); }
.table tbody tr:hover { background: var(--surface-2); }
.table a { color: var(--text); font-weight: 500; }

/* ===== Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.stat:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat .label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; }
.stat .value { font-size: 2rem; font-weight: 700; margin-top: 6px; letter-spacing: -0.02em; }
.stat .icon {
  position: absolute;
  top: 16px; right: 16px;
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-soft);
  color: var(--brand);
}
.stat.todo .icon { background: #e2e8f0; color: var(--status-todo); }
.stat.progress .icon { background: #dbeafe; color: var(--status-progress); }
.stat.done .icon { background: #d1fae5; color: var(--status-done); }

/* ===== Kanban ===== */
.kanban-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.kanban-toolbar .input,
.kanban-toolbar .select { width: auto; }
.kanban-toolbar .grow { flex: 1; min-width: 200px; }

.kanban {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 16px;
}
@media (max-width: 1024px) {
  .kanban { grid-template-columns: 1fr; }
}

.kanban-col {
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 14px;
  min-height: 200px;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding: 0 4px;
}
.kanban-col-header h3 {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.kanban-col-header h3::before {
  content: '';
  display: block;
  width: 8px; height: 8px;
  border-radius: 50%;
}
.kanban-col[data-status="todo"] .kanban-col-header h3::before { background: var(--status-todo); }
.kanban-col[data-status="in_progress"] .kanban-col-header h3::before { background: var(--status-progress); }
.kanban-col[data-status="done"] .kanban-col-header h3::before { background: var(--status-done); }
.kanban-col-count {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.kanban-cards { display: flex; flex-direction: column; gap: 10px; min-height: 50px; }
.kanban-cards.drag-over { background: rgba(20, 184, 166, 0.08); border-radius: var(--radius-sm); }

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: grab;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); border-color: var(--border-strong); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.5; }

.kanban-card-priority-bar {
  height: 3px;
  border-radius: 2px;
  margin-bottom: 10px;
  background: var(--p-normal);
}
.kanban-card[data-priority="low"] .kanban-card-priority-bar { background: var(--p-low); }
.kanban-card[data-priority="high"] .kanban-card-priority-bar { background: var(--p-high); }
.kanban-card[data-priority="urgent"] .kanban-card-priority-bar { background: var(--p-urgent); }

.kanban-card .ticket-num {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  margin-bottom: 4px;
}
.kanban-card .subject {
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 8px;
  line-height: 1.35;
  color: var(--text);
}
.kanban-card .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.kanban-card .meta-left { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kanban-card a { color: inherit; text-decoration: none; display: block; }
.kanban-card a:hover { text-decoration: none; }

/* ===== Month groups in kanban ===== */
.month-group {
  margin-bottom: 28px;
}
.month-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.month-group-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-transform: capitalize;
}
.month-group-header .count-pill {
  background: var(--brand-soft);
  color: var(--brand-ink);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ===== Flash messages ===== */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 0.88rem;
  border: 1px solid transparent;
  display: flex; align-items: center; gap: 10px;
}
.flash-success { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.flash-error { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.flash-info { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.flash-warning { background: #fef3c7; color: #92400e; border-color: #fde68a; }

/* ===== Auth pages ===== */
.auth-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}

.auth-form-side {
  display: grid;
  place-items: center;
  padding: 40px 20px;
}
.auth-card {
  width: 100%;
  max-width: 420px;
}
.auth-card h1 {
  font-size: 1.6rem;
  margin-bottom: 6px;
}
.auth-card .sub {
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 0.92rem;
}

.auth-art {
  background:
    radial-gradient(at 20% 30%, rgba(20, 184, 166, 0.25) 0px, transparent 50%),
    radial-gradient(at 80% 70%, rgba(15, 118, 110, 0.35) 0px, transparent 50%),
    linear-gradient(135deg, #042f2e, #0f766e 60%, #134e4a);
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 40px;
}
.auth-art::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    radial-gradient(rgba(255,255,255,0.08) 1px, transparent 1px);
  background-size: 28px 28px;
}
.auth-art-content {
  position: relative;
  color: #fff;
  text-align: center;
  max-width: 460px;
}
.auth-art-content h2 {
  font-size: 2rem;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}
.auth-art-content p { color: rgba(255,255,255,0.85); }

/* ===== Ticket detail ===== */
.ticket-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 22px;
  align-items: flex-start;
}
@media (max-width: 1024px) {
  .ticket-layout { grid-template-columns: 1fr; }
}

.timeline { display: flex; flex-direction: column; gap: 14px; padding: 22px; }
.comment {
  display: flex;
  gap: 12px;
}
.comment-body {
  flex: 1;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid var(--border);
}
.comment.is-internal .comment-body { background: #fef3c7; border-color: #fde68a; }
.comment .comment-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  margin-bottom: 6px;
}
.comment .author { font-weight: 600; color: var(--text); }
.comment .when { color: var(--text-muted); }
.comment .text { font-size: 0.9rem; color: var(--text); white-space: pre-wrap; }

.activity-line {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.82rem; color: var(--text-muted);
  padding: 6px 0;
}
.activity-line::before {
  content: '';
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-soft);
  flex-shrink: 0;
}

.sidebar-detail .meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
  gap: 8px;
}
.sidebar-detail .meta-row:last-child { border-bottom: none; }
.sidebar-detail .meta-row .lbl { color: var(--text-muted); }

/* ===== Empty state ===== */
.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}
.empty .icon {
  width: 56px; height: 56px;
  background: var(--surface-2);
  border-radius: 16px;
  display: grid; place-items: center;
  margin: 0 auto 14px;
  color: var(--text-soft);
}
.empty h3 { color: var(--text); margin-bottom: 6px; }

/* ===== Tabs / segmented ===== */
.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.segmented a {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}
.segmented a.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* ===== Utilities ===== */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-6 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-6 { margin-bottom: 24px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }
.font-mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.text-right { text-align: right; }
.hidden { display: none !important; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: -100%; top: 0; z-index: 100;
    transition: left var(--transition);
    width: 260px;
  }
  .sidebar.open { left: 0; }
  .sidebar-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    z-index: 99; opacity: 0; pointer-events: none;
    transition: opacity var(--transition);
  }
  .sidebar-overlay.show { opacity: 1; pointer-events: auto; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px; }
}

.mobile-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  cursor: pointer;
}
@media (max-width: 768px) { .mobile-toggle { display: inline-flex; } }
