/* ════════════════════════════════════════════════════════════
   MF PREDIAL — SISTEMA DE LAUDOS 4.0
   styles.css
   Identidade: navy/gold, técnica, premium, sóbria
   ════════════════════════════════════════════════════════════ */

/* ── TOKENS ── */
:root {
  --navy:    #0D1B2A;
  --navy2:   #152538;
  --navy3:   #1E3248;
  --navy4:   #253D58;
  --gold:    #C9952A;
  --gold2:   #E8B84B;
  --gold3:   #F4D070;
  --cream:   #F7F2E8;
  --cream2:  #EDE8DB;
  --cream3:  #E5DFCF;
  --white:   #FFFFFF;
  --red:     #C0392B;
  --red2:    #E74C3C;
  --orange:  #E67E22;
  --orange2: #F39C12;
  --green:   #1A7F54;
  --green2:  #27AE60;
  --blue:    #2471A3;
  --blue2:   #2E86C1;
  --purple:  #6C3483;
  --gray:    #8899AA;
  --gray2:   #B0BEC5;
  --gray3:   #CFD8DC;
  --text:    #2D3F50;
  --text2:   #4A6070;
  --border:  rgba(13,27,42,.1);
  --border2: rgba(13,27,42,.06);
  --sh1: 0 1px 4px rgba(13,27,42,.08);
  --sh2: 0 3px 14px rgba(13,27,42,.12);
  --sh3: 0 6px 28px rgba(13,27,42,.16);
  --tb-h: 52px;
  --sb-w: 218px;
  --r: 2px;
  --font-sans: 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-head: Georgia, 'Times New Roman', serif;
  --font-mono: 'Consolas', 'Courier New', monospace;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body { font-family: var(--font-sans); background: var(--cream); color: var(--text); overflow-x: hidden; }
a { text-decoration: none; color: inherit; cursor: pointer; }
button { font-family: var(--font-sans); cursor: pointer; border: none; }
input, select, textarea { font-family: var(--font-sans); }
img { display: block; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* ════════════════════════
   SPLASH
   ════════════════════════ */
#splash {
  position: fixed; inset: 0; background: var(--navy);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000; transition: opacity .4s;
}
#splash.hide { opacity: 0; pointer-events: none; }
.splash-content { text-align: center; }
.splash-logo {
  width: 56px; height: 56px; background: var(--gold);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 1.4rem; font-weight: 700;
  color: var(--navy); margin-bottom: 16px;
}
.splash-title { font-family: var(--font-head); font-size: 1.6rem; font-weight: 700; color: white; }
.splash-sub { font-size: .72rem; color: rgba(201,149,42,.7); letter-spacing: .2em; text-transform: uppercase; margin-top: 5px; }
.splash-bar { width: 200px; height: 2px; background: rgba(255,255,255,.1); margin: 24px auto 0; overflow: hidden; }
.splash-fill { height: 100%; background: var(--gold); animation: splashload 1.4s infinite; }
@keyframes splashload { 0%{transform:translateX(-100%)} 100%{transform:translateX(400%)} }
.splash-msg { font-size: .68rem; color: rgba(255,255,255,.3); margin-top: 12px; letter-spacing: .06em; }

/* ════════════════════════
   TOOLBAR
   ════════════════════════ */
#toolbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--tb-h);
  background: var(--navy); border-bottom: 2px solid var(--gold);
  display: flex; align-items: center; gap: 0; z-index: 800;
}
.tb-left {
  display: flex; align-items: center; gap: 10px;
  padding: 0 16px; flex-shrink: 0;
}
.tb-logo {
  width: 32px; height: 32px; background: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 700; font-size: .85rem;
  color: var(--navy); flex-shrink: 0;
}
.tb-brand { display: flex; flex-direction: column; gap: 1px; }
.tb-name { font-size: .8rem; font-weight: 700; color: var(--gold2); letter-spacing: .04em; }
.tb-ver { font-size: .58rem; color: rgba(255,255,255,.35); letter-spacing: .1em; text-transform: uppercase; }
.tb-center {
  flex: 1; min-width: 0; padding: 0 16px;
  border-left: 1px solid rgba(255,255,255,.07);
  border-right: 1px solid rgba(255,255,255,.07);
}
.tb-case-name {
  font-size: .8rem; color: rgba(255,255,255,.8);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tb-case-id {
  font-family: var(--font-mono); font-size: .6rem;
  color: rgba(201,149,42,.55); margin-top: 1px;
}
.tb-right {
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px; flex-shrink: 0;
}

/* Save badge */
.save-badge {
  display: flex; align-items: center; gap: 5px;
  font-size: .68rem; font-family: var(--font-mono);
  padding: 4px 10px; border-radius: var(--r); white-space: nowrap;
  transition: all .3s;
}
.save-badge[data-state="idle"]   { background: rgba(136,153,170,.15); color: var(--gray2); }
.save-badge[data-state="saved"]  { background: rgba(26,127,84,.2); color: #6DDBA0; }
.save-badge[data-state="pending"]{ background: rgba(230,126,34,.2); color: #F0A455; }
.save-badge[data-state="saving"] { background: rgba(36,113,163,.2); color: #7BB8E0; }
.save-badge[data-state="error"]  { background: rgba(192,57,43,.2); color: #F1948A; }
.save-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; display: inline-block; flex-shrink: 0;
}
.save-badge[data-state="saving"] .save-dot {
  animation: blink .8s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* ════════════════════════
   LAYOUT
   ════════════════════════ */
#layout {
  display: flex; min-height: 100vh;
  margin-top: var(--tb-h);
}

/* ════════════════════════
   SIDEBAR
   ════════════════════════ */
#sidebar {
  width: var(--sb-w); flex-shrink: 0;
  background: var(--navy2);
  border-right: 1px solid rgba(201,149,42,.1);
  position: sticky; top: var(--tb-h); height: calc(100vh - var(--tb-h));
  overflow-y: auto; padding-bottom: 32px;
}
.sb-group-label {
  font-size: .58rem; color: rgba(201,149,42,.5); letter-spacing: .2em;
  text-transform: uppercase; padding: 14px 14px 5px;
}
.sb-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 14px;
  color: rgba(247,242,232,.4); font-size: .8rem;
  border-left: 2px solid transparent; transition: all .15s;
}
.sb-item:hover { color: var(--gold2); background: rgba(201,149,42,.07); }
.sb-item.active { color: var(--gold2); background: rgba(201,149,42,.1); border-left-color: var(--gold); }
.sb-ic { font-size: .85rem; min-width: 16px; text-align: center; }
.sb-divider { height: 1px; background: rgba(255,255,255,.05); margin: 8px 14px; }

/* Case steps */
.case-steps-locked { opacity: .35; pointer-events: none; }
.case-steps-locked.unlocked { opacity: 1; pointer-events: auto; }
.sb-step {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px 8px 26px;
  color: rgba(247,242,232,.3); font-size: .77rem;
  border-left: 2px solid transparent; transition: all .15s;
}
.sb-step:hover { color: rgba(247,242,232,.7); background: rgba(255,255,255,.04); }
.sb-step.active { color: var(--gold2); border-left-color: var(--gold); background: rgba(201,149,42,.08); }
.sb-step.done { color: rgba(80,200,120,.55); }
.step-num {
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(255,255,255,.1); display: flex; align-items: center;
  justify-content: center; font-size: .6rem; font-weight: 700;
  font-family: var(--font-mono); flex-shrink: 0;
}
.sb-step.active .step-num { background: var(--gold); color: var(--navy); }
.sb-step.done .step-num { background: rgba(26,127,84,.4); color: #6DDBA0; }

/* ════════════════════════
   MAIN CONTENT
   ════════════════════════ */
#main { flex: 1; min-width: 0; padding: 28px 32px 60px; }

/* ════════════════════════
   BUTTONS
   ════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; font-size: .78rem; font-weight: 600;
  border-radius: var(--r); border: none; cursor: pointer;
  transition: all .15s; letter-spacing: .03em; white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-gold   { background: var(--gold); color: var(--navy); }
.btn-gold:hover:not(:disabled) { background: var(--gold2); }
.btn-navy   { background: var(--navy3); color: var(--gold2); border: 1px solid rgba(201,149,42,.22); }
.btn-navy:hover:not(:disabled) { background: var(--gold); color: var(--navy); }
.btn-ghost  { background: transparent; color: rgba(255,255,255,.55); border: 1px solid rgba(255,255,255,.14); }
.btn-ghost:hover:not(:disabled) { color: white; border-color: rgba(255,255,255,.35); }
.btn-red    { background: var(--red); color: white; }
.btn-red:hover:not(:disabled) { background: var(--red2); }
.btn-green  { background: var(--green); color: white; }
.btn-green:hover:not(:disabled) { background: var(--green2); }
.btn-outline { background: transparent; color: var(--navy); border: 1px solid var(--border); }
.btn-outline:hover:not(:disabled) { background: var(--cream2); }
.btn-sm  { padding: 5px 12px; font-size: .72rem; }
.btn-xs  { padding: 3px 8px;  font-size: .66rem; }
.btn-icon { padding: 5px 8px; }

/* ════════════════════════
   PAGE HEADER
   ════════════════════════ */
.page-hd { margin-bottom: 24px; }
.page-hd-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-family: var(--font-head); font-size: 1.55rem; font-weight: 700; color: var(--navy); }
.page-sub { font-size: .83rem; color: var(--gray); margin-top: 4px; line-height: 1.6; }
.gold-rule { width: 44px; height: 2px; background: var(--gold); margin: 10px 0 0; }

/* ════════════════════════
   CARDS
   ════════════════════════ */
.card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; margin-bottom: 16px;
  box-shadow: var(--sh1);
}
.card-hd {
  background: var(--navy); padding: 9px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-hd-title {
  font-size: .68rem; font-weight: 700; color: var(--gold2);
  text-transform: uppercase; letter-spacing: .12em;
}
.card-body { padding: 16px; }

/* ════════════════════════
   FORM ELEMENTS
   ════════════════════════ */
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.form-grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; }
.col-full { grid-column: 1 / -1; }
@media (max-width: 780px) { .form-grid, .form-grid-3, .form-grid-4 { grid-template-columns: 1fr; } }

.fg { display: flex; flex-direction: column; gap: 4px; }
.fl {
  font-size: .65rem; font-weight: 700; color: var(--navy);
  text-transform: uppercase; letter-spacing: .07em;
}
.fl .req { color: var(--red); margin-left: 2px; }
.fi {
  border: 1px solid var(--gray3); padding: 7px 10px; font-size: .85rem;
  color: var(--text); background: white; border-radius: var(--r);
  outline: none; width: 100%; transition: border-color .15s, box-shadow .15s;
}
.fi:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201,149,42,.15); }
.fi.has-error { border-color: var(--red); }
select.fi {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%238899AA' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  padding-right: 26px;
}
textarea.fi { resize: vertical; min-height: 64px; }
.fhint { font-size: .65rem; color: var(--gray); font-style: italic; }
.fsep {
  font-size: .64rem; font-weight: 700; color: var(--gold);
  text-transform: uppercase; letter-spacing: .14em;
  border-bottom: 1px solid var(--cream2); padding: 10px 0 5px; margin-bottom: 12px;
}

