.sxpoh-app {
  --bg: #f4f6f8;
  --panel: #fff;
  --ink: #17212b;
  --muted: #64727f;
  --line: #d8dee6;
  --accent: #146c63;
  --accent-ink: #fff;
  --warn: #8a5b00;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 78vh;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sxpoh-app * {
  box-sizing: border-box;
}

.sxpoh-sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 16px;
  overflow: auto;
}

.sxpoh-brand {
  margin-bottom: 16px;
}

.sxpoh-kicker {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sxpoh-brand h1,
.sxpoh-panel h2 {
  margin: 0;
  line-height: 1.2;
}

.sxpoh-brand h1 {
  font-size: 22px;
}

.sxpoh-panel {
  border-top: 1px solid var(--line);
  padding-top: 14px;
  margin-top: 14px;
}

.sxpoh-panel h2 {
  font-size: 14px;
  margin-bottom: 10px;
}

.sxpoh-lookup label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.sxpoh-inline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.sxpoh-app input,
.sxpoh-app select,
.sxpoh-app button,
.sxpoh-file {
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

.sxpoh-app input,
.sxpoh-app select {
  width: 100%;
  min-width: 0;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
}

.sxpoh-app button,
.sxpoh-file {
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  padding: 9px 12px;
  text-align: center;
  white-space: nowrap;
}

.sxpoh-app button[type="submit"],
.sxpoh-toolbar button {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.sxpoh-app button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.sxpoh-upload {
  display: grid;
  gap: 8px;
}

.sxpoh-file input {
  display: none;
}

.sxpoh-upload-progress {
  background: #eef2f5;
  border: 1px solid var(--line);
  border-radius: 6px;
  height: 9px;
  overflow: hidden;
}

.sxpoh-upload-progress span {
  background: var(--accent);
  display: block;
  height: 100%;
  width: 0%;
}

.sxpoh-upload-log {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  max-height: 150px;
  overflow: auto;
  white-space: pre-wrap;
}

.sxpoh-aircraft-list {
  display: grid;
  gap: 8px;
}

.sxpoh-aircraft {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  text-align: left;
}

.sxpoh-aircraft span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sxpoh-aircraft small {
  color: var(--muted);
}

.sxpoh-source-list {
  display: grid;
  gap: 8px;
}

.sxpoh-source-button {
  display: grid;
  gap: 5px;
  text-align: left;
  white-space: normal;
  width: 100%;
}

.sxpoh-source-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sxpoh-source-button small,
.sxpoh-source-note {
  color: var(--muted);
}

.sxpoh-source-button.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(20, 108, 99, 0.14);
}

.sxpoh-source-open {
  color: var(--accent);
  font-weight: 700;
}

.sxpoh-source-frame {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  height: min(72vh, 760px);
  margin-top: 12px;
  width: 100%;
}

.sxpoh-source-frame-compact {
  height: min(42vh, 460px);
  margin: 0 0 14px;
}

.sxpoh-source-note {
  font-size: 13px;
  line-height: 1.45;
  margin-top: 12px;
}

.sxpoh-status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  margin-top: 14px;
}

.sxpoh-main {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.sxpoh-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 260px) auto;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.sxpoh-content {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  min-height: 0;
}

.sxpoh-results {
  background: #fbfcfd;
  border-right: 1px solid var(--line);
  overflow: auto;
  padding: 12px;
}

.sxpoh-result {
  display: block;
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  margin-bottom: 9px;
  padding: 10px;
  text-align: left;
}

.sxpoh-result.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(20, 108, 99, 0.14);
}

.sxpoh-result:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sxpoh-result-meta,
.sxpoh-page-meta {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 7px;
}

.sxpoh-result mark,
.sxpoh-page mark {
  background: rgba(255, 221, 89, 0.72);
  border-radius: 3px;
  color: inherit;
  padding: 0 2px;
}

.sxpoh-hit-link {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-color: rgba(20, 108, 99, 0.6);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.sxpoh-hit-link:focus mark,
.sxpoh-hit-link:hover mark {
  background: rgba(255, 205, 46, 0.95);
}

.sxpoh-reader {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.sxpoh-reader-head {
  align-items: center;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  margin-bottom: 10px;
}

.sxpoh-reader-head div {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sxpoh-page {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 420px;
  padding: 18px;
}

.sxpoh-page-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.sxpoh-empty {
  color: var(--muted);
  line-height: 1.45;
  padding: 16px;
}

.sxpoh-empty-compact {
  font-size: 13px;
  padding: 0;
}

.sxpoh-login-required {
  background: #fff8e6;
  border: 1px solid #f1d27a;
  border-radius: 8px;
  color: #5f4100;
  padding: 14px;
}

.sxpoh-login-required p {
  margin: 0 0 12px;
}

.sxpoh-login-button {
  align-items: center;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #fff;
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  text-decoration: none;
}

.sxpoh-login-button:focus,
.sxpoh-login-button:hover {
  background: #0f514b;
  color: #fff;
}

@media (max-width: 900px) {
  .sxpoh-app,
  .sxpoh-content {
    grid-template-columns: 1fr;
  }

  .sxpoh-sidebar,
  .sxpoh-results {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sxpoh-toolbar {
    grid-template-columns: 1fr;
  }

  .sxpoh-results {
    max-height: 38vh;
  }
}
