/* ========================================
   CRM Design System - Dark Premium Theme
   Refined Edition
   ======================================== */

:root {
  /* Colors */
  --bg-primary: #08080d;
  --bg-secondary: #0f0f17;
  --bg-card: #151521;
  --bg-card-hover: #1b1b2d;
  --bg-input: #12121e;
  --bg-sidebar: #0b0b14;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-light: rgba(99, 102, 241, 0.12);
  --accent-glow: rgba(99, 102, 241, 0.25);
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a78bfa 100%);

  --text-primary: #eeeef4;
  --text-secondary: #8888a4;
  --text-muted: #4e4e6a;

  --border: #1e1e32;
  --border-subtle: #191928;
  --border-focus: #6366f1;

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.1);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.1);

  /* Sizing */
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-xs: 7px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.03) inset;
}

/* ========================================
   Reset & Base
   ======================================== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input,
select,
textarea,
button {
  font-family: inherit;
  font-size: inherit;
}

a {
  text-decoration: none;
  color: inherit;
}

::selection {
  background: var(--accent);
  color: white;
}

/* ========================================
   Gradients & Text Effects
   ======================================== */
.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent;
}

/* ========================================
   Login Page - Split Layout
   ======================================== */
.login-body {
  min-height: 100vh;
  display: flex;
  background: var(--bg-primary);
  overflow: hidden;
}

.login-container {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

/* Left Panel */
.login-left {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 60px 80px;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 60px;
}

.brand-name {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-tagline {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 500;
}

.hero-title {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 16px;
  letter-spacing: -0.5px;
  color: var(--text-primary);
}

.hero-desc {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 48px;
  max-width: 440px;
}

.login-features {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

.feature-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.feature-dot.green {
  background: var(--success);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
}

.feature-dot.blue {
  background: var(--info);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.4);
}

.feature-dot.purple {
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent-glow);
}

/* Right Panel */
.login-right {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  overflow: hidden;
}

.login-card-header {
  padding: 36px 36px 0;
}

.login-card-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.login-card-header p {
  color: var(--text-muted);
  font-size: 14px;
}

.login-form {
  padding: 28px 36px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-group label svg {
  opacity: 0.6;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  transition: all 0.25s ease;
  outline: none;
  font-size: 14px;
}

.form-group input:hover,
.form-group select:hover {
  border-color: #2a2a44;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-light), 0 0 20px rgba(99, 102, 241, 0.08);
  background: rgba(99, 102, 241, 0.04);
}

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

.login-card-footer {
  padding: 0 36px 32px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider span {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.credentials-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cred-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
}

.cred-label {
  color: var(--text-muted);
}

.cred-value {
  font-family: 'SF Mono', 'Cascadia Code', monospace;
  color: var(--accent-hover);
  background: var(--accent-light);
  padding: 2px 10px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
}

.error-msg {
  color: var(--danger);
  font-size: 13px;
  text-align: center;
  padding: 10px 14px;
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-xs);
}

/* Background shapes */
.login-bg-shapes {
  position: absolute;
  inset: 0;
  overflow: hidden;
  z-index: 0;
  pointer-events: none;
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.3;
  animation: float 25s infinite ease-in-out;
}

.shape-1 {
  width: 500px;
  height: 500px;
  background: #6366f1;
  top: -200px;
  right: -100px;
}

.shape-2 {
  width: 350px;
  height: 350px;
  background: #8b5cf6;
  bottom: -100px;
  left: 20%;
  animation-delay: -8s;
}

.shape-3 {
  width: 280px;
  height: 280px;
  background: #06b6d4;
  top: 40%;
  right: 30%;
  animation-delay: -16s;
}

@keyframes float {

  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }

  25% {
    transform: translate(30px, -40px) scale(1.05);
  }

  50% {
    transform: translate(-25px, 25px) scale(0.95);
  }

  75% {
    transform: translate(15px, 15px) scale(1.02);
  }
}

/* Spinner */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ========================================
   Buttons
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.25s ease;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity 0.25s;
}

