body { min-height: 100vh; overflow-x: hidden; }

.hq-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 86px 34px minmax(0, 1fr) 74px;
  background-color: var(--paper);
}

.hq-header {
  display: grid;
  grid-template-columns: minmax(390px, 1fr) minmax(420px, 1.35fr) 366px;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 248, 243, .92);
}

.hq-brand { display: flex; align-items: center; gap: 19px; padding: 0 32px; color: inherit; text-decoration: none; }
.brand-mark { display: block; width: 30px; height: 24px; color: var(--ink); font-size: 30px; }
.brand-copy { display: flex; flex-direction: column; gap: 2px; }
.brand-copy strong { font-size: 15px; font-weight: 600; letter-spacing: .29em; white-space: nowrap; }
.brand-copy small { color: var(--muted); font-size: 9px; letter-spacing: .24em; }

.hq-status { display: flex; align-items: center; justify-content: center; padding: 0 24px; font-size: 16px; letter-spacing: .08em; white-space: nowrap; }
.hq-actions { display: grid; grid-template-columns: 48px 48px 48px 48px minmax(125px, 1fr) 44px; align-items: center; border-left: 1px solid var(--line); }
.icon-button { height: 100%; border: 0; border-right: 1px solid var(--line); background: transparent; color: var(--ink); cursor: pointer; font-size: 20px; }
.icon-button:hover { background: rgba(48, 61, 200, .05); }
.hq-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 18px; min-width: 0; }
.hq-user div { min-width: 0; display: flex; flex-direction: column; }
.hq-user strong { overflow: hidden; text-overflow: ellipsis; font-size: 15px; font-weight: 500; }
.hq-user small { color: var(--muted); font-size: 10px; margin-top: 3px; }
.hq-actions > .brand-square { justify-self: center; width: 15px; height: 15px; }

.hq-meta { display: flex; align-items: center; gap: 18px; padding: 0 29px; color: #92918d; font-size: 10px; letter-spacing: .05em; }
.hq-meta i { width: 1px; height: 14px; background: var(--line); }
.project-picker { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-family: var(--font-cn); font-size: 9px; }
.project-picker select { max-width: 210px; height: 24px; padding: 0 24px 0 8px; border: 1px solid var(--line); background: rgba(250,248,243,.9); color: var(--ink); font-family: var(--font-cn); font-size: 9px; }

.hq-body { min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 318px; border-bottom: 1px solid var(--line); }
.hq-stage { min-width: 0; min-height: 0; display: grid; grid-template-rows: minmax(650px, 1fr) 81px; }
.hq-map { min-height: 650px; position: relative; overflow: hidden; }
.blueprint { position: absolute; inset: 3.8% 2.8% 1.5%; width: 94.4%; height: 94.7%; object-fit: fill; opacity: .74; mix-blend-mode: multiply; transform: translateY(-4.5%) scale(1.13, 1.085); transform-origin: top center; pointer-events: none; user-select: none; }

.hq-zone { position: absolute; z-index: 2; width: 25%; min-width: 220px; padding: 18px 25px; }
.zone-today { left: 9.4%; top: 8.2%; }
.zone-research { right: 3%; top: 8.2%; width: 25.5%; }
.zone-production { left: 9.4%; bottom: 11.4%; }
.zone-review { right: 4.2%; bottom: 11.4%; width: 16.5%; }
.zone-review .zone-rule { width: 80px; }
.zone-num { display: block; color: var(--muted); font-size: 10px; letter-spacing: .12em; margin-bottom: 21px; }
.hq-zone h2 { margin: 0; font-size: 18px; line-height: 1.2; font-weight: 600; letter-spacing: .025em; }
.zone-cn { margin: 4px 0 0; font-family: var(--font-cn); font-size: 13px; font-weight: 500; letter-spacing: .07em; }
.zone-rule { width: 152px; height: 1px; margin: 14px 0 13px; background: var(--line); }
.zone-summary { display: flex; align-items: center; gap: 9px; margin: 0; color: var(--muted); font-size: 10px; white-space: nowrap; }
.zone-list { display: grid; gap: 5px; margin-top: 12px; }
.zone-item { appearance: none; width: 100%; padding: 7px 0; border: 0; border-top: 1px solid rgba(201, 198, 189, .6); background: transparent; color: inherit; text-align: left; cursor: pointer; }
.zone-item:hover .zone-item-title { color: var(--blue); }
.zone-item-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-cn); font-size: 11px; }
.zone-item-meta { display: flex; align-items: center; gap: 7px; margin-top: 4px; color: var(--muted); font-size: 9px; }
.zone-empty { color: var(--faint); font-size: 10px; }

