@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --navy: #0f172a;
  --navy2: #1e293b;
  --blue: #2563eb;
  --blue-light: #3b82f6;
  --green: #059669;
  --green-light: #d1fae5;
  --red: #dc2626;
  --red-light: #fee2e2;
  --yellow: #d97706;
  --yellow-light: #fef3c7;
  --gray: #64748b;
  --gray-light: #f1f5f9;
  --border: #e2e8f0;
  --text: #0f172a;
  --text2: #475569;
}

body { font-family: 'Inter', sans-serif; background: var(--gray-light); color: var(--text); }

/* ── Auth ─────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}
.auth-box {
  background: #fff;
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}
.auth-logo { text-align: center; margin-bottom: 32px; }
.auth-logo h1 { font-size: 28px; font-weight: 700; color: var(--navy); letter-spacing: -0.5px; }
.auth-logo h1 span { color: var(--blue); }
.auth-logo p { color: var(--gray); font-size: 14px; margin-top: 4px; }
.auth-tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 28px; }
.auth-tab {
  flex: 1; padding: 10px; text-align: center; font-size: 14px; font-weight: 500;
  color: var(--gray); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: all 0.2s;
}
.auth-tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ── Forms ─────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--text2); margin-bottom: 6px; }
input, textarea, select {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; transition: border-color 0.2s; outline: none; background: #fff;
}
input:focus, textarea:focus, select:focus { border-color: var(--blue); }
textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 24px; border-radius: 8px; font-size: 14px; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.2s; text-decoration: none;
}
.btn-primary { background: var(--blue); color: #fff; width: 100%; }
.btn-primary:hover { background: #1d4ed8; }
.btn-outline { background: transparent; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-outline:hover { background: var(--blue); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.error-msg { color: var(--red); font-size: 13px; margin-top: 12px; text-align: center; }

/* ── Layout ─────────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px; background: var(--navy); color: #fff;
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh;
  padding: 24px 0; z-index: 10;
}
.sidebar-logo {
  padding: 0 24px 24px; border-bottom: 1px solid rgba(255,255,255,0.1);
  font-size: 20px; font-weight: 700; letter-spacing: -0.5px;
}
.sidebar-logo span { color: var(--blue-light); }
.sidebar-nav { flex: 1; padding: 16px 12px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px;
  color: rgba(255,255,255,0.65); font-size: 14px; font-weight: 500; text-decoration: none;
  transition: all 0.2s; margin-bottom: 2px; cursor: pointer;
}
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,0.1); color: #fff; }
.nav-item .icon { font-size: 18px; width: 20px; text-align: center; }
.sidebar-bottom { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,0.1); }
.sidebar-user { padding: 8px 12px; }
.sidebar-user .name { font-size: 13px; font-weight: 600; }
.sidebar-user .email { font-size: 12px; color: rgba(255,255,255,0.5); }
.btn-logout {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px;
  color: rgba(255,255,255,0.5); font-size: 13px; cursor: pointer; transition: all 0.2s;
  margin-top: 8px; background: none; border: none; width: 100%; text-align: left;
}
.btn-logout:hover { color: #fff; background: rgba(255,255,255,0.1); }

.main { margin-left: 240px; flex: 1; }
.header {
  background: #fff; border-bottom: 1px solid var(--border); padding: 20px 32px;
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 5;
}
.header h2 { font-size: 18px; font-weight: 600; }
.content { padding: 32px; }

/* ── Cards ─────────────────────────────────────────────────────── */
.card {
  background: #fff; border-radius: 12px; padding: 24px;
  border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card { background: #fff; border-radius: 12px; padding: 20px; border: 1px solid var(--border); }
.stat-card .value { font-size: 32px; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-card .label { font-size: 13px; color: var(--gray); margin-top: 6px; }
.stat-card .sub { font-size: 12px; color: var(--green); margin-top: 4px; font-weight: 500; }

/* ── Table ─────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead tr { border-bottom: 2px solid var(--border); }
th { padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600; color: var(--gray); text-transform: uppercase; letter-spacing: 0.5px; }
td { padding: 14px 16px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }
.case-row { cursor: pointer; }

/* ── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-green { background: var(--green-light); color: #065f46; }
.badge-red { background: var(--red-light); color: #991b1b; }
.badge-yellow { background: var(--yellow-light); color: #92400e; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f1f5f9; color: var(--gray); }

/* ── Probability bar ────────────────────────────────────────────── */
.prob-bar { display: flex; align-items: center; gap: 10px; }
.bar-track { flex: 1; background: var(--border); border-radius: 4px; height: 6px; }
.bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.bar-fill.high { background: var(--green); }
.bar-fill.mid { background: var(--yellow); }
.bar-fill.low { background: var(--red); }

/* ── Case Report ────────────────────────────────────────────────── */
.report-hero {
  border-radius: 12px; padding: 32px; margin-bottom: 24px; color: #fff;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px;
}
.report-hero.aceitar { background: linear-gradient(135deg, #059669, #10b981); }
.report-hero.recusar { background: linear-gradient(135deg, #dc2626, #ef4444); }
.report-hero.negociar_acordo { background: linear-gradient(135deg, #d97706, #f59e0b); }
.report-hero.solicitar_documentos { background: linear-gradient(135deg, #2563eb, #3b82f6); }
.report-hero.indicar_especialista { background: linear-gradient(135deg, #7c3aed, #8b5cf6); }
.hero-rec { font-size: 13px; opacity: 0.85; margin-bottom: 4px; }
.hero-title { font-size: 28px; font-weight: 700; }
.hero-right { text-align: right; }
.hero-prob { font-size: 48px; font-weight: 700; line-height: 1; }
.hero-prob-label { font-size: 13px; opacity: 0.85; }

.metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.metric-card { background: #fff; border-radius: 12px; padding: 20px; border: 1px solid var(--border); }
.metric-card .m-label { font-size: 12px; color: var(--gray); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.metric-card .m-value { font-size: 18px; font-weight: 700; }

.analysis-card { background: #fff; border-radius: 12px; padding: 28px; border: 1px solid var(--border); }
.analysis-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 20px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.analysis-body h2 { font-size: 15px; font-weight: 600; margin: 20px 0 8px; color: var(--navy); }
.analysis-body h2:first-child { margin-top: 0; }
.analysis-body p { font-size: 14px; line-height: 1.7; color: var(--text2); }
.analysis-body ul { padding-left: 20px; }
.analysis-body li { font-size: 14px; line-height: 1.7; color: var(--text2); margin-bottom: 4px; }

/* ── New Case ────────────────────────────────────────────────────── */
.new-case-grid { display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
.loading-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,0.75); display: flex;
  flex-direction: column; align-items: center; justify-content: center; z-index: 100;
  backdrop-filter: blur(4px);
}
.loading-overlay.hidden { display: none; }
.spinner {
  width: 48px; height: 48px; border: 4px solid rgba(255,255,255,0.2);
  border-top-color: var(--blue-light); border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: #fff; margin-top: 16px; font-size: 15px; font-weight: 500; }
.loading-sub { color: rgba(255,255,255,0.6); font-size: 13px; margin-top: 4px; }

/* ── Empty state ─────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--text2); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { width: 60px; }
  .sidebar-logo, .nav-item span, .sidebar-user, .btn-logout span { display: none; }
  .main { margin-left: 60px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .new-case-grid { grid-template-columns: 1fr; }
}
