/* AeroLedger — plain CSS, function-first, calm aviation UI */
:root {
  --bg: #0c1118;
  --bg-elev: #151c27;
  --bg-soft: #1c2634;
  --border: #2a3648;
  --text: #e8eef7;
  --muted: #8b9bb0;
  --accent: #3d8bfd;
  --accent-2: #5eead4;
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 12px;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: radial-gradient(1200px 600px at 10% -10%, #1a2a44 0%, transparent 50%),
    radial-gradient(900px 500px at 100% 0%, #12352f 0%, transparent 45%),
    var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

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

.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.25rem 0 0.75rem;
}

.view {
  min-height: 100vh;
}

/* Auth */
.auth-view {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.site-copyright {
  margin: 1.25rem 0 0;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.4;
}

.auth-card .site-copyright {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.app-view {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-view .content {
  flex: 1 1 auto;
}

.site-footer {
  flex-shrink: 0;
  padding: 0.85rem 1.25rem 1.1rem;
  border-top: 1px solid var(--border);
  background: rgba(12, 17, 24, 0.6);
}

.site-footer .site-copyright {
  margin: 0;
}

.brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  margin-bottom: 1.25rem;
}

.brand h1 {
  margin: 0;
  font-size: 1.4rem;
}

.brand p {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, var(--accent), #1d4ed8);
  color: white;
}

.brand-sm .brand-mark {
  width: 34px;
  height: 34px;
  font-size: 0.8rem;
}

/* Topbar brand: logo + name, Donate under logo block */
.topbar .brand {
  margin-bottom: 0;
}

.brand-with-donate {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.brand-with-donate .brand-main {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.btn-donate-under-logo {
  align-self: stretch;
  justify-content: center;
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
  min-height: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 1rem;
}

.user-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 1rem;
  background: var(--bg);
  padding: 0.3rem;
  border-radius: 999px;
}

.auth-tabs.has-demo {
  grid-template-columns: 1fr 1fr 1fr;
}

.auth-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.5rem;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
}

.auth-tab.active {
  background: var(--bg-soft);
  color: var(--text);
}

.auth-tab-demo.active {
  background: #1d4ed8;
  color: #fff;
}

/* Layout app */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: rgba(12, 17, 24, 0.9);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1;
}

.nav-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.9rem;
}

.nav-btn:hover {
  color: var(--text);
  background: var(--bg-soft);
}

.nav-btn.active {
  color: var(--text);
  background: var(--bg-soft);
  border-color: var(--border);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

/* Top action buttons: pill/chip shape like main nav */
.topbar-actions .btn-chip {
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Glider PDF export options modal */
.export-opt-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
.export-opt-label {
  min-width: 4.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted, #9aa0a6);
}
.export-opt-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.export-opt.active,
.export-opt[data-active="1"] {
  background: var(--primary, #1e90ff);
  color: #fff;
  border-color: transparent;
}
.export-opt:disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

/* Module unlock / donation modal */
#modal-module-unlock .modal-head h3 {
  width: 100%;
  text-align: center;
}
#modal-module-unlock .module-unlock-body {
  text-align: center;
}
#modal-module-unlock .module-unlock-actions {
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
#modal-module-unlock .module-unlock-actions .btn-donate {
  /* same green donate styling as main page (.btn-donate) */
  text-decoration: none;
}

.content {
  /* Fill most of the viewport; soft cap only on ultra-wide monitors */
  width: 100%;
  max-width: min(1680px, 100%);
  margin: 0 auto;
  padding: 1.25rem 1.5rem 2rem;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.page-head h2 {
  margin: 0 0 0.25rem;
}

.page-head p {
  margin: 0;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

/* Profile / Modules forms: fixed readable width (not full canvas) */
.settings-panel-narrow {
  width: 100%;
  max-width: 520px;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0 0 0.75rem;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  cursor: pointer;
}

.choice input {
  margin-top: 0.2rem;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.stat {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 0.2rem;
}

/* Forms */
.stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.req-star {
  color: #f87171;
  font-weight: 700;
  margin-left: 0.15em;
}

input,
select,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Checkbox / radio stay content-sized */
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-width: 0;
}



.hours-row label {
  min-width: 0;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(61, 139, 253, 0.35);
  border-color: var(--accent);
}

input:disabled {
  opacity: 0.65;
}

.row-2,
.row-3,
.row-4 {
  display: grid;
  gap: 0.75rem;
}

.row-2 {
  grid-template-columns: 1fr 1fr;
}

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

.row-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 720px) {
  .row-2,
  .row-3,
  .row-4 {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions .btn {
    flex: 1;
  }
}

.btn {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 9px;
  padding: 0.5rem 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn:hover {
  filter: brightness(1.08);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #2563eb);
  border-color: transparent;
  color: #fff;
}

.btn-danger {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.35);
  background: transparent;
}

.btn-sm {
  padding: 0.25rem 0.55rem;
  font-size: 0.8rem;
}

.form-msg {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.9rem;
  color: var(--danger);
}

.form-msg.ok {
  color: var(--ok);
}

/* Tables */
.table-card {
  overflow-x: auto;
  padding: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

.data-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.2);
}

.data-table tr:last-child td {
  border-bottom: 0;
}

/* Logbook totals line under headers, then 5px gap before entries */
.data-table tr.totals-row td {
  font-weight: 700;
  background: var(--bg-soft);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.data-table tr.totals-row td:first-child {
  letter-spacing: 0.04em;
  color: var(--accent-2);
}

.data-table tr.totals-spacer td {
  height: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  line-height: 0;
  font-size: 0;
}

/* Logbook month separators (all modules) */
.data-table tr.month-separator td {
  padding: 0.55rem 0.8rem 0.35rem;
  border-bottom: 1px solid rgba(34, 211, 238, 0.45);
  background: transparent;
  white-space: nowrap;
}

.data-table tr.month-separator .month-label {
  color: #22d3ee;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* My Aircraft grouped by make/model */
.data-table tr.aircraft-group-header {
  cursor: pointer;
  user-select: none;
}

.data-table tr.aircraft-group-header td {
  background: rgba(0, 0, 0, 0.28);
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 0.8rem;
  font-weight: 400;
}

.data-table tr.aircraft-group-header td strong {
  font-weight: 400;
}

.data-table tr.aircraft-group-row.group-last td {
  border-bottom: 1px solid rgba(34, 211, 238, 0.45);
}

.data-table tr.aircraft-group-header:hover td {
  background: rgba(0, 0, 0, 0.38);
}

.data-table tr.aircraft-group-header .group-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
}

.data-table tr.aircraft-group-header .group-arrow {
  display: inline-block;
  width: 0.85rem;
  color: var(--muted);
  font-size: 0.75rem;
  transition: transform 0.15s ease;
}

.data-table tr.aircraft-group-header.expanded .group-arrow {
  transform: rotate(90deg);
}

.data-table tr.aircraft-group-header .group-count {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85rem;
}

.data-table tr.aircraft-group-row.hidden {
  display: none;
}

.aircraft-form-tabs {
  margin-bottom: 0.25rem;
}

/* Name PIC + Self button on one line */
.label-with-action {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.label-with-action input {
  flex: 1;
  min-width: 0;
}

#ac-tailnumbers {
  width: 100%;
  min-height: 6.5rem;
  resize: vertical;
}

.ac-skipped-list {
  font-weight: 600;
  word-break: break-word;
}

.btn-self-pic {
  flex-shrink: 0;
  white-space: nowrap;
  padding: 0.35rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
}

.admin-log-detail .btn {
  margin-left: 0.35rem;
  vertical-align: middle;
}

/* Admin logs: clickable rows + unread highlight */
.data-table tr.admin-log-clickable {
  cursor: pointer;
}

.data-table tr.admin-log-clickable:hover td {
  background: rgba(255, 255, 255, 0.04);
}

.data-table tr.admin-log-unread td {
  background: rgba(251, 191, 36, 0.12);
  font-weight: 600;
}

.data-table tr.admin-log-unread:hover td {
  background: rgba(251, 191, 36, 0.18);
}

.log-unread-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #f59e0b;
  margin-right: 0.25rem;
  vertical-align: middle;
}

/* Quick log steppers (− value +) */
.stepper-field {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.stepper-field input[type="number"] {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
}

.stepper-btn {
  min-width: 2.4rem;
  min-height: 2.4rem;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0.25rem 0.5rem;
}

/* Add Multiple / Add Single next to Tailnumber — Quick-style, green */
.badge-ac-multi {
  background: rgba(74, 222, 128, 0.18);
  border: 1px solid rgba(74, 222, 128, 0.45);
  color: #86efac;
  font-size: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-left: 0.25rem;
  padding: 0.05em 0.4em;
  border-radius: 4px;
  line-height: 1.25;
  cursor: pointer;
  vertical-align: middle;
  white-space: nowrap;
}

.badge-ac-multi:hover {
  background: rgba(74, 222, 128, 0.28);
}

/* Verified next to City label — same look as Add Multiple, not clickable */
.badge-verified {
  background: rgba(74, 222, 128, 0.18);
  border: 1px solid rgba(74, 222, 128, 0.45);
  color: #86efac;
  font-size: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-left: 0.25rem;
  padding: 0.05em 0.4em;
  border-radius: 4px;
  line-height: 1.25;
  vertical-align: middle;
  white-space: nowrap;
  cursor: default;
}

.icao-caps {
  text-transform: uppercase;
}

.app-dialog-msg {
  margin: 0;
  white-space: pre-line;
  line-height: 1.45;
}

/* Quick log badge in logbook */
.badge-pending {
  background: rgba(251, 191, 36, 0.2);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fbbf24;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.badge-quick {
  background: rgba(251, 191, 36, 0.2);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fbbf24;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-left: 0.35rem;
  vertical-align: middle;
  cursor: pointer;
}

#btn-admin-ac-toggle-filters.active {
  background: var(--bg-elev);
  border-color: var(--accent, #60a5fa);
  color: var(--text);
}

#admin-log-filters .chip {
  position: relative;
}

.row-city-verify {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0.75rem;
  align-items: end;
}

.row-city-verify .city-field {
  min-width: 0;
}

.row-city-verify .verify-field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.row-city-verify .label-spacer {
  display: block;
  font-size: 0.85rem;
  line-height: 1.2;
  margin-bottom: 0.35rem;
  visibility: hidden;
}

.profile-verify-row {
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.4rem;
}

@media (max-width: 720px) {
  .row-city-verify {
    grid-template-columns: 1fr;
  }
  .row-city-verify .label-spacer {
    display: none;
  }
}

.empty {
  padding: 1rem 1.1rem;
  margin: 0;
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--bg-soft);
  border: 1px solid var(--border);
}

.badge-vfr {
  background: rgba(74, 222, 128, 0.18);
  color: #86efac;
  border: 1px solid rgba(74, 222, 128, 0.35);
}

.badge-ifr {
  color: var(--accent-2);
  border-color: rgba(94, 234, 212, 0.35);
}

/* Settings */
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.chip {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
}

.chip.active {
  background: var(--bg-elev);
  color: var(--text);
}

.module-grid {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1rem;
}

.module-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.module-item label {
  flex-direction: row;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-size: 0.95rem;
}

.module-purchase-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

.badge-mod {
  display: inline-block;
  margin-left: 0.45rem;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

.badge-mod.free {
  background: rgba(74, 222, 128, 0.15);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.35);
}

.badge-mod.owned {
  background: rgba(61, 139, 253, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(61, 139, 253, 0.35);
}

.badge-mod.soon {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.35);
  white-space: nowrap;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 14, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

/* Helper / nested modals over an already-open form (e.g. To UTC on Log flight) */
.modal.modal-stack {
  z-index: 130;
}

.modal-panel {
  width: 100%;
  max-width: 440px;
  max-height: 92vh;
  overflow: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

/* Admin contact card */
.contact-card-panel {
  max-width: 420px;
}

.contact-card {
  padding-top: 0.25rem;
}

.contact-card-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.contact-avatar {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #1d4ed8);
  flex-shrink: 0;
}

.contact-card-title {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.contact-card-title strong {
  font-size: 1.15rem;
  line-height: 1.25;
}

.contact-rows {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.contact-row {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.5rem 0.75rem;
  align-items: start;
}

.contact-row-block {
  align-items: start;
}

.contact-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  padding-top: 0.15rem;
}

.contact-value {
  color: var(--text);
  word-break: break-word;
}

a.contact-value {
  color: var(--accent);
  text-decoration: none;
}

a.contact-value:hover {
  text-decoration: underline;
}

.contact-address {
  white-space: pre-line;
  line-height: 1.4;
}

.modal-wide {
  max-width: 640px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  margin: 0;
  font-size: 1.05rem;
}

.modal-body {
  padding: 1rem;
}

.icon-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
}

.module-pick {
  display: grid;
  gap: 0.45rem;
}

.module-pick button {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  cursor: pointer;
  font-weight: 600;
}

.module-pick button.selected,
.module-pick button:hover {
  border-color: var(--accent);
  background: rgba(61, 139, 253, 0.12);
}

.rules-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.btn-rule {
  padding: 0.75rem 0.5rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.section-title {
  margin: 1.25rem 0 0.6rem;
  font-size: 0.95rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.placard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
  align-items: stretch;
}

.placard {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 100%;
}

.placard-footer {
  margin-top: auto;
  padding-top: 0.75rem;
}

textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  resize: vertical;
  min-height: 5rem;
  width: 100%;
}

.placard header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.placard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  justify-content: flex-end;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.rating-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.rating-actions {
  display: flex;
  gap: 0.3rem;
}

.placard-ratings ul {
  list-style: none;
  padding-left: 0;
}

.btn-icon-x {
  border: 1px solid rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.12);
  color: var(--danger);
  border-radius: 8px;
  width: 1.75rem;
  height: 1.75rem;
  line-height: 1;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.btn-icon-x:hover {
  background: rgba(248, 113, 113, 0.25);
}

.btn-icon-u {
  border: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text);
  border-radius: 8px;
  width: 1.75rem;
  height: 1.75rem;
  line-height: 1;
  font-size: 0.78rem;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.btn-icon-u:hover {
  border-color: var(--accent);
  background: rgba(61, 139, 253, 0.14);
}

button.badge-quick {
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

#ac-details.locked-look {
  opacity: 0.95;
}

.rules-label {
  grid-column: 1 / -1;
  margin: 0;
}

#rules-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

#rules-row.hidden {
  display: none !important;
}

.aircraft-field-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.aircraft-field-row select,
.aircraft-field-row input {
  flex: 1;
  min-width: 0;
}

.aircraft-field-row .btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.aircraft-field-label {
  /* label already flex column */
}

.aircraft-picker {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.combo {
  position: relative;
  flex: 1;
  min-width: 0;
}

.combo-model {
  flex: 1.35;
}

.combo-field {
  display: flex;
  align-items: stretch;
}

.combo-field input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: 0;
  width: 100%;
}

.combo-caret {
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: var(--bg);
  color: var(--muted);
  padding: 0 0.6rem;
  cursor: pointer;
  font-size: 0.7rem;
  line-height: 1;
}

.combo-field:focus-within input,
.combo-field:focus-within .combo-caret {
  border-color: var(--accent);
}

.combo-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 3px);
  z-index: 80;
  max-height: 12.5rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}

.combo-list button,
.ac-tail-suggest-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  font: inherit;
}

.combo-list button:last-child,
.ac-tail-suggest-item:last-child {
  border-bottom: 0;
}

.combo-list button:hover,
.combo-list button.active,
.ac-tail-suggest-item:hover,
.ac-tail-suggest-item.active {
  background: rgba(61, 139, 253, 0.14);
}

.airport-field {
  position: relative;
  display: block;
  width: 100%;
}

.airport-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 3px);
  z-index: 80;
  max-height: 12.5rem;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  box-shadow: var(--shadow);
}

