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

:root{
  --navy:#0B1F3A;
  --navy-mid:#142d52;
  --navy-light:#1e3f6e;
  --gold:#C9A84C;
  --gold-light:#e8c87a;
  --surface:#F7F8FA;
  --surface-2:#EDEEF2;
  --border:#D8DAE0;
  --text-main:#0B1F3A;
  --text-muted:#6B7280;
  --text-light:#9CA3AF;
  --green:#1A8A5A;
  --green-bg:#EAF6F0;
  --red:#C0392B;
  --red-bg:#FDECEA;
  --amber:#B45309;
  --amber-bg:#FEF3C7;
  --radius:10px;
  --radius-lg:16px;
  --shadow:0 2px 12px rgba(11,31,58,.07);
  --shadow-md:0 4px 24px rgba(11,31,58,.10);
}

body{
  font-family:'DM Sans',sans-serif;
  background:var(--surface);
  color:var(--text-main);
  min-height:100vh;
  line-height:1.6;
}

/* TOPBAR */
.topbar{
  background:var(--navy);
  height:56px;
  display:flex;
  align-items:center;
}
.topbar-brand{
  display:flex;
  align-items:center;
  gap:10px;
  color:#fff;
  font-size:15px;
  font-weight:500;
  letter-spacing:.02em;
}
.topbar-logo{
  width:28px;height:28px;
  background:var(--gold);
  border-radius:6px;
  display:flex;align-items:center;justify-content:center;
  font-size:13px;font-weight:700;color:var(--navy);
}
.topbar-badge{
  font-size:11px;color:rgba(255,255,255,.45);
  margin-left:6px;font-weight:400;letter-spacing:.04em;
}

/* MAIN */
.main{max-width:900px;margin:0 auto;padding:2rem 1.5rem 4rem;}

/* align topbar inner content with .main */
.topbar-inner{max-width:900px;margin:0 auto;padding:0 1.5rem;width:100%;display:flex;align-items:center;justify-content:space-between;}

/* PAGE HEADER */
.page-header{margin-bottom:2rem;}
.page-header h1{font-size:22px;font-weight:600;color:var(--navy);margin-bottom:4px;}
.page-header p{font-size:14px;color:var(--text-muted);}

/* SECTION CARD */
.section-card{
  background:#fff;
  border:1px solid var(--border);
  border-radius:var(--radius-lg);
  margin-bottom:1.25rem;
  overflow:hidden;
  box-shadow:var(--shadow);
}
.section-header{
  display:flex;align-items:center;gap:10px;
  padding:1rem 1.5rem;
  border-bottom:1px solid var(--surface-2);
  background:var(--surface);
}
.section-icon{
  width:32px;height:32px;border-radius:8px;
  background:var(--navy);
  display:flex;align-items:center;justify-content:center;
  flex-shrink:0;
}
.section-icon svg{width:16px;height:16px;stroke:#fff;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
.section-title{font-size:13px;font-weight:600;color:var(--text-muted);text-transform:uppercase;letter-spacing:.07em;}
.section-subtitle{font-size:12px;color:var(--text-light);margin-top:1px;}
.section-body{padding:1.5rem;}

/* FORM GRID */
.field-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:1rem 1.25rem;}
.field-grid-2{grid-template-columns:repeat(2,1fr);}
.field-grid-3{grid-template-columns:repeat(3,1fr);}
.field-grid-4{grid-template-columns:repeat(4,1fr);}

.field{display:flex;flex-direction:column;gap:5px;}
.field label{font-size:12px;font-weight:500;color:var(--text-muted);letter-spacing:.02em;}
.field input{
  height:40px;
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:0 .85rem;
  font-family:'DM Sans',sans-serif;
  font-size:14px;
  color:var(--text-main);
  background:#fff;
  transition:border-color .15s,box-shadow .15s;
  outline:none;
  width:100%;
}
.field input:hover{border-color:#aab;}
.field input:focus{border-color:var(--navy-light);box-shadow:0 0 0 3px rgba(20,45,82,.10);}
.field input::placeholder{color:var(--text-light);}
.field input[type="date"]{font-size:13px;}
.field-hint{font-size:11px;color:var(--text-light);margin-top:2px;}

/* ACTION ROW */
.action-row{
  display:flex;gap:.75rem;align-items:center;
  padding:1.25rem 1.5rem;
  background:var(--surface);
  border-top:1px solid var(--surface-2);
}
.btn-primary{
  height:42px;padding:0 1.75rem;
  background:var(--navy);
  color:#fff;
  border:none;border-radius:var(--radius);
  font-family:'DM Sans',sans-serif;font-size:14px;font-weight:500;
  cursor:pointer;transition:background .15s,transform .1s;
  display:flex;align-items:center;gap:8px;
  white-space:nowrap;
}
.btn-primary:hover{background:var(--navy-light);}
.btn-primary:active{transform:scale(.98);}
.btn-primary svg{width:15px;height:15px;stroke:#fff;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}

.btn-ghost{
  height:42px;padding:0 1.25rem;
  background:transparent;
  color:var(--text-muted);
  border:1px solid var(--border);border-radius:var(--radius);
  font-family:'DM Sans',sans-serif;font-size:14px;
  cursor:pointer;transition:background .15s,color .15s;
  display:flex;align-items:center;gap:6px;
}
.btn-ghost:hover{background:var(--surface-2);color:var(--text-main);}
.btn-ghost svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}

.btn-print{
  height:42px;padding:0 1.25rem;
  background:transparent;
  color:var(--text-muted);
  border:1px solid var(--border);border-radius:var(--radius);
  font-family:'DM Sans',sans-serif;font-size:14px;
  cursor:pointer;transition:background .15s;
  display:flex;align-items:center;gap:6px;
}
.btn-print:hover{background:var(--surface-2);}
.btn-print svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}

