:root {
  --bg: #eef3f7;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --surface-tint: #edf5f8;
  --text: #15212f;
  --muted: #647386;
  --line: #dbe3ec;
  --line-strong: #c4cfdb;
  --nav: #13202d;
  --nav-soft: #1b2a38;
  --nav-line: rgba(196, 213, 230, 0.18);
  --nav-text: #edf6ff;
  --nav-muted: #9db1c3;
  --primary: #146c83;
  --primary-strong: #0e5265;
  --primary-soft: #e5f3f6;
  --accent: #9f5b12;
  --good: #177c59;
  --warn: #a36510;
  --danger: #b42318;
  --shadow: 0 14px 34px rgba(31, 48, 68, 0.08);
  --shadow-soft: 0 8px 18px rgba(31, 48, 68, 0.05);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(255, 255, 255, 0) 260px),
    var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

body.auth-required .app-shell {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

body.authenticated .auth-screen {
  display: none;
}

body:not(.is-admin) .admin-only,
body:not(.can-write) #newStudentBtn,
body:not(.can-write) #newPilotProfileBtn,
body:not(.can-write) #newProficiencyBtn,
body:not(.can-write) [data-delete-profile],
body:not(.can-write) [data-edit-proficiency],
body:not(.can-write) [data-delete-proficiency],
body:not(.can-write) [data-delete-daily-report] {
  display: none !important;
}

body:not(.can-write-daily) #newDailyReportBtn,
body:not(.can-write-daily) #newDailyReportTopBtn,
body:not(.can-write-daily) [data-edit-daily-report] {
  display: none !important;
}

body:not(.can-write):not(.can-write-own-student) #newFlightBtn,
body:not(.can-write):not(.can-write-own-student) [data-edit-flight],
body:not(.can-write):not(.can-write-own-student) [data-delete-flight] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a.secondary,
label.secondary {
  border: 0;
  cursor: pointer;
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-columns: 282px minmax(0, 1fr);
  min-height: 100vh;
}

.auth-screen {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #102331;
}

.auth-screen::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent 49.8%, rgba(255, 255, 255, 0.04) 50%, transparent 50.2%),
    linear-gradient(0deg, transparent 49.8%, rgba(255, 255, 255, 0.03) 50%, transparent 50.2%);
  background-size: 96px 96px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent 80%);
}

.auth-card {
  position: relative;
  width: min(400px, 100%);
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.auth-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.auth-brand h1,
.auth-brand p,
.auth-note,
.sidebar-note {
  margin: 0;
}

.auth-brand h1 {
  font-size: 22px;
  font-weight: 900;
}

.auth-brand p,
.auth-note {
  color: var(--muted);
}

.auth-note {
  margin-top: 12px;
  font-size: 12px;
}

.auth-card label {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 800;
}

.auth-card input {
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--text);
}

.auth-card .primary {
  min-height: 48px;
  margin-top: 4px;
  font-size: 15px;
}

.auth-connection {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  color: var(--good);
  font-size: 12px;
  font-weight: 800;
}

.auth-connection svg {
  width: 16px;
  height: 16px;
}

.auth-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #f3b6af;
  border-radius: 8px;
  background: #fff7f6;
  color: var(--danger);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.5;
  word-break: break-word;
}

.hidden {
  display: none !important;
}

.mobile-only,
.mobile-training-selectors {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 18px 14px;
  background:
    linear-gradient(180deg, rgba(35, 54, 72, 0.78), rgba(19, 32, 45, 0) 220px),
    var(--nav);
  color: var(--nav-text);
}

.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 7px 8px 16px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--nav-line);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(223, 235, 247, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
}