.airport-list button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0.4rem 0.65rem;
  cursor: pointer;
  font: inherit;
  text-transform: none;
}

.airport-list button:last-child {
  border-bottom: 0;
}

.airport-list button:hover,
.airport-list button.active {
  background: rgba(61, 139, 253, 0.14);
}

.flight-flags-row {
  align-items: start;
}

.xc-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  min-width: 0;
}

.flight-dist-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.flight-dist-row .info-tip {
  margin-left: 0;
}

.flight-dist-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

#admin-aircraft:not(.admin-ac-selecting) .admin-ac-pick {
  display: none;
}

.admin-ac-pick {
  display: inline-flex;
  align-items: center;
  margin-right: 0.4rem;
  vertical-align: middle;
}

.admin-ac-pick input {
  margin: 0;
  width: auto;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0.25rem 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Flight form IFR */
.ifr-mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ifr-mode-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.approach-block {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.15);
}

.approach-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
}

.approach-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 0.5rem;
  align-items: end;
}

.approach-actions {
  display: flex;
  align-items: center;
  min-height: 2.4rem;
}

.approach-actions .btn {
  min-width: 2.4rem;
  font-size: 1.1rem;
  font-weight: 700;
}

@media (max-width: 720px) {
  .approach-row {
    grid-template-columns: 1fr;
  }
}