.btn:hover::after {
  opacity: 1;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.btn-login {
  padding: 14px;
  font-size: 15px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.2px;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

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

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

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

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

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

.btn-ghost::after {
  display: none;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-full {
  width: 100%;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-xs);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon::after {
  display: none;
}

/* ========================================
   App Layout
   ======================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-header {
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
  min-height: 72px;
}

.sidebar-title {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  flex: 1;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.2s ease;
  font-weight: 500;
  font-size: 14px;
  position: relative;
}

.nav-item:hover {
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.06);
}

.nav-item.active {
  color: white;
  background: var(--accent-gradient);
  box-shadow: 0 4px 20px var(--accent-glow);
  font-weight: 600;
}

.nav-item.active svg {
  filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.3));
}

.sidebar-footer {
  padding: 16px 14px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--accent-glow);
}

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-logout {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-logout:hover {
  color: var(--danger);
  background: var(--danger-bg);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
}

.main-header {
  height: var(--header-height);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 15, 23, 0.8);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.btn-menu {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.page-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  min-width: 260px;
  transition: all 0.25s ease;
}

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

.search-box input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  width: 100%;
}

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

.content-area {
  flex: 1;
  padding: 28px 32px;
  overflow-y: auto;
}

/* ========================================
   Cards & Tables
   ======================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-card), 0 0 0 1px rgba(99, 102, 241, 0.05);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

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

.data-table thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.data-table tbody tr {
  transition: all 0.15s ease;
}

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

.data-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 13px;
}

.data-table tbody td:first-child {
  color: var(--text-primary);
  font-weight: 600;
}

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

/* ========================================
   Status Badges
   ======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.15);
}

.badge-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.15);
}

.badge-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.15);
}

.badge-info {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.15);
}

.badge-neutral {
  background: rgba(136, 136, 164, 0.08);
  color: var(--text-secondary);
  border: 1px solid rgba(136, 136, 164, 0.1);
}

/* ========================================
   Modal
   ======================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s;
}

.modal-close:hover {
  color: var(--text-primary);
  background: var(--accent-light);
}

.modal-body {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 28px;
  border-top: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
}

/* ========================================
   Upload Slots
   ======================================== */
.upload-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.upload-slot {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: center;
  min-height: 130px;
  justify-content: center;
  position: relative;
}

.upload-slot::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity 0.25s;
  z-index: 0;
}

.upload-slot:hover::before {
  opacity: 0.08;
}

.upload-slot:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.upload-slot.filled {
  border-color: var(--success);
  border-style: solid;
  background: var(--success-bg);
}

.upload-slot .upload-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  position: relative;
  z-index: 1;
}

.upload-slot.filled .upload-icon {
  background: var(--success-bg);
  color: var(--success);
}

.upload-slot .upload-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  position: relative;
  z-index: 1;
}

.upload-slot .upload-hint {
  font-size: 11px;
  color: var(--text-muted);
  position: relative;
  z-index: 1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-slot.filled .upload-label {
  color: var(--success);
}

.upload-slot input[type="file"] {
  display: none;
}

/* ========================================
   Financeira Tabs
   ======================================== */
.tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13px;
  transition: all 0.25s ease;
  letter-spacing: 0.02em;
}

.tab:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.tab.active {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 3px 12px var(--accent-glow);
}

/* ========================================
   Form Rows
   ======================================== */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

/* Select styling */
.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234e4e6a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 40px;
}

/* Textarea */
.form-group textarea {
  resize: vertical;
  min-height: 70px;
}

