/* FPFUT Flight Test Log — sunlight-readable field UI */
:root {
  --paper: #EEF1F4;
  --panel: #FFFFFF;
  --ink: #16212D;
  --ink-soft: #5B6B7B;
  --line: #C9D2DB;
  --orange: #E85D04;   /* Cube Orange */
  --orange-deep: #C24E03;
  --green: #2E7D32;
  --red: #C62828;
  --red-soft: #FDECEA;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
  -webkit-text-size-adjust: 100%;
}

/* placard-style labels */
.brand-mark {
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 1.1rem;
  color: var(--ink);
}
.brand-mark::after { content: ""; display: inline-block; width: 0.55em; height: 0.55em; margin-left: 0.4em; background: var(--orange); }
.brand-sub { display: block; color: var(--ink-soft); font-size: 0.85rem; margin-top: 0.3rem; letter-spacing: 0.04em; }

/* topbar */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.7rem 1rem;
  padding-top: calc(0.7rem + env(safe-area-inset-top));
  background: var(--panel);
  border-bottom: 3px solid var(--ink);
  position: sticky; top: 0; z-index: 10;
}
/* hamburger navigation: nav is a dropdown under the topbar */
.menu-btn { border: 2px solid transparent; background: none; color: var(--ink); padding: 6px; border-radius: var(--radius); cursor: pointer; min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
.menu-btn[aria-expanded="true"] { border-color: var(--ink); }
.menu-current { font-weight: 600; color: var(--ink-soft); white-space: nowrap; }
.tabs { position: absolute; left: 0; right: 0; top: 100%; display: flex; flex-direction: column; gap: 2px; background: var(--panel); border-bottom: 3px solid var(--ink); padding: 8px; box-shadow: 0 10px 24px rgba(22,33,45,0.15); z-index: 20; }
.tabs[hidden] { display: none; }
.tabs .tab { text-align: left; width: 100%; font-size: 1.05rem; }
@media (min-width: 700px) { .tabs { left: 1rem; right: auto; min-width: 240px; border: 2px solid var(--ink); border-radius: var(--radius); border-top: 0; border-top-left-radius: 0; border-top-right-radius: 0; } }
.tab {
  border: 2px solid transparent; background: none; font: inherit; font-weight: 600;
  padding: 0.55rem 1rem; border-radius: var(--radius); color: var(--ink-soft); cursor: pointer;
  min-height: 44px;
}
.tab.active { color: var(--ink); border-color: var(--ink); }

main { max-width: 860px; margin: 0 auto; padding: 1rem 1rem 4rem; }

.view-head { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; margin: 0.6rem 0 1rem; }
h1 { font-size: 1.5rem; margin: 0; letter-spacing: 0.01em; }
h2 { font-size: 1.1rem; margin: 0 0 0.6rem; text-transform: uppercase; letter-spacing: 0.08em; }
.empty { color: var(--ink-soft); }
.hint { color: var(--ink-soft); font-size: 0.9rem; }

/* buttons — big tap targets */
.btn {
  font: inherit; font-weight: 600; border-radius: var(--radius); cursor: pointer;
  min-height: 46px; padding: 0.6rem 1.2rem; border: 2px solid transparent;
}
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:active { background: var(--orange-deep); }
.btn-ghost { background: none; border-color: var(--line); color: var(--ink); }
.btn-danger-ghost { background: none; border-color: var(--line); color: var(--red); }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 0.3rem 0.8rem; }
.btn-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 1rem; }

/* panels */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem; margin-bottom: 1rem;
}

/* flight cards */
.card-list { display: flex; flex-direction: column; gap: 0.6rem; }
.flight-card {
  display: flex; align-items: center; gap: 0.9rem; text-align: left;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.9rem 1rem; font: inherit; cursor: pointer; min-height: 64px; width: 100%;
}
.flight-card.has-incident { border-left: 5px solid var(--red); }
.flight-main { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; }
.flight-title { font-weight: 700; }
.flight-sub { color: var(--ink-soft); font-size: 0.9rem; }
.incident-flag { color: var(--red); font-weight: 800; font-size: 0.8rem; letter-spacing: 0.08em; }

.phase-chip {
  background: var(--ink); color: #fff; font-weight: 800; border-radius: 6px;
  padding: 0.25rem 0.55rem; font-size: 0.9rem; letter-spacing: 0.04em; flex-shrink: 0;
}
.phase-chip.big { font-size: 1.05rem; padding: 0.35rem 0.7rem; }

/* meta panel */
.meta-panel .meta-name { font-weight: 600; margin-left: 0.6rem; }
.meta-grid { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; margin-top: 0.8rem; color: var(--ink-soft); }
.meta-notes { margin: 0.8rem 0 0; white-space: pre-wrap; }
.incident-box {
  margin-top: 0.9rem; background: var(--red-soft); border-left: 5px solid var(--red);
  border-radius: 6px; padding: 0.7rem 0.9rem;
}
.incident-box strong { color: var(--red); letter-spacing: 0.08em; }
.incident-box p { margin: 0.3rem 0 0; white-space: pre-wrap; }