/* Checkbox */
.check-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; font-size: .82rem; cursor: pointer;
}
.check-row input[type="checkbox"] { accent-color: var(--gold); width: 15px; height: 15px; }

/* ════════════════════════
   STATS GRID
   ════════════════════════ */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.stat-box { background: white; border: 1px solid var(--border); padding: 16px 14px; }
.stat-n { font-family: var(--font-head); font-size: 2rem; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-l { font-size: .65rem; color: var(--gray); text-transform: uppercase; letter-spacing: .1em; margin-top: 5px; }
.stat-box.hl { background: var(--navy); border-color: var(--gold); }
.stat-box.hl .stat-n { color: var(--gold2); }
.stat-box.hl .stat-l { color: rgba(247,242,232,.4); }

/* ════════════════════════
   QUICK ACTIONS
   ════════════════════════ */
.qa-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 22px; }
.qa-card {
  background: white; border: 1px solid var(--border); padding: 22px 16px;
  cursor: pointer; transition: all .18s; text-align: center;
}
.qa-card:hover { border-color: var(--gold); transform: translateY(-1px); box-shadow: var(--sh2); }
.qa-icon { font-size: 1.7rem; display: block; margin-bottom: 8px; }
.qa-title { font-size: .88rem; font-weight: 700; color: var(--navy); }
.qa-desc  { font-size: .72rem; color: var(--gray); margin-top: 3px; }

