:root {
  --primary:       #162318;   /* verde floresta Teva */
  --primary-mid:   #1e3323;   /* hover sidebar */
  --primary-light: #2d4a35;   /* bordas/dividers escuros */
  --accent:        #8bc4a0;   /* mint Teva (letras do logo) */
  --accent-dark:   #5fa882;   /* mint mais escuro para botões */
  --bg-light:      #f4f6f4;   /* fundo geral */
  --bg-green:      #eaf3ec;   /* cards/banners claros */
  --white:         #ffffff;
  --text-dark:     #111827;
  --text-mid:      #374151;
  --text-gray:     #6b7280;
  --border:        #e5e7eb;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.07);
  --shadow:        0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg:     0 8px 32px rgba(0,0,0,0.13);
  --radius:        12px;
  --radius-sm:     8px;
  --sidebar-w:     240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* ── ICONS (Lucide) ─────────────────────────────────────────── */
.icon { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
svg.lucide { display: block; stroke-width: 1.5; }
.btn svg.lucide { width: 15px; height: 15px; }
.nav-icon svg.lucide { width: 17px; height: 17px; }
.stat-icon svg.lucide { width: 24px; height: 24px; }
.qa-icon svg.lucide { width: 28px; height: 28px; }
.upload-icon svg.lucide { width: 40px; height: 40px; stroke-width: 1.2; }
.recent-icon svg.lucide { width: 18px; height: 18px; }
.contract-card-icon svg.lucide { width: 22px; height: 22px; }
.empty-icon svg.lucide { width: 56px; height: 56px; stroke-width: 1; opacity: 0.35; }
.modal-close svg.lucide { width: 18px; height: 18px; }

body {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
}

/* ── SIDEBAR ─────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(139,196,160,0.15);
}

.sidebar-logo img {
  width: 100%;
  max-width: 140px;
  display: block;
  border-radius: 6px;
  margin-bottom: 10px;
}

.sidebar-logo span {
  font-size: 10.5px;
  color: rgba(139,196,160,0.55);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,0.35);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.18s;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.nav-item.active {
  background: rgba(255,255,255,0.13);
  color: #fff;
}

.nav-item .nav-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 15px;
  flex-shrink: 0;
}

.nav-item.active .nav-icon {
  background: var(--accent);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  font-size: 11px;
  color: rgba(255,255,255,0.3);
}

/* ── MAIN ─────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-content {
  padding: 32px;
  flex: 1;
}

/* ── BUTTONS ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 50px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.18s;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-dark);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(22,35,24,0.30);
}

.btn-outline {
  background: transparent;
  color: var(--accent-dark);
  border: 1.5px solid var(--accent-dark);
}

.btn-outline:hover {
  background: var(--bg-green);
}

.btn-ghost {
  background: transparent;
  color: var(--text-gray);
  border: 1.5px solid var(--border);
}

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

.btn-danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1.5px solid #fecaca;
}

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

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

.btn-lg {
  padding: 13px 28px;
  font-size: 15px;
}

/* ── CARDS ─────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

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

.card-header h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
}

.card-body {
  padding: 24px;
}

/* ── STAT CARDS ─────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon.green  { background: #d8f3dc; }
.stat-icon.blue   { background: #dbeafe; }
.stat-icon.amber  { background: #fef3c7; }
.stat-icon.purple { background: #ede9fe; }

.stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-gray);
  margin-top: 4px;
}

/* ── HERO BANNER ────────────────────────── */
.hero-banner {
  background: var(--bg-green);
  border-radius: var(--radius);
  padding: 32px 36px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
}

.hero-banner::after {
  content: '';
}

.hero-text h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
  max-width: 400px;
}

.hero-text h2 span {
  color: var(--accent-dark);
}

.hero-text p {
  font-size: 14px;
  color: var(--primary-light);
  margin: 10px 0 20px;
  max-width: 380px;
}

/* ── FORM ───────────────────────────────── */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-mid);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-dark);
  background: var(--white);
  transition: border-color 0.18s;
  outline: none;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139,196,160,0.18);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.form-hint {
  font-size: 12px;
  color: var(--text-gray);
  margin-top: 5px;
}

/* ── UPLOAD AREA ────────────────────────── */
.upload-area {
  border: 2px dashed var(--accent-dark);
  border-radius: var(--radius);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s;
  background: var(--bg-light);
}

.upload-area:hover, .upload-area.drag-over {
  background: var(--bg-green);
  border-color: var(--primary-mid);
}

.upload-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.upload-area h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 6px;
}