.brand-mark-flight {
  width: 48px;
  height: 48px;
  background: #f2f7f9;
  border-color: rgba(255, 255, 255, 0.55);
  color: #12384a;
  font-size: 13px;
  line-height: 1;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.dialog-head h3 {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  line-height: 1.15;
  font-weight: 900;
}

.brand p {
  margin-top: 4px;
  color: var(--nav-muted);
  font-size: 12px;
}

.user-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-box strong {
  display: block;
  margin-top: 3px;
  color: #ffffff;
}

.sidebar-note {
  color: var(--nav-muted);
  font-size: 12px;
}

.account-card {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.account-card div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.account-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.account-card strong {
  display: block;
  margin-top: 4px;
}

.software-update {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.software-update-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #e7f3f6;
  color: var(--primary);
}

.software-update-icon svg {
  width: 22px;
  height: 22px;
}

.software-update-copy {
  min-width: 0;
}

.software-update-copy h3,
.software-update-copy p {
  margin: 0;
}

.software-update-copy p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.version-pair {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.version-pair strong {
  margin-left: 4px;
  color: var(--text);
}

.update-notes {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
}

.update-action {
  min-width: 118px;
  justify-content: center;
}

.inline-check {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.side-section {
  margin-top: 16px;
}

.side-section.compact {
  padding-top: 14px;
  border-top: 1px solid var(--nav-line);
}

.side-section.first {
  margin-top: 12px;
  padding-top: 0;
  border-top: 0;
}

.side-title {
  margin: 0 8px 8px;
  color: var(--nav-muted);
  font-size: 12px;
  font-weight: 800;
}

.module-nav,
.template-filter {
  display: grid;
  gap: 7px;
}

.module-tab,
.template-chip,
.student-item {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--nav-text);
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.module-tab {
  display: flex;
  position: relative;
  align-items: center;
  gap: 10px;
}

.module-tab svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.module-tab,
.template-chip {
  min-height: 38px;
  padding: 8px 10px;
  background: transparent;
  font-weight: 800;
}

.module-tab:hover,
.template-chip:hover,
.student-item:hover {
  border-color: rgba(223, 235, 247, 0.2);
  background: rgba(255, 255, 255, 0.06);
}

.module-tab.active,
.template-chip.active,
.student-item.active {
  border-color: rgba(125, 177, 201, 0.72);
  background: #213544;
}

.module-tab.active {
  box-shadow: inset 3px 0 0 #62b3c7;
}

.hidden,
.module-page {
  display: none;
}

.module-page.active {
  display: block;
}

.subpage-nav {
  display: flex;
  gap: 4px;
  margin: 0 0 14px;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e8eef3;
}

.subpage-tab {
  display: inline-flex;
  position: relative;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

.subpage-tab svg {
  width: 17px;
  height: 17px;
}

.subpage-tab.active {
  background: #ffffff;
  color: var(--primary-strong);
  box-shadow: 0 1px 4px rgba(31, 48, 68, 0.12);
}

.update-dot {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 9px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: #dc2626;
  color: #ffffff;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.15);
}

.subpage-tab .update-dot {
  top: 4px;
  right: 4px;
  border-width: 1px;
}

.subpage {
  display: none;
}

.subpage.active {
  display: block;
}

.student-list {
  display: grid;
  gap: 7px;
}

.student-item {
  padding: 10px 11px;
  background: rgba(255, 255, 255, 0.035);
}

.student-name {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 900;
}

.student-meta {
  margin-top: 5px;
  color: var(--nav-muted);
  font-size: 12px;
}

.main {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  margin-bottom: 16px;
  padding: 4px 2px;
}

.topbar h2 {
  font-size: 24px;
  line-height: 1.18;
  font-weight: 900;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.top-actions,
.button-row,
.filters,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.primary,
.secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 13px;
  border-radius: 8px;
  font-weight: 800;
  white-space: nowrap;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.primary {
  background: var(--primary);
  color: white;
}

.primary:hover {
  background: var(--primary-strong);
}

.primary:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.secondary {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
}

.secondary:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.sidebar .primary {
  min-height: 40px;
  margin-top: 2px;
  background: #2f758d;
}

.sidebar .secondary {
  border-color: rgba(223, 235, 247, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
}

.wide {
  width: 100%;
}

.small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
}

.file-button input {
  display: none;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.metric {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-value {
  margin-top: 4px;
  font-size: 25px;
  line-height: 1.15;
  font-weight: 900;
}

.metric-sub {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 12px;
  margin-bottom: 12px;
}

.compact-grid {
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.9fr);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.category-card {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.category-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 900;
}

.category-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 9px;
}

.category-values span {
  color: var(--muted);
  font-size: 12px;
}

.category-values strong {
  display: block;
  margin-top: 2px;
  color: var(--text);
  font-size: 15px;
}

.delta-positive {
  color: var(--danger) !important;
}

.delta-negative {
  color: var(--warn) !important;
}

.delta-zero {
  color: var(--good) !important;
}

.alert-list {
  display: grid;
  gap: 8px;
  max-height: 214px;
  overflow: auto;
}

.alert-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.alert-item.over {
  border-color: #e9b6b0;
  background: #fff7f6;
}

.alert-item.short {
  border-color: #ecd094;
  background: #fffaf0;
}

.alert-item.minor {
  border-color: #cfe2ea;
  background: #f4fafc;
}

.alert-code,
.alert-title,
.alert-delta {
  font-weight: 900;
}

.alert-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.alert-delta {
  white-space: nowrap;
}

.panel {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  margin-bottom: 12px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h3 {
  font-size: 16px;
  font-weight: 900;
}

.panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.stage-grid {
  display: grid;
  gap: 9px;
}

.stage-row {
  display: grid;
  grid-template-columns: 150px 1fr 82px;
  align-items: center;
  gap: 12px;
}

.stage-name {
  font-weight: 800;
}

.stage-hours {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.check-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.check-summary-grid .metric {
  padding: 12px;
  box-shadow: none;
}

.check-summary-grid .metric-value {
  font-size: 22px;
}

.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5ebf1;
}

.bar > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.next-course {
  min-height: 116px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-tint);
}

.next-course strong {
  display: block;
  margin-bottom: 7px;
  font-size: 17px;
}

.next-course p {
  margin: 5px 0;
  color: var(--muted);
}

.empty-state {
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.stat-card-list {
  display: grid;
  gap: 9px;
  max-height: 310px;
  overflow: auto;
}

.stat-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: start;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.stat-card strong,
.stat-card b {
  font-weight: 900;
}

.stat-card span,
.stat-card p {
  color: var(--muted);
  font-size: 12px;
}

.stat-card span {
  display: block;
  margin-top: 3px;
}

.stat-card p {
  grid-column: 1 / -1;
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
  background: #ffffff;
}

.proficiency-table {
  min-width: 900px;
  table-layout: fixed;
}

.proficiency-table th:nth-child(1) { width: 16%; }
.proficiency-table th:nth-child(2) { width: 13%; }
.proficiency-table th:nth-child(3) { width: 14%; }
.proficiency-table th:nth-child(4) { width: 21%; }
.proficiency-table th:nth-child(5) { width: 13%; }
.proficiency-table th:nth-child(6) { width: 15%; }
.proficiency-table th:nth-child(7) { width: 8%; }
.proficiency-table th,
.proficiency-table td { vertical-align: middle; }
.proficiency-table td { overflow-wrap: anywhere; }

.profile-table {
  min-width: 1260px;
  table-layout: fixed;
}

.profile-table th:nth-child(1) { width: 100px; }
.profile-table th:nth-child(2) { width: 150px; }
.profile-table th:nth-child(3) { width: 155px; }
.profile-table th:nth-child(4) { width: 190px; }
.profile-table th:nth-child(5) { width: 155px; }
.profile-table th:nth-child(6) { width: 190px; }
.profile-table th:nth-child(7) { width: 180px; }
.profile-table th:nth-child(8) { width: 140px; }

.profile-table th {
  white-space: nowrap;
}

.profile-table td {
  padding: 14px 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.profile-table .profile-name-cell,
.profile-table .profile-name-link,
.profile-table .profile-date,
.profile-table .profile-language-level,
.profile-table .badge {
  white-space: nowrap;
  word-break: keep-all;
  overflow-wrap: normal;
  writing-mode: horizontal-tb;
}

.profile-status-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.profile-table .profile-contact-cell > .muted {
  margin-top: 4px;
  font-size: 12px;
}

.profile-table .profile-identifier {
  max-width: 100%;
  font-size: 12px;
}

.profile-table .profile-unit-cell > .muted {
  margin-top: 4px;
}

.profile-table .profile-file-link {
  min-height: 28px;
  margin-top: 0;
  white-space: nowrap;
  flex: 0 0 auto;
}

.profile-table .table-actions button {
  white-space: nowrap;
}

.profile-note-cell {
  font-size: 13px;
}

.daily-report-table {
  min-width: 1060px;
}

.flight-table {
  min-width: 920px;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f8fb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

td {
  color: var(--text);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.course-title {
  max-width: 320px;
  font-weight: 800;
}

.course-times {
  min-width: 142px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  white-space: nowrap;
}

.course-times strong {
  color: var(--text);
}

.course-times span {
  color: var(--muted);
}

.course-times-total {
  margin-top: 2px;
  color: var(--text);
  font-weight: 900;
}

.muted {
  color: var(--muted);
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  text-align: left;
  padding: 0;
}

.link-button:hover {
  text-decoration: underline;
}

.file-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  cursor: pointer;
  max-width: 100%;
  margin-top: 4px;
  padding: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.file-link svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.file-link span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-link:hover {
  text-decoration: underline;
}

.upload-current {
  display: block;
  min-height: 18px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.upload-current .file-link {
  margin-top: 0;
}

.upload-pending {
  display: block;
  min-height: 18px;
  margin-top: 4px;
  color: #146c83;
  font-size: 12px;
  font-weight: 800;
}

.profile-upload-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 74px auto;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.profile-upload-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #e7f2f4;
  color: var(--primary);
}

.profile-upload-icon svg {
  width: 21px;
  height: 21px;
}

.profile-upload-copy {
  display: grid;
  min-width: 0;
}

.profile-upload-copy .upload-current,
.profile-upload-copy .upload-pending {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-upload-copy .file-link {
  max-width: 100%;
}

.profile-upload-copy > strong {
  font-size: 14px;
}

.profile-upload-preview {
  display: grid;
  width: 72px;
  height: 58px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--muted);
}

.profile-upload-preview:empty {
  display: none;
}

.profile-upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-upload-preview svg {
  width: 22px;
  height: 22px;
}

.profile-upload-preview span {
  font-size: 10px;
  font-weight: 900;
}

.profile-upload-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.profile-upload-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.profile-upload-picker input {
  display: none;
}

.profile-detail {
  display: grid;
  gap: 12px;
}

.detail-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.detail-section h4 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.detail-item {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.detail-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.detail-item strong {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  word-break: break-word;
}

.detail-note {
  margin: 0;
  white-space: pre-wrap;
}

.file-preview-card {
  width: 100%;
}

#filePreviewDialog {
  width: min(1100px, calc(100vw - 12px));
}

.file-preview-tools {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 10px;
}

.file-preview-tools.hidden {
  display: none;
}

.file-preview-tools > span {
  min-width: 48px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.file-preview-body {
  display: grid;
  min-height: min(68vh, 720px);
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
}

.file-preview-image-stage {
  display: grid;
  width: 100%;
  min-height: min(68vh, 720px);
  padding: 24px;
  place-items: center;
}

.file-preview-image {
  display: block;
  max-width: 100%;
  max-height: min(68vh, 720px);
  object-fit: contain;
  transform-origin: center;
  transition: transform 160ms ease;
}

.file-preview-frame {
  width: 100%;
  height: min(68vh, 720px);
  border: 0;
  background: #ffffff;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
}

.badge.done {
  background: #e7f6ef;
  color: var(--good);
}

.badge.running {
  background: #fff4df;
  color: var(--warn);
}

.badge.over {
  background: #fff0ee;
  color: var(--danger);
}

.badge.short {
  background: #fff4df;
  color: var(--warn);
}

.badge.idle {
  background: #eef2f6;
  color: #536170;
}

.progress-cell {
  min-width: 130px;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

select:focus,
input:focus,
textarea:focus {
  border-color: #6baabe;
  box-shadow: 0 0 0 3px rgba(20, 108, 131, 0.12);
}

select,
input {
  height: 36px;
  padding: 7px 10px;
}

textarea {
  padding: 9px 10px;
  resize: vertical;
}

dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100vh - 12px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
  overflow: hidden;
}

dialog::backdrop {
  background: rgba(16, 24, 40, 0.45);
}

.dialog-card {
  padding: 18px;
  max-height: calc(100vh - 12px);
  overflow: auto;
  background: var(--surface);
}

.dialog-card.large {
  width: 100%;
}

#flightDialog {
  width: min(1180px, calc(100vw - 12px));
}

#courseDialog {
  width: min(1100px, calc(100vw - 12px));
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.dialog-head.sticky {
  position: sticky;
  top: -18px;
  z-index: 2;
  margin: -18px -18px 14px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.dialog-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: #eef2f6;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.editable-select {
  position: relative;
  display: block;
  min-width: 0;
}

.editable-select.open {
  z-index: 30;
}

.editable-select input {
  width: 100%;
  padding-right: 38px;
}

.editable-select-toggle {
  position: absolute;
  top: 1px;
  right: 12px;
  display: grid;
  width: 32px;
  height: 34px;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.editable-select-toggle svg {
  width: 17px;
  height: 17px;
  transition: transform 0.16s ease;
}

.editable-select.open .editable-select-toggle svg {
  transform: rotate(180deg);
}

.editable-select-menu {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  display: none;
  max-height: 190px;
  overflow-y: auto;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(31, 48, 68, 0.18);
}

.editable-select.open .editable-select-menu {
  display: block;
}

.editable-select-menu button {
  display: block;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  text-align: left;
  white-space: normal;
  word-break: break-word;
}

.editable-select-menu button:hover,
.editable-select-menu button:focus {
  background: var(--primary-soft);
  color: var(--primary-strong);
  outline: none;
}

.editable-select-empty {
  display: block;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
}

.meter-reference {
  min-height: 17px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.meter-reference.has-reference {
  color: var(--primary);
}

.course-editor-grid,
.checklist-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.course-editor-grid textarea {
  min-height: 160px;
  line-height: 1.55;
}

.course-editor-grid label:nth-child(2) textarea {
  min-height: 230px;
}

.check-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  overflow: hidden;
}

.check-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.check-section-head h4 {
  margin: 0;
  font-size: 14px;
}

.check-list {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.check-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 78px 32px;
  gap: 8px;
  align-items: center;
}

.check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.check-row input[type="text"] {
  height: 34px;
}

.check-row select {
  height: 34px;
  padding: 5px 7px;
}

.remove-item {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--danger);
}

.course-template-block {
  margin-top: 12px;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover {
  background: #f8fafc;
}

#flightForm .form-grid.three {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px 12px;
}

#flightForm .span-3 {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
  color: #344054;
  font-weight: 800;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

.dialog-actions {
  position: sticky;
  bottom: -18px;
  justify-content: flex-end;
  margin: 16px -18px -18px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.dialog-inline-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dialog-inline-actions .muted {
  font-size: 12px;
}

.danger-link {
  border: 0;
  background: transparent;
  color: var(--danger);
  cursor: pointer;
  font-weight: 800;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #101828;
  color: #ffffff;
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition: 0.18s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

#dailyReportDialog {
  width: min(1240px, calc(100vw - 18px));
}

.section-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.section-intro h3,
.section-intro p {
  margin: 0;
}

.section-intro h3 {
  font-size: 18px;
}

.section-intro p,
.section-intro > span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.flight-end-list {
  display: grid;
  gap: 10px;
}

.flight-end-card {
  position: relative;
  display: grid;
  grid-template-columns: 130px minmax(180px, 0.9fr) minmax(260px, 1.25fr);
  gap: 14px;
  align-items: center;
  min-height: 112px;
  padding: 14px 54px 14px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  background: #ffffff;
}

.flight-end-date span,
.flight-end-main span,
.flight-end-main small,
.flight-end-data span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.flight-end-date strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
}

.flight-end-main strong {
  display: block;
  margin: 3px 0;
  font-size: 20px;
}

.flight-end-data {
  display: grid;
  grid-template-columns: 72px 72px minmax(0, 1fr);
  gap: 8px;
}

.flight-end-data > div {
  min-width: 0;
  padding: 8px 10px;
  border-left: 1px solid var(--line);
}

.flight-end-data b {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.flight-end-areas {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.flight-end-areas span,
.breakdown-list > span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 4px 7px;
  border: 1px solid #cfe0e6;
  border-radius: 6px;
  background: #f3f8fa;
  color: #264653;
  font-size: 12px;
}

.flight-end-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 5px;
}

.danger-icon {
  color: var(--danger);
}

.operations-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.operations-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.operations-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.operations-card header span,
.operations-metrics span,
.operations-meta,
.pilot-stat-line span,
.operations-card footer {
  color: var(--muted);
  font-size: 12px;
}

.operations-card h4 {
  margin: 3px 0 0;
  font-size: 22px;
}

.operations-primary {
  text-align: right;
}

.operations-primary strong {
  display: block;
  margin-top: 2px;
  font-size: 20px;
}

.operations-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.operations-metrics > div {
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.operations-metrics span,
.operations-metrics b {
  display: block;
}

.operations-metrics b {
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.operations-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 12px;
  margin-bottom: 10px;
}

.breakdown-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 29px;
}

.breakdown-list span b {
  font-weight: 900;
}

.operations-card footer {
  margin-top: 11px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.pilot-stat-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.pilot-stat-line + .operations-meta {
  margin-top: 10px;
}

.operations-card footer.data-warning {
  color: var(--warn);
  font-weight: 800;
}

.record-filter-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.record-filter-bar label,
.report-form-section label,
.structured-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.record-filter-bar button {
  min-height: 36px;
}

.report-form-section {
  margin-bottom: 13px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

#dailyReportForm .form-grid {
  align-items: start;
}

#dailyReportForm .report-form-section label {
  align-content: start;
}

.report-stepper {
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.report-step {
  display: flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 800;
}

.report-step span {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 50%;
  background: #dce5ec;
  font-size: 11px;
}

.report-step.active {
  border-color: #74aebe;
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.report-step.active span {
  background: var(--primary);
  color: #ffffff;
}

.report-form-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.report-form-heading strong,
.report-form-heading span {
  display: block;
}

.report-consistency {
  display: block;
  min-height: 16px;
  margin-top: 4px;
  color: var(--success, #28724b);
  font-size: 12px;
  font-weight: 700;
}

.report-consistency.is-error {
  color: var(--danger, #a32929);
}

#dailyReportForm [name="hour_before"],
#dailyReportForm [name="hour_after"],
#dailyReportForm [name="flight_hours"] {
  text-align: center;
}

.report-form-heading strong {
  color: var(--text);
  font-size: 15px;
}

.report-form-heading span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.structured-list {
  display: grid;
  gap: 8px;
}

.structured-row {
  display: grid;
  align-items: end;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.flight-segment-row {
  grid-template-columns: minmax(180px, 1.6fr) 100px 90px 90px 36px;
}

.structured-row input,
.structured-row select {
  width: 100%;
}

.remove-structured-row {
  color: var(--danger);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .brand {
    margin-bottom: 12px;
  }

  .module-nav,
  .template-filter,
  .student-list {
    grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  }

  .side-section {
    margin-top: 14px;
  }

  .button-row {
    flex-wrap: wrap;
  }

  .metric-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workspace-grid,
  .compact-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    font-size: 13px;
    padding-bottom: calc(74px + env(safe-area-inset-bottom));
  }

  .mobile-only {
    display: inline-flex;
  }

  .report-stepper.mobile-only,
  .mobile-training-selectors {
    display: grid;
  }

  .auth-screen {
    padding-top: calc(18px + env(safe-area-inset-top));
  }

  .sidebar {
    position: static;
    padding: 0;
    background: transparent;
    color: var(--text);
  }

  .brand {
    display: none;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    font-size: 15px;
  }

  .brand h1 {
    font-size: 17px;
  }

  .user-box {
    min-height: 52px;
    margin: 0;
    padding: calc(9px + env(safe-area-inset-top)) 14px 9px;
    border: 0 !important;
    background: var(--nav);
    color: var(--nav-text);
  }

  .user-box .side-title,
  .user-box .sidebar-note {
    color: var(--nav-muted);
  }

  .user-box .secondary {
    min-height: 32px;
  }

  .sidebar > .side-section.first {
    position: fixed;
    z-index: 80;
    right: 0;
    bottom: 0;
    left: 0;
    margin: 0;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    border: 0;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 -8px 24px rgba(31, 48, 68, 0.12);
  }

  .sidebar > .side-section.first > .side-title {
    display: none;
  }

  .module-nav {
    display: flex;
    gap: 2px;
  }

  .module-tab {
    display: grid;
    min-width: 0;
    min-height: 52px;
    place-items: center;
    gap: 2px;
    padding: 5px 2px;
    border: 0;
    color: var(--muted);
    text-align: center;
    font-size: 11px;
    flex: 1 1 0;
  }

  .module-tab svg {
    width: 21px;
    height: 21px;
  }

  .module-tab.active {
    border: 0;
    background: transparent;
    color: var(--primary);
    box-shadow: none;
  }

  .sidebar [data-module-panel] {
    width: 100%;
    min-width: 0;
    padding: 12px 14px 0;
    background: var(--nav);
    color: var(--nav-text);
  }

  .sidebar [data-module-panel="training"] {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    overflow: hidden;
  }

  .mobile-training-selectors {
    grid-template-columns: 1fr;
    gap: 9px;
    padding: 11px;
    border: 1px solid var(--nav-line);
    border-radius: 8px;
    background: var(--nav-soft);
  }

  .mobile-training-selectors label {
    gap: 4px;
    color: var(--nav-muted);
    font-size: 11px;
  }

  .mobile-training-selectors select {
    height: 42px;
    border-color: rgba(196, 213, 230, 0.24);
    background: #213544;
    color: var(--nav-text);
    font-weight: 800;
  }

  .sidebar [data-module-panel="training"] > *,
  .sidebar [data-module-panel="training"] .side-section,
  .template-filter,
  .student-list {
    width: 100%;
    min-width: 0;
  }

  .sidebar [data-module-panel].hidden {
    display: none !important;
  }

  .sidebar > .side-section.compact.admin-only {
    display: none !important;
  }

  .sidebar [data-module-panel="system"] {
    display: none !important;
  }

  .desktop-training-selector {
    display: none !important;
  }

  .sidebar [data-module-panel="training"] .side-section {
    margin-top: 0;
  }

  .sidebar [data-module-panel="training"] > .primary {
    margin-top: 0;
  }

  .sidebar .button-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .module-tab,
  .template-chip,
  .student-item {
    min-height: 34px;
    padding: 8px 9px;
  }

  .sidebar .primary {
    min-height: 38px;
  }

  .main {
    padding: 14px 12px 18px;
  }

  .topbar,
  .panel-head,
  .top-actions,
  .filters {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    gap: 10px;
    margin-bottom: 10px;
  }

  .topbar h2 {
    font-size: 21px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .top-actions > * {
    width: 100%;
  }

  .top-actions > :only-child {
    grid-column: 1 / -1;
  }

  #pilotProfilePanel .panel-head {
    align-items: center;
    flex-direction: row;
  }

  #pilotProfilePanel .panel-head > div {
    min-width: 0;
  }

  #pilotProfilePanel .panel-head button {
    flex: 0 0 auto;
  }

  .subpage-nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    position: sticky;
    z-index: 20;
    top: 0;
    margin: 0 -12px 12px;
    padding: 8px 12px;
    border-width: 0 0 1px;
    border-radius: 0;
    background: rgba(238, 243, 247, 0.96);
    overflow: visible;
  }

  .subpage-tab {
    min-height: 40px;
    min-width: 0;
    width: 100%;
    padding: 8px 6px;
  }

  .metric-grid,
  .check-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .metric {
    padding: 12px;
  }

  .metric-value {
    font-size: 22px;
  }

  .category-grid,
  .form-grid,
  .form-grid.three,
  .form-grid.four,
  .course-editor-grid,
  .checklist-grid,
  .detail-grid,
  .account-card {
    grid-template-columns: 1fr;
  }

  .section-intro,
  .report-form-heading {
    align-items: stretch;
    flex-direction: column;
  }

  #dailyReportDialog {
    width: calc(100vw - 12px);
    max-height: calc(100dvh - 8px - env(safe-area-inset-top));
    margin: calc(4px + env(safe-area-inset-top)) auto 4px;
  }

  #dailyReportForm.dialog-card {
    max-height: calc(100dvh - 8px - env(safe-area-inset-top));
    padding: 12px;
  }

  #dailyReportForm .dialog-head.sticky {
    top: -12px;
    margin: -12px -12px 10px;
    padding: 12px;
  }

  #dailyReportForm .dialog-head h3 {
    font-size: 20px;
  }

  #dailyReportForm .report-form-section {
    display: none;
    margin-bottom: 10px;
    padding: 11px;
  }

  #dailyReportForm[data-step="1"] [data-report-step="1"],
  #dailyReportForm[data-step="2"] [data-report-step="2"] {
    display: block;
  }

  #dailyReportForm .report-form-heading {
    margin-bottom: 9px;
  }

  #dailyReportForm .form-grid {
    gap: 9px;
  }

  #dailyReportForm label {
    gap: 4px;
    font-size: 12px;
  }

  #dailyReportForm input,
  #dailyReportForm select {
    height: 40px;
  }

  #dailyReportForm .editable-select-toggle {
    height: 38px;
  }

  #dailyReportForm .dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    bottom: -12px;
    margin: 12px -12px -12px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  }

  #dailyReportForm .dialog-actions button {
    width: 100%;
    min-width: 0;
    min-height: 42px;
  }

  #dailyReportForm .dialog-actions {
    grid-template-columns: 1fr 1fr;
  }

  #dailyReportForm[data-step="1"] #dailyReportBackBtn,
  #dailyReportForm[data-step="1"] #dailyReportSubmitBtn,
  #dailyReportForm[data-step="2"] #dailyReportCancelBtn,
  #dailyReportForm[data-step="2"] #dailyReportNextBtn {
    display: none;
  }

  .operations-card-grid,
  .record-filter-bar {
    grid-template-columns: 1fr;
  }

  .flight-end-card {
    grid-template-columns: 1fr 1fr;
    padding-right: 48px;
  }

  .flight-end-data {
    grid-column: 1 / -1;
  }

  .flight-segment-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .flight-segment-row .segment-operation {
    grid-column: 1 / -1;
  }

  .structured-row .remove-structured-row {
    justify-self: end;
  }

  .software-update {
    grid-template-columns: 40px minmax(0, 1fr);
    align-items: start;
  }

  .software-update-icon {
    width: 40px;
    height: 40px;
  }

  .software-update .update-action {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 44px;
  }

  .check-row {
    grid-template-columns: 24px minmax(0, 1fr) 78px 32px;
    align-items: start;
  }

  .check-row input[type="checkbox"] {
    grid-row: 1 / span 2;
    margin-top: 8px;
  }

  .check-row input[type="text"] {
    grid-column: 2 / -1;
    width: 100%;
  }

  .check-row select {
    grid-column: 2 / 4;
    width: 100%;
  }

  .check-row .remove-item {
    grid-column: 4;
  }

  .stage-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .stage-hours {
    text-align: left;
  }

  .span-2,
  .span-3 {
    grid-column: span 1;
  }

  .file-preview-body,
  .file-preview-frame {
    min-height: 58vh;
    height: 58vh;
  }

  .file-preview-image {
    max-height: 58vh;
  }

  .file-preview-image-stage {
    min-height: 58vh;
    padding: 14px;
  }

  .profile-upload-card {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 9px;
  }

  .profile-upload-preview {
    grid-column: 2;
    width: 68px;
    height: 54px;
  }

  .profile-upload-actions {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .profile-upload-picker span {
    display: none;
  }

  .flight-table-wrap,
  .daily-report-table-wrap,
  #pilotProfilePanel .table-wrap,
  #proficiencyPanel .table-wrap {
    overflow-x: visible;
    border: 0;
  }

  .flight-table,
  .daily-report-table,
  .profile-table,
  .proficiency-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
    background: transparent;
  }

  .flight-table thead,
  .daily-report-table thead,
  .profile-table thead,
  .proficiency-table thead {
    display: none;
  }

  .flight-table tbody,
  .daily-report-table tbody,
  .profile-table tbody,
  .proficiency-table tbody {
    display: grid;
    gap: 10px;
  }

  .flight-table tr,
  .daily-report-table tr,
  .profile-table tr,
  .proficiency-table tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
  }

  .flight-table td,
  .daily-report-table td,
  .profile-table td,
  .proficiency-table td {
    min-width: 0;
    padding: 0;
    border-bottom: 0;
  }

  .flight-table td::before,
  .daily-report-table td::before,
  .profile-table td::before,
  .proficiency-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
  }

  .flight-table td:nth-child(1),
  .flight-table td:nth-child(2),
  .flight-table td:nth-child(5),
  .flight-table td:nth-child(8) {
    grid-column: 1 / -1;
  }

  .daily-report-table td:nth-child(1),
  .daily-report-table td:nth-child(7),
  .daily-report-table td:nth-child(8),
  .profile-table td:nth-child(1),
  .profile-table td:nth-child(2),
  .profile-table td:nth-child(6),
  .profile-table td:nth-child(7),
  .profile-table td:nth-child(8),
  .proficiency-table td:nth-child(1),
  .proficiency-table td:nth-child(6),
  .proficiency-table td:nth-child(7) {
    grid-column: 1 / -1;
  }

  .flight-table td:nth-child(2) strong {
    display: inline-block;
    margin-right: 6px;
  }

  .flight-table .table-actions,
  .daily-report-table .table-actions,
  .profile-table .table-actions,
  .proficiency-table .table-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding-top: 4px;
  }

  .flight-table .table-actions::before,
  .daily-report-table .table-actions::before,
  .profile-table .table-actions::before,
  .proficiency-table .table-actions::before {
    display: none;
  }

  .flight-table .table-actions button,
  .daily-report-table .table-actions button,
  .profile-table .table-actions button,
  .proficiency-table .table-actions button {
    width: 100%;
    min-height: 38px;
  }

  .flight-table .danger-link,
  .daily-report-table .danger-link,
  .profile-table .danger-link,
  .proficiency-table .danger-link {
    border: 1px solid #f2c8c2;
    border-radius: 8px;
    background: #fff7f6;
  }

  .profile-table {
    table-layout: auto;
  }

  .profile-table tr {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px 16px;
    padding: 16px;
  }

  .profile-table td {
    padding: 0;
  }

  .profile-table td::before {
    margin-bottom: 6px;
    font-size: 12px;
    white-space: nowrap;
  }

  .profile-table .profile-name-cell {
    border-bottom: 1px solid var(--line);
    padding-bottom: 10px;
  }

  .profile-table .profile-name-link {
    font-size: 17px;
    min-height: 32px;
  }

  .profile-table .profile-contact-cell > .muted {
    display: none;
  }

  .profile-table .profile-file-link {
    min-height: 36px;
  }
}