/* ========================================
   Stats Cards
   ======================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity 0.3s;
}

.stat-card:hover {
  border-color: rgba(99, 102, 241, 0.2);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.purple {
  background: var(--accent-light);
  color: var(--accent);
}

.stat-icon.green {
  background: var(--success-bg);
  color: var(--success);
}

.stat-icon.orange {
  background: var(--warning-bg);
  color: var(--warning);
}

.stat-icon.blue {
  background: var(--info-bg);
  color: var(--info);
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 2px;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 72px 20px;
  color: var(--text-muted);
  text-align: center;
}

.empty-state svg {
  margin-bottom: 20px;
  opacity: 0.3;
}

.empty-state p {
  font-size: 15px;
  margin-bottom: 24px;
  font-weight: 500;
}

/* ========================================
   Action Bar
   ======================================== */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
}

.filter-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filter-select {
  padding: 8px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-primary);
  outline: none;
  font-size: 13px;
  transition: border-color 0.2s;
}

.filter-select:focus {
  border-color: var(--border-focus);
}

/* ========================================
   Toast / Notification
   ======================================== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  animation: toastIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 13px;
  font-weight: 500;
}

.toast.success {
  border-left: 3px solid var(--success);
}

.toast.error {
  border-left: 3px solid var(--danger);
}

.toast.warning {
  border-left: 3px solid var(--warning);
}

@keyframes toastIn {
  from {
    transform: translateX(120%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ========================================
   Calendar Component
   ======================================== */
.calendar-wrapper {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}

.calendar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.calendar-month-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  text-transform: capitalize;
}

.calendar-nav {
  display: flex;
  gap: 6px;
}

.calendar-nav button {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.calendar-nav button:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--border-focus);
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 12px 16px 8px;
  gap: 4px;
}

.calendar-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 4px 0;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 4px 16px 16px;
  gap: 4px;
}

.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  gap: 4px;
  min-height: 48px;
}

.calendar-day:hover {
  background: rgba(99, 102, 241, 0.08);
  color: var(--text-primary);
}

.calendar-day.other-month {
  color: var(--text-muted);
  opacity: 0.35;
}

.calendar-day.today {
  color: var(--accent);
  font-weight: 700;
  background: var(--accent-light);
}

