/* EcoFlight — tasarım sistemi. Harici font/CDN yok: kokpitte çevrimdışı çalışır. */

:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --text: #0f1a17;
  --muted: #56655f;
  --border: #d9e3df;
  --brand: #0d7a5b;
  --brand-ink: #ffffff;
  --brand-soft: #e3f3ed;
  --sky: #0b5cab;
  --sky-soft: #e5effa;
  --ok: #067647;
  --ok-soft: #dcf5e7;
  --info: #0b5cab;
  --info-soft: #e5effa;
  --note: #56655f;
  --note-soft: #eef1f0;
  --warn: #9a4b00;
  --warn-soft: #fdf0dc;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --shadow: 0 1px 2px rgba(15, 26, 23, 0.06), 0 4px 16px rgba(15, 26, 23, 0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --gap: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1210; --surface: #121b18; --surface-2: #17231f; --text: #e5eeea; --muted: #97a8a2;
    --border: #243530; --brand: #34c796; --brand-ink: #062118; --brand-soft: #123429;
    --sky: #6aa9f0; --sky-soft: #132640; --ok: #4ade80; --ok-soft: #12301f; --info: #6aa9f0; --info-soft: #132640;
    --note: #97a8a2; --note-soft: #1b2824; --warn: #f5b041; --warn-soft: #33250c; --danger: #f87171; --danger-soft: #3a1512;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1210; --surface: #121b18; --surface-2: #17231f; --text: #e5eeea; --muted: #97a8a2;
  --border: #243530; --brand: #34c796; --brand-ink: #062118; --brand-soft: #123429;
  --sky: #6aa9f0; --sky-soft: #132640; --ok: #4ade80; --ok-soft: #12301f; --info: #6aa9f0; --info-soft: #132640;
  --note: #97a8a2; --note-soft: #1b2824; --warn: #f5b041; --warn-soft: #33250c; --danger: #f87171; --danger-soft: #3a1512;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font);
  min-height: 100vh; overflow-x: hidden;
}
a { color: var(--sky); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 8px; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 8px; }
ul, ol { margin: 0 0 8px; padding-left: 20px; }
li { margin: 2px 0; }
small, .muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* Kabuk */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); font-weight: 700; font-size: 1.1rem; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand small { font-weight: 500; color: var(--muted); font-size: 0.75rem; display: block; line-height: 1; }
.topbar .spacer { flex: 1; }
.net { font-size: 0.8rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.dot.off { background: var(--warn); }
a.net { text-decoration: none; border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; }
a.net:hover { border-color: var(--brand); }
.sync { font-size: 0.75rem; font-weight: 700; border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.sync.ok { background: var(--ok-soft); color: var(--ok); }
.sync.wait { background: var(--warn-soft); color: var(--warn); }
details.fb > summary { cursor: pointer; color: var(--muted); font-size: 0.86rem; }
.iconbtn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px;
  height: 36px; min-width: 36px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; font: inherit;
}
.iconbtn:hover { border-color: var(--brand); }

nav.tabs { display: flex; gap: 4px; }
nav.tabs a {
  text-decoration: none; color: var(--muted); padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: 0.92rem; white-space: nowrap;
}
nav.tabs a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); }
@media (max-width: 820px) {
  /* backdrop-filter sabit konumlu alt menü için kapsayıcı blok oluşturur: mobilde kapat */
  .topbar { backdrop-filter: none; background: var(--surface); }
  nav.tabs {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; justify-content: space-around; gap: 0;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  nav.tabs a { display: flex; flex-direction: column; align-items: center; font-size: 0.72rem; padding: 6px 4px; gap: 2px; flex: 1; text-align: center; }
  nav.tabs a svg { width: 22px; height: 22px; }
  main { padding-bottom: 88px !important; }
  .net .label { display: none; }
}
@media (min-width: 821px) { nav.tabs a svg { display: none; } }

main { max-width: 1120px; margin: 0 auto; padding: 16px; }

/* Yüzeyler */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: var(--gap); }
.panel > header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.panel > header h2 { margin: 0; }
.grid { display: grid; gap: 12px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 8px; }
hr { border: 0; border-top: 1px solid var(--border); margin: 12px 0; }