/* checklist */
.cl-head { display: flex; align-items: baseline; justify-content: space-between; }
.cl-count { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--orange-deep); }
.cl-section {
  font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-soft); margin: 1.1rem 0 0.4rem; border-bottom: 1px solid var(--line); padding-bottom: 0.25rem;
}
.cl-item {
  display: flex; align-items: flex-start; gap: 0.8rem;
  padding: 0.7rem 0.4rem; min-height: 52px; cursor: pointer;
  border-bottom: 1px dashed var(--line);
}
.cl-item input { width: 26px; height: 26px; flex-shrink: 0; accent-color: var(--green); margin-top: 1px; }
.cl-item.checked span { color: var(--ink-soft); }
.cl-item:last-child { border-bottom: none; }

/* forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.form-grid label { display: flex; flex-direction: column; gap: 0.3rem; font-weight: 600; font-size: 0.9rem; }
.form-grid .span2 { grid-column: span 2; }
.form-grid input, .form-grid select, .form-grid textarea {
  font: inherit; font-weight: 400; padding: 0.6rem 0.7rem; min-height: 46px;
  border: 1.5px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.form-grid textarea { min-height: auto; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus,
.btn:focus-visible, .tab:focus-visible, .cl-item input:focus-visible {
  outline: 3px solid var(--orange); outline-offset: 1px;
}
.check-row { flex-direction: row !important; align-items: center; gap: 0.7rem !important; min-height: 46px; }
.check-row input { width: 24px; height: 24px; min-height: auto; accent-color: var(--red); }
.form-err, .login-err { color: var(--red); font-weight: 600; }

/* files */
.file-list { margin-top: 0.8rem; display: flex; flex-direction: column; gap: 0.4rem; }
.file-row {
  display: flex; align-items: center; gap: 0.8rem;
  padding: 0.5rem 0.2rem; border-bottom: 1px dashed var(--line);
}
.file-row a { color: var(--ink); font-weight: 600; flex: 1; word-break: break-all; }
#fileInput { margin: 0.5rem 0.6rem 0.5rem 0; font: inherit; }

