* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  color: #222;
  background: #f5f7fa;
}

.shell {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto;
  padding: 20px 0 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.topbar-links {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand {
  font-size: 1.4rem;
  font-weight: 700;
  color: #305680;
}

.health,
.result-meta {
  font-size: 0.9rem;
  color: #666;
}

.secondary-link {
  color: #305680;
  text-decoration: none;
}

.search-panel,
.results-panel {
  background: #fff;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.search-panel {
  padding: 18px;
}

.results-panel {
  margin-top: 16px;
  padding: 16px 18px 20px;
}

.title,
.results-header h2,
.result-card h3 {
  margin: 0;
  font-weight: 600;
}

.title {
  margin-bottom: 14px;
  font-size: 1.4rem;
}

.search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-input,
.control,
.search-button,
.secondary-button {
  min-height: 38px;
  border: 1px solid #bcc7d4;
  border-radius: 4px;
  font: inherit;
}

.search-input,
.control {
  padding: 8px 10px;
  background: #fff;
  color: #222;
}

.search-input {
  flex: 1;
}

.search-button,
.secondary-button,
.tab-button {
  cursor: pointer;
}

.search-button {
  padding: 8px 16px;
  color: #fff;
  background: #305680;
  border: 1px solid #27496d;
}

.secondary-button {
  padding: 8px 12px;
  background: #eef2f7;
}

.toolbar {
  margin-top: 14px;
}

.tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.tab-button {
  padding: 6px 10px;
  border: 1px solid #d3dae3;
  border-radius: 4px;
  background: #f8fafc;
  color: #31455a;
}

.tab-button.is-active {
  background: #e3ebf5;
  border-color: #9eb4cc;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.admin-field {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
}

.admin-field-full {
  margin-top: 14px;
}

.admin-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.admin-message {
  margin-top: 14px;
}

.admin-textarea {
  width: 100%;
  min-height: 120px;
  padding: 10px 12px;
  border: 1px solid #bcc7d4;
  border-radius: 4px;
  font: inherit;
  resize: vertical;
}

.admin-textarea-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
}

.toggle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
  margin-top: 14px;
}

.toggle-item {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.92rem;
}

.control {
  min-width: 110px;
}

.control-wide {
  flex: 1 1 260px;
}

.control-small {
  width: 100px;
}

.results-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}

.results {
  display: grid;
  gap: 16px;
  margin-top: 14px;
}

.result-card {
  padding: 0 0 10px;
  border-bottom: 1px solid #e4e8ef;
}

.result-card h3 {
  font-size: 1.05rem;
  font-weight: 400;
}

.result-card h3 a {
  color: #1a0dab;
  text-decoration: none;
}

.result-card h3 a:hover,
.path a:hover {
  text-decoration: underline;
}

.path {
  margin: 4px 0 8px;
  word-break: break-all;
  font-size: 0.86rem;
  color: #006621;
}

.path a {
  color: #006621;
  text-decoration: none;
}

.snippet,
.muted {
  color: #4a5565;
  line-height: 1.45;
}

@media (max-width: 860px) {
  .shell {
    width: min(100% - 16px, 1000px);
    padding-top: 12px;
  }

  .search-row,
  .results-header,
  .topbar,
  .admin-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .search-button,
  .secondary-button,
  .control,
  .control-small {
    width: 100%;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .toggle-grid {
    grid-template-columns: 1fr;
  }
}
