/* Helicopter Logbook PWA — Sistema de diseño moderno con dark mode */

:root {
  --radius: 0.875rem;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);

  /* Light mode — warm aviation */
  --bg: #faf7f2;
  --bg-elevated: #ffffff;
  --fg: #1a1d24;
  --fg-muted: #5a6270;
  --fg-subtle: #8a929e;
  --card: #ffffff;
  --card-border: #e5e7eb;
  --primary: #c8841a;
  --primary-fg: #ffffff;
  --primary-soft: rgba(200, 132, 26, 0.1);
  --primary-tint: rgba(200, 132, 26, 0.05);
  --accent: rgba(200, 132, 26, 0.08);
  --muted: #f1f3f5;
  --muted-fg: #5a6270;
  --border: #e5e7eb;
  --input: #f1f3f5;
  --ring: #c8841a;
  --destructive: #dc2626;
  --destructive-soft: rgba(220, 38, 38, 0.1);

  --emerald: #059669;
  --emerald-soft: rgba(5, 150, 105, 0.1);
  --amber: #d97706;
  --amber-soft: rgba(217, 119, 6, 0.1);
  --violet: #7c3aed;
  --violet-soft: rgba(124, 58, 237, 0.1);
  --orange: #ea580c;
  --orange-soft: rgba(234, 88, 12, 0.1);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-glow: 0 4px 12px -2px rgba(200, 132, 26, 0.25);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.dark {
  --bg: #14171c;
  --bg-elevated: #1a1d24;
  --fg: #f5f7fa;
  --fg-muted: #9aa3b0;
  --fg-subtle: #6b7280;
  --card: #1a1d24;
  --card-border: rgba(255, 255, 255, 0.08);
  --primary: #e0952c;
  --primary-fg: #1a1d24;
  --primary-soft: rgba(224, 149, 44, 0.18);
  --primary-tint: rgba(224, 149, 44, 0.08);
  --accent: rgba(224, 149, 44, 0.15);
  --muted: #1f232b;
  --muted-fg: #9aa3b0;
  --border: rgba(255, 255, 255, 0.08);
  --input: rgba(255, 255, 255, 0.1);
  --ring: #e0952c;
  --destructive: #f87171;
  --destructive-soft: rgba(248, 113, 113, 0.15);

  --emerald: #34d399;
  --emerald-soft: rgba(52, 211, 153, 0.15);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.15);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.15);
  --orange: #fb923c;
  --orange-soft: rgba(251, 146, 60, 0.15);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 4px 12px -2px rgba(224, 149, 44, 0.35);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  background: var(--input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 0.75rem;
  height: 2.75rem;
  width: 100%;
  outline: none;
  transition: border-color 150ms, box-shadow 150ms;
  color: var(--fg);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

input[type="time"], input[type="date"], input[type="number"] {
  font-variant-numeric: tabular-nums;
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

textarea {
  height: auto;
  padding: 0.5rem 0.75rem;
  resize: vertical;
  min-height: 3rem;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
}

label .req {
  color: var(--destructive);
  margin-left: 0.125rem;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* ===== Layout ===== */
.app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-image: radial-gradient(ellipse 80% 50% at 50% -20%, var(--primary-tint), transparent);
}

.header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: between;
  gap: 0.5rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 80%, #000));
  color: var(--primary-fg);
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.logo svg {
  width: 1.25rem;
  height: 1.25rem;
  transform: rotate(-45deg);
}

.title-block h1 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.01em;
}

.title-block p {
  margin: 0.25rem 0 0;
  font-size: 0.6875rem;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  color: var(--fg);
  transition: background 150ms;
}

.icon-btn:hover, .icon-btn:active {
  background: var(--accent);
}

.icon-btn svg {
  width: 1.125rem;
  height: 1.125rem;
}

/* Dropdown */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.25rem);
  min-width: 11rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.25rem;
  z-index: 50;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--fg);
  text-align: left;
}

.dropdown-item:hover, .dropdown-item:active {
  background: var(--accent);
}

.dropdown-item svg {
  width: 1rem;
  height: 1rem;
}

/* Primary button */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 2.25rem;
  padding: 0 0.875rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--primary);
  color: var(--primary-fg);
  box-shadow: var(--shadow-sm);
  transition: transform 100ms, box-shadow 150ms, background 150ms;
}