/* phase rail — the program ladder */
.phase-rail { display: flex; flex-direction: column; gap: 0.5rem; }
.phase-row {
  display: flex; align-items: center; gap: 1rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.phase-num {
  font-size: 1.6rem; font-weight: 800; width: 2.4rem; text-align: center;
  color: var(--line); flex-shrink: 0;
}
.phase-row.in_progress { border-left: 5px solid var(--orange); }
.phase-row.in_progress .phase-num { color: var(--orange); }
.phase-row.complete { border-left: 5px solid var(--green); }
.phase-row.complete .phase-num { color: var(--green); }
.phase-body { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }
.phase-name { font-weight: 700; }
.phase-meta { color: var(--ink-soft); font-size: 0.9rem; }
.phase-notes { font-size: 0.9rem; }
.phase-status {
  font: inherit; min-height: 46px; padding: 0.4rem 0.6rem;
  border: 1.5px solid var(--line); border-radius: 8px; background: #fff;
}

/* login */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--orange);
  border-radius: var(--radius); padding: 2rem; width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 0.9rem;
}
.field-label { font-weight: 600; font-size: 0.9rem; }
.login-card input {
  font: inherit; padding: 0.7rem; min-height: 48px;
  border: 1.5px solid var(--line); border-radius: 8px;
}
.login-card input:focus { outline: 3px solid var(--orange); outline-offset: 1px; }

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: span 1; }
  .phase-row { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* phase accordion */
.acc { display: flex; flex-direction: column; gap: 12px; }
.acc-row { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.acc-row.in_progress { border-left: 5px solid var(--orange); }
.acc-row.complete { border-left: 5px solid var(--green); }
.acc-head {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 16px; background: none; border: 0; font: inherit; text-align: left; cursor: pointer;
}
.acc-head:hover { background: rgba(0,0,0,0.03); }
.acc-title { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acc-chev { color: var(--ink-soft); font-size: 1rem; }
.inc-meta { color: var(--red); font-weight: 600; }
.acc-body { padding: 4px 16px 18px; border-top: 1px solid var(--line); }

/* flight chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 0; }
.chip-label { font-size: 0.85rem; color: var(--ink-soft); }
.chip {
  font: inherit; font-size: 0.9rem; padding: 7px 14px; min-height: 40px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--panel); cursor: pointer;
}
.chip.active { border-color: var(--orange); background: #FFF3E8; font-weight: 600; }
.chip-incident { border-color: var(--red); }
.chip-new { color: var(--ink-soft); border-style: dashed; }

/* sub tabs */
.subtabs { display: flex; gap: 2px; border-bottom: 1.5px solid var(--line); overflow-x: auto; }
.subtabs button {
  font: inherit; font-size: 0.95rem; padding: 10px 16px; min-height: 44px;
  background: none; border: 0; border-bottom: 3px solid transparent; cursor: pointer; color: var(--ink-soft); white-space: nowrap;
}
.subtabs button.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--orange); }
.subtab-content { padding-top: 14px; }
.cl-progress { font-size: 0.9rem; color: var(--ink-soft); margin-bottom: 6px; }

/* checklist value inputs */
.cl-label { flex: 1; }
.cl-valwrap { flex-shrink: 0; }
.cl-val {
  width: 90px; font: inherit; font-size: 0.9rem; padding: 6px 8px; min-height: 40px;
  border: 1.5px solid var(--line); border-radius: 8px; text-align: right;
}
.cl-val:focus { outline: 2px solid var(--orange); }

.debrief textarea {
  width: 100%; font: inherit; padding: 0.7rem;
  border: 1.5px solid var(--line); border-radius: 8px;
}
.upload-block { margin-top: 16px; }

/* retest + preview */
.retest-block { display: block; margin-bottom: 14px; font-weight: 600; font-size: 0.95rem; }
.retest-block textarea {
  width: 100%; margin-top: 6px; font: inherit; font-weight: 400; padding: 0.7rem;
  border: 1.5px solid var(--orange); border-radius: 8px; background: #FFF8F2;
}
.cl-preview { opacity: 0.75; }

/* flight review */
.btn-success { background: var(--green); color: #fff; border: 0; }
.btn-danger { background: var(--red); color: #fff; border: 0; }
.review-status { margin: 6px 0 10px; }
.review-chat {
  max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
  border: 1.5px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--paper);
}
.rmsg { padding: 10px 14px; border-radius: 12px; max-width: 92%; white-space: pre-wrap; font-size: 0.95rem; }
.rmsg.ai { background: var(--panel); border: 1px solid var(--line); align-self: flex-start; }
.rmsg.me { background: #FFF3E8; border: 1px solid var(--orange); align-self: flex-end; }
.rmsg.sys { align-self: center; color: var(--ink-soft); font-size: 0.8rem; background: none; }
.review-input { display: flex; gap: 8px; margin-top: 10px; }
.review-input textarea { flex: 1; font: inherit; padding: 0.6rem; border: 1.5px solid var(--line); border-radius: 8px; }
.review-actions { margin-top: 8px; }
.review-doc { margin-top: 14px; border-top: 2px solid var(--orange); padding-top: 10px; }
.review-doc pre { white-space: pre-wrap; font-size: 0.9rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }

/* ask bar + mic */
.askbar-wrap { max-width: 900px; margin: 0 auto; padding: 12px 16px 0; }
.askbar { display: flex; gap: 8px; }
.askbar input {
  flex: 1; font: inherit; padding: 10px 14px; min-height: 44px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--panel);
}
.askbar input:focus { outline: 2px solid var(--orange); }
.mic { font-size: 1.1rem; min-width: 44px; }
.mic.rec { background: var(--red); color: #fff; border-color: var(--red); animation: micpulse 1.2s infinite; }
@keyframes micpulse { 50% { opacity: 0.6; } }
.ask-panel { margin-top: 10px; }
.ask-a { background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--radius); padding: 14px; }
.ask-q { font-weight: 600; margin-bottom: 8px; }
.ask-cached { font-size: 0.75rem; color: var(--green); border: 1px solid var(--green); border-radius: 999px; padding: 2px 8px; margin-left: 6px; font-weight: 400; }
.ask-body { white-space: pre-wrap; font-size: 0.95rem; margin-bottom: 10px; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---------- AI-age restyle ---------- */
.topbar { flex-wrap: wrap; gap: 10px; }
.askwrap { flex: 1 1 260px; min-width: 220px; position: relative; display: flex; gap: 8px; }
.micwrap { position: relative; flex: 1; display: flex; }
.micwrap.grow { flex: 1; }
.micwrap input, .micwrap textarea {
  width: 100%; font: inherit; padding: 10px 46px 10px 14px; min-height: 44px;
  border: 1.5px solid var(--line); border-radius: 999px; background: var(--panel);
}
.micwrap textarea { border-radius: 14px; }
.micwrap input:focus, .micwrap textarea:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(232,93,4,0.18); }
.micbtn {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border: 0; border-radius: 50%; background: transparent;
  color: var(--ink-soft); cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 7px;
}
.micbtn svg { width: 100%; height: 100%; }
.micbtn:hover { background: rgba(232,93,4,0.12); color: var(--orange); }
.micbtn.rec { background: var(--red); color: #fff; animation: micpulse 1.2s infinite; }
.voicebtn { min-width: 44px; padding: 8px; }
.voicebtn svg { width: 22px; height: 22px; }
.voicebtn.voice-off .v-on { display: none; }
.voicebtn.voice-off { opacity: 0.45; }
.ask-panel { position: absolute; top: calc(100% + 8px); left: 0; right: 0; z-index: 60; }
.ask-a { box-shadow: 0 12px 40px rgba(22,33,45,0.18); border-radius: 16px; }

/* chat restyle */
.review-chat { border-radius: 18px; background: linear-gradient(180deg, #F6F8FA, #EDF1F5); border: 1px solid var(--line); }
.rmsg { border-radius: 16px; line-height: 1.5; }
.rmsg.ai { background: #fff; border: 1px solid #E2E8EF; border-left: 3px solid var(--orange); box-shadow: 0 2px 10px rgba(22,33,45,0.06); white-space: normal; }
.rmsg.me { background: linear-gradient(135deg, #FFF3E8, #FFE7D3); border: 1px solid #F3C9A8; }
.rmsg.ai .rq { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; margin: 2px 0 4px; }
.rmsg.ai em { color: var(--ink-soft); }
.rmsg.ai ul { margin: 4px 0 4px 20px; }
.rmsg.ai code { background: var(--paper); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 0.88em; }
.rgap { height: 8px; }
.review-doc-body { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; font-size: 0.95rem; }
.review-doc-body .rq { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; margin: 10px 0 4px; }
.review-doc-body ul { margin: 4px 0 8px 20px; }

/* pulsing AI orb */
.ai-orb {
  position: fixed; right: 22px; bottom: 22px; z-index: 100;
  width: 74px; height: 74px; cursor: pointer;
}
.ai-orb img {
  position: absolute; inset: 7px; width: 60px; height: 60px; border-radius: 50%;
  box-shadow: 0 6px 24px rgba(22,33,45,0.35);
}
.ai-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid var(--orange); opacity: 0;
}
.ai-orb.speaking .ai-ring { animation: ring 1.6s ease-out infinite; }
.ai-orb.speaking .ai-ring.r2 { animation-delay: 0.8s; }
.ai-orb.speaking img { animation: breathe 1.6s ease-in-out infinite; }
.ai-orb.thinking .ai-ring { border-color: #7A8CA0; animation: ring 1.1s ease-out infinite; }
.ai-orb.thinking .ai-ring.r2 { animation-delay: 0.55s; }
@keyframes ring { 0% { transform: scale(0.85); opacity: 0.9; } 100% { transform: scale(1.55); opacity: 0; } }
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.07); } }

@media (max-width: 760px) {
  .askwrap { order: 10; flex-basis: 100%; }
}

/* ---------- FPF FLIGHT INTEL — dark AI panel ---------- */
.review-wrap.intel {
  background: radial-gradient(120% 140% at 20% 0%, #16283F 0%, #0C1626 55%, #0A121F 100%);
  border-radius: 20px;
  padding: 18px;
  border: 1px solid #22354D;
  box-shadow: 0 18px 50px rgba(6, 12, 22, 0.35);
}
.intel-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.intel-ava { position: relative; width: 58px; height: 58px; flex-shrink: 0; }
.intel-ava img { position: absolute; inset: 5px; width: 48px; height: 48px; border-radius: 50%; filter: invert(1) brightness(1.6) drop-shadow(0 0 8px rgba(232,93,4,0.45)); }
.intel-ava .ir { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--orange); opacity: 0; }
.intel-ava.speaking .ir { animation: ring 1.5s ease-out infinite; }
.intel-ava.speaking .ir.i2 { animation-delay: 0.75s; }
.intel-ava.speaking img { animation: breathe 1.5s ease-in-out infinite; }
.intel-ava.thinking .ir { border-color: #5E7A9B; animation: ring 1s ease-out infinite; }
.intel-ava.thinking .ir.i2 { animation-delay: 0.5s; }
.intel-id { flex: 1; min-width: 0; }
.intel-title { color: #EDF2F8; font-weight: 800; letter-spacing: 0.24em; font-size: 0.82rem; }
.intel-status { color: #6E87A3; font-size: 0.68rem; letter-spacing: 0.3em; margin-top: 3px; }
.intel-outcome { font-size: 0.68rem; letter-spacing: 0.2em; padding: 4px 12px; border-radius: 999px; border: 1px solid; }
.intel-outcome.success { color: #6FE3A1; border-color: #2E7D5B; background: rgba(46,125,91,0.15); }
.intel-outcome.issues { color: #FF9E8A; border-color: #A5453A; background: rgba(165,69,58,0.15); }
.intel-restart {
  background: transparent; color: #8AA2BD; border: 1px solid #2C425E;
  font-size: 0.72rem; letter-spacing: 0.1em; padding: 7px 14px;
}
.intel-restart:hover { color: #EDF2F8; border-color: #5E7A9B; }

.intel .review-chat {
  background: rgba(10, 18, 31, 0.5);
  border: 1px solid #1E3049;
  border-radius: 16px;
}
.intel .rmsg.ai {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-left: 3px solid var(--orange);
  color: #DCE6F1;
  box-shadow: none;
  backdrop-filter: blur(4px);
}
.intel .rmsg.ai .rq { color: #FFFFFF; text-decoration-color: var(--orange); }
.intel .rmsg.ai em { color: #92A9C2; }
.intel .rmsg.ai code { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.15); color: #FFD9BC; }
.intel .rmsg.me {
  background: linear-gradient(135deg, #E85D04, #C24E03);
  border: 0; color: #fff;
}
.intel .rmsg.sys { color: #55708E; }
.intel .review-input textarea {
  background: rgba(255,255,255,0.06); border-color: #2C425E; color: #EDF2F8; border-radius: 14px;
}
.intel .review-input textarea::placeholder { color: #55708E; }
.intel .review-input textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(232,93,4,0.25); }
.intel .micbtn { color: #8AA2BD; }
.intel .micbtn:hover { color: var(--orange); }
.intel .review-actions .btn-ghost { background: transparent; color: #8AA2BD; border: 1px solid #2C425E; }
.intel .review-actions .btn-ghost:hover { color: #EDF2F8; border-color: #5E7A9B; }
.intel .cl-section, .intel h3 { color: #EDF2F8; }
.intel .review-doc { border-top-color: var(--orange); }
.intel .review-doc-body { background: rgba(255,255,255,0.97); }

/* ---------- work + doc ---------- */
.work-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .work-grid { grid-template-columns: 1fr; } }
.work-h { font-size: 1.05rem; margin-bottom: 10px; }
.work-h .hint { font-weight: 400; }
.new-item { background: var(--panel); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; margin-bottom: 14px; }
.new-item input { width: 100%; font: inherit; padding: 9px 12px; border: 1.5px solid var(--line); border-radius: 8px; margin-bottom: 8px; }
.new-item-row { display: flex; gap: 8px; }
.new-item-row select { font: inherit; padding: 7px; border: 1.5px solid var(--line); border-radius: 8px; }
.work-item { background: var(--panel); border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; }
.work-item.done { opacity: 0.55; }
.work-item.active { border-left: 4px solid var(--orange); }
.wi-head { display: flex; align-items: center; gap: 8px; }
.wi-title { font-weight: 600; }
.wi-meta { font-size: 0.8rem; color: var(--ink-soft); margin: 4px 0 8px; }
.wi-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.wi-actions select { font: inherit; font-size: 0.85rem; padding: 6px; border: 1.5px solid var(--line); border-radius: 8px; }
.prio { font-size: 0.68rem; letter-spacing: 0.08em; padding: 2px 8px; border-radius: 999px; border: 1px solid; }
.prio.high { color: var(--red); border-color: var(--red); background: var(--red-soft); }
.prio.medium { color: var(--orange); border-color: var(--orange); background: #FFF3E8; }
.prio.low { color: var(--ink-soft); border-color: var(--line); }
.cmts { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 8px; }
.cmt { font-size: 0.9rem; margin-bottom: 8px; }
.cmt-new { display: flex; gap: 8px; }
.cmt-new input { flex: 1; font: inherit; padding: 7px 10px; border: 1.5px solid var(--line); border-radius: 8px; }
.doc-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.doc-bar #docSave { margin-left: auto; }
.doc-edit { width: 100%; min-height: 420px; font: 0.95rem/1.5 ui-monospace, Menlo, monospace; padding: 16px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--panel); }
.doc-edit:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(232,93,4,0.15); }
.rev-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 0.9rem; }

/* aircraft selector + gating */
.ac-select { display: flex; gap: 10px; margin-bottom: 16px; }
.ac-btn {
  font: inherit; font-weight: 600; padding: 10px 22px; min-height: 44px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--panel); cursor: pointer; color: var(--ink-soft);
}
.ac-btn.active { border-color: var(--orange); color: var(--ink); background: #FFF3E8; box-shadow: 0 2px 10px rgba(232,93,4,0.15); }
.acc-row.locked { opacity: 0.5; }
.acc-row.locked .acc-head { cursor: not-allowed; }
.phase-meta-box {
  background: var(--paper); border: 1px dashed var(--line); border-radius: 10px;
  padding: 10px 14px; font-size: 0.88rem; color: var(--ink-soft); margin: 10px 0 2px;
}

/* ---------- training ---------- */
.tr-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.tr-pilot { font-weight: 600; font-size: 0.9rem; display: flex; flex-direction: column; gap: 4px; }
.tr-pilot select { font: inherit; padding: 8px; border: 1.5px solid var(--line); border-radius: 8px; }
.tr-hours { display: flex; gap: 10px; flex: 1; }
.tr-hour { background: var(--panel); border: 1.5px solid var(--line); border-radius: 12px; padding: 8px 16px; font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); text-align: center; }
.tr-hour span { display: block; font-size: 1.3rem; font-weight: 700; color: var(--ink); letter-spacing: 0; }
.tr-hour.combined { border-color: var(--orange); }
.tr-rule { white-space: normal; }
.tr-item { display: flex; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.tr-item input[type=checkbox] { width: 26px; height: 26px; accent-color: var(--green); flex-shrink: 0; margin-top: 2px; }
.tr-item.checked .tr-item-title { color: var(--green); }
.tr-item-main { flex: 1; }
.tr-item-pass { font-size: 0.88rem; color: var(--ink-soft); }
.tr-item-meta { display: flex; gap: 8px; align-items: center; font-size: 0.8rem; color: var(--ink-soft); margin-top: 6px; flex-wrap: wrap; }
.tr-att { width: 64px; font: inherit; font-size: 0.85rem; padding: 4px 6px; border: 1.5px solid var(--line); border-radius: 6px; }
.tr-notes { flex: 1; min-width: 140px; font: inherit; font-size: 0.85rem; padding: 4px 8px; border: 1.5px solid var(--line); border-radius: 6px; }
.seclabel-tr h2 { font-size: 1.05rem; margin: 26px 0 10px; }
.tr-sess { display: flex; gap: 12px; align-items: baseline; padding: 9px 4px; border-bottom: 1px solid var(--line); font-size: 0.92rem; flex-wrap: wrap; }
.tr-sess-type { font-size: 0.65rem; letter-spacing: 0.12em; padding: 3px 8px; border-radius: 999px; }
.tr-sess-type.sim { background: #E8F0FE; color: #1A56DB; }
.tr-sess-type.aircraft { background: #FFF3E8; color: var(--orange-deep); }
.tr-form-overlay { position: fixed; inset: 0; background: rgba(12, 20, 32, 0.55); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.tr-form { background: var(--panel); border-radius: 16px; padding: 22px; width: 100%; max-width: 440px; max-height: 92vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.tr-form label { font-size: 0.82rem; font-weight: 600; display: flex; flex-direction: column; gap: 4px; }
.tr-form input, .tr-form select, .tr-form textarea { font: inherit; padding: 8px 10px; border: 1.5px solid var(--line); border-radius: 8px; }
.tr-est { background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; font-size: 0.72rem; }

/* ---------- events (test card execution) ---------- */
.ev-card { text-align: left; font: inherit; cursor: pointer; }
.ev-head-panel .ev-meta { color: var(--ink-soft); font-size: 0.9rem; letter-spacing: 0.04em; margin-bottom: 0.4rem; }
.ev-head-panel .ev-desc { margin: 0; }
.ev-day { margin-top: 1.4rem; }
.ev-code {
  font-weight: 800; letter-spacing: 0.04em; color: var(--ink);
  border: 2px solid var(--ink); border-radius: 8px; padding: 0.25rem 0.5rem;
  min-width: 3.4rem; text-align: center; flex-shrink: 0; font-size: 0.85rem;
}
.ev-status-chip {
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  border-radius: 999px; padding: 0.3rem 0.7rem; flex-shrink: 0;
  background: var(--paper); color: var(--ink-soft); border: 1px solid var(--line);
}
.ev-status-chip.s-in_progress { background: #FFF3E4; color: var(--orange-deep); border-color: var(--orange); }
.ev-status-chip.s-pass { background: #E7F2E8; color: var(--green); border-color: var(--green); }
.ev-status-chip.s-fail { background: var(--red-soft); color: var(--red); border-color: var(--red); }
.ev-status-chip.s-inconclusive { background: #FFF8DC; color: #8a6d00; border-color: #c9a900; }
.ev-status-chip.s-refly { background: #EAF1F8; color: #1d4e79; border-color: #6d9dc5; }
.acc-row.ev-pass { border-left: 5px solid var(--green); }
.acc-row.ev-fail { border-left: 5px solid var(--red); }
.acc-row.ev-in_progress { border-left: 5px solid var(--orange); }
.acc-row.ev-refly { border-left: 5px solid #6d9dc5; }
.acc-row.ev-inconclusive { border-left: 5px solid #c9a900; }

.ev-metrics { margin-top: 1rem; }
.ev-metric { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.7rem 0.8rem; margin-bottom: 0.6rem; background: var(--panel); }
.ev-metric.pass { border-color: var(--green); background: #F4FAF4; }
.ev-metric.fail { border-color: var(--red); background: var(--red-soft); }
.ev-metric-top { display: flex; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.ev-metric-label { font-weight: 600; }
.ev-metric-req { color: var(--ink-soft); font-size: 0.9rem; white-space: nowrap; }
.ev-metric-act { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.mchip-pass.active { background: var(--green); border-color: var(--green); color: #fff; }
.mchip-fail.active { background: var(--red); border-color: var(--red); color: #fff; }
.ev-obs {
  flex: 1; min-width: 180px; font: inherit; font-size: 0.95rem;
  border: 1px solid var(--line); border-radius: 8px; padding: 0.55rem 0.7rem; background: var(--paper);
}
.ev-obs:focus { outline: 2px solid var(--orange); outline-offset: 1px; }

.ev-grid { margin-top: 1rem; }
.ev-grid-row { display: grid; grid-template-columns: 6.5rem 1.2fr 1.2fr 0.8fr; gap: 0.4rem; margin-bottom: 0.4rem; align-items: center; }
.ev-grid-head span { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); font-weight: 700; }
.ev-grid-label { font-weight: 600; font-size: 0.9rem; }
.ev-grid-row input { font: inherit; font-size: 0.95rem; border: 1px solid var(--line); border-radius: 8px; padding: 0.5rem 0.6rem; background: var(--paper); min-width: 0; }
.ev-grid-row input:focus { outline: 2px solid var(--orange); outline-offset: 1px; }
@media (max-width: 560px) {
  .ev-grid-row { grid-template-columns: 5rem 1fr 1fr 0.7fr; }
}

.ev-notes { margin-top: 1rem; }
.ev-note { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 0.8rem; margin-bottom: 0.5rem; background: var(--panel); }
.ev-note-meta { color: var(--ink-soft); font-size: 0.8rem; margin-bottom: 0.25rem; display: flex; justify-content: space-between; gap: 0.6rem; }
.ev-note-del { border: 0; background: none; color: var(--ink-soft); font-size: 1.1rem; cursor: pointer; min-height: 0; padding: 0 0.3rem; }
.ev-note-text { white-space: pre-wrap; }
.ev-note-add { display: flex; gap: 0.6rem; align-items: flex-end; margin-top: 0.6rem; }
.ev-note-add textarea {
  flex: 1; font: inherit; border: 1px solid var(--line); border-radius: 8px;
  padding: 0.6rem 0.7rem; background: var(--paper); resize: vertical;
}
.ev-note-add textarea:focus { outline: 2px solid var(--orange); outline-offset: 1px; }

.ev-report .ev-report-bar { display: flex; justify-content: space-between; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.ev-report .btn-row { margin-top: 0; }
.ev-report-body { margin-top: 0.6rem; }

/* event card photos & files */
.ev-files { margin-top: 1rem; }
.ev-file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.7rem; margin-bottom: 0.6rem; }
.ev-file { border: 1px solid var(--line); border-radius: var(--radius); padding: 0.5rem; background: var(--panel); position: relative; display: flex; flex-direction: column; gap: 0.4rem; }
.ev-file img { width: 100%; height: 110px; object-fit: cover; border-radius: 6px; display: block; }
.ev-file-doc { font-size: 0.85rem; word-break: break-all; color: var(--ink); min-height: 44px; display: flex; align-items: center; }
.ev-caption { font: inherit; font-size: 0.82rem; border: 1px solid var(--line); border-radius: 6px; padding: 0.4rem 0.5rem; background: var(--paper); width: 100%; }
.ev-caption:focus { outline: 2px solid var(--orange); outline-offset: 1px; }
.ev-file-del {
  position: absolute; top: 0.3rem; right: 0.3rem; border: 0; border-radius: 50%;
  width: 28px; height: 28px; min-height: 0; padding: 0; background: rgba(22,33,45,0.75); color: #fff;
  font-size: 1rem; cursor: pointer; line-height: 1;
}
.ev-upl-status { align-self: center; }

/* spreadsheet-style table notes */
.ev-tbl-wrap { margin: 0.2rem 0; }
.ev-tbl-title { font-weight: 700; margin-bottom: 0.4rem; }
.ev-tbl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ev-tbl { border-collapse: collapse; font-size: 0.85rem; }
.ev-tbl th, .ev-tbl td { border: 1px solid #8a949e; padding: 0.4rem 0.65rem; white-space: nowrap; }
.ev-tbl .ev-tbl-corner { border: 1.5px solid var(--ink); background: var(--panel); font-weight: 700; }
.ev-tbl .ev-tbl-group { border: 1.5px solid var(--ink); font-weight: 700; text-align: center; }
.ev-tbl .ev-tbl-col { font-style: italic; font-weight: 500; font-size: 0.8rem; text-align: center; }
.ev-tbl .ev-tbl-rowlabel { border: 1.5px solid var(--ink); background: var(--panel); font-weight: 700; text-align: right; }
.ev-tbl td { text-align: center; }

/* note editing */
.ev-note-acts { display: flex; gap: 0.5rem; align-items: center; flex-shrink: 0; }
.ev-note-edit { border: 1px solid var(--line); background: var(--paper); border-radius: 6px; padding: 0.25rem 0.6rem; font: inherit; font-size: 0.78rem; cursor: pointer; min-height: 0; }
.ev-note-edit:hover { border-color: var(--ink); }
.ev-note-editor textarea { width: 100%; font: inherit; border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem 0.7rem; background: var(--paper); resize: vertical; }
.ev-note-editor textarea:focus { outline: 2px solid var(--orange); outline-offset: 1px; }
.ev-note-editor .btn-row { margin-top: 0.4rem; }


/* ---------- flight day module ---------- */
.stamp { display:inline-block; margin-left:8px; font-size:0.78rem; color:var(--ink-soft); white-space:nowrap; }
.fd-sec .fd-head { width:100%; background:none; border:0; padding:0; text-align:left; cursor:pointer; display:flex; align-items:center; gap:12px; font:inherit; color:inherit; }
.fd-sec .fd-head h2 { flex:1; margin:0; }
.fd-sec.warn { border-left:5px solid var(--orange); }
.fd-sec.ok { border-left:5px solid var(--green); }
.fd-body { margin-top:8px; }
.panel.inner { background:#F7F9FB; margin:10px 0; }
.note-field { margin:10px 0; }
.note-head { display:flex; align-items:center; justify-content:space-between; margin-bottom:4px; }
.note-field textarea, .co-edit, .mic-clean { width:100%; font:inherit; font-size:1rem; padding:10px; border:1px solid var(--line); border-radius:var(--radius); }
.micbtn2.rec { background:var(--red); color:#fff; border-color:var(--red); }
.mic-review { background:#FFF3E8; border:1px solid var(--orange); border-radius:var(--radius); padding:10px; margin:8px 0; }
.mic-raw summary { cursor:pointer; color:var(--ink-soft); font-size:0.85rem; margin-top:6px; }
.mic-raw p { font-size:0.9rem; color:var(--ink-soft); }
.stamp-row { align-items:center; margin-top:10px; }
.pool-row { display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--line); }
.pool-row.done .pool-title { text-decoration:line-through; color:var(--ink-soft); }
.pool-title { flex:1; }
.pool-state { font-size:0.8rem; color:var(--ink-soft); text-transform:uppercase; letter-spacing:0.06em; }
.pool-row.done .pool-state { color:var(--green); }
.pick-box { background:#F7F9FB; border:1px solid var(--line); border-radius:var(--radius); padding:10px; margin:10px 0; }
.pick-box select { width:100%; font:inherit; padding:10px; margin-bottom:8px; }
.dmg-row { display:flex; gap:12px; align-items:flex-start; padding:10px 0; border-bottom:1px solid var(--line); }
.dmg-row.open { border-left:4px solid var(--red); padding-left:10px; }
.dmg-row.repaired { border-left:4px solid var(--green); padding-left:10px; opacity:0.8; }
.dmg-main { flex:1; }
.sev { font-size:0.78rem; text-transform:uppercase; letter-spacing:0.06em; padding:2px 6px; border-radius:4px; background:#EEF1F4; }
.sev-major, .sev-grounding, .sev-critical { background:var(--red-soft); color:var(--red); }
.evt-row { display:flex; gap:10px; align-items:baseline; padding:8px 0; border-bottom:1px solid var(--line); }
.evt-t { font-variant-numeric:tabular-nums; color:var(--ink-soft); white-space:nowrap; font-size:0.9rem; }
.evt-kind { font-size:0.78rem; text-transform:uppercase; letter-spacing:0.06em; background:#EEF1F4; padding:2px 6px; border-radius:4px; white-space:nowrap; }
.evt-row.sev-major .evt-kind, .evt-row.sev-critical .evt-kind { background:var(--red-soft); color:var(--red); }
.evt-desc { flex:1; }
.proc { white-space:pre-wrap; font:inherit; font-size:0.95rem; background:#F7F9FB; padding:10px; border-radius:var(--radius); }
.log-sum pre { white-space:pre-wrap; font-size:0.8rem; max-height:300px; overflow:auto; background:#F7F9FB; padding:8px; }
.pl-row { display:grid; grid-template-columns:auto 2fr 1fr 70px 1.5fr auto; gap:6px; align-items:center; padding:6px 0; border-bottom:1px solid var(--line); }
.pl-row input { font:inherit; font-size:0.95rem; padding:8px; border:1px solid var(--line); border-radius:6px; min-width:0; }
.pl-move { display:flex; gap:2px; }
.new-item-row { display:flex; gap:6px; margin:10px 0; flex-wrap:wrap; }
.new-item-row input { flex:1; font:inherit; padding:10px; border:1px solid var(--line); border-radius:var(--radius); min-width:120px; }
@media (max-width: 700px) { .pl-row { grid-template-columns:auto 1fr auto; } .pl-row .pl-cat, .pl-row .pl-qty, .pl-row .pl-note { grid-column: 2 / span 2; } }

.task-obs { width:100%; margin-top:6px; font:inherit; font-size:0.95rem; padding:8px; border:1px solid var(--line); border-radius:6px; }
.ev-metric-act { display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
.ev-note-add .note-head, .ev-note-editor .note-head { margin-top:6px; }

.micbtn2 { display:inline-flex; align-items:center; justify-content:center; width:44px; height:44px; padding:0; border:1px solid var(--line); border-radius:50%; background:var(--panel); color:var(--ink); cursor:pointer; flex-shrink:0; }
.micbtn2:hover { border-color:var(--orange); color:var(--orange); }
.micbtn2.rec { background:var(--red); border-color:var(--red); color:#fff; animation: micpulse 1.2s ease-in-out infinite; }
@keyframes micpulse { 0%,100% { box-shadow:0 0 0 0 rgba(198,40,40,0.45); } 50% { box-shadow:0 0 0 8px rgba(198,40,40,0); } }
.note-head { gap:10px; }
.note-head-right { justify-content:flex-end; margin-bottom:6px; }
.ev-note-add { display:flex; flex-direction:column; gap:8px; }
.ev-note-add textarea { width:100%; font:inherit; padding:10px; border:1px solid var(--line); border-radius:var(--radius); }

.mic-row { display:flex; align-items:flex-start; gap:10px; }
.mic-row textarea { flex:1; min-width:0; }
.mic-row .micbtn2 { margin-top:2px; }

/* checklist library */
.cl-tabs { margin-bottom: 12px; }
.cl-edit-row { grid-template-columns: auto 3fr 110px auto; }
.cl-edit-row.pre { grid-template-columns: auto 3fr 1.2fr 110px auto; }
.cl-retired { display:flex; justify-content:space-between; align-items:center; gap:10px; padding:6px 0; border-bottom:1px solid var(--line); color:var(--ink-soft); }
.cl-hist { display:flex; flex-wrap:wrap; align-items:center; gap:10px; padding:7px 0; border-bottom:1px solid var(--line); }
.cl-hist-what { flex:1; min-width:200px; }
.cl-hist.undone .cl-hist-what { color:var(--ink-soft); text-decoration:line-through; }
@media (max-width: 700px) { .cl-edit-row, .cl-edit-row.pre { grid-template-columns: auto 1fr auto; } .cl-edit-row .pl-cat, .cl-edit-row .pl-qty { grid-column: 2 / span 2; } }

/* aircraft tab */
.ac-row { cursor: pointer; }
.ac-badge { display:inline-block; padding:2px 10px; border-radius:999px; font-size:0.8rem; font-weight:800; margin-left:6px; vertical-align:middle; }
.ac-ready { background:#DDF3E1; color:#1D7A34; }
.ac-out { background:#FFF1D6; color:#9A6B00; }
.ac-down { background:#FBDCDC; color:#B02A2A; }
.ac-pill { display:inline-block; padding:1px 8px; border-radius:999px; background:#EEF2F6; margin-right:5px; font-size:0.78rem; font-weight:700; }
.ac-sq { background:#FBDCDC; color:#B02A2A; margin-left:6px; }
.ac-thumbs { display:flex; gap:6px; flex-wrap:wrap; margin-top:6px; }
.ac-thumb { width:84px; height:84px; object-fit:cover; border-radius:8px; border:1px solid #D8DEE5; }
.ac-hist { padding:4px 0; border-bottom:1px solid #EEF2F6; }