.spacer{flex:1;}

/* RESULTS */
#resultados{display:none;}

.result-grid{display:grid;grid-template-columns:1fr 1fr;gap:1rem;margin-bottom:1rem;}
.result-grid-wide{grid-column:1/-1;}

.result-card{
  background:#fff;border:1px solid var(--border);border-radius:var(--radius-lg);
  overflow:hidden;box-shadow:var(--shadow);
}
.result-card-header{
  padding:.85rem 1.25rem;
  border-bottom:1px solid var(--surface-2);
  background:var(--surface);
  display:flex;align-items:center;gap:8px;
}
.result-card-header svg{width:14px;height:14px;stroke:var(--text-muted);fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
.result-card-title{font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.07em;color:var(--text-muted);}
.result-card-body{padding:1.25rem;}

/* KPI STRIP */
.kpi-strip{
  background:var(--navy);
  border-radius:var(--radius-lg);
  padding:1.5rem;
  display:grid;
  grid-template-columns:2fr 1fr 1fr 1fr;
  gap:1px;
  margin-bottom:1rem;
  box-shadow:var(--shadow-md);
}
.kpi{padding:.5rem 1.25rem;border-right:1px solid rgba(255,255,255,.08);}
.kpi:last-child{border-right:none;}
.kpi:first-child{padding-left:0;}
.kpi-label{font-size:11px;color:rgba(255,255,255,.45);text-transform:uppercase;letter-spacing:.08em;margin-bottom:6px;}
.kpi-value{font-size:22px;font-weight:600;color:#fff;line-height:1.2;}
.kpi-value.highlight{color:var(--gold);}
.kpi-value.small{font-size:15px;margin-top:2px;}
.kpi-diff{font-size:12px;margin-top:4px;}
.kpi-diff.up{color:#4ade80;}
.kpi-diff.down{color:#f87171;}
.kpi-diff.neutral{color:rgba(255,255,255,.35);}

/* DATA TABLE in result cards */
.data-table{width:100%;border-collapse:collapse;}
.data-table tr{border-bottom:1px solid var(--surface-2);}
.data-table tr:last-child{border-bottom:none;}
.data-table td{padding:7px 0;font-size:13px;}
.data-table td:first-child{color:var(--text-muted);}
.data-table td:last-child{text-align:right;font-weight:500;font-family:'DM Mono',monospace;font-size:13px;color:var(--text-main);}

/* BADGES */
.badge{
  display:inline-flex;align-items:center;gap:4px;
  padding:3px 10px;border-radius:20px;
  font-size:11px;font-weight:500;
}
.badge-green{background:var(--green-bg);color:var(--green);}
.badge-red{background:var(--red-bg);color:var(--red);}
.badge-amber{background:var(--amber-bg);color:var(--amber);}

/* ALERT */
.alert{
  border-radius:var(--radius);
  padding:.85rem 1.1rem;
  font-size:13px;
  margin-bottom:.6rem;
  display:flex;gap:10px;align-items:flex-start;
}
.alert:last-child{margin-bottom:0;}
.alert-icon{width:16px;height:16px;flex-shrink:0;margin-top:1px;}
.alert-warn{background:var(--amber-bg);color:var(--amber);}
.alert-warn .alert-icon{stroke:var(--amber);}
.alert-ok{background:var(--green-bg);color:var(--green);}
.alert-ok .alert-icon{stroke:var(--green);}

/* RISK INDICATOR */
.risk-bar{margin-top:1rem;}
.risk-bar-track{
  height:6px;border-radius:3px;
  background:var(--surface-2);
  overflow:hidden;margin:.5rem 0;
}
.risk-bar-fill{height:100%;border-radius:3px;transition:width .5s ease;}
.risk-labels{display:flex;justify-content:space-between;font-size:10px;color:var(--text-light);}

/* DEFLATOR PILLS */
.defl-row{display:flex;gap:.5rem;flex-wrap:wrap;margin-top:.75rem;}
.defl-pill{
  padding:4px 10px;border-radius:6px;
  font-size:11px;font-weight:500;
  background:var(--surface-2);color:var(--text-muted);
  display:flex;align-items:center;gap:5px;
}
.defl-pill span{color:var(--text-main);font-family:'DM Mono',monospace;}

/* MODAL */
.modal-overlay{
  position:fixed;inset:0;
  background:rgba(11,31,58,.5);
  display:none;align-items:center;justify-content:center;
  z-index:200;backdrop-filter:blur(3px);
}
.modal-overlay.open{display:flex;}
.modal{
  background:#fff;border-radius:var(--radius-lg);
  width:min(860px,95vw);max-height:90vh;
  display:flex;flex-direction:column;
  box-shadow:0 20px 60px rgba(0,0,0,.15);
}
.modal-header{
  background:var(--navy);color:#fff;
  padding:1rem 1.5rem;border-radius:var(--radius-lg) var(--radius-lg) 0 0;
  display:flex;align-items:center;justify-content:space-between;
  flex-shrink:0;
}
.modal-header h2{font-size:15px;font-weight:500;}
.modal-close{
  background:none;border:none;color:rgba(255,255,255,.6);
  cursor:pointer;font-size:20px;line-height:1;padding:0;
  transition:color .15s;
}
.modal-close:hover{color:#fff;}
.modal-body{padding:1.5rem;overflow-y:auto;flex:1;}
.modal-footer{
  padding:.85rem 1.5rem;border-top:1px solid var(--border);
  display:flex;justify-content:flex-end;flex-shrink:0;
}

.info-section{margin-bottom:1.75rem;}
.info-section:last-child{margin-bottom:0;}
.info-section h3{
  font-size:12px;font-weight:600;text-transform:uppercase;letter-spacing:.07em;
  color:var(--text-muted);margin-bottom:.85rem;
  padding-bottom:.5rem;border-bottom:1px solid var(--surface-2);
}
.info-table{width:100%;border-collapse:collapse;}
.info-table th{
  font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.05em;
  color:var(--text-muted);padding:.5rem .75rem;
  background:var(--surface);text-align:left;
  border-bottom:1px solid var(--border);
}
.info-table td{padding:.5rem .75rem;font-size:13px;border-bottom:1px solid var(--surface-2);}
.info-table tr:last-child td{border-bottom:none;}
.info-table code{font-family:'DM Mono',monospace;font-size:12px;color:var(--navy-light);}

.rk-alto td:nth-child(3){color:var(--red);font-weight:500;}
.rk-medio td:nth-child(3){color:var(--amber);font-weight:500;}
.rk-baixo td:nth-child(3){color:var(--green);font-weight:500;}

/* FOOTER */
footer{
  text-align:center;font-size:12px;color:var(--text-light);
  padding:2rem 0 1rem;border-top:1px solid var(--surface-2);
  margin-top:1rem;
}

/* PRINT */
@media print{
  .topbar,.action-row,.btn-ghost,.btn-print,.btn-primary{display:none!important;}
  .main{max-width:100%;padding:1rem;}
  .section-card,.result-card{box-shadow:none;}
}

/* RESPONSIVE */
@media(max-width:640px){
  .kpi-strip{grid-template-columns:1fr 1fr;gap:.5rem;}
  .kpi{border-right:none;border-bottom:1px solid rgba(255,255,255,.08);}
  .result-grid{grid-template-columns:1fr;}
  .field-grid-4,.field-grid-3{grid-template-columns:1fr 1fr;}
}

/* SEPARATOR */
.section-sep{
  display:flex;align-items:center;gap:.75rem;
  margin-bottom:1.25rem;font-size:11px;font-weight:600;
  text-transform:uppercase;letter-spacing:.07em;color:var(--text-light);
}
.section-sep::before,.section-sep::after{content:'';flex:1;height:1px;background:var(--surface-2);}
.section-sep:first-child::before{display:none;}

/* PRINT BUTTON (resultado) */
.btn-imprimir{
  height:38px;padding:0 1.1rem;
  background:transparent;
  color:var(--text-muted);
  border:1px solid var(--border);border-radius:var(--radius);
  font-family:'DM Sans',sans-serif;font-size:13px;
  cursor:pointer;transition:background .15s,color .15s;
  display:inline-flex;align-items:center;gap:6px;
}
.btn-imprimir:hover{background:var(--surface-2);color:var(--text-main);}
.btn-imprimir svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}
.resultado-actions{display:flex;justify-content:flex-end;margin-bottom:.75rem;}
