/* ─────────────────────────────────────────────────────────────────
   EDURE Logbook — app.css  (tema navy, padrão EDURE)
   ───────────────────────────────────────────────────────────────── */

:root {
  --primary:       #1a2e4a;
  --primary-light: #243d60;
  --primary-dark:  #111e30;
  --accent:        #2f6fd6;
  --accent-hover:  #285fb8;
  --bg:            #f0f3f7;
  --surface:       #ffffff;
  --border:        #dbe2ea;
  --text:          #1d2733;
  --muted:         #6b7785;
  --ok:            #1f9d57;
  --warn:          #c77f11;
  --danger:        #c0392b;
  --aviao:         #2f6fd6;
  --heli:          #7a4fd6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px; color: var(--text); background: var(--bg);
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
a { color: var(--accent); }

/* ── Login ───────────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; padding: 24px;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-light) 100%);
}
.login-card {
  background: var(--surface); border-radius: 18px; padding: 36px 32px;
  width: 100%; max-width: 380px; box-shadow: 0 18px 50px rgba(0,0,0,.28);
}
.login-logo {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 22px; color: var(--primary);
}
.login-logo i { color: var(--accent); }
.login-sub { text-align: center; color: var(--muted); margin: 6px 0 22px; }
.login-foot { color: rgba(255,255,255,.6); font-size: 12px; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.field input, .pw-wrap input {
  width: 100%; border: 1px solid var(--border); border-radius: 10px;
  padding: 11px 12px; font-size: 15px; background: #f7f9fc; color: var(--text);
}
.field input:focus, .pw-wrap input:focus { outline: none; border-color: var(--accent); background: #fff; }
.pw-wrap { position: relative; }
.pw-toggle { position: absolute; right: 4px; top: 0; bottom: 0; border: none; background: none; color: var(--muted); padding: 0 12px; cursor: pointer; }

.login-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); margin: 18px 0; font-size: 12px; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.link-btn { display: block; margin: 14px auto 0; background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 10px; padding: 11px 16px; font-size: 14px;
  font-weight: 600; cursor: pointer; transition: background .15s, opacity .15s;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-outline { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
.btn-outline:hover:not(:disabled) { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 7px 11px; font-size: 13px; }

/* ── Topbar ──────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 30; height: 54px;
  display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: var(--primary); color: #fff;
  padding-top: env(safe-area-inset-top);
}
.topbar-title { flex: 1; font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.topbar-title i { color: #8fb6f2; }
.topbar-back, .topbar-acct {
  background: rgba(255,255,255,.12); border: none; color: #fff;
  width: 36px; height: 36px; border-radius: 9px; cursor: pointer; font-size: 15px;
}
.topbar-back:hover, .topbar-acct:hover { background: rgba(255,255,255,.22); }

main#view { max-width: 980px; margin: 0 auto; padding: 18px 14px 60px; }

/* ── Painel (aeronaves) ──────────────────────────────────────────── */
.acft-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 680px) { .acft-grid { grid-template-columns: 1fr 1fr; } }
.acft-card {
  background: var(--surface); border-radius: 16px; padding: 20px;
  box-shadow: 0 3px 14px rgba(0,0,0,.07); cursor: pointer;
  border-top: 4px solid var(--aviao); transition: transform .12s, box-shadow .12s;
}
.acft-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.12); }
.acft-card.heli { border-top-color: var(--heli); }
.acft-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.acft-head .ic { width: 42px; height: 42px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff; background: var(--aviao); }
.acft-card.heli .acft-head .ic { background: var(--heli); }
.acft-head .pfx { font-size: 20px; font-weight: 800; color: var(--primary); }
.acft-head .typ { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.acft-totais { display: flex; gap: 14px; }
.tot-box { flex: 1; background: #f5f8fc; border-radius: 12px; padding: 12px; text-align: center; }
.tot-box .v { font-size: 24px; font-weight: 800; color: var(--primary); }
.tot-box .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.acft-meta { margin-top: 14px; font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 16px; }
.acft-meta b { color: var(--text); font-weight: 600; }

/* ── Folhas / tabelas ────────────────────────────────────────────── */
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; }
.search { flex: 1; position: relative; }
.search input { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px 10px 36px; font-size: 14px; background: #fff; }
.search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }

.card { background: var(--surface); border-radius: 14px; box-shadow: 0 3px 14px rgba(0,0,0,.06); overflow: hidden; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th { text-align: left; background: #f4f7fb; color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.tbl td { padding: 11px 12px; border-bottom: 1px solid #eef2f6; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl tbody tr.clickable:hover { background: #f5f9ff; }
.pdf-yes { color: var(--ok); } .pdf-no { color: var(--border); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-warn { background: #fdf2dc; color: var(--warn); }

/* mobile cards (folhas) */
.folha-cards { display: none; }
@media (max-width: 640px) {
  .tbl-wrap { display: none; }
  .folha-cards { display: grid; gap: 10px; }
  .folha-c { background: var(--surface); border-radius: 12px; padding: 13px 14px; box-shadow: 0 2px 8px rgba(0,0,0,.06); cursor: pointer; }
  .folha-c .r1 { display: flex; justify-content: space-between; align-items: baseline; }
  .folha-c .pg { font-size: 17px; font-weight: 800; color: var(--primary); }
  .folha-c .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
}

/* ── Folha detalhe ───────────────────────────────────────────────── */
.folha-head { background: var(--surface); border-radius: 14px; padding: 16px 18px; box-shadow: 0 3px 14px rgba(0,0,0,.06); margin-bottom: 14px; }
.folha-head .ttl { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.folha-head h2 { font-size: 20px; color: var(--primary); }
.folha-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.folha-tots { display: flex; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.folha-tots .t { background: #f5f8fc; border-radius: 10px; padding: 9px 14px; }
.folha-tots .t .v { font-size: 17px; font-weight: 800; color: var(--primary); }
.folha-tots .t .l { font-size: 11px; color: var(--muted); }

.etapa-toggle { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 12px; }
.etapa-dados { background: #f7f9fc; }
.etapa-dados dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; padding: 12px 16px; font-size: 12.5px; }
.etapa-dados dt { color: var(--muted); font-weight: 600; }
.etapa-dados dd { color: var(--text); word-break: break-word; }

/* ── Modal ───────────────────────────────────────────────────────── */
.overlay { position: fixed; inset: 0; background: rgba(15,25,40,.55); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; width: 100%; max-width: 460px; max-height: 90vh; overflow: auto; }
.modal-sm { max-width: 380px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.modal-close { background: none; border: none; font-size: 18px; color: var(--muted); cursor: pointer; }
.modal-body { padding: 18px; }
.acct-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #eef2f6; }
.acct-row:last-child { border-bottom: none; }
.passkey-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; background: #f5f8fc; border-radius: 10px; margin-bottom: 8px; }
.passkey-name { font-weight: 600; } .passkey-date { font-size: 11.5px; color: var(--muted); }

/* ── Misc ────────────────────────────────────────────────────────── */
.page-title { font-size: 19px; font-weight: 700; color: var(--primary); margin-bottom: 14px; }
.alert { border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.alert-erro { background: #fdecea; color: var(--danger); }
.alert-ok { background: #e7f6ee; color: var(--ok); }
.alert-warn { background: #fdf2dc; color: var(--warn); }
.tbl-empty, .muted { color: var(--muted); text-align: center; padding: 26px; }
.spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin: 36px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(120px); background: var(--primary); color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 14px; z-index: 90; opacity: 0; transition: transform .25s, opacity .25s; max-width: 90vw; }
#toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
#toast.toast-err { background: var(--danger); }
