@charset "UTF-8";

:root {
  --jet-red-500: #f05a66;
  --jet-red-600: #d71920;
  --jet-red-700: #bb151b;
  --jet-red-800: #8d1015;
  --jet-red-900: #5e0b0f;
  --text-primary: #0d1b2a;
  --text-secondary: #3a4d63;
  --text-muted: rgba(16, 38, 63, 0.65);
  --base-bg: #f5f6f9;
  --panel-bg: #ffffff;
  --border-subtle: rgba(16, 38, 63, 0.12);
  --toggle-track: rgba(16, 38, 63, 0.08);
  --shadow-soft: 0 12px 32px rgba(12, 17, 43, 0.12);
  --shadow-raised: 0 18px 44px rgba(12, 17, 43, 0.18);
  --banner-start: var(--jet-red-600);
  --banner-end: var(--jet-red-700);
}

body.theme-dark {
  --text-primary: #f8f9fb;
  --text-secondary: rgba(255, 247, 250, 0.85);
  --text-muted: rgba(255, 247, 250, 0.6);
  --base-bg: #1a0204;
  --panel-bg: rgba(26, 4, 5, 0.92);
  --border-subtle: rgba(255, 247, 250, 0.16);
  --toggle-track: rgba(255, 247, 250, 0.1);
  --shadow-soft: 0 20px 36px rgba(0, 0, 0, 0.45);
  --shadow-raised: 0 28px 68px rgba(0, 0, 0, 0.6);
  --banner-start: var(--jet-red-800);
  --banner-end: var(--jet-red-900);
}

html, body {
  margin: 0;
  min-height: 100vh;
  height: 100%;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  background: var(--base-bg);
  color: var(--text-primary);
}

body {
  display: flex;
  flex-direction: column;
}

#app {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

main, section {
  box-sizing: border-box;
}

.menu-screen {
  width: 100%;
  flex: 1;
  background: linear-gradient(135deg, var(--banner-start), var(--banner-end));
  color: #fff;
  box-shadow: var(--shadow-raised);
  padding: clamp(1.1rem, 4vw, 2rem) clamp(1.25rem, 6vw, 3rem);
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  /* Ensure the menu's gradient covers the full viewport to avoid revealing the page background
     when users scroll. Allow the menu to scroll internally on smaller devices. */
  min-height: 100vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.status-indicator {
  display: inline-flex;
  align-self: flex-end;
  align-items: center;
  gap: 0.45rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
}

.status-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.25);
}

.status-dot-online {
  background: #2ad16a;
  box-shadow: 0 0 0 3px rgba(42, 209, 106, 0.45);
}

h1#greeting {
  margin: 0;
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.time-row {
  display: grid;
  gap: clamp(1.1rem, 5vw, 3rem);
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  font-weight: 600;
  color: rgba(255, 255, 255, 0.95);
}

.time-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.time-card-date-body {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
}

.flight-widget {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 0.85rem 0.65rem 1.1rem;
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);
  color: rgba(255, 255, 255, 0.9);
  contain: content;
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 11rem;
  --flight-widget-accent: rgba(255, 255, 255, 0.45);
}

.flight-widgets-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.flight-widget:not([hidden]) {
  cursor: pointer;
}

.flight-widget-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.78;
}

.flight-widget-main {
  display: inline-flex;
  align-items: baseline;
  gap: 0.25rem;
  font-size: 1.05rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.flight-widget-flight {
  word-break: break-word;
}

.flight-widget-destination {
  opacity: 0.9;
}

.flight-widget-separator {
  opacity: 0.6;
}

.flight-widget[data-has-destination="false"] .flight-widget-separator {
  display: none;
}

.flight-widget-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem 0.6rem;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.85;
}

.flight-widget-countdown {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--flight-widget-accent);
}

.flight-widget[data-status="ok"] {
  --flight-widget-accent: #2ad16a;
}

.flight-widget[data-status="warning"] {
  --flight-widget-accent: #f7c948;
}

.flight-widget[data-status="critical"] {
  --flight-widget-accent: #ff6b6b;
}

.flight-widget[data-status="idle"] {
  --flight-widget-accent: rgba(255, 255, 255, 0.6);
}

.flight-widget-desktop {
  display: none;
}

.flight-widget-mobile {
  flex: 0 1 auto;
}

.time-label {
  display: block;
  font-size: 0.72rem;
  opacity: 0.72;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.time-value {
  display: block;
  font-size: clamp(1.25rem, 5vw, 2.1rem);
  margin-top: 0.2rem;
  font-weight: 700;
}

.weather-banner {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 1rem;
  padding: clamp(0.95rem, 4vw, 1.3rem);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(6px);
}

.weather-primary {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.weather-temp {
  font-size: clamp(2rem, 6vw, 2.8rem);
  font-weight: 700;
  margin: 0;
}

.weather-condition {
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  opacity: 0.85;
}

.weather-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  opacity: 0.8;
}

.weather-meta span {
  white-space: nowrap;
}

.weather-forecast {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.5rem;
  font-size: 0.8rem;
}

.weather-forecast[data-empty-forecast="true"] {
  display: block;
}

.weather-forecast-item {
  display: grid;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 0.7rem;
  padding: 0.4rem 0.55rem;
  gap: 0.15rem;
}

.weather-forecast-time {
  font-weight: 600;
  opacity: 0.85;
}

.weather-forecast-condition {
  opacity: 0.75;
}

.weather-forecast-temp {
  font-weight: 600;
  justify-self: start;
}

.weather-forecast-placeholder {
  display: inline-block;
  opacity: 0.75;
}

@media (min-width: 768px) {
  .weather-forecast {
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    font-size: 0.85rem;
  }
}

@media (min-width: 1024px) {
  .weather-forecast {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    font-size: 0.9rem;
  }
  #desktop-widgets-container {
    flex-direction: row;
    align-items: flex-start;
    gap: 1.5rem;
  }
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: clamp(1rem, 4vw, 1.6rem);
}

.action-card {
  border: none;
  border-radius: 1rem;
  padding: clamp(1rem, 4vw, 1.4rem);
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  text-align: left;
  display: grid;
  gap: 0.35rem;
  box-shadow: 0 18px 35px rgba(0, 0, 0, 0.18);
  cursor: pointer;  
  transition: transform 0.2s ease, background 0.2s ease;
  will-change: transform;
  backdrop-filter: blur(6px);
}

.action-card:active {
  transform: translateY(3px);
}

