/* Pilot logbook — wide desktop ledger + compact mobile cards */

.rcs-pilot-field-page .lb-stat,
.rcs-pilot-field-page .lb-fleet,
.rcs-pilot-field-page .lb-ledger,
.rcs-pilot-field-page .lb-panel,
.rcs-pilot-field-page .lb-empty,
.rcs-pilot-field-page .lb-cards .lb-card {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
}

[data-theme="dark"] .rcs-pilot-field-page .lb-stat,
[data-theme="dark"] .rcs-pilot-field-page .lb-fleet,
[data-theme="dark"] .rcs-pilot-field-page .lb-ledger,
[data-theme="dark"] .rcs-pilot-field-page .lb-panel,
[data-theme="dark"] .rcs-pilot-field-page .lb-empty,
[data-theme="dark"] .rcs-pilot-field-page .lb-cards .lb-card {
  background: rgba(17, 24, 39, 0.9);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.32);
}

.rcs-pilot-field-page .lb-active:not([hidden]) {
  background: rgba(34, 197, 94, 0.18);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.rcs-logbook-page .rcs-logbook-wrap {
  max-width: min(1320px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 0 16px 56px;
}

@media (max-width: 767px) {
  .rcs-logbook-page .rcs-logbook-wrap {
    padding-bottom: 80px;
  }
}

@media (min-width: 900px) {
  .rcs-logbook-page .rcs-logbook-wrap {
    padding: 24px 24px 64px;
  }
}

/* ── Active flight banner ── */
.lb-active[hidden] {
  display: none !important;
}

.lb-active:not([hidden]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid var(--rcs-accent);
  background: var(--rcs-accent-dim);
}

.lb-active-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rcs-accent-text);
  margin-bottom: 4px;
}

.lb-active-summary {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.lb-active-pulse {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--rcs-accent);
  margin-right: 6px;
  animation: lb-pulse 1.4s ease-in-out infinite;
}

@keyframes lb-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

/* ── Stats row — gap shows field backdrop between cards (no panel on grid itself) ── */
.lb-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

@media (min-width: 640px) {
  .lb-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
  }
}

@media (min-width: 900px) {
  .lb-stats {
    grid-template-columns: repeat(5, 1fr);
    gap: 14px;
    margin-bottom: 24px;
  }
}

.lb-stat {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--rcs-border);
  min-width: 0;
}

@media (min-width: 900px) {
  .lb-stat {
    padding: 16px 18px;
  }
}

.lb-stat-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

@media (min-width: 640px) {
  .lb-stat-value { font-size: 24px; }
}

@media (min-width: 900px) {
  .lb-stat-value { font-size: 26px; }
}

@media (min-width: 1100px) {
  .lb-stat-value { font-size: 28px; }
}

.lb-stat-label {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rcs-muted);
}

.lb-stat.accent .lb-stat-value { color: var(--rcs-accent-text); }

/* ── Fleet / aircraft breakdown ── */
.lb-fleet {
  margin-bottom: 20px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--rcs-border);
  background: var(--rcs-panel);
}

.lb-fleet-title {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rcs-muted);
}

.lb-fleet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lb-fleet-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--rcs-border);
  background: var(--rcs-input-bg);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lb-fleet-chip:hover { border-color: var(--rcs-muted); }

.lb-fleet-chip.active {
  border-color: var(--rcs-accent);
  box-shadow: 0 0 0 1px var(--rcs-accent);
}

.lb-fleet-chip .lb-ac-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.lb-fleet-chip .lb-ac-meta {
  font-size: 10px;
  font-weight: 500;
  color: var(--rcs-muted);
  margin-left: 2px;
}

.lb-fleet-bar {
  display: flex;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 12px;
  background: var(--rcs-border);
}

.lb-fleet-bar-seg {
  height: 100%;
  min-width: 2px;
  transition: width 0.3s ease;
}

/* ── Main layout: ledger + sidebar ── */
.lb-layout {
  display: grid;
  gap: 20px;
}

@media (min-width: 1024px) {
  .lb-layout {
    grid-template-columns: 1fr 320px;
    align-items: start;
  }
}

/* ── Toolbar / filters ── */
.lb-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--rcs-border);
  background: var(--rcs-panel);
}

.lb-toolbar-group {
  flex: 1 1 140px;
  min-width: 0;
}

.lb-toolbar-group.wide { flex: 2 1 200px; }

.lb-toolbar label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--rcs-muted);
  margin: 0 0 4px;
}

.lb-toolbar input,
.lb-toolbar select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--rcs-border);
  background: var(--rcs-input-bg);
  color: var(--rcs-text);
  font: inherit;
  font-size: 13px;
}

.lb-result-count {
  flex: 1 1 100%;
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--rcs-muted);
}

@media (min-width: 768px) {
  .lb-result-count { flex: 0 0 auto; margin: 0 0 4px auto; text-align: right; }
}

