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

:root {
  --bg-primary: #0a0f1a;
  --bg-secondary: #111827;
  --bg-card: rgba(17, 24, 39, 0.7);
  --border: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(13, 148, 136, 0.3);
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --teal: #0d9488;
  --teal-light: #14b8a6;
  --teal-glow: rgba(20, 184, 166, 0.15);
  --green: #22c55e;
  --yellow: #eab308;
  --red: #ef4444;
  --blue: #3b82f6;
  --purple: #a855f7;
  --radius: 12px;
  --radius-sm: 8px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

/* -- Header -- */
header {
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(13, 148, 136, 0.06) 0%, transparent 100%);
}
.header-inner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff; flex-shrink: 0;
}
.header-text h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.header-text p { font-size: 0.85rem; color: var(--text-secondary); }

/* -- Main Tabs -- */
.main-tabs {
  display: flex; gap: 0; margin-top: 16px;
  border-bottom: 2px solid var(--border);
}
.main-tab {
  padding: 10px 20px;
  background: none; border: none;
  color: var(--text-muted);
  font-family: inherit; font-size: 0.9rem; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
}
.main-tab:hover { color: var(--text-secondary); }
.main-tab.active {
  color: var(--teal-light);
  border-bottom-color: var(--teal-light);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* -- Glass Cards -- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(12px);
  margin-bottom: 20px;
  transition: border-color 0.2s;
}
.card:hover { border-color: var(--border-glow); }
.card-title {
  font-size: 1rem; font-weight: 600;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
  color: var(--teal-light);
}
.card-title i { font-size: 1.2rem; }

/* -- Upload Zone -- */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--teal);
  background: var(--teal-glow);
}
.upload-zone i { font-size: 48px; color: var(--text-muted); display: block; margin-bottom: 12px; }
.upload-zone p { color: var(--text-secondary); font-size: 0.9rem; }
.upload-zone small { color: var(--text-muted); font-size: 0.8rem; }
.upload-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}

/* -- Forms -- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }
input, textarea, select {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: inherit; font-size: 0.9rem;
  transition: border-color 0.2s;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--teal);
}
textarea { resize: vertical; min-height: 70px; }

/* -- Checkboxes -- */
.checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.checkbox-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.2s;
  font-size: 0.85rem;
}
.checkbox-item:hover { border-color: var(--teal); }
.checkbox-item input[type="checkbox"] { accent-color: var(--teal); width: 16px; height: 16px; }

/* -- Buttons -- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px;
  border: none; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.btn-primary {
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  color: #fff; width: 100%;
  justify-content: center;
  font-size: 1rem; padding: 14px;
}
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; }
.btn-secondary {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.btn-secondary:hover { border-color: var(--teal); }
.btn-group { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 16px; }

/* -- Loading -- */
.loading-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(10, 15, 26, 0.85);
  z-index: 1000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  backdrop-filter: blur(4px);
}
.loading-overlay.active { display: flex; }
.spinner {
  width: 56px; height: 56px;
  border: 3px solid var(--border);
  border-top-color: var(--teal-light);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-steps { text-align: center; }
.loading-steps p {
  font-size: 0.9rem; color: var(--text-secondary);
  padding: 4px 0; transition: all 0.3s;
}
.loading-steps p.active { color: var(--teal-light); font-weight: 600; }
.loading-steps p.done { color: var(--green); }

/* -- Results -- */
#results-section { display: none; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem; font-weight: 600;
}
.badge-teal { background: var(--teal-glow); color: var(--teal-light); border: 1px solid var(--teal); }
.badge-blue { background: rgba(59, 130, 246, 0.15); color: var(--blue); border: 1px solid rgba(59, 130, 246, 0.3); }
.badge-yellow { background: rgba(234, 179, 8, 0.15); color: var(--yellow); border: 1px solid rgba(234, 179, 8, 0.3); }
.badge-green { background: rgba(34, 197, 94, 0.15); color: var(--green); border: 1px solid rgba(34, 197, 94, 0.3); }
.badge-red { background: rgba(239, 68, 68, 0.15); color: var(--red); border: 1px solid rgba(239, 68, 68, 0.3); }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: var(--purple); border: 1px solid rgba(168, 85, 247, 0.3); }