.action-title {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.action-description {
  font-size: 0.9rem;
  opacity: 0.8;
  line-height: 1.35;
}

.import-status {
  margin-top: 0.75rem;
  max-width: 40ch;
  color: rgba(255, 255, 255, 0.92);
}

body.theme-dark .import-status {
  color: rgba(255, 255, 255, 0.82);
}

.import-status[data-tone="error"] {
  color: #ffe5e7;
}

.import-status[data-tone="success"] {
  color: #d0ffe2;
}


.settings-button {
  margin-top: auto;
  align-self: flex-start;
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.4rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #d71920;
  background: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform 0.18s ease;
  will-change: transform;
}

.settings-button:active {
  transform: translateY(2px);
}

.settings-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: clamp(1.2rem, 4vw, 2rem) clamp(1.25rem, 6vw, 3rem);
  background: linear-gradient(135deg, var(--banner-start), var(--banner-end));
  color: rgba(255, 255, 255, 0.96);
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.back-button {
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1.3rem;
  font-size: 0.95rem;
  font-weight: 600;
  background: linear-gradient(135deg, var(--jet-red-700), var(--jet-red-600));
  color: #fff;
  box-shadow: 0 15px 30px rgba(215, 25, 32, 0.25);
  cursor: pointer;  
  transition: transform 0.18s ease;
  will-change: transform;
}

.back-button:active {
  transform: translateY(2px);
}

.settings-header h2 {
  margin: 0;
  font-size: clamp(1.2rem, 4vw, 1.6rem);
  font-weight: 700;
  color: inherit;
}

.settings-content {
  display: grid;
  gap: 1.4rem;
  background: var(--panel-bg);
  border-radius: 1.5rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(215, 25, 32, 0.22);
  color: var(--text-primary);
}

.settings-group {
  display: grid;
  gap: 0.6rem;
}

.settings-helper-text {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.settings-group label,
.settings-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.settings-group input[type="text"] {
  border: 1px solid rgba(215, 25, 32, 0.18);
  border-radius: 0.8rem;
  padding: 0.75rem 0.95rem;
  font: inherit;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.92);
}

.settings-group input[type="text"]::placeholder {
  color: var(--text-muted);
}

.settings-group input[type="text"]:focus {
  outline: none;
  border-color: var(--jet-red-600);
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.22);
}

.flight-lookup-status {
  margin-top: 0.35rem;
  font-size: 0.8rem;
  line-height: 1.3;
  color: var(--text-muted);
  min-height: 1.1rem;
}

.flight-lookup-status[data-tone="info"] {
  color: var(--text-secondary);
}

.flight-lookup-status[data-tone="success"] {
  color: #1f7a4d;
}

.flight-lookup-status[data-tone="warning"] {
  color: #a66b05;
}

.flight-lookup-status[data-tone="error"] {
  color: var(--jet-red-700);
}

body.theme-dark .flight-lookup-status[data-tone="success"] {
  color: #6bd6a0;
}

body.theme-dark .flight-lookup-status[data-tone="warning"] {
  color: #f5c46b;
}

body.theme-dark .flight-lookup-status[data-tone="error"] {
  color: #ff9095;
}

.theme-toggle {
  display: inline-flex;
  gap: 0.75rem;
  background: var(--toggle-track);
  padding: 0.45rem;
  border-radius: 999px;
}

.theme-toggle label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.95rem;
  color: var(--text-secondary);
  position: relative;
  transition: color 0.18s ease;
}

.theme-toggle input {
  display: none;
}

.theme-toggle input:checked + span {
  background: linear-gradient(135deg, var(--jet-red-600), var(--jet-red-700));
  color: #fff;
  font-weight: 700;
  padding: 0.3rem 0.9rem;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(215, 25, 32, 0.3);
}

.app-meta {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.9rem;
}

.app-meta div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.app-meta dt {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin: 0;
}

.app-meta dd {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.danger-button {
  justify-self: start;
  border: none;
  border-radius: 0.8rem;
  padding: 0.65rem 1.1rem;
  background: rgba(215, 25, 32, 0.12);
  color: var(--jet-red-700);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.danger-button:active {
  transform: translateY(1px);
}

.danger-button:hover {
  background: rgba(215, 25, 32, 0.2);
}

body.theme-dark .settings-group input[type="text"] {
  background: rgba(26, 4, 5, 0.85);
}

body.theme-dark .settings-button {
  background: #2c0606;
  color: #ffd6d8;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.55);
}

body.theme-dark .settings-content {
  background: rgba(42, 6, 8, 0.92);
}

body.theme-dark .danger-button {
  background: rgba(215, 25, 32, 0.18);
  color: #ffb9bd;
}

body.theme-dark .danger-button:hover {
  background: rgba(215, 25, 32, 0.28);
}

[hidden] {
  display: none !important;
}

@media (max-width: 600px) {
  .menu-screen {
    min-height: auto;
    padding-bottom: clamp(1.3rem, 6vw, 2.4rem);
  }

  .time-row {
    grid-template-columns: 1fr;
    gap: 1.4rem;
  }

  .time-card-date-body {
    flex-wrap: wrap;
    gap: 0.6rem;
  }

  .flight-widget {
    min-width: min(100%, 14.5rem);
  }

  .settings-view {
    padding: clamp(1rem, 4vw, 1.6rem);
  }

  .settings-content {
    border-radius: 1.25rem;
  }
}

@media (min-width: 640px) {
  .flight-widget-desktop {
    display: flex;
  }

  .flight-widget-mobile {
    display: none;
  }
}
#modal-layer[hidden] {
  display: none !important;
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 10, 26, 0.55);
  backdrop-filter: blur(3px);
  cursor: default;
}

.modal-layer.log-viewer-active {
  align-items: flex-start;
  padding-top: clamp(2rem, 6vh, 4rem);
}

.modal-container {
  position: relative;
  width: min(420px, 100%);
  background: var(--panel-bg);
  border-radius: 1rem;
  padding: clamp(1.2rem, 4vw, 1.6rem);
  box-shadow: var(--shadow-soft);
  color: var(--text-primary);
  contain: content;
}

.history-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.history-search-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-primary);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.history-search-input:focus {
  outline: none;
  border-color: var(--jet-red-600);
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.18);
}

body.theme-dark .history-search-input {
  background: rgba(12, 19, 36, 0.9);
  border-color: rgba(255, 247, 250, 0.18);
  color: rgba(255, 255, 255, 0.94);
}

.history-filter-group {
  display: flex;
  gap: 0.5rem;
  background: var(--toggle-track);
  padding: 0.35rem;
  border-radius: 999px;
  overflow-x: auto;
}

