:root {
  color-scheme: light;
  --bg: #f5f6f2;
  --surface: #ffffff;
  --surface-soft: #f0f3ed;
  --ink: #1f2722;
  --muted: #69746c;
  --line: #dfe5dc;
  --accent: #256f5b;
  --accent-dark: #174b3e;
  --accent-soft: #dbeee7;
  --warning: #b36b20;
  --danger: #a33c32;
  --shadow: 0 16px 40px rgba(31, 39, 34, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  padding: 28px 20px;
  background: #18231e;
  color: #f4f7f2;
}

.mobile-install-card {
  display: none;
  margin-top: 18px;
}

.mobile-install-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.helper-copy {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

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

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #dcefe7;
  color: #173f35;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}

.brand p,
.sidebar-note span,
.subtle {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.sidebar .brand p,
.sidebar-note span {
  color: #b9c7bf;
}

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

.nav-item,
.quick-actions button,
.template-list button,
.button-row button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.nav-item {
  width: 100%;
  border-color: rgba(255, 255, 255, 0.08);
  background: transparent;
  color: #dce5df;
  text-align: left;
  padding: 12px 14px;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.sidebar-note {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-note strong {
  display: block;
  margin-bottom: 8px;
}

.main {
  padding: 36px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h2 {
  font-size: 30px;
}

h3 {
  font-size: 17px;
}

.primary-action {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.primary-action:hover {
  background: var(--accent-dark);
}

.secondary-action {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--ink);
}

.score-panel,
.panel,
.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.score-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  align-items: center;
  gap: 24px;
  padding: 26px;
  margin-bottom: 18px;
}

.panel-label,
.metric-card span,
.review-summary span {
  color: var(--muted);
  font-size: 14px;
}

.score-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.score-line strong {
  font-size: 56px;
  line-height: 1;
}

.score-line span {
  color: var(--muted);
  font-size: 20px;
}

.score-panel p {
  margin: 10px 0 0;
  color: var(--muted);
}

.score-meter {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.score-meter div {
  width: 82%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  padding: 18px;
}

.metric-card strong {
  display: block;
  margin-top: 10px;
  font-size: 28px;
}

.two-column,
.form-report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.form-report-layout {
  align-items: start;
}

.panel {
  padding: 22px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.insight-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.insight-list li,
.report-copy p,
.report-copy li,
.empty-state p {
  color: var(--muted);
  line-height: 1.7;
}

.insight-list li {
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-soft);
}

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

.quick-actions button:hover,
.template-list button:hover,
.button-row button:hover,
.section-title button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.section-title button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--muted);
}

.form-panel {
  display: grid;
  gap: 16px;
}

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

label {
  display: grid;
  gap: 7px;
  color: #344039;
  font-size: 14px;
  font-weight: 650;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

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

.button-row button:not(.primary-action) {
  padding: 0 16px;
}

.report-panel {
  position: sticky;
  top: 24px;
}

.empty-state {
  display: grid;
  min-height: 320px;
  place-content: center;
  text-align: center;
}

.report-status {
  display: inline-flex;
  margin-bottom: 14px;
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
}

.report-status.warn {
  background: #f8eadb;
  color: var(--warning);
}

.report-status.danger {
  background: #f5dedb;
  color: var(--danger);
}

.report-block {
  margin-top: 18px;
}

.report-block h4 {
  margin: 0 0 8px;
}

.report-block ul,
.report-copy ul {
  margin: 0;
  padding-left: 20px;
}

.check-list {
  display: grid;
  gap: 12px;
}

.check-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.check-list input {
  width: auto;
}

.rule-preview {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  line-height: 1.7;
}

.risk-bars {
  display: grid;
  gap: 14px;
}

.risk-bars div {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 12px;
}

meter {
  width: 100%;
  height: 12px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 13px;
}

.tag {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tag.warn {
  background: #f8eadb;
  color: var(--warning);
}

.tag.danger {
  background: #f5dedb;
  color: var(--danger);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 32px));
  border-radius: 8px;
  padding: 14px 16px;
  background: #18231e;
  color: white;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

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

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

.review-summary div {
  padding: 14px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.review-summary strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

.preview-list {
  display: grid;
  gap: 10px;
}

.preview-item {
  padding: 12px;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  line-height: 1.6;
}

.screenshot-import {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfa;
}

.screenshot-import .section-title {
  margin-bottom: 0;
}

.file-drop {
  display: grid;
  gap: 6px;
  border: 1px dashed #b8c4bb;
  border-radius: 8px;
  padding: 16px;
  background: var(--surface);
  cursor: pointer;
}

.file-drop input {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
}

.file-drop span {
  color: var(--ink);
  font-weight: 750;
}

.file-drop small {
  color: var(--muted);
  font-weight: 500;
  line-height: 1.6;
}

.screenshot-preview {
  display: grid;
  min-height: 120px;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  text-align: center;
}

.screenshot-preview img {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  background: #ffffff;
}

.screenshot-preview p {
  margin: 0;
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 8;
    height: auto;
    padding: calc(14px + env(safe-area-inset-top)) 18px 14px;
    box-shadow: 0 12px 30px rgba(24, 35, 30, 0.18);
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

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

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

  .sidebar-note {
    display: none;
  }

  .nav {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 9;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(24, 35, 30, 0.12);
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(18px);
  }

  .nav-item {
    min-height: 50px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    text-align: center;
    padding: 8px 4px;
  }

  .nav-item.active,
  .nav-item:hover {
    background: var(--accent-soft);
    color: var(--accent-dark);
  }

  .main {
    padding: 24px 18px calc(92px + env(safe-area-inset-bottom));
  }

  .score-panel,
  .two-column,
  .form-report-layout {
    grid-template-columns: 1fr;
  }

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

  .report-panel {
    position: static;
  }

  .mobile-install-card {
    display: block;
  }

  .toast {
    right: 14px;
    bottom: calc(84px + env(safe-area-inset-bottom));
    left: 14px;
    max-width: none;
  }
}

@media (max-width: 640px) {
  body {
    background: var(--surface-soft);
  }

  .main {
    padding: 18px 12px calc(92px + env(safe-area-inset-bottom));
  }

  .page-heading {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
  }

  .page-heading .primary-action,
  .button-row .primary-action {
    width: 100%;
  }

  .metric-grid,
  .form-grid,
  .quick-actions,
  .template-list,
  .review-summary {
    grid-template-columns: 1fr;
  }

  h2 {
    font-size: 24px;
  }

  .score-line strong {
    font-size: 44px;
  }

  .score-panel,
  .panel,
  .metric-card {
    box-shadow: none;
  }

  .score-panel,
  .panel {
    padding: 18px;
  }

  .score-panel {
    gap: 16px;
  }

  .metric-grid {
    gap: 10px;
  }

  .metric-card {
    padding: 14px;
  }

  .metric-card strong {
    font-size: 24px;
  }

  .brand {
    gap: 10px;
  }

  .brand p {
    display: none;
  }

  .nav-item {
    min-height: 48px;
    font-size: 10px;
  }

  input,
  select,
  textarea {
    min-height: 44px;
    font-size: 16px;
  }

  .button-row {
    display: grid;
  }

  table {
    font-size: 13px;
  }
}
