/* ====================================================================
   IMEDLOG CONECTA — COMPONENTS
   Cards, badges, semáforos, botões, formulários, tabelas
   ==================================================================== */

/* ── APP SHELL ── */
#app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── HEADER / TOPBAR ── */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  background: rgba(10, 34, 64, 0.96);
  backdrop-filter: blur(20px) saturate(200%);
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-5);
  z-index: var(--z-sticky);
  gap: var(--space-4);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.topbar-logo-mark {
  width: 38px;
  height: 38px;
  background: var(--gradient-accent);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: var(--font-black);
  color: white;
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.topbar-brand h1 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  line-height: 1.1;
}

.topbar-brand span {
  font-size: var(--text-xs);
  color: var(--text-accent);
  font-weight: var(--font-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: 1;
  overflow-x: auto;
  padding: 0 var(--space-4);
}

.topbar-nav-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  transition: all var(--transition-base);
  white-space: nowrap;
  cursor: pointer;
  background: none;
  border: none;
}

.topbar-nav-btn:hover,
.topbar-nav-btn.active {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.topbar-nav-btn.active {
  color: var(--brand-accent);
  background: rgba(249,142,43,0.1);
}

.topbar-nav-btn .nav-icon {
  font-size: 1rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* ── PROFILE SWITCHER ── */
.profile-switcher {
  position: relative;
}

.profile-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  cursor: pointer;
  transition: all var(--transition-base);
  color: var(--text-primary);
}

.profile-btn:hover {
  background: var(--glass-hover);
  border-color: var(--brand-accent);
}

.profile-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.profile-info {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.profile-name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.profile-role {
  font-size: 10px;
  color: var(--text-accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: var(--font-medium);
}

.profile-chevron {
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform var(--transition-base);
}

.profile-switcher.open .profile-chevron {
  transform: rotate(180deg);
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 260px;
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: scaleIn 0.2s ease both;
  transform-origin: top right;
  z-index: var(--z-dropdown);
}

.profile-dropdown-header {
  padding: var(--space-4);
  background: var(--glass-bg);
  border-bottom: 1px solid var(--surface-divider);
}

.profile-dropdown-header p {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-3);
}

.profile-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.profile-option:hover {
  background: var(--surface-hover);
}

.profile-option.selected {
  background: rgba(249,142,43,0.1);
}

.profile-option.selected .profile-option-name {
  color: var(--text-accent);
}

.profile-option-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.profile-option-info { flex: 1; }

.profile-option-name {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.profile-option-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* ── NOTIFICATION BELL ── */
.notif-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all var(--transition-base);
  color: var(--text-secondary);
}

.notif-btn:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  width: 16px; height: 16px;
  background: var(--status-red);
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: var(--font-bold);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--surface-base);
  animation: pulseDot 2s ease-in-out infinite;
}

/* ── MAIN LAYOUT ── */
.app-layout {
  display: flex;
  flex: 1;
  padding-top: var(--header-height);
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--gradient-sidebar);
  border-right: 1px solid var(--surface-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: var(--header-height);
  bottom: 0;
  left: 0;
  overflow-y: auto;
  z-index: var(--z-raised);
  transition: transform var(--transition-slow);
}

.sidebar-section {
  padding: var(--space-4) var(--space-3);
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0 var(--space-2) var(--space-2);
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: var(--space-1);
  position: relative;
}

.sidebar-item:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: rgba(249,142,43,0.12);
  color: var(--brand-accent);
  font-weight: var(--font-semibold);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%; transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--brand-accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sidebar-icon {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: var(--font-bold);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--brand-accent);
  color: white;
}

.sidebar-badge.red { background: var(--status-red); }
.sidebar-badge.green { background: var(--status-green); }

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: var(--space-6);
  min-height: calc(100vh - var(--header-height));
  animation: fadeIn 0.3s ease both;
}

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

