:root {
  color: #182824;
  background: #f6f6ef;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --muted: #50635b;
  --green: #235c43;
  --green-dark: #184632;
  --border: #d9dfd7;
  --error: #9c352a;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  margin: 0;
  line-height: 1.6;
}

.layout {
  width: min(1056px, calc(100% - 64px));
  margin-inline: auto;
}

.masthead {
  min-height: 85px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding-block: 18px;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-right: auto;
  color: inherit;
  text-decoration: none;
  font-size: 1.25rem;
  font-weight: 750;
  letter-spacing: -.035em;
}

.home-link {
  color: var(--green-dark);
  font-size: .9rem;
  text-underline-offset: .22em;
}

.account-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 100%;
}

.account-actions p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: .9rem;
}

.account-actions button { flex-shrink: 0; }

h1, h2, p { margin: 0; }
h1 { font-size: 2.1rem; line-height: 1.24; letter-spacing: -.045em; }
h2 { font-size: 1.22rem; line-height: 1.35; }
.initial-status { margin-block: 48px; color: var(--muted); }

.login-panel {
  width: min(884px, 100%);
  display: grid;
  grid-template-columns: .94fr 1fr;
  margin: clamp(40px, 9vh, 105px) auto 40px;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: #fffefa;
  overflow: hidden;
  box-shadow: 0 18px 36px #223d2010;
}

.cover {
  min-height: 450px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 26px;
  padding: clamp(28px, 5vw, 54px);
  background: #214f3d;
  color: #f2f5e6;
}

.cover-tag {
  color: #d6e6cd;
  font-weight: 600;
  font-size: .9rem;
  letter-spacing: .11em;
}

.cover-title {
  font-family: "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
  font-size: clamp(2.1rem, 4vw, 3.3rem);
  line-height: 1.32;
  font-weight: 700;
  letter-spacing: -.055em;
}

.cover-lines {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(72%, 174px);
}

.cover-lines span {
  height: 2px;
  border-radius: 2px;
  background: #8fb79e;
}

.cover-lines span:nth-child(2) { width: 78%; }
.cover-lines span:last-child { width: 47%; background: #d9dfaa; }

.login-content {
  align-self: center;
  padding: clamp(28px, 4.7vw, 52px);
}

.login-content > p:not(.feedback) {
  margin-top: 9px;
  color: var(--muted);
}

.login-content form { margin-top: 27px; }
.login-content .primary { width: 100%; }

form { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; }
label { font-size: .9rem; font-weight: 650; }

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

input, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid #afbdb2;
  border-radius: 8px;
  background: #fffefa;
  color: inherit;
  padding: 9px 12px;
}

