:root {
  --ink: #17312f;
  --muted: #66736f;
  --faint: #9ca7a2;
  --paper: #fbf7ee;
  --paper-2: #f2eadc;
  --card: rgba(255, 253, 247, 0.86);
  --card-strong: #fffdf7;
  --line: rgba(37, 58, 54, 0.13);
  --accent: #bf5b32;
  --accent-2: #1b6f65;
  --amber: #d99a2b;
  --red: #be3b34;
  --green: #3c8b62;
  --shadow: 0 22px 60px rgba(47, 53, 43, 0.14);
  --radius: 24px;
  --font-display: "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --font-body: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "Cascadia Mono", "Menlo", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-body);
  background:
    radial-gradient(circle at 8% 8%, rgba(191, 91, 50, 0.2), transparent 28rem),
    radial-gradient(circle at 88% 4%, rgba(27, 111, 101, 0.18), transparent 26rem),
    linear-gradient(135deg, #fbf7ee 0%, #efe4d2 55%, #e9dfcf 100%);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.boot {
  display: grid;
  min-height: 100vh;
  place-items: center;
  gap: 18px;
  color: var(--muted);
}

.boot-mark {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 3px solid rgba(27, 111, 101, 0.2);
  border-top-color: var(--accent-2);
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.42);
  backdrop-filter: blur(20px);
}

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

.brand-logo {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent-2), #12343b);
  box-shadow: 0 14px 28px rgba(18, 52, 59, 0.24);
}

.brand h1 {
  margin: 0;
  font: 700 16px/1.2 var(--font-display);
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.nav button {
  width: 100%;
  border: 0;
  border-radius: 16px;
  color: var(--muted);
  background: transparent;
  padding: 12px 14px;
  text-align: left;
  transition: 160ms ease;
}

.nav button:hover,
.nav button.active {
  color: var(--ink);
  background: rgba(255, 253, 247, 0.8);
  box-shadow: inset 0 0 0 1px var(--line);
}

.nav-kicker {
  display: block;
  margin-bottom: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.rail-note {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 22px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--muted);
  background: rgba(255, 253, 247, 0.62);
  font-size: 12px;
  line-height: 1.65;
}

.main {
  padding: 32px;
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 280px;
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(18, 52, 59, 0.96), rgba(27, 111, 101, 0.9)),
    radial-gradient(circle at 80% 20%, rgba(217, 154, 43, 0.4), transparent 18rem);
  color: #fffaf1;
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -16% -55% 48%;
  height: 280px;
  background: radial-gradient(ellipse, rgba(255, 246, 219, 0.18), transparent 70%);
  transform: rotate(-12deg);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 880px;
}

.eyebrow {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 14px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: rgba(255, 250, 241, 0.82);
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
}

.hero h2 {
  margin: 0;
  max-width: 760px;
  font: 700 clamp(30px, 4vw, 58px)/1.08 var(--font-display);
  letter-spacing: -0.04em;
}

.hero p {
  max-width: 680px;
  margin: 18px 0 0;
  color: rgba(255, 250, 241, 0.78);
  font-size: 16px;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.primary-btn,
.ghost-btn,
.chip-btn {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
}

.primary-btn {
  color: #fffaf1;
  background: var(--accent);
  box-shadow: 0 12px 26px rgba(191, 91, 50, 0.26);
}

.ghost-btn {
  color: rgba(255, 250, 241, 0.88);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.section {
  display: none;
  animation: rise 300ms ease both;
}

.section.active {
  display: block;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.grid {
  display: grid;
  gap: 18px;
}

.kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 22px 0;
}

.card {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 16px 42px rgba(47, 53, 43, 0.09);
}

.card.pad {
  padding: 22px;
}

.kpi {
  padding: 20px;
}

.kpi label {
  color: var(--muted);
  font-size: 13px;
}

.kpi strong {
  display: block;
  margin-top: 8px;
  font: 760 30px/1 var(--font-display);
  letter-spacing: -0.03em;
}

.kpi span {
  display: block;
  margin-top: 10px;
  color: var(--faint);
  font-size: 12px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 18px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 14px;
}

.card-head h3 {
  margin: 0;
  font: 700 22px/1.25 var(--font-display);
}

.card-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--accent-2);
  background: rgba(27, 111, 101, 0.1);
  font: 600 12px/1 var(--font-body);
  white-space: nowrap;
}

