* { box-sizing: border-box; }
body { margin: 0; background: #f2f5fa; font-family: 'Segoe UI', Arial, sans-serif; color: #1c2e40; }
input, button { font: inherit; }
table { border-collapse: collapse; width: 100%; font-size: 12px; }
h1, h2, h3, p { margin: 0; }

.app { display: flex; flex-wrap: wrap; min-height: 100vh; }

/* Barra lateral */
.sidebar { flex: 1 1 212px; max-width: 212px; background: #27384c; color: #bdd0e5; padding: 25px 0; }
.brand { padding: 0 22px 24px; border-bottom: 1px solid #3b526b; display: flex; align-items: center; gap: 10px; }
.brand div { display: flex; flex-direction: column; gap: 2px; }
.brand-name { font-size: 22px; color: #fff; font-weight: 700; }
.brand-sub { font-size: 9px; letter-spacing: 2px; color: #9fb7cc; }
.sidebar nav { display: flex; flex-direction: column; margin-top: 22px; }
.sidebar nav a { padding: 16px 24px; border-left: 3px solid transparent; color: #c5d6e8; font-size: 13px; text-decoration: none; }
.sidebar nav a.active { border-left-color: #21a2df; background: #324a64; color: #fff; font-weight: 700; }

/* Área principal */
main { flex: 999 1 560px; min-width: 0; padding: 25px 29px 30px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; border-bottom: 1px solid #dfe4ea; padding-bottom: 17px; }
.page-head > div { display: flex; flex-direction: column; gap: 4px; }
h1 { font-size: 22px; font-weight: 600; }
.crumbs { font-size: 12px; color: #5f7589; }
.pill-ok { font-size: 11px; color: #1d6e52; background: #e4f7ef; border-radius: 99px; padding: 6px 12px; }

.card { background: #fff; border: 1px solid #e0e7ef; border-radius: 6px; box-shadow: 0 2px 8px rgba(26,51,82,.05); overflow: hidden; }
.pad { padding: 17px 19px; display: flex; flex-direction: column; gap: 11px; }
h2 { font-size: 13px; font-weight: 700; }

.form { padding: 18px 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 13px; align-items: end; }
.form label { display: flex; flex-direction: column; gap: 7px; font-size: 11px; color: #5f7589; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.form input { padding: 11px; border: 1px solid #d7e0e9; border-radius: 4px; color: #182e45; font-size: 13px; }

.btn { min-height: 44px; border: 0; border-radius: 4px; background: #1b7fc0; color: #fff; font-size: 12px; font-weight: 700; padding: 10px 19px; cursor: pointer; }
.btn-outline { min-height: 40px; border: 1px solid #c2410c; border-radius: 4px; background: #fff; color: #9a3412; font-size: 12px; font-weight: 700; cursor: pointer; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 7px; }
.kpi span { font-size: 11px; color: #5f7589; }
.kpi strong { font-size: 23px; font-weight: 600; color: #1c344f; font-variant-numeric: tabular-nums; }
.kpi-warn { border: 1px solid #fdba74; border-radius: 6px; background: #fff7ed; }
.kpi-warn span, .kpi-warn strong { color: #9a3412; }
.kpi-warn span { font-weight: 700; }

.cols { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.composition { flex: 1.35 1 460px; min-width: 0; }
.side { flex: .85 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.section-head { padding: 17px 19px; border-bottom: 1px solid #e7edf3; display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; }

.tabs { display: flex; gap: 4px; }
.tabs button { min-height: 32px; border: 0; border-radius: 4px; padding: 7px 12px; font-size: 11px; background: #f2f5fa; color: #40698a; cursor: pointer; }
.tabs button[aria-pressed="true"] { background: #1b7fc0; color: #fff; }

/* Grupos coloridos */
.group-head { padding: 12px 19px; display: flex; flex-direction: column; gap: 4px; }
.group-head > div { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.group-head h3 { font-size: 13px; font-weight: 700; }
.group-head .sub { font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.group-head p { font-size: 12px; line-height: 1.5; }
.table-wrap { overflow-x: auto; }
td { border-bottom: 1px solid #eaf0f5; padding: 12px 19px; }
td.label { color: #3f566c; }
td.status { text-align: right; padding: 12px 8px; }
td.value { width: 120px; text-align: right; color: #173550; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.st-ok { color: #374151; background: #f3f4f6; }
.st-est { color: #9a3412; background: #ffedd5; }
.st-calc { color: #9f1239; background: #ffe4e6; }

.grand { padding: 17px 19px; background: #f7fafd; display: flex; flex-direction: column; gap: 4px; }
.grand div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 700; }
.grand small { font-size: 11px; color: #9a3412; }
.actions { padding: 12px 19px; text-align: right; }

.map { width: 100%; height: 320px; background: #e7eef6; }
.fir-list { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 12px 18px 0; font-size: 12px; color: #3f566c; }
.fir-list b { color: #1c2e40; }
.airport-label { background: #1c344f; color: #fff; border: 0; font-weight: 700; font-size: 11px; padding: 2px 6px; }
.airport-label::before { display: none; }
.note { padding: 14px 18px; color: #5f7589; font-size: 11px; line-height: 1.7; }

.sum-row { display: flex; align-items: center; gap: 9px; font-size: 12px; }
.sum-row .dot { width: 10px; height: 10px; border-radius: 50%; }
.sum-row .name { flex-grow: 1; color: #3f566c; }
.sum-row strong { font-variant-numeric: tabular-nums; }

.warn-box { background: #fff7ed; border: 1px solid #fdba74; border-radius: 6px; padding: 16px 19px; display: flex; flex-direction: column; gap: 9px; }
.warn-box h2 { color: #9a3412; }
.warn-box p { font-size: 12px; line-height: 1.5; color: #7c2d12; }

@media (max-width: 640px) {
  .sidebar { max-width: none; flex-basis: 100%; padding: 16px 0; }
  .sidebar nav { flex-direction: row; overflow-x: auto; margin-top: 12px; }
  .sidebar nav a { border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; }
  .sidebar nav a.active { border-bottom-color: #21a2df; }
  main { padding: 18px 14px; }
}

/* Botões das linhas e mensagens */
.mini { margin-left: 6px; min-height: 28px; padding: 3px 9px; border: 1px solid #1b7fc0; border-radius: 4px; background: #fff; color: #1b6fa8; font-size: 11px; font-weight: 700; cursor: pointer; }
.btn-link { background: none; border: 0; color: #40698a; font-size: 12px; text-decoration: underline; cursor: pointer; margin-right: 10px; min-height: 44px; }
.btn-outline:disabled { opacity: .5; cursor: default; }
.form-msg { grid-column: 1 / -1; margin: 0; font-size: 12px; color: #40698a; }
.form-msg:empty { display: none; }

/* PDF / impressão */
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sidebar, .form, .tabs, .actions, .mini, .warn-box button, .leaflet-control-zoom { display: none !important; }
  .app { display: block; }
  main { padding: 0; }
  .cols { display: block; }
  .composition, .side { width: 100%; }
  .side { margin-top: 12px; }
  .card { box-shadow: none; break-inside: avoid; }
  .composition { break-inside: auto; }
  .map { height: 260px; }
  .page-head h1::after { content: " — Kostvia"; }
}
