/* CRM SaaS — advanced UI (static CSS, no bundler). Light/dark: html.dark */

:root {
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sidebar-width: 260px;
  --sidebar-width-collapsed: 76px;
  --topbar-height: auto;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --bg: #f0f2f7;
  --bg-mesh: radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, 0.09), transparent 50%),
    radial-gradient(900px 500px at 100% 0%, rgba(14, 165, 233, 0.07), transparent 45%),
    var(--bg);
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --text: #0f172a;
  --text-secondary: #334155;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #4f46e5;
  --primary-soft: rgba(79, 70, 229, 0.12);
  --primary-hover: #4338ca;
  --accent-cyan: #0ea5e9;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;
  --sidebar: #0c1222;
  --sidebar-border: rgba(255, 255, 255, 0.06);
  --sidebar-text: #f1f5f9;
  --sidebar-muted: #94a3b8;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 4px 16px rgba(15, 23, 42, 0.06);
  --shadow-kpi: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 4px 24px rgba(15, 23, 42, 0.07);
  --ring: 0 0 0 3px rgba(79, 70, 229, 0.25);
  --topbar-glass: rgba(255, 255, 255, 0.72);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

html.dark {
  --topbar-glass: rgba(17, 24, 39, 0.82);
  --bg: #070b14;
  --bg-mesh: radial-gradient(1000px 500px at 15% 0%, rgba(99, 102, 241, 0.15), transparent 50%),
    radial-gradient(800px 400px at 90% 10%, rgba(14, 165, 233, 0.1), transparent 40%),
    var(--bg);
  --surface: #111827;
  --surface-elevated: #151f32;
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --muted: #94a3b8;
  --border: #1e293b;
  --primary-soft: rgba(129, 140, 248, 0.18);
  --sidebar: #030712;
  --sidebar-border: rgba(255, 255, 255, 0.05);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 32px rgba(0, 0, 0, 0.35);
  --shadow-kpi: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 28px rgba(0, 0, 0, 0.4);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-mesh);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(99, 102, 241, 0.22);
  color: var(--text);
}

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  z-index: 100;
  transform: translateY(-160%);
  transition: transform 0.2s var(--ease-out);
}
.skip-link:focus {
  transform: translateY(0);
  outline: none;
  box-shadow: var(--ring);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

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

.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  flex-shrink: 0;
  background: linear-gradient(165deg, var(--sidebar) 0%, #0a0f1a 55%, #060a12 100%);
  color: var(--sidebar-text);
  padding: 1rem 0 0.75rem;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sidebar-border);
  transition: width 0.28s var(--ease-out);
  position: relative;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

html.dark .sidebar {
  box-shadow: 4px 0 32px rgba(0, 0, 0, 0.45);
}

.app-shell.sidebar-collapsed .sidebar {
  width: var(--sidebar-width-collapsed);
}

.app-shell.sidebar-collapsed .sidebar-brand-text,
.app-shell.sidebar-collapsed .sidebar-link-label,
.app-shell.sidebar-collapsed .sidebar-section-label {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  gap: 0.35rem;
}

.app-shell.sidebar-collapsed .sidebar-collapse-toggle {
  margin-left: 0;
}

.app-shell.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

.app-shell.sidebar-collapsed .sidebar-badge {
  margin-left: 0;
  position: absolute;
  top: 0.2rem;
  right: 0.35rem;
  min-width: 1rem;
  height: 1rem;
  font-size: 0.6rem;
}

.app-shell.sidebar-collapsed .sidebar-nav {
  padding: 0 0.4rem;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.85rem 1rem;
  margin: 0 0.65rem 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.03em;
  border-bottom: 1px solid var(--sidebar-border);
  position: relative;
}

.sidebar-brand-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-collapse-toggle {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-collapse-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--sidebar-text);
}

.sidebar-collapse-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.5);
}

.sidebar-toggle-icon {
  display: block;
  transition: transform 0.25s var(--ease-out);
}

.sidebar-section-label {
  padding: 0.85rem 1.1rem 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: rgba(148, 163, 184, 0.65);
  pointer-events: none;
}

.sidebar-brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #0ea5e9 100%);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
  flex-shrink: 0;
}

.sidebar-nav {
  list-style: none;
  margin: 0;
  padding: 0 0.65rem;
}

.sidebar-nav li {
  margin-bottom: 2px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-muted);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.18s ease, color 0.18s ease, transform 0.15s ease;
  position: relative;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--sidebar-text);
  text-decoration: none;
}

.sidebar-link.active {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.28) 0%, rgba(99, 102, 241, 0.08) 100%);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(129, 140, 248, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #a5b4fc, #6366f1);
}