.pill.high {
  color: var(--red);
  background: rgba(190, 59, 52, 0.1);
}

.pill.mid {
  color: #976512;
  background: rgba(217, 154, 43, 0.14);
}

.bars {
  display: grid;
  gap: 13px;
}

.bar-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 78px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
}

.bar-track {
  overflow: hidden;
  height: 12px;
  border-radius: 999px;
  background: rgba(23, 49, 47, 0.08);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
}

.bar-num {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: right;
}

.decision-list,
.risk-list {
  display: grid;
  gap: 10px;
}

.decision,
.risk-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.46);
}

.decision strong,
.risk-item strong {
  display: block;
  margin-bottom: 5px;
}

.decision p,
.risk-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 10px;
  margin-bottom: 14px;
}

.result-note {
  margin: -3px 0 12px;
  padding: 10px 12px;
  border: 1px dashed rgba(27, 111, 101, 0.24);
  border-radius: 15px;
  color: var(--muted);
  background: rgba(255, 253, 247, 0.52);
  font-size: 12px;
  line-height: 1.5;
}

.search,
.select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  padding: 0 14px;
  outline: none;
}

.search:focus,
.select:focus {
  border-color: rgba(27, 111, 101, 0.4);
  box-shadow: 0 0 0 4px rgba(27, 111, 101, 0.1);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.42);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 880px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(37, 58, 54, 0.09);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted);
  background: #fffaf0;
  font-size: 12px;
  font-weight: 700;
}

td {
  font-size: 13px;
  line-height: 1.45;
}

.entity-row {
  cursor: pointer;
  transition: 140ms ease;
}

.entity-row:hover {
  background: rgba(27, 111, 101, 0.055);
}

.entity-row.active {
  background: rgba(191, 91, 50, 0.09);
  box-shadow: inset 4px 0 0 var(--accent);
}

.money {
  white-space: nowrap;
  font-family: var(--font-mono);
  text-align: right;
}

.muted {
  color: var(--muted);
}

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

.insight {
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid var(--line);
}

.insight small {
  color: var(--muted);
}

.insight strong {
  display: block;
  margin-top: 8px;
  font: 700 20px/1.2 var(--font-display);
}

.detail-pane {
  min-height: 280px;
}

.detail-pane dl {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px 12px;
  margin: 0;
}

.detail-pane dt {
  color: var(--muted);
  font-size: 12px;
}

.detail-pane dd {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.question-box {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 22px;
  background: #fff8e8;
  border: 1px solid rgba(217, 154, 43, 0.28);
}

.question-box ol {
  margin: 0;
  padding-left: 22px;
}

.question-box li {
  margin: 8px 0;
  color: #684811;
  line-height: 1.6;
}

.empty {
  padding: 34px;
  color: var(--muted);
  text-align: center;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
}

.login-card {
  width: min(540px, 100%);
  display: grid;
  gap: 20px;
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 30px;
  background: rgba(255, 253, 247, 0.88);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.login-card h1 {
  margin: 0;
  font: 750 34px/1.15 var(--font-display);
  letter-spacing: -0.03em;
}

.login-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.login-form {
  display: grid;
  gap: 10px;
}

.login-form label {
  color: var(--muted);
  font-size: 13px;
}

.login-form .primary-btn {
  justify-self: start;
}

.login-error {
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--red);
  background: rgba(190, 59, 52, 0.1);
  font-size: 13px;
}

.login-note {
  padding: 12px 14px;
  border: 1px dashed rgba(191, 91, 50, 0.26);
  border-radius: 16px;
  color: var(--muted);
  background: rgba(255, 248, 232, 0.66);
  font-size: 12px;
  line-height: 1.65;
}

.logout-btn {
  width: 100%;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 253, 247, 0.7);
  padding: 8px 10px;
  font-size: 12px;
}

