:root {
  --ink: #0f1923;
  --paper: #f5f2ed;
  --warm: #ede9e2;
  --accent: #b83215;
  --blue: #1a5c8f;
  --gold: #a07820;
  --green: #256840;
  --muted: #6e6660;
  --bd: rgba(15,25,35,0.13);
  --card: #ffffff;
}

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

body {
  background: var(--paper);
  color: var(--ink);
  font-family: 'DM Sans', sans-serif;
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: linear-gradient(rgba(15,25,35,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,25,35,0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none; z-index: 0;
}

header {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 48px;
  background: rgba(245,242,237,0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1.5px solid var(--bd);
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand-icon {
  width: 38px; height: 38px;
  background: var(--ink); border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}
.brand-name { font-family: 'DM Serif Display', serif; font-size: 20px; letter-spacing: -0.4px; }
.brand-sub { font-size: 10px; color: var(--muted); letter-spacing: 2.5px; text-transform: uppercase; }
.header-tag {
  background: var(--green); color: white;
  font-size: 10px; font-weight: 600; letter-spacing: 1.2px;
  text-transform: uppercase; padding: 5px 12px; border-radius: 20px;
}

main { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 52px 28px 80px; }

/* HERO */
.hero { text-align: center; margin-bottom: 56px; }
.eyebrow {
  display: inline-block; font-size: 10px; letter-spacing: 3px;
  text-transform: uppercase; color: var(--green); font-weight: 600;
  margin-bottom: 18px; padding: 5px 14px;
  border: 1.5px solid currentColor; border-radius: 20px;
}
.hero h1 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.1; letter-spacing: -1px; margin-bottom: 18px;
}
.hero h1 em { font-style: italic; color: var(--blue); }
.hero p { font-size: 16px; color: var(--muted); max-width: 520px; margin: 0 auto; line-height: 1.75; }

/* CARD */
.card {
  background: var(--card);
  border: 1.5px solid var(--bd);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 3px 32px rgba(15,25,35,0.07);
  margin-bottom: 24px;
}
.card-head {
  background: var(--ink); padding: 22px 34px;
  display: flex; align-items: center; gap: 12px;
}
.card-head h2 { font-family: 'DM Serif Display', serif; font-size: 20px; color: var(--paper); }
.card-head .ch-sub { font-size: 11px; color: rgba(245,242,237,0.45); letter-spacing: 1.5px; text-transform: uppercase; margin-left: auto; }
.card-body { padding: 34px; display: grid; gap: 30px; }

/* SECTION LABEL */
.sec-label {
  font-size: 10px; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
}
.sec-label::after { content: ''; flex: 1; height: 1px; background: var(--bd); }

/* LOGO AREA */
.logo-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.logo-box {
  width: 130px; height: 72px;
  border: 2px dashed var(--bd); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--warm); overflow: hidden; cursor: pointer;
  transition: border-color .2s;
}
.logo-box:hover { border-color: var(--blue); }
.logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; padding: 4px; }
.logo-ph { font-size: 11px; color: var(--muted); text-align: center; line-height: 1.6; padding: 6px; }
.logo-info h4 { font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.logo-info p { font-size: 12px; color: var(--muted); line-height: 1.55; }
.btn-sm {
  background: var(--warm); border: 1.5px solid var(--bd);
  padding: 7px 16px; border-radius: 7px; font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all .2s; font-family: 'DM Sans', sans-serif;
  margin-top: 9px; display: inline-block;
}
.btn-sm:hover { border-color: var(--blue); background: white; }
.btn-sm.danger { color: var(--accent); }
.btn-sm.danger:hover { border-color: var(--accent); }

/* GRID INFO */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fg { display: flex; flex-direction: column; gap: 5px; }
.fg label { font-size: 11px; font-weight: 600; letter-spacing: 0.5px; color: var(--muted); text-transform: uppercase; }
.fg input, .fg textarea, .fg select {
  background: var(--warm); border: 1.5px solid var(--bd);
  border-radius: 8px; padding: 9px 13px; font-size: 13px;
  font-family: 'DM Sans', sans-serif; color: var(--ink);
  transition: border-color .2s; outline: none;
}
.fg input:focus, .fg textarea:focus, .fg select:focus { border-color: var(--blue); background: white; }
.fg textarea { resize: vertical; min-height: 72px; }
.full { grid-column: 1 / -1; }

/* DROP ZONE */
.drop-zone {
  border: 2px dashed var(--bd); border-radius: 14px;
  padding: 38px 20px; text-align: center; background: var(--warm);
  cursor: pointer; transition: all .25s; position: relative;
}
.drop-zone:hover, .drop-zone.over { border-color: var(--blue); background: rgba(26,92,143,0.05); }
.drop-zone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-icon { font-size: 36px; margin-bottom: 12px; display: block; }
.drop-zone h3 { font-size: 15px; font-weight: 600; margin-bottom: 7px; }
.drop-zone p { font-size: 12px; color: var(--muted); }

/* THUMBS */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 14px; }
.thumb {
  position: relative; border-radius: 9px; overflow: hidden;
  aspect-ratio: 3/4; border: 1.5px solid var(--bd); background: var(--warm);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-rm {
  position: absolute; top: 5px; right: 5px;
  width: 20px; height: 20px; background: rgba(15,25,35,0.65);
  color: white; border: none; border-radius: 50%; cursor: pointer;
  font-size: 10px; display: flex; align-items: center; justify-content: center;
}
.thumb-rm:hover { background: var(--accent); }
.thumb-lbl {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(15,25,35,0.68));
  color: white; font-size: 9px; padding: 14px 5px 4px; text-align: center;
}
.thumb-analyzed { border-color: var(--green) !important; }

/* GALLERY SELECTION */
.gallery-item { cursor: pointer; transition: transform .2s, border-color .2s; position: relative; }
.gallery-item:hover { transform: scale(1.02); border-color: var(--blue); }
.gallery-item.selected { border: 3px solid var(--blue); box-shadow: 0 0 15px rgba(26,92,143,0.3); }
.check-overlay {
    position: absolute; top: 8px; right: 8px;
    background: var(--blue); color: white;
    width: 24px; height: 24px; border-radius: 50%;
    display: none; align-items: center; justify-content: center;
    font-size: 12px; font-weight: bold;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.gallery-item.selected .check-overlay { display: flex; }

/* REPORT TYPE */
.rtype-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.rtype {
  border: 2px solid var(--bd); border-radius: 13px; padding: 20px 18px;
  cursor: pointer; transition: all .2s; position: relative;
}
.rtype:hover { border-color: var(--blue); }
.rtype.sel { border-color: var(--blue); background: rgba(26,92,143,0.05); }
.rtype input { display: none; }
.rtype-icon { font-size: 26px; margin-bottom: 10px; display: block; }
.rtype h3 { font-size: 14px; font-weight: 700; margin-bottom: 5px; }
.rtype p { font-size: 12px; color: var(--muted); line-height: 1.6; }
.rtype .badge {
  position: absolute; top: 13px; right: 13px;
  font-size: 9px; padding: 3px 8px; border-radius: 9px; font-weight: 600; letter-spacing: 0.5px;
}
.badge-full { background: rgba(26,92,143,0.13); color: var(--blue); }
.badge-quick { background: rgba(184,50,21,0.1); color: var(--accent); }
.feat { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.feat li { font-size: 11px; color: var(--muted); list-style: none; display: flex; align-items: center; gap: 5px; }
.feat li::before { content: '✓'; color: var(--green); font-weight: 700; font-size: 10px; }

/* BUTTONS */
.btn-main {
  background: var(--ink); color: var(--paper); border: none;
  padding: 15px 38px; border-radius: 10px; font-size: 14px; font-weight: 600;
  font-family: 'DM Sans', sans-serif; cursor: pointer; transition: all .2s;
  display: flex; align-items: center; gap: 9px;
}
.btn-main:hover { background: var(--blue); transform: translateY(-1px); }
.btn-main:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn-dl {
  background: var(--blue); color: white; border: none;
  padding: 12px 26px; border-radius: 8px; font-size: 13px; font-weight: 600;
  font-family: 'DM Sans', sans-serif; cursor: pointer; transition: all .2s;
  display: flex; align-items: center; gap: 7px;
}
.btn-dl:hover { background: var(--ink); }
.btn-sec {
  background: var(--warm); color: var(--ink);
  border: 1.5px solid var(--bd); padding: 12px 22px;
  border-radius: 8px; font-size: 13px; font-weight: 500;
  font-family: 'DM Sans', sans-serif; cursor: pointer; transition: all .2s;
}
.btn-sec:hover { border-color: var(--ink); }

/* PROGRESS */
.progress-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,25,35,0.88); z-index: 1000;
  align-items: center; justify-content: center; flex-direction: column; gap: 20px;
}
.progress-overlay.on { display: flex; }
.prog-spinner {
  width: 50px; height: 50px;
  border: 3px solid rgba(245,242,237,0.18);
  border-top-color: var(--paper); border-radius: 50%;
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.prog-title { color: var(--paper); font-size: 17px; font-family: 'DM Serif Display', serif; }
.prog-sub { color: rgba(245,242,237,0.5); font-size: 12px; }
.prog-bar-wrap {
  width: 280px; height: 4px; background: rgba(245,242,237,0.15); border-radius: 2px; overflow: hidden;
}
.prog-bar { height: 100%; background: var(--paper); transition: width .4s; border-radius: 2px; }

/* RESULT */
.result {
  display: none; background: white;
  border: 1.5px solid var(--bd); border-radius: 20px; overflow: hidden;
  box-shadow: 0 3px 32px rgba(15,25,35,0.07);
  animation: fadeUp .4s ease;
}
.result.on { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.res-head {
  background: var(--green); padding: 18px 30px;
  display: flex; align-items: center; gap: 12px; color: white;
}
.res-head h3 { font-size: 17px; font-family: 'DM Serif Display', serif; }
.res-head p { font-size: 12px; opacity: .75; }
.res-body { padding: 28px 30px; }
.res-preview {
  background: var(--warm); border-radius: 11px; padding: 22px;
  max-height: 520px; overflow-y: auto; font-size: 13px; line-height: 1.75;
  margin-bottom: 22px; border: 1px solid var(--bd);
}
.res-preview h2 {
  font-family: 'DM Serif Display', serif; font-size: 17px; color: var(--blue);
  margin: 18px 0 9px; border-bottom: 1px solid var(--bd); padding-bottom: 5px;
}
.res-preview h3 { font-size: 13px; font-weight: 700; margin: 12px 0 5px; }
.res-preview p { margin-bottom: 8px; }
.res-preview ul { margin: 6px 0 10px 18px; }
.res-preview li { margin-bottom: 3px; }
.res-preview .highlight {
  background: rgba(184,50,21,0.07); border-left: 3px solid var(--accent);
  padding: 10px 14px; border-radius: 0 6px 6px 0; margin: 10px 0;
}
.res-preview .zone-table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 12px; }
.res-preview .zone-table th { background: rgba(26,92,143,0.1); color: var(--blue); padding: 7px 10px; text-align: left; font-weight: 600; }
.res-preview .zone-table td { padding: 6px 10px; border-bottom: 1px solid var(--bd); }
.res-preview .zone-table tr:last-child td { border: none; }
.res-actions { display: flex; gap: 11px; flex-wrap: wrap; }

/* HEATMAP CANVAS */
.heatmap-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-top: 12px; }
.heatmap-item { border-radius: 10px; overflow: hidden; border: 1.5px solid var(--bd); position: relative; }
.heatmap-item canvas { width: 100%; display: block; }
.heatmap-item .hm-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(15,25,35,0.7));
  color: white; font-size: 10px; padding: 16px 7px 5px; text-align: center;
}