.btn:hover {
  background: color-mix(in srgb, var(--primary) 90%, #000);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: scale(0.97);
}

.btn svg {
  width: 1rem;
  height: 1rem;
}

.btn-sm {
  height: 2rem;
  padding: 0 0.75rem;
  font-size: 0.8125rem;
}

.btn-outline {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn-outline:hover {
  background: var(--accent);
  border-color: var(--primary);
}

.btn-ghost {
  background: transparent;
  color: var(--fg);
  box-shadow: none;
}

.btn-ghost:hover {
  background: var(--accent);
}

.btn-destructive {
  background: var(--destructive);
  color: #fff;
}

.btn-block {
  width: 100%;
}

.btn-lg {
  height: 3rem;
  font-size: 0.9375rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}

/* ===== Main ===== */
main {
  flex: 1;
  max-width: 48rem;
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
}

/* Tabs */
.tabs-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
  background: var(--muted);
  border-radius: var(--radius-md);
  padding: 0.25rem;
  margin-bottom: 1rem;
  height: 2.75rem;
}

.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--fg-muted);
  border-radius: var(--radius-sm);
  transition: background 150ms, color 150ms;
  padding: 0 0.5rem;
}

.tab svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.tab.active {
  background: var(--bg-elevated);
  color: var(--fg);
  box-shadow: var(--shadow-sm);
}

.tab:active {
  transform: scale(0.97);
}

/* Footer */
.footer {
  position: sticky;
  bottom: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}

.footer-inner {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0.625rem 1rem;
}

/* ===== Cards ===== */
.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.card-body {
  padding: 1rem;
}

.card-header {
  padding: 1rem 1rem 0.5rem;
}

.card-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.card-title-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title svg {
  width: 1rem;
  height: 1rem;
  color: var(--primary);
}

.modern-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 200ms, border-color 200ms;
}

.modern-card:hover {
  box-shadow: var(--shadow-md);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.625rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--fg-muted);
  white-space: nowrap;
}

.badge-primary {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: transparent;
}

.badge-emerald {
  background: var(--emerald-soft);
  color: var(--emerald);
  border-color: transparent;
}

.badge-amber {
  background: var(--amber-soft);
  color: var(--amber);
  border-color: transparent;
}

.badge-violet {
  background: var(--violet-soft);
  color: var(--violet);
  border-color: transparent;
}

.badge-orange {
  background: var(--orange-soft);
  color: var(--orange);
  border-color: transparent;
}

.badge-destructive {
  background: var(--destructive-soft);
  color: var(--destructive);
  border-color: transparent;
}

/* Chip */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  background: var(--muted);
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

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

.chip svg {
  width: 0.75rem;
  height: 0.75rem;
}

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--muted) 25%, var(--card-border) 50%, var(--muted) 75%);
  background-size: 200% 100%;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
}

@keyframes skeleton-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== Toast ===== */
#toaster {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: calc(100% - 2rem);
  max-width: 28rem;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  pointer-events: auto;
  animation: toast-in 200ms ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-1rem); }
  to { opacity: 1; transform: translateY(0); }
}

.toast.success { border-left: 3px solid var(--emerald); }
.toast.error { border-left: 3px solid var(--destructive); }
.toast.info { border-left: 3px solid var(--primary); }

.toast svg {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.toast.success svg { color: var(--emerald); }
.toast.error svg { color: var(--destructive); }
.toast.info svg { color: var(--primary); }

/* ===== Sheet (bottom drawer) ===== */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 60;
  animation: fade-in 200ms ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 70;
  background: var(--bg-elevated);
  border-top-left-radius: 1.5rem;
  border-top-right-radius: 1.5rem;
  border-top: 2px solid var(--primary);
  max-height: 94vh;
  max-height: 94dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: slide-up 280ms cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 -10px 30px rgba(0,0,0,0.15);
}

@keyframes slide-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.sheet-handle {
  position: sticky;
  top: 0;
  display: flex;
  justify-content: center;
  padding: 0.5rem 0 0.25rem;
  background: color-mix(in srgb, var(--bg-elevated) 95%, transparent);
  backdrop-filter: blur(8px);
  z-index: 5;
}

.sheet-handle::before {
  content: '';
  display: block;
  width: 2.5rem;
  height: 0.25rem;
  border-radius: 9999px;
  background: var(--muted-fg);
}

