:root {
  --primary: #1e3a5f;
  --primary-dark: #152d4a;
  --primary-light: #2d5a8f;
  --sidebar-width: 260px;
  --header-height: 60px;
}

[data-bs-theme="dark"] {
  --bs-body-bg: #0f1a2e;
  --bs-body-color: #e2e8f0;
  --bs-border-color: #1e293b;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: #f1f5f9;
  overflow-x: hidden;
}

[data-bs-theme="dark"] body {
  background-color: #0a0f1a;
}

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

.login-card {
  background: white;
  border-radius: 1.5rem;
  box-shadow: 0 25px 60px rgba(0,0,0,0.3);
  max-width: 420px;
  width: 100%;
}

.login-logo {
  width: 72px;
  height: 72px;
  background: rgba(30,58,95,0.1);
  border-radius: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0 auto;
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #1e3a5f 0%, #152d4a 100%);
  z-index: 1040;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-brand-icon {
  width: 42px;
  height: 42px;
  background: rgba(255,255,255,0.15);
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.sidebar-brand-text {
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
}

.sidebar-nav {
  padding: 0.75rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: 0.75rem;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s;
  margin-bottom: 0.15rem;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

.sidebar-link.active {
  background: rgba(255,255,255,0.18);
  color: white;
  font-weight: 600;
}

.sidebar-link i {
  width: 20px;
  text-align: center;
  font-size: 0.95rem;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: auto;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: white;
  padding: 0.5rem;
}

.sidebar-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

/* Main content */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  padding: 1.5rem;
}

/* Top header for mobile */
.top-header {
  display: none;
  background: white;
  border-bottom: 1px solid #e2e8f0;
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 1030;
}

/* Kanban Board */
.kanban-board {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  min-height: calc(100vh - 280px);
  align-items: flex-start;
}

.kanban-column {
  flex: 0 0 300px;
  min-width: 300px;
  background: #f8fafc;
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 240px);
}

[data-bs-theme="dark"] .kanban-column {
  background: #1e293b;
  border-color: #334155;
}

.kanban-column-header {
  padding: 0.85rem 1rem;
  border-radius: 1rem 1rem 0 0;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  position: sticky;
  top: 0;
  z-index: 2;
}

.kanban-column-body {
  padding: 0.6rem;
  overflow-y: auto;
  flex: 1;
}

.kanban-card {
  background: white;
  border-radius: 0.75rem;
  padding: 0.85rem;
  margin-bottom: 0.6rem;
  border: 1px solid #e2e8f0;
  border-left: 4px solid #94a3b8;
  cursor: grab;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  position: relative;
}

.kanban-card:hover {
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.12), 0 4px 10px -6px rgba(0,0,0,0.08);
  transform: translateY(-3px) rotate(0.5deg);
  border-left-width: 6px;
  z-index: 10;
}

.kanban-card:active {
  cursor: grabbing;
  transform: translateY(-1px) rotate(1.5deg) scale(0.99);
  box-shadow: 0 15px 35px -5px rgba(0,0,0,0.18);
}

.kanban-card[data-status="agendado"] { border-left-color: #f59e0b; }
.kanban-card[data-status="em_curso"] { border-left-color: #3b82f6; }
.kanban-card[data-status="concluido"] { border-left-color: #10b981; }
.kanban-card[data-status="cancelado"] { border-left-color: #ef4444; }
.kanban-card-paused { border-left-color: #f59e0b !important; }
.kanban-card-paused .live-timer { color: #f59e0b; }

[data-bs-theme="dark"] .kanban-card {
  background: #1a2332;
  border-color: #334155;
}

[data-bs-theme="dark"] .kanban-card:hover {
  border-color: #475569;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,0.5);
}

.kanban-card-client {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1e293b;
  margin-bottom: 0.3rem;
}

[data-bs-theme="dark"] .kanban-card-client {
  color: #e2e8f0;
}

.kanban-card-location {
  font-size: 0.8rem;
  color: #64748b;
}

.kanban-card-meta {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Timer */
.timer-display {
  font-size: 5rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
}

@media (max-width: 767px) {
  .timer-display {
    font-size: 3.2rem;
  }
}

/* Service card list (mobile chief) */
.service-card {
  border-radius: 1rem;
  transition: all 0.2s;
}

.service-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Responsive */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .top-header {
    display: flex;
  }

  .kanban-column {
    flex: 0 0 280px;
    min-width: 280px;
  }
}

/* Backdrop */
.sidebar-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1035;
}

.sidebar-backdrop.show {
  display: block;
}

/* Stats */
.stat-card {
  border-radius: 1rem;
  border: none;
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

/* Toast */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
}

/* Spinner */
.spinner-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9990;
}

[data-bs-theme="dark"] .spinner-overlay {
  background: rgba(15,26,46,0.7);
}

.kanban-card-late {
  border-left-color: #ef4444 !important;
  animation: latePulse 2s ease-in-out infinite;
}

@keyframes latePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.kanban-card-live {
  border-left-color: #3b82f6 !important;
  animation: livePulse 2s ease-in-out infinite;
}

@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
  50% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
}

/* Print / Export */
@media print {
  .sidebar, .top-header, .btn, .no-print { display: none !important; }
  .main-content { margin-left: 0 !important; padding: 0 !important; }
}
