/* 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;
}

.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-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);
}

#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;
}

@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;
}

.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;
}