.upload-area p {
  font-size: 13px;
  color: var(--text-gray);
}

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

/* ── TABLE ──────────────────────────────── */
.table-wrap {
  overflow-x: auto;
}

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

thead th {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--bg-light);
}

tbody tr {
  transition: background 0.12s;
}

tbody tr:hover {
  background: var(--bg-light);
}

tbody td {
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--text-mid);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

/* ── BADGES ─────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 50px;
  font-size: 11.5px;
  font-weight: 600;
}

.badge-green  { background: #d1fae5; color: #065f46; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-amber  { background: #fef3c7; color: #92400e; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-gray   { background: #f3f4f6; color: #4b5563; }

/* ── GRID LAYOUT ────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

/* ── CONTRACT CARDS (History) ───────────── */
.contracts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.contract-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: box-shadow 0.18s, transform 0.18s;
}

.contract-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.contract-card-icon {
  width: 44px; height: 44px;
  background: var(--bg-green);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
}

.contract-card h4 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.contract-card .meta {
  font-size: 12px;
  color: var(--text-gray);
  margin-bottom: 4px;
}

.contract-card .actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

/* ── PREVIEW BOX ─────────────────────────── */
.preview-box {
  background: var(--bg-light);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--text-mid);
  white-space: pre-wrap;
  max-height: 400px;
  overflow-y: auto;
  font-family: 'Courier New', monospace;
}

/* ── EMPTY STATE ─────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.empty-state .empty-icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-state h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 13.5px;
  color: var(--text-gray);
  max-width: 320px;
  margin: 0 auto 20px;
}

/* ── TOAST ───────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--primary-light);
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.25s ease;
  max-width: 320px;
}

.toast.success { background: #065f46; }
.toast.error   { background: #991b1b; }
.toast.info    { background: var(--primary-mid); }

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── MODAL ───────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}

.modal {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 540px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
}

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

.modal-header h3 { font-size: 16px; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-gray);
  line-height: 1;
}

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── DIVIDER ─────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── TAG ─────────────────────────────────── */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-green);
  color: var(--primary-mid);
  border-radius: 50px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
}

/* ── PROGRESS ─────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 50px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--primary-light);
  border-radius: 50px;
  transition: width 0.3s ease;
}

/* ── QUICK ACTIONS ────────────────────────── */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.quick-action {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-dark);
  transition: all 0.18s;
}

.quick-action:hover {
  border-color: var(--accent);
  background: var(--bg-green);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.quick-action .qa-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.quick-action h4 {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

.quick-action p {
  font-size: 11.5px;
  color: var(--text-gray);
  margin-top: 3px;
}

/* ── RECENT LIST ──────────────────────────── */
.recent-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.recent-item:last-child { border-bottom: none; }

.recent-icon {
  width: 38px; height: 38px;
  border-radius: 9px;
  background: var(--bg-green);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.recent-info { flex: 1; min-width: 0; }

.recent-info h5 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-info p {
  font-size: 12px;
  color: var(--text-gray);
  margin-top: 2px;
}

.section-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-dark);
  margin-bottom: 16px;
}

.section-title span {
  color: var(--primary-light);
}

/* ── SERVICE CHIPS ────────────────────────── */
.services-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.service-chip input[type="checkbox"] { display: none; }

.service-chip label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-mid);
  transition: all 0.15s;
  user-select: none;
}

.service-chip label:hover {
  border-color: var(--accent);
  background: var(--bg-green);
}

.service-chip input:checked + label {
  border-color: var(--accent-dark);
  background: var(--bg-green);
  color: var(--primary);
  font-weight: 700;
}

.service-chip input:checked + label::before {
  content: '';
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-dark);
  flex-shrink: 0;
}

.add-service-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

/* ── PHASE DEADLINE ROWS ───────────────────── */
.phase-rows { display: flex; flex-direction: column; gap: 10px; }

.phase-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: end;
  padding: 12px 14px;
  background: var(--bg-light);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
}

.phase-row label {
  font-size: 12px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 4px;
  display: block;
}

/* ── PAYMENT BLOCK ─────────────────────────── */
.payment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.payment-summary {
  margin-top: 14px;
  background: var(--bg-green);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13px;
  color: var(--primary);
  line-height: 1.7;
  border-left: 3px solid var(--accent-dark);
}

.payment-summary strong { font-weight: 700; }

/* ── SECTION DIVIDER WITH LABEL ────────────── */
.section-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

/* ── SPLIT LAYOUT ─────────────────────────── */
.split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .split-layout { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