/* ════════════════════════
   DATA TABLE (Meus Casos)
   ════════════════════════ */
.tbl-wrap { overflow-x: auto; }
.tbl {
  width: 100%; border-collapse: collapse; font-size: .82rem;
}
.tbl th {
  background: var(--navy); color: var(--gold2); padding: 8px 12px;
  font-size: .62rem; text-transform: uppercase; letter-spacing: .12em;
  font-weight: 700; white-space: nowrap; text-align: left;
}
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--cream2); vertical-align: middle; }
.tbl tr:hover td { background: rgba(201,149,42,.04); }
.tbl .tbl-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.tbl .mono { font-family: var(--font-mono); font-size: .68rem; color: var(--gold); }
.tbl .name-link { font-weight: 600; cursor: pointer; }
.tbl .name-link:hover { color: var(--blue); text-decoration: underline; }

/* ════════════════════════
   BADGES
   ════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 7px; font-size: .62rem; font-weight: 700;
  border-radius: 2px; letter-spacing: .04em; text-transform: uppercase;
  border: 1px solid transparent;
}
.badge-rascunho  { background: rgba(136,153,170,.1); color: var(--gray); border-color: rgba(136,153,170,.2); }
.badge-andamento { background: rgba(36,113,163,.1); color: var(--blue); border-color: rgba(36,113,163,.2); }
.badge-revisao   { background: rgba(108,52,131,.1); color: var(--purple); border-color: rgba(108,52,131,.2); }
.badge-finalizado{ background: rgba(26,127,84,.1); color: var(--green); border-color: rgba(26,127,84,.2); }
.badge-arquivado { background: rgba(13,27,42,.06); color: var(--gray); border-color: rgba(13,27,42,.1); }
.badge-critico   { background: rgba(192,57,43,.1); color: var(--red); border-color: rgba(192,57,43,.2); }
.badge-alto      { background: rgba(230,126,34,.1); color: var(--orange); border-color: rgba(230,126,34,.2); }
.badge-medio     { background: rgba(36,113,163,.1); color: var(--blue); border-color: rgba(36,113,163,.2); }
.badge-minimo    { background: rgba(26,127,84,.1); color: var(--green); border-color: rgba(26,127,84,.2); }

/* ════════════════════════
   CALLOUT BOXES
   ════════════════════════ */
