:root {
  color-scheme: light;
  --paper: #f8f7f2;
  --ink: #1d3028;
  --muted: #56685e;
  --forest: #203c32;
  --line: #e1e5d9;
  --cream: #f1e9d6;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button, input, select, textarea { border: 1px solid var(--line); border-radius: 9px; }
button { background: white; color: inherit; padding: .65rem .85rem; cursor: pointer; }
button:hover { background: #eff2ea; }
button:disabled { cursor: wait; opacity: .6; }
input, select, textarea { background: white; color: inherit; padding: .7rem .8rem; }
input[type=checkbox] { accent-color: #427353; width: 21px; height: 21px; margin: 0; flex: none; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid #608b55;
  outline-offset: 3px;
}
a { color: inherit; }
h1, h2, p { margin: 0; }
[hidden] { display: none !important; }
.primary { background: var(--forest); color: white; border-color: var(--forest); font-weight: 650; }
.primary:hover { background: #345747; }
.app-page { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--forest);
  color: #f6f8f1;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 31px 16px 20px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px; text-decoration: none; font-size: 17px; font-weight: 750; }
.brand-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: var(--forest);
  background: #dce7c9;
  font-size: 23px;
  flex: none;
}
.categories { display: grid; gap: 5px; margin-top: 39px; }
.sidebar button { background: transparent; border-color: transparent; text-align: left; color: #e3eee6; }
.sidebar button:hover, .sidebar button[aria-pressed=true] { background: #38574a; color: #fff; }
.sidebar button[aria-pressed=true] { font-weight: 700; }
.logout { margin-top: auto; }
.logout button { font-size: 14px; }
.workspace { width: min(100%, 1170px); margin-inline: auto; padding: 32px clamp(20px, 4vw, 62px); }
.summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  min-height: 154px;
  padding: 28px clamp(22px, 4vw, 48px);
  border-radius: 19px;
  border: 1px solid #e9e2cf;
  background: linear-gradient(112deg, #f5edda, #eef0df);
}
.summary h1 { font-family: "Songti SC", SimSun, serif; font-size: clamp(35px, 5vw, 61px); font-weight: 700; letter-spacing: .07em; white-space: nowrap; }
.progress-card { width: min(250px, 40%); }
.progress-card > div { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 9px; font-size: 14px; }
.progress-card strong { font-size: 19px; font-variant-numeric: tabular-nums; white-space: nowrap; }
progress { display: block; width: 100%; height: 8px; border: 0; border-radius: 20px; background: #d8deca; }
progress::-webkit-progress-bar { background: #d8deca; border-radius: 20px; }
progress::-webkit-progress-value { background: #517a56; border-radius: 20px; }
progress::-moz-progress-bar { background: #517a56; border-radius: 20px; }
.toolbar, .tools, .filters { display: flex; align-items: center; gap: 8px; }
.toolbar { justify-content: space-between; gap: 16px; margin: 24px 0; flex-wrap: wrap; }
.filters { gap: 3px; padding: 4px; background: #edeee5; border-radius: 12px; }
.filters button { border-color: transparent; background: transparent; white-space: nowrap; font-size: 14px; padding: .52rem .75rem; }
.filters button[aria-pressed=true] { background: white; box-shadow: 0 1px 3px #203c321c; font-weight: 650; }
.tools input { width: min(200px, 42vw); }
.tools button { white-space: nowrap; }
.group { margin-bottom: 26px; }
.group h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 19px; }
.count { font: 650 12px Inter, sans-serif; border-radius: 12px; color: var(--muted); background: #e9eee2; padding: 3px 7px; }
.rows { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: white; }
.row { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 10px; }
.row + .row { border-top: 1px solid var(--line); }
.row:hover { background: #fbfcf8; }
.row.ready { background: #f5f8f1; }
.item-label { display: flex; align-items: center; gap: 13px; padding: 12px 0 12px 15px; cursor: pointer; flex: 1; min-width: 0; }
.item-copy { display: grid; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.item-copy strong { font-size: 15px; font-weight: 650; }
.item-copy small { font-size: 13px; line-height: 1.5; color: var(--muted); }
.item-states { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px 9px; margin-right: 12px; flex-shrink: 0; }
.bought, .optional-tag { font-size: 12px; white-space: nowrap; }
.bought { min-height: 34px; padding: 5px 8px; color: #536659; border-radius: 7px; }
.bought[aria-pressed=true] { background: #e6efdf; color: #2b593b; border-color: #d6e6ce; }
.optional-tag { color: #72562a; background: #f3ebd9; border-radius: 6px; padding: 3px 6px; }
.empty { color: var(--muted); text-align: center; background: white; padding: 40px 16px; border: 1px solid var(--line); border-radius: 13px; }
footer { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); padding-top: 12px; }
.error { color: #93352f; margin-block: 12px; }
dialog { width: min(420px, calc(100% - 28px)); padding: 24px; border-radius: 15px; border: 1px solid var(--line); color: var(--ink); }
dialog::backdrop { background: #192d2490; }
dialog form, .login-card form { display: grid; gap: 12px; }
dialog label { display: grid; gap: 5px; font-size: 14px; }
dialog label.optional { display: flex; align-items: center; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
.login-page { display: grid; min-height: 100vh; place-items: center; padding: 20px; background: linear-gradient(115deg, #f5edda, #eef0df); }
.login-card { width: min(100%, 380px); border: 1px solid var(--line); padding: 32px; border-radius: 18px; background: white; box-shadow: 0 18px 60px #203c3214; }
.login-card h1 { margin: 12px 0 25px; }
.login-card input { width: 100%; }

@media (max-width: 720px) {
  .app-page { display: block; }
  .sidebar { height: auto; padding: 12px 15px; display: grid; grid-template-columns: 1fr auto; z-index: 1; }
  .brand { padding: 0; }
  .categories { grid-column: 1 / -1; grid-row: 2; display: flex; overflow-x: auto; margin-top: 9px; }
  .categories button { white-space: nowrap; font-size: 13px; padding: .54rem .62rem; }
  .logout { margin: 0; }
  .workspace { padding: 15px 13px 28px; }
  .summary { min-height: 107px; gap: 10px; padding: 18px 15px; }
  .summary h1 { font-size: clamp(27px, 7vw, 42px); }
  .progress-card > div { gap: 5px; font-size: 12px; }
  .progress-card strong { font-size: 15px; }
  .toolbar { margin-block: 16px; gap: 10px; }
  .tools { flex: 1; }
  .tools input { width: 0; flex: 1; min-width: 85px; }
  .item-states { align-items: flex-end; flex-direction: column; margin-right: 8px; }
  .item-label { gap: 8px; padding-left: 9px; }
}