.history-filter-button {
  flex: 1 1 auto;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.history-filter-button.active {
  background: var(--panel-bg);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(12, 17, 43, 0.1);
}

body.theme-dark .history-filter-button.active {
  background: rgba(42, 6, 8, 0.92);
}

.modal-history {
  max-height: 60vh;
  overflow-y: scroll;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  /* Add some padding to the container */
  margin: 0 -0.5rem;
  padding: 0 0.5rem;
}

.modal-history-empty {
  padding: 1rem;
  text-align: center;
  color: var(--text-muted);
}

.modal-history-item {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
  background-color: rgba(16, 38, 63, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 0.85rem;
  transition: background-color 0.2s ease;
}

.modal-history-item:hover {
  background-color: rgba(16, 38, 63, 0.08);
}

.modal-history-restore {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  color: inherit;
  border-radius: 0.85rem 0 0 0.85rem;
}

.modal-history-restore:focus-visible {
  outline: 2px solid var(--jet-red-600);
  outline-offset: -2px;
}

.modal-history-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
}

.modal-history-detail {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.modal-history-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.modal-history-clear {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0 1rem;
  cursor: pointer;
  border-left: 1px solid var(--border-subtle);
}

.app-modal {
  display: none;
}

.app-modal:not([hidden]) {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.app-modal h2 {
  margin: 0;
  font-size: clamp(1.25rem, 4.5vw, 1.4rem);
}

.app-modal p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.5;
}

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

.modal-actions button {
  cursor: pointer;
  border-radius: 999px;
  padding: 0.55rem 1.1rem;
  font-weight: 600;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: inherit;
}

.modal-actions button:focus {
  outline: 2px solid rgba(13, 27, 42, 0.15);
  outline-offset: 2px;
}

.modal-actions button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--text-muted);
  color: var(--text-primary);
  border-color: transparent;
}

.modal-actions .primary-action {
  background: var(--jet-red-600);
  border-color: var(--jet-red-600);
  color: #fff;
}

.modal-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--border-subtle);
  border-radius: 0.85rem;
  padding: 0.7rem 0.9rem;
  font: inherit;
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-primary);
  resize: vertical;
}

.modal-textarea:focus {
  outline: 2px solid rgba(13, 27, 42, 0.18);
  outline-offset: 2px;
}

body.theme-dark .modal-textarea {
  background: rgba(12, 19, 36, 0.92);
  border-color: rgba(255, 247, 250, 0.18);
  color: rgba(255, 255, 255, 0.94);
}

.modal-footnote {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.modal-instructions {
  display: grid;
  gap: 1rem;
  padding: 0.25rem 0;
}

.modal-instructions h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text-primary);
}

.modal-instructions ol {
  margin: 0.4rem 0 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.35rem;
  color: var(--text-secondary);
}

.modal-instructions em {
  font-style: normal;
  font-weight: 600;
}

.share-qr-preview {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.share-qr-output {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 1rem;
  border: 1px solid var(--border-subtle);
  min-height: 220px;
  width: min(320px, 100%);
}

body.theme-dark .share-qr-output {
  background: rgba(12, 19, 36, 0.92);
  border-color: rgba(255, 247, 250, 0.18);
}

.share-qr-output canvas,
.share-qr-output img {
  width: min(260px, 100%);
  height: auto;
}

.share-qr-output table {
  display: none;
}

.qr-scanner-frame {
  position: relative;
  width: min(320px, 100%);
  aspect-ratio: 3 / 4;
  background: rgba(12, 19, 36, 0.9);
  border-radius: 1.2rem;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-scanner-frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.qr-scanner-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 2px dashed rgba(255, 255, 255, 0.55);
  border-radius: 1rem;
  box-shadow: inset 0 0 0 999rem rgba(12, 19, 36, 0.35);
}

.qr-status {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-align: center;
}

.qr-status[data-tone="error"] {
  color: var(--jet-red-600);
}

.qr-status[data-tone="success"] {
  color: var(--jet-red-700);
}

.log-viewer-filters {
  display: flex;
  gap: 0.5rem;
  background: var(--toggle-track);
  padding: 0.35rem;
  border-radius: 999px;
  overflow-x: auto;
}

.log-filter-button {
  flex: 1 1 auto;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.log-filter-button.active {
  background: var(--panel-bg);
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(12, 17, 43, 0.1);
}

body.theme-dark .log-filter-button.active {
  background: rgba(42, 6, 8, 0.92);
}

.log-viewer-content {
  max-height: 60vh;
  overflow-y: auto;
  background-color: rgba(16, 38, 63, 0.04);
  border-radius: 0.85rem;
  padding: 0.75rem;
  font-family: "SF Mono", "Consolas", "Menlo", monospace;
  font-size: 0.8rem;
  line-height: 1.45;
  border: 1px solid var(--border-subtle);
}

body.theme-dark .log-viewer-content {
  background-color: rgba(42, 6, 8, 0.32);
  border-color: rgba(255, 247, 250, 0.2);
}

.log-entry {
  display: flex;
  gap: 0.75rem;
  padding: 0.35rem 0.5rem;
  border-left: 3px solid var(--text-muted);
  margin-bottom: 0.35rem;
  border-radius: 0 0.4rem 0.4rem 0;
}

.log-entry[data-level="info"] {
  border-left-color: #3b82f6;
}

.log-entry[data-level="warn"] {
  border-left-color: #f59e0b;
  background-color: rgba(245, 158, 11, 0.08);
}

.log-entry[data-level="error"] {
  border-left-color: var(--jet-red-600);
  background-color: rgba(215, 25, 32, 0.06);
}

.log-time {
  color: var(--text-muted);
  flex-shrink: 0;
}

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

.log-message {
  word-break: break-word;
}

.log-data-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--text-secondary);
}

.log-data-details pre {
  margin: 0.5rem 0 0;
  padding: 0.5rem;
  background: rgba(16, 38, 63, 0.05);
  border-radius: 0.5rem;
  white-space: pre-wrap;
  word-break: break-all;
}

.qr-fallback {
  display: grid;
  gap: 0.8rem;
}

/* =========================
   WORKFLOW PLACEHOLDERS
   ========================= */

.generic-workflow-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 3vh, 1.6rem);
  padding: clamp(1.2rem, 4vw, 2.4rem);
  background: var(--base-bg);
  color: var(--text-primary);
}

.generic-workflow-shell {
  display: flex;
  justify-content: center;
  width: 100%;
}

.generic-workflow-card {
  width: 100%;
  display: grid;
  gap: clamp(1.1rem, 3vw, 1.6rem);
  padding: clamp(1.3rem, 3vw, 2rem);
  background: var(--panel-bg);
  border-radius: 1.5rem;
  border: 1px solid var(--border-subtle);
  contain: content;
  box-shadow: var(--shadow-soft);
}

body.theme-dark .generic-workflow-card {
  box-shadow: var(--shadow-soft);
}

