/* CHANGE-G1B-0014: direction both + filter sync */
:root {
  color-scheme: dark;
  --bg: #0c1119;
  --surface: #131c28;
  --border: #293747;
  --text: #edf3fa;
  --muted: #a7b7ca;
  --green: #89edc4;
  --amber: #f4cd88;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }
button, input { font: inherit; }
button, a, input { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
[hidden] { display: none !important; }
.workspace { width: min(1240px, 100%); margin: auto; padding: 40px 32px 24px; }
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 7px; color: var(--green); letter-spacing: .12em; font-size: 11px; font-weight: 650; }
h1 { margin: 0; font-size: clamp(26px, 4vw, 34px); line-height: 1.3; letter-spacing: .02em; }
.intro { color: var(--muted); margin: 9px 0 0; }
.demo-label { display: flex; align-items: center; gap: 9px; flex-shrink: 0; padding: 10px 15px; border: 1px solid #715b35; background: #2b2419; color: var(--amber); border-radius: 8px; font-weight: 700; }
.demo-dot { height: 7px; width: 7px; border-radius: 50%; background: var(--amber); }
.safety-notice { display: flex; flex-wrap: wrap; gap: 6px 24px; padding: 14px 18px; border-left: 3px solid var(--amber); border-radius: 4px; background: #1d211f; margin-bottom: 25px; }
.safety-notice strong { color: var(--amber); }
.safety-notice span { color: var(--muted); font-size: 12px; align-self: center; }
.toolbar { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding-bottom: 25px; border-bottom: 1px solid var(--border); }
.direction-filter { padding: 0; margin: 0; border: 0; min-width: 0; }
.direction-filter legend, .search-field label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.filter-buttons { display: flex; gap: 5px; padding: 4px; background: #17212e; border: 1px solid var(--border); border-radius: 8px; }
.filter-buttons button { background: transparent; color: var(--muted); border: 0; border-radius: 5px; min-height: 38px; padding: 6px 22px; cursor: pointer; }
.filter-buttons button:hover { color: var(--text); background: #263445; }
.filter-buttons button[aria-pressed="true"] { background: #2c5147; color: #b6f9dc; font-weight: 650; }
.search-field { width: min(420px, 45%); }
.search-field input { width: 100%; min-height: 48px; padding: 10px 14px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.search-field input::placeholder { color: #8d9db1; }
.list-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 0 16px; }
.list-heading h2 { font-size: 16px; margin: 0; }
.list-heading p { color: var(--muted); font-size: 12px; margin: 0; }
.message-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.message-card { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); overflow-wrap: anywhere; min-width: 0; }
.message-header { display: flex; align-items: start; justify-content: space-between; gap: 16px; padding: 16px 18px 12px; border-bottom: 1px solid #24303f; }
.group-name { margin: 0; font-size: 14px; font-weight: 400; color: var(--muted); line-height: 1.5; } /* CHANGE-G1B-0054: size match sender; keep muted/400 */
.sender-name { margin: 4px 0 0; color: var(--text); font-size: 14px; font-weight: 650; line-height: 1.5; } /* CHANGE-G1B-0052: swapped with group */

/* CHANGE-G1B-0047: message card group/sender icons + copy buttons */
/* CHANGE-G1B-0048: tighten identity rows — copy sits after text, not card-right; less vertical gap */
/* CHANGE-G1B-0049: briefly tried horizontal row; reverted in 0050 */
/* CHANGE-G1B-0050: restore stacked rows; top-align; minimize vertical height */
.message-identity {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  align-self: start;
  justify-content: flex-start;
  gap: 0;
  line-height: 1.5;
}
.identity-row {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  min-width: 0;
  width: max-content;
  margin: 0;
  padding: 0;
  line-height: 1.5;
  min-height: 0;
}
.identity-row .group-name,
.identity-row .sender-name {
  margin: 0;
  padding: 0;
  min-width: 0;
  flex: 0 1 auto;
  overflow-wrap: anywhere;
  line-height: 1.5;
}
.identity-row .meta-icon { margin-top: 0; }
.identity-row-sender .sender-name { margin-top: 0; }
.meta-icon {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  margin-top: 1px;
  color: var(--muted);
  opacity: 0.92;
}
.meta-copy-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  min-height: 0; /* CHANGE-G1B-0051: override global `button { min-height: 44px }` */
  min-width: 0;
  margin: 0;
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.72;
  line-height: 1;
}
.meta-copy-btn:hover,
.meta-copy-btn:focus-visible {
  opacity: 1;
  color: var(--text);
  background: #24303f;
  outline: none;
}
.meta-copy-btn:focus-visible {
  box-shadow: 0 0 0 2px rgba(87, 160, 255, 0.45);
}
/* CHANGE-G1B-0055: checkmark + emphasis flash on copy success */
.meta-copy-btn.is-copied {
  color: #7ddea8;
  opacity: 1;
  background: rgba(125, 222, 168, 0.22);
  box-shadow: 0 0 0 2px rgba(125, 222, 168, 0.55);
  animation: meta-copy-pop 0.45s ease-out;
}
.meta-copy-btn.is-copied .meta-icon-check {
  color: #7ddea8;
  stroke-width: 2.5;
}
.meta-copy-btn.is-failed { color: #e8a0a0; opacity: 1; }
.meta-copy-btn .meta-icon { width: 11px; height: 11px; margin-top: 0; }
@keyframes meta-copy-pop {
  0% { transform: scale(0.72); background: rgba(125, 222, 168, 0.5); }
  60% { transform: scale(1.18); }
  100% { transform: scale(1); background: rgba(125, 222, 168, 0.22); }
}
.http-dashboard .identity-row { gap: 3px; }
.http-dashboard .meta-copy-btn { width: 13px; height: 13px; min-height: 0; min-width: 0; }
.http-dashboard .message-identity { gap: 0; align-items: flex-start; align-self: start; }
.http-dashboard .identity-row .sender-name,
.http-dashboard .sender-name { margin-top: 0; }
#dashboard[data-mode="http"] .direction-leading > .message-identity {
  align-self: start;
  justify-self: start;
}

.message-meta { text-align: right; flex-shrink: 0; }
.direction-badge { display: inline-block; padding: 1px 9px; border-radius: 4px; font-size: 11px; font-weight: 650; }
.direction-buy { background: #223d39; color: #9de4c9; }
.direction-sell { background: #253b56; color: #a6caff; }
.direction-both { background: #3a3341; color: #e2c6f0; }
.direction-unknown { background: #373341; color: #d0c2e5; }
.message-time { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
.original-content-wrap { position: relative; min-width: 0; }
.original-content { margin: 0; padding: 18px 34px 28px 18px; font-size: 15px; line-height: 1.85; white-space: pre-wrap; overflow-wrap: anywhere; }
.original-content mark { color: #b7f7da; background: #25443c; border-radius: 3px; padding: 0; }
/* CHANGE-G1B-0056: original body bottom-right copy */
.original-copy-btn {
  position: absolute;
  right: 10px;
  bottom: 8px;
  width: 22px;
  height: 22px;
  min-height: 0;
  min-width: 0;
  border-radius: 5px;
  opacity: 0.78;
  background: #1a2432;
  color: var(--muted);
  z-index: 1;
}
.original-copy-btn .meta-icon { width: 13px; height: 13px; }
.original-copy-btn:hover,
.original-copy-btn:focus-visible {
  opacity: 1;
  color: var(--text);
  background: #24303f;
}
.original-copy-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.http-dashboard .original-content { padding: 10px 28px 24px 12px; }
.http-dashboard .original-copy-btn {
  right: 8px;
  bottom: 6px;
  width: 20px;
  height: 20px;
}
.structured-fields { display: flex; flex-wrap: wrap; gap: 7px 18px; margin: 0; padding: 12px 18px; border-top: 1px solid #24303f; color: var(--muted); font-size: 11px; }
.structured-fields div { display: flex; gap: 7px; min-width: 0; }
.structured-fields dt { color: #8fa1b6; }
.structured-fields dd { margin: 0; color: #c4d0df; }
.empty-state { padding: 60px 18px; text-align: center; border: 1px dashed var(--border); border-radius: 10px; }
.empty-state h2 { margin: 0 0 8px; font-size: 18px; }
.empty-state p { color: var(--muted); margin: 0; }
.page-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 28px; color: var(--muted); font-size: 11px; }
a { color: var(--green); text-underline-offset: 3px; }
.test-table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 12px; }
.test-table th, .test-table td { border: 1px solid var(--border); text-align: left; padding: 10px; overflow-wrap: anywhere; }
.test-table th { color: var(--green); }
.test-pass { color: var(--green); }
.test-fail { color: #ffb3b3; }
.test-unverified { color: var(--amber); }
@media (max-width: 760px) {
  .workspace { padding: 24px 16px; }
  .page-header { align-items: start; flex-direction: column; gap: 16px; }
  .demo-label { font-size: 13px; }
  .toolbar { align-items: stretch; flex-direction: column; gap: 16px; }
  .search-field { width: 100%; }
  .filter-buttons button { flex: 1; padding: 8px 12px; }
  .message-list { grid-template-columns: minmax(0, 1fr); }
  .message-header { padding: 14px; gap: 10px; }
  .original-content { padding: 14px; }
  .structured-fields { padding: 12px 14px; }
}

/* Stage2C: local Mock API controls and accessible native details dialog. */
button, select { font: inherit; }
select, button { min-height: 44px; }
select { width: 100%; padding: 10px 12px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
select:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
.day-field { flex: 0 0 160px; } /* CHANGE-G1B-0021 */
.day-field label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.day-field input[type="date"] { width: 100%; padding: 10px 12px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.day-field input[type="date"]:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }


/* CHANGE-G1B-0030/0031/0032: toolbar toggles (「搜索」apply + 去重复); pressed = active non-empty q or 去重复 on */
.dedupe-field, .search-enable-field { flex: 0 0 auto; display: flex; flex-direction: column; align-items: stretch; min-width: 0; }
.dedupe-label, .search-enable-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.dedupe-field button, .search-enable-field button {
  background: transparent; color: var(--muted); border: 1px solid var(--border); border-radius: 8px;
  min-height: 38px; padding: 6px 16px; cursor: pointer; background: var(--surface);
}
.dedupe-field button:hover, .search-enable-field button:hover { color: var(--text); background: #263445; }
.dedupe-field button[aria-pressed="true"], .search-enable-field button[aria-pressed="true"] { background: #2c5147; color: #b6f9dc; font-weight: 650; border-color: #43665d; }
.http-dashboard .dedupe-label, .http-dashboard .search-enable-label { margin-bottom: 4px; font-size: 11px; }
.http-dashboard .dedupe-field button, .http-dashboard .search-enable-field button { min-height: 36px; padding: 4px 14px; font-size: 13px; }
@media (max-width: 760px) {
  .dedupe-field, .search-enable-field { width: 100%; }
  .dedupe-field button, .search-enable-field button { width: 100%; }
}

.toolbar { flex-wrap: wrap; gap: 18px; }
.search-field { flex: 1 1 230px; width: auto; }
.card-actions { padding: 0 18px 16px; }
.detail-button, #load-more, #close-detail { padding: 9px 16px; background: #203d38; color: #b6f9dc; border: 1px solid #43665d; border-radius: 7px; cursor: pointer; }
button:disabled { cursor: default; opacity: .65; }
.pagination { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 16px; padding: 24px 0; }
.pagination p { margin: 0; color: var(--muted); }
.demo-error { border: 1px solid #77543d; color: #f4cd88; background: #2b2419; padding: 14px; border-radius: 8px; overflow-wrap: anywhere; }
dialog { width: min(760px, calc(100% - 32px)); max-height: calc(100dvh - 32px); padding: 20px; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 12px; overflow: auto; overflow-wrap: anywhere; }
dialog::backdrop { background: rgb(0 0 0 / .72); }
.detail-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.detail-header h2 { margin: 0; font-size: 20px; }
.detail-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0 0 18px; }
.detail-fields dt { color: var(--muted); font-size: 12px; }
.detail-fields dd { margin: 2px 0 0; white-space: pre-wrap; }
.workspace, .toolbar > *, .message-header > div { min-width: 0; }
.page-footer { flex-wrap: wrap; }
@media (max-width: 760px) {
  .day-field, .search-field { flex: initial; width: 100%; }
  .message-header { flex-wrap: wrap; }
  .message-meta { text-align: left; }
  .detail-fields { grid-template-columns: minmax(0, 1fr); }
  dialog { padding: 14px; }
  .list-heading { align-items: start; flex-wrap: wrap; }
}

/* Stage2D: HTTP loading state only; existing offline layout is preserved. */
/* CHANGE-G1B-0038: aria-busy is set only for initial empty load (see app.js). Keeps opacity
   dimming from toggling during day autofetch / refresh / load-more while cards are visible. */
#message-list[aria-busy="true"] { opacity: .7; }
/* CHANGE-G1B-0040: footer status copy removed; button-only pagination. */
#page-status { display: none !important; min-height: 0; margin: 0; padding: 0; border: 0; }

/* Stage2E local synthetic membership; no external assets. */
.auth-panel { border: 1px solid var(--border, #344256); border-radius: 14px; padding: 20px; margin: 20px 0; background: #141d2b; }
.auth-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 18px; }
.auth-panel label { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.auth-panel input { min-width: 0; max-width: 100%; padding: 10px; color: #edf2f7; background: #0d1520; border: 1px solid #536177; border-radius: 6px; }
.auth-panel article { padding: 12px 0; border-bottom: 1px solid #344256; overflow-wrap: anywhere; }
.auth-panel article button { margin: 4px; }
.auth-panel pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.auth-panel a, .page-header a { color: #98caff; }
#auth-error, #admin-error { color: #ffc0b8; }
[hidden] { display: none !important; }

/* A-01/A-02: official HTTP dashboard only; preserve offline/admin presentation. */
#dashboard[data-mode="http"] .message-list {
  grid-template-columns: minmax(0, 1fr);
}
#dashboard[data-mode="http"] .message-header {
  flex-wrap: wrap;
}
#dashboard[data-mode="http"] .message-header > div {
  flex: 1 1 18rem;
}
#dashboard[data-mode="http"] .message-header.direction-leading > .observation-meta,
#dashboard[data-mode="http"] .message-header.direction-leading > .message-identity {
  flex: 0 1 auto; /* CHANGE-G1B-0058: don't force 18rem basis onto grid time/identity */
}
#dashboard[data-mode="http"] .message-meta {
  text-align: left;
}

/* G1-UI header adaptation: HTTP page only; retain the existing dark palette. */
body.http-dashboard {
  --header-bar: #141e2e;
  --header-line: rgba(255, 255, 255, .08);
}
.http-dashboard .brand-header {
  background: var(--bg);
  border-bottom: 1px solid var(--header-line);
}
.http-dashboard .header-inner,
.http-dashboard .environment-inner {
  width: min(1440px, 100%);
  margin-inline: auto;
  padding-inline: 48px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.http-dashboard .header-inner {
  padding-block: 21px;
  justify-content: space-between;
  flex-wrap: wrap;
  /* CHANGE-G1B-0035: row-gap only; avoid tall wrap chrome */
  row-gap: 8px;
  column-gap: 12px;
}
.http-dashboard .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  /* CHANGE-G1B-0035: grow less so mid/zoom keeps brand+actions on one row longer */
  flex: 0 1 auto;
}
.http-dashboard .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 9px;
  background: #2f6b52;
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.http-dashboard .brand-copy { min-width: 0; }
.http-dashboard .brand-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.http-dashboard .brand-title h1 {
  font-size: 19px;
  font-weight: 650;
  line-height: 1.4;
  /* CHANGE-G1B-0035: keep title as one unit to delay awkward wrap */
  white-space: nowrap;
}
.http-dashboard .brand-tag {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--header-line);
  background: rgba(255, 255, 255, .04);
  padding: 2px 5px;
  border-radius: 3px;
}
.http-dashboard .brand-subtitle {
  font-size: 11px;
  color: var(--muted);
  margin: 5px 0 0;
}
.http-dashboard .header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
  /* CHANGE-G1B-0035: stay right as a group on wrap (not left-flush under title) */
  margin-inline-start: auto;
  flex: 0 1 auto;
}
.http-dashboard .environment-tag { font-size: 11px; color: var(--muted); }
.http-dashboard .status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--amber);
  border: 1px solid #715b35;
  padding: 5px 10px;
  border-radius: 6px;
  overflow-wrap: anywhere;
}
.http-dashboard .status-dot,
.http-dashboard .status-square {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: var(--amber);
  flex-shrink: 0;
}
.http-dashboard .status-dot { border-radius: 50%; }
.http-dashboard .status-square { border-radius: 1px; }
.http-dashboard .header-account-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--header-line);
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
  text-decoration: none;
  white-space: nowrap;
}
.http-dashboard .header-account-link:hover { border-color: var(--muted); }
.http-dashboard .header-account-link:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}
.http-dashboard .environment-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--header-bar);
  border-bottom: 1px solid var(--header-line);
}
.http-dashboard .environment-inner {
  min-height: 36px;
  padding-block: 8px;
  flex-wrap: wrap;
  gap: 6px 20px;
  font-size: 10px;
}
.http-dashboard .prototype-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 650;
  color: var(--amber);
  letter-spacing: .04em;
}
.http-dashboard .environment-copy { color: var(--muted); font-weight: 500; }
.http-dashboard .memory-only { margin-inline-start: auto; color: var(--muted); }
.http-dashboard #dashboard {
  width: min(1440px, 100%);
  padding: 24px 48px;
}
@media (max-width: 760px) {
  .http-dashboard .header-inner,
  .http-dashboard .environment-inner { padding-inline: 16px; }
  .http-dashboard .header-inner { padding-block: 16px; gap: 12px; }
  .http-dashboard .brand { flex: 1 1 100%; }
  .http-dashboard .brand-mark { width: 35px; height: 35px; }
  .http-dashboard .brand-title h1 { font-size: 16px; }
  /* CHANGE-G1B-0035: full-width wrap row, actions group right-aligned */
  .http-dashboard .header-actions { flex: 1 1 100%; justify-content: flex-end; gap: 8px; margin-inline-start: 0; }
  .http-dashboard .header-account-link { min-height: 44px; }
  .http-dashboard .brand-tag,
  .http-dashboard .environment-tag,
  .http-dashboard .memory-only { display: none; }
  .http-dashboard .prototype-label { width: 100%; }
  .http-dashboard #dashboard { padding: 20px 16px; }
}

/* Account presentation only: preserve auth form IDs and the existing dark palette. */
.http-dashboard .account-trigger,
.http-dashboard .account-dialog button[type="submit"] {
  min-height: 36px;
  padding: 7px 14px;
  border: 0;
  border-radius: 6px;
  color: var(--bg);
  background: var(--amber);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.http-dashboard .account-trigger:focus-visible,
.http-dashboard .account-dialog button:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
}
.http-dashboard .account-dialog {
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 20px;
  border: 1px solid var(--header-line);
  border-radius: 10px;
  background: var(--header-bar);
  color: var(--text);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .5);
}
.http-dashboard .account-dialog::backdrop { background: rgba(0, 0, 0, .55); }
.http-dashboard .account-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.http-dashboard .account-dialog-head h2 { margin: 0; font-size: 16px; }
.http-dashboard #account-close {
  min-width: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 24px;
  cursor: pointer;
}
.http-dashboard .account-dialog .auth-panel {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}
.http-dashboard .account-dialog p { font-size: 12px; overflow-wrap: anywhere; }
.http-dashboard .account-dialog .auth-grid { grid-template-columns: minmax(0, 1fr); }
.http-dashboard .account-dialog input { width: 100%; min-height: 40px; }
@media (max-width: 760px) {
  .http-dashboard .account-trigger,
  .http-dashboard #account-close { min-height: 44px; }
}

/* Time presentation only: keep the existing direction badge and identity positions. */
#dashboard[data-mode="http"] .observation-meta {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  column-gap: 12px;
  align-items: start;
}
#dashboard[data-mode="http"] .observation-meta .message-time {
  margin-top: 0;
  justify-self: end;
  text-align: right;
  color: var(--green);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

/* Direction placement and second-precision time only; message contents stay untouched. */
#dashboard[data-mode="http"] .direction-leading {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  gap: 10px;
  align-items: start;
}
#dashboard[data-mode="http"] .direction-leading > .observation-meta {
  display: block;
  min-width: 0;
  align-self: start;
  justify-self: end;
  margin: 0;
  padding: 0;
  line-height: 1.2;
}
/* CHANGE-G1B-0058: pin compact time to top-right of header (with sender), not mid-header */
#dashboard[data-mode="http"] .direction-leading > .observation-meta .message-time {
  display: block;
  margin: 0;
  padding: 0;
  line-height: 1.2;
  white-space: nowrap;
}
#dashboard[data-mode="http"] .direction-leading > .direction-badge {
  display: inline-flex;
  align-items: center;
  align-self: start;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.4;
  white-space: nowrap;
}
#dashboard[data-mode="http"] .direction-leading > .direction-buy { background: #e0f6e8; color: #127a42; }
#dashboard[data-mode="http"] .direction-leading > .direction-sell { background: #e3efff; color: #0871e8; }
#dashboard[data-mode="http"] .direction-leading > .direction-both { background: #f3eef8; color: #6b4f8a; }
#dashboard[data-mode="http"] .direction-leading > .direction-unknown { background: #eef0f3; color: #68717a; }
#dashboard[data-mode="http"] .direction-leading .direction-arrow { font-size: 15px; line-height: 1; }
@media (max-width: 760px) {
  #dashboard[data-mode="http"] .direction-leading { grid-template-columns: max-content minmax(0, 1fr); }
  #dashboard[data-mode="http"] .direction-leading > .observation-meta { grid-column: 1 / -1; justify-self: end; }
}

