:root {
  --bg: #f5f4f0;
  --bg-soft: #faf9f7;
  --panel: #ffffff;
  --panel-soft: #fcfbf9;
  --ink: #1f2328;
  --ink-soft: #5d6470;
  --line: #e4e6eb;
  --line-strong: #d8dce3;
  --accent: #2f4058;
  --accent-soft: #edf2f8;
  --success: #2f6f44;
  --warn: #8a3f2f;
  --shadow-card: 0 8px 24px rgba(31, 35, 40, 0.06);
  --shadow-soft: 0 1px 2px rgba(31, 35, 40, 0.04);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 10px;

  --font-sans: "Source Sans 3", "SF Pro Text", "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --font-serif: "Libre Baskerville", "Noto Serif SC", "Songti SC", "STSong", serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 6%, rgba(228, 235, 244, 0.44), transparent 34%),
    radial-gradient(circle at 84% 94%, rgba(236, 240, 246, 0.5), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0));
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
}

.brand {
  padding: 8px 10px;
}

.brand-eyebrow {
  margin: 0;
  color: #8a909b;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 700;
}

.brand h1 {
  margin: 9px 0 7px;
  font-family: var(--font-serif);
  font-size: 30px;
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.brand-sub {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.52;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow: auto;
  padding-right: 2px;
}

.nav-btn {
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: #313742;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  padding: 9px 11px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.nav-btn:hover {
  background: #f4f6fa;
}

.nav-btn.active {
  color: #11151c;
  background: #edf1f7;
  border-color: #dce3ed;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.sidebar-note {
  margin: 2px 10px 0;
  color: #7f8793;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.45;
}

.status-box {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.badge {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  background: #ffffff;
}

.badge.muted {
  color: #5f6877;
}

.badge.ok {
  border-color: rgba(47, 111, 68, 0.35);
  background: rgba(47, 111, 68, 0.1);
  color: #225839;
}

.badge.warn {
  border-color: rgba(138, 63, 47, 0.35);
  background: rgba(138, 63, 47, 0.1);
  color: #6f2f22;
}

.content {
  width: 100%;
  max-width: 1300px;
  padding: 30px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 6px 2px 20px;
}

.topbar-main {
  min-width: 0;
  flex: 1;
}

.topbar-kicker {
  margin: 0;
  color: #7c8492;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
}

.topbar h2 {
  margin: 8px 0 0;
  font-family: var(--font-serif);
  font-size: 38px;
  line-height: 1.18;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.topbar p {
  margin: 10px 0 0;
  max-width: 900px;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.64;
}

.topbar-auth {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 260px;
}

.top-chip {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  padding: 5px 10px;
  font-size: 12px;
  color: #313845;
}

.top-chip.muted {
  color: #5b6472;
}

.panel {
  display: none;
  animation: panel-in 0.22s ease;
}

.panel.active {
  display: block;
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.panel-grid {
  display: grid;
  gap: 14px;
}

.overview-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.hero-card {
  grid-column: 1 / -1;
  border-color: #dfe4ed;
  background: linear-gradient(130deg, #ffffff, #f7f9fc 74%);
}

.overview-grid > .card:not(.hero-card) {
  grid-column: span 6;
}

.overview-kicker {
  margin: 0;
  font-size: 12px;
  color: #768093;
  letter-spacing: 0.1em;
  font-weight: 700;
  text-transform: uppercase;
}

.overview-title {
  margin: 8px 0;
  font-family: var(--font-serif);
  font-size: 33px;
  line-height: 1.24;
  letter-spacing: -0.02em;
}

.overview-lead {
  margin: 0;
  color: #4f5968;
  font-size: 16px;
  line-height: 1.72;
}

.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
}

.quick-tags span {
  border: 1px solid #dce2eb;
  border-radius: 999px;
  background: #f5f8fc;
  padding: 4px 10px;
  font-size: 12px;
  color: #3f4754;
}

.hint {
  margin: 0 0 13px;
  color: var(--ink-soft);
  font-size: 14px;
}

.overview-output {
  min-height: 80px;
}

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

.feature-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
  box-shadow: var(--shadow-soft);
  padding: 11px;
}

.feature-item h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.feature-item p {
  margin: 0;
  color: #566071;
  font-size: 13px;
  line-height: 1.58;
}

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

.highlight-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--panel-soft);
  box-shadow: var(--shadow-soft);
  padding: 11px;
}

.highlight-grid h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.highlight-grid p {
  margin: 0;
  color: #566071;
  font-size: 13px;
  line-height: 1.58;
}

.module-hint {
  margin: -2px 0 12px;
  color: #606978;
  font-size: 14px;
  line-height: 1.52;
}

.stack {
  display: grid;
  gap: 9px;
}

label {
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  color: #697280;
}

input,
textarea,
select,
button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: #ffffff;
  padding: 10px 12px;
  color: var(--ink);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

input::placeholder,
textarea::placeholder {
  color: #98a1b0;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #b5c0cf;
  box-shadow: 0 0 0 3px rgba(182, 195, 212, 0.22);
}

button {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #ffffff;
  font-weight: 600;
  background: #1f2a38;
  cursor: pointer;
  transition: background 0.16s ease, transform 0.16s ease;
}

button:hover {
  background: #27384d;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.72;
  cursor: wait;
}

button.ghost {
  color: #2f3642;
  border-color: #d6dbe5;
  background: #f4f6fa;
}

button.ghost:hover {
  background: #eaeff6;
}

.topbar-btn {
  padding: 7px 11px;
  font-size: 12px;
}

.inline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.inline-grid.one-line {
  grid-template-columns: 1fr 1fr;
}

.result-toolbar {
  margin: 13px 0 9px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.result-view {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: #fcfbfa;
  min-height: 90px;
  max-height: 600px;
  overflow: auto;
  padding: 13px;
  line-height: 1.62;
}

.result-empty {
  color: #687181;
  font-size: 13px;
}

.result-section {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
  padding: 11px;
  margin-bottom: 10px;
}

.result-section h4 {
  margin: 0 0 8px;
  font-size: 15px;
}

.result-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.result-rich {
  word-break: break-word;
}

.result-rich h3,
.result-rich h4,
.result-rich h5,
.result-rich h6 {
  margin: 10px 0 6px;
  font-size: 15px;
}

.result-rich p {
  margin: 0 0 8px;
  line-height: 1.68;
}

.result-rich ul,
.result-rich ol {
  margin: 0 0 8px;
  padding-left: 20px;
}

.result-rich li {
  margin: 4px 0;
}

.finding-list {
  display: grid;
  gap: 8px;
}

.finding-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
  padding: 9px 10px;
}

.finding-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.finding-cat {
  font-size: 12px;
  color: #566071;
}

.sev {
  font-size: 11px;
  border-radius: 999px;
  padding: 2px 7px;
  border: 1px solid transparent;
  font-weight: 700;
}

.sev-critical {
  border-color: #b8524a;
  color: #9a3d36;
  background: rgba(184, 82, 74, 0.12);
}

.sev-high {
  border-color: #b77735;
  color: #8d5d23;
  background: rgba(183, 119, 53, 0.15);
}

.sev-medium {
  border-color: #9a8b3d;
  color: #746625;
  background: rgba(154, 139, 61, 0.18);
}

.sev-low {
  border-color: #4b7f5d;
  color: #325f44;
  background: rgba(75, 127, 93, 0.16);
}

.sev-info {
  border-color: #5d6f88;
  color: #455a75;
  background: rgba(93, 111, 136, 0.14);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.meta-pill {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  background: #f4f7fb;
}

.alert {
  border: 1px solid rgba(138, 63, 47, 0.35);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: rgba(138, 63, 47, 0.08);
  margin-bottom: 10px;
  font-size: 13px;
}

.plain-list {
  margin: 0;
  padding-left: 16px;
}

.plain-list li {
  margin: 6px 0;
}

details {
  margin-top: 8px;
}

summary {
  cursor: pointer;
  color: #2b3340;
  font-weight: 600;
}

pre.raw {
  margin: 8px 0 0;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: 480px;
  z-index: 100;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 16px 34px rgba(31, 35, 40, 0.16);
  padding: 10px 12px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.success {
  border-color: rgba(47, 111, 68, 0.4);
}

.toast.error {
  border-color: rgba(138, 63, 47, 0.45);
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #f2f4f8;
  backdrop-filter: none;
}

.auth-overlay.hidden {
  display: none;
}

.auth-shell {
  width: 100%;
  max-width: 920px;
  border: 1px solid rgba(217, 224, 235, 0.8);
  border-radius: 22px;
  background: #ffffff;
  box-shadow: 0 28px 70px rgba(16, 20, 28, 0.32);
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
}

.auth-brand {
  margin: 0;
  color: #d7deea;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}

.auth-visual {
  background:
    linear-gradient(150deg, #192332, #24344a 58%, #2c4260),
    radial-gradient(circle at 18% 18%, rgba(202, 218, 243, 0.16), transparent 44%);
  color: #f2f5fb;
  padding: 30px 28px 26px;
  position: relative;
}

.auth-visual::after {
  content: "";
  position: absolute;
  right: -120px;
  top: -70px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  border: 1px solid rgba(205, 219, 241, 0.24);
  background: radial-gradient(circle, rgba(223, 233, 249, 0.2), transparent 65%);
  pointer-events: none;
}

.auth-visual h3 {
  margin: 10px 0 8px;
  font-family: var(--font-serif);
  font-size: 33px;
  line-height: 1.25;
}

.auth-sub {
  margin: 0;
  color: rgba(234, 240, 251, 0.9);
  font-size: 14px;
  line-height: 1.66;
}

.auth-points {
  margin: 14px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 7px;
  font-size: 13px;
  color: rgba(235, 241, 251, 0.9);
  line-height: 1.5;
}

.auth-note-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-note-grid article {
  border: 1px solid rgba(216, 227, 246, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  padding: 10px;
}

.auth-note-grid span {
  display: block;
  color: rgba(226, 235, 249, 0.88);
  font-size: 12px;
  margin-bottom: 4px;
}

.auth-note-grid strong {
  color: #f8fbff;
  font-size: 15px;
}

.auth-form-panel {
  padding: 28px 24px 24px;
  background: #ffffff;
  border-left: 1px solid #e8edf6;
}

.auth-kicker {
  margin: 0;
  color: #7f8796;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
}

.auth-form-panel h4 {
  margin: 8px 0 10px;
  font-family: var(--font-serif);
  font-size: 30px;
  line-height: 1.2;
}

.auth-form {
  margin-top: 2px;
}

.auth-form input {
  height: 44px;
}

.auth-form button {
  margin-top: 4px;
  width: 100%;
  height: 44px;
  font-size: 15px;
}

.auth-error {
  min-height: 22px;
  margin: 11px 0 0;
  color: #9a3d36;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.94);
  }

  .brand h1 {
    font-size: 28px;
  }

  .nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar-note {
    margin-top: 4px;
  }

  .status-box {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 2px;
  }

  .content {
    max-width: none;
  }
}

@media (max-width: 980px) {
  .content {
    padding: 16px;
  }

  .topbar h2 {
    font-size: 31px;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar-auth {
    width: 100%;
    justify-content: flex-start;
  }

  .auth-shell {
    max-width: 520px;
    grid-template-columns: 1fr;
  }

  .auth-form-panel {
    border-left: 0;
    border-top: 1px solid #e8edf6;
  }

  .auth-visual {
    padding: 22px 20px 18px;
  }

  .auth-visual h3 {
    font-size: 28px;
  }

  .auth-note-grid {
    grid-template-columns: 1fr;
  }

  .overview-grid,
  .feature-grid,
  .highlight-grid,
  .inline-grid,
  .inline-grid.one-line,
  .status-box,
  .nav {
    grid-template-columns: 1fr;
  }

  .overview-grid > .card:not(.hero-card) {
    grid-column: 1 / -1;
  }
}