.sidebar-link-label {
  flex: 1;
  min-width: 0;
}

.sidebar-link-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  flex-shrink: 0;
}

.sidebar-badge {
  margin-left: auto;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--accent-rose);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.75rem 1.1rem;
  background: var(--topbar-glass);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, var(--shadow);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
}

.topbar-leading {
  min-width: 0;
}

.topbar-heading {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.038em;
  line-height: 1.2;
  color: var(--text);
}

.topbar-sub {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--muted);
  font-weight: 500;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill-muted {
  background: var(--bg);
  color: var(--muted);
  border: 1px solid var(--border);
}

html.dark .pill-muted {
  background: var(--surface-elevated);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.35rem 0.65rem 0.35rem 0.35rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-width: 220px;
}

.user-chip-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, #6366f1, #8b5cf6 45%, #0ea5e9);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.user-chip-meta {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
  text-align: left;
}

.user-chip-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.user-chip-role {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-group {
  display: inline-flex;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.btn-group .btn {
  border-radius: 0;
  border: none;
  box-shadow: none;
}

.btn-group .btn:not(:last-child) {
  border-right: 1px solid var(--border);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.btn-secondary:hover {
  background: var(--bg);
  color: var(--text);
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  color: var(--muted);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
}

.empty-state h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.empty-state p {
  margin: 0;
  font-size: 0.9rem;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding: 0.65rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.pagination-bar .pagination-meta {
  font-size: 0.8125rem;
  color: var(--muted);
  font-weight: 500;
}

.pagination-bar .pagination-nav {
  display: flex;
  gap: 0.35rem;
}

.btn-icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon svg {
  display: block;
}

.content {
  padding: 1.5rem 1.75rem 2.5rem;
  flex: 1;
}

.content-fade {
  animation: contentIn 0.45s ease both;
}

@keyframes contentIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* KPI grid — SaaS dashboard */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.kpi-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow-kpi);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.1);
  border-color: rgba(99, 102, 241, 0.25);
}

html.dark .kpi-card:hover {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.kpi-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--kpi-accent, var(--primary));
  border-radius: var(--radius) var(--radius) 0 0;
  opacity: 0.95;
}

.kpi-card--indigo {
  --kpi-accent: #6366f1;
}
.kpi-card--cyan {
  --kpi-accent: #0ea5e9;
}
.kpi-card--emerald {
  --kpi-accent: #10b981;
}
.kpi-card--amber {
  --kpi-accent: #f59e0b;
}
.kpi-card--rose {
  --kpi-accent: #f43f5e;
}

.kpi-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.kpi-card-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.kpi-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}

.kpi-card--cyan .kpi-card-icon {
  background: rgba(14, 165, 233, 0.14);
  color: var(--accent-cyan);
}
.kpi-card--emerald .kpi-card-icon {
  background: rgba(16, 185, 129, 0.14);
  color: var(--accent-emerald);
}
.kpi-card--amber .kpi-card-icon {
  background: rgba(245, 158, 11, 0.16);
  color: var(--accent-amber);
}
.kpi-card--rose .kpi-card-icon {
  background: rgba(244, 63, 94, 0.14);
  color: var(--accent-rose);
}

.kpi-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.kpi-card-hint {
  margin-top: 0.45rem;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.4;
}

.kpi-trend {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}

