/* SGA · OverDesk: mesma identidade do portal OverDesk (claro por padrão, escuro automático) */
:root {
  --fundo: #f5f7fb;
  --fundo-2: #eef2f8;
  --superficie: #ffffff;
  --borda: #e3e8f0;
  --texto: #0f172a;
  --sutil: #64748b;
  --primaria: #2563eb;
  --primaria-2: #1d4ed8;
  --primaria-suave: #e8effe;
  --verde: #16a34a;
  --vermelho: #dc2626;
  --amarelo: #ca8a04;
  --hoje: #f3f7ff;
  --sombra: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --raio: 14px;
  --fonte: "Inter", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fundo: #0b1120;
    --fundo-2: #0f172a;
    --superficie: #131c2e;
    --borda: #22304a;
    --texto: #e2e8f0;
    --sutil: #94a3b8;
    --primaria: #3b82f6;
    --primaria-2: #60a5fa;
    --primaria-suave: #172554;
    --hoje: #16213a;
    --sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 15px/1.5 var(--fonte);
  color: var(--texto);
  background: radial-gradient(1200px 500px at 85% -10%, var(--primaria-suave), transparent 60%), var(--fundo);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primaria); text-decoration: none; }
a:hover { color: var(--primaria-2); }
h2, h3 { line-height: 1.25; letter-spacing: -.02em; }
.hidden { display: none !important; }