.sheet-header {
  position: sticky;
  top: 0.5rem;
  padding: 0.5rem 1.25rem 0.75rem;
  background: color-mix(in srgb, var(--bg-elevated) 95%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  z-index: 5;
  margin-top: -0.25rem;
  padding-top: 1rem;
}

.sheet-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sheet-title svg {
  width: 1rem;
  height: 1rem;
}

.sheet-content {
  padding: 1.25rem;
}

.sheet-footer {
  position: sticky;
  bottom: 0;
  background: color-mix(in srgb, var(--bg-elevated) 95%, transparent);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  margin: 0 -1.25rem;
  display: flex;
  gap: 0.5rem;
  padding-bottom: calc(0.75rem + env(safe-area-inset-bottom));
}

/* ===== Dialog (modal) ===== */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fade-in 200ms ease-out;
}

.dialog {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 28rem;
  width: 100%;
  padding: 1.5rem;
  animation: dialog-in 200ms ease-out;
}

@keyframes dialog-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.dialog h2 {
  margin: 0 0 0.5rem;
  font-size: 1.0625rem;
  font-weight: 600;
}

.dialog p {
  margin: 0 0 1.25rem;
  font-size: 0.875rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* ===== Forms ===== */
.field {
  margin-bottom: 1rem;
}

.field-label {
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.field-label svg {
  width: 0.875rem;
  height: 0.875rem;
  color: var(--fg-muted);
}

.field-hint {
  font-size: 0.6875rem;
  color: var(--fg-muted);
  margin-top: 0.25rem;
}

.section-label {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin: 1rem 0 0.5rem;
}

.section-label svg {
  width: 0.875rem;
  height: 0.875rem;
}

.form-section {
  background: var(--primary-tint);
  border: 1px solid var(--primary-soft);
  border-radius: var(--radius-lg);
  padding: 1rem;
  margin-bottom: 1rem;
}

.form-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.form-section-title .hint {
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  color: var(--fg-muted);
  font-size: 0.6875rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

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

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

.error-box {
  background: var(--destructive-soft);
  color: var(--destructive);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  margin-bottom: 1rem;
}

/* Time calc boxes */
.calc-box {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.75rem;
}

.calc-box.highlight {
  border-color: var(--primary-soft);
  background: var(--primary-soft);
}

.calc-box-label {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
}

.calc-box-label svg {
  width: 0.75rem;
  height: 0.75rem;
}

.calc-box-value {
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 0.125rem;
}

.calc-box-value .unit {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--fg-muted);
  margin-left: 0.25rem;
}

.calc-box-hint {
  font-size: 0.625rem;
  color: var(--fg-muted);
  margin-top: 0.125rem;
}

/* Time cell */
.time-cell {
  background: var(--muted);
  border-radius: var(--radius-sm);
  padding: 0.375rem 0.5rem;
}

.time-cell-label {
  font-size: 0.5625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  font-weight: 600;
}

.time-cell-value {
  font-size: 0.875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Autocomplete */
.autocomplete-list {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 0.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  max-height: 16rem;
  overflow-y: auto;
  z-index: 50;
}

.autocomplete-section {
  padding: 0.375rem 0.75rem;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  background: var(--muted);
  border-bottom: 1px solid var(--border);
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.875rem;
  text-align: left;
  width: 100%;
  border-bottom: 1px solid var(--border);
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover, .autocomplete-item.active {
  background: var(--accent);
}

.autocomplete-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}

.autocomplete-icon svg {
  width: 1rem;
  height: 1rem;
}

.autocomplete-text {
  flex: 1;
  min-width: 0;
}

.autocomplete-text-main {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autocomplete-text-sub {
  font-size: 0.625rem;
  color: var(--fg-muted);
}

.autocomplete-text-sub .mono {
  font-family: var(--font-mono);
  margin-left: 0.5rem;
}

/* Flight card */
.flight-card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin-bottom: 0.625rem;
  transition: box-shadow 200ms, transform 100ms;
}

.flight-card:active {
  transform: scale(0.99);
}

.flight-card-body {
  padding: 1rem;
}

.flight-card-route {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.flight-card-route-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.flight-card-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  color: var(--primary);
  flex-shrink: 0;
}

.flight-card-icon svg {
  width: 1rem;
  height: 1rem;
  transform: rotate(-45deg);
}

.flight-card-route-text {
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.flight-card-arrow {
  color: var(--fg-subtle);
}

.flight-card-date {
  font-size: 0.75rem;
  color: var(--fg-muted);
  white-space: nowrap;
}

.flight-card-aircraft {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--fg-muted);
  margin-top: -0.25rem;
  margin-bottom: 0.625rem;
}

.flight-card-aircraft-name {
  font-weight: 500;
  color: var(--fg);
}

.flight-card-aircraft-reg {
  font-family: var(--font-mono);
  background: var(--muted);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  font-size: 0.625rem;
}

.flight-card-times {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.375rem;
  margin-bottom: 0.625rem;
}

.flight-card-durations {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.75rem;
  margin-bottom: 0.625rem;
}

.flight-card-duration {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--fg-muted);
}

.flight-card-duration svg {
  width: 0.75rem;
  height: 0.75rem;
}

.flight-card-duration b {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.flight-card-duration.flight b {
  color: var(--primary);
}

.flight-card-counts {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.6875rem;
  color: var(--fg-muted);
  margin-bottom: 0.625rem;
}

.flight-card-counts span {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.flight-card-counts svg {
  width: 0.75rem;
  height: 0.75rem;
}

.flight-card-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
}

.flight-card-pic {
  font-size: 0.625rem;
  color: var(--fg-muted);
  margin-left: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40%;
}

.flight-card-remarks {
  font-size: 0.75rem;
  color: var(--fg-muted);
  font-style: italic;
  border-left: 2px solid var(--border);
  padding-left: 0.5rem;
  margin-top: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.flight-card-actions {
  display: flex;
  gap: 0.5rem;
  padding-top: 0.625rem;
  margin-top: 0.625rem;
  border-top: 1px solid var(--border);
}

.flight-card-actions button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  height: 2rem;
  font-size: 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--fg-muted);
  transition: background 150ms;
}

.flight-card-actions button:hover {
  background: var(--accent);
}

.flight-card-actions button.destructive {
  color: var(--destructive);
}

.flight-card-actions button.destructive:hover {
  background: var(--destructive-soft);
}

.flight-card-actions svg {
  width: 0.875rem;
  height: 0.875rem;
}

/* Empty state */
.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 3.5rem 1rem;
  text-align: center;
}

.empty-state svg {
  width: 2.5rem;
  height: 2.5rem;
  margin: 0 auto 0.75rem;
  color: var(--fg-subtle);
  opacity: 0.4;
}

.empty-state p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--fg-muted);
}