/* ── PAGE HEADER ── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.page-header-left {}

.page-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  line-height: var(--leading-tight);
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  font-family: var(--font-primary);
  cursor: pointer;
  transition: all var(--transition-base);
  border: none;
  white-space: nowrap;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  user-select: none;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0);
  transition: background var(--transition-fast);
}

.btn:hover::after {
  background: rgba(255,255,255,0.08);
}

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

.btn-primary {
  background: var(--gradient-accent);
  color: white;
  box-shadow: 0 4px 14px rgba(249,142,43,0.35);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(249,142,43,0.5);
  transform: translateY(-1px);
}

.btn-navy {
  background: var(--brand-blue);
  color: white;
  box-shadow: var(--shadow-blue);
}

.btn-navy:hover {
  background: var(--brand-blue-mid);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
}

.btn-outline:hover {
  background: var(--surface-hover);
  border-color: rgba(255,255,255,0.2);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--surface-card);
  color: var(--text-primary);
}

.btn-success {
  background: var(--gradient-success);
  color: white;
  box-shadow: 0 4px 14px rgba(34,197,94,0.3);
}

.btn-danger {
  background: var(--gradient-danger);
  color: white;
  box-shadow: 0 4px 14px rgba(239,68,68,0.3);
}

.btn-warning {
  background: var(--gradient-warn);
  color: white;
  box-shadow: 0 4px 14px rgba(245,158,11,0.3);
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  border-radius: var(--radius-md);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
  border-radius: var(--radius-xl);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  font-size: 1rem;
}

.btn-icon.btn-lg {
  width: 44px;
  height: 44px;
  font-size: 1.2rem;
  border-radius: var(--radius-lg);
}

.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── CARDS ── */
.card {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  transition: all var(--transition-base);
  animation: fadeIn 0.4s ease both;
}

.card:hover {
  border-color: rgba(255,255,255,0.12);
  box-shadow: var(--shadow-lg);
}

.card.glass {
  background: var(--glass-bg);
  border-color: var(--glass-border);
  backdrop-filter: blur(12px);
}

.card.interactive {
  cursor: pointer;
}

.card.interactive:hover {
  transform: translateY(-2px);
  border-color: rgba(249,142,43,0.3);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--surface-divider);
}

.card-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ── STAT CARDS ── */
.stat-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  animation: slideUp 0.5s ease both;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.stat-card.blue::before { background: var(--gradient-accent); }
.stat-card.green::before { background: var(--gradient-success); }
.stat-card.yellow::before { background: var(--gradient-warn); }
.stat-card.red::before { background: var(--gradient-danger); }
.stat-card.purple::before { background: linear-gradient(135deg, #8B5CF6, #6D28D9); }

.stat-label {
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-value {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: var(--font-black);
  color: var(--text-primary);
  line-height: 1;
  margin: var(--space-2) 0;
  animation: countUp 0.6s ease both;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.stat-change.up {
  color: var(--status-green);
  background: var(--status-green-bg);
}

.stat-change.down {
  color: var(--status-red);
  background: var(--status-red-bg);
}

/* ── BADGES / CHIPS ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  line-height: 1.4;
  white-space: nowrap;
}

.badge-dot {
  width: 6px; height: 6px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.badge-success { background: var(--status-green-bg); color: var(--status-green); }
.badge-success .badge-dot { background: var(--status-green); animation: pulseDot 2s ease-in-out infinite; }

.badge-warning { background: var(--status-yellow-bg); color: var(--status-yellow); }
.badge-warning .badge-dot { background: var(--status-yellow); }

.badge-danger  { background: var(--status-red-bg); color: var(--status-red); }
.badge-danger  .badge-dot { background: var(--status-red); animation: pulseDot 1.5s ease-in-out infinite; }

.badge-info    { background: var(--status-blue-bg); color: var(--status-blue); }
.badge-info    .badge-dot { background: var(--status-blue); }

.badge-purple  { background: var(--status-purple-bg); color: var(--status-purple); }
.badge-gray    { background: var(--status-gray-bg); color: var(--status-gray); }
.badge-accent  { background: var(--brand-accent-glow); color: var(--brand-accent); }

/* ── SEMÁFORO FISCAL/RISCO ── */
.semaforo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
}

.semaforo-indicator {
  width: 12px; height: 12px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  position: relative;
}

.semaforo-indicator::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: var(--radius-full);
  animation: pulseDot 2s ease-in-out infinite;
}

.semaforo.verde {
  background: var(--status-green-bg);
  color: var(--status-green);
  border: 1px solid rgba(34,197,94,0.2);
}
.semaforo.verde .semaforo-indicator { background: var(--status-green); }
.semaforo.verde .semaforo-indicator::after { background: rgba(34,197,94,0.3); }

.semaforo.amarelo {
  background: var(--status-yellow-bg);
  color: var(--status-yellow);
  border: 1px solid rgba(245,158,11,0.2);
}
.semaforo.amarelo .semaforo-indicator { background: var(--status-yellow); animation: trafficBlink 1.5s ease infinite; }
.semaforo.amarelo .semaforo-indicator::after { background: rgba(245,158,11,0.3); }

.semaforo.vermelho {
  background: var(--status-red-bg);
  color: var(--status-red);
  border: 1px solid rgba(239,68,68,0.2);
}
.semaforo.vermelho .semaforo-indicator { background: var(--status-red); }
.semaforo.vermelho .semaforo-indicator::after { background: rgba(239,68,68,0.3); animation: pulseDot 1s ease-in-out infinite; }

/* ── STATUS TIMELINE ── */
.status-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.status-step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  position: relative;
}

.status-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 44px;
  bottom: 0;
  width: 2px;
  background: var(--surface-border);
}