.callout {
  border-left: 3px solid var(--gold); background: rgba(201,149,42,.07);
  padding: 11px 14px; margin: 12px 0; border-radius: 0 var(--r) var(--r) 0;
}
.callout.info   { border-color: var(--blue);   background: rgba(36,113,163,.07); }
.callout.warn   { border-color: var(--orange); background: rgba(230,126,34,.07); }
.callout.danger { border-color: var(--red);    background: rgba(192,57,43,.07); }
.callout.ok     { border-color: var(--green);  background: rgba(26,127,84,.06); }
.callout-lbl {
  font-size: .62rem; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; display: block; margin-bottom: 4px; color: var(--gold);
}
.callout.info   .callout-lbl { color: var(--blue); }
.callout.warn   .callout-lbl { color: var(--orange); }
.callout.danger .callout-lbl { color: var(--red); }
.callout.ok     .callout-lbl { color: var(--green); }
.callout p { font-size: .82rem; line-height: 1.7; color: var(--text2); margin: 0; }

/* ════════════════════════
   OCCURRENCE CARDS
   ════════════════════════ */
.oc-card {
  background: white; border: 1px solid var(--border);
  margin-bottom: 14px; position: relative;
  border-left: 3px solid var(--gray3); transition: border-color .2s;
}
.oc-card.risk-critico { border-left-color: var(--red); }
.oc-card.risk-alto    { border-left-color: var(--orange); }
.oc-card.risk-medio   { border-left-color: var(--blue); }
.oc-card.risk-minimo  { border-left-color: var(--green); }
.oc-hd {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px 10px;
  background: rgba(13,27,42,.03); cursor: pointer;
  border-bottom: 1px solid var(--cream2);
}
.oc-code { font-family: var(--font-mono); font-size: .62rem; color: var(--gold); flex-shrink: 0; }
.oc-label { font-size: .88rem; font-weight: 600; color: var(--navy); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oc-meta { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.oc-body { padding: 16px 14px 14px; }
.oc-layout { display: grid; grid-template-columns: 220px 1fr; gap: 16px; }
@media (max-width: 700px) { .oc-layout { grid-template-columns: 1fr; } }

/* Photo slot */
.photo-slot {
  border: 2px dashed var(--gray3); background: var(--cream);
  min-height: 164px; position: relative; cursor: pointer;
  transition: border-color .2s; overflow: hidden; display: flex;
  flex-direction: column;
}
.photo-slot:hover { border-color: var(--gold); }
.photo-slot.has-photo { border-style: solid; border-color: var(--gray3); }
.photo-slot-file { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.photo-preview { width: 100%; height: 164px; object-fit: cover; display: block; }
.photo-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; padding: 16px; text-align: center; pointer-events: none;
}
.photo-ph-icon { font-size: 2rem; color: var(--gray3); margin-bottom: 7px; }
.photo-ph-text { font-size: .72rem; color: var(--gray); }

/* Legend */
.legend-zone { margin-top: 8px; }
.legend-lbl { font-size: .62rem; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 4px; }
.legend-generate-btn {
  width: 100%; margin-top: 5px; padding: 5px;
  background: rgba(13,27,42,.05); border: 1px dashed var(--gray3);
  color: var(--blue); font-size: .7rem; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.legend-generate-btn:hover { background: rgba(36,113,163,.1); border-color: var(--blue); }
.legend-note { font-size: .62rem; color: var(--gray); font-style: italic; margin-top: 3px; }

/* GUT Panel */
.gut-panel { background: var(--cream); border: 1px solid var(--cream2); padding: 12px; margin-top: 14px; }
.gut-lbl { font-size: .62rem; font-weight: 700; color: var(--navy); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 8px; }
.gut-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.gut-result {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: var(--r); margin-top: 10px; transition: all .3s;
}
.gut-score { font-family: var(--font-head); font-size: 1.7rem; font-weight: 700; flex-shrink: 0; }
.gut-info {}
.gut-class { font-size: .8rem; font-weight: 700; }
.gut-formula { font-family: var(--font-mono); font-size: .62rem; color: var(--gray); margin-top: 2px; }
.gut-low      { background: rgba(26,127,84,.08);  border-left: 3px solid var(--green); }
.gut-low      .gut-score, .gut-low  .gut-class  { color: var(--green); }
.gut-mid      { background: rgba(36,113,163,.08); border-left: 3px solid var(--blue); }
.gut-mid      .gut-score, .gut-mid  .gut-class  { color: var(--blue); }
.gut-high     { background: rgba(230,126,34,.08); border-left: 3px solid var(--orange); }
.gut-high     .gut-score, .gut-high .gut-class  { color: var(--orange); }
.gut-critical { background: rgba(192,57,43,.08);  border-left: 3px solid var(--red); }
.gut-critical .gut-score, .gut-critical .gut-class { color: var(--red); }

/* IBAPE risk buttons */
.ibape-btns { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 8px; }
.ibape-btn {
  padding: 3px 9px; font-size: .64rem; font-weight: 700;
  border: 2px solid transparent; cursor: pointer; transition: all .12s;
  background: transparent; letter-spacing: .05em; border-radius: var(--r);
}
.ibape-btn.r-critico { border-color: var(--red);    color: var(--red); }
.ibape-btn.r-critico.sel { background: var(--red);    color: white; }
.ibape-btn.r-alto    { border-color: var(--orange);  color: var(--orange); }
.ibape-btn.r-alto.sel { background: var(--orange);  color: white; }
.ibape-btn.r-medio   { border-color: var(--blue);    color: var(--blue); }
.ibape-btn.r-medio.sel { background: var(--blue);    color: white; }
.ibape-btn.r-minimo  { border-color: var(--green);   color: var(--green); }
.ibape-btn.r-minimo.sel { background: var(--green);  color: white; }

/* ════════════════════════
   MATRIX TABLE
   ════════════════════════ */
.matrix-tbl { width: 100%; border-collapse: collapse; font-size: .82rem; }
.matrix-tbl th {
  background: var(--navy); color: var(--gold2); padding: 8px 12px;
  font-size: .6rem; text-transform: uppercase; letter-spacing: .12em; white-space: nowrap;
}
.matrix-tbl td { padding: 8px 12px; border-bottom: 1px solid var(--cream2); vertical-align: middle; }
.matrix-tbl tr:nth-child(odd) td { background: rgba(13,27,42,.02); }
.prio-i { color: var(--red);    font-weight: 700; }
.prio-h { color: var(--orange); font-weight: 700; }
.prio-m { color: var(--blue);   font-weight: 600; }
.prio-l { color: var(--green); }

/* ════════════════════════
   TABS
   ════════════════════════ */
.tabs { display: flex; border-bottom: 2px solid var(--cream2); margin-bottom: 20px; }
.tab-btn {
  padding: 8px 18px; font-size: .78rem; font-weight: 600;
  cursor: pointer; border: none; background: transparent;
  color: var(--gray); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all .15s;
}
.tab-btn:hover { color: var(--navy); }
.tab-btn.active { color: var(--navy); border-bottom-color: var(--gold); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ════════════════════════
   REVIEW ITEMS
   ════════════════════════ */
.review-list { display: flex; flex-direction: column; gap: 5px; }
.review-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 13px;
  border: 1px solid var(--cream2); background: white; font-size: .82rem;
}
.review-item.ok     { border-color: rgba(26,127,84,.2); background: rgba(26,127,84,.04); }
.review-item.warn   { border-color: rgba(230,126,34,.2); background: rgba(230,126,34,.04); }
.review-item.error  { border-color: rgba(192,57,43,.2); background: rgba(192,57,43,.04); }
.review-ic { font-size: .95rem; flex-shrink: 0; }
.review-txt { flex: 1; }
.review-txt strong { color: var(--navy); }

/* ════════════════════════
   EMPTY STATE
   ════════════════════════ */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--gray);
  background: white; border: 1px solid var(--border);
}
.empty-icon { font-size: 2.4rem; display: block; margin-bottom: 12px; opacity: .4; }
.empty-title { font-size: .95rem; font-weight: 600; color: var(--navy); margin-bottom: 5px; }
.empty-desc { font-size: .8rem; }

/* ════════════════════════
   DISCLAIMER
   ════════════════════════ */
.disclaimer {
  font-size: .68rem; color: var(--gray); line-height: 1.65;
  padding: 10px 14px; background: rgba(13,27,42,.04);
  border: 1px solid var(--border2); font-style: italic; margin-top: 20px;
}

/* ════════════════════════
   LAUDO PREVIEW
   ════════════════════════ */
.laudo-preview { background: white; border: 1px solid var(--border); box-shadow: var(--sh2); }
.lp-cover { background: var(--navy); padding: 48px 40px; }
.lp-cover-label { font-size: .62rem; color: var(--gold); letter-spacing: .22em; text-transform: uppercase; margin-bottom: 10px; }
.lp-cover-title { font-family: var(--font-head); font-size: 2rem; font-weight: 700; color: white; margin-bottom: 6px; line-height: 1.15; }
.lp-cover-sub { font-size: .9rem; color: rgba(201,149,42,.75); margin-bottom: 28px; font-style: italic; }
.lp-cover-meta { font-size: .75rem; color: rgba(255,255,255,.45); line-height: 2.2; }
.lp-cover-meta strong { color: rgba(255,255,255,.7); }
.lp-section { padding: 22px 40px; border-bottom: 1px solid var(--cream2); }
.lp-section:last-child { border-bottom: none; }
.lp-sec-title {
  font-family: var(--font-head); font-size: 1.05rem; font-weight: 700; color: var(--navy);
  border-bottom: 2px solid var(--gold); padding-bottom: 6px; margin-bottom: 14px;
}
.lp-body { font-size: .85rem; line-height: 1.8; color: var(--text2); text-align: justify; }
.lp-id-row {
  display: grid; grid-template-columns: 160px 1fr;
  gap: 2px; padding: 5px 0; border-bottom: 1px solid var(--cream2);
  font-size: .82rem;
}
.lp-id-key { font-weight: 600; color: var(--navy); }
.lp-id-val { color: var(--text2); }
.lp-oc { border: 1px solid var(--cream2); margin-bottom: 12px; }
.lp-oc-hd {
  background: var(--navy2); padding: 7px 13px;
  display: flex; align-items: center; justify-content: space-between;
}
.lp-oc-code { font-family: var(--font-mono); font-size: .6rem; color: var(--gold); }
.lp-oc-title { font-size: .83rem; font-weight: 600; color: white; }
.lp-oc-risk { font-size: .7rem; font-weight: 700; }
.lp-oc-body { padding: 12px 13px; }
.lp-oc-img { width: 100%; max-height: 200px; object-fit: cover; display: block; margin-bottom: 8px; }
.lp-legend { font-size: .73rem; font-style: italic; color: var(--gray); text-align: center; padding: 4px; background: var(--cream); }

/* ════════════════════════
   MODAL
   ════════════════════════ */
#modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 2000; display: none; align-items: center; justify-content: center;
}
#modal-overlay.open { display: flex; }
#modal-box {
  background: white; width: 90%; max-width: 560px;
  max-height: 85vh; overflow-y: auto;
  border-top: 3px solid var(--gold); box-shadow: var(--sh3);
}
.modal-hd { padding: 18px 20px 12px; border-bottom: 1px solid var(--cream2); display: flex; justify-content: space-between; align-items: center; }
.modal-title { font-family: var(--font-head); font-size: 1.1rem; font-weight: 700; color: var(--navy); }
.modal-close { background: none; border: none; font-size: 1.2rem; color: var(--gray); cursor: pointer; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--cream2); display: flex; gap: 8px; justify-content: flex-end; }