.kpi-trend--up {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.kpi-trend--down {
  background: rgba(244, 63, 94, 0.12);
  color: var(--accent-rose);
}

.kpi-trend--flat {
  background: var(--bg);
  color: var(--muted);
}

/* Legacy stat (other pages) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:hover {
  text-decoration: none;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}

.btn-primary {
  background: linear-gradient(180deg, #6366f1 0%, #4f46e5 100%);
  color: #fff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.35);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #4f46e5 0%, #4338ca 100%);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.4rem;
  margin-bottom: 1.25rem;
}

.card--chart {
  padding-bottom: 1.5rem;
}

.card-title {
  margin: 0 0 1.1rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.card-title-row .card-title {
  margin: 0;
}

.card-caption {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 500;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg);
}

html.dark .data-table th {
  background: rgba(15, 23, 42, 0.5);
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr {
  transition: background 0.12s ease;
}

.data-table tr:hover td {
  background: var(--bg);
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.form-control {
  width: 100%;
  max-width: 480px;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.error-text {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.flash {
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.flash-success {
  background: rgba(22, 163, 74, 0.12);
  color: var(--success);
  border: 1px solid rgba(22, 163, 74, 0.35);
}

.flash-info {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(79, 70, 229, 0.25);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--bg);
  color: var(--muted);
  letter-spacing: 0.02em;
}

.kanban {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  align-items: flex-start;
  scrollbar-width: thin;
}

.kanban-column {
  flex: 0 0 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: calc(100vh - 180px);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.kanban-column-header {
  padding: 0.85rem 1rem;
  font-weight: 600;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.kanban-cards {
  padding: 0.65rem;
  overflow-y: auto;
  flex: 1;
  min-height: 120px;
}

.kanban-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.5rem;
  cursor: grab;
  font-size: 0.85rem;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.kanban-card:hover {
  border-color: rgba(99, 102, 241, 0.35);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card-meta {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.timeline {
  border-left: 2px solid var(--border);
  margin-left: 0.5rem;
  padding-left: 1rem;
}

.timeline-item {
  margin-bottom: 1rem;
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -1.15rem;
  top: 0.35rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.gap {
  gap: 0.5rem;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mb-1 {
  margin-bottom: 1rem;
}

.mb-0 {
  margin-bottom: 0;
}

.chart-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.15rem;
}

@media (max-width: 768px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100% !important;
    min-height: 0;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 0.75rem;
    background: var(--sidebar);
  }

  .sidebar-scroll {
    flex: none;
    width: 100%;
    max-height: none;
    overflow: visible;
  }

  .sidebar-collapse-toggle {
    display: none;
  }

  .sidebar-brand {
    width: 100%;
    margin: 0 0 0.5rem;
    padding: 0 0.5rem 0.75rem;
    border-bottom: 1px solid var(--sidebar-border);
  }

  .app-shell.sidebar-collapsed .sidebar-brand-text,
  .app-shell.sidebar-collapsed .sidebar-link-label,
  .app-shell.sidebar-collapsed .sidebar-section-label {
    display: block;
  }

  .app-shell.sidebar-collapsed .sidebar-link {
    justify-content: flex-start;
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    width: 100%;
    padding: 0 0.25rem;
  }

  .sidebar-nav li {
    margin: 0;
  }

  .sidebar-section-label {
    width: 100%;
    flex-basis: 100%;
    padding: 0.65rem 0.5rem 0.2rem;
  }

  .sidebar-link {
    padding: 0.45rem 0.65rem;
    font-size: 0.8rem;
  }

  .sidebar-link.active::before {
    display: none;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    flex-wrap: wrap;
  }

  .user-chip {
    max-width: none;
    flex: 1 1 100%;
  }
}

.guest-center {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg-mesh);
  background-attachment: fixed;
}

.guest-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.guest-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #6366f1, #8b5cf6, #0ea5e9);
  opacity: 0.9;
}

.guest-card h1 {
  margin: 0.35rem 0 1.25rem;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.sidebar-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 0.75rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.35) transparent;
}

.sidebar-scroll::-webkit-scrollbar {
  width: 5px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.35);
  border-radius: 99px;
}

.card {
  transition: box-shadow 0.22s var(--ease-out), border-color 0.22s ease;
}

.card:not(.card--flush):hover {
  border-color: rgba(99, 102, 241, 0.14);
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.07);
}

html.dark .card:not(.card--flush):hover {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.data-table tbody tr:nth-child(even) td {
  background: rgba(15, 23, 42, 0.025);
}

html.dark .data-table tbody tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

input[type="checkbox"] {
  accent-color: var(--primary);
  width: 1.05rem;
  height: 1.05rem;
  cursor: pointer;
}

.guest-shell {
  position: relative;
  min-height: 100vh;
}

.guest-top-actions {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.guest-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #0ea5e9 100%);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
  margin: 0 auto 1.25rem;
}

.welcome-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.welcome-layout::before {
  content: "";
  position: absolute;
  width: 560px;
  height: 560px;
  top: -180px;
  right: -120px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.22) 0%, transparent 68%);
  pointer-events: none;
}

.welcome-layout::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  bottom: -120px;
  left: -80px;
  background: radial-gradient(circle, rgba(14, 165, 233, 0.16) 0%, transparent 70%);
  pointer-events: none;
}

.welcome-top {
  display: flex;
  justify-content: flex-end;
  padding: 1rem 1.25rem;
  position: relative;
  z-index: 2;
}

.welcome-hero {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem 1.5rem 4rem;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}

.welcome-hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin: 0 0 1rem;
}

.welcome-hero p {
  color: var(--muted);
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
  line-height: 1.55;
}

.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
  margin-top: 0.25rem;
}

.data-table tbody td a {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.data-table tbody td a:hover {
  color: var(--primary);
  border-bottom-color: rgba(79, 70, 229, 0.35);
  text-decoration: none;
}