.error-box {
  display: none; background: rgba(184,50,21,0.08); border: 1.5px solid rgba(184,50,21,0.25);
  border-radius: 9px; padding: 13px 18px; color: var(--accent); font-size: 13px; margin-top: 14px;
}
.error-box.on { display: block; }

footer {
  position: relative; z-index: 1; text-align: center;
  padding: 28px; border-top: 1px solid var(--bd);
  font-size: 12px; color: var(--muted);
}
footer strong { color: var(--ink); }

@media (max-width: 680px) {
  header { padding: 14px 18px; }
  main { padding: 28px 14px 56px; }
  .info-grid, .rtype-grid { grid-template-columns: 1fr; }
  .card-body { padding: 22px 18px; }
  .card-head { padding: 18px 20px; }
}

/* TABS CSS */
.tabs {
  display: flex; border-bottom: 2px solid var(--bd); margin-bottom: 24px; gap: 15px;
}
.tab-btn {
  background: none; border: none; padding: 12px 20px; font-size: 14px; font-weight: 600;
  color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px;
  font-family: 'DM Sans', sans-serif; transition: all .2s; display: flex; align-items: center; gap: 8px;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
/* ESTILOS DO LAUDO (PADRÃO MÉDICO) */
.report-body {
  font-family: Arial, sans-serif;
  color: #333;
  line-height: 1.4;
  padding: 20px;
  background: white;
}

.report-header-top {
  border-bottom: 2px solid #1a5c8f;
  padding-bottom: 5px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-weight: bold;
  color: #1a5c8f;
  text-transform: uppercase;
}

.report-title-area {
  text-align: center;
  margin-bottom: 30px;
}

.report-title-area h1 {
  font-size: 24px;
  color: #1a5c8f;
  margin: 0;
  text-transform: uppercase;
}

.report-title-area h2 {
  font-size: 18px;
  color: #5da0d4;
  margin: 5px 0;
}

.report-title-area .report-meta {
  font-size: 11px;
  color: #888;
}

.report-section-title {
  font-size: 16px;
  color: #1a5c8f;
  border-bottom: 1px solid #eee;
  padding-bottom: 4px;
  margin: 25px 0 15px;
  text-transform: uppercase;
  font-weight: bold;
}

.id-table, .summary-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  border: 1px solid #333;
}