/* ════════════════════════
   TOASTS
   ════════════════════════ */
#toast-stack {
  position: fixed; bottom: 18px; right: 18px;
  display: flex; flex-direction: column; gap: 7px; z-index: 9500;
}
.toast {
  padding: 9px 16px; font-size: .8rem; font-weight: 500;
  color: white; min-width: 220px; max-width: 360px;
  display: flex; align-items: flex-start; gap: 8px;
  box-shadow: var(--sh3); animation: toastIn .22s ease;
}
.toast-ok   { background: var(--green); }
.toast-err  { background: var(--red); }
.toast-info { background: var(--blue); }
.toast-warn { background: var(--orange); }
.toast-ico { flex-shrink: 0; font-size: .9rem; margin-top: 1px; }
.toast-txt { flex: 1; line-height: 1.5; }
@keyframes toastIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ════════════════════════
   EXPORT PANEL
   ════════════════════════ */
.export-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.export-card {
  background: white; border: 1px solid var(--border); padding: 20px 14px;
  text-align: center; cursor: pointer; transition: all .18s;
}
.export-card:hover { border-color: var(--gold); transform: translateY(-1px); box-shadow: var(--sh2); }
.export-icon { font-size: 1.8rem; display: block; margin-bottom: 8px; }
.export-title { font-size: .88rem; font-weight: 700; color: var(--navy); }
.export-desc  { font-size: .7rem; color: var(--gray); margin-top: 3px; }

