/* xiaoyu herness: OpenCode-style working surface inside XiaoYu's pastel shell. */
body[data-page="herness"] .workspace-layout {grid-template-columns:minmax(0,1fr)}
body[data-page="herness"] #workspace {padding:24px;min-height:calc(100vh - 108px)}
body[data-page="herness"] #evidence-rail {display:none}
body[data-page="herness"] #xiaoyu-float {display:none!important}
html:not(.dark) body[data-page="herness"],
html:not(.dark) body[data-page="herness"] .shell {background:#f7f8fc}
html:not(.dark) body[data-page="herness"] .sidebar {background:#f0f3f9!important;border-color:#dbe2ee!important;box-shadow:none!important}
html:not(.dark) body[data-page="herness"] .topbar,
html:not(.dark) body[data-page="herness"] .footer {background:#fcfcfe!important;border-color:#e1e5ed!important}
html:not(.dark) body[data-page="herness"] .nav-project.active {background:#e6ebf7!important;border-color:#d4deef!important}

.herness-workbench {
  --h-mint:#dff4eb;--h-blue:#e1eff8;--h-apricot:#f9ead9;--h-lilac:#eee8f8;
  --h-line:#e0e5ee;
  min-height:calc(100vh - 158px);display:grid;grid-template-columns:220px minmax(420px,1fr) 244px;
  overflow:hidden;border:1px solid var(--h-line);border-radius:18px;
  background:#fcfcfe;box-shadow:0 8px 28px rgba(66,79,116,.05)
}
.herness-history,.herness-status {min-width:0;padding:18px 14px;background:#f8f9fd}
.herness-history {border-right:1px solid var(--h-line)}
.herness-status {border-left:1px solid var(--h-line)}
.herness-pane-title {display:flex;align-items:center;justify-content:space-between;gap:8px;padding:2px 3px 15px;color:var(--ink);font-size:12px;font-weight:700;letter-spacing:.02em}
.herness-pane-title .button {min-height:31px;padding:4px 9px;border-radius:10px;font-size:10px;background:rgba(255,255,255,.5)}
.herness-history-list {display:flex;flex-direction:column;gap:5px}
.herness-history-item {width:100%;border:0;border-radius:8px;background:transparent;padding:11px;text-align:left;color:var(--muted);transition:background-color .16s ease,color .16s ease}
.herness-history-item:hover {background:#eef1f9;color:var(--ink)}
.herness-history-item.active {background:#e9edf8;color:#3e5288;box-shadow:inset 2px 0 #8da4d5}
.herness-history-item span {display:block;font-size:12px;line-height:1.5}
.herness-history-item small {display:block;margin-top:6px;font-family:var(--mono);font-size:9px;color:var(--muted)}
.herness-history-empty,.herness-local-note {margin:10px 6px;color:var(--muted);font-size:10.5px;line-height:1.7}
.herness-local-note {margin-top:auto;padding-top:16px}
.herness-history {display:flex;flex-direction:column}

.herness-main {min-width:0;display:grid;grid-template-rows:auto minmax(300px,1fr) auto auto;overflow:hidden;background:#fff}
.herness-header {display:flex;align-items:center;justify-content:space-between;gap:16px;padding:18px 22px;border-bottom:1px solid var(--h-line);background:#fff}
.herness-identity {display:flex;align-items:center;gap:12px;min-width:0}
.herness-header h1 {margin:1px 0 0;font-family:var(--body);font-size:16px;font-weight:700;letter-spacing:-.01em}
.herness-header p {margin:2px 0 0;color:var(--muted);font-size:10.5px}
.herness-header-actions {display:flex;align-items:center;gap:9px}
.herness-header-actions .button {border-radius:11px}
.herness-trust {padding:0;color:#56627c;font-size:10px;white-space:nowrap}
.herness-trust::before {content:'';display:inline-block;width:6px;height:6px;margin-right:6px;border-radius:50%;background:#67a58c}

.herness-transcript {min-height:0;overflow:auto;padding:34px clamp(22px,5vw,70px);scrollbar-width:thin;scrollbar-color:rgba(126,126,134,.45) transparent}
.herness-empty {position:relative;width:min(100%,590px);height:auto;min-height:290px;display:flex;flex-direction:column;align-items:flex-start;justify-content:center;margin:36px auto;padding:32px 36px;text-align:left;background:#fffdf8;border:1px solid #e8e2d7;box-shadow:0 12px 26px rgba(85,75,60,.07);transform:rotate(-.3deg)}
.herness-empty::before {content:'';width:69px;height:69px;margin-bottom:23px;border:5px solid #fff;border-radius:16px 12px 17px 13px;background:#e9eff7 url('/static/brand/xiaoyu-memory-tin.png') 75% 75%/470px 470px no-repeat;box-shadow:0 3px 11px rgba(64,72,91,.16);transform:rotate(-6deg)}
.herness-empty::after {content:'';position:absolute;top:-10px;right:35px;width:80px;height:23px;background:rgba(244,221,168,.68);transform:rotate(4deg)}
.herness-empty h2 {margin:0 0 9px;font-family:var(--body);font-size:22px;font-weight:650;letter-spacing:-.015em}
.herness-empty p {max-width:475px;margin:0;color:var(--muted);font-size:12.5px;line-height:1.8}
.herness-message {max-width:760px;margin:0 auto 25px}
.herness-message.user {padding:15px 17px;border-radius:12px;background:#f0f3fa;border:1px solid #dfe6f2}
.herness-message.assistant {padding:3px 2px 0}
.herness-message-meta {display:flex;align-items:center;gap:8px;margin-bottom:11px;color:var(--muted);font-size:10px}
.herness-message-meta strong {color:var(--ink);font-size:11.5px}
.herness-message-meta time {margin-left:auto;font-family:var(--mono)}
.herness-mini-mark {display:grid;place-items:center;width:21px;height:21px;border-radius:6px;background:#e9edf8;color:#52689d;font-family:var(--mono);font-weight:700}
.herness-engine {margin-left:auto;font-family:var(--mono);font-size:9.5px}
.herness-message>p {margin:0;font-size:13px;line-height:1.85;white-space:pre-wrap}
.herness-answer p {margin:0 0 13px;max-width:none;font-size:13.5px;line-height:1.9;white-space:pre-wrap}
.herness-answer-error {padding:12px 14px;border-radius:11px;background:rgba(246,217,215,.52);color:var(--danger)}
.herness-receipt {margin-top:17px;padding:11px 0 0;border-top:1px solid var(--h-line);border-radius:0;background:transparent}
.herness-receipt summary {font-size:11px}
.herness-receipt dl {display:grid;grid-template-columns:1fr 1fr;gap:8px 16px;margin:12px 0 0}
.herness-receipt dl div {min-width:0}
.herness-receipt dt {color:var(--muted);font-size:9.5px}
.herness-receipt dd {margin:3px 0 0;font-family:var(--mono);font-size:10px;overflow-wrap:anywhere}

.herness-quick {display:flex;gap:7px;overflow-x:auto;padding:0 22px 10px}
.herness-quick .button {min-height:33px;padding:5px 10px;border-radius:8px;background:transparent;font-size:10.5px;transition:background-color .16s ease,border-color .16s ease}
.herness-quick .button:hover {background:#f0f3fa;border-color:#cdd8eb}
.herness-composer {margin:0 20px 20px;padding:14px 15px 11px;border:1px solid #cdd8eb;border-radius:14px;background:#fff;box-shadow:0 3px 14px rgba(64,80,125,.08);transition:border-color .16s ease,box-shadow .16s ease}
.herness-composer:focus-within {border-color:var(--xy-focus);box-shadow:0 3px 14px rgba(64,80,125,.08),0 0 0 3px var(--xy-brand-subtle)}
.herness-input {display:block;width:100%;min-height:76px;max-height:210px;resize:vertical;border:0;outline:0;background:transparent;color:var(--ink);font-size:13.5px;line-height:1.7}
.herness-input::placeholder {color:color-mix(in srgb,var(--muted) 70%,transparent)}
.herness-composer-foot {display:flex;align-items:center;justify-content:space-between;gap:12px;padding-top:10px;border-top:1px solid var(--h-line);color:var(--muted);font-size:10px}
.button.herness-send {min-height:36px;border-radius:8px!important;padding:6px 16px!important;background:var(--xy-brand-action)!important;border:0!important;color:var(--accent-ink)!important;box-shadow:none;transition:background-color .16s ease}
.button.herness-send:not(:disabled):hover {background:var(--xy-brand-action-hover)!important}

.herness-status-body {display:flex;flex-direction:column;gap:2px}
.herness-live {display:flex;align-items:center;gap:8px;margin:2px 0 13px;padding:10px 0;font-size:11px}
.herness-live i {width:7px;height:7px;border-radius:50%;background:currentColor;box-shadow:0 0 9px currentColor}
.herness-live.online {color:#397a64}.herness-live.checking {color:#9a7341}.herness-live.offline {color:var(--danger)}
.herness-status-note {margin:0 0 12px;color:var(--muted);font-size:11px;line-height:1.6}
.herness-fact {display:flex;justify-content:space-between;gap:10px;margin:0;padding:10px 0;border-bottom:1px solid var(--h-line);font-size:10px}
.herness-fact span {color:var(--muted)}
.herness-fact b {max-width:145px;text-align:right;font-weight:500;overflow-wrap:anywhere}
.herness-status-body>.button {align-self:flex-start;margin-top:12px;border-radius:9px;background:rgba(255,255,255,.45)}
.herness-integrity {color:var(--danger);font-size:9px}
.herness-boundary,.herness-evidence {margin-top:20px;padding-top:16px;border-top:1px solid var(--h-line)}
.herness-boundary span,.herness-evidence span {font-size:10px;font-weight:700;letter-spacing:.05em}
.herness-boundary p,.herness-evidence p {margin:7px 0 0;color:var(--muted);font-size:10.5px;line-height:1.75}

/* Dark mode follows Codex's neutral graphite hierarchy. Green is status only. */
html.dark body[data-page="herness"] {background:#0d0d0f;color:#ececef}
html.dark body[data-page="herness"] .sidebar {background:#111113!important;border-color:#29292d!important;box-shadow:none!important}
html.dark body[data-page="herness"] .sidebar .seal {color:#e7e7e9!important;background:#2a2a2e!important}
html.dark body[data-page="herness"] .nav-project {background:transparent!important;border-color:transparent!important}
html.dark body[data-page="herness"] .nav-project.active {background:#1c1c1f!important;border-color:#303035!important}
html.dark body[data-page="herness"] .nav-link.active {background:#242428!important;color:#f4f4f5!important}
html.dark body[data-page="herness"] .topbar,
html.dark body[data-page="herness"] .footer {background:#111113!important;border-color:#29292d!important}
html.dark body[data-page="herness"] .shell {background:#0d0d0f}
html.dark .herness-workbench {
  --h-line:#2d2d32;--h-mint:#2a2a2e;--h-blue:#2a2a2e;--h-apricot:#2a2a2e;--h-lilac:#2a2a2e;
  background:#171719;border-color:#303035;box-shadow:0 1px 2px rgba(0,0,0,.35)
}
html.dark .herness-history {background:#121214;border-color:#2d2d32}
html.dark .herness-header {background:#18181b;border-color:#2d2d32}
html.dark .herness-status {background:#151518;border-color:#2d2d32}
html.dark .herness-main {background:#18181b}
html.dark .herness-brand-mark,
html.dark .herness-orb,
html.dark .herness-mini-mark {color:#f0f0f2;background:#27272b;border-color:#3b3b41;box-shadow:none}
html.dark .herness-eyebrow {color:#9b9ba3}
html.dark .herness-trust {color:#c2c2c8;background:#242428}
html.dark .herness-history-item:hover {background:#1d1d20;color:#f0f0f2}
html.dark .herness-history-item.active {background:#242428;color:#f4f4f5;box-shadow:inset 0 0 0 1px #34343a}
html.dark .herness-message.user {background:#232327;border-color:#333338}
html.dark .herness-empty {background:#252630;border-color:#414352;box-shadow:0 12px 28px rgba(0,0,0,.2)}
html.dark .herness-empty::before {border-color:#373946}
html.dark .herness-live {background:transparent}
html.dark .herness-composer {background:#202024;border-color:#39393f;box-shadow:0 14px 38px rgba(0,0,0,.28)}
html.dark .herness-composer:focus-within {border-color:#55555d;box-shadow:0 16px 42px rgba(0,0,0,.38),0 0 0 3px rgba(255,255,255,.055)}
html.dark .herness-input {color:#ededf0}
html.dark .herness-pane-title .button,
html.dark .herness-status-body>.button,
html.dark .herness-header-actions .button {color:#d4d4d8;background:#202024;border-color:#35353a}
html.dark .herness-quick .button {color:#d4d4d8;background:transparent;border-color:#35353a}
html.dark .herness-quick .button:hover {background:#242428;border-color:#44444b}
html.dark .button.herness-send {color:#18181b!important;background:#f1f1f3!important;box-shadow:none}
html.dark .button.herness-send:hover {background:#fff!important}
html.dark .herness-live.online {color:#71c99a}
html.dark .herness-live.checking {color:#c7a86a}
html.dark .herness-live.offline {color:#ef8888}
html.dark .herness-fact {border-color:#29292e;background:transparent}
html.dark .herness-receipt,
html.dark .herness-boundary,
html.dark .herness-evidence {border-color:#303035}

@media(max-width:1180px){
  body[data-page="herness"] #workspace {padding:18px}
  .herness-workbench {grid-template-columns:190px minmax(390px,1fr) 210px}
}
@media(max-width:960px){
  .herness-workbench {grid-template-columns:180px minmax(0,1fr)}
  .herness-status {grid-column:1/-1;display:grid;grid-template-columns:1.2fr 1fr 1fr;gap:18px}
  .herness-status>.herness-pane-title {grid-column:1/-1;padding-bottom:0}
  .herness-boundary,.herness-evidence {margin:0;padding:13px}
}
@media(max-width:680px){
  body[data-page="herness"] .nav-project-label,
  body[data-page="herness"] .nav-project,
  body[data-page="herness"] .nav-project-divider {display:none}
  body[data-page="herness"] .sidebar {display:flex;align-items:center;gap:14px;padding:12px 14px}
  body[data-page="herness"] .sidebar .brand {flex:0 0 auto}
  body[data-page="herness"] .sidebar nav {flex:1;margin:0;padding:0;justify-content:flex-end}
  body[data-page="herness"] .sidebar .nav-link {min-height:36px;padding:5px 9px}
  body[data-page="herness"] .sidebar .nav-link svg {display:none}
  body[data-page="herness"] .topbar {height:48px}
  body[data-page="herness"] .breadcrumb {display:none}
  body[data-page="herness"] #workspace {padding:12px 10px 22px}
  .herness-workbench {min-height:680px;display:flex;flex-direction:column;border-radius:16px}
  .herness-history {order:2;padding:12px;border-right:0;border-top:1px solid var(--h-line)}
  .herness-history-list {display:flex;flex-direction:row;overflow-x:auto}
  .herness-history-item {min-width:150px}
  .herness-local-note {display:none}
  .herness-main {order:1;display:flex;flex-direction:column;min-height:650px}
  .herness-header {padding:14px;align-items:flex-start}
  .herness-header-actions {flex-direction:column;align-items:flex-end}
  .herness-trust {font-size:8px}
  .herness-transcript {flex:1;padding:25px 17px}
  .herness-empty {min-height:250px;margin:20px auto;padding:26px}
  .herness-quick {padding:0 13px 9px}
  .herness-composer {margin:0 12px 13px}
  .herness-composer-foot>span {display:none}
  .herness-send {margin-left:auto}
  .herness-status {order:3;display:block;padding:15px;border-left:0;border-top:1px solid var(--h-line)}
  .herness-boundary,.herness-evidence {margin-top:10px;padding:13px}
  .herness-receipt dl {grid-template-columns:1fr}
}