/* Form */
.form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.form .wide { grid-column: span 2; }
@media (max-width: 480px) { .form .wide { grid-column: 1 / -1; } }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: var(--muted); font-weight: 600; min-width: 0; }
label.f .hint { font-weight: 400; font-size: 0.78rem; min-height: 1.1em; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; min-height: 44px; width: 100%; min-width: 0;
}
textarea { min-height: 72px; resize: vertical; font-family: var(--mono); font-size: 0.85rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 1px; border-color: var(--brand); }
input.icao { text-transform: uppercase; font-family: var(--mono); letter-spacing: 0.06em; font-weight: 700; }
details.adv { grid-column: 1 / -1; border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 10px 12px; }
details.adv > summary { cursor: pointer; font-weight: 600; color: var(--muted); }
details.adv[open] > summary { margin-bottom: 10px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: var(--surface-2); color: var(--muted); padding: 8px 12px; font: inherit; font-weight: 600; cursor: pointer; min-height: 40px; }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 12px; border: 1px solid transparent;
  background: var(--brand); color: var(--brand-ink); font: inherit; font-weight: 700; padding: 10px 18px; min-height: 44px; cursor: pointer; text-decoration: none;
}
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.ghost { background: transparent; color: var(--sky); padding: 6px 8px; min-height: 36px; }
.btn.ghost.danger { color: var(--danger); }
.btn:disabled { opacity: 0.6; cursor: progress; }

