:root {
  --bg: #0e141b;
  --elev: #151c25;
  --muted: #1c2530;
  --line: #2a3644;
  --text: #e7eef5;
  --soft: #93a1b0;
  --accent: #4d7fa3;
  --accent-ink: #d5e6f2;
  --danger: #c46b6b;
  --warn: #c6a15b;
  --ok: #6ea887;
  --critical: #d17b73;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  --sidebar: 248px;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.7rem; font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; font-weight: 600; }

.public-nav, .topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 20, 27, 0.92);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: -0.02em; }
.brand img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.brand i {
  width: 18px; height: 22px; border: 1.5px solid var(--accent-ink); border-radius: 3px; display: inline-block; position: relative;
}
.brand i::after { content: ""; position: absolute; left: 3px; right: 3px; top: 6px; height: 1.5px; background: var(--accent); box-shadow: 0 4px 0 var(--accent); }
.nav-links { display: flex; gap: 18px; align-items: center; color: var(--soft); }
.wrap { width: min(1080px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 64px; }
.hero { display: grid; gap: 14px; padding: 18px 0 28px; }
.lede { max-width: 640px; color: var(--soft); font-size: 1.08rem; line-height: 1.55; }
.disclaimer { color: var(--soft); font-size: 0.86rem; line-height: 1.5; margin-top: 28px; }

.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 20px 14px;
  border-right: 1px solid var(--line); background: #10171f;
  display: flex; flex-direction: column; gap: 18px;
}
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
  color: var(--soft); padding: 9px 12px; border-radius: 8px; text-decoration: none;
}
.side-nav a.active, .side-nav a:hover { background: var(--muted); color: var(--text); text-decoration: none; }
.side-foot { margin-top: auto; display: grid; gap: 8px; color: var(--soft); font-size: 0.86rem; }
.main { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 5; }
.content { padding: 28px; display: grid; gap: 22px; }
.search { display: flex; gap: 8px; }
.search input, .filters input, .filters select, .stack input, .stack select, .stack textarea {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 10px;
}
.search input { min-width: 220px; }
.icon-btn, .btn, button {
  background: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; cursor: pointer;
}
.btn.primary, button.primary { background: var(--accent); border-color: #3f6d8d; color: white; }
.btn.danger, button.danger { background: transparent; color: var(--danger); border-color: #6d3d3d; }
.btn.ghost { background: transparent; }
.nav-toggle { display: none; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat, .card, .panel {
  background: var(--elev); border: 1px solid var(--line); border-radius: 12px; padding: 16px;
}
.stat span { display: block; color: var(--soft); font-size: 0.82rem; margin-bottom: 8px; }
.stat strong { font-size: 1.55rem; font-weight: 600; letter-spacing: -0.03em; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 0.8fr; gap: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.company-card { display: grid; gap: 12px; }
.identity { display: flex; gap: 12px; align-items: center; }
.mark {
  width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
  font-weight: 700; color: white; flex: none;
}
.meta { color: var(--soft); font-size: 0.86rem; display: grid; gap: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--soft); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.04em; text-transform: uppercase; }
.badge {
  display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 8px;
  border: 1px solid var(--line); color: var(--soft); font-size: 0.75rem; letter-spacing: 0.03em;
}
.badge.low { color: var(--soft); }
.badge.medium { color: #9ec0d6; border-color: #355068; }
.badge.high { color: var(--warn); border-color: #6d5a32; }
.badge.critical { color: var(--critical); border-color: #6d3d3d; }
.badge.ok { color: var(--ok); border-color: #355848; }
.badge.bad { color: var(--danger); border-color: #6d3d3d; }
.empty { padding: 28px 8px; color: var(--soft); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.stack { display: grid; gap: 8px; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toast, .banner {
  border: 1px solid var(--line); background: var(--muted); border-radius: 10px; padding: 10px 12px;
}
.toast.error, .banner.error { border-color: #6d3d3d; color: #f0d0d0; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.clause { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 8px; background: #121922; }
.clause header { color: var(--soft); font-size: 0.75rem; margin-bottom: 6px; }
.clause.removed { border-color: #6d3d3d; }
.clause.added { border-color: #355848; }
.clause.modified { border-color: #6d5a32; }
.diff-board.only-changed .clause[data-change="UNCHANGED"] { display: none; }
.source { display: grid; gap: 6px; color: var(--soft); }
.preview {
  white-space: pre-wrap; background: #10171f; border-radius: 12px; padding: 16px; border: 1px solid var(--line); line-height: 1.45;
}
.pager { display: flex; gap: 10px; align-items: center; color: var(--soft); }
.login-card { width: min(420px, calc(100% - 32px)); margin: 10vh auto; display: grid; gap: 14px; }
label span { display: block; color: var(--soft); font-size: 0.82rem; margin-bottom: 6px; }
textarea { min-height: 90px; resize: vertical; }
.section-label { color: var(--soft); font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; }
.policy-block { display: grid; gap: 10px; padding-top: 8px; border-top: 1px solid var(--line); }
.check { display: flex; gap: 8px; align-items: center; color: var(--soft); }

h3 { font-size: 0.95rem; font-weight: 600; }
.lede { color: var(--soft); line-height: 1.5; }
.skip {
  position: absolute; left: 8px; top: -40px; background: var(--accent); color: white; padding: 8px 12px; z-index: 40;
}
.skip:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 2px; }
.side-nav a { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.count {
  min-width: 1.4rem; text-align: center; border-radius: 999px; background: var(--muted); color: var(--text);
  font-size: 0.75rem; padding: 1px 6px;
}
.side-rule { height: 1px; background: var(--line); margin: 8px 4px; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: end; flex-wrap: wrap; }
.search-launch { display: flex; gap: 10px; align-items: center; min-width: 220px; color: var(--soft); }
kbd { border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 0.75rem; }
.top-actions { margin-left: auto; }
.company-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.feed { display: grid; gap: 10px; }
.feed-item {
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start;
  color: inherit; text-decoration: none; padding: 12px; border-radius: 12px;
}
a.feed-item:hover, .feed-item.active { background: var(--muted); text-decoration: none; }
.bar-row { display: grid; grid-template-columns: 140px 1fr 32px; gap: 8px; align-items: center; }
.bar { height: 8px; background: var(--muted); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--accent); }
.spark { display: flex; align-items: end; gap: 3px; height: 72px; }
.spark span { flex: 1; background: var(--accent); min-height: 2px; border-radius: 2px 2px 0 0; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.menu { position: relative; margin-left: auto; }
.menu summary { cursor: pointer; list-style: none; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }
.menu summary::-webkit-details-marker { display: none; }
.menu[open] { display: grid; gap: 6px; background: var(--elev); }
.review-layout { display: grid; grid-template-columns: 0.9fr 1.1fr; gap: 16px; align-items: start; }
.tweet-card { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: #10171f; }
.draft-text { white-space: pre-wrap; }
dialog {
  border: 1px solid var(--line); background: var(--elev); color: var(--text); border-radius: 12px; width: min(560px, calc(100% - 24px));
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button.active { background: var(--accent); border-color: #3f6d8d; color: white; }
.skeleton { height: 14px; margin: 8px 0; border-radius: 6px; background: var(--muted); }
.result-row { display: grid; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 1200px) {
  .company-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .stats, .grid-2, .split { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 20; transform: translateX(-105%); width: min(280px, 86vw); }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .nav-toggle { display: inline-flex; }
  .content, .public-nav, .topbar { padding-left: 16px; padding-right: 16px; }
  .company-grid, .review-layout, .feed-item, .bar-row { grid-template-columns: 1fr; }
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  tr { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; padding: 8px; }
  td { border: none; }
}

body.public { background: #070809; }
body.public .public-nav { background: #070809; border-bottom-color: #1c2126; }
body.public .stat,
body.public .panel,
body.public .pub-card {
  background: #101214;
  border-color: #23282e;
}
body.public .stat p,
body.public .panel-head,
body.public .empty-detail { color: var(--soft); }
body.public .stat p { margin-top: 8px; font-size: 0.82rem; line-height: 1.4; }
body.public .panel-head { display: grid; gap: 4px; margin-bottom: 14px; }
.steps { margin: 0; display: grid; gap: 6px; padding-left: 18px; }
.steps li { color: var(--soft); line-height: 1.45; }
.empty-detail { display: grid; gap: 8px; }
body.public .pub-card { display: grid; gap: 10px; color: inherit; }
body.public .pub-card:hover { text-decoration: none; border-color: #3a424a; }
.lang-switch { display: flex; gap: 4px; }
.lang-switch a { color: var(--soft); padding: 2px 7px; border-radius: 6px; border: 1px solid transparent; }
.lang-switch a.active { color: var(--text); border-color: var(--line); text-decoration: none; }

body.public .read { width: min(40rem, 100%); display: grid; gap: 1.75rem; }
body.public .read-head { display: grid; gap: 8px; }
body.public .read-head .section-label { text-transform: none; letter-spacing: 0; font-size: 0.95rem; }
body.public .read h1 { font-size: 1.85rem; line-height: 1.2; font-weight: 600; }
body.public .read-meta { color: var(--soft); font-size: 0.95rem; }
body.public .read-links { display: grid; gap: 6px; margin-top: 6px; }
body.public .read-links a { display: inline-flex; flex-wrap: wrap; gap: 0.2rem 0.7rem; align-items: baseline; line-height: 1.45; }
body.public .read-links a span { color: var(--soft); overflow-wrap: anywhere; }
body.public .read .lede { max-width: none; color: var(--soft); font-size: 1.02rem; line-height: 1.6; }
body.public .passage { display: grid; gap: 2.5rem; }
body.public .passage article { display: grid; gap: 1.15rem; }
body.public .passage h2 { font-size: 1.05rem; font-weight: 600; }
body.public .was, body.public .now { display: grid; gap: 0.35rem; }
body.public .was span, body.public .now span { color: var(--soft); font-size: 0.82rem; }
body.public .was p, body.public .now p { font-size: 1.05rem; line-height: 1.7; }
body.public .was p { color: var(--soft); }
body.public .read-foot { display: grid; gap: 0.35rem; color: var(--soft); font-size: 0.9rem; line-height: 1.5; }
body.public .read-foot p { margin: 0; }
