:root {
  --bg: #0d1714;
  --panel: #12231e;
  --panel-2: #172b25;
  --panel-3: #203a32;
  --text: #eef8f1;
  --muted: #a9bdb3;
  --line: rgba(255,255,255,.11);
  --accent: #92d6a5;
  --accent-strong: #bff0c9;
  --red: #ff6b6b;
  --orange: #ffb15f;
  --yellow: #ffe078;
  --green: #7bd88f;
  --shadow: 0 18px 70px rgba(0,0,0,.32);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, rgba(146,214,165,.14), transparent 28rem), var(--bg);
  color: var(--text);
}

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button {
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #092016;
  padding: .8rem 1rem;
  cursor: pointer;
  font-weight: 800;
  box-shadow: 0 10px 30px rgba(146,214,165,.16);
}
button:hover { filter: brightness(1.06); }
button.secondary {
  background: var(--panel-3);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: none;
}
button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  box-shadow: none;
}
button.danger { background: var(--red); color: #1f0909; }
button.small { padding: .45rem .65rem; border-radius: 10px; font-size: .85rem; }
input, select, textarea {
  width: 100%;
  background: #091411;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: .78rem .9rem;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: rgba(146,214,165,.65); }
code { background: rgba(255,255,255,.08); padding: .12rem .35rem; border-radius: 6px; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 2rem clamp(1rem, 3vw, 3rem);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: .15rem 0 .4rem; font-size: clamp(1.8rem, 3.2vw, 3.4rem); letter-spacing: -.04em; }
.subtitle { margin: 0; color: var(--muted); max-width: 60rem; }
.eyebrow { margin: 0; text-transform: uppercase; color: var(--accent-strong); font-size: .74rem; letter-spacing: .16em; font-weight: 900; }
.status-pill {
  align-self: flex-start;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  padding: .7rem .9rem;
  border-radius: 999px;
  white-space: nowrap;
  color: var(--muted);
}
.status-pill.ok { color: var(--green); border-color: rgba(123,216,143,.45); }
.status-pill.warn { color: var(--yellow); border-color: rgba(255,224,120,.45); }
.status-pill.bad { color: var(--red); border-color: rgba(255,107,107,.45); }

.layout { display: grid; grid-template-columns: 260px 1fr; min-height: calc(100vh - 142px); }
.sidebar {
  border-right: 1px solid var(--line);
  padding: 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  background: rgba(9,20,17,.54);
  backdrop-filter: blur(20px);
}
.nav {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: .55rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  box-shadow: none;
}
.nav.active, .nav:hover {
  color: var(--text);
  background: var(--panel-2);
  border-color: var(--line);
}
.admin-box {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.03);
}
.admin-box label { display: block; font-size: .75rem; color: var(--muted); margin-bottom: .5rem; }
.admin-box button { width: 100%; margin-top: .65rem; }

.content { padding: 1.25rem clamp(1rem, 2vw, 2rem) 3rem; }
.view { display: none; }
.view.active { display: block; }
.authority-block {
  border: 1px solid rgba(255,224,120,.28);
  background: rgba(255,224,120,.08);
  color: #fff5cd;
  border-radius: 18px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}
.authority-block strong { display: block; color: var(--yellow); margin-bottom: .2rem; }

.hero-card, .panel, .card, .item-card {
  background: linear-gradient(180deg, rgba(255,255,255,.055), rgba(255,255,255,.028));
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.hero-card {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.hero-card h2 { margin: .25rem 0 .5rem; font-size: clamp(1.4rem, 2.2vw, 2.3rem); }
.hero-card p { color: var(--muted); max-width: 60rem; }
.button-stack { display: flex; flex-direction: column; min-width: 230px; gap: .75rem; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: .8rem; margin: 1rem 0; }
.card { padding: 1rem; }
.card .number { font-size: 2rem; font-weight: 900; line-height: 1; }
.card .label { color: var(--muted); font-size: .8rem; margin-top: .4rem; }
.panel { padding: 1.2rem; margin: 1rem 0; }
.grid-two { display: grid; grid-template-columns: 1.15fr .85fr; gap: 1rem; }
.section-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; margin: .5rem 0 1rem; }
.section-head h2, .section-head h3 { margin: 0 0 .3rem; }
.muted { color: var(--muted); }
.inline-form { display: flex; gap: .65rem; align-items: center; }
.inline-form input { flex: 1; }
.result-box { margin-top: 1rem; border: 1px solid var(--line); border-radius: 16px; padding: 1rem; background: rgba(0,0,0,.16); }
.hidden { display: none !important; }

.risk-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.risk-grid div { border: 1px solid var(--line); border-radius: 16px; padding: .8rem; background: rgba(0,0,0,.14); }
.risk-grid p { margin: .45rem 0 0; color: var(--muted); font-size: .88rem; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: .28rem .58rem;
  border-radius: 999px;
  font-size: .76rem;
  font-weight: 900;
  border: 1px solid transparent;
}
.badge.red { background: rgba(255,107,107,.14); color: var(--red); border-color: rgba(255,107,107,.32); }
.badge.orange { background: rgba(255,177,95,.14); color: var(--orange); border-color: rgba(255,177,95,.32); }
.badge.yellow { background: rgba(255,224,120,.14); color: var(--yellow); border-color: rgba(255,224,120,.32); }
.badge.green { background: rgba(123,216,143,.14); color: var(--green); border-color: rgba(123,216,143,.32); }
.badge.gray { background: rgba(255,255,255,.08); color: var(--muted); border-color: var(--line); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; }
table { width: 100%; border-collapse: collapse; min-width: 980px; }
th, td { text-align: left; padding: .85rem; vertical-align: top; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: .74rem; text-transform: uppercase; letter-spacing: .08em; background: rgba(0,0,0,.16); }
tr:last-child td { border-bottom: 0; }
.source-title { font-weight: 850; }
.phrase-list { display: flex; flex-wrap: wrap; gap: .35rem; max-width: 420px; }
.phrase-list span { font-size: .72rem; color: var(--muted); background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: 999px; padding: .22rem .48rem; }
.actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.scorebars { min-width: 160px; }
.scorebar { display: grid; grid-template-columns: 68px 1fr 44px; align-items: center; gap: .4rem; margin: .22rem 0; font-size: .75rem; color: var(--muted); }
.bar { height: 8px; background: rgba(255,255,255,.08); border-radius: 999px; overflow: hidden; }
.fill { height: 100%; background: linear-gradient(90deg, rgba(146,214,165,.55), rgba(191,240,201,.95)); }

.item-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: .9rem; }
.item-card { padding: 1rem; }
.item-card h3 { margin: 0 0 .35rem; }
.item-card .meta { display: flex; flex-wrap: wrap; gap: .4rem; margin: .65rem 0; }
.item-card p { color: var(--muted); }
.target-form { display: grid; grid-template-columns: 1fr 1.4fr 120px auto; gap: .6rem; }

.snippet {
  margin-top: .5rem;
  color: var(--muted);
  font-size: .86rem;
  max-width: 620px;
}
.structural-snapshot {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .4rem;
}

#caseDialog {
  width: min(1050px, calc(100vw - 2rem));
  max-height: 88vh;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}
#caseDialog::backdrop { background: rgba(0,0,0,.66); backdrop-filter: blur(8px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #07110f;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  max-height: 58vh;
  overflow: auto;
}
.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  background: var(--panel-3);
  border: 1px solid var(--line);
  color: var(--text);
  padding: .8rem 1rem;
  border-radius: 14px;
  box-shadow: var(--shadow);
  max-width: 420px;
  z-index: 20;
}

@media (max-width: 980px) {
  .topbar { flex-direction: column; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; border-right: 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .nav { margin: 0; }
  .admin-box { grid-column: 1 / -1; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .hero-card, .grid-two, .target-form { grid-template-columns: 1fr; flex-direction: column; display: grid; }
  .button-stack { min-width: 0; }
  .inline-form { flex-direction: column; align-items: stretch; }
}