/* Search */
.search-wrap {
  position: relative;
  margin-bottom: 0.5rem;
}

.search-wrap svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--fg-muted);
}

.search-wrap input {
  padding-left: 2.25rem;
  height: 2.75rem;
  border-radius: var(--radius-md);
}

/* Pilot dashboard */
.pilot-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.pilot-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.pilot-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, #000));
  color: var(--primary-fg);
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.pilot-avatar svg {
  width: 1.5rem;
  height: 1.5rem;
  transform: rotate(-45deg);
}

.pilot-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pilot-license {
  margin: 0.125rem 0 0;
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 1rem;
}

.summary-chip {
  border-radius: var(--radius-md);
  padding: 0.5rem 0.25rem;
  text-align: center;
}

.summary-chip-value {
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.summary-chip-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  margin-top: 0.25rem;
}

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.kpi-card {
  padding: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.kpi-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.kpi-icon svg {
  width: 1rem;
  height: 1rem;
}

.kpi-label {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  color: var(--fg-muted);
}

.kpi-value {
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  margin-top: 0.125rem;
}

/* Currency / Limit cards */
.currency-card, .limit-card {
  border-width: 2px;
  border-style: solid;
}

.currency-card.status-current, .limit-card.status-current {
  border-color: var(--emerald-soft);
  background: linear-gradient(to bottom, var(--emerald-soft), transparent 50%);
}

.currency-card.status-warning, .limit-card.status-warning {
  border-color: var(--amber-soft);
  background: linear-gradient(to-bottom, var(--amber-soft), transparent 50%);
}

.currency-card.status-expired, .limit-card.status-expired {
  border-color: var(--destructive-soft);
  background: linear-gradient(to bottom, var(--destructive-soft), transparent 50%);
}

.currency-card.status-unknown, .limit-card.status-unknown {
  border-color: var(--border);
  background: var(--muted);
}

.currency-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.currency-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.currency-icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.currency-icon.status-current {
  background: var(--emerald-soft);
  color: var(--emerald);
}

.currency-icon.status-warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.currency-icon.status-expired {
  background: var(--destructive-soft);
  color: var(--destructive);
}

.currency-icon.status-unknown {
  background: var(--muted);
  color: var(--fg-muted);
}

.currency-body {
  flex: 1;
  min-width: 0;
}

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

.currency-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
}

