:root {
  color-scheme: light;
  --ground: #ecf2ef;
  --paper: #fcfdfa;
  --ink: #16322e;
  --muted: #4e6862;
  --line: #d0ded6;
  --teal: #286a5c;
  --blue: #235a7c;
  --blue-light: #e7f1f6;
  --danger: #952d36;
  --danger-light: #fbecee;
  --mono: 'Cascadia Mono', Consolas, monospace;
  font: 15px/1.6 'Microsoft YaHei UI', 'PingFang SC', 'Noto Sans CJK SC', 'Segoe UI', system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; background: var(--ground); color: var(--ink); }
h1, h2, h3, p, dl, dd { margin: 0; }
a { color: var(--blue); text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
:focus-visible { outline: 2px solid #2557a1; outline-offset: 3px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }

.header { min-height: 64px; border-bottom: 1px solid var(--line); background: #f5f8f4; }
.header-inner, .shell { width: min(100% - 64px, 1216px); margin: auto; }
.header-inner { min-height: 63px; display: flex; justify-content: space-between; align-items: center; gap: 15px; }
.header-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 7px 10px; }
#employee { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 720; letter-spacing: .005em; }
.brand > span:last-child { margin-left: 1px; padding-left: 11px; border-left: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 580; white-space: nowrap; }
.brand-icon { width: 27px; height: 19px; position: relative; border: 1.5px solid var(--teal); border-radius: 3px; background: repeating-linear-gradient(90deg, var(--teal) 0 2px, transparent 2px 5px) 4px 3px / 19px 2px no-repeat, repeating-linear-gradient(90deg, var(--teal) 0 2px, transparent 2px 5px) 4px 13px / 19px 2px no-repeat; }
.brand-icon::after { position: absolute; top: 6px; left: 10px; width: 6px; height: 5px; content: ''; clip-path: polygon(0 0,100% 50%,0 100%); background: var(--teal); }

.shell { padding: 31px 0 42px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.spec { font: 600 13px/1.4 var(--mono); color: var(--teal); }
h1 { margin-top: 4px; font-size: clamp(30px, 5vw, 51px); line-height: 1.18; font-weight: 760; letter-spacing: -.03em; }
.intro-copy { margin-top: 8px; color: var(--muted); font-size: 14px; }
.refresh { display: grid; justify-items: end; gap: 4px; flex-shrink: 0; }
.button { display: inline-flex; justify-content: center; align-items: center; gap: 7px; min-height: 37px; padding: 7px 12px; border: 1px solid #9fb8ae; border-radius: 5px; background: #f7fbf8; color: var(--ink); font-weight: 630; font-size: 13px; line-height: 1.35; white-space: nowrap; }
.button:hover:not(:disabled) { background: #e9f4ed; border-color: #608878; }
.button-primary { border-color: var(--teal); background: var(--teal); color: white; }
.button-primary:hover:not(:disabled) { background: #155346; border-color: #155346; }
.button-link { color: var(--blue); }
.button-quiet { min-height: 32px; padding: 4px 8px; color: var(--blue); background: transparent; border-color: var(--line); }
.button-danger { color: var(--danger); }
.button-danger:hover:not(:disabled) { background: var(--danger-light); border-color: #b67b81; }

.workspace { display: grid; grid-template-columns: minmax(290px, .83fr) minmax(0, 1.37fr); align-items: start; gap: 19px; }
.panel { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); box-shadow: 0 2px 5px #153d3107; }
.login { max-width: 450px; }
.login .panel-head { border-bottom: 1px solid var(--line); }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 13px 16px 11px; }
.panel-head h2 { font-size: 17px; font-weight: 710; }
.filters { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 15px 12px; border-bottom: 1px solid var(--line); }
.filter { display: flex; align-items: center; gap: 3px; padding: 4px 7px; border: 1px solid transparent; border-radius: 4px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 550; white-space: nowrap; }
.filter:hover { background: #eaf3ee; }
.filter[aria-pressed='true'] { background: #e1eee7; border-color: #b7d4c4; color: #143c31; font-weight: 680; }
.filter span { font: 11px var(--mono); }
.jobs { max-height: max(430px, 66vh); overflow: auto; }
.job { display: block; position: relative; width: 100%; padding: 13px 15px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; }
.job:last-child { border-bottom: 0; }
.job:hover { background: #f0f6f2; }
.job[aria-pressed='true'] { background: #e5f1e9; }
.job[aria-pressed='true']::before { position: absolute; top: 0; bottom: 0; left: 0; width: 4px; content: ''; background: var(--teal); }
.job:focus-visible { outline-offset: -3px; }
.job-leading { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.job-title { font-weight: 680; line-height: 1.44; overflow-wrap: anywhere; }
.job-meta { display: flex; flex-wrap: wrap; gap: 3px 11px; margin-top: 5px; color: var(--muted); font-size: 11px; }
.status { flex: 0 0 auto; padding: 1px 6px; border: 1px solid #c7d7cc; border-radius: 4px; color: #375a4b; font-size: 11px; font-weight: 650; white-space: nowrap; }
.status-processing, .status-submitted { color: #265373; border-color: #c4dbe7; background: var(--blue-light); }
.status-succeeded { color: #265a40; border-color: #b9d5c1; background: #e8f3eb; }
.status-failed { color: var(--danger); border-color: #ecc6cd; background: var(--danger-light); }

.detail { outline-offset: 3px; }
.detail-head { display: flex; justify-content: space-between; align-items: start; gap: 14px; padding: 16px 19px; border-bottom: 1px solid var(--line); }
.detail-head h2 { font-size: clamp(19px, 3.4vw, 25px); line-height: 1.28; overflow-wrap: anywhere; }
.detail-id { margin-top: 4px; color: var(--muted); font: 11px/1.6 var(--mono); overflow-wrap: anywhere; }
.detail-body { display: grid; gap: 17px; padding: 16px 19px 19px; }
.settings { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; background: #f2f7f2; }
.settings dt { color: var(--muted); font-size: 11px; }
.settings dd { color: var(--ink); font-size: 13px; font-weight: 640; overflow-wrap: anywhere; }
.record { display: grid; gap: 5px; }
.record-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 30px; }
.record h3 { font-size: 14px; }
.prompt { max-height: 260px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 5px; overflow: auto; background: #f8faf6; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13px; }
.references { display: grid; gap: 8px; }
.reference-list { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.reference-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.reference-list a { overflow-wrap: anywhere; font-size: 13px; }
.reference-list a:hover { text-decoration: underline; }
.reference-group { padding: 6px 10px 8px; border-left: 3px solid #a4c4b5; background: #f4f8f4; }
.reference-type { margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 650; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 7px; padding: 12px 19px; border-top: 1px solid var(--line); background: #f2f7f4; }
.claim-note { padding: 9px 11px; border: 1px solid #c4dbe7; border-radius: 5px; background: var(--blue-light); color: #265373; font-size: 13px; }
.result-data { overflow-wrap: anywhere; font-size: 13px; }
.result-data p { white-space: pre-wrap; }

.empty { min-height: 175px; display: grid; place-items: center; align-content: center; gap: 8px; padding: 16px; color: var(--muted); font-size: 13px; text-align: center; }
.detail > .empty { min-height: 300px; }
.empty strong { color: var(--ink); font-size: 15px; }
.notice { margin-bottom: 12px; padding: 8px 10px; border-radius: 4px; border: 1px solid #e8b5bd; background: var(--danger-light); color: var(--danger); overflow-wrap: anywhere; font-size: 13px; }
.toast { position: fixed; z-index: 2; right: 18px; bottom: 18px; max-width: min(90vw, 410px); padding: 9px 13px; border: 1px solid #b1d0bc; border-radius: 5px; background: #e9f6eb; color: #204c38; font-size: 13px; box-shadow: 0 4px 14px #2f5c3c17; }
.toast[data-tone='error'] { color: var(--danger); border-color: #e8b5bd; background: var(--danger-light); }

dialog { width: min(520px, 100% - 22px); max-height: calc(100% - 22px); overflow: auto; padding: 0; border: 1px solid #a8bdaf; border-radius: 7px; background: var(--paper); color: var(--ink); box-shadow: 0 16px 48px #19382f32; }
dialog::backdrop { background: #162e2a5c; }
.dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 19px; }
.dialog-body { padding: 13px 16px 16px; }
.dialog-note { margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.dialog-body label { display: grid; gap: 5px; margin-top: 8px; color: var(--ink); font-size: 13px; font-weight: 600; }
.dialog-body input, .dialog-body textarea { width: 100%; min-height: 38px; padding: 6px 8px; border: 1px solid #97afa6; border-radius: 5px; background: white; color: var(--ink); }
.dialog-body textarea { resize: vertical; }
.dialog-error { margin-top: 8px; color: var(--danger); font-size: 13px; }
.dialog-actions { display: flex; justify-content: end; flex-wrap: wrap; gap: 7px; margin-top: 13px; }

@media (max-width: 740px) {
  .header-inner, .shell { width: min(100% - 26px, 660px); }
  .shell { padding-top: 24px; }
  .workspace { grid-template-columns: minmax(0, 1fr); gap: 13px; }
  .jobs { max-height: 260px; }
  .detail > .empty { min-height: 150px; }
}

@media (max-width: 380px) {
  .brand { gap: 6px; font-size: 13px; }
  .brand > span:last-child { padding-left: 6px; font-size: 11px; }
  .brand-icon { display: none; }
  .header-inner { gap: 8px; }
  #employee { max-width: 100px; }
  .intro { align-items: start; flex-direction: column; gap: 8px; }
  .refresh { grid-auto-flow: column; align-items: center; gap: 10px; }
  .detail-head, .detail-body, .detail-actions { padding-inline: 12px; }
  .settings { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