.calendar-day.selected {
  background: var(--accent-gradient);
  color: white;
  font-weight: 700;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.calendar-day.selected .day-dots .dot {
  background: rgba(255, 255, 255, 0.7);
}

.day-number {
  font-size: 14px;
  line-height: 1;
}

.day-dots {
  display: flex;
  gap: 3px;
  height: 6px;
  align-items: center;
}

.day-dots .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-pendente {
  background: var(--warning);
}

.dot-confirmado {
  background: var(--info);
}

.dot-concluido {
  background: var(--success);
}

.dot-cancelado {
  background: var(--danger);
}

/* Day detail sidebar */
.day-detail {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  max-height: calc(100vh - 200px);
}

.day-detail-header {
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.day-detail-date {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.day-detail-weekday {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.day-detail-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.day-event {
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s;
  position: relative;
}

.day-event:hover {
  border-color: var(--border);
  background: var(--bg-card-hover);
}

.day-event-time {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 6px;
}

.day-event-client {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.day-event-tipo {
  font-size: 12px;
  color: var(--text-secondary);
}

.day-event-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  position: absolute;
  top: 10px;
  right: 10px;
}

.day-event-status {
  border-left: 3px solid transparent;
}

.day-event-status.pendente {
  border-left-color: var(--warning);
}

.day-event-status.confirmado {
  border-left-color: var(--info);
}

.day-event-status.concluido {
  border-left-color: var(--success);
}

.day-event-status.cancelado {
  border-left-color: var(--danger);
}

.day-detail-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.day-detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  color: var(--text-muted);
  text-align: center;
  gap: 12px;
  flex: 1;
}

.day-detail-empty p {
  font-size: 13px;
  font-weight: 500;
}

/* ========================================
   Mobile Table Wrapper (horizontal scroll)
   ======================================== */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -4px;
  padding: 0 4px;
}

.table-wrapper::-webkit-scrollbar {
  height: 3px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ========================================
   Mobile Overlay (sidebar backdrop)
   ======================================== */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.visible {
  display: block;
  opacity: 1;
}

/* ========================================
   Responsive - Tablet (≤1024px)
   ======================================== */
@media (max-width: 1024px) {
  .login-container {
    grid-template-columns: 1fr;
  }

  .login-left {
    display: none;
  }

  .login-right {
    padding: 20px;
  }

  .card-header {
    flex-wrap: wrap;
    gap: 12px;
  }

  .data-table {
    min-width: 600px;
  }
}

/* ========================================
   Responsive - Mobile (≤768px)
   ======================================== */
@media (max-width: 768px) {

  /* Sidebar off-canvas */
  .sidebar {
    transform: translateX(-100%);
    width: 280px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.7);
  }

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

  .btn-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xs);
    transition: background 0.2s;
  }

  .btn-menu:active {
    background: var(--accent-light);
  }

  /* Header */
  .main-header {
    padding: 0 16px;
    height: 56px;
  }

  .page-title {
    font-size: 16px;
  }

  .search-box {
    display: none;
  }

  /* Content area */
  .content-area {
    padding: 16px;
  }

  /* Stats - 2 column on mobile */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }

  .stat-card {
    padding: 16px;
    gap: 12px;
  }

  .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
  }

  .stat-icon svg {
    width: 20px;
    height: 20px;
  }

  .stat-value {
    font-size: 24px;
  }

  .stat-label {
    font-size: 11px;
  }

  /* Card */
  .card {
    padding: 16px;
    border-radius: var(--radius-sm);
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 16px;
  }

  .card-header .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
  }

  /* Tables - scroll horizontally */
  .data-table {
    min-width: 550px;
  }

  .data-table thead th {
    padding: 10px 12px;
    font-size: 10px;
    white-space: nowrap;
  }

  .data-table tbody td {
    padding: 12px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* Forms */
  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 14px 16px;
    font-size: 16px;
    /* prevent iOS zoom */
  }

  .form-group label {
    font-size: 12px;
  }

  /* Upload grid */
  .upload-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .upload-slot {
    padding: 16px 10px;
    min-height: 110px;
  }

  /* Tabs */
  .tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 2px;
    padding: 3px;
    flex-wrap: nowrap;
  }

  .tab {
    padding: 9px 12px;
    font-size: 12px;
    flex-shrink: 0;
    min-width: auto;
  }

  /* Modal - full width on mobile */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-width: 100%;
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
    border-bottom: none;
  }

  .modal-overlay.open .modal {
    transform: translateY(0);
  }

  .modal-header {
    padding: 18px 20px;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
  }

  .modal-body {
    padding: 16px 20px;
  }

  .modal-footer {
    padding: 14px 20px;
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    z-index: 1;
  }

  .modal-footer .btn {
    flex: 1;
    padding: 14px;
    justify-content: center;
  }

  /* Buttons - bigger touch targets */
  .btn {
    padding: 12px 20px;
    min-height: 44px;
  }

  .btn-sm {
    padding: 8px 12px;
    min-height: 36px;
  }

  .btn-ghost {
    min-height: 36px;
    padding: 8px;
  }

  /* Toast */
  .toast-container {
    top: auto;
    bottom: 20px;
    right: 16px;
    left: 16px;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }

  /* Empty state */
  .empty-state {
    padding: 48px 20px;
  }

  .empty-state svg {
    width: 44px;
    height: 44px;
  }

  .empty-state p {
    font-size: 14px;
  }

  /* Filters in card header */
  .card-header>div {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    width: 100%;
  }

  .filter-select {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    font-size: 14px;
  }

  /* Calendar mobile */
  .calendar-wrapper {
    grid-template-columns: 1fr;
  }

  .calendar-header {
    padding: 16px;
  }

  .calendar-month-title {
    font-size: 16px;
  }

  .calendar-weekdays {
    padding: 8px 10px 4px;
  }

  .calendar-grid {
    padding: 2px 10px 12px;
    gap: 2px;
  }

  .calendar-day {
    min-height: 40px;
    font-size: 13px;
  }

  .day-detail {
    max-height: none;
  }

  .day-detail-header {
    padding: 16px;
  }

  /* Disable hover effects on touch */
  .stat-card:hover {
    transform: none;
  }

  .upload-slot:hover {
    transform: none;
  }

  .btn-primary:hover {
    transform: none;
  }
}

