:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-2: #243044;
  --border: #2f3f56;
  --text: #e8eef7;
  --muted: #9fb0c8;
  --accent: #4da3ff;
  --accent-soft: rgba(77, 163, 255, 0.12);
  --success: #3ecf8e;
  --radius: 10px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #172033 0%, var(--bg) 55%);
  color: var(--text);
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-header {
  border-bottom: 1px solid var(--border);
  background: rgba(15, 20, 25, 0.85);
  backdrop-filter: blur(8px);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.brand-subtitle {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.app-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.app-footer {
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem 2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.search-panel,
.detail-panel,
.results-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.search-form {
  display: flex;
  gap: 0.75rem;
}

.search-form input {
  flex: 1;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-size: 1rem;
}

.search-form button {
  padding: 0.85rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #041018;
  font-weight: 600;
  cursor: pointer;
}

.search-form button:hover {
  filter: brightness(1.05);
}

.hint {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 1.5rem 0 1rem;
}

.result-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.75rem;
}

.result-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  background: var(--surface-2);
}

.result-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
}

.detail-header {
  margin-bottom: 1.25rem;
}

.detail-header h1 {
  margin: 0 0 0.5rem;
  font-size: 1.6rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.field-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.field-card h4 {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-card p {
  margin: 0;
}

.section {
  margin-top: 1.5rem;
}

.section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.rel-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

.rel-item {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--muted);
}

.status-message,
.error-message {
  padding: 1rem;
  border-radius: 8px;
}

.status-message {
  background: var(--surface-2);
  color: var(--muted);
}

.error-message {
  background: rgba(255, 96, 96, 0.12);
  border: 1px solid rgba(255, 96, 96, 0.35);
  color: #ffb4b4;
}

.ecc-header {
  margin-bottom: 1.5rem;
}

.ecc-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.ecc-title-row h1 {
  margin: 0;
  font-size: 1.6rem;
}

.ecc-nav-link,
.workspace-nav-link {
  font-size: 0.95rem;
}

.workspace-header {
  margin-bottom: 1.5rem;
}

.workspace-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.workspace-title-row h1 {
  margin: 0;
  font-size: 1.6rem;
}

.workspace-nav {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.workspace-zone {
  margin-bottom: 2rem;
}

.workspace-zone h2 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.workspace-zone-attention {
  background: rgba(255, 196, 77, 0.06);
  border: 1px solid rgba(255, 196, 77, 0.25);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
}

.attention-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.attention-item {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem 1rem;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.attention-item.severity-high {
  border-color: rgba(255, 96, 96, 0.45);
}

.workspace-warnings {
  background: rgba(255, 196, 77, 0.08);
  border: 1px solid rgba(255, 196, 77, 0.35);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}

.ecc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.ecc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}

.ecc-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.ecc-value {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.ecc-detail {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.ecc-link {
  display: inline-block;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

.ecc-card.status-certified,
.ecc-card.status-authorized,
.ecc-card.status-clean,
.ecc-card.status-passing,
.ecc-card.status-constitutionally_complete {
  border-color: rgba(62, 207, 142, 0.45);
}

.ecc-card.status-attention,
.ecc-card.status-unknown {
  border-color: rgba(255, 196, 77, 0.45);
}

.ecc-warnings {
  background: rgba(255, 196, 77, 0.08);
  border: 1px solid rgba(255, 196, 77, 0.35);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin-bottom: 1rem;
}

.ecc-warnings h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.ecc-warnings ul {
  margin: 0;
  padding-left: 1.2rem;
}

.warning-item {
  margin-bottom: 0.5rem;
  color: var(--text);
}

.refreshed-at {
  margin-top: 1rem;
}

.planning-grid {
  display: grid;
  gap: 1rem;
}

.planning-answer {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow);
}

.planning-answer h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.planning-answer-text {
  margin: 0 0 0.75rem;
  line-height: 1.5;
}

.planning-action {
  margin: 0 0 0.75rem;
  color: var(--accent);
}

.planning-evidence {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.evidence-item {
  margin-bottom: 0.35rem;
}

@media (max-width: 640px) {
  .search-form {
    flex-direction: column;
  }
}