.generic-workflow-card .panel-note {
  margin: 0;
}

/* =========================
   HOLD WEIGHT PAGE STYLES
   ========================= */

.hold-weight-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 3vh, 1.8rem);
  padding: clamp(1.2rem, 4vw, 2.4rem) clamp(1.25rem, 6vw, 3.2rem);
  background: linear-gradient(135deg, var(--banner-start), var(--banner-end));
  color: rgba(255, 255, 255, 0.96);
}

.workflow-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
  margin: 0;
}

.workflow-title-group {
  display: flex;
  flex: 1 1 0;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.workflow-title-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  flex: 1;
  text-align: center;
  margin: 0;
  min-width: 0;
}
.workflow-flight-summary {
  display: block;
  font-size: clamp(1.3rem, 3.5vw, 1.7rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0; /* Hidden until it has content */
  transition: opacity 0.2s ease;
}

.workflow-header h2 {
  margin: 0;
  font-size: clamp(1.3rem, 3.5vw, 1.7rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  color: inherit;
}

@media (min-width: 768px) {
  .workflow-title-main {
    flex-direction: column;
    gap: 0.2rem;
  }

}

.workflow-flight-summary:not(:empty) {
  opacity: 1;
}
.hold-weight-shell {
  display: flex;
  justify-content: center;
  width: 100%;
}

.hold-weight-card.card {
  width: 100%;
  display: grid;
  gap: clamp(1.4rem, 3.5vw, 2rem);
  padding: clamp(1.4rem, 3.5vw, 2.3rem);
  background: var(--panel-bg);
  border-radius: 1.5rem;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-raised);
  backdrop-filter: blur(14px);
  contain: content;
  color: var(--text-primary);
}

.hold-weight-card .tabs {
  margin: 0 calc(-1 * clamp(1.4rem, 3.5vw, 2.3rem));
  padding-inline: clamp(1.4rem, 3.5vw, 2.3rem);
}

.hold-weight-card .tabs::before,
.hold-weight-card .tabs::after {
  display: none;
}

body.theme-dark .hold-weight-card.card {
  background: rgba(42, 6, 8, 0.92);
  border-color: rgba(255, 247, 250, 0.18);
  box-shadow: var(--shadow-soft);
  backdrop-filter: none;
}

.workflow-form {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.workflow-form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.workflow-field-inline {
  display: flex;
  align-items: stretch;
  gap: 0.5rem;
}

.workflow-field-inline input[type="date"] {
  flex: 1 1 auto;
}

.workflow-field-inline .today-button {
  flex: 0 0 auto;
  padding: 0.55rem 0.9rem;
  font-size: 0.9rem;
  white-space: nowrap;
}

.workflow-form label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.workflow-form input {
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-primary);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.workflow-form input:focus {
  outline: none;
  border-color: var(--jet-red-600);
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.18);
}

body.theme-dark .workflow-form input {
  background: rgba(12, 19, 36, 0.9);
  border-color: rgba(255, 247, 250, 0.18);
  color: rgba(255, 255, 255, 0.94);
}

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

.multi-input-item {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1 1 0;
}
.prm-breakdown-row {
  justify-content: flex-start;
  gap: 0.5rem;
}

.prm-breakdown-row .multi-input-item {
  flex-grow: 0;
}

.constrained-input-row input,
.constrained-input-row select,
.constrained-input-row .choice-toggle {
  max-width: 20rem;
}

.padded-bottom-row {
  padding-bottom: 0.75rem;
}

.padded-top-row {
  padding-top: 0.75rem;
}


.multi-input-item label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}
.prm-breakdown-row .multi-input-item input {
  max-width: 2.25rem;
}

.multi-input-item input {
  text-align: center;
  font-weight: 700;
}

.timing-entry-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem;
  border-radius: 1rem;
  background: rgba(16, 38, 63, 0.04);
  border: 1px solid var(--border-subtle);
}

body.theme-dark .timing-entry-row {
  background-color: rgba(42, 6, 8, 0.32);
  border-color: rgba(255, 247, 250, 0.2);
}

.timing-entry-main {
  flex: 1 1 auto;
  display: grid;
  gap: 0.6rem;
  min-width: 0;
}

.timing-entry-label {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.timing-entry-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.6rem 0.8rem;
}

.timing-entry-row .workflow-field-inline {
  align-items: center;
  gap: 0.4rem;
}

.timing-entry-row .workflow-field-inline label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.timing-entry-row .workflow-field-inline input[type="time"] {
  flex: 1 1 auto;
  min-width: 90px;
}

.timing-entry-row .now-button {
  flex-shrink: 0;
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
}

.timing-entry-na {
  flex-shrink: 0;
  display: flex;
  padding-top: 0.25rem; /* Add some padding to align with the main label */
  align-items: center;
  gap: 0.4rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border-subtle);
}

body.theme-dark .timing-entry-na {
  border-left-color: rgba(255, 247, 250, 0.2);
}

.timing-entry-na label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.timing-entry-na input[type="checkbox"] {
  width: 1.1rem;
  height: 1.1rem;
  cursor: pointer;
}

.timing-entry-row[data-na="true"] .timing-entry-main {
  opacity: 0.5;
  pointer-events: none;
}

.timing-entry-row[data-na="true"] .timing-entry-label {
  text-decoration: line-through;
}

.timing-entry-row[data-na="true"] .workflow-field-inline input[type="time"] {
  background-color: var(--toggle-track);
}


.clear-button {
  padding: 0.3rem;
  font-size: 1.1rem;
  line-height: 1;
  min-width: 2rem;
  border-radius: 0.5rem;
  color: var(--text-muted);
  border-color: transparent;
}

.radio-summary {
  display: grid;
  gap: 1.2rem;
  padding: 0.5rem;
}

.radio-summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  border-left: 3px solid var(--jet-red-600);
  padding-left: 0.8rem;
}

.radio-summary-item.is-valid {
  border-left-color: #2ad16a;
}

.radio-summary-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.radio-summary-value {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-primary);
  min-height: 1.2rem; /* Prevents layout shift when empty */
}

.workflow-form select {
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 0.65rem 2.3rem 0.65rem 0.85rem;
  width: 100%;
  min-height: 2.75rem;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-primary);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-secondary) 50%),
    linear-gradient(135deg, var(--text-secondary) 50%, transparent 50%);
  background-position: calc(100% - 1.45rem) 50%, calc(100% - 1rem) 50%;
  background-size: 8px 8px, 8px 8px;
  background-repeat: no-repeat;
}

.workflow-form select:focus {
  outline: none;
  border-color: var(--jet-red-600);
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.18);
}