input::placeholder, textarea::placeholder { color: #65756d; }
textarea { resize: vertical; min-height: 138px; }
.field-hint { color: var(--muted); font-size: .8rem; }

.button {
  width: fit-content;
  min-height: 42px;
  padding: 7px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 650;
}

.primary { background: var(--green); color: #fff; }
.primary:hover { background: var(--green-dark); }
.secondary { color: var(--green-dark); background: #fffefa; border-color: #a7b7ab; }
.secondary:hover { background: #eef2e9; }
.button:disabled { cursor: wait; opacity: .65; }

:focus-visible {
  outline: 2px solid #2d7357;
  outline-offset: 3px;
}

.feedback { color: var(--muted); font-size: .9rem; }
.feedback:not(:empty) { margin-top: 12px; }
.feedback[data-error] { color: var(--error); }

.workspace-intro { padding-block: 44px 28px; }
.workspace-intro h1 { width: fit-content; }

.workspace-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  margin-top: 15px;
}

.workspace-nav a {
  padding-block: 4px;
  color: var(--green-dark);
  text-underline-offset: .2em;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  align-items: start;
  gap: 24px;
  margin-bottom: 40px;
}

.panel {
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fffefa;
}

.panel h2 { margin-bottom: 17px; }

.capture-panel #capture-text { min-height: 176px; }
.capture-panel #capture-question { min-height: 69px; }
#capture-model-status:not(:empty) { margin: 0 0 14px; }
.optional { color: var(--muted); font-weight: 400; }

.capture-actions, .history-heading {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 12px;
}

.history-heading {
  align-items: center;
  justify-content: space-between;
}

.history-heading h2 { margin: 0; }

.capture-preview {
  margin-top: 16px;
  padding: 13px 16px;
  border: 1px solid #dce5d9;
  border-radius: 8px;
  background: #f2f6ec;
}

.capture-preview h3 {
  margin: 0 0 4px;
  font-size: .9rem;
}

.capture-preview p, .capture-record dd {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.capture-history {
  list-style: none;
  display: grid;
  gap: 9px;
  padding: 0;
  margin: 16px 0 0;
}

.capture-record {
  border: 1px solid #e0e6dc;
  border-radius: 8px;
}

.capture-record summary {
  padding: 12px 14px;
  border-radius: inherit;
  cursor: pointer;
}

.capture-record summary:hover { background: #f2f6ec; }

.capture-excerpt {
  display: inline-block;
  vertical-align: bottom;
  max-width: calc(100% - 1.3rem);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 650;
}

.capture-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 11px;
  margin-top: 5px;
  color: var(--muted);
  font-size: .8rem;
}

.capture-state {
  padding: 1px 7px;
  border-radius: 5px;
  color: var(--green-dark);
  background: #ecf1e8;
}

.capture-state[data-state="failed"] { color: var(--error); background: #f9ece7; }

.capture-record dl { margin: 0; padding: 10px 14px 14px; border-top: 1px solid var(--border); }
.capture-record dt { font-size: .84rem; font-weight: 650; }
.capture-record dd { margin: 3px 0 0; }
.capture-record dd + dt { margin-top: 12px; }
.capture-result { padding: 12px 14px; border-top: 1px solid var(--border); }
.capture-result h3 { margin-bottom: 9px; font-size: .95rem; }
.capture-result p { overflow-wrap: anywhere; }
.capture-result article { margin-bottom: 14px; }
.capture-result article time { color: var(--muted); font-size: .8rem; }
.capture-result article dl { padding: 8px 0 0; border: 0; }

.private-notes { margin: -14px 0 30px; }
.private-notes > summary {
  width: fit-content;
  padding: 6px 2px;
  color: var(--muted);
  cursor: pointer;
  font-size: .9rem;
}

.private-notes > .workspace-grid { margin-top: 10px; }

.library-panel { margin-bottom: 36px; }
.library-heading, .library-card-summary-line, .library-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.library-heading { justify-content: space-between; }
.library-heading h2 { margin: 0; }
.library-muted { color: var(--muted); font-size: .86rem; }
.library-heading .library-muted { margin-top: 3px; }

.library-filters, .library-create-list form {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 12px 16px;
  align-items: end;
}

.library-filters { margin-top: 22px; }
.library-panel select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 9px 12px;
  border: 1px solid #afbdb2;
  border-radius: 8px;
  background: #fffefa;
  color: inherit;
  font: inherit;
}

.library-create-list { margin-top: 12px; }
.library-create-list summary { width: fit-content; cursor: pointer; color: var(--green-dark); }
.library-create-list form { margin-top: 8px; grid-template-columns: minmax(0, 1fr) auto; max-width: 31rem; }
.library-panel > p:not(:empty) { margin-top: 14px; }
.library-items, .library-sources, .library-reviews { padding: 0; margin: 0; list-style: none; }
.library-items:not(:empty) { display: grid; gap: 9px; margin-top: 16px; }

.library-card {
  border: 1px solid #e0e6dc;
  border-radius: 10px;
  overflow: hidden;
}

.library-card > summary, .library-source > summary {
  display: block;
  position: relative;
  padding: 13px 15px 13px 36px;
  cursor: pointer;
}

.library-card > summary::-webkit-details-marker, .library-source > summary::-webkit-details-marker { display: none; }
.library-card > summary::before, .library-source > summary::before {
  content: "";
  position: absolute;
  top: 22px;
  left: 16px;
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 1px 1px 0 0;
  transform: rotate(45deg);
}

.library-card[open] > summary::before, .library-source[open] > summary::before { transform: rotate(135deg); }
.library-card > summary:focus-visible { outline-offset: -3px; }
.library-card > summary:hover, .library-card[open] > summary { background: #f2f6ec; }
.library-card-summary-line { justify-content: space-between; gap: 3px 14px; }
.library-expression { font-size: 1.08rem; font-weight: 750; overflow-wrap: anywhere; }
.library-summary-hint { display: block; font-size: .89rem; color: var(--muted); overflow-wrap: anywhere; }

.library-card-body { padding: clamp(15px, 2.6vw, 27px); }
.library-card-body > section + section {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.library-card h3, .library-card h4 { margin: 0 0 7px; }
.library-card h3 { font-size: 1rem; }
.library-card h4 { font-size: .9rem; }
.library-fields { margin: 0; }
.library-fields dt { font-size: .83rem; font-weight: 700; }
.library-fields dd { margin: 1px 0 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.library-fields dd + dt { margin-top: 9px; }
.library-public > .library-muted { margin-bottom: 8px; }

.library-sources { display: grid; gap: 7px; margin-top: 9px; }
.library-source { border: 1px solid #e3e8df; border-radius: 8px; }
.library-source > summary { overflow-wrap: anywhere; }
.library-source[open] > summary { background: #f7f8f3; }
.library-source-body { padding: 12px 15px 15px; }
.library-source-body .library-public { margin-top: 13px; }
.library-source-version { display: block; }
.library-memberships { margin-bottom: 9px; }
.library-actions { align-items: end; }
.library-actions .field { flex: 1 1 12rem; max-width: 24rem; }
.library-review-actions { gap: 8px; }
.library-reviews { display: grid; gap: 5px; margin-top: 9px; }
.library-reviews li { display: flex; flex-wrap: wrap; gap: 3px 9px; align-items: baseline; }
.library-reviews time { color: var(--muted); font-size: .84rem; }

.notes-panel > p { color: var(--muted); }
.notes-panel .secondary { margin-top: 12px; }

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

.note-list li {
  padding: 12px 14px;
  border: 1px solid #e0e6dc;
  border-radius: 8px;
  background: #f7f9f2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 650px) {
  .layout { width: calc(100% - 32px); }
  .login-panel, .workspace-grid { grid-template-columns: 1fr; }
  .login-panel { margin-top: 24px; }
  .cover { min-height: auto; padding: 24px 28px; gap: 15px; }
  .cover-title { font-size: 2rem; }
  .cover-lines { display: none; }
  .workspace-intro { padding-top: 32px; }
}

@media (max-width: 460px) {
  .library-filters { grid-template-columns: 1fr; }
  .library-create-list form { grid-template-columns: 1fr; }
  .library-heading .button { min-height: 38px; padding-inline: 11px; }
}