/* ════════════════════════
   PRINT / PDF
   ════════════════════════ */
@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body { background: white !important; }
  #toolbar, #sidebar, .no-print, #toast-stack { display: none !important; }
  #layout { display: block; }
  #main { padding: 0; }
  .laudo-preview { border: none; box-shadow: none; }
  .card { break-inside: avoid; }
  .oc-card { break-inside: avoid; }
  .lp-section { break-inside: avoid; }
  @page { margin: 14mm; size: A4; }
}

/* ════════════════════════════════════════════════════════════
   UX MELHORIAS v2 — Onboarding, Export cards, Versioning
   ════════════════════════════════════════════════════════════ */

/* Export cards 2x2 grid hover improvements */
.export-card { position: relative; overflow: hidden; }
.export-card::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent 70%, rgba(201,149,42,.06));
  pointer-events: none;
}
.export-card:hover { box-shadow: 0 4px 18px rgba(13,27,42,.14); }

/* Onboarding modal grid items */
#modal-box { border-radius: 2px; }

/* Version history row */
.tbl tbody tr:first-child td { background: rgba(201,149,42,.06); }

/* Case steps progress indicator */
.sb-step.done::after {
  content: ' ✓';
  font-size: .6rem;
  color: #6DDBA0;
  margin-left: 2px;
}