body.theme-dark .workflow-form select {
  background: rgba(12, 19, 36, 0.9);
  border-color: rgba(255, 247, 250, 0.18);
  color: rgba(255, 255, 255, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
body.theme-dark .workflow-form select option {
  background-color: rgba(12, 19, 36, 0.94); /* Or a more specific dark variable */
  color: rgba(255, 255, 255, 0.92);
}

.workflow-form select option[disabled] {
  color: var(--text-muted);
}

body.theme-dark #departure-aircraft-type option[disabled],
body.theme-dark #turnaround-aircraft-type option[disabled] {
  color: rgba(255, 247, 250, 0.65);
}

.workflow-form .choice-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.workflow-form .choice-toggle label {
  flex: 1 1 auto;
  position: relative;
  display: block;
  color: var(--text-secondary);
}

.workflow-form .choice-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.workflow-form .choice-toggle span {
  display: block;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.96);
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
}

.workflow-form .choice-toggle input:checked + span {
  background: var(--tab-active-bg, rgba(215, 25, 32, 0.12));
  color: var(--tab-active-color, var(--jet-red-700));
  border-color: var(--tab-active-border, var(--jet-red-600));
  box-shadow: var(--tab-active-shadow, inset 0 0 0 2px rgba(215, 25, 32, 0.24));
}

.workflow-form .choice-toggle input:focus-visible + span {
  outline: none;
  border-color: var(--jet-red-600);
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.18);
}

body.theme-dark .workflow-form .choice-toggle span {
  background: rgba(12, 19, 36, 0.9);
}

.workflow-form-row.field-required label::after {
  content: " *";
  color: var(--jet-red-600);
  font-weight: 600;
}

.workflow-form .input-missing-required {
  border-color: var(--jet-red-600) !important;
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.24) !important;
}

body.theme-dark .workflow-form .input-missing-required {
  border-color: rgba(255, 185, 189, 0.9) !important;
  box-shadow: 0 0 0 3px rgba(255, 185, 189, 0.22) !important;
}

/* Tabs */
.tabs {
  --tab-bg: rgba(255, 255, 255, 0.96);
  --tab-text: var(--text-secondary);
  --tab-shadow: 0 12px 28px rgba(12, 17, 43, 0.12);
  --tab-shadow-hover: 0 16px 34px rgba(12, 17, 43, 0.16);
  --tab-focus-ring: 0 0 0 4px rgba(215, 25, 32, 0.22), 0 12px 28px rgba(12, 17, 43, 0.12);
  --tab-active-bg: rgba(215, 25, 32, 0.12);
  --tab-active-color: var(--jet-red-700);
  --tab-active-border: var(--jet-red-600);
  --tab-active-shadow: inset 0 0 0 2px rgba(215, 25, 32, 0.24);
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.75rem;
  margin: 0 -1.3rem; /* Counteract parent padding */
}

.tabs::-webkit-scrollbar {
  display: none; /* Hide scrollbar for a cleaner look */
}

.tabs::before,
.tabs::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5rem;
  pointer-events: none;
  z-index: 1;
}
.tabs::before {
  left: 0;
}
.tab-button {
  box-sizing: border-box;
  flex: 0 0 auto;
  min-height: 3.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.4rem;
  border: 2px solid transparent;
  border-radius: 1.8rem;
  background: var(--tab-bg, rgba(255, 255, 255, 0.96));
  color: var(--tab-text, var(--text-secondary));
  font-size: clamp(1rem, 2.6vw, 1.15rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  white-space: nowrap;
  box-shadow: var(--tab-shadow, 0 12px 28px rgba(12, 17, 43, 0.12));
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.tab-button[disabled],
.tab-button[aria-disabled="true"] {
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.55);
  color: rgba(60, 70, 90, 0.45);
  border-color: transparent;
  box-shadow: none;
  transform: none;
  opacity: 0.65;
}
.tab-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--tab-shadow-hover, 0 16px 34px rgba(12, 17, 43, 0.16));
}
.tab-button:focus-visible {
  outline: none;
  border-color: var(--tab-active-border, var(--jet-red-600));
  box-shadow: var(--tab-focus-ring, 0 0 0 4px rgba(215, 25, 32, 0.22), 0 12px 28px rgba(12, 17, 43, 0.12));
}
.tab-button.active,
.tab-button[aria-selected="true"] {
  background: var(--tab-active-bg, rgba(215, 25, 32, 0.12));
  color: var(--tab-active-color, var(--jet-red-700));
  border-color: var(--tab-active-border, var(--jet-red-600));
  box-shadow: var(--tab-active-shadow, inset 0 0 0 2px rgba(215, 25, 32, 0.24));
  transform: none;
}
body.theme-dark .tabs {
  --tab-bg: rgba(26, 4, 5, 0.92);
  --tab-text: rgba(255, 247, 250, 0.85);
  --tab-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  --tab-shadow-hover: 0 16px 36px rgba(0, 0, 0, 0.55);
  --tab-focus-ring: 0 0 0 4px rgba(215, 25, 32, 0.32), 0 12px 28px rgba(0, 0, 0, 0.45);
  --tab-active-bg: rgba(215, 25, 32, 0.32);
  --tab-active-color: #fff;
  --tab-active-border: rgba(255, 185, 189, 0.85);
  --tab-active-shadow: inset 0 0 0 2px rgba(255, 185, 189, 0.4);
}
body.theme-dark .tab-button[disabled],
body.theme-dark .tab-button[aria-disabled="true"] {
  background: rgba(26, 4, 5, 0.35);
  color: rgba(255, 247, 250, 0.45);
  border-color: rgba(255, 247, 250, 0.08);
}

/* Panels */
.tab-panel {
  display: grid;
  gap: clamp(1rem, 2.5vw, 1.4rem);
}
.tab-panel[hidden] {
  display: none !important;
}

/* Totals + form styling */
#totals-panel > div,
.additional-items .additional-item-row {
  display: grid;
  gap: 0.4rem;
}

#totals-panel label,
.additional-items label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
}

#totals-panel input[type="text"],
#totals-panel select,
.additional-items select,
.additional-items input[type="text"] {
  border: 1px solid var(--border-subtle);
  border-radius: 0.85rem;
  padding: 0.75rem 1rem;
  font: inherit;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
#totals-panel input[type="text"]:focus,
#totals-panel select:focus,
.additional-items select:focus,
.additional-items input[type="text"]:focus {
  outline: none;
  border-color: var(--jet-red-600);
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.18);
}
#totals-panel input[type="text"]::placeholder,
.additional-items input[type="text"]::placeholder {
  color: var(--text-muted);
}
body.theme-dark #totals-panel input[type="text"],
body.theme-dark #totals-panel select,
body.theme-dark .additional-items select,
body.theme-dark .additional-items input[type="text"] {
  background: rgba(26, 4, 5, 0.85);
  color: var(--text-primary);
  border-color: rgba(255, 247, 250, 0.2);
}