.currency-period {
  margin: 0.125rem 0 0;
  font-size: 0.6875rem;
  color: var(--fg-muted);
}

.currency-meta {
  margin-top: 0.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.75rem;
  font-size: 0.75rem;
  color: var(--fg-muted);
}

.currency-meta b {
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.currency-meta .days {
  font-weight: 600;
}

.currency-meta .days.status-current { color: var(--emerald); }
.currency-meta .days.status-warning { color: var(--amber); }
.currency-meta .days.status-expired { color: var(--destructive); }

/* Limit row */
.limit-row {
  margin-bottom: 0.5rem;
}

.limit-row:last-child {
  margin-bottom: 0;
}

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

.limit-head-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.limit-head-left svg {
  width: 1rem;
  height: 1rem;
}

.limit-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
}

.limit-subtitle {
  font-size: 0.6875rem;
  color: var(--fg-muted);
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.limit-values {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.limit-current {
  font-size: 1.5rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.limit-current .limit-max {
  font-size: 0.75rem;
  color: var(--fg-muted);
  font-weight: 400;
  margin-left: 0.375rem;
}

.limit-remaining {
  font-size: 0.75rem;
  font-weight: 600;
}

.limit-remaining.status-current { color: var(--emerald); }
.limit-remaining.status-warning { color: var(--amber); }
.limit-remaining.status-expired { color: var(--destructive); }

.limit-bar {
  height: 0.5rem;
  background: var(--muted);
  border-radius: 9999px;
  overflow: hidden;
}

.limit-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 300ms ease;
}

.limit-bar-fill.status-current { background: var(--emerald); }
.limit-bar-fill.status-warning { background: var(--amber); }
.limit-bar-fill.status-expired { background: var(--destructive); }
.limit-bar-fill.status-unknown { background: var(--fg-muted); }

/* Progress bar (generic) */
.progress-bar {
  height: 0.375rem;
  background: var(--muted);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 9999px;
  background: var(--primary);
  transition: width 300ms ease;
}

.progress-bar-fill.emerald { background: var(--emerald); }
.progress-bar-fill.amber { background: var(--amber); }
.progress-bar-fill.violet { background: var(--violet); }
.progress-bar-fill.orange { background: var(--orange); }
.progress-bar-fill.destructive { background: var(--destructive); }
.progress-bar-fill.muted { background: var(--fg-muted); }

/* Breakdown */
.breakdown-row {
  margin-bottom: 0.625rem;
}

.breakdown-row:last-child {
  margin-bottom: 0;
}

.breakdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}

.breakdown-label {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.breakdown-value {
  font-variant-numeric: tabular-nums;
  color: var(--fg-muted);
  white-space: nowrap;
}

.breakdown-value b {
  color: var(--fg);
}

/* Loading screen */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 200;
}

.loading-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, #000));
  color: var(--primary-fg);
  box-shadow: var(--shadow-glow);
  animation: pulse 2s ease-in-out infinite;
}

.loading-logo svg {
  width: 2rem;
  height: 2rem;
  transform: rotate(-45deg);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.95); opacity: 0.8; }
}

.loading-text {
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.loading-spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--muted);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Utility */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--fg-muted); }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uppercase { text-transform: uppercase; }

/* Filters row */
.filters-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.filters-row select {
  height: 2.5rem;
  font-size: 0.75rem;
  padding: 0 0.5rem;
  padding-right: 1.75rem;
}

/* Active filters */
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  font-size: 0.75rem;
  margin-bottom: 1rem;
}

.active-filters .label {
  color: var(--fg-muted);
  align-self: center;
}

/* Stats summary line */
.stats-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  padding: 0 0.25rem;
  margin-bottom: 0.75rem;
}

/* Recent landings list */
.recent-landings {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.recent-landings-title {
  font-size: 0.625rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 0.5rem;
}

.recent-landing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  padding: 0.25rem 0;
  font-variant-numeric: tabular-nums;
}

.recent-landing-row .date {
  color: var(--fg-muted);
}

.recent-landing-row .landings {
  font-weight: 600;
}