.hq-core { position: absolute; z-index: 4; left: 25.8%; right: 24.2%; top: 18.5%; bottom: 30%; display: flex; align-items: center; justify-content: center; transition: inset .2s ease, background .2s ease; }
.core-idle { width: min(610px, 100%); display: flex; flex-direction: column; align-items: center; text-align: center; transform: translateY(-4px); }
.core-kicker { font-size: 10px; letter-spacing: .22em; }
.core-note { color: var(--muted); font-family: var(--font-cn); font-size: 10px; margin-top: 6px; letter-spacing: .14em; }
.core-square { width: 14px; height: 14px; background: var(--blue); margin: 23px 0 75px; }
.hq-core h1 { margin: 0; font-size: 48px; line-height: 1; font-weight: 600; letter-spacing: .02em; }
.hq-core h1 span { color: var(--blue); }
.hq-core .core-idle > p { margin: 21px 0 20px; font-family: var(--font-cn); font-size: 14px; letter-spacing: .12em; }
.core-input-wrap { width: 100%; height: 52px; display: grid; grid-template-columns: 1fr 46px; align-items: center; padding: 5px; border: 1px solid #bbb8b0; background: rgba(251, 249, 244, .9); box-shadow: 0 8px 28px rgba(51, 45, 33, .04); }
.core-input-wrap textarea { width: 100%; max-height: 100px; resize: none; border: 0; outline: 0; background: transparent; color: var(--ink); padding: 10px 11px; font-family: var(--font-cn); font-size: 12px; }
.core-input-wrap textarea::placeholder { color: #9b9993; }
.core-send { width: 40px; height: 40px; border: 0; background: var(--blue); color: white; cursor: pointer; font-size: 21px; }
.core-send:hover { background: #2631a9; }
.core-send:disabled { background: #aaa9a4; }
.hq-core.is-auth-gated .core-square { margin-bottom: 36px; }
.hq-core.is-auth-gated .core-idle > p { margin-bottom: 16px; }
.hq-core.is-auth-gated .core-input-wrap,
.hq-core.is-auth-gated .core-chips { display: none; }
.auth-state {
  position: relative;
  width: 100%;
  min-height: 98px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px 14px;
  padding: 14px 14px 12px;
  overflow: hidden;
  border: 1px solid rgba(48, 61, 200, .24);
  background: linear-gradient(112deg, rgba(232, 234, 254, .92), rgba(251, 249, 244, .96) 62%);
  box-shadow: 0 12px 32px rgba(48, 61, 200, .08);
  color: var(--muted);
  font-family: var(--font-cn);
  text-align: left;
}
.auth-state-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: var(--paper-soft);
  font-size: 21px;
}
.auth-state-copy { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.auth-state-copy small { color: var(--blue); font-size: 8px; font-weight: 600; letter-spacing: .18em; }
.auth-state-copy strong { color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.35; letter-spacing: .035em; text-wrap: balance; }
.auth-state-copy span { font-size: 9px; line-height: 1.55; text-wrap: pretty; }
.auth-state a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 15px;
  background: var(--blue);
  box-shadow: 0 8px 20px rgba(48, 61, 200, .22);
  color: var(--paper-soft);
  text-decoration: none;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform .16s ease, box-shadow .16s ease;
}
.auth-state a:hover { transform: translateY(-1px); box-shadow: 0 11px 24px rgba(48, 61, 200, .28); }
.auth-state a iconify-icon { font-size: 17px; }
.auth-state-trust {
  grid-column: 2 / -1;
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  color: var(--faint);
  font-size: 8px;
  line-height: 1.4;
}
.auth-state-trust iconify-icon { color: var(--blue); font-size: 12px; }
.core-chips { display: flex; justify-content: center; gap: 12px; margin-top: 8px; }
.core-chips button { display: flex; align-items: center; gap: 7px; padding: 7px 13px; border: 1px solid var(--line); background: rgba(250, 248, 243, .8); color: var(--muted); font-family: var(--font-cn); font-size: 10px; cursor: pointer; }
.core-chips button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.core-chips button:disabled { opacity: .55; }

.core-active { display: none; width: 100%; height: 100%; flex-direction: column; min-height: 0; }
.hq-core.has-task { inset: 4.5% 8% 4%; padding: 20px; border: 1px solid var(--line-strong); background: rgba(250, 248, 243, .97); box-shadow: 0 22px 70px rgba(45, 41, 33, .14); }
.hq-core.has-task .core-idle { display: none; }
.hq-core.has-task .core-active { display: flex; }
.task-header { display: grid; grid-template-columns: 40px 1fr auto auto; align-items: center; gap: 12px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.task-back { width: 34px; height: 34px; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.task-header > div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.task-header small { color: var(--muted); font-size: 8px; letter-spacing: .16em; }
.task-header strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-cn); font-size: 13px; }
.task-badge { padding: 5px 9px; color: var(--blue); border: 1px solid currentColor; font-size: 9px; }
.badge-done { color: var(--green); }.badge-failed { color: var(--red); }.badge-waiting { color: var(--amber); }
.task-content { flex: 1; min-height: 0; overflow: auto; padding: 14px 6px; }
.hq-core.is-chat-mode #taskTimeline,
.hq-core.is-chat-mode #taskStream { display: none; }
.hq-core:not(.is-chat-mode) #chatStream,
.hq-core:not(.is-chat-mode) #chatTrace { display: none; }
.chat-trace { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; padding: 4px 0 13px; border-bottom: 1px solid var(--line); }
.chat-trace strong { margin-right: 3px; color: var(--ink); font-family: var(--font-cn); font-size: 9px; }
.chat-trace span { padding: 3px 6px; border: 1px solid var(--line); color: var(--muted); font-family: var(--font-cn); font-size: 8px; }
.chat-stream { display: grid; gap: 17px; padding: 18px 2px 24px; }
.chat-message { display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: start; gap: 12px; }
.chat-role { padding-top: 3px; color: var(--faint); font-size: 8px; letter-spacing: .14em; }
.chat-assistant .chat-role { color: var(--blue); }
.chat-body { max-width: 86%; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-cn); font-size: 12px; line-height: 1.8; }
.chat-user .chat-body { padding: 9px 11px; border: 1px solid var(--line); background: rgba(255, 255, 255, .45); }
.chat-assistant .chat-body { font-size: 13px; }
.chat-message.chat-task .chat-role { color: var(--amber); }
.chat-message.chat-task .chat-body { padding-left: 10px; border-left: 2px solid rgba(220,155,28,.45); }
.task-event { display: grid; grid-template-columns: 56px 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px solid rgba(217, 214, 206, .6); font-size: 10px; }
.event-time { color: var(--muted); }.event-text { font-family: var(--font-cn); }
.plan-steps { display: grid; gap: 7px; margin: 10px 0; }
.plan-step { display: grid; grid-template-columns: 24px 1fr; gap: 8px; align-items: center; font-family: var(--font-cn); font-size: 10px; }
.plan-step-num { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--line); color: var(--muted); }
.step-done .plan-step-num { color: var(--green); border-color: var(--green); }
.source-list { display: grid; gap: 6px; margin: 12px 0; }
.source-card { display: grid; gap: 3px; padding: 9px 10px; border: 1px solid var(--line); color: inherit; text-decoration: none; font-size: 9px; }
.source-card:hover { border-color: var(--blue); }
.source-card span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-stop { display: inline-flex; align-items: center; gap: 4px; padding: 5px 9px; border: 1px solid var(--red); background: transparent; color: var(--red); font-family: var(--font-cn); font-size: 9px; cursor: pointer; }
.task-stop:hover { background: rgba(196, 74, 62, .06); }
.task-stop[hidden] { display: none; }
.source-provenance { color: var(--faint); font-size: 8px; letter-spacing: .05em; padding: 2px 0 4px; }
.source-note { border-style: dashed; cursor: default; }
.source-note strong { color: var(--amber); }
.source-note:hover { border-color: var(--line); }
.intent-card { display: grid; gap: 8px; margin: 8px 0 14px; padding: 11px 12px; border: 1px solid rgba(46, 68, 199, .28); background: rgba(46, 68, 199, .035); }
.intent-card > div { display: flex; align-items: center; gap: 10px; }
.intent-card strong { font-family: var(--font-cn); font-size: 11px; }
.intent-route { padding: 3px 6px; background: var(--blue); color: white; font-size: 7px; letter-spacing: .12em; }
.intent-card p { margin: 0; color: var(--muted); font-family: var(--font-cn); font-size: 9px; line-height: 1.6; }
.intent-card small { color: var(--faint); font-size: 8px; letter-spacing: .05em; }
.context-card { display: grid; gap: 9px; margin: 8px 0 14px; padding: 12px; border: 1px solid rgba(46, 68, 199, .22); background: linear-gradient(135deg, rgba(46, 68, 199, .045), rgba(255, 255, 255, .55)); }
.context-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.context-heading span { color: var(--blue); font-family: var(--font-en); font-size: 8px; letter-spacing: .16em; }
.context-heading strong { color: var(--ink); font-family: var(--font-mono); font-size: 8px; font-weight: 500; }
.context-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.context-metrics span { padding: 7px 8px; border: 1px solid var(--line); color: var(--muted); font-family: var(--font-cn); font-size: 8px; }
.context-card small { color: var(--faint); font-family: var(--font-cn); font-size: 8px; line-height: 1.5; }
.tool-list { display: grid; gap: 7px; margin: 12px 0; }
.tool-card { border: 1px solid var(--line); background: rgba(255, 255, 255, .4); }
.tool-card.tool-done { border-left: 2px solid var(--green); }.tool-card.tool-failed { border-left: 2px solid var(--red); }
.tool-title { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-family: var(--font-cn); font-size: 9px; }
.tool-title span { color: var(--muted); }.tool-card.tool-failed .tool-title span { color: var(--red); }
.tool-card pre { max-height: 140px; margin: 0; padding: 9px 10px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; line-height: 1.55; }
.diff-card { margin: 10px 0; border: 1px solid var(--line-strong); background: rgba(255, 255, 255, .42); }
.diff-card summary { display: flex; justify-content: space-between; gap: 12px; padding: 9px 10px; cursor: pointer; font-size: 8px; }
.diff-card summary strong { color: var(--blue); letter-spacing: .06em; }.diff-card summary span { color: var(--muted); }
.diff-columns { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.diff-columns pre { position: relative; min-height: 72px; max-height: 260px; margin: 0; padding: 25px 10px 10px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 8px; line-height: 1.55; }
.diff-columns pre + pre { border-left: 1px solid var(--line); background: rgba(54, 177, 122, .035); }
.diff-columns pre::before { content: attr(data-label); position: absolute; top: 7px; left: 10px; color: var(--faint); font-size: 7px; letter-spacing: .12em; }
.review-card { display: grid; gap: 9px; margin: 12px 0; padding: 12px; border: 1px solid var(--line-strong); }
.review-card.review-pass { border-left: 3px solid var(--green); }.review-card.review-warning { border-left: 3px solid var(--amber); }.review-card.review-fail { border-left: 3px solid var(--red); }
.review-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.review-heading span { color: var(--muted); font-size: 7px; letter-spacing: .13em; }.review-heading strong { font-family: var(--font-cn); font-size: 10px; }
.review-card p { margin: 0; color: var(--muted); font-family: var(--font-cn); font-size: 9px; line-height: 1.6; }
.review-card ul { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.review-card li { display: grid; grid-template-columns: 82px 1fr; gap: 8px; font-family: var(--font-cn); font-size: 8px; line-height: 1.5; }
.review-card li strong { color: var(--green); }.review-card li.check-fail strong { color: var(--amber); }.review-card li span { color: var(--muted); }
.approval-card { margin: 12px 0; padding: 14px; border: 1px solid var(--amber); background: #fffaf0; }
.approval-header { display: flex; align-items: center; gap: 7px; font-family: var(--font-cn); font-size: 12px; font-weight: 600; }
.approval-desc, .approval-impact { margin-top: 8px; color: var(--muted); font-family: var(--font-cn); font-size: 10px; line-height: 1.6; overflow-wrap: anywhere; }
.approval-actions { display: flex; gap: 8px; margin-top: 12px; }
.approval-btn { padding: 7px 12px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; font-family: var(--font-cn); font-size: 10px; }
.approval-approve { border-color: var(--blue); background: var(--blue); color: white; }
.approval-resolved { opacity: .58; pointer-events: none; }
.delivery-card { margin-top: 12px; padding: 12px; border: 1px solid var(--line); }
.delivery-label { color: var(--blue); font-size: 9px; letter-spacing: .14em; }
.delivery-content { margin-top: 7px; white-space: pre-wrap; font-family: var(--font-cn); font-size: 10px; line-height: 1.7; }
.task-input-box { height: 46px; display: grid; grid-template-columns: 1fr 40px; align-items: center; border: 1px solid var(--line-strong); }
.task-input-box textarea { resize: none; border: 0; outline: 0; background: transparent; padding: 10px; font-family: var(--font-cn); font-size: 10px; }
.task-input-box button { align-self: stretch; border: 0; background: var(--blue); color: white; font-size: 18px; cursor: pointer; }

.hq-legend { height: 54px; align-self: start; margin: 0 10% 0 7.4%; display: flex; align-items: center; gap: 31px; padding: 0 20px; border: 1px solid var(--line); color: var(--muted); font-size: 9px; }
.hq-legend > span { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.legend-title { margin-right: 3px; }
.hq-legend .version { margin-left: auto; }
.hq-legend .brand-square { width: 9px; height: 9px; }

.hq-brief { min-height: 0; overflow: auto; margin: -4px 24px 40px 0; padding: 27px 24px; border: 1px solid var(--line); background: rgba(250, 248, 243, .72); }
.brief-heading { display: flex; align-items: flex-start; justify-content: space-between; }
.brief-heading > div { display: flex; flex-direction: column; gap: 5px; }
.brief-heading strong { font-size: 11px; letter-spacing: .22em; }
.brief-heading span { color: var(--muted); font-family: var(--font-cn); font-size: 10px; letter-spacing: .1em; }
.brief-heading time { color: var(--faint); font-size: 9px; }
.brief-rule { height: 1px; background: var(--line); margin: 20px 0 12px; }
.brief-feed { display: grid; }
.brief-empty { padding: 24px 5px; color: var(--muted); font-family: var(--font-cn); font-size: 10px; line-height: 1.7; }
.brief-item { appearance: none; display: block; width: 100%; position: relative; padding: 22px 5px 22px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; text-align: left; cursor: pointer; }
.brief-item:hover .brief-title { color: var(--blue); }
.brief-type { display: flex; align-items: center; gap: 8px; font-family: var(--font-cn); font-size: 11px; }
.brief-time { position: absolute; top: 23px; right: 4px; color: var(--faint); font-size: 9px; }
.brief-title { margin-top: 17px; padding-right: 8px; font-family: var(--font-cn); font-size: 12px; line-height: 1.65; }
.brief-detail { margin-top: 7px; color: var(--muted); font-family: var(--font-cn); font-size: 9px; line-height: 1.6; }
.brief-link { display: inline-flex; align-items: center; gap: 5px; margin-top: 13px; color: var(--blue); font-family: var(--font-cn); font-size: 9px; font-weight: 600; }

.hq-footer { display: grid; grid-template-columns: 318px 1fr 280px; align-items: center; padding: 0 30px; background: rgba(250, 248, 243, .92); }
.footer-brand { display: flex; align-items: center; gap: 34px; }
.footer-brand strong { font-size: 9px; letter-spacing: .28em; }
.footer-brand span { color: var(--muted); font-size: 8px; letter-spacing: .15em; }
.hq-footer nav { display: flex; justify-content: center; gap: 52px; color: #454441; font-family: var(--font-cn); font-size: 10px; }
.footer-help { display: flex; justify-content: flex-end; gap: 38px; }
.footer-help a { color: inherit; text-decoration: none; font-family: var(--font-cn); font-size: 10px; }
.footer-help a:hover { color: var(--blue); }

.toast { position: fixed; z-index: 100; left: 50%; bottom: 30px; transform: translate(-50%, 15px); padding: 10px 15px; border: 1px solid var(--line-strong); background: var(--paper-soft); box-shadow: 0 12px 40px rgba(30, 28, 23, .16); opacity: 0; pointer-events: none; transition: .18s ease; font-family: var(--font-cn); font-size: 11px; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.history-backdrop { position: fixed; z-index: 180; inset: 0; background: rgba(24,23,20,.2); backdrop-filter: blur(2px); }
.history-backdrop[hidden] { display: none; }
.history-drawer { position: fixed; z-index: 181; top: 0; right: 0; width: min(390px, 92vw); height: 100vh; display: grid; grid-template-rows: auto auto minmax(0,1fr); gap: 14px; padding: 25px 22px; border-left: 1px solid var(--line-strong); background: rgba(250,248,243,.985); box-shadow: -24px 0 70px rgba(31,29,25,.16); transform: translateX(102%); transition: transform .2s ease; }
.history-drawer.is-open { transform: translateX(0); }
.history-heading { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.history-heading > div { display: flex; flex-direction: column; gap: 5px; }
.history-heading strong { font-size: 10px; letter-spacing: .18em; }
.history-heading span { color: var(--muted); font-family: var(--font-cn); font-size: 11px; }
.history-heading button { width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 21px; }
.history-new { height: 38px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--blue); background: var(--blue); color: white; cursor: pointer; font-family: var(--font-cn); font-size: 10px; }
.history-list { min-height: 0; overflow: auto; display: grid; align-content: start; }
.history-empty { padding: 30px 8px; color: var(--muted); font-family: var(--font-cn); font-size: 10px; line-height: 1.7; }
.history-item { width: 100%; display: grid; gap: 7px; padding: 15px 8px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; text-align: left; cursor: pointer; }
.history-item:hover, .history-item.is-current { background: rgba(46,68,199,.045); }
.history-item.is-current { border-left: 2px solid var(--blue); padding-left: 10px; }
.history-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-cn); font-size: 11px; }
.history-item p { margin: 0; overflow: hidden; color: var(--muted); font-family: var(--font-cn); font-size: 9px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.history-item small { color: var(--faint); font-size: 8px; }

.brain-backdrop { position: fixed; z-index: 182; inset: 0; background: rgba(24,23,20,.2); backdrop-filter: blur(2px); }
.brain-backdrop[hidden] { display: none; }
.brain-drawer { position: fixed; z-index: 183; top: 0; right: 0; width: min(480px, 96vw); height: 100vh; display: grid; grid-template-rows: auto auto minmax(0,1fr); gap: 0; overflow: auto; padding: 25px 24px 40px; border-left: 1px solid var(--line-strong); background: rgba(250,248,243,.99); box-shadow: -24px 0 70px rgba(31,29,25,.16); transform: translateX(102%); transition: transform .2s ease; }
.brain-drawer.is-open { transform: translateX(0); }
.brain-heading { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.brain-heading > div, .brain-section-title > div { display: flex; flex-direction: column; gap: 5px; }
.brain-heading strong { font-size: 10px; letter-spacing: .19em; }
.brain-heading span { color: var(--muted); font-family: var(--font-cn); font-size: 11px; }
.brain-heading button { width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 21px; }
.brain-section { padding: 22px 0; border-bottom: 1px solid var(--line); }
.brain-section-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 16px; }
.brain-section-title strong { font-size: 9px; letter-spacing: .15em; }
.brain-section-title span { color: var(--muted); font-family: var(--font-cn); font-size: 10px; }
.brain-section-title small { color: var(--faint); font-family: var(--font-cn); font-size: 8px; }
.soul-form { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-bottom: 12px; }
.soul-form label { display: grid; gap: 6px; color: var(--muted); font-family: var(--font-cn); font-size: 9px; }
.soul-form input, .soul-form select, .memory-compose textarea, .memory-compose select, .memory-edit { width: 100%; border: 1px solid var(--line-strong); background: rgba(255,255,255,.55); color: var(--ink); outline: 0; font-family: var(--font-cn); font-size: 10px; }
.soul-form input, .soul-form select { height: 36px; padding: 0 9px; }
.soul-form input:focus, .soul-form select:focus, .memory-compose textarea:focus, .memory-edit:focus { border-color: var(--blue); }
.brain-primary { min-height: 34px; padding: 7px 13px; border: 1px solid var(--blue); background: var(--blue); color: white; cursor: pointer; font-family: var(--font-cn); font-size: 9px; }
.brain-primary:disabled { opacity: .45; cursor: default; }
.brain-policy { margin: 10px 0 0; color: var(--faint); font-family: var(--font-cn); font-size: 8px; line-height: 1.65; }
.memory-compose { display: grid; gap: 8px; margin-bottom: 14px; }
.memory-compose textarea { min-height: 60px; resize: vertical; padding: 9px; line-height: 1.6; }
.memory-compose > div { display: grid; grid-template-columns: 1fr 92px; gap: 8px; }
.memory-compose select { height: 34px; padding: 0 8px; }
.memory-list { display: grid; gap: 8px; min-height: 80px; }
.memory-empty { padding: 24px 7px; color: var(--muted); font-family: var(--font-cn); font-size: 9px; line-height: 1.65; text-align: center; }
.memory-item { display: grid; gap: 8px; padding: 11px; border: 1px solid var(--line); background: rgba(255,255,255,.36); }
.memory-item-head { display: flex; justify-content: space-between; gap: 10px; }
.memory-scope { color: var(--blue); font-family: var(--font-cn); font-size: 8px; }
.memory-item time { color: var(--faint); font-size: 8px; }
.memory-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-cn); font-size: 10px; line-height: 1.65; }
.memory-actions { display: flex; justify-content: flex-end; gap: 7px; }
.memory-actions button { padding: 5px 9px; border: 1px solid var(--line-strong); background: transparent; color: var(--muted); cursor: pointer; font-family: var(--font-cn); font-size: 8px; }
.memory-actions button:hover { border-color: var(--blue); color: var(--blue); }
.memory-actions .memory-forget:hover { border-color: var(--red); color: var(--red); }
.memory-edit { min-height: 58px; padding: 8px; resize: vertical; line-height: 1.6; }

@media (max-width: 1120px) {
  .hq-header { grid-template-columns: minmax(310px, 1fr) minmax(350px, 1.1fr) 270px; }
  .hq-actions { grid-template-columns: 44px 44px 44px 44px 1fr 38px; }
  .brand-copy strong { font-size: 12px; }
  .hq-body { grid-template-columns: minmax(0, 1fr) 270px; }
  .hq-core { left: 24%; right: 24%; }
  .core-square { margin-bottom: 42px; }
  .hq-zone { padding-inline: 10px; }
}

@media (max-width: 860px) {
  .hq-shell { display: block; min-height: 100vh; }
  .hq-header { height: 70px; grid-template-columns: 1fr auto; }
  .hq-status { display: none; }
  .hq-actions { grid-template-columns: 48px 48px 48px 48px 98px 36px; }
  .hq-meta { height: 34px; }
  .hq-body { display: block; }
  .hq-stage { display: block; }
  .hq-map { min-height: auto; padding: 22px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .blueprint { inset: 0; width: 100%; height: 100%; opacity: .3; object-fit: cover; transform: none; }
  .hq-zone, .zone-today, .zone-research, .zone-production, .zone-review { position: relative; inset: auto; width: auto; min-width: 0; padding: 18px; border: 1px solid var(--line); background: rgba(250, 248, 243, .84); }
  .hq-core { position: relative; inset: auto; grid-column: 1 / -1; grid-row: 1; min-height: 420px; padding: 30px 12px; }
  .hq-core.has-task { inset: auto; min-height: 600px; }
  .core-idle { max-width: 600px; }
  .hq-legend { min-height: 54px; margin: 0 18px 18px; overflow-x: auto; }
  .hq-brief { min-height: 360px; margin: 0; border-left: 0; border-right: 0; border-top: 1px solid var(--line); }
  .hq-footer { min-height: 74px; grid-template-columns: 1fr auto; gap: 20px; }
  .hq-footer nav { display: none; }
}

@media (max-width: 560px) {
  .hq-header { height: 62px; }
  .hq-brand { padding: 0 16px; gap: 10px; }
  .brand-mark { width: 24px; height: 18px; }
  .brand-copy strong { font-size: 10px; letter-spacing: .18em; }
  .brand-copy small { font-size: 7px; }
  .hq-actions { grid-template-columns: 40px 40px 40px 32px; }
  .hq-actions #btnNotifications { display: none; }
  .hq-user { display: none; }
  .project-picker { margin-left: auto; }
  .project-picker select { max-width: 130px; }
  .hq-actions > .brand-square { width: 11px; height: 11px; }
  .hq-meta { padding: 0 16px; font-size: 8px; }
  .hq-map { grid-template-columns: 1fr; padding: 12px; }
  .hq-core { grid-column: 1; min-height: 390px; padding: 20px 0; }
  .hq-core h1 { font-size: 42px; }
  .core-square { margin: 18px 0 38px; }
  .core-chips { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
  .core-chips button { justify-content: center; padding: 7px 4px; font-size: 8px; }
  .core-chips iconify-icon { display: none; }
  .auth-state { grid-template-columns: 40px minmax(0, 1fr); gap: 10px 12px; padding: 13px 13px 12px; }
  .auth-state-icon { width: 40px; height: 40px; }
  .auth-state a { grid-column: 1 / -1; width: 100%; }
  .auth-state-trust { grid-column: 1 / -1; justify-content: center; text-align: center; }
  .hq-zone { min-height: 160px; }
  .hq-legend { margin: 0 12px 12px; padding: 0 12px; gap: 20px; }
  .hq-legend .version { display: none; }
  .task-header { grid-template-columns: 36px 1fr auto; }
  .task-badge { grid-column: 2; justify-self: start; }
  .task-stop { grid-column: 3; }
  .diff-columns { grid-template-columns: 1fr; }
  .diff-columns pre + pre { border-left: 0; border-top: 1px solid var(--line); }
  .hq-footer { grid-template-columns: 1fr; padding: 22px 16px; }
  .footer-help { justify-content: flex-start; }
  .soul-form { grid-template-columns: 1fr; }
}