.hold-weight-card.card .input-invalid,
.hold-weight-card.card [aria-invalid="true"] {
  border-color: rgba(215, 25, 32, 0.8) !important;
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.18);
  background: rgba(240, 90, 102, 0.08);
}
body.theme-dark .hold-weight-card.card .input-invalid,
body.theme-dark .hold-weight-card.card [aria-invalid="true"] {
  border-color: rgba(255, 185, 189, 0.85) !important;
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.32);
  background: rgba(215, 25, 32, 0.22);
  color: inherit;
}

.additional-items {
  margin-top: 0.5rem;
  padding: 1rem;
  border-radius: 1.1rem;
  background: rgba(16, 38, 63, 0.05);
  border: 1px solid var(--border-subtle);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
body.theme-dark .additional-items {
  background: rgba(42, 6, 8, 0.35);
  box-shadow: none;
}

.additional-item-row--header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.misc-heading strong {
  font-size: 0.95rem;
}
.panel-note.soft {
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.tertiary-button {
  border: 1px dashed var(--border-subtle);
  background: transparent;
  color: var(--jet-red-700);
  padding: 0.6rem 1rem;
  border-radius: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.tertiary-button:hover {
  color: var(--jet-red-600);
  border-color: var(--jet-red-600);
}
.tertiary-button:active {
  transform: translateY(1px);
}
body.theme-dark .tertiary-button {
  color: #ffb9bd;
  border-color: rgba(255, 247, 250, 0.3);
}

#emd-weights-container,
#misc-items-container {
  display: grid;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

#emd-count {
  margin-top: 0.5rem;
}

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

.emd-weight-row label {
  flex: 1 1 220px;
}

.emd-weight-row input {
  flex: 0 0 160px;
  max-width: 200px;
}

.misc-item-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) minmax(110px, 0.9fr) minmax(100px, 0.7fr) auto;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--border-subtle);
  border-radius: 0.85rem;
  padding: 0.75rem;
  background: rgba(16, 38, 63, 0.03);
  box-sizing: border-box;
}

.misc-item-row input {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

body.theme-dark .misc-item-row {
  background: rgba(42, 6, 8, 0.42);
  border-color: rgba(255, 247, 250, 0.18);
}

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

/* Stat pill + warnings */
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(16, 38, 63, 0.06);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 0.4rem 0.95rem;
  width: max-content;
}
body.theme-dark .stat-pill {
  background: rgba(42, 6, 8, 0.4);
}

.panel-note {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.panel-note.warning {
  color: var(--jet-red-700);
  font-weight: 700;
}
.panel-note.warning.critical {
  color: var(--jet-red-600);
}

/* Actions */
.view-actions {
  display: flex;
  justify-content: flex-end;
}
.secondary-button,
.primary-button,
.back-button {
  border: none;
  border-radius: 999px;
  padding: 0.65rem 1.25rem;
  font-weight: 700;
  cursor: pointer;  
  transition: transform 0.15s ease, box-shadow 0.2s ease, filter 0.15s ease;
  will-change: transform;
}
.secondary-button {
  background: rgba(16, 38, 63, 0.08);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}
.secondary-button:hover {
  background: rgba(16, 38, 63, 0.12);
}
.primary-button {
  background: linear-gradient(135deg, var(--jet-red-600), var(--jet-red-700));
  color: #fff;
  box-shadow: 0 12px 28px rgba(215, 25, 32, 0.28);
}
.primary-button:hover {
  filter: brightness(1.02);
}
.back-button:hover {
  filter: brightness(1.03);
}
.primary-button:active,
.secondary-button:active,
.back-button:active {
  transform: translateY(1px);
}

/* Distribution layout */
.distribution-layout {
  display: grid;
  gap: clamp(1rem, 3vw, 1.5rem);
}
.distribution-layout > * {
  min-width: 0;
}
@media (min-width: 980px) {
  .distribution-layout {
    grid-template-columns: minmax(340px, 0.95fr) 1fr;
    align-items: start;
  }
}

.distribution-sidebar {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

.distribution-sidebar select {
  border: 1px solid var(--border-subtle);
  border-radius: 0.85rem;
  padding: 0.75rem 1rem;
  font: inherit;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.distribution-sidebar select:focus-visible {
  outline: none;
  border-color: var(--jet-red-600);
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.18);
}

body.theme-dark .distribution-sidebar select {
  background: rgba(26, 4, 5, 0.85);
  border-color: rgba(255, 247, 250, 0.2);
  color: var(--text-primary);
}

.summary-grid {
  display: grid;
  gap: 0.45rem;
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(16, 38, 63, 0.05);
  border: 1px solid var(--border-subtle);
}
.summary-grid > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
.summary-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.summary-subvalue {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
}

details.aircraft-info {
  border: 1px solid var(--border-subtle);
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  background: var(--panel-bg);
  box-shadow: var(--shadow-soft);
}
details.aircraft-info summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--text-secondary);
}

.distribution-actions {
  display: grid;
  gap: 0.8rem;
}
.distribution-actions > * {
  width: 100%;
}
.distribution-actions .primary-button {
  padding-block: 0.9rem;
  font-size: 1.05rem;
  border-radius: 1rem;
}
.distribution-actions-bottom {
  display: flex;
  justify-content: flex-end;
}

.additional-items-panel {
  display: grid;
  gap: 0.6rem;
  border: 1px dashed var(--border-subtle);
  border-radius: 1.1rem;
  padding: 0.9rem;
  background: rgba(16, 38, 63, 0.04);
}
body.theme-dark .additional-items-panel {
  background: rgba(42, 6, 8, 0.32);
}

.emd-assignment-grid,
.misc-assignment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
}

.emd-assignment-row,
.misc-assignment-row {
  display: grid;
  gap: 0.45rem;
  padding: 0.4rem 0.5rem;
  border-radius: 0.75rem;
  background: rgba(16, 38, 63, 0.05);
  justify-items: start;
}
.emd-assignment-row strong,
.misc-assignment-row strong {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
}
.emd-assignment-row select,
.misc-assignment-row select {
  width: min(180px, 100%);
  padding: 0.65rem 0.75rem;
  border-radius: 0.8rem;
  border: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.96);
  font: inherit;
  color: var(--text-primary);
}

/* Holds area */
.distribution-holds {
  display: grid;
  gap: 0.9rem;
  min-width: 0;
}

#holds-wrapper[hidden] {
  display: none !important;
}