.btn-amber {
  background: linear-gradient(135deg, #d97706, #b45309);
  border-color: transparent;
  color: #fff;
  font-weight: 700;
}

.btn-amber:hover {
  filter: brightness(1.08);
}

.btn-danger-solid {
  background: #b91c1c;
  border-color: #991b1b;
  color: #fff;
}

.btn-danger-solid:hover {
  filter: brightness(1.08);
}

.danger-banner {
  margin: 0;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid #f87171;
  background: rgba(185, 28, 28, 0.2);
  color: #fecaca;
  font-weight: 600;
  line-height: 1.45;
}

.due-panel {
  margin-bottom: 1.25rem;
}

.due-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.due-item {
  display: grid;
  grid-template-columns: 5.5rem 1fr auto auto;
  gap: 0.5rem 0.75rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.9rem;
}

/* Due within 3 months (30–90 days) */
.due-item.due-amber {
  border-color: rgba(251, 191, 36, 0.5);
  background: rgba(180, 120, 20, 0.16);
  color: #fde68a;
}

/* Due within 1 month or overdue */
.due-item.due-urgent {
  border-color: rgba(248, 113, 113, 0.55);
  background: rgba(185, 28, 28, 0.18);
  color: #fecaca;
}

.due-kind {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.due-item.due-amber .due-kind {
  color: #fcd34d;
}

.due-item.due-urgent .due-kind {
  color: #fca5a5;
}

.due-title {
  font-weight: 600;
}

.due-date,
.due-when {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.due-item.due-amber .due-date,
.due-item.due-amber .due-when {
  color: #fde68a;
  font-weight: 600;
}

.due-item.due-urgent .due-date,
.due-item.due-urgent .due-when {
  color: #fecaca;
  font-weight: 600;
}

.due-item.due-link {
  grid-template-columns: 1fr auto;
}

@media (max-width: 720px) {
  .due-item {
    grid-template-columns: 1fr 1fr;
  }
}

.admin-entitlements {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.5rem;
}

.admin-ent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.mod-cell {
  font-size: 0.8rem;
  max-width: 12rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.placard h4 {
  margin: 0.15rem 0 0;
  font-size: 1.05rem;
}

.placard-kicker {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-2);
  font-weight: 700;
}

.placard-medical .placard-kicker {
  color: #fbbf24;
}

.placard-meta,
.placard-dates {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.placard-ratings ul {
  margin: 0.25rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.85rem;
}

.small {
  font-size: 0.82rem;
}

.ok-text {
  color: var(--ok) !important;
}

.address-matches {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 200px;
  overflow: auto;
}

.address-match {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  font-size: 0.85rem;
}

.address-match:hover {
  border-color: var(--accent);
}

.category-pick {
  display: grid;
  gap: 0.45rem;
}

.category-pick button {
  text-align: left;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  font-weight: 600;
}

.category-pick button:hover {
  border-color: var(--accent);
  background: rgba(61, 139, 253, 0.12);
}

label.check {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  color: var(--text);
  font-size: 0.9rem;
}

label.check input {
  width: auto;
}

.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  font-size: 0.68rem;
  font-weight: 700;
  font-style: italic;
  line-height: 1;
  color: var(--bg);
  background: var(--muted);
  cursor: help;
  flex-shrink: 0;
  user-select: none;
}

.info-tip:hover,
.info-tip:focus {
  background: var(--accent);
  color: #fff;
  outline: none;
}

.panel-divider {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0 1rem;
}

/* Major update 0.3 — layout helpers */
.modules-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  align-items: start;
}

.badge-mod.available {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
  border: 1px solid rgba(34, 197, 94, 0.4);
}

.btn-available {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.5);
  color: #86efac;
  font-weight: 700;
}

.btn-available:hover {
  filter: brightness(1.1);
}

.btn-donate {
  background: linear-gradient(135deg, #16a34a, #15803d);
  border-color: transparent;
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.btn-donate:hover {
  filter: brightness(1.08);
  color: #fff;
}

.stat-action {
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-totals-popup {
  width: 100%;
  white-space: normal;
  line-height: 1.25;
  min-height: 3rem;
}

.time-with-local {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.local-check {
  flex-direction: row !important;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.check-inline {
  flex-direction: row !important;
  align-items: center;
  gap: 0.45rem;
}

.xc-with-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.xc-with-info .info-tip {
  margin-left: 0;
}

.counter-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.counter-row input {
  width: 4.5rem;
  text-align: center;
}

.label-with-info {
  position: relative;
}

.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15rem;
  height: 1.15rem;
  margin-left: 0.35rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  font-style: italic;
  cursor: pointer;
  vertical-align: middle;
  padding: 0;
  line-height: 1;
}

.info-tip:hover {
  color: var(--text);
  border-color: var(--accent, #60a5fa);
}

.approach-row-follow label {
  /* labels visually hidden but keep layout for selects */
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.approach-row-follow {
  /* no visible label text on follow-up lines */
}

.approach-row-follow label.sr-only {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

.approach-row-follow label.sr-only {
  font-size: 0;
  line-height: 0;
  color: transparent;
}

.approach-row-follow label.sr-only select {
  font-size: 0.95rem;
  line-height: normal;
  color: var(--text);
  width: 100%;
}

/* v0.4 layout */
.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 1rem;
}

.row-dep-time {
  display: grid;
  grid-template-columns: 1fr 0.7fr auto;
  gap: 0.65rem;
  align-items: end;
}

.local-check-inline {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  padding-bottom: 0.45rem;
  white-space: nowrap;
}

.local-check-spacer {
  min-width: 7rem;
}

@media (max-width: 720px) {
  .row-dep-time {
    grid-template-columns: 1fr;
  }
  .local-check-spacer {
    display: none;
  }
  .checkbox-grid {
    grid-template-columns: 1fr;
  }
}

/* Soft green donate (legacy / secondary contexts) — topbar uses solid gradient above */
.topbar-actions .btn-donate {
  background: linear-gradient(135deg, #16a34a, #15803d);
  border-color: transparent;
  color: #fff;
  font-weight: 700;
}

.topbar-actions .btn-donate:hover {
  filter: brightness(1.08);
  color: #fff;
}

.label-with-info .label-text {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex-wrap: wrap;
}

.label-with-info .info-tip {
  flex-shrink: 0;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
}

.filter-field {
  font-size: 0.85rem;
}

.logbook-filters {
  margin-bottom: 0.75rem;
  padding: 0.75rem 1rem;
}

.my-totals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.totals-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  background: var(--bg);
}

.totals-card.grand-totals {
  grid-column: 1 / -1;
  border-color: rgba(96, 165, 250, 0.4);
}

.totals-card h4 {
  margin: 0 0 0.5rem;
}

#modal-module-totals .modal-panel.modal-wide {
  max-width: min(1100px, 96vw);
}

/* v0.4.1 */
.dep-arr-grid {
  display: grid;
  grid-template-columns: 1fr 0.85fr auto;
  gap: 0.55rem 0.75rem;
  align-items: end;
}

.dep-arr-grid .local-check-inline {
  align-self: end;
  padding-bottom: 0.4rem;
}

.row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1.2fr;
  gap: 0.65rem;
}

@media (max-width: 720px) {
  .dep-arr-grid {
    grid-template-columns: 1fr;
  }
  .row-3 {
    grid-template-columns: 1fr;
  }
}

.totals-pairs {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.totals-pair-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
}

.totals-pair-row-one {
  grid-template-columns: 1fr;
}

.totals-pair-cell-empty {
  border: none;
  background: transparent;
  min-height: 0;
  padding: 0;
}

.totals-pair-cell {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  min-height: 2.1rem;
}

.totals-pair-cell strong {
  text-align: right;
}

.logbook-filter-bar {
  margin: 0.35rem 0 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

#btn-toggle-filters.active {
  background: var(--bg-elev);
  border-color: var(--accent, #60a5fa);
  color: var(--text);
}

/* Glider: no Use Local Times column; equal 2-col so fields line up */
.dep-arr-grid.glider-times {
  grid-template-columns: 1fr 1fr;
}
#form-flight.glider-layout .row-2,
#form-flight.glider-layout .dep-arr-grid.glider-times {
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem 0.75rem;
}
.dep-arr-grid.glider-times .local-check-inline,
.dep-arr-grid.glider-times .to-utc-cell,
.dep-arr-grid.glider-times .local-check-spacer {
  display: none !important;
}

/* Third row of #dep-arr-grid: Departure date | Arrival date | empty */
#dep-arr-grid .dual-date-end-spacer {
  min-height: 0;
}

@media (max-width: 720px) {
  #dep-arr-grid .dual-date-end-spacer {
    display: none;
  }
}

.to-utc-cell {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  gap: 0.15rem;
  padding-bottom: 0.15rem;
  min-height: 2.4rem;
}

.to-utc-cell #btn-to-utc {
  align-self: stretch;
}

.to-utc-hint {
  display: block;
  font-size: 0.68rem;
  line-height: 1.2;
  text-align: center;
  letter-spacing: 0.02em;
}

.to-utc-hint.hidden {
  display: none;
}

.to-utc-cell .local-check-spacer {
  display: none;
}

#btn-to-utc:not(.hidden) + .local-check-spacer {
  display: none;
}

input.field-locked,
input[readonly].field-locked {
  opacity: 0.65;
  cursor: not-allowed;
  background: var(--bg-soft);
}

.to-utc-warning {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* Local environment banner */
.local-env-banner {
  position: sticky;
  top: 0;
  z-index: 10000;
  background: #ea580c;
  color: #fff;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.28rem 0.6rem;
  line-height: 1.25;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}
.local-env-banner.hidden {
  display: none !important;
}
body.has-local-banner .topbar {
  /* keep layout tight under sticky banner */
}

/* Demo / preview session banner */
.demo-env-banner {
  position: sticky;
  top: 0;
  z-index: 10001;
  background: #1d4ed8;
  color: #fff;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.32rem 0.6rem;
  line-height: 1.25;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}
body.has-local-banner .demo-env-banner {
  top: 1.5rem; /* sit under LOCAL banner when both show */
}
.demo-env-banner.hidden {
  display: none !important;
}

/* Stage 1: flight form Delete bottom left; info bubble for .info-tip (tap shows, any tap hides) */
.modal-actions .modal-actions-left { margin-right: auto; }
.info-bubble {
  position: fixed;
  z-index: 10000;
  padding: 0.5rem 0.65rem;
  border-radius: 4px;
  background: var(--t-panel, var(--bg-elev, #fff));
  color: var(--t-ink, var(--text, #222));
  border: 1px solid var(--t-line, var(--border, #ccc));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  font-size: 0.82rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.35;
  pointer-events: none;
}

/* Stage 1b/1d: Settings › Options holds the Options, Modules and Connections cards. Flex rows: side by side when they fit,
   wrapped/stacked otherwise. The Connections card is as wide as its table (1d); when even a full row is too narrow,
   the card stays full width and the table scrolls sideways inside it. */
.settings-panel.settings-cards:not(.hidden) {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-start;
}
.settings-cards > .card.settings-panel-narrow {
  flex: 1 1 18rem;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  box-sizing: border-box;
}
.settings-cards > #connections-card {
  flex: 1 1 auto;
  width: max-content;              /* basis = the table's width … */
  min-width: min(100%, 18rem);
}
.settings-cards > #connections-card > :not(#connections-list) {
  width: 0;                        /* … texts wrap to the card and do not widen it */
  min-width: 100%;
}
#connections-list {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
#connections-list .data-table { width: 100%; }

/* Stage 2: instructor sign-off */
.modal-actions { flex-wrap: wrap; }
.flight-left-actions { display: inline-flex; flex-wrap: wrap; gap: 0.5rem; }
.badge-signoff-pending { background: #fff4d6; color: #8a5a00; border: 1px solid #e8c36a; }
.badge-signed { background: #e3f6e8; color: #1e6b34; border: 1px solid #8fd0a1; }
.badge-rejected { background: #fde6e4; color: #b3261e; border: 1px solid #ef9a94; }
.signoff-row .signoff-cell { display: flex; flex-direction: column; gap: 0.3rem; }
.signoff-row label { font-size: 0.82rem; font-weight: 600; }
.signoff-row input[readonly] { background: var(--t-soft, #f3f3f3); }
#form-flight .signoff-row input#flight-signoff-name { font-size: 0.82rem; }
.signoff-status { margin: 0; font-size: 0.85rem; }
.signoff-signed { color: #1e6b34; font-weight: 600; }
.signoff-rejected { color: #b3261e; font-weight: 600; }
.signoff-pending { color: #8a5a00; font-weight: 600; }
html[data-theme="dark"] .signoff-signed { color: #7fd69a; }
html[data-theme="dark"] .signoff-rejected { color: #ff8a80; }
html[data-theme="dark"] .signoff-pending { color: #f0c36a; }
html[data-theme="dark"] .badge-signoff-pending { background: rgba(240,195,106,.15); color: #f0c36a; border-color: rgba(240,195,106,.4); }
html[data-theme="dark"] .badge-signed { background: rgba(127,214,154,.15); color: #7fd69a; border-color: rgba(127,214,154,.4); }
html[data-theme="dark"] .badge-rejected { background: rgba(255,138,128,.15); color: #ff8a80; border-color: rgba(255,138,128,.4); }
.due-signoff { cursor: pointer; }
.choice-item { display: flex; gap: 0.5rem; align-items: center; padding: 0.55rem 0.65rem; border: 1px solid var(--t-line, #ccc); border-radius: 4px; cursor: pointer; }
.choice-item:has(input:checked) { background: var(--t-accent-soft, rgba(61,139,253,.14)); border-color: var(--t-accent, #3d8bfd); }
.help-sub { margin: 1rem 0 0.25rem; font-size: 0.95rem; }
@media (max-width: 600px) {
  .signoff-row .signoff-row-spacer:not(:has(.signoff-left-note:not(:empty))) { display: none; }
  #modal-flight-form .modal-actions .btn { flex: 1 1 auto; }
  .flight-left-actions { width: 100%; }
}
/* Stage 2: keep the sign-off badge colours under the house theme (theme-ivan restyles .badge) */
html[data-theme="light"] .badge.badge-signoff-pending { background: #fff4d6; color: #8a5a00; border: 1px solid #e8c36a; }
html[data-theme="light"] .badge.badge-signed { background: #e3f6e8; color: #1e6b34; border: 1px solid #8fd0a1; }
html[data-theme="light"] .badge.badge-rejected { background: #fde6e4; color: #b3261e; border: 1px solid #ef9a94; }
html[data-theme="dark"] .badge.badge-signoff-pending { background: rgba(240,195,106,.15); color: #f0c36a; border: 1px solid rgba(240,195,106,.4); }
html[data-theme="dark"] .badge.badge-signed { background: rgba(127,214,154,.15); color: #7fd69a; border: 1px solid rgba(127,214,154,.4); }
html[data-theme="dark"] .badge.badge-rejected { background: rgba(255,138,128,.15); color: #ff8a80; border: 1px solid rgba(255,138,128,.4); }

/* Stage 2c */
.signoff-row .signoff-row-spacer { display: flex; flex-direction: column; justify-content: flex-end; }
.signoff-row .signoff-left-note { margin: 0 0 0.55rem; }
.signoff-row .signoff-left-note:empty { display: none; }
#app-dialog-actions.dialog-actions-stack { flex-direction: column; align-items: stretch; }
#app-dialog-actions.dialog-actions-stack .btn { width: 100%; margin: 0; }
.ok-toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translate(-50%, 1rem); z-index: 10000; max-width: calc(100vw - 2rem);
  padding: 0.7rem 1.1rem; border-radius: 8px; background: #1e7b3c; color: #fff; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.ok-toast.show { opacity: 1; transform: translate(-50%, 0); }
html[data-theme="dark"] .ok-toast { background: #2e9e55; }

/* Stage 2d */
.flight-review-note { margin: 0 0 0.4rem; padding: 0.55rem 0.8rem; border-radius: 6px; font-weight: 600;
  background: #fff4d6; color: #8a5a00; border: 1px solid #e8c36a; }
html[data-theme="dark"] .flight-review-note { background: rgba(240,195,106,.15); color: #f0c36a; border-color: rgba(240,195,106,.4); }
#flight-signoff-name:disabled { cursor: not-allowed; opacity: 1; }
/* Stage 2e: Instructor time box greyed like the Examiner/Instructor box while reviewing */
html[data-theme] #form-flight input[name="instructor_hours"].field-locked { background: var(--t-soft, #f3f3f3); cursor: not-allowed; }

/* Stage 3: glider Pilot function locked while the instructor reviews */
html[data-theme] #form-flight select#flight-glider-function.field-locked { background: var(--t-soft, #f3f3f3); cursor: not-allowed; opacity: 1; }

/* Stage 4: FSTD / ground trainer devices */
.combo-group-label { padding: 0.35rem 0.6rem 0.2rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted, #6b7280); cursor: default; }
html[data-theme] .badge.badge-sim { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; white-space: nowrap; }
html[data-theme="dark"] .badge.badge-sim { background: #312e81; color: #e0e7ff; border-color: #4338ca; }
#form-flight.fstd-mode #dep-arr-grid label:not(#flight-dep-time-label) .req-star,
#form-flight.fstd-mode #nonglider-fields .req-star,
#form-flight.fstd-mode #flight-pic-name-label .req-star { display: none; }
html[data-theme] #form-flight .fstd-locked { background: var(--t-soft, #eef0f3); opacity: 0.6; cursor: not-allowed; }
.aircraft-group-fstd td:nth-child(4) strong { letter-spacing: 0.01em; }
.btn-row { display: inline-flex; gap: 0.5rem; flex-wrap: wrap; }
#modal-fstd select option:disabled { color: #9ca3af; }
/* Stage 4b */
#fstd-lookup-note { margin: -0.35rem 0 0; }
#fstd-lookup-note.form-msg-error { color: #c0392b; }
html[data-theme="dark"] #fstd-lookup-note.form-msg-error { color: #f1948a; }

/* Stage 4c */
.data-table th.col-rules, .data-table td.col-rules { text-align: center; }
html[data-theme] .combo-group-label { color: var(--t-accent, #3d8bfd); }
/* Stage 4d: IFR and VFR/IFR in the VFR style — translucent tint with coloured letters */
html[data-theme] .badge.badge-ifr { background: rgba(30, 58, 138, 0.10); color: #1e3a8a; border: 1px solid rgba(30, 58, 138, 0.40); }
html[data-theme="dark"] .badge.badge-ifr { background: rgba(96, 165, 250, 0.14); color: #93c5fd; border-color: rgba(147, 197, 253, 0.45); }
html[data-theme] .badge.badge-vfrifr { background: rgba(124, 58, 237, 0.10); color: #7c3aed; border: 1px solid rgba(124, 58, 237, 0.40); }
html[data-theme="dark"] .badge.badge-vfrifr { background: rgba(167, 139, 250, 0.16); color: #c4b5fd; border-color: rgba(196, 181, 253, 0.45); }

/* Stage 4f: TOTAL column — SIM label sits before the time; the number stays in line with normal rows */
td.col-total { white-space: nowrap; }
td.col-total .total-num { position: relative; display: inline-block; }
td.col-total .total-sim { position: absolute; right: calc(100% + 4px); top: 50%; transform: translateY(-50%); margin: 0; }

/* Stage 4g: Profile card on Settings › Options — own row below Connections, sized to its form */
.settings-cards > #profile-card { flex: 1 1 100%; max-width: 44rem; }

/* Stage 5: Description (airplane) / Remarks (glider) column — fixed ~24 ch box; long text -2pt, max 4 lines */
#flights-table th.col-desc, #flights-table td.col-desc { width: 24ch; min-width: 24ch; max-width: 24ch; }
#flights-table td.col-desc .desc-box { width: 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; text-align: left; }
#flights-table td.col-desc .desc-box.desc-long {
  font-size: calc(1em - 2pt); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden;
}
/* Stage 5: pencil icon for ratings / currencies */
.btn-icon-u svg { display: block; margin: auto; }

/* Stage 5: central login button (accounts.aeroledger.eu) */
#central-login .btn { display: block; text-align: center; text-decoration: none; }
/* Stage 5: two-word app titles (AEROLEDGER LOGBOOK / GLIDERTRACK) fit one line in the login card on desktop */
.auth-card .brand h1 { font-size: 1.2rem; }

/* t351u: Settings › Import/Export › Import Aircraft (CSV) preview */
#import-aircraft-preview { margin-top: 1rem; }
.import-ac-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; padding: 0.9rem 1.1rem; }
.import-ac-head .import-ac-head-btns { margin-left: auto; display: inline-flex; gap: 0.5rem; }
.import-ac-tails { font-weight: 700; }
.import-ac-note { font-size: 0.78rem; margin-top: 0.2rem; }
.import-ac-err { font-size: 0.78rem; margin-top: 0.25rem; color: #b3261e; }
html[data-theme="dark"] .import-ac-err { color: #ff8a80; }
.badge-ac-indb { background: #e6eefc; color: #1d4ed8; border: 1px solid #a9c2f2; }
html[data-theme="dark"] .badge-ac-indb { background: rgba(147,180,255,.15); color: #93b4ff; border-color: rgba(147,180,255,.4); }

/* t353u: Import Flights / Import Aircraft buttons, Back, editable aircraft preview */
.import-choice { display: flex; flex-wrap: wrap; gap: 0.75rem; }
.import-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
.import-file-name { margin: 0; overflow-wrap: anywhere; }
.import-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
#export-flights-msg:empty, #import-flights-msg:empty, #import-aircraft-msg:empty { display: none; }
.import-ac-scroll { overflow-x: auto; }
/* t357u: top horizontal scrollbar (synced with the table scroll) */
.import-ac-topscroll { overflow-x: auto; overflow-y: hidden; height: 14px; }
.import-ac-topscroll > div { height: 1px; }
.import-ac-topscroll.hidden { display: none; }
/* t357u: "Multiple" tails parent row + display-only child rows (My Aircraft style) */
.import-ac-table tr.import-ac-group-header { cursor: pointer; }
.import-ac-table tr.import-ac-group-header > td { background: rgba(0, 0, 0, 0.18); }
.import-ac-table tr.import-ac-group-header:hover > td { background: rgba(0, 0, 0, 0.28); }
.import-ac-table tr.import-ac-group-header > td.import-ac-missing { background: rgba(220, 38, 38, 0.14); }
.import-ac-table .group-toggle { display: inline-flex; align-items: center; gap: 0.45rem; user-select: none; white-space: nowrap; }
.import-ac-table .group-arrow { display: inline-block; width: 0.85rem; color: var(--muted); font-size: 0.75rem; transition: transform 0.15s ease; }
.import-ac-table tr.import-ac-group-header.expanded .group-arrow { transform: rotate(90deg); }
.import-ac-table .group-count { color: var(--muted); font-weight: 500; font-size: 0.85rem; }
.import-ac-table tr.import-ac-group-row.hidden { display: none; }
.import-ac-table tr.import-ac-group-row > td { color: var(--muted, inherit); }
.import-ac-table tr.import-ac-group-row > td:first-child { padding-left: 1.9rem; }
.import-ac-table tr.import-ac-group-row.group-last > td { border-bottom: 1px solid rgba(34, 211, 238, 0.45); }
.import-ac-table { font-size: 0.82rem; }
.import-ac-table th { white-space: nowrap; }
.import-ac-table td { vertical-align: top; }
.import-ac-table td.import-ac-c { text-align: center; }
.import-ac-table input[type="text"], .import-ac-table select {
  width: auto; min-width: 0; padding: 0.2rem 0.35rem; font-size: 0.82rem; margin: 0; border-radius: 6px;
}
.import-ac-table input[type="checkbox"] { width: auto; margin: 0.2rem auto; }
.import-ac-table input.import-ac-w-xs { width: 3.6rem; }
.import-ac-table input.import-ac-w-s { width: 5.5rem; }
.import-ac-table input.import-ac-w-m { width: 8rem; }
.import-ac-table input.import-ac-w-l { width: 11rem; }
.import-ac-tail-list { display: flex; flex-direction: column; gap: 0.2rem; min-width: 6.5rem; }
.import-ac-table tr.import-ac-row-readonly td { color: var(--muted, inherit); }
.import-ac-table td.import-ac-missing { background: rgba(220, 38, 38, 0.14); box-shadow: inset 0 0 0 2px #dc2626; }
.import-ac-table td.import-ac-missing input, .import-ac-table td.import-ac-missing select { border-color: #dc2626; }
html[data-theme="dark"] .import-ac-table td.import-ac-missing { background: rgba(248, 113, 113, 0.2); box-shadow: inset 0 0 0 2px #f87171; }
.import-ac-na { opacity: 0.5; }
