:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #647069;
  --line: #d8ded9;
  --paper: #ffffff;
  --canvas: #f4f6f4;
  --sidebar: #202622;
  --accent: #3f6650;
  --accent-strong: #2f503d;
  --soft-green: #e8f0eb;
  --soft-blue: #eaf0f4;
  --danger: #a23c36;
  --shadow: 0 14px 35px rgba(24, 35, 28, .12);
  font-family: "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { color: var(--ink); background: var(--canvas); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, .primary-button {
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease;
}
button:hover, .primary-button:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
button:disabled { cursor: not-allowed; opacity: .45; }
button.secondary { color: var(--accent-strong); background: #fff; border-color: #aebbb2; }
button.secondary:hover { background: var(--soft-green); }
button.quiet { min-height: 34px; padding: 0 10px; color: #dbe3dd; background: transparent; border-color: #5b665e; }
button.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.eyebrow { margin: 0 0 8px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0; }

/* Landing */
.landing-page { min-height: 100vh; background: #1b211d; }
.landing { position: relative; min-height: 100vh; overflow: hidden; isolation: isolate; }
.landing-backdrop {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url("/assets/entry-background.png") center/cover no-repeat;
}
.landing-backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(17, 23, 19, .88) 0%, rgba(17, 23, 19, .68) 45%, rgba(17, 23, 19, .18) 100%);
}
.landing-content {
  width: min(720px, calc(100% - 48px));
  padding-top: clamp(110px, 20vh, 190px);
  margin-left: clamp(24px, 10vw, 170px);
  color: #fff;
}
.landing-content .eyebrow { color: #c5d7ca; }
.landing-content h1 { margin: 0; max-width: 680px; font-size: clamp(36px, 6vw, 68px); line-height: 1.08; font-weight: 700; }
.landing-content p:not(.eyebrow) { margin: 22px 0 34px; color: #e4ebe6; font-size: 18px; }
.landing-enter { display: inline-flex; align-items: center; justify-content: center; min-width: 156px; }
.landing footer { position: absolute; left: clamp(24px, 10vw, 170px); right: 24px; bottom: 28px; color: #dce4de; font-size: 12px; display: flex; flex-wrap: wrap; gap: 10px 18px; }
.public-security-filing { display: inline-flex; align-items: center; gap: 5px; }
.public-security-filing img { width: 20px; height: 22px; object-fit: contain; flex-shrink: 0; }

/* Workspace shell */
.workspace-page { min-height: 100vh; }
.app-shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 14px 18px;
  color: #e7ece8;
  background: var(--sidebar);
}
.brand { display: block; padding: 0 8px 18px; border-bottom: 1px solid #3a433d; }
.brand strong { display: block; font-size: 20px; }
.brand span { display: block; margin-top: 5px; color: #aab5ad; font-size: 11px; }
.project-panel { margin: 20px 0 18px; padding: 0 8px; }
.project-panel label { display: block; margin-bottom: 7px; color: #aeb8b1; font-size: 12px; }
.project-panel select { width: 100%; height: 40px; padding: 0 9px; border: 1px solid #667168; border-radius: 4px; color: #fff; background: #2d352f; }
.project-actions { display: grid; grid-template-columns: 1fr auto; gap: 7px; margin-top: 8px; }
.project-actions button { min-height: 34px; padding: 0 10px; }
.sidebar nav { display: grid; gap: 5px; }
.nav-button {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  text-align: left;
  color: #dfe6e1;
  background: transparent;
  border: 0;
}
.nav-button:hover, .nav-button.active { background: #3f5d49; }
.nav-button span { font-size: 20px; }
.sidebar-bottom { display: grid; gap: 9px; margin-top: auto; padding: 16px 8px 0; border-top: 1px solid #3a433d; color: #aeb8b1; font-size: 12px; }

.main { min-width: 0; padding: 0 28px 40px; }
.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  min-height: 128px;
  padding: 26px 2px 22px;
  border-bottom: 1px solid var(--line);
}
.topbar h1 { margin: 0; font-size: 28px; }
.topbar p:not(.eyebrow) { margin: 6px 0 0; color: var(--muted); }
.project-summary { min-width: 190px; text-align: right; color: var(--muted); font-size: 13px; }
.project-summary strong { display: block; color: var(--ink); font-size: 15px; }

.view { padding-top: 24px; }
.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px auto;
  gap: 10px;
  max-width: 920px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid #bfc8c1;
  border-radius: 4px;
  color: var(--ink);
  background: #fff;
  outline: none;
}
input, select { height: 40px; padding: 0 11px; }
textarea { padding: 10px 11px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(63, 102, 80, .12); }
.section-meta { min-height: 28px; padding: 14px 2px 8px; color: var(--muted); font-size: 13px; }

.result-list, .practice-list { display: grid; gap: 10px; }
.result-row, .practice-card {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(280px, 1.6fr) 130px;
  gap: 18px;
  align-items: start;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
}
.result-row h3, .practice-card h3 { margin: 0 0 7px; font-size: 15px; }
.result-row p, .practice-card p { margin: 0; color: #3b4740; font-size: 13px; line-height: 1.65; white-space: pre-line; }
.item-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { padding: 3px 7px; border-radius: 3px; color: #47604f; background: var(--soft-green); font-size: 11px; }
.row-actions { display: flex; justify-content: flex-end; gap: 7px; }
.row-actions button { min-height: 34px; padding: 0 11px; }

.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.section-heading h2 { margin: 0; font-size: 20px; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.heading-actions { display: flex; gap: 8px; }
.empty {
  padding: 50px 24px;
  border: 1px dashed #b8c3bb;
  text-align: center;
  color: var(--muted);
  background: #fafbfa;
}

.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: #fff; }
.materials-table { width: 100%; min-width: 980px; border-collapse: collapse; table-layout: fixed; }
.materials-table th { padding: 11px 9px; text-align: left; color: #4f5c54; background: #edf1ee; font-size: 12px; }
.materials-table td { padding: 8px; border-top: 1px solid #e4e8e5; vertical-align: top; }
.materials-table th:nth-child(1) { width: 110px; }
.materials-table th:nth-child(2) { width: 170px; }
.materials-table th:nth-child(3) { width: 120px; }
.materials-table th:nth-child(4) { width: 160px; }
.materials-table th:nth-child(5) { width: 170px; }
.materials-table th:nth-child(7) { width: 54px; }
.materials-table input { height: 34px; border-color: #d4dad5; }
.materials-table .icon-button { color: var(--danger); }

dialog { width: min(610px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 6px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(18, 24, 20, .55); }
dialog form { display: grid; gap: 15px; padding: 22px; }
dialog label { display: grid; gap: 7px; color: #465249; font-size: 13px; }
.dialog-heading, .dialog-actions { display: flex; align-items: center; gap: 10px; }
.dialog-heading { justify-content: space-between; }
.dialog-heading h2 { margin: 0; font-size: 20px; }
.dialog-actions { display: grid; grid-template-columns: auto 1fr auto auto; margin-top: 5px; }
.icon-button { width: 34px; min-height: 34px; padding: 0; color: #536057; background: transparent; border-color: transparent; font-size: 22px; }
.icon-button:hover { color: var(--ink); background: #eef1ef; border-color: #d4dad5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: 5px;
  color: #fff;
  background: #26332a;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .18s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

@media (max-width: 850px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar nav { grid-template-columns: repeat(3, 1fr); }
  .sidebar-bottom { display: none; }
  .main { padding: 0 16px 30px; }
  .topbar { min-height: 110px; }
  .toolbar { grid-template-columns: 1fr; }
  .result-row, .practice-card { grid-template-columns: 1fr; }
  .row-actions { justify-content: flex-start; }
}
@media (max-width: 560px) {
  .landing-content { margin-left: 24px; }
  .sidebar nav { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .project-summary { text-align: left; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
}

