:root {
  --bg: #eef2f5;
  --panel: #ffffff;
  --surface: #f7fafc;
  --text: #17212b;
  --muted: #607181;
  --line: #d6e0e8;
  --primary: #0f5f6f;
  --primary-dark: #0a4854;
  --accent: #e4f4f6;
  --danger: #a43b3b;
  --warning: #9a650e;
  --success: #19734d;
  --shadow: 0 12px 30px rgba(25, 43, 56, .08);
  --radius: 8px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.55;
}

a { color: inherit; }

.appHeader {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

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

.brand span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-weight: 900;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

nav a {
  padding: 8px 10px;
  border-radius: var(--radius);
  text-decoration: none;
}

nav a:hover {
  color: var(--primary);
  background: var(--accent);
}

main {
  max-width: 1240px;
  margin: 0 auto;
  padding: 22px;
}

.notice,
.hero,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.notice {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 14px;
  padding: 16px 18px;
  border-left: 5px solid var(--warning);
}

.notice p {
  margin: 0;
  color: var(--muted);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  margin-top: 20px;
  padding: 28px;
}

.hero h1 {
  margin: 8px 0 12px;
  max-width: 800px;
  font-size: clamp(32px, 4vw, 50px);
  line-height: 1.08;
  letter-spacing: 0;
}

.hero p {
  max-width: 820px;
  color: var(--muted);
  font-size: 17px;
}

.rulesCard {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.codeBox {
  white-space: pre-wrap;
  overflow: auto;
  max-height: 360px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #101820;
  color: #e8f4f8;
  padding: 14px;
  font-size: 13px;
}

.rulesCard h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.rulesCard ul {
  margin: 0;
  padding-left: 20px;
}

.panel {
  margin: 20px 0;
  padding: 24px;
}

.sectionHead {
  max-width: 840px;
  margin-bottom: 18px;
}

.sectionHead h2,
.resultsHeader h2 {
  margin: 6px 0 6px;
  font-size: 28px;
}

.sectionHead p {
  margin: 0;
  color: var(--muted);
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 12px !important;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.searchForm {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.filterGrid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.wide {
  grid-column: span 2;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font: inherit;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(15, 95, 111, .22);
  outline-offset: 2px;
}

.formActions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.backendStatus {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: var(--primary);
  padding: 10px 14px;
  font-weight: 900;
  cursor: pointer;
}

.button.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.button.primary:hover {
  background: var(--primary-dark);
}

.smallButton {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 12px;
}

.queryList {
  display: grid;
  gap: 10px;
}

.queryItem {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.queryItem code {
  overflow-wrap: anywhere;
  color: var(--text);
}

.resultsHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.summaryStrip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summaryCard {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}

.summaryCard span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summaryCard strong {
  display: block;
  margin-top: 4px;
  color: var(--primary);
  font-size: 22px;
}

.tableWrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 2200px;
  border-collapse: collapse;
  background: white;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  position: sticky;
  top: 0;
  background: #f0f6f8;
  color: #31424f;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

td a {
  color: var(--primary);
  overflow-wrap: anywhere;
}

.tag {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.risk-low { color: var(--success); font-weight: 900; }
.risk-medium { color: var(--warning); font-weight: 900; }
.risk-high { color: var(--danger); font-weight: 900; }

.historyList {
  display: grid;
  gap: 10px;
}

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

.projectCard,
.miniPanel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}

.projectCard.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 95, 111, .12);
}

.projectCard h3,
.miniPanel h2,
.miniPanel h3 {
  margin: 8px 0;
}

.projectCard p {
  color: var(--muted);
  margin: 6px 0;
}

.twoColumn {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.statList {
  display: grid;
  gap: 8px;
}

.statList div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.checkLine {
  display: flex;
  grid-template-columns: auto 1fr;
  align-items: flex-start;
  gap: 9px;
  margin: 10px 0 14px;
  color: var(--text);
  font-size: 14px;
}

.checkLine input {
  width: auto;
  margin-top: 3px;
}

.historyItem {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.historyItem p {
  margin: 2px 0 0;
  color: var(--muted);
}

.emptyState {
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface);
}

.compactList {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.compactList li + li {
  margin-top: 6px;
}

footer {
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 980px) {
  .appHeader,
  .resultsHeader {
    align-items: flex-start;
    flex-direction: column;
  }

  .notice,
  .hero,
  .searchForm,
  .filterGrid,
  .summaryStrip,
  .historyItem,
  .projectGrid,
  .twoColumn {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto;
  }

  .panel,
  .hero {
    padding: 18px;
  }
}