/* Smooth fade for view transitions */
#main { animation: fadein .2s ease; }
@keyframes fadein { from { opacity: .6; } to { opacity: 1; } }

/* Photo slot remove button */
.photo-remove-btn {
  position: absolute; top: 6px; right: 6px;
  background: rgba(192,57,43,.85); color: white; border: none;
  padding: 2px 7px; font-size: .65rem; cursor: pointer; z-index: 10;
  border-radius: 2px;
}
.photo-remove-btn:hover { background: var(--red2); }

/* Sticky step nav bottom bar on mobile */
@media (max-width: 700px) {
  #sidebar { display: none; }
  #main { margin-left: 0; }
  .tb-center { display: none; }
}

/* Improved callout for info */
.callout.info {
  border-color: var(--blue);
  background: rgba(36,113,163,.07);
}
.callout.info .callout-lbl { color: var(--blue); }

/* Dashboard quick action hover accent */
.qa-card:hover .qa-icon { transform: scale(1.15); display: inline-block; transition: transform .2s; }

/* Export step: 2-col on wide screens */
@media (min-width: 900px) {
  .export-card { padding: 24px 20px; }
  .export-icon { font-size: 2.1rem; }
}

/* ════════════════════════════════════════════════════════════
   ARQUITETURA DO LAUDO — v1.0
   ════════════════════════════════════════════════════════════ */

/* Radio cards — tipo doc e tipo edif */
.arq-radio-card {
  border: 1.5px solid var(--cream2); background: white;
  padding: 10px 12px; cursor: pointer; transition: all .15s;
  display: flex; align-items: flex-start; gap: 8px;
}
.arq-radio-card:hover { border-color: rgba(201,149,42,.4); background: rgba(201,149,42,.03); }
.arq-radio-card.sel { border-color: var(--gold); background: rgba(201,149,42,.06); }

/* Chapter toggle rows */
.arq-capitulo-row { transition: background .15s; }
.arq-capitulo-row:last-child { border-bottom: none !important; }
.arq-capitulo-row input:disabled { opacity: .5; cursor: not-allowed; }