.summary-badges { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.summary-text { color: var(--text-secondary); font-size: 0.9rem; line-height: 1.7; }

/* -- Table -- */
.meas-table { width: 100%; border-collapse: collapse; }
.meas-table th {
  text-align: left; padding: 10px 12px;
  font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.meas-table td {
  padding: 10px 12px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.meas-table tr:last-child td { border-bottom: none; }
.meas-table tr:hover td { background: rgba(255,255,255,0.02); }
.status-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}
.status-normal { background: var(--green); }
.status-alerta { background: var(--yellow); }
.status-critico { background: var(--red); }
.status-nd { background: #475569; opacity: 0.6; }
.meas-mini-card.status-nd-card { border-left-color: #475569; opacity: 0.7; }

.interpretation-text, .treatment-text, .observations-text {
  color: var(--text-secondary); font-size: 0.9rem; line-height: 1.8;
  white-space: pre-wrap;
}

/* -- Stats Row -- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--teal-light);
}
.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* -- Result Tabs -- */
.result-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 4px;
}
.result-tab {
  padding: 8px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}
.result-tab:hover { border-color: var(--teal); color: var(--text-primary); }
.result-tab.active { background: var(--teal-glow); border-color: var(--teal); color: var(--teal-light); }

/* -- Confidence -- */
.confidence-bar {
  display: flex; align-items: center; gap: 8px;
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border);
}
.confidence-bar label { font-size: 0.75rem; color: var(--text-muted); white-space: nowrap; }
.confidence-track {
  flex: 1; height: 6px;
  background: var(--bg-secondary);
  border-radius: 3px; overflow: hidden;
}
.confidence-fill { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.confidence-fill.high { background: var(--green); }
.confidence-fill.medium { background: var(--yellow); }
.confidence-fill.low { background: var(--red); }
.confidence-value { font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); min-width: 36px; text-align: right; }

/* -- Image Annotated View -- */
.annotated-view {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.annotated-image {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}
.annotated-image img {
  width: 100%;
  display: block;
}
.measurement-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 500px;
  overflow-y: auto;
}
.meas-mini-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.meas-mini-card:hover { border-color: var(--teal); }
.meas-mini-card.status-normal-card { border-left-color: var(--green); }
.meas-mini-card.status-alerta-card { border-left-color: var(--yellow); }
.meas-mini-card.status-critico-card { border-left-color: var(--red); }
.meas-mini-card .meas-mini-name { font-size: 0.8rem; font-weight: 600; color: var(--text-primary); }
.meas-mini-card .meas-mini-value { font-size: 0.75rem; color: var(--text-secondary); }
.meas-mini-card .meas-mini-detail {
  display: none;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.meas-mini-card.expanded .meas-mini-detail { display: block; }

/* -- Treatment Comparison Table -- */
.treatment-comparison {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.treatment-option-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.2s;
  position: relative;
}
.treatment-option-card:hover { border-color: var(--teal); }
.treatment-option-card.recommended {
  border-color: var(--teal);
  box-shadow: 0 0 20px rgba(13, 148, 136, 0.15);
}
.treatment-option-card.recommended::after {
  content: "Recomendado";
  position: absolute; top: -10px; right: 16px;
  background: var(--teal); color: white;
  font-size: 0.7rem; font-weight: 600;
  padding: 2px 10px; border-radius: 10px;
}
.treatment-option-name {
  font-size: 1.1rem; font-weight: 700; margin-bottom: 8px;
  color: var(--text-primary);
}
.treatment-option-desc {
  font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 14px;
  line-height: 1.5;
}
.treatment-option-meta {
  display: flex; flex-direction: column; gap: 8px;
}
.treatment-meta-row {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.78rem;
}
.treatment-meta-label { color: var(--text-muted); }
.treatment-meta-value { color: var(--text-primary); font-weight: 600; }
.cost-indicator { letter-spacing: 2px; }

/* -- Patient Progress -- */
.progress-comparison {
  background: var(--teal-glow);
  border: 1px solid var(--teal);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 16px;
}
.progress-comparison h4 {
  font-size: 0.9rem; font-weight: 600; color: var(--teal-light);
  margin-bottom: 8px;
}
.progress-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 0; font-size: 0.82rem;
}
.progress-change {
  font-weight: 600;
}
.progress-change.improved { color: var(--green); }
.progress-change.worsened { color: var(--red); }
.progress-change.stable { color: var(--text-muted); }

/* -- Monitoring Timeline -- */
.timeline {
  position: relative;
  padding-left: 24px;
}
.timeline::before {
  content: "";
  position: absolute; left: 8px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-item {
  position: relative;
  margin-bottom: 20px;
  padding-left: 24px;
}
.timeline-item::before {
  content: "";
  position: absolute; left: -20px; top: 8px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--teal);
  border: 2px solid var(--bg-primary);
}
.timeline-date {
  font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px;
}
.timeline-photo {
  max-width: 200px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.timeline-note {
  font-size: 0.82rem; color: var(--text-secondary); margin-top: 4px;
}

/* -- History -- */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer; transition: all 0.2s;
}
.history-item:hover { border-color: var(--teal); }
.history-meta { font-size: 0.8rem; color: var(--text-muted); }
.history-name { font-size: 0.9rem; font-weight: 500; }
.history-badge { font-size: 0.75rem; }
.history-empty { text-align: center; padding: 24px; color: var(--text-muted); font-size: 0.85rem; }
.history-clear-btn {
  background: none; border: none; color: var(--red);
  font-size: 0.8rem; cursor: pointer; padding: 4px 8px;
}

/* -- Error Card -- */
.error-card {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px; display: none;
}
.error-card.show { display: block; }
.error-card .error-title {
  font-size: 0.95rem; font-weight: 600; color: var(--red);
  margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
.error-card .error-message { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.6; }
.error-card .error-dismiss {
  background: none; border: none; color: var(--red);
  cursor: pointer; font-size: 0.8rem; margin-top: 8px; padding: 4px 0; text-decoration: underline;
}

/* -- Footer -- */
footer {
  padding: 32px 0; text-align: center;
  border-top: 1px solid var(--border); margin-top: 40px;
}
.disclaimer {
  background: rgba(234, 179, 8, 0.08);
  border: 1px solid rgba(234, 179, 8, 0.2);
  border-radius: var(--radius-sm);
  padding: 16px; font-size: 0.82rem; color: var(--yellow);
  margin-bottom: 16px; line-height: 1.6;
}
.copyright { font-size: 0.8rem; color: var(--text-muted); }

/* -- Toast -- */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--teal);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 0.85rem;
  color: var(--teal-light);
  z-index: 2000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* -- Executive Summary -- */
.exec-summary {
  background: linear-gradient(135deg, rgba(13, 148, 136, 0.1), rgba(59, 130, 246, 0.05));
  border: 1px solid var(--teal);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.exec-summary h3 {
  font-size: 0.9rem; font-weight: 600; color: var(--teal-light);
  margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
.exec-summary p {
  font-size: 0.88rem; color: var(--text-secondary); line-height: 1.7;
}

/* -- Scrollbar -- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* -- Print -- */
@media print {
  body { background: #fff; color: #111; }
  .card { border: 1px solid #ddd; background: #fff; backdrop-filter: none; }
  .main-tabs, #upload-section, #patient-section, #analysis-options,
  #history-section, .btn-group, .upload-zone, .result-tabs,
  footer .disclaimer, .toast, .error-card, .confidence-bar { display: none !important; }
  #results-section { display: block !important; }
  .tab-content { display: block !important; }
}

main { padding: 24px 0; }
section { margin-bottom: 8px; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .checkbox-grid { grid-template-columns: 1fr; }
  .header-inner { gap: 10px; }
  .header-text h1 { font-size: 1.2rem; }
  .card { padding: 16px; }
  .upload-zone { padding: 32px 16px; }
  .meas-table { font-size: 0.78rem; }
  .meas-table th, .meas-table td { padding: 8px 6px; }
  .btn-group { flex-direction: column; }
  .btn-group .btn { width: 100%; justify-content: center; }
  .annotated-view { grid-template-columns: 1fr; }
  .treatment-comparison { grid-template-columns: 1fr; }
  .main-tab { padding: 8px 12px; font-size: 0.8rem; }
}

/* ── AUTH OVERLAY ── */
.auth-overlay{position:fixed;inset:0;background:var(--bg-primary);z-index:9999;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:24px;}
.auth-box{background:var(--bg-secondary);border:1px solid var(--border);border-radius:var(--radius);padding:40px 48px;text-align:center;min-width:320px;}
.auth-logo{width:64px;height:64px;background:linear-gradient(135deg,var(--teal),var(--teal-light));border-radius:16px;margin:0 auto 20px;display:flex;align-items:center;justify-content:center;font-size:32px;}
.auth-title{font-size:1.4rem;font-weight:700;margin-bottom:6px;}
.auth-sub{font-size:0.85rem;color:var(--text-secondary);margin-bottom:24px;}
.pin-display{display:flex;gap:10px;justify-content:center;margin-bottom:16px;}
.pin-dot{width:16px;height:16px;border-radius:50%;background:var(--bg-tertiary);border:2px solid var(--border);transition:all .2s;}
.pin-dot.filled{background:var(--teal);border-color:var(--teal);}
.pin-keypad{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;}
.pin-key{background:var(--bg-tertiary);border:1px solid var(--border);border-radius:var(--radius-sm);padding:14px;font-size:1.1rem;font-weight:600;cursor:pointer;color:var(--text-primary);transition:all .2s;}
.pin-key:hover{background:var(--teal-glow);border-color:var(--teal);}
.pin-key.special{color:var(--text-secondary);font-size:0.85rem;}
.pin-error{color:var(--red);font-size:0.82rem;min-height:20px;}

/* ── DASHBOARD ── */
.dash-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:14px;margin-bottom:24px;}
.dash-stat{background:var(--bg-secondary);border:1px solid var(--border);border-radius:var(--radius);padding:20px;text-align:center;transition:border-color .2s;}
.dash-stat:hover{border-color:rgba(20,184,166,.3);}
.dash-stat-val{font-size:2rem;font-weight:800;color:var(--teal-light);line-height:1;}
.dash-stat-lbl{font-size:0.72rem;color:var(--text-muted);text-transform:uppercase;letter-spacing:.05em;margin-top:6px;}
.dash-stat-icon{font-size:1.4rem;margin-bottom:8px;}
.dist-row{display:flex;align-items:center;gap:10px;margin-bottom:8px;}
.dist-label{font-size:0.82rem;color:var(--text-secondary);width:90px;flex-shrink:0;}
.dist-bar{flex:1;height:8px;background:var(--bg-tertiary);border-radius:4px;overflow:hidden;}
.dist-fill{height:100%;border-radius:4px;transition:width .6s ease;}
.dist-count{font-size:0.8rem;color:var(--text-muted);width:40px;text-align:right;}
.recent-analysis{display:flex;align-items:center;gap:12px;padding:10px 0;border-bottom:1px solid var(--border);}
.recent-analysis:last-child{border-bottom:none;}
.recent-name{font-size:0.9rem;font-weight:600;flex:1;}
.recent-meta{font-size:0.78rem;color:var(--text-muted);}

/* ── PATIENT SEARCH ── */
.search-bar{display:flex;gap:10px;margin-bottom:16px;flex-wrap:wrap;}
.search-bar input{flex:1;min-width:160px;}
.search-bar select{min-width:140px;}
.patient-card{background:var(--bg-secondary);border:1px solid var(--border);border-radius:var(--radius);padding:16px;display:flex;align-items:center;gap:14px;cursor:pointer;transition:border-color .2s;}
.patient-card:hover{border-color:rgba(20,184,166,.3);}
.patient-avatar{width:44px;height:44px;background:var(--teal-glow);border:1px solid var(--teal);border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:1.1rem;font-weight:700;color:var(--teal-light);flex-shrink:0;}
.patient-info{flex:1;}
.patient-name{font-size:.95rem;font-weight:600;margin-bottom:2px;}
.patient-meta{font-size:.78rem;color:var(--text-muted);}
.patient-actions{display:flex;gap:8px;}
.btn-icon{background:none;border:1px solid var(--border);border-radius:var(--radius-sm);width:32px;height:32px;display:flex;align-items:center;justify-content:center;cursor:pointer;color:var(--text-secondary);transition:all .2s;font-size:0.9rem;}
.btn-icon:hover{border-color:var(--teal);color:var(--teal-light);}
.btn-icon.danger:hover{border-color:var(--red);color:var(--red);}

/* ── COMPARISON SLIDER ── */
.compare-container{position:relative;width:100%;overflow:hidden;border-radius:var(--radius);cursor:ew-resize;user-select:none;}
.compare-before,.compare-after{position:absolute;top:0;left:0;width:100%;height:100%;}
.compare-before img,.compare-after img{width:100%;height:100%;object-fit:cover;display:block;}
.compare-after{clip-path:inset(0 50% 0 0);}
.compare-divider{position:absolute;top:0;bottom:0;left:50%;width:3px;background:var(--teal);cursor:ew-resize;z-index:10;}
.compare-handle{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:36px;height:36px;background:var(--teal);border-radius:50%;display:flex;align-items:center;justify-content:center;color:#fff;font-size:1rem;}
.compare-label{position:absolute;top:8px;padding:4px 10px;background:rgba(0,0,0,.6);border-radius:4px;font-size:.75rem;font-weight:600;color:#fff;}
.compare-label.before{left:8px;}
.compare-label.after{right:8px;}

/* ── PRESENTATION MODE ── */
.present-overlay{position:fixed;inset:0;background:#0a0f1a;z-index:8000;display:none;flex-direction:column;padding:32px;overflow-y:auto;}
.present-overlay.active{display:flex;}
.present-close{position:fixed;top:20px;right:20px;background:rgba(255,255,255,.1);border:none;color:#fff;width:44px;height:44px;border-radius:50%;cursor:pointer;font-size:1.3rem;display:flex;align-items:center;justify-content:center;z-index:8001;}
.present-header{text-align:center;margin-bottom:40px;}
.present-patient-name{font-size:2rem;font-weight:800;margin-bottom:8px;}
.present-date{font-size:.9rem;color:var(--text-secondary);}
.present-class{display:inline-block;background:var(--teal-glow);border:1px solid var(--teal);color:var(--teal-light);border-radius:8px;padding:8px 24px;font-size:1.1rem;font-weight:700;margin:12px 0;}
.present-summary{font-size:1.1rem;color:var(--text-secondary);max-width:700px;margin:0 auto;line-height:1.7;}
.present-meas-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:12px;margin:32px 0;}
.present-meas-card{background:var(--bg-secondary);border:1px solid var(--border);border-radius:var(--radius);padding:20px;text-align:center;}
.present-meas-name{font-size:.8rem;color:var(--text-muted);text-transform:uppercase;letter-spacing:.05em;margin-bottom:6px;}
.present-meas-val{font-size:1.6rem;font-weight:800;}
.present-meas-status{font-size:.72rem;margin-top:4px;}
.present-treat-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:16px;margin-top:24px;}
.present-treat-card{background:var(--bg-secondary);border:1px solid var(--border);border-radius:var(--radius);padding:20px;}
.present-treat-name{font-size:1rem;font-weight:700;margin-bottom:6px;color:var(--teal-light);}
.present-treat-desc{font-size:.9rem;color:var(--text-secondary);line-height:1.6;}
.present-treat-badge{display:inline-block;background:var(--teal-glow);border:1px solid var(--teal);color:var(--teal-light);border-radius:4px;padding:3px 10px;font-size:.78rem;margin-bottom:8px;}

/* ── ALIGNER TRACKING ── */
.aligner-card{background:var(--bg-secondary);border:1px solid var(--border);border-radius:var(--radius);padding:20px;margin-top:12px;}
.aligner-progress-bar{background:var(--bg-tertiary);border-radius:4px;height:10px;overflow:hidden;margin:10px 0;}
.aligner-progress-fill{height:100%;background:linear-gradient(90deg,var(--teal),var(--teal-light));border-radius:4px;transition:width .6s ease;}
.aligner-info-grid{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:12px;}
.aligner-info-item{background:var(--bg-tertiary);border-radius:var(--radius-sm);padding:10px;text-align:center;}
.aligner-info-val{font-size:1.1rem;font-weight:700;color:var(--teal-light);}
.aligner-info-lbl{font-size:.72rem;color:var(--text-muted);margin-top:2px;}

/* ── CLINICAL NOTES ── */
.note-item{padding:10px 14px;background:var(--bg-tertiary);border-radius:var(--radius-sm);border-left:3px solid var(--teal);margin-bottom:8px;}
.note-date{font-size:.72rem;color:var(--text-muted);margin-bottom:4px;}
.note-text{font-size:.85rem;color:var(--text-secondary);line-height:1.5;}

/* ── CHART ── */
.chart-container{position:relative;height:200px;background:var(--bg-secondary);border:1px solid var(--border);border-radius:var(--radius);padding:16px;margin-top:12px;}

/* ── SETTINGS ── */
.settings-section{margin-bottom:28px;}
.settings-section-title{font-size:.9rem;font-weight:700;color:var(--teal-light);margin-bottom:12px;text-transform:uppercase;letter-spacing:.05em;}
.settings-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
@media(max-width:600px){.settings-grid{grid-template-columns:1fr;}}

/* ── WHATSAPP BTN ── */
.btn-whatsapp{background:#25D366;color:#fff;border:none;}
.btn-whatsapp:hover{background:#20ba5a;transform:translateY(-1px);}

/* ── MOBILE FIX ── */
@media(max-width:640px){
  .dash-grid{grid-template-columns:1fr 1fr;}
  .aligner-info-grid{grid-template-columns:1fr 1fr;}
  .present-meas-grid{grid-template-columns:1fr 1fr;}
  .present-treat-grid{grid-template-columns:1fr;}
  .compare-container{height:250px !important;}
  .search-bar{flex-direction:column;}
  .search-bar input,.search-bar select{width:100%;}
}


/* FASE 3 */
.radar-wrap{position:relative;width:100%;max-width:360px;margin:0 auto 16px}
.radar-legend{display:flex;gap:16px;justify-content:center;flex-wrap:wrap;margin-top:8px}
.radar-legend span{font-size:11px;color:var(--text-muted);display:flex;align-items:center;gap:4px}
.radar-legend span::before{content:"";width:10px;height:10px;border-radius:50%;display:inline-block}
.radar-legend .l-patient::before{background:rgba(0,229,255,.8)}
.radar-legend .l-normal::before{background:rgba(255,255,255,.25)}
#odont-container{background:var(--card-bg);border-radius:12px;padding:16px;margin-top:12px}
.odont-title{font-size:13px;font-weight:600;color:var(--text-muted);margin-bottom:12px;text-align:center;letter-spacing:.5px;text-transform:uppercase}
.odont-svg-wrap{overflow-x:auto}
.odont-svg-wrap svg{display:block;margin:0 auto}
.odont-legend{display:flex;gap:12px;justify-content:center;flex-wrap:wrap;margin-top:10px}
.odont-legend span{font-size:11px;color:var(--text-muted);display:flex;align-items:center;gap:5px}
.odont-legend span::before{content:"";width:10px;height:10px;border-radius:2px;display:inline-block}
.odont-l-normal::before{background:#2a2a3e;border:1px solid #444}
.odont-l-alerta::before{background:rgba(255,193,7,.25);border:1px solid rgba(255,193,7,.6)}
.odont-l-critico::before{background:rgba(255,77,77,.25);border:1px solid rgba(255,77,77,.6)}
.odont-l-ausente::before{background:rgba(100,100,120,.2);border:1px dashed #555}
#photo-quality-alert{display:none;border-radius:8px;padding:10px 14px;margin:8px 0;font-size:13px;border-left:3px solid}
#photo-quality-alert.good{background:rgba(0,200,83,.1);border-color:#00c853;color:#00c853}
#photo-quality-alert.warn{background:rgba(255,193,7,.1);border-color:#ffc107;color:#ffc107}
#photo-quality-alert.bad{background:rgba(255,77,77,.1);border-color:#ff4d4d;color:#ff4d4d}
#consent-modal,#honorarios-modal{position:fixed;inset:0;background:rgba(0,0,0,.75);z-index:3000;display:none;overflow-y:auto}
#consent-modal.open,#honorarios-modal.open{display:flex;align-items:flex-start;justify-content:center;padding:32px 16px}
.consent-box,.honorarios-box{background:#1a1a2e;border-radius:16px;width:100%;max-width:700px;padding:32px;position:relative}
.consent-box h2,.honorarios-box h2{font-size:18px;margin-bottom:16px}
.consent-header{font-size:11px;color:var(--text-muted);margin-bottom:16px}
.consent-types{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:16px}
.consent-type-btn{padding:6px 14px;border-radius:20px;border:1px solid #333;background:transparent;color:var(--text-muted);cursor:pointer;font-size:13px;transition:.2s}
.consent-type-btn.active{border-color:var(--teal);color:var(--teal);background:rgba(0,229,255,.1)}
#consent-preview{background:#fff;color:#111;border-radius:8px;padding:24px;font-family:Georgia,serif;font-size:12px;line-height:1.7;min-height:300px;max-height:500px;overflow-y:auto}
.consent-body{white-space:pre-wrap}
.consent-actions{display:flex;gap:10px;margin-top:16px;justify-content:flex-end}
.btn-close-modal{position:absolute;top:16px;right:16px;background:none;border:none;color:var(--text-muted);cursor:pointer;font-size:20px;line-height:1}
.hon-field{margin-bottom:14px}
.hon-field label{display:block;font-size:12px;color:var(--text-muted);margin-bottom:5px}
.hon-field select,.hon-field input{width:100%;background:rgba(255,255,255,.06);border:1px solid #333;border-radius:8px;padding:8px 12px;color:#fff;font-size:14px}
.hon-result{background:rgba(0,229,255,.07);border:1px solid rgba(0,229,255,.2);border-radius:12px;padding:20px;margin-top:20px;display:none}
.hon-result-title{font-size:12px;color:var(--text-muted);margin-bottom:8px}
.hon-range{font-size:26px;font-weight:700;color:var(--teal)}
.hon-range small{font-size:13px;font-weight:400;color:var(--text-muted)}
.hon-breakdown{margin-top:10px;font-size:13px;color:var(--text-muted);line-height:1.8}
.hon-breakdown strong{color:#fff}
.hon-note{font-size:11px;color:var(--text-muted);margin-top:8px;font-style:italic}
.action-btns-row{display:flex;gap:8px;flex-wrap:wrap;margin:10px 0}
.action-btns-row .btn{flex:1;min-width:100px;font-size:13px;padding:9px 12px}


/* ═══════════════════════════════════════════════════════
   ATLAS ORTHO v7.0 — DESIGN UPGRADE 2026
   Pesquisa: Medical SaaS Premium + Clinical Trustworthy
   ═══════════════════════════════════════════════════════ */

/* 1. Header gradient text — mais premium */
.header-text h1 {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #f1f5f9 0%, #14b8a6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Logo icon glow */
.logo {
  box-shadow: 0 0 24px rgba(20, 184, 166, 0.4);
}

/* 2. Upload zone — shimmer + pulse no ícone */
.upload-zone {
  background: linear-gradient(135deg, rgba(13,148,136,0.06) 0%, rgba(17,24,39,0.4) 100%);
  position: relative;
  overflow: hidden;
}
.upload-zone::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(20,184,166,0.06) 50%, transparent 100%);
  transform: translateX(-100%);
  animation: zone-shimmer 3s ease-in-out infinite;
}
@keyframes zone-shimmer {
  0%   { transform: translateX(-100%); }
  50%  { transform: translateX(100%); }
  100% { transform: translateX(100%); }
}
.upload-zone i {
  animation: icon-pulse 2.5s ease-in-out infinite;
  display: block;
  font-size: 48px;
  color: var(--teal-light);
  margin-bottom: 12px;
}
@keyframes icon-pulse {
  0%, 100% { transform: scale(1);    opacity: 0.6; }
  50%       { transform: scale(1.12); opacity: 1;   }
}
.upload-zone:hover::before { animation-play-state: paused; }
.upload-zone:hover { border-color: var(--teal); }

/* 3. Botão Analisar — shimmer */
.btn-primary {
  position: relative;
  overflow: hidden;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: btn-shine 2.8s ease-in-out infinite;
}
@keyframes btn-shine {
  0%   { left: -60%; }
  50%, 100% { left: 120%; }
}

/* 4. Patient cards — hover lift */
.patient-card {
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1);
}
.patient-card:hover {
  transform: translateY(-3px);
  border-color: rgba(20,184,166,0.4);
  box-shadow: 0 8px 28px rgba(13,148,136,0.15), 0 1px 4px rgba(0,0,0,0.3);
}

/* 5. Stat cards — gradient value + hover glow */
.stat-card {
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  border-color: rgba(20,184,166,0.3);
  box-shadow: 0 4px 16px rgba(13,148,136,0.12);
}
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #f1f5f9 0%, #14b8a6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 6. Card entrada animation */
@keyframes card-enter {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card {
  animation: card-enter 0.35s ease-out forwards;
}

/* 7. PIN screen card — glass mais refinado */
#pin-screen > .card {
  background: linear-gradient(160deg, rgba(20,184,166,0.08) 0%, rgba(17,24,39,0.95) 100%);
  border: 1px solid rgba(20,184,166,0.25);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5), 0 0 0 1px rgba(20,184,166,0.08) inset;
  backdrop-filter: blur(24px);
}
.pin-key {
  transition: all 0.15s ease;
}
.pin-key:hover {
  background: rgba(20,184,166,0.12);
  border-color: var(--teal);
  color: var(--teal-light);
  transform: scale(1.05);
}
.pin-key:active {
  transform: scale(0.96);
}
.pin-dot.filled {
  box-shadow: 0 0 8px rgba(20,184,166,0.5);
}

/* 8. Tab indicator transition suave */
.main-tab {
  transition: color 0.2s ease, border-color 0.2s ease;
  position: relative;
}
.main-tab::after {
  content: '';
  position: absolute;
  bottom: -2px; left: 50%; right: 50%;
  height: 2px;
  background: var(--teal-light);
  transition: left 0.2s ease, right 0.2s ease;
}
.main-tab.active::after {
  left: 0; right: 0;
}

/* 9. Card title accent line */
.card-title {
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(20,184,166,0.1);
  margin-bottom: 20px;
}

/* 10. Disclaimer bar — mais sutil */
.disclaimer-bar {
  border-left: 3px solid var(--yellow);
  background: rgba(234,179,8,0.07);
  padding: 12px 18px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* 11. Reduced motion — respeitar preferência */
@media (prefers-reduced-motion: reduce) {
  .upload-zone::before, .upload-zone i,
  .btn-primary::after, @keyframes card-enter { animation: none; }
  .patient-card:hover, .stat-card:hover { transform: none; }
}

/* 12. Scrollbar custom */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: rgba(20,184,166,0.3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(20,184,166,0.5); }