.holds-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  min-width: 0;
}

.holds-grid .card {
  background: var(--panel-bg);
  border: 1px solid var(--border-subtle);
  border-radius: 1.1rem;
  padding: 0.9rem;
  box-shadow: var(--shadow-soft);
}
.holds-grid .hold-card {
  --hold-accent: var(--jet-red-600);
  --hold-accent-soft: rgba(215, 25, 32, 0.12);
  --hold-surface: rgba(16, 38, 63, 0.05);
  --hold-border: rgba(215, 25, 32, 0.18);
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 0.9rem;
  padding: 1.1rem 1.25rem;
  min-width: 0;
  border-radius: 1.35rem;
  border: 1px solid var(--hold-border);
  background:
    radial-gradient(135% 135% at 100% 0%, rgba(215, 25, 32, 0.08), transparent 65%),
    var(--panel-bg);
  box-shadow: var(--shadow-soft);
}

.hold-card-header {
  display: grid;
  gap: 0.6rem;
  align-items: start;
}

.hold-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0;
}

.hold-weight-display {
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 0.35rem;
  padding: 0.85rem 1rem;
  border-radius: 1rem;
  background: var(--hold-surface, rgba(255, 255, 255, 0.96));
  border: 1px solid rgba(215, 25, 32, 0.14);
  min-width: 0;
  justify-self: stretch;
}

.hold-weight-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.hold-weight-display strong {
  font-size: 1.3rem;
  font-weight: 750;
  color: var(--hold-accent);
  line-height: 1;
  letter-spacing: 0.01em;
  justify-self: start;
}

.hold-card-header .remainder-info {
  min-width: 0;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: var(--hold-surface, rgba(255, 255, 255, 0.96));
  border: 1px solid rgba(215, 25, 32, 0.16);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  justify-self: start;
}

.hold-card-header .remainder-info:empty {
  display: none;
}

@media (min-width: 880px) {
  .holds-grid .hold-card {
    padding-right: 1,85;
  }
  .hold-card-header {
    grid-template-columns: minmax(1, 1fr) minmax(200px, 240px);
    gap: 0.4rem 1.25rem;
  }
  .hold-weight-display {
    grid-column: 2 / 3;
    grid-row: 1 / span 2;
    max-width: 240px;
    justify-self: end;
  }
  .hold-weight-display strong {
    font-size: 1.15rem;
  }
  .hold-card-header .remainder-info {
    grid-column: 1 / 2;
    grid-row: 2 / 3;
  }
}

.hold-card-body {
  display: grid;
  gap: 0.55rem;
  align-content: start;
}

.hold-card-body label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.hold-input-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.65rem;
  align-items: end;
}

.hold-input-row input {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.65rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid rgba(215, 25, 32, 0.18);
  border-radius: 0.85rem;
  font: inherit;
  color: var(--text-primary);
  background: var(--hold-surface, rgba(255, 255, 255, 0.96));
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.hold-input-row input:focus-visible {
  outline: none;
  border-color: var(--hold-accent);
  box-shadow: 0 0 0 4px rgba(215, 25, 32, 0.16);
}

.remainder-button {
  justify-self: stretch;
  border: 1px dashed rgba(215, 25, 32, 0.35);
  border-radius: 0.9rem;
  padding: 0.55rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--hold-surface);
  color: var(--hold-accent);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, transform 0.18s ease;
}

.remainder-button:hover:not(:disabled) {
  border-color: var(--hold-accent);
  color: var(--hold-accent);
  background: rgba(215, 25, 32, 0.08);
  transform: translateY(-1px);
}

.remainder-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  border-style: solid;
  background: rgba(16, 38, 63, 0.06);
  color: rgba(215, 25, 32, 0.45);
  transform: none;
}

.remainder-button.active {
  background: linear-gradient(135deg, var(--jet-red-600), var(--jet-red-700));
  border-color: transparent;
  color: #fff;
  box-shadow: 0 12px 26px rgba(215, 25, 32, 0.24);
}

.hold-card-footer {
  display: grid;
  gap: 0.35rem;
}

.hold-special-note {
  display: grid;
  gap: 0.2rem;
  justify-items: end;
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.hold-breakdown {
  font-weight: 600;
  color: var(--hold-accent);
}

.hold-extra-info {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.hold-card.remainder-active {
  border-color: rgba(215, 25, 32, 0.42);
  box-shadow: 0 18px 36px rgba(215, 25, 32, 0.2);
}

/* Error text */
.error {
  color: var(--jet-red-600);
  font-weight: 700;
}

.debug-options {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.debug-button-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.debug-button-grid button {
  border-radius: 0.75rem;
}

/* Dark theme adjustments */
body.theme-dark .secondary-button {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 247, 250, 0.2);
  color: rgba(255, 247, 250, 0.85);
}
body.theme-dark .summary-grid {
  background: rgba(42, 6, 8, 0.4);
}
body.theme-dark details.aircraft-info {
  background: rgba(42, 6, 8, 0.92);
  border-color: rgba(255, 247, 250, 0.18);
}
body.theme-dark .holds-grid .card {
  background: rgba(42, 6, 8, 0.92);
  border-color: rgba(255, 247, 250, 0.18);
}
body.theme-dark .holds-grid .hold-card {
  --hold-accent: #ffb9bd;
  --hold-accent-soft: rgba(255, 185, 189, 0.24);
  --hold-surface: rgba(255, 247, 250, 0.12);
  --hold-border: rgba(255, 185, 189, 0.28);
  background:
    radial-gradient(135% 135% at 100% 0%, rgba(215, 25, 32, 0.24), transparent 65%),
    rgba(42, 6, 8, 0.92);
  border-color: var(--hold-border);
  box-shadow: var(--shadow-soft);
}
body.theme-dark .hold-card-header .remainder-info {
  background: rgba(255, 247, 250, 0.16);
  border-color: rgba(255, 185, 189, 0.28);
  color: rgba(255, 247, 250, 0.85);
}
body.theme-dark .remainder-button {
  border-color: rgba(255, 185, 189, 0.3);
  background: rgba(255, 247, 250, 0.12);
  color: #ffb9bd;
}
body.theme-dark .remainder-button:hover:not(:disabled) {
  border-color: rgba(255, 185, 189, 0.65);
  color: #ffd4d6;
  background: rgba(255, 185, 189, 0.16);
}
body.theme-dark .remainder-button.active {
  box-shadow: 0 12px 32px rgba(215, 25, 32, 0.38);
}
body.theme-dark .hold-weight-display {
  background: rgba(255, 247, 250, 0.12);
  border-color: rgba(255, 185, 189, 0.3);
}
body.theme-dark .hold-weight-display strong {
  color: #ffd4d6;
}
body.theme-dark .hold-input-row input {
  background: rgba(42, 6, 8, 0.85);
  border-color: rgba(255, 185, 189, 0.24);
  color: rgba(255, 247, 250, 0.92);
}
body.theme-dark .hold-input-row input:focus-visible {
  border-color: rgba(255, 185, 189, 0.65);
  box-shadow: 0 0 0 4px rgba(255, 185, 189, 0.24);
}
body.theme-dark .emd-assignment-row,
body.theme-dark .misc-assignment-row {
  background: rgba(255, 247, 250, 0.12);
}
body.theme-dark .emd-assignment-row select,
body.theme-dark .misc-assignment-row select {
  background: rgba(42, 6, 8, 0.85);
  border-color: rgba(255, 185, 189, 0.22);
  color: rgba(255, 247, 250, 0.9);
}
body.theme-dark .hold-special-note {
  color: rgba(255, 247, 250, 0.85);
}
body.theme-dark .hold-extra-info {
  color: rgba(255, 247, 250, 0.65);
}
body.theme-dark .hold-card.remainder-active {
  border-color: rgba(255, 185, 189, 0.55);
  box-shadow: 0 18px 34px rgba(215, 25, 32, 0.32);
}
body.theme-dark .additional-items-panel {
  border-color: rgba(255, 247, 250, 0.2);
}

.workflow-form-textarea {
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-primary);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  resize: vertical;
  min-height: 8rem;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
}


.workflow-form textarea {
  border: 1px solid var(--border-subtle);
  border-radius: 0.75rem;
  padding: 0.65rem 0.85rem;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-primary);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  resize: vertical;
  min-height: 4rem;
}

