/* UAS Flight Log — aviation logbook theme (from reference UI) */

:root {
  --navy: #0b1622;
  --navy-grid: #122033;
  --ink: #1a1a1a;
  --muted: #6b7280;
  --section: #6d92bd;
  --section-dark: #5a7fa8;
  --sky: #60a5fa;
  --green: #2e8b3d;
  --green-soft: #d1e7dd;
  --orange: #f59e0b;
  --panel: #ffffff;
  --field: #f1f3f5;
  --border: #e5e7eb;
  --nav: #1c1c1e;
  --radius: 12px;
  --radius-sm: 8px;
}

body.app-shell {
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--navy);
  background-image:
    linear-gradient(rgba(18, 32, 51, 0.9), rgba(11, 22, 34, 0.95)),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 47px,
      rgba(109, 146, 189, 0.08) 47px,
      rgba(109, 146, 189, 0.08) 48px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 47px,
      rgba(109, 146, 189, 0.08) 47px,
      rgba(109, 146, 189, 0.08) 48px
    );
  background-attachment: fixed;
}

.app-header {
  background: var(--nav);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  color: #fff;
}

.app-header a {
  color: #fff;
}

.app-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  min-height: 2.5rem;
}

.app-logo {
  display: block;
  width: 2.5rem;
  height: 2.5rem;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.app-brand-text {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

@media (max-width: 480px) {
  .app-logo {
    width: 2.25rem;
    height: 2.25rem;
  }

  .app-brand-text {
    font-size: 0.95rem;
  }
}

.app-main {
  color: var(--ink);
}

.app-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(11, 22, 34, 0.85);
  color: rgba(255, 255, 255, 0.55);
}

/* Page titles on dark shell */
.page-title {
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.page-sub {
  color: rgba(255, 255, 255, 0.7);
}

.draft-status {
  color: rgba(255, 255, 255, 0.65);
}

/* White content panel */
.panel {
  background: var(--panel);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.panel-muted {
  background: rgba(255, 255, 255, 0.06);
  border: 1px dashed rgba(109, 146, 189, 0.45);
  border-radius: var(--radius);
  color: rgba(255, 255, 255, 0.75);
}

.panel-muted h2,
.panel-muted strong {
  color: #fff;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-sm);
  background: var(--section);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: var(--section-dark);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.65rem 1.15rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: #e5e7eb;
}

.btn-sky {
  background: var(--sky);
  color: #fff;
  border: none;
}

.btn-sky:hover {
  filter: brightness(0.95);
}

.btn-green {
  background: var(--green);
  color: #fff;
  border: none;
}

.btn-green:hover {
  filter: brightness(0.95);
}

.badge-sky {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--sky);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Form sections — medium slate blue headers like reference */
details.fl-section {
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

details.fl-section > summary {
  list-style: none;
  cursor: pointer;
  background: var(--section);
  color: #fff;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
}

details.fl-section > summary::-webkit-details-marker {
  display: none;
}

details.fl-section > summary::after {
  content: '+';
  float: right;
  font-weight: 700;
  color: #fff;
  opacity: 0.9;
}

details.fl-section[open] > summary::after {
  content: '−';
}

details.fl-section > summary:hover {
  background: var(--section-dark);
}

.fl-section-body {
  padding: 1rem;
  background: var(--panel);
}

.fl-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--field);
  padding: 0.55rem 0.75rem;
  font-size: 0.95rem;
  color: var(--ink);
}

.fl-input:focus {
  outline: 2px solid var(--sky);
  outline-offset: 1px;
  border-color: var(--sky);
  background: #fff;
}

.fl-input[readonly],
.fl-input:disabled {
  background: #e8eaed;
  color: var(--muted);
}

.fl-label {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.fl-error {
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: #b91c1c;
}

.fl-check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--field);
}

.fl-check input {
  margin-top: 0.15rem;
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--section);
}

.fl-check span {
  color: var(--ink);
  font-size: 0.9rem;
}

/* Shown only when Preflight "Other" is checked */
.fl-conditional {
  display: none;
}

.fl-conditional.is-open {
  display: block;
}

.fl-other-box {
  margin-top: 0.25rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--field);
}

.summary-total {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--green-soft);
  color: var(--green);
  font-weight: 700;
  font-size: 0.95rem;
}

.battery-table {
  min-width: 100%;
  border-collapse: collapse;
}

.battery-table th,
.battery-table td {
  border: 1px solid var(--border);
  padding: 0.4rem;
  vertical-align: middle;
}

.battery-table th {
  background: var(--field);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink);
}

.battery-table .row-label {
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--field);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.session-table thead tr {
  background: var(--field);
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.session-table th,
.session-table td {
  border: 1px solid var(--border);
  padding: 0.35rem;
}

.link-accent {
  color: var(--sky);
  font-weight: 600;
}

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

@media (max-width: 768px) {
  .session-table-wrap,
  .battery-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* Signature field + modal */
.signature-field {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 6.5rem;
  padding: 0;
  overflow: hidden;
  border: 1px dashed #9aa7b8;
  border-radius: var(--radius-sm);
  background: var(--field);
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.signature-field:focus {
  outline: 2px solid var(--sky);
  outline-offset: 1px;
  border-color: var(--sky);
}

.signature-placeholder {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 0.5rem 0.75rem;
}

.signature-preview {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  object-position: center;
  background: #fff;
}

.signature-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(11, 22, 34, 0.72);
}

.signature-modal.hidden {
  display: none;
}

.signature-modal-panel {
  width: min(100%, 40rem);
  border-radius: var(--radius);
  background: #fff;
  padding: 1.25rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.signature-modal-panel h2 {
  color: var(--ink);
}

.signature-canvas-wrap {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background:
    linear-gradient(#cbd5e1, #cbd5e1) left 16px bottom 28% / calc(100% - 32px) 1px no-repeat,
    var(--field);
  overflow: hidden;
  touch-action: none;
}

#signature-canvas {
  display: block;
  width: 100%;
  height: min(40vh, 280px);
  touch-action: none;
  cursor: crosshair;
}

body.signature-modal-open {
  overflow: hidden;
}

/* Tables on list/detail */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
}

.data-table thead {
  background: var(--section);
  color: #fff;
}

.data-table th {
  padding: 0.7rem 0.75rem;
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  padding: 0.7rem 0.75rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.data-table tbody tr:hover {
  background: var(--field);
}

/* Admin statistics charts */
.chart-card {
  padding: 1rem 1rem 0.75rem;
}

.chart-title {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--section);
}

.chart-wrap {
  position: relative;
  height: 260px;
  width: 100%;
}

.chart-wrap-sm {
  height: 240px;
}

.chart-wrap-lg {
  height: 360px;
}

@media (max-width: 640px) {
  .chart-wrap,
  .chart-wrap-sm {
    height: 220px;
  }

  .chart-wrap-lg {
    height: 420px;
  }
}