/* Çipler ve rozetler */
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; padding: 2px 10px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.st-recommended { background: var(--ok-soft); color: var(--ok); }
.st-consider { background: var(--info-soft); color: var(--info); }
.st-info { background: var(--note-soft); color: var(--note); }
.st-not-now { background: var(--warn-soft); color: var(--warn); }
.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 6px; padding: 0 6px; font-size: 0.72rem; font-weight: 700; border: 1px solid var(--border); color: var(--muted); white-space: nowrap; }
.badge.P { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.badge.S { color: var(--info); border-color: color-mix(in srgb, var(--info) 45%, transparent); }
.badge.T { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.badge.D, .badge.OFP, .badge.OP { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.fresh { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; background: var(--surface-2); }
.fresh::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.fresh.aging::before { background: var(--warn); }
.fresh.stale::before, .fresh.none::before { background: var(--danger); }

/* Özet */
.hero { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px; border: 1px solid var(--border); }
.kpi .v { font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.route-line { font-family: var(--mono); font-weight: 800; font-size: 1.2rem; letter-spacing: 0.04em; }

/* Öneri listesi */
.phase-block { margin-top: 14px; }
.phase-block > h3 { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 8px; }
.phase-block > h3::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.rec { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: 8px; overflow: hidden; }
.rec > summary { list-style: none; cursor: pointer; padding: 12px 14px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: start; }
.rec > summary::-webkit-details-marker { display: none; }
.rec .t { font-weight: 700; }
.rec .why { grid-column: 1 / -1; font-size: 0.88rem; color: var(--muted); }
.rec .why li { margin: 0; }
.rec .sav { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ok); white-space: nowrap; }
.rec .sav small { display: block; font-weight: 600; color: var(--muted); }
.rec[data-status="not-now"] .t { color: var(--muted); }
.rec .body { border-top: 1px solid var(--border); padding: 12px 14px; background: var(--surface-2); }
.caution { color: var(--warn); font-size: 0.86rem; }
.caution::before { content: "⚠ "; }

#recs[data-show="actions"] .rec[data-status="info"], #recs[data-show="actions"] .phase-block.only-info { display: none; }

/* Talimat kartı */
.card-h { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.card-h h3 { margin: 0; font-size: 1.05rem; }
.summary-line { font-size: 0.95rem; }
.cockpit { background: var(--brand-soft); border-radius: var(--radius-sm); padding: 10px 12px; margin: 10px 0; }
.cockpit h4, .sect h4 { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 0 0 6px; }
.cockpit ul { margin: 0; padding-left: 18px; font-weight: 600; }
.sect { margin-top: 12px; }
.never { border-left: 4px solid var(--danger); background: var(--danger-soft); padding: 10px 12px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.never h4 { color: var(--danger); }
ol.steps { padding-left: 0; list-style: none; counter-reset: s; margin: 0; }
ol.steps li { counter-increment: s; display: grid; grid-template-columns: 28px 56px 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
ol.steps li::before { content: counter(s); font-weight: 800; color: var(--brand); }
ol.steps .who { font-size: 0.72rem; font-weight: 800; color: var(--sky); background: var(--sky-soft); border-radius: 6px; padding: 1px 6px; height: fit-content; text-align: center; }
@media (max-width: 480px) { ol.steps li { grid-template-columns: 22px 1fr; } ol.steps .who { grid-column: 2; width: fit-content; } ol.steps li > span:last-child { grid-column: 2; } }
.fleet-tabs { margin: 8px 0; }
.flag-u { display: inline-block; font-size: 0.7rem; font-weight: 800; color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); border-radius: 5px; padding: 0 5px; margin-left: 6px; vertical-align: 1px; }
.atc li { font-family: var(--mono); font-size: 0.86rem; }
.atc .who { font-family: var(--font); font-weight: 800; font-size: 0.72rem; color: var(--muted); margin-right: 6px; }
.disclaimer { font-size: 0.8rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: 8px; margin-top: 12px; }
.src-list li { font-size: 0.85rem; }

/* Tablolar */
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tr.best td { background: var(--ok-soft); font-weight: 700; }
tr.plan td { background: var(--surface-2); }

/* Hava */
.wx { display: grid; gap: 6px; }
.wx .raw { font-family: var(--mono); font-size: 0.82rem; background: var(--surface-2); padding: 8px 10px; border-radius: 8px; overflow-wrap: anywhere; }
.flags { display: flex; gap: 6px; flex-wrap: wrap; }
.flag { font-size: 0.75rem; font-weight: 700; border-radius: 999px; padding: 2px 8px; background: var(--ok-soft); color: var(--ok); }
.flag.bad { background: var(--warn-soft); color: var(--warn); }

/* Uçuşta modu */
.inflight { --fs: 1.05rem; }
.phasebar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.phasebar button {
  flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 12px; padding: 10px 14px;
  font: inherit; font-weight: 700; min-height: 48px; cursor: pointer;
}
.phasebar button[aria-current="step"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.phasebar button .cnt { font-size: 0.75rem; opacity: 0.8; margin-left: 4px; }
.check { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); margin-bottom: 10px; font-size: var(--fs); }
.check .ttl { font-weight: 800; }
.check ul { margin: 6px 0 0; font-size: 0.95rem; }
.tri { display: inline-flex; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.tri button { border: 0; background: var(--surface-2); color: var(--muted); min-width: 64px; min-height: 48px; font: inherit; font-weight: 800; cursor: pointer; }
.tri button[aria-pressed="true"][data-v="yes"] { background: var(--ok); color: #fff; }
.tri button[aria-pressed="true"][data-v="no"] { background: var(--warn); color: #1b1300; }
@media (max-width: 480px) {
  /* Telefonda başlık tam genişlik, düğmeler altında: dar sütunda 5 satıra kırılmasın */
  .check { grid-template-columns: 1fr; }
  .tri { display: flex; }
  .tri button { flex: 1; }
}
.tools { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.result { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Kütüphane */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters .chipbtn { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 0.85rem; font-weight: 600; color: var(--muted); cursor: pointer; min-height: 36px; }
.filters .chipbtn[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.libcard { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: 12px 14px; margin-bottom: 8px; }
.libcard > summary { cursor: pointer; list-style: none; }
.libcard > summary::-webkit-details-marker { display: none; }
.libcard > summary .t { font-weight: 700; }
.quiz .opt { display: block; width: 100%; text-align: left; margin: 6px 0; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 10px; padding: 12px; font: inherit; cursor: pointer; min-height: 48px; }
.quiz .opt.right { border-color: var(--ok); background: var(--ok-soft); }
.quiz .opt.wrong { border-color: var(--danger); background: var(--danger-soft); }

/* Uyarı bandı */
.banner { border-radius: var(--radius-sm); padding: 10px 12px; font-size: 0.88rem; background: var(--info-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--info) 30%, transparent); }
.banner.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; z-index: 50; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.spinner { width: 18px; height: 18px; border: 3px solid color-mix(in srgb, var(--brand-ink) 40%, transparent); border-top-color: var(--brand-ink); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Yazdırma: brifing kâğıdı */
@media print {
  .topbar, nav.tabs, .noprint, form, details.adv { display: none !important; }
  body { background: #fff; color: #000; }
  .panel { box-shadow: none; border-color: #bbb; break-inside: avoid; }
  .rec[open] .body { background: #fff; }
  main { padding: 0; }
}