.status-step.done::after {
  background: var(--status-green);
}

.status-step.active::after {
  background: linear-gradient(to bottom, var(--brand-accent), transparent);
}

.step-indicator {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.status-step.done .step-indicator {
  background: var(--status-green-bg);
  color: var(--status-green);
  border: 2px solid var(--status-green);
}

.status-step.active .step-indicator {
  background: var(--brand-accent-glow);
  color: var(--brand-accent);
  border: 2px solid var(--brand-accent);
  animation: glow 2s ease-in-out infinite;
}

.status-step.pending .step-indicator {
  background: var(--surface-raised);
  color: var(--text-muted);
  border: 2px solid var(--surface-border);
}

.status-step.blocked .step-indicator {
  background: var(--status-red-bg);
  color: var(--status-red);
  border: 2px solid var(--status-red);
}

.step-content { flex: 1; }

.step-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.status-step.pending .step-title { color: var(--text-muted); }

.step-desc {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.step-time {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ── FORMS ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
}

.form-label.required::after {
  content: ' *';
  color: var(--status-red);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-raised);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: var(--text-sm);
  transition: all var(--transition-base);
  outline: none;
  appearance: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px var(--brand-accent-glow);
  background: var(--surface-card);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394A3B8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

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

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--status-red);
  display: flex;
  align-items: center;
  gap: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-4);
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

/* ── TABS ── */
.tabs {
  display: flex;
  gap: 0;
  background: var(--surface-raised);
  border-radius: var(--radius-xl);
  padding: 4px;
  border: 1px solid var(--surface-border);
  overflow-x: auto;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  background: none;
  border: none;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--text-secondary);
  background: var(--surface-card);
}

.tab-btn.active {
  background: var(--surface-card);
  color: var(--text-primary);
  font-weight: var(--font-semibold);
  box-shadow: var(--shadow-sm);
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease both; }

/* ── DATA TABLE ── */
.data-table-wrapper {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.data-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--surface-divider);
  background: var(--glass-bg);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: var(--space-3) var(--space-4);
  font-size: 11px;
  font-weight: var(--font-semibold);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
  border-bottom: 1px solid var(--surface-divider);
  background: var(--surface-raised);
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-primary);
  border-bottom: 1px solid var(--surface-divider);
  vertical-align: middle;
}

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

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

.data-table .amount {
  font-family: var(--font-display);
  font-weight: var(--font-bold);
}

.data-table .amount.income { color: var(--status-green); }
.data-table .amount.cost   { color: var(--status-red); }
.data-table .amount.margin { color: var(--brand-accent); }

/* ── VEHICLE CARD ── */
.vehicle-card {
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  transition: all var(--transition-base);
  cursor: pointer;
  animation: fadeIn 0.4s ease both;
  position: relative;
  overflow: hidden;
}

.vehicle-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}

.vehicle-card.disponivel::before { background: var(--gradient-success); }
.vehicle-card.em-rota::before { background: var(--gradient-accent); }
.vehicle-card.pendente::before { background: var(--gradient-warn); }
.vehicle-card.bloqueado::before { background: var(--gradient-danger); }

.vehicle-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(255,255,255,0.15);
}