/* ── Ledger (pilot logbook look) ── */
.lb-ledger {
  border-radius: 14px;
  border: 1px solid var(--rcs-border);
  overflow: hidden;
  box-shadow: 0 4px 24px var(--rcs-shadow);
}

[data-theme="light"] .lb-ledger {
  background: linear-gradient(180deg, #fffef9 0%, #f8f6ee 100%);
  border-color: rgba(120, 100, 60, 0.18);
}

[data-theme="dark"] .lb-ledger {
  background: linear-gradient(180deg, #0c1424 0%, #0f172a 100%);
}

.lb-ledger-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 2px solid var(--rcs-border);
  background: var(--rcs-input-bg);
}

.lb-ledger-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--rcs-muted);
}

.lb-ledger-head .lb-ledger-sub {
  font-size: 11px;
  color: var(--rcs-muted);
}

/* Desktop table */
.lb-table-wrap {
  overflow-x: auto;
}

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.lb-table thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--rcs-muted);
  border-bottom: 1px solid var(--rcs-border);
  background: var(--rcs-input-bg);
  white-space: nowrap;
}

.lb-table tbody tr {
  border-bottom: 1px solid var(--rcs-border);
  transition: background 0.12s ease;
}

[data-theme="light"] .lb-table tbody tr:nth-child(even) {
  background: rgba(120, 100, 60, 0.04);
}

[data-theme="dark"] .lb-table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.02);
}

.lb-table tbody tr:hover { background: var(--rcs-hover); }

.lb-table td {
  padding: 11px 12px;
  vertical-align: top;
  line-height: 1.4;
}

.lb-table .lb-col-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.lb-table .lb-col-duration {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-size: 14px;
}

.lb-ac-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.lb-ac-stripe {
  width: 4px;
  align-self: stretch;
  min-height: 28px;
  border-radius: 2px;
  flex-shrink: 0;
}

.lb-notes-cell {
  max-width: 200px;
  font-size: 12px;
  color: var(--rcs-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-weather-cell {
  font-size: 11px;
  color: var(--rcs-muted);
  white-space: nowrap;
}

.lb-badge-manual {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--rcs-pill-bg);
  color: var(--rcs-muted);
  margin-left: 4px;
}

/* Mobile cards */
.lb-cards { display: none; }

.lb-card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rcs-border);
  display: grid;
  grid-template-columns: 4px 1fr auto;
  gap: 0 12px;
  align-items: start;
}

.lb-card:last-child { border-bottom: none; }

.lb-card-stripe {
  grid-row: 1 / -1;
  border-radius: 2px;
  min-height: 100%;
}

.lb-card-main { min-width: 0; }

.lb-card-aircraft {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 2px;
}

.lb-card-meta {
  font-size: 12px;
  color: var(--rcs-muted);
  line-height: 1.4;
}

.lb-card-duration {
  font-weight: 800;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lb-card-actions {
  grid-column: 2 / -1;
  margin-top: 8px;
}

@media (max-width: 767px) {
  .lb-table-wrap { display: none; }
  .lb-cards { display: block; }
}

.lb-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--rcs-muted);
  font-size: 14px;
  line-height: 1.5;
}

.lb-empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* ── Sidebar panels ── */
.lb-sidebar { display: flex; flex-direction: column; gap: 16px; }

.lb-panel {
  border-radius: 14px;
  border: 1px solid var(--rcs-border);
  background: var(--rcs-panel);
  overflow: hidden;
}

.lb-panel-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--rcs-border);
  background: var(--rcs-input-bg);
}

.lb-panel-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--rcs-muted);
}

.lb-panel-body { padding: 16px; }

.lb-panel-body input[type="datetime-local"],
.lb-panel-body select {
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

#manual-form label,
#panel-export label {
  display: block;
  margin-top: 10px;
}

#panel-export label:first-of-type,
#manual-form label:first-of-type {
  margin-top: 0;
}

.lb-panel-body .rcs-hint { margin-top: 0; }

/* Mobile: collapsible sidebar sections */
@media (max-width: 1023px) {
  .lb-panel-collapsible .lb-panel-body { display: none; }
  .lb-panel-collapsible.is-open .lb-panel-body { display: block; }

  .lb-panel-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border: none;
    background: var(--rcs-input-bg);
    color: var(--rcs-text);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
  }

  .lb-panel-toggle::after {
    content: "▾";
    opacity: 0.6;
    font-size: 14px;
  }

  .lb-panel-collapsible.is-open .lb-panel-toggle::after {
    transform: rotate(180deg);
  }

  .lb-panel-collapsible .lb-panel-head { display: none; }
}

@media (min-width: 1024px) {
  .lb-panel-toggle { display: none; }
  .lb-panel-collapsible .lb-panel-body { display: block; }
}
