:root {
  color-scheme: dark;
  --bg: #08111f;
  --panel: #111b2d;
  --panel-2: #17243a;
  --text: #e7eefb;
  --muted: #9fb0cc;
  --accent: #4ec7ff;
  --danger: #ff6b6b;
  --success: #5be38d;
  --warning: #ffd166;
  --border: #2a3952;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #12213a, var(--bg) 45%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: rgba(8, 17, 31, 0.82);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  backdrop-filter: blur(10px);
  z-index: 10;
}
.brand {
  color: var(--text);
  font-weight: 800;
  letter-spacing: 0.03em;
}
.site-header nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.container {
  width: min(1180px, calc(100% - 2rem));
  margin: 2rem auto;
}
.footer {
  width: min(1180px, calc(100% - 2rem));
  margin: 3rem auto 2rem;
  color: var(--muted);
  font-size: 0.9rem;
}

h1, h2, h3 { margin-top: 0; }
h1 { font-size: clamp(2rem, 4vw, 3rem); }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.9rem; margin-top: -0.35rem; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.grid {
  display: grid;
  gap: 1.5rem;
}
.two-col { grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr); }
.panel, .auth-card, .summary-card, .hangar-card {
  background: linear-gradient(180deg, rgba(23, 36, 58, 0.94), rgba(17, 27, 45, 0.94));
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.24);
}
.panel { padding: 1.25rem; }
.panel.wide { overflow: hidden; }
.auth-card {
  width: min(460px, 100%);
  margin: 5rem auto;
  padding: 2rem;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 1rem;
}
.summary-grid.compact { min-width: min(520px, 100%); }
.summary-card { padding: 1rem; }
.summary-card span { display: block; color: var(--muted); font-size: 0.9rem; }
.summary-card strong { display: block; margin-top: 0.4rem; font-size: 1.25rem; }

.hangar-list {
  display: grid;
  gap: 0.85rem;
}
.hangar-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  color: var(--text);
}
.hangar-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.hangar-card h3 { margin-bottom: 0.25rem; }
.hangar-stats {
  display: grid;
  gap: 0.25rem;
  text-align: right;
  min-width: 160px;
}

.stacked-form {
  display: grid;
  gap: 1rem;
}
label {
  display: grid;
  gap: 0.4rem;
  color: var(--muted);
  font-weight: 650;
}
input, textarea, select {
  width: 100%;
  padding: 0.78rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0a1424;
  color: var(--text);
  font: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid rgba(78, 199, 255, 0.35);
  border-color: var(--accent);
}
button {
  cursor: pointer;
  border: 0;
  border-radius: 12px;
  padding: 0.78rem 1rem;
  background: var(--accent);
  color: #03111d;
  font-weight: 800;
}
button:hover { filter: brightness(1.08); }
button.danger { background: var(--danger); color: #250000; }
button.small { padding: 0.45rem 0.65rem; font-size: 0.85rem; }
.inline { display: inline; }
.link-button {
  background: transparent;
  color: var(--accent);
  padding: 0;
  border-radius: 0;
  font-weight: 600;
}

.actions-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}
th, td {
  padding: 0.85rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
th {
  color: var(--muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.numeric { text-align: right; }

.flash {
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  margin-bottom: 1rem;
}
.flash-success { border-color: rgba(91, 227, 141, 0.5); background: rgba(91, 227, 141, 0.12); }
.flash-warning { border-color: rgba(255, 209, 102, 0.5); background: rgba(255, 209, 102, 0.12); }
.flash-danger { border-color: rgba(255, 107, 107, 0.5); background: rgba(255, 107, 107, 0.12); }

@media (max-width: 900px) {
  .hero, .two-col { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .hangar-card { flex-direction: column; }
  .hangar-stats { text-align: left; }
}

.top-gap { margin-top: 1.5rem; }
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 1.5rem;
}
.pill {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(23, 36, 58, 0.72);
  color: var(--text);
  font-weight: 700;
}
.pill.active, .pill:hover {
  border-color: var(--accent);
  text-decoration: none;
}
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.panel-heading h2 { margin-bottom: 0; }
.status-list {
  display: grid;
  gap: 0.85rem;
  margin: 0 0 1.25rem;
}
.status-list div {
  display: grid;
  grid-template-columns: minmax(150px, 0.6fr) minmax(0, 1fr);
  gap: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--border);
}
.status-list dt {
  color: var(--muted);
  font-weight: 800;
}
.status-list dd { margin: 0; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.25rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 850;
  border: 1px solid var(--border);
}
.badge-success {
  color: var(--success);
  background: rgba(91, 227, 141, 0.1);
  border-color: rgba(91, 227, 141, 0.35);
}
.badge-warning {
  color: var(--warning);
  background: rgba(255, 209, 102, 0.1);
  border-color: rgba(255, 209, 102, 0.35);
}
.badge-danger {
  color: var(--danger);
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.35);
}
.badge-muted {
  color: var(--muted);
  background: rgba(159, 176, 204, 0.08);
}
.single-col { grid-template-columns: 1fr; }
.event-list {
  display: grid;
  gap: 0.75rem;
}
.event-card {
  display: grid;
  gap: 0.2rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(8, 17, 31, 0.34);
}
.button-stack {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
button.warning {
  background: var(--warning);
  color: #241a00;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.checkbox-label {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 0.55rem;
}
.checkbox-label input {
  width: auto;
}
.reset-details {
  margin-top: 0.55rem;
  color: var(--muted);
}
.reset-details summary {
  cursor: pointer;
  color: var(--accent);
}
.compact-form {
  gap: 0.55rem;
  margin-top: 0.55rem;
}
code {
  display: inline-block;
  max-width: 460px;
  white-space: pre-wrap;
  word-break: break-word;
  color: #dce9ff;
}

@media (max-width: 900px) {
  .status-list div { grid-template-columns: 1fr; gap: 0.25rem; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
}
.danger-text {
  color: var(--danger);
}

.announcement-banner {
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1rem;
  background: rgba(78, 199, 255, 0.12);
}
.announcement-content {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
}
.announcement-content strong { margin-right: 0.2rem; }
.announcement-info, .announcement-preview.announcement-info {
  border-color: rgba(78, 199, 255, 0.55);
  background: rgba(78, 199, 255, 0.12);
}
.announcement-success, .announcement-preview.announcement-success {
  border-color: rgba(91, 227, 141, 0.55);
  background: rgba(91, 227, 141, 0.12);
}
.announcement-warning, .announcement-preview.announcement-warning {
  border-color: rgba(255, 209, 102, 0.55);
  background: rgba(255, 209, 102, 0.14);
}
.announcement-danger, .announcement-preview.announcement-danger {
  border-color: rgba(255, 107, 107, 0.55);
  background: rgba(255, 107, 107, 0.14);
}
.announcement-preview {
  display: grid;
  gap: 0.25rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 1rem;
}

.top-gap-small { margin-top: 0.45rem; }
.row-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 800;
  margin-bottom: 0.45rem;
}
.row-details[open] {
  min-width: 220px;
}

body.modal-open { overflow: hidden; }
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.72);
}
.modal-card {
  width: min(1040px, 100%);
  max-height: min(92vh, 940px);
  overflow: auto;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(23, 36, 58, 0.98), rgba(8, 17, 31, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.42);
}
.scan-actions { margin-bottom: 0.85rem; }
.scan-stage {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}
.scan-stage video,
.scan-stage canvas {
  width: 100%;
  max-height: 560px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #030812;
}
.scan-stage canvas {
  touch-action: none;
  cursor: crosshair;
}
.scan-stage video:not([srcObject]) {
  display: none;
}
.scan-status {
  margin-top: 0.9rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(8, 17, 31, 0.42);
  white-space: pre-wrap;
}
.scan-result {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(8, 17, 31, 0.38);
}
.scan-result pre {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
  padding: 0.75rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #07101e;
}