/* ========================================
   Responsive - Small phones (≤400px)
   ======================================== */
@media (max-width: 400px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    padding: 14px;
  }

  .stat-value {
    font-size: 22px;
  }

  .upload-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .upload-slot {
    min-height: 100px;
    padding: 12px 8px;
  }

  .upload-slot .upload-label {
    font-size: 11px;
  }

  .content-area {
    padding: 12px;
  }

  .card {
    padding: 14px;
  }

  .login-card {
    border-radius: 16px;
  }

  .login-card-header {
    padding: 28px 24px 0;
  }

  .login-form {
    padding: 20px 24px;
  }

  .login-card-footer {
    padding: 0 24px 24px;
  }
}

/* ========================================
   Safe area (notched phones)
   ======================================== */
@supports (padding: env(safe-area-inset-bottom)) {
  .modal-footer {
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .toast-container {
    bottom: calc(20px + env(safe-area-inset-bottom));
  }

  .sidebar-footer {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

/* ========================================
   Touch/Hover detection
   ======================================== */
@media (hover: none) {
  .stat-card:hover {
    transform: none;
    box-shadow: var(--shadow-card);
    border-color: var(--border);
  }

  .stat-card:hover::before {
    opacity: 0;
  }

  .btn-primary:hover {
    transform: none;
  }

  .upload-slot:hover {
    transform: none;
  }

  .upload-slot:hover::before {
    opacity: 0;
  }

  .data-table tbody tr:hover {
    background: transparent;
  }

  /* Active states instead for touch */
  .stat-card:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  .btn:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
  }

  .nav-item:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
  }

  .upload-slot:active {
    transform: scale(0.97);
    border-color: var(--accent);
    transition: all 0.1s ease;
  }
}

/* ========================================
   Scrollbar
   ======================================== */
::-webkit-scrollbar {
  width: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========================================
   Animations
   ======================================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content-area>* {
  animation: fadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Staggered animation for stat cards */
.stats-grid .stat-card:nth-child(1) {
  animation: fadeIn 0.35s ease 0.05s both;
}

.stats-grid .stat-card:nth-child(2) {
  animation: fadeIn 0.35s ease 0.1s both;
}

.stats-grid .stat-card:nth-child(3) {
  animation: fadeIn 0.35s ease 0.15s both;
}

.stats-grid .stat-card:nth-child(4) {
  animation: fadeIn 0.35s ease 0.2s both;
}

/* Table row animation */
.data-table tbody tr {
  animation: fadeIn 0.3s ease both;
}

.data-table tbody tr:nth-child(1) {
  animation-delay: 0.05s;
}

.data-table tbody tr:nth-child(2) {
  animation-delay: 0.08s;
}

.data-table tbody tr:nth-child(3) {
  animation-delay: 0.11s;
}

.data-table tbody tr:nth-child(4) {
  animation-delay: 0.14s;
}

.data-table tbody tr:nth-child(5) {
  animation-delay: 0.17s;
}

.data-table tbody tr:nth-child(6) {
  animation-delay: 0.20s;
}

.data-table tbody tr:nth-child(7) {
  animation-delay: 0.23s;
}

.data-table tbody tr:nth-child(8) {
  animation-delay: 0.26s;
}

.data-table tbody tr:nth-child(9) {
  animation-delay: 0.29s;
}

.data-table tbody tr:nth-child(10) {
  animation-delay: 0.32s;
}

/* Focus ring for accessibility */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}