body.theme-dark .workflow-form textarea {
  background: rgba(12, 19, 36, 0.9);
  border-color: rgba(255, 247, 250, 0.18);
  color: rgba(255, 255, 255, 0.94);
}

/* LMC Tab Styles */
.lmc-section {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.lmc-section:not(:last-child) {
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.2rem;
}

.lmc-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.lmc-section-header h4 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.lmc-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lmc-entry {
  background-color: rgba(16, 38, 63, 0.04);
  border-radius: 1.1rem;
  padding: 1rem;
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lmc-input-row {
  gap: 1rem;
}

.lmc-input-row .multi-input-item {
  flex-grow: 0;
  flex-basis: 7rem;
  min-width: 6rem;
}

/* Delay Report Styles */
.delay-report-summary {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.delay-report-section {
  background-color: rgba(16, 38, 63, 0.04);
  border-radius: 1.1rem;
  padding: 1rem;
  border: 1px solid var(--border-subtle);
}

.delay-report-section h4 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  color: var(--text-secondary);
}

.delay-report-list {
  display: grid;
  gap: 0.5rem;
}

.delay-report-item {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.95rem;
}

.delay-report-label {
  flex: 0 0 10rem;
  max-width: 10rem;
  color: var(--text-muted);
  font-weight: 600;
}

.delay-report-value {
  font-weight: 700;
  color: var(--text-primary);
}

.delay-report-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

/* Image Capture Styles */
.image-capture-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.image-capture-footer {
  margin-top: 0.5rem;
  min-width: 0; /* Allows text to wrap inside flex/grid containers */
}

.image-capture-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.image-capture-indicator {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 4ch;
  text-align: center;
}

.image-capture-viewer {
  position: relative;
  overflow: hidden;
  border-radius: 1.1rem;
  border: 1px solid var(--border-subtle);
  background-color: rgba(16, 38, 63, 0.04);
}

.image-capture-track {
  display: flex;
  transition: transform 0.3s ease-in-out;
}

.image-capture-item {
  flex: 0 0 100%;
  min-width: 0;
  width: 100%;
  position: relative;
}

.image-capture-item img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: contain;
}

.image-capture-item .clear-capture-btn,
.image-capture-preview .clear-capture-btn {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background-color: rgba(13, 27, 42, 0.6);
  color: white;
  border-radius: 999px;
  backdrop-filter: blur(3px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 2; /* Ensure it's above the image */
}

.image-capture-preview {
  position: relative;
  max-width: 100%;
  border-radius: 1.1rem;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background-color: rgba(16, 38, 63, 0.04);
}
/* Delay Entry Styles */
.delay-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-large, 1.2rem);
  margin-bottom: var(--spacing-large, 1.2rem);
}

.delay-entry {
  background-color: rgba(16, 38, 63, 0.04);
  border-radius: 1.1rem;
  padding: var(--spacing-medium, 1rem);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-medium, 1rem);
}

body.theme-dark .delay-entry {
  background-color: rgba(42, 6, 8, 0.32);
  border-color: rgba(255, 247, 250, 0.2);
}

body.theme-dark .delay-report-section {
  background-color: rgba(42, 6, 8, 0.32);
  border-color: rgba(255, 247, 250, 0.2);
}

.delay-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem; /* Added gap for spacing */
  padding-bottom: var(--spacing-small, 0.5rem);
  border-bottom: 1px solid var(--border-subtle);
}

.delay-entry-header strong {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.delay-entry .multi-input-row {
  gap: var(--spacing-medium, 1rem);
}

.delay-entry .multi-input-item label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: left; /* Align label text to the left */
  text-transform: none; /* Remove uppercase transform */
}

.delay-entry .workflow-form-row {
  margin-bottom: 0; /* Override default margin */
}

.delay-note-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.icon-button {
  padding: 0.25rem 0.5rem;
  font-size: 1.2rem;
  line-height: 1;
  min-width: auto;
}

.delay-entry-fields {
  justify-content: flex-start;
}

.delay-entry-fields .multi-input-item {
  flex-grow: 0;
  flex-basis: 6rem;
  min-width: 4rem;
}

@media (max-width: 600px) {
  .hold-weight-view {
    padding: clamp(1rem, 5vw, 1.6rem);
  }
  .tabs {
    width: 100%;
    justify-content: space-between;
  }
  .holds-grid {
    grid-template-columns: 1fr 1fr;
  }
  .summary-grid > span {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.3rem;
  }
}

body.theme-dark .modal-history-item {
  background-color: rgba(42, 6, 8, 0.32);
  border-color: rgba(255, 247, 250, 0.2);
}

body.theme-dark .modal-history-item:hover {
  background-color: rgba(42, 6, 8, 0.5);
}

body.theme-dark .modal-history-clear {
  border-left-color: rgba(255, 247, 250, 0.2);
}

.turnaround-timings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.turnaround-timings-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.flight-widget-time {
  margin-left: auto;
  font-size: 0.9em;
  font-weight: 600;
  opacity: 0.9;
}