.readable-panel {
  max-width: 900px;
}
.content-block {
  white-space: pre-wrap;
  line-height: 1.65;
  color: var(--text);
}
.preview-block {
  max-height: 360px;
  overflow: auto;
  padding: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(8, 17, 31, 0.45);
}
.soft-rule {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.25rem 0;
}
.google-sso-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin: 1rem 0;
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}
.google-sso-button:hover { background: rgba(255, 255, 255, 0.13); }
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: var(--muted);
}
.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}

/* Hangar resource page layout improvements */
@media (min-width: 1200px) {
  .container,
  .footer,
  .announcement-content {
    width: min(1540px, calc(100% - 3rem));
  }
}

.hangar-layout {
  grid-template-columns: 1fr;
  align-items: start;
}

.resource-panel {
  width: 100%;
}

.add-resource-panel {
  max-width: 720px;
}

.resource-table-wrap {
  overflow-x: visible;
}

.resource-table-wrap table {
  min-width: 0;
  table-layout: fixed;
}

.resource-table-wrap th,
.resource-table-wrap td {
  overflow-wrap: anywhere;
  word-break: normal;
}

.resource-table-wrap th:nth-child(1),
.resource-table-wrap td:nth-child(1) { width: 19%; }
.resource-table-wrap th:nth-child(2),
.resource-table-wrap td:nth-child(2) { width: 8%; }
.resource-table-wrap th:nth-child(3),
.resource-table-wrap td:nth-child(3) { width: 13%; }
.resource-table-wrap th:nth-child(4),
.resource-table-wrap td:nth-child(4) { width: 13%; }
.resource-table-wrap th:nth-child(5),
.resource-table-wrap td:nth-child(5) { width: 24%; }
.resource-table-wrap th:nth-child(6),
.resource-table-wrap td:nth-child(6) { width: 14%; }
.resource-table-wrap th:nth-child(7),
.resource-table-wrap td:nth-child(7) { width: 9%; }

@media (max-width: 900px) {
  .resource-table-wrap {
    overflow-x: auto;
  }

  .resource-table-wrap table {
    min-width: 860px;
  }

  .add-resource-panel {
    max-width: none;
  }
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin: 0.75rem 0 1rem;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(8, 17, 31, 0.32);
}
.select-column {
  width: 84px;
  text-align: center;
}
.select-column input[type="checkbox"] {
  width: auto;
}
.select-all-label {
  margin-right: auto;
}
