:root {
  color-scheme: light;
  --ink: #15231c;
  --muted: #66736c;
  --line: #dfe7e2;
  --paper: #f6f8f4;
  --card: #ffffff;
  --green: #1b7352;
  --green-dark: #11553d;
  --green-soft: #e8f4ed;
  --orange: #d26b2d;
  --red: #b84848;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); }
button, input, textarea { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }

.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 18px 32px; color: white; background: #163f30; box-shadow: 0 8px 30px rgba(17, 50, 38, .18); }
.topbar h1 { margin: 3px 0 0; font-size: 24px; }
.eyebrow { margin: 0; color: #93c7ad; font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.header-actions form { margin: 0; }
.ghost-button, .primary-button, .danger-button, .filter-button { border: 0; border-radius: 10px; cursor: pointer; font-weight: 700; text-decoration: none; transition: .18s ease; }
.ghost-button { display: inline-flex; padding: 9px 13px; color: #eef8f2; background: rgba(255,255,255,.1); }
.ghost-button:hover { background: rgba(255,255,255,.18); }

.page-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 28px; max-width: 1580px; margin: 0 auto; padding: 28px 30px 60px; }
.sidebar { position: sticky; top: 104px; align-self: start; max-height: calc(100vh - 126px); overflow: auto; padding-right: 5px; }
.summary-card { display: flex; align-items: center; gap: 16px; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 8px 30px rgba(32, 67, 49, .06); }
.summary-ring { --progress: 0; display: grid; place-items: center; width: 72px; height: 72px; border-radius: 50%; background: conic-gradient(var(--green) calc(var(--progress) * 1%), #e8eee9 0); position: relative; }
.summary-ring::after { content: ""; position: absolute; width: 54px; height: 54px; border-radius: 50%; background: white; }
.summary-ring strong { z-index: 1; font-size: 15px; }
.summary-card span, .mini-stats span { display: block; color: var(--muted); font-size: 12px; }
.summary-card b { display: block; margin-top: 4px; font-size: 20px; }
.summary-card i { font-style: normal; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 10px 0 16px; }
.mini-stats div { padding: 13px; background: var(--card); border: 1px solid var(--line); border-radius: 13px; }
.mini-stats strong { display: block; margin-top: 3px; font-size: 20px; }
.module-nav { display: grid; gap: 3px; }
.module-nav a { display: grid; grid-template-columns: 38px 1fr auto; align-items: center; gap: 6px; padding: 10px 9px; border-radius: 9px; color: #425248; font-size: 13px; text-decoration: none; }
.module-nav a:hover { color: var(--green); background: #eaf2ec; }
.module-nav span { color: #85928a; font-size: 11px; font-weight: 800; }
.module-nav b { color: #829087; font-size: 11px; }
.danger-button { width: 100%; margin-top: 16px; padding: 10px; color: var(--red); background: #f9ecec; border: 1px solid #efd1d1; }
.danger-button:hover { background: #f4dddd; }

.content { min-width: 0; }
.toolbar { position: sticky; top: 91px; z-index: 10; display: flex; align-items: end; justify-content: space-between; gap: 18px; padding: 14px; margin-bottom: 18px; background: rgba(246, 248, 244, .92); border: 1px solid var(--line); border-radius: 15px; backdrop-filter: blur(12px); }
.search-box { flex: 1; }
.search-box span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 800; }
.search-box input { width: 100%; padding: 11px 13px; color: var(--ink); background: white; border: 1px solid #cfdbd3; border-radius: 10px; outline: none; }
.search-box input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(27, 115, 82, .1); }
.filter-group { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-button { padding: 9px 12px; color: #57655d; background: white; border: 1px solid var(--line); }
.filter-button.active { color: white; background: var(--green); border-color: var(--green); }

.module-section { margin: 0 0 28px; scroll-margin-top: 174px; }
.module-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 10px; }
.module-heading span { color: var(--green); font-size: 11px; font-weight: 900; letter-spacing: .12em; }
.module-heading h2 { margin: 3px 0; font-size: 22px; }
.module-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.module-progress { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.module-progress b { color: var(--green); font-size: 20px; }
.module-progress span { color: var(--muted); letter-spacing: 0; }
.module-progress-track { height: 5px; margin-bottom: 11px; overflow: hidden; background: #e2e9e4; border-radius: 999px; }
.module-progress-track i { display: block; height: 100%; background: linear-gradient(90deg, #2a9a6f, var(--green)); transition: width .25s ease; }
.case-list { display: grid; gap: 9px; }
.test-case { background: var(--card); border: 1px solid var(--line); border-radius: 15px; box-shadow: 0 4px 18px rgba(23, 57, 41, .035); transition: .2s ease; }
.test-case:hover { border-color: #bfd1c5; box-shadow: 0 8px 24px rgba(23, 57, 41, .07); }
.test-case.completed { background: #f4faf6; border-color: #b9d8c7; }
.case-main { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 15px 16px 12px; }
.case-check { display: block; padding-top: 2px; cursor: pointer; }
.case-check input { position: absolute; opacity: 0; }
.case-check span { display: block; width: 23px; height: 23px; border: 2px solid #aab9af; border-radius: 7px; background: white; }
.case-check input:checked + span { border-color: var(--green); background: var(--green); }
.case-check input:checked + span::after { content: ""; display: block; width: 9px; height: 5px; margin: 5px 0 0 5px; border-left: 2px solid white; border-bottom: 2px solid white; transform: rotate(-45deg); }
.case-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.case-title-row code { color: #75837b; font-size: 11px; }
.case-title-row h3 { margin: 0; font-size: 15px; }
.completed .case-title-row h3 { color: #597064; text-decoration: line-through; text-decoration-color: #9db5a7; }
.priority, .dependency-badge { padding: 3px 7px; border-radius: 999px; font-size: 10px; font-weight: 800; }
.priority.p0 { color: #a63d3d; background: #fbe8e8; }
.priority.p1 { color: #8b5b1e; background: #fff1d9; }
.dependency-badge { color: #7651a3; background: #f0e9f8; }
.dependency-text { margin: 7px 0 0; color: #7651a3; font-size: 12px; }
details { margin-top: 8px; }
summary { color: var(--green); font-size: 12px; font-weight: 700; cursor: pointer; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 10px 0 2px; }
.detail-grid div { padding: 11px; background: #f7f9f7; border-radius: 9px; }
.detail-grid b { font-size: 11px; }
.detail-grid p { margin: 5px 0 0; color: #4e5d54; font-size: 13px; line-height: 1.65; }
.case-actions { display: grid; justify-items: end; gap: 7px; min-width: 82px; }
.case-actions a { color: var(--green); font-size: 12px; font-weight: 700; text-decoration: none; }
.save-state { min-height: 16px; color: #819087; font-size: 11px; }
.case-notes { display: block; width: calc(100% - 56px); min-height: 42px; margin: 0 16px 14px 44px; padding: 9px 11px; resize: vertical; color: #435149; background: #f8faf8; border: 1px solid #e0e7e2; border-radius: 9px; outline: none; }
.case-notes:focus { background: white; border-color: #9fc1ad; }
.empty-state { padding: 60px 20px; color: var(--muted); text-align: center; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; padding: 12px 16px; color: white; background: #263b31; border-radius: 10px; opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s; }
.toast.visible { opacity: 1; transform: translateY(0); }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top, #315f4a 0, #173d2f 42%, #102b21 100%); }
.login-card { width: min(430px, 100%); padding: 38px; background: rgba(255,255,255,.98); border-radius: 24px; box-shadow: 0 28px 80px rgba(0,0,0,.28); }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 20px; color: white; background: var(--green); border-radius: 15px; font-size: 23px; font-weight: 900; }
.login-card h1 { margin: 5px 0 10px; font-size: 28px; }
.login-copy { color: var(--muted); line-height: 1.65; }
.login-form { display: grid; gap: 15px; margin-top: 24px; }
.login-form label { color: #526159; font-size: 12px; font-weight: 800; }
.login-form input { width: 100%; margin-top: 7px; padding: 12px; border: 1px solid #cbd7cf; border-radius: 10px; outline: none; }
.login-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(27,115,82,.1); }
.primary-button { padding: 13px; color: white; background: var(--green); }
.primary-button:hover { background: var(--green-dark); }
.alert { margin-top: 15px; padding: 10px 12px; color: #9d3737; background: #fceaea; border-radius: 9px; font-size: 13px; }

@media (max-width: 980px) {
  .page-shell { grid-template-columns: 1fr; padding: 20px 16px 50px; }
  .sidebar { position: static; max-height: none; }
  .module-nav { display: none; }
  .toolbar { top: 86px; align-items: stretch; flex-direction: column; }
}

@media (max-width: 680px) {
  .topbar { position: static; padding: 17px; align-items: flex-start; flex-direction: column; }
  .header-actions { width: 100%; }
  .header-actions .ghost-button { flex: 1; justify-content: center; }
  .header-actions form { flex: 1; }
  .header-actions form button { width: 100%; }
  .toolbar { position: static; }
  .filter-group { display: grid; grid-template-columns: 1fr 1fr; }
  .module-heading { align-items: flex-start; }
  .case-main { grid-template-columns: 26px minmax(0, 1fr); }
  .case-actions { grid-column: 2; justify-items: start; display: flex; }
  .detail-grid { grid-template-columns: 1fr; }
  .case-notes { width: calc(100% - 58px); }
  .login-card { padding: 28px 22px; }
}