/* Sidebar step diamond marker */
.sb-step [style*="◆"] {
  background: var(--gold) !important;
  color: var(--navy) !important;
  font-size: .55rem !important;
}

/* Sumário preview */
#arq-capitulos-container { max-height: 460px; overflow-y: auto; }
#arq-capitulos-container::-webkit-scrollbar { width: 4px; }
#arq-capitulos-container::-webkit-scrollbar-thumb { background: var(--gold); }

/* Sistema grid checkboxes */
input[name="arq-sistema"] + span { user-select: none; }

/* Tipo doc grid responsive */
@media (max-width: 900px) {
  #arq-tipo-doc-grid { grid-template-columns: repeat(2,1fr) !important; }
  #arq-tipo-edif-grid { grid-template-columns: repeat(2,1fr) !important; }
}

/* ════════════════════════════════════════════════════════════
   LOCK SCREEN — Sistema de Licença
   ════════════════════════════════════════════════════════════ */
body.locked { overflow: hidden; }

#lock-screen {
  position: fixed; inset: 0; z-index: 99999;
  background: var(--navy);
  align-items: center; justify-content: center;
}

.lock-overlay {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(201,149,42,.07) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(201,149,42,.05) 0%, transparent 60%);
}

.lock-box {
  width: 100%; max-width: 460px; margin: 16px;
  border: 1px solid rgba(201,149,42,.2);
  background: var(--navy2);
  box-shadow: 0 0 80px rgba(0,0,0,.5);
}

.lock-header {
  background: var(--navy); padding: 32px 32px 24px;
  text-align: center; border-bottom: 1px solid rgba(201,149,42,.15);
}

.lock-logo {
  width: 52px; height: 52px; background: var(--gold);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 1.3rem; font-weight: 700;
  color: var(--navy); margin-bottom: 12px;
}

.lock-brand {
  font-family: var(--font-head); font-size: 1.25rem; font-weight: 700;
  color: white; margin-bottom: 4px;
}

.lock-sub {
  font-size: .78rem; color: var(--gold2); letter-spacing: .06em;
}

.lock-version {
  font-size: .62rem; color: rgba(255,255,255,.3); margin-top: 5px;
  letter-spacing: .08em; text-transform: uppercase;
}

.lock-body { padding: 28px 32px 24px; }

.lock-title {
  font-size: 1rem; font-weight: 700; color: white; margin-bottom: 8px;
}

.lock-desc {
  font-size: .8rem; color: rgba(255,255,255,.45); line-height: 1.7;
  margin-bottom: 22px;
}

.lock-field { margin-bottom: 12px; }

.lock-label {
  display: block; font-size: .65rem; font-weight: 700; color: var(--gold2);
  text-transform: uppercase; letter-spacing: .1em; margin-bottom: 7px;
}

.lock-input {
  width: 100%; padding: 12px 14px; background: var(--navy);
  border: 1.5px solid rgba(201,149,42,.25); color: white;
  font-family: var(--font-mono); font-size: 1rem; font-weight: 600;
  letter-spacing: .12em; text-align: center; outline: none;
  transition: border-color .2s;
}
.lock-input:focus { border-color: var(--gold); }
.lock-input::placeholder { color: rgba(255,255,255,.2); font-weight: 400; letter-spacing: .06em; }

.lock-error {
  background: rgba(192,57,43,.15); border: 1px solid rgba(192,57,43,.3);
  color: #F1948A; font-size: .78rem; padding: 8px 12px;
  margin-bottom: 12px; line-height: 1.5;
}

.lock-btn {
  width: 100%; padding: 13px; background: var(--gold); color: var(--navy);
  border: none; font-size: .88rem; font-weight: 700; cursor: pointer;
  letter-spacing: .06em; transition: background .15s; margin-bottom: 8px;
}
.lock-btn:hover { background: var(--gold2); }

.lock-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 12px; color: var(--gold2); font-size: .82rem;
  margin-bottom: 8px;
}

.lock-spinner {
  width: 18px; height: 18px; border: 2px solid rgba(201,149,42,.3);
  border-top-color: var(--gold); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.lock-footer {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  text-align: center;
}
.lock-footer p { font-size: .75rem; color: rgba(255,255,255,.35); margin-bottom: 5px; }
.lock-footer a { color: var(--gold); text-decoration: none; }
.lock-footer a:hover { text-decoration: underline; }
.lock-disclaimer { font-size: .65rem !important; color: rgba(255,255,255,.2) !important; }
