:root {
  --paper: #f6f2e8;
  --ink: #17211b;
  --muted: #667064;
  --line: #d8d0bd;
  --jade: #1f6f57;
  --jade-dark: #164736;
  --red: #a83a32;
  --amber: #c9832b;
  --blue: #315f78;
  --white: #fffdf7;
  --shadow: 0 18px 50px rgba(45, 38, 24, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(31, 111, 87, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(31, 111, 87, 0.06) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.side-panel {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 22px;
  background: #153c31;
  color: #f8f4e9;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

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

.seal {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 2px solid #dec68b;
  color: #dec68b;
  font-size: 28px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
  letter-spacing: 0;
}

.brand p {
  color: rgba(248, 244, 233, 0.72);
  margin-top: 5px;
}

.tabs {
  display: grid;
  gap: 10px;
}

.tab,
.mode,
.batch-mode,
.ghost,
.primary {
  border: 0;
  border-radius: 6px;
  min-height: 42px;
}

.tab {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.08);
  color: #f8f4e9;
}

.tab.active {
  background: #dec68b;
  color: #163c31;
  font-weight: 700;
}

.notice {
  margin-top: 28px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.08);
  border-left: 4px solid #dec68b;
  color: rgba(248, 244, 233, 0.84);
  line-height: 1.65;
}

.notice strong {
  display: block;
  color: #fff9e6;
}

.workspace {
  padding: 28px;
  overflow: hidden;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow {
  color: var(--jade);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h2 {
  margin-top: 4px;
  font-size: 30px;
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px;
  background: rgba(23, 33, 27, 0.08);
  border-radius: 8px;
}

.mode,
.batch-mode {
  padding: 0 14px;
  color: var(--ink);
  background: transparent;
}

.mode.active,
.batch-mode.active {
  color: var(--white);
  background: var(--jade);
}

.input-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: end;
  margin-bottom: 20px;
}

.input-box {
  display: grid;
  gap: 8px;
  padding: 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
}

input {
  font-size: 28px;
  font-weight: 800;
}

textarea {
  min-height: 170px;
  resize: vertical;
  line-height: 1.7;
}

.button-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.primary {
  padding: 0 22px;
  color: var(--white);
  background: var(--jade);
  font-weight: 800;
}

.ghost {
  padding: 0 16px;
  color: var(--jade-dark);
  background: #e7dfcf;
}

.compact {
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
}

.result-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

.score-panel,
.detail-panel,
.section-card,
.rule-card,
.table-wrap {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.score-panel {
  padding: 22px;
}

.score-ring {
  display: grid;
  place-items: center;
  align-content: center;
  width: 150px;
  height: 150px;
  margin: 0 auto 18px;
  border: 12px solid var(--jade);
  border-radius: 50%;
  background: #f9f6ee;
}

.score-ring span {
  font-size: 40px;
  font-weight: 900;
}

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

.score-panel h3 {
  text-align: center;
  font-size: 20px;
}

.score-panel p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.65;
}

.quick-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.flag,
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.flag.risk,
.chip.risk {
  color: #84241f;
  background: #f4d2cc;
}

.flag.good,
.chip.good {
  color: #14513f;
  background: #cfe8dc;
}

.flag.warn,
.chip.warn {
  color: #7a4b0b;
  background: #f4dfbd;
}

.detail-panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.matches {
  display: grid;
  gap: 10px;
}

.match-row {
  display: grid;
  grid-template-columns: 90px 110px 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid #e2dac8;
  border-radius: 8px;
  background: #fbf8f1;
}

.match-row strong {
  color: var(--jade-dark);
}

.empty {
  color: var(--muted);
  min-height: 90px;
  align-content: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
}

.analysis-sections {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.section-card {
  padding: 18px;
}

.section-card h3 {
  margin-bottom: 10px;
}

.section-card ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.75;
}

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

.rule-card {
  padding: 18px;
}

.rule-card h3 {
  margin-bottom: 12px;
}

.rule-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rule-note {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.65;
}

.table-wrap {
  margin-top: 18px;
  overflow: auto;
}

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

th,
td {
  padding: 12px;
  border-bottom: 1px solid #e1d8c6;
  text-align: left;
  vertical-align: top;
  line-height: 1.55;
}

th {
  color: var(--white);
  background: var(--jade-dark);
}

tr:nth-child(even) td {
  background: #fbf8f1;
}

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

  .side-panel {
    position: static;
    height: auto;
  }

  .input-grid,
  .result-layout,
  .analysis-sections,
  .rules-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .workspace,
  .side-panel {
    padding: 18px;
  }

  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  h2 {
    font-size: 25px;
  }

  input {
    font-size: 22px;
  }

  .match-row {
    grid-template-columns: 1fr;
  }
}