/* ---------- topo ---------- */
.topo {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--superficie) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--borda);
}
.faixa { max-width: 1200px; margin: 0 auto; padding: 0 20px; height: 62px; display: flex; align-items: center; gap: 28px; }
.marca { display: flex; align-items: center; gap: 14px; flex-shrink: 0; color: var(--texto); }
.marca:hover { color: var(--texto); }
.marca-icone { position: relative; display: block; width: 38px; height: 38px; }
.marca-icone img { display: block; width: 38px; height: 38px; }
/* aviãozinho sobre o ícone do OverDesk, decolando para a direita */
.marca-icone .aviaozinho {
  position: absolute; right: -9px; top: -7px; width: 22px; height: 22px;
  transform: rotate(45deg);
  background: var(--superficie); border-radius: 50%; padding: 2px;
  box-shadow: 0 0 0 1px var(--borda);
}
.marca .produto { display: flex; flex-direction: column; line-height: 1.1; }
.produto-nome { font-size: 1.3rem; font-weight: 650; letter-spacing: -.01em; color: #4b4b4d; }
.produto-nome strong { font-weight: 800; color: var(--primaria); letter-spacing: .01em; }
.produto-nome em { font-style: normal; color: var(--sutil); margin: 0 6px; font-weight: 400; }
.produto-sub { font-size: .7rem; color: var(--sutil); letter-spacing: .02em; margin-top: 2px; }
@media (prefers-color-scheme: dark) { .produto-nome { color: #e6e7e8; } }
.topo nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.topo nav a { color: var(--sutil); padding: 7px 12px; border-radius: 9px; font-weight: 550; white-space: nowrap; }
.topo nav a:hover { color: var(--texto); background: var(--fundo-2); }
.topo nav a.ativo { color: var(--primaria); background: var(--primaria-suave); }

main { max-width: 1200px; margin: 0 auto; padding: 28px 20px 48px; }

.view { display: none; }
.view.ativa { display: block; }

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.toolbar h2 { margin: 0; font-size: 1.5rem; font-weight: 750; }
.toolbar-right { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.toolbar label { display: flex; flex-direction: column; font-size: .8rem; font-weight: 600; color: var(--sutil); gap: 4px; }

.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav h2 { margin-left: 10px; }

/* ---------- botões / campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid var(--borda);
  background: var(--superficie); color: var(--texto); font: 600 .92rem var(--fonte); cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--sutil); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--primaria); border-color: var(--primaria); color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--primaria) 35%, transparent); }
.btn.primary:hover { background: var(--primaria-2); }
.btn.danger { color: var(--vermelho); border-color: color-mix(in srgb, var(--vermelho) 35%, var(--borda)); }
.btn.danger:hover { background: var(--vermelho); border-color: var(--vermelho); color: #fff; }
.btn.small { padding: 5px 10px; font-size: .8rem; border-radius: 8px; }

input, select, textarea {
  font: 400 .95rem var(--fonte);
  padding: 9px 12px;
  color: var(--texto);
  background: var(--fundo-2);
  border: 1px solid var(--borda);
  border-radius: 10px;
  outline: none;
  min-width: 0;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primaria); background-color: var(--superficie);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primaria) 18%, transparent);
}
input[type="color"] { padding: 3px; height: 40px; width: 70px; cursor: pointer; }
@media (prefers-color-scheme: dark) { input[type="datetime-local"] { color-scheme: dark; } }

/* ---------- calendário ---------- */
.calendar {
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  box-shadow: var(--sombra);
  overflow: hidden;
}
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-head div {
  padding: 10px;
  text-align: center;
  font-weight: 700;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--sutil);
  border-bottom: 1px solid var(--borda);
  background: var(--fundo-2);
}
.cal-dia {
  min-height: 118px;
  border-right: 1px solid var(--borda);
  border-bottom: 1px solid var(--borda);
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  transition: background .12s;
}
.cal-dia:nth-child(7n) { border-right: none; }
.cal-dia:nth-last-child(-n+7) { border-bottom: none; }
.cal-dia:hover { background: var(--primaria-suave); }
.cal-dia.fora { background: color-mix(in srgb, var(--fundo-2) 60%, transparent); color: color-mix(in srgb, var(--sutil) 60%, transparent); }
.cal-dia.hoje { background: var(--hoje); }
.cal-dia.passado { cursor: default; }
.cal-dia.passado:hover { background: inherit; }
.cal-dia.fora.passado:hover { background: color-mix(in srgb, var(--fundo-2) 60%, transparent); }
.cal-dia.hoje:hover { background: var(--primaria-suave); }
.cal-num { font-size: .85rem; font-weight: 650; align-self: flex-end; padding: 1px 7px; }
.cal-dia.hoje .cal-num { background: var(--primaria); color: #fff; border-radius: 999px; }
.evento {
  position: relative;
  height: 20px;
  font-size: .75rem;
  font-weight: 550;
  color: #fff;
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
  cursor: pointer;
  line-height: 16px;
}
/* voo de vários dias: a barra emenda com o dia anterior/seguinte (cobre o espaço e a borda) */
.evento.cont-esq { margin-left: -6px; border-top-left-radius: 0; border-bottom-left-radius: 0; }
.evento.cont-dir { margin-right: -7px; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.cal-dia:nth-child(7n) .evento.cont-dir { margin-right: -6px; }
/* texto escrito uma vez, por cima da barra inteira daquela semana */
.evento-texto {
  position: relative; z-index: 2; display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none;
}
.evento.cont-esq .evento-texto { padding-left: 6px; }
.evento.faixa-vazia { visibility: hidden; pointer-events: none; }
.evento:hover { filter: brightness(.9); }
.mais { font-size: .75rem; color: var(--sutil); padding-left: 4px; }

.hint { color: var(--sutil); font-size: .85rem; }
.aviso {
  padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; border: 1px solid;
  background: color-mix(in srgb, var(--amarelo) 12%, var(--superficie));
  border-color: color-mix(in srgb, var(--amarelo) 40%, transparent);
}
.aviso a { font-weight: 650; }

/* ---------- tabelas ---------- */
.tabela {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--superficie);
  border: 1px solid var(--borda);
  border-radius: var(--raio);
  box-shadow: var(--sombra);
  overflow: hidden;
}
.tabela th, .tabela td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--borda); }
.tabela tbody tr:last-child td { border-bottom: none; }
.tabela tbody tr:hover td { background: var(--fundo-2); }
.tabela th { background: var(--fundo-2); font-size: .72rem; font-weight: 700; color: var(--sutil); text-transform: uppercase; letter-spacing: .06em; }
.tabela td.acoes-col { text-align: right; white-space: nowrap; }
.tabela .vazio { text-align: center; color: var(--sutil); padding: 36px; }
.bolinha { display: inline-block; width: 14px; height: 14px; border-radius: 50%; vertical-align: middle; }

/* ---------- modais ---------- */
.modal {
  border: 1px solid var(--borda);
  border-radius: 16px;
  padding: 0;
  width: min(580px, 94vw);
  background: var(--superficie);
  color: var(--texto);
  box-shadow: 0 24px 60px rgba(15, 23, 42, .3);
}
.modal::backdrop { background: rgba(15, 23, 42, .5); backdrop-filter: blur(2px); }
.modal form { padding: 24px; }
.modal h3 { margin: 0 0 18px; font-size: 1.15rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 label { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; font-weight: 600; }
.grid2 .full { grid-column: 1 / -1; }
.acoes { display: flex; gap: 8px; margin-top: 20px; }
.spacer { flex: 1; }
.erro { color: var(--vermelho); font-size: .9rem; font-weight: 500; min-height: 1.2em; margin: 12px 0 0; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--texto);
  color: var(--superficie);
  font-weight: 550;
  padding: 10px 18px;
  border-radius: 10px;
  box-shadow: var(--sombra);
  z-index: 1000;
}

.rodape { text-align: center; color: var(--sutil); font-size: .85rem; padding: 24px 20px; border-top: 1px solid var(--borda); }

/* ---------- celular ---------- */
@media (max-width: 760px) {
  .faixa { gap: 12px; height: auto; padding: 10px 14px; flex-wrap: wrap; }
  .marca-icone, .marca-icone img { width: 30px; height: 30px; }
  .produto-nome { font-size: 1.1rem; }
  main { padding: 16px 12px 32px; }
  .cal-dia { min-height: 80px; padding: 3px; }
  .evento { font-size: .65rem; padding: 1px 4px; }
  .grid2 { grid-template-columns: 1fr; }
  .tabela { font-size: .85rem; display: block; overflow-x: auto; }
}

/* ---------- conta (topo) ---------- */
.conta { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.conta-nome { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; font-weight: 600; font-size: .88rem; margin-right: 4px; }
.conta-nome small { font-weight: 500; font-size: .72rem; color: var(--sutil); }
a.btn { text-decoration: none; color: var(--texto); }
a.btn:hover { color: var(--texto); }
.sutil { color: var(--sutil); font-weight: 400; }
h2 small { font-size: .85rem; margin-left: 6px; }

/* ---------- perfis e situação ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.perfil-admin { background: color-mix(in srgb, #7c3aed 14%, transparent); color: #7c3aed; }
.perfil-tripulante { background: color-mix(in srgb, var(--verde) 14%, transparent); color: var(--verde); }
.perfil-usuario { background: var(--primaria-suave); color: var(--primaria); }
.tabela tr.inativo td { opacity: .55; }
label.check { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 500 !important; }
label.check input { width: auto; }
.evento.com-trechos:not(.cont-esq) { box-shadow: inset 3px 0 0 rgba(255, 255, 255, .85); }

/* ---------- pernas dentro do voo ---------- */
.modal.largo { width: min(820px, 96vw); }
.pernas { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--borda); }
.pernas-cab { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.pernas-cab h4 { margin: 0; font-size: 1rem; }
.tabela.compacta { box-shadow: none; font-size: .85rem; }
.tabela.compacta th, .tabela.compacta td { padding: 8px 10px; }
#voo-info, #perna-tempo { margin: 10px 0 0; font-size: .85rem; }
select:disabled, input:disabled, textarea:disabled { opacity: .8; cursor: default; }

/* ---------- login ---------- */
.pagina-login { min-height: 100vh; display: grid; place-items: center; }
.login { width: 100%; padding: 32px 16px; display: grid; place-items: center; }
.cartao-login {
  width: 100%; max-width: 420px; padding: 32px;
  background: var(--superficie); border: 1px solid var(--borda); border-radius: 18px; box-shadow: var(--sombra);
}
.login-cab { text-align: center; margin-bottom: 22px; display: flex; flex-direction: column; align-items: center; }
.login-cab h1 { margin: 14px 0 2px; font-size: 1.6rem; font-weight: 650; color: #4b4b4d; }
.login-cab h1 strong { color: var(--primaria); font-weight: 800; }
@media (prefers-color-scheme: dark) { .login-cab h1 { color: #e6e7e8; } }
.marca-icone.grande, .marca-icone.grande img { width: 64px; height: 64px; }
.marca-icone.grande .aviaozinho { width: 32px; height: 32px; right: -14px; top: -10px; }
.form-login { display: flex; flex-direction: column; gap: 14px; }
.form-login label { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; font-weight: 600; }
.btn.largo { width: 100%; padding: 11px 16px; margin-top: 4px; }
.aviso.erro {
  background: color-mix(in srgb, var(--vermelho) 10%, var(--superficie));
  border-color: color-mix(in srgb, var(--vermelho) 35%, transparent);
}
.aviso.info {
  background: var(--primaria-suave);
  border-color: color-mix(in srgb, var(--primaria) 30%, transparent);
  font-size: .88rem;
}
.aviso code { font-size: .85em; }
.login-rodape { text-align: center; color: var(--sutil); font-size: .85rem; margin: 18px 0 0; }

@media (max-width: 760px) {
  .conta-nome { display: none; }
}

/* ---------- campos de seleção (select) ---------- */
:root {
  --seta: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  --pino: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z'/%3E%3Ccircle cx='12' cy='9.5' r='2.5'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) {
  :root {
    --seta: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
    --pino: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 21s-7-6.2-7-11.5A7 7 0 0 1 19 9.5C19 14.8 12 21 12 21z'/%3E%3Ccircle cx='12' cy='9.5' r='2.5'/%3E%3C/svg%3E");
  }
}
select {
  -webkit-appearance: none;
  appearance: none;
  background-color: var(--fundo-2);
  background-image: var(--seta);
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px;
  padding: 9px 38px 9px 12px;
  min-width: 150px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
select:hover:not(:disabled) { border-color: color-mix(in srgb, var(--primaria) 45%, var(--borda)); background-color: var(--superficie); }
select:disabled { background-image: none; padding-right: 12px; }
option { background: var(--superficie); color: var(--texto); }

/* navegadores com select personalizável (Chrome/Edge recentes): lista aberta no estilo do sistema */
@supports (appearance: base-select) {
  select, ::picker(select) { appearance: base-select; }
  select { display: inline-flex; align-items: center; }
  select::picker-icon { display: none; }
  ::picker(select) {
    border: 1px solid var(--borda);
    border-radius: 12px;
    background: var(--superficie);
    color: var(--texto);
    box-shadow: 0 18px 44px rgba(15, 23, 42, .22);
    padding: 6px;
    margin-block: 6px;
    max-height: 320px;
    overflow-y: auto;
    opacity: 0;
    translate: 0 -4px;
    transition: opacity .12s, translate .12s, overlay .12s allow-discrete, display .12s allow-discrete;
  }
  ::picker(select):popover-open { opacity: 1; translate: 0 0; }
  @starting-style { ::picker(select):popover-open { opacity: 0; translate: 0 -4px; } }
  select option {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; border-radius: 8px;
    background: transparent; font-size: .92rem; cursor: pointer;
  }
  select option:hover, select option:focus-visible { background: var(--primaria-suave); color: var(--primaria); outline: none; }
  select option:checked { font-weight: 650; color: var(--primaria); }
  select option::checkmark { content: '✓'; order: 1; margin-left: auto; color: var(--primaria); }
  select option[value=""] { color: var(--sutil); }
}

/* ---------- busca de cidade (origem/destino) ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; font-size: .85rem; font-weight: 600; }
.busca-cidade { position: relative; }
.busca-cidade input {
  width: 100%;
  padding-left: 34px;
  background-image: var(--pino);
  background-repeat: no-repeat;
  background-position: 10px center;
  background-size: 17px;
}
.busca-cidade input.invalido { border-color: var(--vermelho); box-shadow: 0 0 0 3px color-mix(in srgb, var(--vermelho) 15%, transparent); }
.sugestoes {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px);
  margin: 0; padding: 6px; list-style: none;
  background: var(--superficie); border: 1px solid var(--borda); border-radius: 12px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, .22);
  max-height: 290px; overflow-y: auto;
}
.sugestoes li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer; font-weight: 500;
}
.sugestoes li span { color: var(--sutil); font-size: .78rem; white-space: nowrap; }
.sugestoes li:hover, .sugestoes li.ativo { background: var(--primaria-suave); }
.sugestoes li.ativo strong, .sugestoes li:hover strong { color: var(--primaria); }
.sugestoes li.vazio { color: var(--sutil); cursor: default; font-weight: 400; }
.sugestoes li.vazio:hover { background: none; }

.paginacao { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 14px; }
.toolbar input[type="search"] { min-width: 240px; }
.toolbar label.check { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 10px; }

/* ---------- menu Voos / trechos ---------- */
.modal-corpo { padding: 24px; }
.modal-corpo h3 { margin: 0 0 4px; }
.modal-corpo > .sutil { margin: 0 0 16px; font-size: .88rem; }
.badge.pendente { background: color-mix(in srgb, var(--amarelo) 18%, transparent); color: var(--amarelo); }
.toolbar input[type="date"] { min-width: 150px; }

/* ---------- aeródromo (ICAO) no trecho ---------- */
.busca-aerodromo input { text-transform: uppercase; }
.busca-aerodromo input::placeholder { text-transform: none; }
.sugestoes .icao {
  display: inline-block; min-width: 44px; margin-right: 6px; padding: 0 6px; border-radius: 6px;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: .8rem; font-weight: 700;
  background: var(--primaria-suave); color: var(--primaria); text-align: center;
}
.busca-aerodromo .sugestoes { min-width: 240px; }
.dica-campo { margin: -4px 0 0; font-size: .78rem; font-weight: 400; }
#trecho-destino ~ .sugestoes { left: auto; right: 0; }
.busca-aerodromo .sugestoes li strong { font-weight: 550; }

/* ---------- voo sem agenda ---------- */
.badge.avulso { background: color-mix(in srgb, #7c3aed 15%, transparent); color: #8b5cf6; margin-left: 6px; }
.evento.avulso {
  background-image: repeating-linear-gradient(135deg, rgba(255, 255, 255, .16) 0 6px, transparent 6px 12px) !important;
}

/* rodapé sempre no fim da tela, mesmo com pouco conteúdo */
body:not(.pagina-login) { display: flex; flex-direction: column; min-height: 100vh; }
body:not(.pagina-login) > main { flex: 1 0 auto; width: 100%; }