@media (max-width: 460px) {
  .module-nav {
    display: flex;
  }

  .metric-grid,
  .check-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .flight-end-card {
    grid-template-columns: 1fr;
  }

  .flight-end-data {
    grid-column: 1;
  }

  .flight-segment-row {
    position: relative;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .flight-segment-row .segment-operation {
    grid-column: 1 / -1;
    padding-right: 38px;
  }

  .flight-segment-row .remove-structured-row {
    position: absolute;
    top: 9px;
    right: 9px;
  }

  .operations-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  #flightForm.dialog-card {
    padding: 12px;
  }

  #flightForm .dialog-head.sticky {
    top: -12px;
    margin: -12px -12px 10px;
    padding: 12px;
  }

  #flightForm .form-grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  #flightForm .span-3 {
    grid-column: 1 / -1;
  }

  #flightForm label {
    gap: 4px;
    font-size: 13px;
  }

  #flightForm input,
  #flightForm select {
    height: 34px;
    padding: 5px 8px;
  }

  #flightForm textarea {
    min-height: 72px;
  }

  #flightForm .dialog-actions {
    bottom: -12px;
    margin: 12px -12px -12px;
    padding: 10px 12px 12px;
  }
}

.task-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); border:1px solid #d9e0e7; background:#fff; margin-bottom:16px; }
.task-summary div { padding:16px 18px; border-right:1px solid #e5e9ee; display:flex; flex-direction:column; gap:5px; }
.task-summary div:last-child { border-right:0; }
.task-summary span { color:#66717d; font-size:13px; }
.task-summary strong { font-size:24px; color:#152332; }
.task-book-list { display:flex; flex-direction:column; }
.task-book-filter-bar,.task-book-batch-bar { display:flex; align-items:end; gap:12px; flex-wrap:wrap; padding:12px 0; }
.task-book-filter-bar label { display:grid; gap:5px; color:#66717d; font-size:12px; }
.task-book-filter-bar input,.task-book-filter-bar select { min-width:150px; height:36px; }
.task-book-batch-bar { align-items:center; border-top:1px solid #e5e9ee; border-bottom:1px solid #e5e9ee; margin-bottom:4px; }
.task-book-batch-bar > span { color:#66717d; font-size:13px; margin-right:auto; }
.task-book-row { width:100%; border-bottom:1px solid #e5e9ee; background:#fff; padding:0 4px; display:flex; align-items:center; color:#172331; }
.task-book-row-actions { display:flex; align-items:center; gap:3px; padding:0 4px 0 8px; }
.task-book-row-actions .icon-button { width:34px; height:34px; }
.task-book-row-actions .icon-button.danger { color:#b33b35; }
.task-book-open { flex:1; border:0; background:transparent; padding:15px 0; display:flex; justify-content:space-between; align-items:center; text-align:left; color:#172331; border-radius:0; }
.task-book-check { display:grid; place-items:center; width:38px; }
.task-book-check input { width:18px; height:18px; }
.task-book-row:hover { background:#f7f9fa; }
.task-reminder-dot { position:relative; width:9px; height:9px; flex:0 0 9px; margin-left:auto; border-radius:50%; background:#c43d36; box-shadow:0 0 0 3px #fbe9e8; }
.task-reminder-dot::after { content:attr(data-count); position:absolute; margin:-7px 0 0 8px; min-width:15px; height:15px; padding:0 3px; border-radius:8px; background:#c43d36; color:#fff; font-size:10px; line-height:15px; text-align:center; }
.task-book-open > div { display:flex; align-items:center; gap:12px; min-width:0; }
.task-book-open > div:first-child { flex-direction:column; align-items:flex-start; gap:3px; }
.task-book-open span { color:#687481; font-size:13px; }
.task-book-dialog { width:min(1060px,96vw); }
.task-book-card { width:100%; max-width:none; height:min(860px,calc(100dvh - 16px)); max-height:calc(100dvh - 16px); padding:0; overflow:clip; overscroll-behavior:none; display:flex; flex-direction:column; }
.task-book-card > .dialog-head { position:relative; top:auto; flex:0 0 auto; margin:0; padding:18px 22px; }
.task-book-card > .dialog-head > div { min-width:0; overflow-wrap:anywhere; }
.task-book-card > .dialog-head > .icon-button { flex:0 0 48px; width:48px; height:48px; touch-action:manipulation; }
.task-book-close-bottom { display:none; }
.task-stepper { display:grid; grid-template-columns:repeat(8,minmax(72px,1fr)); border-top:1px solid #e4e9ee; border-bottom:1px solid #e4e9ee; overflow-x:auto; background:#f7f9fa; }
.task-stepper button { border:0; border-right:1px solid #e4e9ee; border-radius:0; background:transparent; color:#66717d; padding:10px 6px; min-height:62px; display:flex; flex-direction:column; align-items:center; gap:4px; }
.task-stepper button span { display:grid; place-items:center; width:22px; height:22px; border-radius:50%; background:#e1e7ec; font-size:12px; }
.task-stepper button small { white-space:nowrap; font-size:11px; }
.task-stepper button.active { background:#fff; color:#0a5c72; box-shadow:inset 0 -3px #0a7088; }
.task-stepper button.active span { background:#0a7088; color:#fff; }
.task-book-page { padding:22px 22px 40px; overflow-y:auto; overscroll-behavior:contain; scroll-padding-bottom:32px; flex:1; min-height:0; background:#fff; }
.task-original-head { margin:0 0 18px; padding:0 0 14px; border-bottom:2px solid #273642; text-align:center; }
.task-original-head > span { display:block; color:#3d4b55; font-size:14px; font-weight:700; }
.task-original-head h4 { margin:5px 0 12px; font-size:20px; color:#17242d; }
.task-original-head h4:has(> span) { display:flex; justify-content:space-around; gap:20px; }
.task-original-head > div { display:flex; flex-wrap:wrap; justify-content:center; gap:8px 18px; color:#4e5d67; font-size:13px; }
.task-fixed-notes { margin-top:16px; padding:14px 0; border-top:1px solid #cfd8de; border-bottom:1px solid #cfd8de; }
.task-fixed-notes > strong { display:block; margin-bottom:8px; color:#1e2c35; }
.task-fixed-notes ol { margin:0; padding-left:24px; display:grid; gap:7px; color:#37454f; line-height:1.65; }
.task-fixed-notes li.strong { font-weight:700; }
.task-original-signatures { margin-top:18px; display:grid; grid-template-columns:repeat(auto-fit,minmax(210px,1fr)); border-top:1px solid #cfd8de; border-bottom:1px solid #cfd8de; }
.task-original-signatures > div { min-height:76px; padding:14px; display:flex; flex-direction:column; gap:8px; border-right:1px solid #cfd8de; }
.task-original-signatures > div:last-child { border-right:0; }
.task-original-signatures span { color:#4f5d66; font-size:13px; }
.task-original-signatures strong { color:#1c2a33; }
.performance-block p { margin:8px 0; color:#485760; line-height:1.55; font-size:13px; }
.task-book-actions { position:relative; bottom:auto; flex:0 0 auto; margin:0; padding:14px 22px max(14px,env(safe-area-inset-bottom)); background:#fff; border-top:1px solid #e2e7ec; display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; z-index:1; }
.task-book-actions #taskBookSaveState { text-align:center; }
.task-page-toolbar,.task-segment-head,.task-total,.signature-status { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.task-column-groups { display:grid; grid-template-columns:1fr 1.4fr .8fr 1fr; gap:8px; margin:14px 0 8px; padding:10px 12px; background:#eef2f4; border:1px solid #d7e0e5; font-weight:700; color:#31414b; text-align:center; }
.task-form-section-title { margin:4px 0 0; padding:10px 0 7px; border-bottom:1px solid #ccd6dc; color:#1f2f39; font-size:15px; }
.task-check-table-head { display:grid; grid-template-columns:minmax(0,1fr) 150px 160px; gap:10px; padding:10px 12px; background:#eef2f4; border:1px solid #d7e0e5; font-weight:700; color:#31414b; }
.task-page-toolbar { margin-bottom:14px; }
.task-page-toolbar > div { display:flex; flex-direction:column; gap:2px; }
.task-page-toolbar span { color:#697582; font-size:13px; }
.task-check-actions { display:flex; justify-content:flex-end; margin:0 0 10px; }
.task-segment { border:1px solid #dfe5ea; padding:14px; margin-bottom:12px; background:#fbfcfd; }
.task-segment-head { margin-bottom:10px; }
.task-seat-crew { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.task-seat-crew fieldset { min-width:0; margin:0; padding:10px 0; border:0; border-top:1px solid #dce3e8; display:grid; grid-template-columns:minmax(90px,0.7fr) minmax(0,1fr); gap:10px; }
.task-seat-crew legend { padding:0 8px 0 0; font-size:15px; font-weight:700; }
.task-seat-crew label { min-width:0; }
.task-seat-crew input,.task-seat-crew select { width:100%; min-width:0; }
.task-segment-duration { text-align:right; color:#5c6875; margin-top:8px; }
.task-total { padding:14px 16px; background:#edf5f6; margin:14px 0; }
.task-total strong { font-size:19px; color:#075e71; }
.task-check-list { display:flex; flex-direction:column; border-top:1px solid #dde3e8; }
.task-subsection { border:1px solid #dce3e8; padding:14px; background:#fbfcfd; }
.task-subsection-head { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-bottom:12px; }
.task-subsection-head span { color:#697582; font-size:12px; }
#taskWeatherStatus, #taskMetarStatus { display:block; margin-top:4px; overflow-wrap:anywhere; }
.task-auto-field { align-content:start; }
.task-auto-value { display:flex; align-items:center; min-height:36px; padding:7px 10px; border:1px solid #cfd9df; border-radius:8px; background:#f2f6f8; color:#173746; font-weight:800; }
.task-multi-select { min-width:0; margin:0; padding:12px; border:1px solid #dce3e8; background:#fbfcfd; }
.task-multi-select legend { padding:0 4px; color:#263746; font-weight:800; }
.task-multi-options { display:flex; flex-wrap:wrap; gap:8px; }
.task-multi-option { display:flex; flex-direction:row; align-items:center; gap:7px; min-height:34px; margin:0; padding:6px 10px; border:1px solid #dce3e8; background:#fff; }
.task-multi-option input { width:17px; height:17px; margin:0; }
.task-option-admin-list { display:grid; gap:8px; margin-top:12px; }
.task-option-admin-row { display:grid; grid-template-columns:minmax(0,1fr) auto auto; align-items:center; gap:8px; min-height:42px; padding:7px 9px; border:1px solid #dce3e8; background:#fff; }
.task-option-admin-row span { overflow-wrap:anywhere; }
.task-option-admin-row em { color:#697582; font-size:12px; font-style:normal; }
.task-health-list { display:flex; flex-direction:column; gap:10px; }
.task-health-row { display:grid; grid-template-columns:28px repeat(4,minmax(0,1fr)); gap:10px; align-items:end; }
.task-health-row > span { display:grid; place-items:center; width:26px; height:34px; background:#e9eef2; font-weight:700; }
.task-health-signature { display:grid; gap:6px; min-width:0; }
.task-health-signature > span { font-size:14px; font-weight:600; }
.task-health-signature > img { width:100%; height:46px; object-fit:contain; background:#fff; }
.task-health-signature-actions { display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.task-health-signature-actions button { min-height:40px; }
.task-check-list.compact { border:0; display:grid; grid-template-columns:1fr 1fr; gap:8px 14px; margin-bottom:12px; }
.task-check-line { display:flex; flex-direction:row; align-items:flex-start; gap:8px; padding:8px; margin:0; border:1px solid #e2e7eb; background:#fff; }
.task-check-line input { width:18px; height:18px; flex:0 0 auto; }
.task-seat-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.task-seat-grid section { border:1px solid #dce3e8; padding:12px; background:#fbfcfd; display:grid; gap:10px; }
.performance-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.performance-shared-limit { border:1px solid #d6e0e6; background:#f8fafb; padding:16px; }
.performance-limit-head { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; padding-bottom:14px; border-bottom:1px solid #dfe6ea; }
.performance-limit-head strong { display:block; color:#172a37; font-size:17px; }
.performance-limit-head p { margin:6px 0 0; color:#52616b; font-size:14px; line-height:1.5; }
.performance-limit-toggle { display:flex; flex-direction:row; align-items:center; gap:8px; margin:0; padding:8px 12px; border:1px solid #c8d4db; background:#fff; white-space:nowrap; font-weight:700; }
.performance-limit-toggle input { width:20px; height:20px; flex:0 0 20px; margin:0; }
.performance-limit-fields { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:14px; }
.performance-aircraft { border:1px solid #d8e0e6; background:#fbfcfd; }
.performance-aircraft h4 { margin:0; padding:12px; background:#e9f1f3; color:#075e71; }
.performance-block { padding:12px; border-top:1px solid #e0e6ea; display:grid; gap:9px; }
.performance-block .inline-check { flex-direction:row; align-items:center; font-weight:700; }
.performance-block .inline-check input { width:18px; height:18px; }
.task-check-item { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:16px; padding:11px 4px; border-bottom:1px solid #e4e9ed; align-items:center; }
.task-check-item > div:first-child { display:flex; flex-direction:column; gap:7px; }
.task-check-item input[type="text"] { min-height:34px; }
.segmented { display:flex; border:1px solid #cbd4dc; }
.segmented label { margin:0; }
.segmented input { position:absolute; opacity:0; width:1px; height:1px; pointer-events:none; }
.segmented span { display:block; padding:8px 14px; border-right:1px solid #cbd4dc; cursor:pointer; }
.segmented label:last-child span { border-right:0; }
.segmented input:checked + span { background:#0a7088; color:#fff; }
.signature-flow { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:20px; }
.signature-flow.single { grid-template-columns:1fr; }
.signature-status { border:1px solid #dce3e8; padding:14px; flex-wrap:wrap; }
.signature-status strong { flex:1; min-width:150px; }
.task-final-actions { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:10px; margin-top:18px; }
.signature-dialog { width:min(980px,96vw); height:min(600px,calc(100dvh - 24px)); max-height:calc(100dvh - 24px); }
.signature-dialog.dialog-fallback-open { position:fixed; inset:0; z-index:1000; margin:auto; }
.signature-card { --signature-rotated:0; width:100%; height:100%; max-width:none; max-height:none; display:grid; grid-template-rows:auto minmax(0,1fr) auto; gap:10px; overflow:hidden; }
.signature-card > .dialog-head { margin:0; gap:12px; }
.signature-card > .dialog-head h3 { font-size:18px; line-height:1.35; margin:0; }
.signature-card > .dialog-head .icon-button { width:44px; height:44px; flex:0 0 44px; }
.signature-canvas-area { display:flex; justify-content:center; align-items:center; min-width:0; min-height:0; padding:3px; overflow:hidden; }
#signatureCanvas { display:block; flex:none; width:100%; height:auto; border:0; outline:2px dashed #aeb9c3; background:#fff; touch-action:none; user-select:none; -webkit-user-select:none; }
.signature-card > .dialog-actions { position:static; margin:0; padding:8px 0 0; gap:12px; }
.signature-card > .dialog-actions button { min-height:44px; }
@media (max-width:760px), (max-height:500px) {
  .signature-dialog, .signature-dialog.dialog-fallback-open { position:fixed; inset:0; width:100vw; height:100dvh; max-width:none; max-height:none; margin:0; border-radius:0; }
  .signature-card { padding:10px max(16px,env(safe-area-inset-right,0px)) max(10px,env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px)); }
}
@media (max-width:760px) and (orientation:portrait) {
  .signature-card { --signature-rotated:1; position:absolute; left:50%; top:50%; width:100dvh; height:100vw; transform:translate(-50%,-50%) rotate(90deg); padding:10px max(16px,env(safe-area-inset-bottom,0px)) 10px max(28px,env(safe-area-inset-top,0px)); }
}
.danger { color:#a32929; border-color:#d8aaaa; }

@media (max-width: 760px) {
  .task-summary { grid-template-columns:repeat(3,1fr); }
  .task-summary div { padding:10px; }
  .task-summary strong { font-size:20px; }
  .task-book-row { align-items:flex-start; gap:4px; }
  .task-book-open { align-items:flex-start; gap:8px; }
  .task-book-open > div:last-child { flex-wrap:wrap; justify-content:flex-end; }
  .task-book-filter-bar { display:grid; grid-template-columns:1fr 1fr; align-items:end; }
  .task-book-filter-bar label:last-of-type { grid-column:1 / -1; }
  .task-book-filter-bar input,.task-book-filter-bar select { width:100%; min-width:0; }
  .task-book-batch-bar .primary,.task-book-batch-bar .danger { width:100%; }
  .task-book-dialog { width:100vw; max-width:none; height:100dvh; max-height:100dvh; margin:0; border-radius:0; }
  .task-book-card { height:100dvh; max-height:100dvh; border-radius:0; }
  .task-book-card > .dialog-head { gap:12px; padding:calc(12px + max(24px, env(safe-area-inset-top, 0px))) max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px)); }
  .task-book-card > .dialog-head > .icon-button { order:-1; }
  .task-book-card > .dialog-head > div { flex:1; }
  .task-book-card > .dialog-head h3 { font-size:18px; line-height:1.35; }
  .task-stepper { grid-template-columns:repeat(8,76px); }
  .task-stepper button small { display:none; }
  .task-book-page { padding:14px 14px 36px; }
  .task-original-head h4 { font-size:17px; }
  .task-original-head h4:has(> span) { flex-direction:column; gap:4px; }
  .task-original-head > div { justify-content:flex-start; text-align:left; }
  .task-original-signatures { grid-template-columns:1fr; }
  .task-original-signatures > div { border-right:0; border-bottom:1px solid #cfd8de; }
  .task-original-signatures > div:last-child { border-bottom:0; }
  .task-column-groups { grid-template-columns:1fr 1fr; text-align:left; }
  .task-check-table-head { grid-template-columns:1fr; gap:3px; }
  .task-book-page .form-grid { grid-template-columns:1fr; }
  .task-book-page .span-2 { grid-column:auto; }
  .task-seat-crew { grid-template-columns:1fr; }
  .task-check-item { grid-template-columns:1fr; gap:8px; }
  .task-health-row { grid-template-columns:28px 1fr; border-bottom:1px solid #dce3e8; padding-bottom:12px; }
  .task-health-row > label, .task-health-signature { grid-column:2; }
  .task-check-list.compact { grid-template-columns:1fr; }
  .task-seat-grid,.performance-grid { grid-template-columns:1fr; }
  .performance-limit-head { align-items:stretch; flex-direction:column; gap:12px; }
  .performance-limit-toggle { width:100%; justify-content:flex-start; }
  .performance-limit-fields { grid-template-columns:1fr; gap:10px; }
  .task-check-item .segmented { width:100%; }
  .task-check-item .segmented label { flex:1; text-align:center; }
  .signature-flow { grid-template-columns:1fr; }
  .task-book-actions { padding:8px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); grid-template-columns:repeat(3,minmax(0,1fr)); grid-template-areas:"status status status" "close prev next"; gap:8px; }
  .task-book-actions #taskBookSaveState { grid-area:status; font-size:11px; line-height:1.4; overflow-wrap:anywhere; }
  .task-book-actions #taskBookPrevBtn { grid-area:prev; }
  .task-book-actions #taskBookNextBtn { grid-area:next; }
  .task-book-actions > button { min-width:0; min-height:48px; padding:8px; gap:4px; touch-action:manipulation; }
  .task-book-close-bottom { grid-area:close; display:inline-flex; }
}

@media print {
  .sidebar,
  .top-actions,
  dialog,
  .filters,
  .danger-link {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .main {
    padding: 0;
  }

  .panel,
  .metric {
    box-shadow: none;
  }
}
/* Run ledger keeps dense records on desktop and stacked fields on phones. */
.operations-filters { display: grid; grid-template-columns: repeat(5,minmax(120px,1fr)) auto; align-items: end; gap: 12px; padding: 16px 0; }
.operations-filters button, [data-module-page="operations"] .top-actions button { display:flex; align-items:center; justify-content:center; gap:7px; }
.operations-status { font-size: 14px; color: #596570; padding: 8px 0 16px; }
.operations-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; border-block: 1px solid #dbe1e5; padding: 18px 0; margin-bottom: 18px; }
.operations-summary > div { display: grid; gap: 8px; }
.operations-summary span { font-size: 14px; color: #596570; }
.operations-summary strong { font-size: 23px; }
#taskDownloadDialog { width: min(440px, calc(100vw - 24px)); }
.task-download-card { width: 100%; }
#taskDownloadMessage, #taskFileHelp { overflow-wrap: anywhere; line-height: 1.6; }
#taskDownloadLink, #taskFilePreview { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; border-radius: 8px; text-decoration: none; }
#taskDownloadLink.hidden, #taskFilePreview.hidden { display: none; }
.task-download-card .dialog-actions { flex-wrap: wrap; gap: 10px; }
.task-download-card .dialog-actions > :not(.hidden) { flex: 1 1 auto; }
.operations-list { border-top: 1px solid #dbe1e5; }
.operations-record { width: 100%; display: grid; grid-template-columns: 1.2fr 1fr 1.5fr 1fr; gap: 16px; align-items: center; text-align: left; border: 0; border-bottom: 1px solid #dbe1e5; border-radius: 0; padding: 16px 8px; background: #fff; color: #202a32; font-size: 16px; font-weight: 400; }
.operations-record:hover { background: #f1f7f4; }
.operations-record span { min-width: 0; overflow-wrap: anywhere; }
.operations-record small { display: block; font-size: 13px; color: #596570; line-height: 1.7; }
.operations-record small svg { width: 14px; height: 14px; display: inline; vertical-align: middle; }
.operations-pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 0; }
.operations-date { max-width: 280px; margin-bottom: 18px; }
.operations-precheck { font-size: 14px; line-height: 1.7; padding: 12px 0; overflow-wrap: anywhere; }
.operations-pilot { border-bottom: 1px solid #dbe1e5; padding: 16px 0 24px; }
.operations-pilot header { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:10px; margin-bottom: 16px; }
.operations-pilot h3 { font-size: 19px; margin: 0; }
.operations-pilot header span { color: #596570; font-size: 14px; }
.operations-limit-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 20px; }
.operations-limit-grid > div { display: grid; gap: 7px; }
.operations-limit-grid strong { font-size: 20px; }
.operations-limit-grid small { font-size: 13px; font-weight: 400; }
.operations-limit-grid progress { width: 100%; height: 8px; accent-color: #297a56; }
.operations-alert, .operations-record .operations-alert { color: #966214; }
.operations-alert progress { accent-color: #b27b16; }
.operations-blocked { color: #b72c36; }
.operations-blocked progress { accent-color: #b72c36; }
.operations-detail { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 0 20px; }
.operations-detail > div { padding: 12px 0; border-bottom: 1px solid #e4e7e9; overflow-wrap: anywhere; }
.operations-detail dt { font-size: 13px; color: #596570; }
.operations-detail dd { margin: 6px 0 0; font-size: 16px; }
.operations-sources > div { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 12px 0; }
.operations-sources > p { font-size: 14px; line-height: 1.6; }
.operations-dialog { max-width: min(900px,calc(100vw - 24px)); max-height: 92dvh; overflow: auto; }
.operations-dialog .dialog-card { max-width: 100%; }
.operations-pilot summary { cursor: pointer; padding: 7px 0; }
.operations-period-filter { display:flex; align-items:end; flex-wrap:wrap; gap:12px; margin:18px 0 20px; padding:14px 16px; border:1px solid #dbe1e5; background:#f8fafb; }
.operations-period-filter label { display:grid; gap:5px; min-width:165px; }
.operations-period-filter label span, .operations-period-hint { color:#596570; font-size:13px; }
.operations-period-filter input { min-height:42px; }
.operations-period-hint { align-self:center; margin-left:auto; }
.pilot-aircraft-details { margin-top:16px; border-top:1px solid #dbe1e5; padding-top:4px; }
#pilotStats { align-items:start; }
.pilot-aircraft-details > summary, .pilot-flight-records > summary { display:flex; align-items:center; gap:8px; min-height:44px; cursor:pointer; list-style:none; padding:10px 0; color:#33424d; font-size:14px; font-weight:600; }
.pilot-aircraft-details summary::-webkit-details-marker { display:none; }
.pilot-aircraft-details summary > svg { width:18px; height:18px; flex-shrink:0; }
.pilot-aircraft-details[open] > summary > svg, .pilot-flight-records[open] > summary > svg { transform:rotate(90deg); }
.pilot-aircraft-details > summary strong { margin-left:auto; font-weight:600; color:#297a56; }
.pilot-flight-records > summary { font-size:13px; font-weight:400; }
.pilot-record-pagination, #pilotStatsPagination { display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:13px; }
.pilot-record-pagination { padding-top:10px; }
.pilot-record-pagination .icon-button, #pilotStatsPagination .icon-button { width:44px; height:44px; min-width:44px; flex-shrink:0; }
#pilotStatsPeriodFilter input, #pilotStatsPeriodFilter select { min-height:44px; }
.pilot-aircraft-breakdown { border-top:1px solid #edf0f2; padding-top:8px; }
.breakdown-title, .breakdown-row, .breakdown-total { display:flex; justify-content:space-between; gap:12px; padding:7px 0; }
.breakdown-title { color:#596570; font-size:13px; }
.breakdown-total { border-top:1px solid #e4e7e9; margin-top:4px; font-size:13px; }
.pilot-aircraft-item { border-bottom:1px solid #edf0f2; padding:3px 0 8px; }
.pilot-aircraft-item:last-of-type { border-bottom:0; }
.pilot-aircraft-item small { display:block; color:#596570; font-size:12px; padding-bottom:3px; }
.pilot-aircraft-record { display:flex; justify-content:space-between; gap:12px; padding:8px 0; border-bottom:1px solid #edf0f2; color:#596570; font-size:14px; }
.pilot-aircraft-record > span { min-width:0; overflow-wrap:anywhere; }
.pilot-aircraft-record > b { flex-shrink:0; white-space:nowrap; }
@media(max-width: 1100px) { .operations-filters { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media(max-width: 760px) {
  .module-nav { grid-template-columns: repeat(6,minmax(0,1fr)); }
  .module-nav .module-tab { min-width: 0; padding: 8px 2px; font-size: 11px; }
  .module-nav .module-tab > span:first-of-type { white-space: nowrap; }
  .operations-filters { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .operations-summary { gap: 12px; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .operations-record { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .operations-record > span:nth-child(even) { text-align: right; }
  .operations-limit-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; }
  .operations-detail { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .operations-period-filter { align-items:stretch; }
  .operations-period-filter label { min-width:calc(50% - 6px); flex:1 1 calc(50% - 6px); }
  .operations-period-filter button { flex:1 1 calc(50% - 6px); }
  .operations-period-hint { width:100%; margin-left:0; }
  .operations-pagination { font-size: 13px; }
}