.vehicle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.vehicle-icon-wrap {
  width: 44px; height: 44px;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.vehicle-info-main h3 {
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

.vehicle-info-main p {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.vehicle-specs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin: var(--space-3) 0;
}

.vehicle-spec-item {
  background: var(--surface-raised);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  text-align: center;
}

.vehicle-spec-val {
  font-size: var(--text-sm);
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

.vehicle-spec-label {
  font-size: 10px;
  color: var(--text-muted);
}

/* ── MODALS ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(8px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: fadeIn 0.2s ease both;
}

.modal {
  background: var(--surface-card);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn 0.25s ease both;
}

.modal-sm { max-width: 440px; }
.modal-md { max-width: 600px; }
.modal-lg { max-width: 860px; }
.modal-xl { max-width: 1100px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--surface-divider);
  position: sticky;
  top: 0;
  background: var(--surface-card);
  z-index: 1;
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
}

.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--status-red-bg);
  color: var(--status-red);
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--surface-divider);
}

/* ── TOAST NOTIFICATIONS ── */
.toast-container {
  position: fixed;
  top: calc(var(--header-height) + 12px);
  right: var(--space-5);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-card);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  min-width: 300px;
  max-width: 420px;
  pointer-events: all;
  animation: slideInRight 0.3s ease both;
}

.toast.hiding {
  animation: slideOutRight 0.3s ease both;
}

.toast-icon {
  width: 32px; height: 32px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.toast.success .toast-icon { background: var(--status-green-bg); color: var(--status-green); border-left: 3px solid var(--status-green); }
.toast.warning .toast-icon { background: var(--status-yellow-bg); color: var(--status-yellow); }
.toast.error   .toast-icon { background: var(--status-red-bg); color: var(--status-red); }
.toast.info    .toast-icon { background: var(--status-blue-bg); color: var(--status-blue); }

.toast.success { border-left: 3px solid var(--status-green); }
.toast.warning { border-left: 3px solid var(--status-yellow); }
.toast.error   { border-left: 3px solid var(--status-red); }
.toast.info    { border-left: 3px solid var(--status-blue); }

.toast-content { flex: 1; }

.toast-title {
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.toast-msg {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ── PROGRESS BAR ── */
.progress-bar {
  height: 6px;
  background: var(--surface-raised);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  animation: progressFill 1s ease both;
}

.progress-fill.orange { background: var(--gradient-accent); }
.progress-fill.green  { background: var(--gradient-success); }
.progress-fill.blue   { background: linear-gradient(90deg, #3B82F6, #1D4ED8); }
.progress-fill.yellow { background: var(--gradient-warn); }
.progress-fill.red    { background: var(--gradient-danger); }

/* ── AVATAR ── */
.avatar {
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-bold);
  flex-shrink: 0;
  overflow: hidden;
}

.avatar-sm { width: 28px; height: 28px; font-size: var(--text-xs); }
.avatar-md { width: 36px; height: 36px; font-size: var(--text-sm); }
.avatar-lg { width: 48px; height: 48px; font-size: var(--text-base); }
.avatar-xl { width: 64px; height: 64px; font-size: var(--text-xl); }

/* ── SEARCH BAR ── */
.search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--surface-raised);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius-xl);
  transition: all var(--transition-base);
}

.search-bar:focus-within {
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px var(--brand-accent-glow);
}

.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: var(--text-sm);
  flex: 1;
}

.search-bar input::placeholder { color: var(--text-muted); }

.search-icon { color: var(--text-muted); font-size: 0.9rem; }

/* ── EMPTY STATE ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-8);
  text-align: center;
  color: var(--text-muted);
  gap: var(--space-4);
}

.empty-state-icon {
  font-size: 3rem;
  opacity: 0.4;
  animation: float 3s ease-in-out infinite;
}

.empty-state h3 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  color: var(--text-secondary);
}

.empty-state p {
  font-size: var(--text-sm);
  max-width: 320px;
  line-height: var(--leading-relaxed);
}

/* ── FINANCIAL HIGHLIGHT (margin blindado) ── */
.financial-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  transition: background var(--transition-fast);
}

.financial-row:hover { background: var(--surface-hover); }

.financial-row-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.financial-row-value {
  font-size: var(--text-base);
  font-weight: var(--font-bold);
  font-family: var(--font-display);
}

.financial-row.total {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
}

.financial-row.total .financial-row-label {
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.margin-locked {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: rgba(249,142,43,0.08);
  border: 1px dashed rgba(249,142,43,0.3);
  border-radius: var(--radius-lg);
  font-size: var(--text-xs);
  color: var(--brand-accent);
}

/* ── LOADING SKELETON ── */
.skeleton {
  background: linear-gradient(90deg,
    var(--surface-raised) 25%,
    var(--surface-hover) 50%,
    var(--surface-raised) 75%
  );
  background-size: 400px 100%;
  border-radius: var(--radius-md);
  animation: shimmer 1.5s ease-in-out infinite;
}

/* ── RESPONSIVE SIDEBAR ── */
@media (max-width: 1024px) {
  :root { --sidebar-width: 240px; }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    padding: var(--space-4);
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .topbar-nav { display: none; }
}
