:root {
  color-scheme: light;
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  color: #212a28;
  background: #f4f5f0;
  --surface: #fff;
  --muted: #52615c;
  --line: #dde3db;
  --accent: #1c6153;
  --accent-hover: #134c40;
  --highlight: #e9f3ec;
  --warning: #862f28;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
[hidden] { display: none !important; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
a { color: var(--accent); text-underline-offset: .18em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }

.masthead { border-bottom: 1px solid var(--line); background: var(--surface); }
.masthead-inner {
  max-width: 1320px;
  min-height: 66px;
  margin-inline: auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: .98rem; font-weight: 750; white-space: nowrap; }
.brand-mark { width: 16px; height: 16px; border: 4px solid var(--accent); border-radius: 5px; transform: rotate(-14deg); }

.button {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font-size: .875rem;
  font-weight: 650;
  white-space: nowrap;
}
.button-primary { color: #fff; background: var(--accent); }
.button-primary:hover:not(:disabled) { background: var(--accent-hover); }
.button-quiet { border-color: var(--line); background: var(--surface); }
.button-quiet:hover:not(:disabled) { background: var(--highlight); }
.button-inline { color: var(--accent); padding-inline: 8px; }
.button-inline:hover { background: var(--highlight); }

.startup { margin: 52px auto; padding-inline: 24px; max-width: 420px; color: var(--muted); text-align: center; }
.login {
  width: min(400px, calc(100% - 32px));
  margin: clamp(34px, 12vh, 125px) auto 32px;
  padding: clamp(22px, 5vw, 34px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 14px 38px #26373012;
}
.login h1 { margin-bottom: 27px; font-size: 1.5rem; }
.login form { display: grid; gap: 10px; }
.login label { color: #35433c; font-weight: 650; font-size: .875rem; }
.login input {
  width: 100%;
  min-height: 44px;
  margin-bottom: 8px;
  padding: 9px 12px;
  border: 1px solid #b8c5bd;
  border-radius: 8px;
  color: #212a28;
  background: #fff;
}
.login .button { min-height: 44px; margin-top: 6px; }
.form-message { min-height: 1.35em; font-size: .875rem; color: var(--warning); line-height: 1.5; }

.key-dialog {
  width: min(435px, calc(100% - 32px));
  padding: clamp(18px, 5vw, 26px);
  color: inherit;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}
.key-dialog::backdrop { background: #1d302a85; }
.key-dialog h2 { font-size: 1.2rem; }
.key-dialog p:not(.form-message) { margin: 9px 0 17px; color: var(--muted); font-size: .875rem; line-height: 1.5; }
.key-dialog form { display: grid; gap: 9px; }
.key-dialog label { color: #35433c; font-size: .875rem; font-weight: 650; }
.key-dialog input { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid #b8c5bd; border-radius: 8px; }
.key-dialog input[readonly] { margin-top: 5px; font-family: ui-monospace, monospace; }
.key-dialog .form-message { margin: 8px 0; }

.workspace { max-width: 1320px; margin-inline: auto; padding: 34px 28px 60px; }
.workspace-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 19px; }
.workspace-header h1 { font-size: clamp(1.65rem, 4vw, 2.35rem); letter-spacing: -.025em; }
.workspace-message:empty { display: none; }
.workspace-message:not(:empty) { margin-bottom: 10px; }
.record-layout { display: grid; grid-template-columns: minmax(260px, .85fr) minmax(0, 2fr); gap: 18px; align-items: start; }
.record-list, .record-detail { border: 1px solid var(--line); background: var(--surface); border-radius: 14px; min-width: 0; }
.record-list { overflow: hidden; }
.list-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; min-height: 64px; }
.list-header h2 { font-size: 1rem; }
.filter-label, .list-message { padding: 0 16px 13px; color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.list-message:empty { padding: 0; }
.records { list-style: none; padding: 0; margin: 0; }
.records li { border-top: 1px solid var(--line); }
.record {
  display: grid;
  width: 100%;
  padding: 13px 16px;
  gap: 7px;
  text-align: start;
  color: inherit;
  background: var(--surface);
  border: 0;
  border-left: 3px solid transparent;
}
.record:hover, .record[aria-current="true"] { background: var(--highlight); }
.record[aria-current="true"] { border-left-color: var(--accent); }
.record:focus-visible { outline-offset: -4px; }
.record-title-line, .record-meta-line { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.record-title { font-size: .91rem; line-height: 1.38; overflow-wrap: anywhere; }
.record-meta-line { justify-content: start; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.badge { padding: 3px 7px; border-radius: 6px; color: #465550; background: #edf0ec; font-size: .72rem; line-height: 1.35; white-space: nowrap; }
.badge-good { color: #184c3b; background: #e2f1e7; }
.badge-progress { color: #765018; background: #faf1da; }
.badge-warning { color: #812f29; background: #f8e7e5; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--line); padding: 12px 14px; }
.pager span { color: var(--muted); font-size: .82rem; }

.record-detail { min-height: 360px; padding: clamp(16px, 3vw, 27px); }
.empty-detail { color: var(--muted); line-height: 1.65; }
.detail-top { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: 12px; }
.detail-top h2 { font-size: clamp(1.2rem, 3vw, 1.55rem); line-height: 1.35; overflow-wrap: anywhere; }
.detail-top p { margin-top: 5px; color: var(--muted); font-size: .83rem; }
.detail-status { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px 16px;
  background: #f6f8f4;
  border-radius: 9px;
  padding: 14px;
  margin: 17px 0 0;
}
.details dt { color: var(--muted); font-size: .76rem; margin-bottom: 3px; }
.details dd { margin: 0; font-size: .86rem; line-height: 1.45; overflow-wrap: anywhere; }
.key-found { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.key-found .button { min-height: 30px; padding-block: 4px; font-size: .78rem; }
.error-detail { margin-top: 15px; padding: 10px 12px; color: var(--warning); background: #f9efed; border-radius: 8px; font-size: .85rem; line-height: 1.5; overflow-wrap: anywhere; }
.detail-block { margin-top: 24px; }
.detail-block h3 { font-size: .96rem; margin-bottom: 10px; }
.detail-block-message { color: var(--muted); font-size: .83rem; line-height: 1.5; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(145px, 100%), 1fr)); gap: 9px; }
.media { margin: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: #f6f8f4; min-width: 0; }
.media-preview { display: block; width: 100%; min-height: 120px; max-height: 225px; aspect-ratio: 4 / 3; object-fit: contain; background: #eff3ed; }
.media-caption { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 5px 8px; min-height: 43px; padding: 7px 9px; font-size: .8rem; }
.media-caption span { overflow-wrap: anywhere; }
.guidance, .prompt-content { font-family: inherit; white-space: pre-wrap; overflow-wrap: anywhere; font-size: .87rem; line-height: 1.65; }
.guidance { border-radius: 8px; background: #f6f8f4; padding: 10px 12px; }
.prompt { margin-bottom: 7px; border: 1px solid var(--line); border-radius: 8px; }
.prompt summary { cursor: pointer; padding: 10px 12px; font-size: .83rem; font-weight: 650; }
.prompt-content { margin: 0; padding: 0 12px 12px; max-height: 380px; overflow: auto; }

@media (max-width: 760px) {
  .masthead-inner { padding-inline: 16px; }
  .workspace { padding: 23px 16px 38px; }
  .record-layout { grid-template-columns: 1fr; }
  .record-detail { min-height: 180px; }
}

@media (max-width: 380px) {
  .details { grid-template-columns: 1fr; }
}