.logout-btn:hover {
  color: var(--ink);
  background: var(--card-strong);
}

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

  .rail {
    position: sticky;
    z-index: 20;
    height: auto;
    padding: 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 253, 247, 0.76);
  }

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

  .rail-note {
    position: static;
    margin-top: 16px;
  }

  .main {
    padding: 22px;
  }

  .kpi-grid,
  .two-col,
  .insight-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  html,
  body {
    overflow-x: hidden;
  }

  body {
    background:
      radial-gradient(circle at 0% 0%, rgba(191, 91, 50, 0.18), transparent 18rem),
      linear-gradient(145deg, #fbf7ee 0%, #efe4d2 100%);
  }

  .shell,
  .rail,
  .main,
  .login-shell {
    width: min(100vw, 390px);
    max-width: 390px;
  }

  .brand {
    margin-bottom: 12px;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 13px;
  }

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

  .brand p {
    font-size: 11px;
  }

  .rail {
    top: 0;
    padding: 12px 12px 10px;
    backdrop-filter: blur(18px);
  }

  .rail-note {
    display: none;
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav button {
    min-width: 64px;
    padding: 9px 12px;
    border-radius: 14px;
    font-size: 14px;
    text-align: center;
  }

  .nav-kicker {
    display: none;
  }

  .main {
    padding: 12px;
  }

  .hero {
    min-height: auto;
    padding: 20px;
    border-radius: 24px;
  }

  .hero h2 {
    font-size: 26px;
    line-height: 1.18;
    letter-spacing: -0.035em;
  }

  .hero p {
    margin-top: 14px;
    font-size: 13px;
    line-height: 1.7;
  }

  .hero-actions {
    display: grid;
  }

  .hero-actions button {
    width: 100%;
  }

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

  .kpi {
    padding: 14px;
    border-radius: 20px;
  }

  .kpi strong {
    font-size: 24px;
  }

  .card.pad {
    padding: 16px;
    border-radius: 22px;
  }

  .card-head {
    display: grid;
    gap: 10px;
  }

  .card-head h3 {
    font-size: 21px;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }

  .chip-btn,
  .primary-btn,
  .ghost-btn {
    width: 100%;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 16px;
    max-height: none;
    background: transparent;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: rgba(255, 253, 247, 0.74);
    box-shadow: 0 10px 24px rgba(47, 53, 43, 0.06);
  }

  td {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 10px;
    padding: 7px 4px;
    border-bottom: 0;
    font-size: 12px;
    line-height: 1.55;
    text-align: left;
    overflow-wrap: anywhere;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    line-height: 1.55;
  }

  td:first-child {
    padding-top: 2px;
  }

  td:first-child strong {
    font-size: 13px;
  }

  td:empty::after {
    content: "-";
    color: var(--faint);
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .bar-num {
    text-align: left;
  }

  .money {
    text-align: left;
    white-space: normal;
  }

  .detail-pane dl {
    grid-template-columns: 84px 1fr;
  }

  .login-shell {
    align-items: start;
    justify-items: start;
    padding: 18px;
    overflow-x: hidden;
  }

  .login-card {
    width: min(100%, 320px);
    max-width: 320px;
    margin-top: 7vh;
    padding: 22px;
    border-radius: 26px;
  }

  .login-card .eyebrow {
    max-width: 100%;
    white-space: normal;
  }

  .login-card h1 {
    font-size: 29px;
    overflow-wrap: anywhere;
  }

  .login-card p,
  .login-note {
    overflow-wrap: anywhere;
  }
}
