:root {
  --sidebar-width: 240px;
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #fff;
  --sidebar-active-bg: #1e40af;
  --topbar-h: 56px;
  --accent: #1e40af;
  --accent-light: #dbeafe;
}

/* ── Layout ── */
body { background: #f1f5f9; font-family: 'Segoe UI', system-ui, sans-serif; }

#wrapper { min-height: 100vh; }

#sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .2s;
}

#page-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Sidebar ── */
.sidebar-brand {
  padding: 20px 20px 16px;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  border-bottom: 1px solid #1e293b;
  letter-spacing: -.3px;
}

.sidebar-nav {
  list-style: none;
  padding: 12px 0;
  margin: 0;
  flex: 1;
}

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  border-radius: 0;
  transition: background .15s, color .15s;
}

.sidebar-nav li a:hover { background: #1e293b; color: #cbd5e1; }
.sidebar-nav li a.active { background: var(--sidebar-active-bg); color: var(--sidebar-active); font-weight: 600; }
.sidebar-nav li a i { font-size: 16px; width: 20px; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #1e293b;
}

.avatar-sm {
  width: 32px; height: 32px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  flex-shrink: 0;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}

/* ── Cards ── */
.card { border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.card-header { background: #f8fafc; border-bottom: 1px solid #e2e8f0; padding: 12px 16px; font-size: 14px; }

/* ── Stat cards ── */
.stat-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}

.stat-value { font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 12px; color: #64748b; margin-top: 4px; }

.stat-new .stat-value { color: #2563eb; }
.stat-progress .stat-value { color: #16a34a; }
.stat-waiting .stat-value { color: #d97706; }
.stat-closed .stat-value { color: #0891b2; }
.stat-rejected .stat-value { color: #dc2626; }
.stat-today .stat-value { color: #7c3aed; }

/* ── Status badges ── */
.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-new      { background: #dbeafe; color: #1d4ed8; }
.badge-progress { background: #dcfce7; color: #15803d; }
.badge-waiting  { background: #fef3c7; color: #b45309; }
.badge-closed   { background: #cffafe; color: #0e7490; }
.badge-rejected { background: #fee2e2; color: #b91c1c; }

/* ── Source badge ── */
.source-badge { font-size: 12px; white-space: nowrap; }

/* ── Table ── */
.table > :not(caption) > * > * { padding: 10px 12px; }
.table thead th { font-size: 12px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .5px; background: #f8fafc; }
.table-hover tbody tr:hover { background: #f8fafc; }
.btn-ghost { background: transparent; border: none; padding: 4px 8px; border-radius: 6px; color: #64748b; }
.btn-ghost:hover { background: #f1f5f9; color: #0f172a; }

/* ── Kanban ── */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: calc(100vh - 180px);
}

.kanban-column {
  min-width: 260px;
  flex: 0 0 260px;
  background: #f1f5f9;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.kanban-col-header {
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kanban-new      { background: #dbeafe; color: #1d4ed8; }
.kanban-progress { background: #dcfce7; color: #15803d; }
.kanban-waiting  { background: #fef3c7; color: #92400e; }
.kanban-closed   { background: #cffafe; color: #0e7490; }
.kanban-rejected { background: #fee2e2; color: #991b1b; }

.kanban-cards { padding: 10px; flex: 1; overflow-y: auto; max-height: calc(100vh - 220px); }

.kanban-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: box-shadow .15s, transform .1s;
  font-size: 13px;
}

.kanban-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); transform: translateY(-1px); }

/* ── Timeline ── */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content:''; position:absolute; left:8px; top:0; bottom:0; width:2px; background:#e2e8f0; }

.timeline-item { position: relative; margin-bottom: 16px; }

.timeline-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  position: absolute;
  left: -20px;
  top: 4px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #e2e8f0;
}

.dot-created { background: #3b82f6; }
.dot-status  { background: #f59e0b; }
.dot-comment { background: #6366f1; }
.dot-call    { background: #10b981; }
.dot-message { background: #0ea5e9; }

.timeline-content {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
}

/* ── Info labels ── */
.info-label { font-size: 11px; font-weight: 600; color: #94a3b8; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.info-value { font-size: 14px; color: #0f172a; }

/* ── Login ── */
.login-body { background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }

.login-container { width: 100%; max-width: 400px; padding: 24px; }

.login-card { background: #fff; border-radius: 16px; padding: 40px 36px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }

.login-logo {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, #1d4ed8, #7c3aed);
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #fff;
  margin: 0 auto 20px;
}

/* ── Toast ── */
.toast { min-width: 240px; }

/* ── Responsive ── */
@media (max-width: 768px) {
  #sidebar { transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #page-content { margin-left: 0; }
}

/* ── Pagination ── */
.pagination .page-link { border: none; color: #475569; font-size: 13px; }
.pagination .page-item.active .page-link { background: var(--accent); color: #fff; border-radius: 6px; }

/* ── Misc ── */
.font-monospace { font-family: 'Courier New', monospace; }
.text-monospace { font-family: 'Courier New', monospace; font-size: 13px; }