.id-table td, .summary-table th, .summary-table td {
  border: 1px solid #333;
  padding: 8px 12px;
  font-size: 12px;
}

.id-table tr td:first-child {
  background-color: #e6f0f7;
  font-weight: bold;
  width: 35%;
}

.summary-table th {
  background-color: #1a5c8f;
  color: white;
  text-align: left;
}

.summary-table tr:nth-child(even) {
  background-color: #f9f9f9;
}

.summary-table .priority-row {
  background-color: #fff0f0 !important;
  color: #b83215;
  font-weight: bold;
}

.report-p {
  font-size: 13px;
  margin-bottom: 12px;
  text-align: justify;
}

.report-list {
  margin-bottom: 15px;
  padding-left: 20px;
}

.report-list li {
  font-size: 13px;
  margin-bottom: 6px;
}

.report-footer {
  margin-top: 40px;
  padding-top: 10px;
  border-top: 1px solid #ccc;
  text-align: center;
  font-size: 10px;
  color: #777;
}

.report-section-subtitle {
  font-size: 14px;
  color: #5da0d4;
  font-weight: bold;
  margin: 15px 0 10px;
}

.report-conclusion {
  background: #f8f9fa;
  border-left: 4px solid #1a5c8f;
  padding: 15px;
  margin: 20px 0;
}
.report-conclusion h3 {
  margin: 0 0 10px;
  color: #1a5c8f;
  font-size: 16px;
}

.report-warning {
  font-size: 11px;
  font-style: italic;
  font-weight: bold;
  color: #666;
  text-align: justify;
  margin-top: 30px;
  border-top: 1px dashed #ccc;
  padding-top: 10px;
}

.report-signature-wrapper {
  margin-top: 40px;
}
.signature-box, .date-box {
  width: 40%;
  text-align: center;
}
.sig-line {
  border-top: 1px solid #333;
  margin-bottom: 8px;
}
.signature-box p, .date-box p {
  margin: 2px 0;
  font-size: 12px;
}
