:root {
  color-scheme: light;
  --ground: #f2f4f1;
  --sheet: #fff;
  --surface: #f5f7f4;
  --rule: #e5eae4;
  --ink: #202820;
  --muted: #526257;
  --accent: #166950;
  --dark-accent: #0d543d;
  --soft-accent: #e5f1e9;
  --error: #9d281e;
  --warm: #89501d;
  --text: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--ground); font: 14px/1.55 var(--text); }
button, input, textarea, select { font: inherit; color: inherit; }
button, a { touch-action: manipulation; }
button { border: 1px solid var(--rule); background: var(--sheet); padding: .48rem .8rem; border-radius: 7px; cursor: pointer; white-space: nowrap; }
button:hover { background: var(--surface); }
button.primary { background: var(--accent); color: white; border-color: var(--accent); }
button.primary:hover { background: var(--dark-accent); }
button:disabled { opacity: .55; cursor: not-allowed; }
a { color: var(--accent); }
input, textarea, select { width: 100%; padding: .55rem .7rem; border: 1px solid #cbd5cb; border-radius: 6px; background: var(--sheet); }
textarea { resize: vertical; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1,h2,h3,p { margin: 0; }
h1 { font-size: 25px; letter-spacing: -.035em; line-height: 1.3; font-weight: 640; }
h2 { font-size: 17px; line-height: 1.4; }
h3 { font-size: 14px; }
small,.muted { color: var(--muted); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.sign-in { width: min(100%, 360px); background: var(--sheet); padding: 36px; border-radius: 16px; display: grid; gap: 18px; }
.sign-in label { display: grid; gap: 6px; }
.error { color: var(--error); overflow-wrap: anywhere; font-size: 13px; }
.frame { min-height: 100vh; display: grid; grid-template-columns: 208px minmax(0,1fr); }
.rail { padding: 24px 12px 20px 18px; display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand strong { font-size: 15px; }
.mark { display: inline-block; flex: 0 0 23px; width: 23px; height: 22px; position: relative; color: var(--accent); }
.mark::before,.mark::after { content:""; position: absolute; top: 3px; width: 10px; height: 15px; border: 2px solid currentColor; }
.mark::before { left: 1px; transform: skewY(17deg); border-radius: 2px 1px 0 2px; }
.mark::after { right: 1px; transform: skewY(-17deg); background: var(--soft-accent); border-radius: 1px 2px 2px 0; }
.rail nav { display: grid; gap: 4px; }
.rail nav button,.logout { background: transparent; border-color: transparent; text-align: left; padding: 9px 12px; }
.rail nav button[aria-current="page"] { color: var(--dark-accent); background: #e4ebe3; font-weight: 650; }
.rail nav button:hover,.logout:hover { background: #e9eee8; }
.logout { align-self: start; margin-top: auto; color: var(--muted); font-size: 13px; }
.sheet { margin: 8px 8px 8px 0; background: var(--sheet); border-radius: 15px; border: 1px solid var(--rule); min-width: 0; }
.toolbar { border-bottom: 1px solid var(--rule); min-height: 64px; padding: 12px clamp(18px,3vw,42px); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.global-search { display: flex; gap: 8px; width: min(520px,75%); }
.global-search input { background: var(--surface); border-color: var(--rule); }
.online { font-size: 12px; color: var(--muted); white-space: nowrap; }
.online:not(:empty)::before { display: inline-block; background: var(--accent); content: ""; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.view { padding: 24px clamp(18px,3vw,42px) 42px; max-width: 1440px; margin: auto; }
.heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 18px; }
.heading .actions { margin: 0; }
.totals { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; max-width: 720px; margin: 0 0 26px; }
.total { background: var(--surface); display: grid; gap: 2px; padding: 13px 16px; border-radius: 9px; color: var(--muted); }
.total strong { color: var(--ink); font-weight: 520; font-size: 26px; font-variant-numeric: tabular-nums; }
.library { display: grid; grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr); gap: 24px; align-items: start; }
.panel { min-width: 0; }
.panel > h2 { margin: 0 0 10px; }
.reader { border-left: 1px solid var(--rule); min-height: 300px; padding-left: 24px; overflow-wrap: anywhere; }
.reader .body { white-space: pre-wrap; margin: 20px 0; line-height: 1.8; }
.reader h2 { font-size: 20px; }
.list { display: grid; }
.row { padding: 12px 0; border-bottom: 1px solid var(--rule); display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; min-width: 0; }
.row:first-child { border-top: 1px solid var(--rule); }
.row .leading { min-width: 0; display: grid; gap: 3px; overflow-wrap: anywhere; }
.row .leading button { border: 0; padding: 0; border-radius: 2px; background: none; text-align: left; white-space: normal; font-weight: 650; }
.row .leading button:hover { color: var(--accent); text-decoration: underline; }
.row .leading button[aria-pressed="true"] { color: var(--accent); }
.meta { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.snippet { color: var(--muted); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.empty { background: var(--surface); padding: 22px; border-radius: 8px; color: var(--muted); }
.actions,.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions { margin: 12px 0; }
.state { color: var(--muted); font-size: 12px; flex-shrink: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.state[data-status="succeeded"],.state[data-status="online"] { color: var(--accent); }
.state[data-status="failed"],.state[data-status="revoked"] { color: var(--error); }
.state[data-status="running"],.state[data-status="queued"],.state[data-status="partial"] { color: var(--warm); }
.editor { display: grid; gap: 10px; padding: 16px; background: var(--surface); border-radius: 8px; margin-bottom: 16px; }
.editor label { display: grid; gap: 4px; font-weight: 550; }
.section { margin-top: 26px; }
.section h2 { margin-bottom: 8px; }
.details { background: var(--surface); border-radius: 10px; margin: 16px 0; padding: 16px; }
.token { display:block; overflow-wrap:anywhere; white-space:pre-wrap; background: var(--soft-accent); padding:12px; user-select:all; }
@media (max-width: 900px) {
  .frame { grid-template-columns: 144px minmax(0,1fr); }
  .library { gap: 14px; grid-template-columns: minmax(195px,.75fr) minmax(0,1.25fr); }
  .reader { padding-left: 14px; }
}
@media (max-width: 680px) {
  .frame { display: block; }
  .rail { display: flex; flex-wrap: wrap; flex-direction: row; height: auto; position: static; align-items: center; padding: 11px 15px; gap: 8px; }
  .rail nav { order: 2; width: 100%; display: flex; overflow-x: auto; gap: 3px; }
  .rail nav button { padding: 6px 9px; }
  .logout { margin-left: auto; }
  .sheet { border-radius: 0; margin: 0; border-left: 0; border-right: 0; }
  .library { grid-template-columns: 1fr; }
  .reader { padding: 18px 0 0; border-left: 0; border-top: 1px solid var(--rule); min-height: 0; }
  .total { padding: 8px 9px; }
  .total strong { font-size: 21px; }
}