/* R4: live reading controls; message typography and original content unchanged. */
.new-messages { position:fixed; top:64px; left:50%; transform:translateX(-50%); z-index:30; border:1px solid #5eaa90; background:#153f35; color:#c1ffe6; border-radius:18px; padding:8px 16px; box-shadow:0 3px 12px #0006; cursor:pointer; }
.new-messages[hidden] { display:none; }
.message-list { overflow-anchor:none; }

/* R11: status changes stay inside one stable box; message text remains unrestricted. */
.live-reading-root { overflow-anchor:none; scroll-behavior:auto; }
.http-dashboard .sync-status-panel { height:auto; min-height:2.4rem; max-height:4.5rem; margin:10px 0; overflow:auto; overflow-anchor:none; }
.http-dashboard .sync-status-panel > p { margin:0 0 4px; }
.http-dashboard #result-count { white-space:nowrap; }
@media (max-width:600px) {
  .http-dashboard .sync-status-panel { min-height:2.8rem; max-height:6rem; }
  .http-dashboard #result-count { font-size:12px; }
}

/* Formal UI: truthful, compact status. Keep R11's fixed layout and one scroll owner. */
.http-dashboard .status-pill { min-width: 6em; justify-content: center; color: var(--muted); border-color: var(--border); }
.http-dashboard .status-pill[data-state="connected"] { color: var(--green); border-color: rgba(125,211,192,.4); }
.http-dashboard .status-pill[data-state="warning"] { color: var(--amber); }
.http-dashboard .header-actions { flex-wrap: wrap; }
.http-dashboard .sync-status-panel { height: auto; min-height: 2.4rem; max-height: 4rem; margin: 8px 0 12px; }
.http-dashboard .sync-status-panel > p { font-size: 13px; line-height: 1.45; }
.http-dashboard #source-status { color: var(--muted); }
.http-dashboard .toolbar input:disabled { cursor: default; }
.http-dashboard .filter-buttons button:disabled { opacity: .6; cursor: default; }
@media (max-width:600px) {
  .http-dashboard .sync-status-panel { min-height: 2.8rem; max-height: 5.5rem; }
  .http-dashboard .header-inner { flex-wrap: wrap; gap: 8px 12px; }
  /* CHANGE-G1B-0035: wrapped actions stay right-aligned (was flex-start / left-flush) */
  .http-dashboard .header-actions { width: 100%; justify-content: flex-end; gap: 8px; margin-inline-start: 0; }
}

/* G1B product-keywords V1: isolated display-only candidate. */
.product-filters{margin:8px 0 10px;padding:10px 12px;border:1px solid var(--line,rgba(255,255,255,.12));border-radius:10px;background:rgba(255,255,255,.02);min-width:0}
.product-filters p{margin:0;font-size:12px;line-height:1.45;color:var(--muted,#9aa8b8)}
.product-filter-groups{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin:8px 0}
.product-filter-group{border:1px solid rgba(255,255,255,.12);border-radius:6px;min-width:0;align-self:start}
.product-filter-group>summary{padding:9px;cursor:pointer;font-size:13px;color:#e6edf5;overflow-wrap:anywhere}
.product-options{border:0;margin:0;padding:8px;display:flex;flex-wrap:wrap;gap:7px;max-height:240px;overflow:auto;min-width:0}
.product-option{display:flex;align-items:center;gap:5px;font-size:12px;white-space:normal;overflow-wrap:anywhere;padding:4px;cursor:pointer;color:#d9e3ed}
.product-option input{width:15px;height:15px;padding:0;margin:0;flex:none;accent-color:#e0b04a}
.product-selected{display:flex;flex-wrap:wrap;gap:6px;min-width:0}
.product-selected:empty{display:none}
.product-selection-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center;justify-content:space-between;margin:2px 0 4px}
.product-chip,.product-selection-actions button{font-size:12px;padding:5px 8px;border:1px solid rgba(255,255,255,.18);border-radius:6px;background:transparent;color:#e6edf5;cursor:pointer;max-width:100%;overflow-wrap:anywhere}
.product-filters button:focus-visible,.product-filter-group summary:focus-visible{outline:2px solid #e0b04a;outline-offset:2px}
.product-filters .product-filter-hint{font-size:11px;margin-top:4px}
.product-highlight{border-radius:3px;padding:0 .06em;box-decoration-break:clone;-webkit-box-decoration-break:clone;font-weight:700}
.product-highlight.product-memory{color:#FFB347;background:#473019;font-weight:700}
.product-highlight.product-gpu{color:#72B4FF;background:#1B3657;font-weight:700}
.product-highlight.product-cpu{color:#4ADE80;background:#1C3827;font-weight:700}
/* CHANGE-G1B-0023: free-text q match emphasis (orange-red + bold); stacks with product-highlight */
/* CHANGE-G1B-0024: raise specificity above .original-content mark (green) and .product-highlight.product-* category colors */
/* CHANGE-G1B-0025: product marks bold; search-q keeps #FF4500+bold, no background tint */
.search-q-highlight,
.original-content mark.search-q-highlight,
.structured-fields mark.search-q-highlight,
.product-highlight.search-q-highlight,
.original-content mark.product-highlight.search-q-highlight,
.structured-fields mark.product-highlight.search-q-highlight,
.original-content mark.product-highlight.product-memory.search-q-highlight,
.original-content mark.product-highlight.product-gpu.search-q-highlight,
.original-content mark.product-highlight.product-cpu.search-q-highlight,
.structured-fields mark.product-highlight.product-memory.search-q-highlight,
.structured-fields mark.product-highlight.product-gpu.search-q-highlight,
.structured-fields mark.product-highlight.product-cpu.search-q-highlight{
  color:#FF4500 !important;
  font-weight:700 !important;
  background:transparent !important;
  border-radius:3px;
  padding:0 .06em;
  box-decoration-break:clone;
  -webkit-box-decoration-break:clone;
}
@media(max-width:1000px){.product-filter-groups{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){.product-filter-groups{grid-template-columns:1fr}.product-filters{padding:12px}.product-options{max-height:200px}}

.product-options>legend{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}

.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}


/* CHANGE-G1B-0035: header responsive wrap — brand left / actions right; on wrap actions stay end-aligned */
/* CHANGE-G1B-0006 compact message-first */
.http-dashboard .brand-header { position: sticky; top: 0; z-index: 40; }
.http-dashboard .header-inner { min-height: 48px; padding-block: 8px; gap: 12px; }
.http-dashboard .brand-mark { width: 28px; height: 28px; }
.http-dashboard .brand-title h1 { font-size: 16px; letter-spacing: 0; }
.http-dashboard .brand-subtitle { display: none; }
.http-dashboard #dashboard { width: min(1280px, 100%); padding: 12px 20px 20px; }
.http-dashboard .toolbar {
  align-items: end;
  gap: 10px 14px;
  padding: 0 0 10px;
  margin: 0;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 48px;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
}
.http-dashboard .direction-filter legend,
.http-dashboard .search-field label,
.http-dashboard .day-field label,
.http-dashboard .dedupe-label,
.http-dashboard .search-enable-label { margin-bottom: 4px; font-size: 11px; }
.http-dashboard .filter-buttons { padding: 2px; gap: 2px; }
.http-dashboard .filter-buttons button { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.http-dashboard .search-field input,
.http-dashboard .day-field input[type="date"],
.http-dashboard .toolbar select,
.http-dashboard .toolbar button { min-height: 36px; }
.http-dashboard .search-field input { padding: 6px 10px; }
.http-dashboard .day-field { flex: 0 0 148px; }
.http-dashboard .day-field input[type="date"] { padding: 6px 10px; }
.http-dashboard .product-filters {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 8px;
}
.http-dashboard .product-filter-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}
.http-dashboard .product-filter-group {
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 6px;
  padding: 6px 8px 8px;
  min-width: 0;
  background: rgba(0,0,0,.12);
}
.http-dashboard .product-group-title {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 650;
  color: #e6edf5;
  display: flex;
  align-items: center;
  gap: 4px;
}
.http-dashboard .product-group-count { color: var(--amber); font-weight: 600; }
.http-dashboard .product-options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-height: 7.5rem;
  overflow: auto;
  padding: 0;
  margin: 0;
  border: 0;
}
.http-dashboard .product-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.3;
  color: #d9e3ed;
  background: rgba(255,255,255,.03);
  white-space: nowrap;
}
/* CHANGE-G1B-0013: selected chrome/bold (border later beaten by G1B-0007 !important) */
.http-dashboard .product-option:has(input:checked) {
  border-color: rgba(224,176,74,.7);
  background: rgba(224,176,74,.12);
  color: #ffe2a8;
  font-weight: 700;
}
.http-dashboard .product-option input { width: 12px; height: 12px; }
.http-dashboard .product-selection-actions {
  margin: 6px 0 0;
  gap: 6px;
}
.http-dashboard .product-selection-actions p { font-size: 11px; }
.http-dashboard .product-selection-actions button {
  min-height: 28px;
  padding: 2px 8px;
  font-size: 11px;
}
.http-dashboard .product-selected { gap: 4px; margin-top: 4px; }
.http-dashboard .product-chip { min-height: 28px; padding: 2px 8px; font-size: 11px; font-weight: 700; }
.http-dashboard .stream-chrome {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 16px;
  margin: 4px 0 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.http-dashboard .stream-chrome .list-heading {
  padding: 0;
  gap: 10px;
  flex: 1 1 auto;
}
.http-dashboard .stream-chrome .list-heading h2 { font-size: 14px; }
.http-dashboard .stream-chrome .list-heading p { font-size: 11px; }
.http-dashboard .sync-status-panel {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  flex: 1 1 220px;
  text-align: right;
}
.http-dashboard .sync-status-panel > p {
  margin: 0;
  font-size: 11px;
  line-height: 1.35;
  color: var(--muted);
}
.http-dashboard .message-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.http-dashboard .message-card { border-radius: 8px; }
.http-dashboard .message-header { padding: 10px 12px 8px; gap: 10px; }
.http-dashboard .group-name { font-size: 13px; font-weight: 400; color: var(--muted); line-height: 1.5; } /* CHANGE-G1B-0054: size match sender */
.http-dashboard .sender-name { margin-top: 0; font-size: 13px; font-weight: 650; color: var(--text); line-height: 1.5; } /* CHANGE-G1B-0052: swapped */
.http-dashboard .original-content { padding: 10px 28px 24px 12px; font-size: 14px; line-height: 1.55; } /* CHANGE-G1B-0056: room for copy btn */
.http-dashboard .structured-fields { padding: 8px 12px; gap: 4px 12px; }
.http-dashboard .card-actions { padding: 0 12px 10px; }
.http-dashboard .card-actions .detail-button { min-height: 32px; padding: 4px 10px; font-size: 12px; }
.http-dashboard .pagination { padding: 12px 0 4px; gap: 10px; }
.http-dashboard .empty-state { padding: 28px 14px; }
.http-dashboard .new-messages { top: 56px; padding: 6px 12px; }
@media (max-width: 1000px) {
  .http-dashboard .product-filter-groups { grid-template-columns: 1fr; }
  .http-dashboard .product-options { max-height: 5.5rem; }
}
@media (max-width: 760px) {
  .http-dashboard #dashboard { padding: 10px 12px 16px; }
  .http-dashboard .toolbar { top: 0; position: static; }
  .http-dashboard .message-list { grid-template-columns: minmax(0, 1fr); }
  .http-dashboard .sync-status-panel { text-align: left; flex-basis: 100%; }
  .http-dashboard .filter-buttons button { min-height: 36px; }
}


/* CHANGE-G1B-0007 tidy product option grids */
.http-dashboard .product-option-sections {
  display: grid;
  gap: 8px;
}
.http-dashboard .product-options-legend {
  float: none;
  width: auto;
  padding: 0;
  margin: 0 0 6px;
  font-size: 11px;
  line-height: 1.2;
  color: var(--muted);
  letter-spacing: .04em;
}
.http-dashboard .product-options {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px !important;
  max-height: none !important;
  overflow: visible !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  min-width: 0;
}
.http-dashboard .product-options-capacity {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.http-dashboard .product-options-frequency {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.http-dashboard .product-options-cpu {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-height: 9.5rem !important;
  overflow: auto !important;
  padding-right: 2px !important;
}
.http-dashboard .product-options-gpu {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-height: 9.5rem !important;
  overflow: auto !important;
  padding-right: 2px !important;
}
.http-dashboard .product-option {
  display: inline-flex !important;
  align-items: center;
  justify-content: flex-start;
  gap: 6px !important;
  width: 100%;
  min-height: 28px;
  margin: 0;
  padding: 4px 8px !important;
  border: 1px solid rgba(255,255,255,.14) !important;
  border-radius: 6px !important;
  font-size: 12px !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}
.http-dashboard .product-option input {
  width: 13px !important;
  height: 13px !important;
  flex: none;
}

/* CHANGE-G1B-0016: re-assert selected emphasis AFTER G1B-0007 border !important so bold+chrome visibly win */
.http-dashboard .product-option:has(input:checked) {
  border-color: rgba(224,176,74,.7) !important;
  background: rgba(224,176,74,.12);
  color: #ffe2a8;
  font-weight: 700;
}
.http-dashboard .product-chip {
  font-weight: 700;
  border-color: rgba(224,176,74,.7);
  background: rgba(224,176,74,.12);
  color: #ffe2a8;
}
@media (max-width: 1100px) {
  .http-dashboard .product-options-cpu { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .http-dashboard .product-options-capacity,
  .http-dashboard .product-options-frequency,
  .http-dashboard .product-options-gpu { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .http-dashboard .product-options-cpu { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* CHANGE-G1B-0018: densify 内存/CPU/GPU product-keyword panels (less vertical space) */
.http-dashboard .product-filters {
  margin: 6px 0;
  padding: 6px 8px;
}
.http-dashboard .product-filter-groups {
  gap: 6px;
}
.http-dashboard .product-filter-group {
  padding: 4px 6px 6px;
}
.http-dashboard .product-group-title {
  margin: 0 0 4px;
  font-size: 11px;
  gap: 3px;
}
.http-dashboard .product-option-sections {
  gap: 4px;
}
.http-dashboard .product-options-legend {
  margin: 0 0 3px;
  font-size: 10px;
}
.http-dashboard .product-options {
  gap: 3px !important;
}
.http-dashboard .product-options-cpu,
.http-dashboard .product-options-gpu {
  max-height: 6.5rem !important;
}
.http-dashboard .product-option {
  gap: 3px !important;
  min-height: 22px;
  padding: 2px 6px !important;
  font-size: 11px !important;
  line-height: 1.15 !important;
}
.http-dashboard .product-option input {
  width: 11px !important;
  height: 11px !important;
}
/* Keep G1B-0016 selected amber+bold after densify overrides */
.http-dashboard .product-option:has(input:checked) {
  border-color: rgba(224,176,74,.7) !important;
  background: rgba(224,176,74,.12);
  color: #ffe2a8;
  font-weight: 700;
}
.http-dashboard .product-selection-actions {
  margin: 4px 0 0;
  gap: 4px;
}
.http-dashboard .product-selection-actions p { font-size: 10px; }
.http-dashboard .product-selection-actions button {
  min-height: 24px;
  padding: 1px 6px;
  font-size: 10px;
}
.http-dashboard .product-selected { gap: 3px; margin-top: 3px; }
.http-dashboard .product-chip {
  min-height: 22px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  border-color: rgba(224,176,74,.7);
  background: rgba(224,176,74,.12);
  color: #ffe2a8;
}
@media (max-width: 1000px) {
  .http-dashboard .product-options-cpu,
  .http-dashboard .product-options-gpu { max-height: 5.5rem !important; }
}


/* CHANGE-G1B-0019: independent Memory/CPU/GPU panel collapse (click title); keep 0018 densify + 0016 amber */
/* CHANGE-G1B-0020: collapse hide must beat .product-options { display:grid !important }; caret ▸/▼ */
.http-dashboard .product-group-title {
  cursor: pointer;
  user-select: none;
  margin-bottom: 0;
}
.http-dashboard .product-group-title::before {
  content: "▸";
  display: inline-block;
  width: 0.85em;
  color: var(--amber);
}
.http-dashboard .product-filter-group:not(.is-collapsed) .product-group-title {
  margin: 0 0 4px;
}
.http-dashboard .product-filter-group:not(.is-collapsed) .product-group-title::before {
  content: "▼";
}
.http-dashboard .product-filter-group.is-collapsed {
  padding-bottom: 4px;
}
.http-dashboard .product-filter-group.is-collapsed > :not(.product-group-title) {
  display: none !important; /* beat G1B-0007 .product-options { display:grid !important } on CPU/GPU fieldset children */
}
.http-dashboard .product-group-title:focus-visible {
  outline: 2px solid #e0b04a;
  outline-offset: 2px;
  border-radius: 4px;
}

/* CHANGE-G1B-0010: brief fresh-arrival emphasis on message cards (not persistent unread) */
/* CHANGE-G1B-0011: bold card text while --fresh is active; reverts when class clears */
/* CHANGE-G1B-0025: keep 3.2s green pulse; remove whole-card / group-name / direction-badge bold during --fresh */
@keyframes message-card-fresh-pulse {
  0% {
    background-color: #1a2f28;
    border-color: #3d7a66;
    box-shadow: 0 0 0 1px rgba(137, 237, 196, 0.32), 0 0 16px rgba(137, 237, 196, 0.12);
  }
  40% {
    background-color: #17262c;
    border-color: #355a52;
    box-shadow: 0 0 0 1px rgba(137, 237, 196, 0.18), 0 0 10px rgba(137, 237, 196, 0.06);
  }
  100% {
    background-color: var(--surface);
    border-color: var(--border);
    box-shadow: none;
  }
}
.message-card.message-card--fresh {
  animation: message-card-fresh-pulse 3.2s ease-out 1;
}
@media (prefers-reduced-motion: reduce) {
  .message-card.message-card--fresh {
    animation: none;
  }
}


/* CHANGE-G1B-0033: compact mobile filter toolbar — pair query/actions rows; densify gaps */
/* Desktop: display:contents so children keep participating in .toolbar flex as before */
.toolbar-query-row,
.toolbar-actions-row {
  display: contents;
}

@media (max-width: 760px) {
  .toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 10px;
  }
  .toolbar-query-row,
  .toolbar-actions-row {
    display: flex;
    flex-direction: row;
    align-items: end;
    gap: 8px;
    width: 100%;
    min-width: 0;
  }
  .toolbar-query-row .search-field {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }
  .toolbar-query-row .day-field {
    flex: 0 0 132px;
    width: auto;
  }
  .toolbar-actions-row .search-enable-field,
  .toolbar-actions-row .dedupe-field {
    flex: 1 1 0;
    width: auto;
    min-width: 0;
  }
  .toolbar-actions-row .search-enable-field button,
  .toolbar-actions-row .dedupe-field button {
    width: 100%;
  }
  /* Button text is self-describing; hide duplicate labels to save a row of chrome */
  .toolbar-actions-row .search-enable-label,
  .toolbar-actions-row .dedupe-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .direction-filter legend,
  .search-field label,
  .day-field label {
    margin-bottom: 4px;
    font-size: 11px;
  }
  .filter-buttons {
    padding: 2px;
    gap: 2px;
  }
  .filter-buttons button {
    flex: 1;
    min-height: 34px;
    padding: 6px 8px;
    font-size: 13px;
  }
  .search-field input,
  .day-field input[type="date"] {
    min-height: 34px;
    padding: 6px 8px;
  }
  .dedupe-field button,
  .search-enable-field button {
    min-height: 34px;
    padding: 4px 10px;
    font-size: 13px;
  }
  .product-filters {
    margin: 6px 0 8px;
    padding: 6px 8px;
  }
}

/* HTTP workbench: same pairing + slightly tighter chrome on phone */
@media (max-width: 760px) {
  .http-dashboard .toolbar {
    gap: 8px;
    padding: 0 0 8px;
  }
  .http-dashboard .toolbar-query-row,
  .http-dashboard .toolbar-actions-row {
    gap: 6px;
  }
  .http-dashboard .toolbar-query-row .day-field {
    flex-basis: 124px;
  }
  .http-dashboard .direction-filter legend,
  .http-dashboard .search-field label,
  .http-dashboard .day-field label {
    margin-bottom: 2px;
    font-size: 10px;
  }
  .http-dashboard .filter-buttons button {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 12px;
  }
  .http-dashboard .search-field input,
  .http-dashboard .day-field input[type="date"],
  .http-dashboard .toolbar-actions-row .search-enable-field button,
  .http-dashboard .toolbar-actions-row .dedupe-field button {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 12px;
  }
  .http-dashboard .product-filters {
    margin: 4px 0 6px;
    padding: 4px 6px;
  }
}

/* CHANGE-G1B-0034: merge 消息方向 into search toolbar strip (same cluster as search/date) */
/* Desktop: display:contents keeps direction + search + day in one .toolbar flex row */
.direction-filter {
  flex: 0 0 auto;
  align-self: end;
}
/* Soften standalone panel look: aria legend only; segment sits with search controls */
.direction-filter legend {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.filter-buttons {
  background: var(--surface);
  border-color: var(--border);
}

@media (max-width: 760px) {
  /* Shared shell: direction full-width first line; search+date stay on second line */
  .toolbar-query-row {
    flex-wrap: wrap;
    align-items: stretch;
  }
  .toolbar-query-row .direction-filter {
    flex: 1 1 100%;
    width: 100%;
    align-self: stretch;
  }
  .toolbar-query-row .filter-buttons {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .http-dashboard .toolbar-query-row .direction-filter {
    flex-basis: 100%;
  }
  .http-dashboard .toolbar-query-row .filter-buttons button {
    min-height: 32px;
    padding: 4px 8px;
    font-size: 12px;
  }
}

/* CHANGE-G1B-0041: full-page real-auth login gate (G1-UI mockup layout). */
/* CHANGE-G1B-0042: dark palette aligned with workbench (--bg/--surface/--text/--green). */
body.http-dashboard.is-logged-out {
  background: var(--bg);
}
body.http-dashboard.is-logged-out .brand-header,
body.http-dashboard.is-logged-out .workbench-shell {
  display: none !important;
}
body.http-dashboard.is-logged-in .login-gate {
  display: none !important;
}
body.http-dashboard.is-logged-out .login-gate {
  display: flex;
}
.login-gate {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
  color: var(--text);
  color-scheme: dark;
  overflow: auto;
}
.login-card {
  width: min(420px, 100%);
  margin: auto;
  padding: 28px 28px 22px;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .45);
}
.login-card-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 16px;
}
.login-mark {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #25443c;
  color: var(--green);
  border: 1px solid #43665d;
  box-shadow: none;
}
.login-mark svg { display: block; }
.login-card-titles { min-width: 0; flex: 1; }
.login-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.login-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: .01em;
  color: var(--text);
}
.login-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  background: #17212e;
}
.login-subtitle {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.login-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #1a2b26;
  border: 1px solid #2c5147;
  color: #b6f9dc;
  font-size: 12.5px;
  line-height: 1.45;
}
.login-banner-icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  background: #2c5147;
  color: #b6f9dc;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  line-height: 1;
}
.login-error {
  margin: 0 0 10px;
  min-height: 1.2em;
  color: #ffb3b3;
  font-size: 13px;
}
.login-error:empty { display: none; }
.login-form {
  display: grid;
  gap: 12px;
}
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.login-form input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #0d1520;
  color: var(--text);
  font-size: 14px;
}
.login-form input::placeholder { color: #8d9db1; }
.login-form input:focus {
  outline: 2px solid rgba(137, 237, 196, .45);
  outline-offset: 1px;
  border-color: #43665d;
  background: #101926;
}
.login-submit {
  margin-top: 4px;
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  border: 1px solid #43665d;
  border-radius: 10px;
  background: #203d38;
  color: #b6f9dc;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}
.login-submit:hover { background: #2c5147; color: #d7fff0; }
.login-submit:disabled { opacity: .65; cursor: default; filter: none; }
.login-submit:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}
.login-submit-icon {
  font-size: 16px;
  line-height: 1;
}
.login-footnote {
  margin: 16px 0 0;
  text-align: center;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}
.login-footnote a { color: var(--green); }
@media (max-width: 480px) {
  .login-card { padding: 22px 18px 18px; border-radius: 12px; }
  .login-title { font-size: 18px; }
}

/* CHANGE-G1B-0045: login-gate login/register tabs (dark theme). */
.login-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: 0 0 14px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #17212e;
}
.login-mode-tab {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}
.login-mode-tab[aria-selected="true"] {
  background: #2c5147;
  color: #b6f9dc;
}
.login-mode-tab:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}
.login-gate-status {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #2c5147;
  background: #1a2b26;
  color: #b6f9dc;
  font-size: 12.5px;
  line-height: 1.45;
}
.login-gate-status[hidden] { display: none !important; }
.login-register-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}

/* CHANGE-G1B-0046: 「账号管理」仅 ADMIN 可见；默认隐藏防闪现。 */
.admin-entry[hidden] { display: none !important; }
body.http-dashboard:not(.is-admin) .admin-entry { display: none !important; }
body.http-dashboard.is-admin .header-account-link.admin-entry:not([hidden]) {
  display: inline-flex;
}

