/* Homepage workspace; report layouts retain their existing styles. */
body:has(#input-view:not([hidden])) { background: #f5f7fb; }
body:has(#input-view:not([hidden])) main { padding: 0; }
body:has(#input-view:not([hidden])) .site-header { display: none; }
body:has(#input-view:not([hidden])) .brand-logo { width: 118px; }
body:has(#input-view:not([hidden])) .brand-subtitle { font-size: 13px; padding-left: 18px; border-left: 0; margin-bottom: 8px; }
#input-view { max-width: none; }
.workbench-shell { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: 100vh; }
.workbench-sidebar { padding: 35px 18px; background: #fff; border-right: 0; }
.nav-caption { font-size: 11px; color: var(--muted); padding: 0 14px; letter-spacing: .1em; margin-bottom: 16px; }
.workspace-nav-link { display: flex; align-items: center; gap: 12px; padding: 13px 14px; margin-bottom: 7px; border-radius: 7px; font-size: 14px; color: #56687e; }
.workspace-nav-link svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.workspace-nav-link:hover { background: #f5f7fb; color: var(--accent); }
.workspace-nav-link.is-current { color: var(--accent); background: #eaf2ff; font-weight: 600; }
.workbench-content { padding: 26px 36px 48px; width: 100%; max-width: 1500px; margin: auto; min-width: 0; }
.workspace-breadcrumb { color: var(--ink); font-size: 24px; font-weight: 600; line-height: 1.4; margin: 0 0 8px; letter-spacing: .02em; }
.workspace-breadcrumb span { margin: 0 10px; color: #9aa9bd; }
.workspace-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 28px; }
.workspace-heading .workspace-eyebrow { color: var(--accent); font-size: 10px; letter-spacing: .16em; font-weight: 700; margin-bottom: 8px; }
.workspace-heading h1 { font-size: 29px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 10px; }
.workspace-heading p { font-size: 13px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 24px; align-items: start; }
.workspace-primary { min-width: 0; }
.workspace-card { background: #fff; border: 0; border-radius: 12px; box-shadow: 0 3px 10px #172c4603; }
.research-card { padding: 26px; }
.workspace-card-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.section-kicker { color: var(--accent); font-size: 11px; font-weight: 600; }
.workspace-card h2 { margin: 9px 0 0; font-size: 21px; font-weight: 650; }
.workspace-description { margin: 12px 0 2px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.research-card .form-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; padding-top: 24px; }
.research-card .keyword-field { grid-column: 1 / -1; }
.research-card input:not([type="hidden"]), .research-card .market-select-trigger { border-radius: 8px; border-color: #dbe3ee; background-color: #fbfcfe; min-height: 46px; font-size: 14px; }
.research-card input:focus { border-color: var(--accent); }
.research-card label { font-size: 12px; margin-bottom: 9px; }
.research-card label span { font-size: 10px; }
.research-card .field-hint { font-size: 11px; }
.research-card .form-bottom { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding-top: 2px; }
.research-card .primary-button { min-height: 46px; border-radius: 6px; font-size: 13px; width: auto; padding: 12px 22px; }
.analysis-note { font-size: 11px; color: var(--muted); }
.keyword-examples { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-top: 10px; padding: 0; }
.keyword-examples > span { color: #718096; font-size: 10px; font-weight: 400; margin-right: 6px; }
.keyword-examples button { padding: 4px 8px; border: 0; border-radius: 4px; background: transparent; color: var(--accent); font-size: 11px; font-weight: 500; min-height: 28px; }
.keyword-examples button:hover { color: var(--accent-hover); background: var(--accent-soft); text-decoration: underline; text-underline-offset: 3px; }
.keyword-examples button span { margin-left: 8px; }
.keyword-examples small { width: 100%; font-size: 10px; color: var(--muted); margin-top: 3px; }
.guide-card { background: #edf3fc; border: 0; border-radius: 12px; padding: 25px 22px 0; }
.guide-card h2 { font-size: 22px; line-height: 1.6; font-weight: 650; margin: 12px 0 22px; }
.research-questions { list-style: none; padding: 0; margin: 0; }
.research-questions li { display: flex; align-items: flex-start; gap: 12px; padding-bottom: 23px; }
.research-questions li > span { color: #527bb4; font-size: 11px; padding-top: 3px; font-weight: 600; }
.research-questions h3 { font-size: 12px; margin: 0 0 8px; font-weight: 600; }
.research-questions p { color: #5a708c; font-size: 11px; line-height: 1.9; margin: 0; }
.guide-footer { border-top: 0; color: #587293; padding: 16px 0; font-size: 10px; }
.workspace-references { margin-top: 26px; border-top: 0; padding-top: 20px; }
.workspace-references > summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; list-style: none; }
.workspace-references > summary::-webkit-details-marker { display: none; }
.workspace-references summary strong { color: var(--accent); font-size: 18px; font-weight: 500; line-height: 1.6; }
.workspace-references summary div > span { font-size: 11px; color: var(--muted); margin-left: 12px; }
.workspace-references .market-trends { margin-top: 8px; padding: 0 18px 18px; border-radius: 8px; background: #fff; }
.workspace-references[open] summary { margin-bottom: 20px; }
@media (min-width: 1500px) { .workspace-grid { grid-template-columns: minmax(0, 1fr) 300px; } .workbench-content { padding: 32px 48px 56px; } }
@media (max-width: 1180px) { .workbench-shell { grid-template-columns: 170px minmax(0, 1fr); } .workbench-content { padding: 24px; } .workspace-grid { grid-template-columns: minmax(0, 1fr) 230px; gap: 18px; } .research-card { padding: 22px; } .analysis-note { display: none; } }
@media (max-width: 980px) { .workspace-grid { grid-template-columns: minmax(0, 1fr); } .workspace-guide { display: block; } .guide-card h2 br { display: none; } .guide-card h2 { font-size: 18px; } }
@media (max-width: 680px) { .workbench-shell { display: block; } .workbench-sidebar { padding: 10px 16px; border-right: 0; border-bottom: 0; } .workbench-sidebar nav { display: flex; gap: 8px; } .workspace-nav-link { margin: 0; padding: 10px 14px; font-size: 12px; } .nav-caption { display: none; } .workbench-content { padding: 22px 16px 36px; } .workspace-breadcrumb { font-size: 20px; } .workspace-heading h1 { font-size: 23px; } .workspace-heading p { font-size: 12px; } .workspace-heading { margin-bottom: 24px; } .research-card { padding: 21px 18px; } .workspace-card h2 { font-size: 19px; } .research-card .form-card { grid-template-columns: minmax(0, 1fr); } .research-card input:not([type="hidden"]), .research-card .market-select-trigger { font-size: 16px; } .research-card .primary-button { width: 100%; } .workspace-guide { grid-template-columns: 1fr; } .workspace-references summary div > span { display: block; margin: 6px 0 0; } body:has(#input-view:not([hidden])) .site-header { padding: 12px 20px; } body:has(#input-view:not([hidden])) .brand-subtitle { font-size: 11px; } }


.research-card #reuse-supplier-details { min-height: 46px; border-radius: 6px; font-size: 13px; padding: 12px 18px; }

.history-panel { padding: 24px; }
.history-panel:has(> #recent-analysis-list:empty) { padding: 0; background: transparent; box-shadow: none; }
.history-panel a { color: var(--accent); }
#recent-analysis-empty { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.history-row:last-child { border-bottom: 0; }
.history-row strong { font-size: 14px; overflow-wrap: anywhere; }
.history-row small { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.history-row > a, .history-row > div { flex: 1; min-width: 0; font-size: 13px; padding: 10px 0; }
.history-row > .research-status { display: grid; place-items: center; flex: 0 0 24px; width: 24px; height: 24px; padding: 0; border-radius: 50%; color: var(--accent); }
.research-status.is-running { background: conic-gradient(var(--accent) var(--research-progress), var(--line) 0); }
.research-status-center { width: 18px; height: 18px; border-radius: 50%; background: var(--surface, #fff); }
.research-status.is-completed { background: transparent; color: #8bbba2; }
.research-status.is-failed { background: #fff0e8; color: #a34520; }
.research-status svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.research-status.is-completed svg { width: 16px; height: 16px; stroke-width: 1.6; }

.workspace-map { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; margin: 0 0 8px; background: transparent; }
.workspace-map img { display: block; width: 100%; height: 110px; object-fit: contain; mix-blend-mode: multiply; }
.workbench-content:has(> .workspace-map) { padding-top: 18px; }
.workbench-content:has(> .workspace-map) > .workspace-breadcrumb { margin-bottom: 4px; }
@media (max-width: 680px) {
  .workspace-map { margin-bottom: 8px; }
  .workspace-map img { height: 90px; object-fit: contain; }
}

.map-legend { position: relative; left: clamp(-110px, -7vw, -48px); display: grid; gap: 14px; padding-right: 4px; color: #71849e; font-size: 11px; }
.map-legend span { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.map-legend i { width: 6px; height: 6px; border-radius: 50%; background: #a0a9b7; }
.map-legend .map-legend-covered { background: #f04d5d; }
@media (max-width: 680px) { .workspace-map { gap: 8px; } .map-legend { font-size: 9px; gap: 10px; } }

@media (max-width: 980px) { .map-legend { left: -24px; } }
@media (max-width: 680px) { .map-legend { left: 0; } }

.sidebar-brand { display: block; width: fit-content; max-width: 100%; margin: 0 0 26px; padding: 0 12px; }
.sidebar-brand img { display: block; width: 138px; max-width: 100%; height: auto; }
@media (max-width: 680px) { .sidebar-brand { margin-bottom: 12px; padding: 0 14px; } .sidebar-brand img { width: 118px; } }

@media (min-width: 981px) {
  .workspace-grid { align-items: stretch; }
  .workspace-primary, .workspace-guide { display: flex; flex-direction: column; }
  .workspace-primary > .research-card, .workspace-guide > .guide-card { flex: 1; }
  .workspace-guide > .guide-card { display: flex; flex-direction: column; }
  .guide-card > .guide-footer { margin-top: auto; }
}

.sidebar-research-list { max-height: 65vh; overflow-y: auto; padding: 0 14px; }
#sidebar-research-history, .sidebar-research-list { scrollbar-width: none; }
#sidebar-research-history::-webkit-scrollbar, .sidebar-research-list::-webkit-scrollbar { display: none; }
.sidebar-research-list .history-row { padding: 6px 0; border: 0; line-height: 1.35; gap: 10px; }
.sidebar-research-list .history-row > a, .sidebar-research-list .history-row > div { min-width: 0; padding: 0; }
.sidebar-research-list .history-row strong { font-size: 12px; font-weight: 500; }
.sidebar-research-list .history-row small { margin-top: 3px; font-size: 10px; line-height: 1.4; overflow-wrap: anywhere; }
.recent-nav-heading { display: flex; align-items: center; margin-bottom: 7px; }
.recent-nav-heading .workspace-nav-link { flex: 1; gap: 8px; padding-right: 0; margin-bottom: 0; white-space: nowrap; }
#toggle-research-history { display: grid; place-items: center; flex-shrink: 0; width: 28px; min-height: 32px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: #56687e; }
#toggle-research-history:hover { background: #f5f7fb; }
#toggle-research-history svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }
#toggle-research-history[aria-expanded="false"] svg { transform: rotate(-90deg); }
#sidebar-research-status { padding: 0 14px; }
@media (max-width: 680px) { .sidebar-research-list { max-height: 220px; } }

/* Keep examples with their field, and give the primary action clear emphasis. */
.keyword-label-row { display: flex; align-items: baseline; justify-content: flex-start; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 9px; }
.research-card .keyword-label-row label, .research-card .keyword-label-row .field-hint { margin: 0; }
.cost-input { position: relative; }
.cost-input > span { position: absolute; top: 50%; left: 14px; transform: translateY(-50%); color: var(--muted); font-size: 14px; pointer-events: none; }
.research-card .cost-input input { padding-left: 34px; }
.research-card .form-bottom { gap: 12px; padding-top: 8px; }
.research-card #reuse-supplier-details { border: 0; background: transparent; color: #60728a; font-weight: 400; font-size: 12px; padding: 10px 8px; }
.research-card #reuse-supplier-details:hover { background: #f5f7fb; color: var(--accent); }
@media (min-width: 681px) {
  .research-card { display: flex; flex-direction: column; }
  .research-card .form-card { flex: 1; grid-template-rows: auto auto 1fr; }
  .research-card .form-bottom { align-self: end; }
}
@media (max-width: 680px) {
  .research-card .form-card { gap: 20px; }
  .research-card .form-bottom { display: grid; grid-template-columns: 1fr; }
  .research-card #reuse-supplier-details { width: 100%; }
}

.research-card .workspace-card-title h2 { margin: 0; font-size: 20px; font-weight: 600; }
.research-card label { font-weight: 500; }
.research-card .keyword-label-row .field-hint { font-size: 10px; }
.research-card .form-bottom { gap: 20px; padding-top: 16px; }
.research-card .form-bottom .primary-button { min-height: 44px; padding: 10px 24px; }

[data-auth-only][hidden] { display: none !important; }
.account-controls { margin-top: 16px; padding-top: 12px; border-top: 1px solid #edf0f5; }
#account-name { display: block; color: #263750; font-size: 12px; font-weight: 600; line-height: 1.5; font-variant-numeric: tabular-nums; white-space: nowrap; }
.account-text { display: grid; flex: 1; grid-template-columns: minmax(0, max-content) 24px; align-items: center; column-gap: 6px; row-gap: 3px; min-width: 0; }
.account-text #account-name { grid-column: 1; grid-row: 1; }
#account-name[hidden], #account-credits[hidden] { display: none; }
#account-credits { grid-column: 1; grid-row: 2; color: #758399; font-size: 11px; font-weight: 400; line-height: 1.5; font-variant-numeric: tabular-nums; white-space: nowrap; justify-self: start; }
.account-summary { display: flex; align-items: center; gap: 9px; min-height: 56px; padding: 8px 4px; }
#account-button, #account-credits { padding: 0; border: 0; border-radius: 7px; background: transparent; text-align: left; cursor: pointer; }
#account-button { position: relative; color: #758399; font-size: 13px; font-weight: 500; }
#account-name:not([hidden]) ~ #account-button { grid-column: 2; grid-row: 1; display: grid; place-items: center; width: 24px; height: 24px; }
#account-name:not([hidden]) ~ #account-button #account-button-label { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.account-logout-icon { display: none; width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#account-name:not([hidden]) ~ #account-button .account-logout-icon { display: block; }
.account-logout-tooltip { display: none; position: absolute; right: 0; bottom: calc(100% + 6px); padding: 5px 8px; border-radius: 6px; color: #fff; background: #263750; font-size: 11px; font-weight: 400; white-space: nowrap; pointer-events: none; z-index: 11; }
#account-name:not([hidden]) ~ #account-button:is(:hover, :focus-visible) .account-logout-tooltip { display: block; }
.account-avatar { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; border: 1px solid #dae8fc; border-radius: 50%; background: #edf4ff; color: #4679be; }
.account-avatar svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#account-button:hover, #account-button[aria-expanded="true"] { background: #f5f8fc; }
#account-button:hover #account-button-label, #account-credits:hover { color: var(--accent); }
#account-credits:hover { text-decoration: underline; text-underline-offset: 3px; }
#account-button:focus-visible, #account-credits:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (min-width: 681px) {
  .workbench-sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; }
  .workbench-sidebar > nav, .sidebar-brand, .account-controls { flex-shrink: 0; }
  #sidebar-research-history { min-height: 0; overflow-y: auto; margin-bottom: 16px; }
  .sidebar-research-list { max-height: none; overflow-y: visible; }
  .account-controls { margin-top: auto; }
}
@media (max-width: 680px) {
  #account-button { font-size: 12px; }
}
#auth-dialog { width: min(380px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 30px; border: 1px solid #dbe3ee; border-radius: 16px; color: #182337; box-shadow: 0 24px 80px #14243c30; }
#credits-dialog { width: min(420px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 32px; border: 1px solid #dbe3ee; border-radius: 16px; color: var(--ink); text-align: center; box-shadow: 0 24px 80px #14243c30; }
#credits-dialog::backdrop { background: #15223866; }
#credits-dialog h2 { margin: 12px 0; font-size: 23px; }
#credits-message { font-size: 15px; line-height: 1.8; }
#credits-dialog .credits-close { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 24px; }
#credits-dialog .primary-button { width: 100%; justify-content: center; margin-top: 16px; }
#credits-dialog :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#auth-dialog::backdrop { background: #15223866; }
#auth-dialog h2 { margin: 0 0 8px; font-size: 24px; }
#auth-dialog .field-hint { margin-bottom: 24px; }
#auth-form { display: grid; gap: 12px; }
#auth-form label { font-size: 14px; font-weight: 600; }
#auth-form input { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #c4cedd; border-radius: 8px; font: inherit; }
#auth-form .primary-button { width: 100%; margin-top: 8px; justify-content: center; border-radius: 8px; }
#auth-dialog .auth-close { position: absolute; top: 8px; right: 8px; width: 44px; height: 44px; font-size: 24px; text-decoration: none; display: grid; place-items: center; padding: 0; }
#auth-dialog :focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; }
.auth-code-row { display: flex; gap: 8px; min-width: 0; }
#auth-code { min-width: 0; flex: 1; }
#auth-send { white-space: nowrap; padding: 8px 12px; font-size: 13px; border-radius: 8px; }
#auth-send:disabled { color: #64748b; background: #f1f5f9; border-color: #dbe3ee; cursor: not-allowed; }
#auth-dialog #auth-status, #auth-dialog .auth-note { margin: 0; font-size: 12px; }
#auth-dialog #auth-status:empty { display: none; }
#auth-dialog .auth-note { text-align: center; }
#auth-dialog .auth-note a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

#auth-submit:disabled { background: #e2e8f0; border-color: #e2e8f0; color: #64748b; cursor: not-allowed; opacity: 1; }

#auth-identity { min-width: 0; margin: 0; padding: 0; border: 0; }
#auth-identity[hidden] { display: none; }
#auth-identity legend { margin-bottom: 10px; font-size: 14px; font-weight: 600; }
.auth-identity-options { display: flex; gap: 12px; }
#auth-identity label { display: flex; flex: 1; align-items: center; gap: 8px; min-height: 44px; margin: 0; padding: 10px 12px; border: 1px solid #c4cedd; border-radius: 8px; cursor: pointer; font-weight: 400; }
#auth-identity label:has(:checked) { border-color: var(--accent); background: #eaf2ff; color: var(--accent); }
#auth-identity input { width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; accent-color: var(--accent); }
#auth-identity input:focus { outline: none; }
#auth-identity label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }

.account-controls { position: relative; }
#logout-confirm { position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 10; width: 240px; max-width: calc(100vw - 36px); padding: 16px; border: 1px solid #e2e8f0; border-radius: 12px; background: #fff; box-shadow: 0 8px 28px #14243c1f; }
#logout-confirm[hidden] { display: none; }
#logout-title { margin: 0 0 14px; color: #34465e; font-size: 14px; font-weight: 500; }
.logout-actions { display: flex; justify-content: flex-end; gap: 8px; }
.logout-actions button { min-height: 36px; padding: 8px 14px; border: 1px solid #dbe3ee; border-radius: 6px; background: #fff; color: #56687e; font-size: 12px; cursor: pointer; }
.logout-actions button:hover { background: #f5f7fb; }
#logout-submit { border-color: var(--accent); background: var(--accent); color: #fff; }
#logout-submit:hover { background: var(--accent-hover); }
#logout-submit:disabled { opacity: .6; cursor: wait; }
#logout-confirm button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 管理员首页用户管理，窄屏保留横向滚动，避免压缩操作控件。 */
#admin-nav[hidden], #user-management[hidden] { display: none; }
#user-management { align-self: start; margin: 0 auto; }
.users-panel { padding: 24px; }
.users-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.users-toolbar .field-hint { margin: 0; }
.users-toolbar button { flex-shrink: 0; }
#users-status { color: #56708f; min-height: 24px; }
.users-table-scroll { overflow-x: auto; }
.users-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 14px; }
.users-table th { background: #f4f7fc; color: #56708f; font-weight: 600; }
.users-table th, .users-table td { padding: 16px 12px; border-bottom: 1px solid #e5ebf3; white-space: nowrap; }
.users-operations { display: flex; flex-wrap: nowrap; gap: 6px; }
#user-action-dialog { width: min(420px, calc(100% - 32px)); max-height: calc(100dvh - 32px); box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain; padding: 28px; border: 1px solid #dbe3ee; border-radius: 16px; color: var(--ink); box-shadow: 0 24px 80px #14243c30; }
#user-action-dialog::backdrop { background: #15223866; }
#user-action-dialog h2 { margin: 0 0 12px; font-size: 24px; }
#user-action-form label { display: block; margin: 20px 0 8px; }
#user-action-form input, #user-action-form select { width: 100%; min-height: 44px; padding: 10px; border: 1px solid #d5deeb; border-radius: 8px; background: white; color: var(--ink); }
.user-action-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; }
#user-action-dialog :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (max-width: 640px) { .users-panel { padding: 16px; } .users-toolbar { align-items: flex-start; } }

/* 用户管理：搜索工具栏与清晰的操作层级。 */
.users-panel { padding: 28px; border: 1px solid #edf1f7; border-radius: 18px; box-shadow: 0 4px 20px #21395703; }
.users-toolbar { gap: 16px; }
.users-search { display: flex; align-items: center; gap: 10px; margin: 0; flex: 1; }
.users-search-field { position: relative; width: min(360px, 100%); }
.users-search-field svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: none; stroke: #8291a8; stroke-width: 1.8; pointer-events: none; }
.users-search-field input { width: 100%; height: 42px; padding: 10px 14px 10px 42px; border: 1px solid #e2e8f1; border-radius: 10px; background: #f8fafd; color: #20334d; font-size: 14px; transition: border-color .15s; }
.users-search-field input::placeholder { color: #8a98ab; }
.users-search-field input:focus { outline: none; border-color: var(--accent); box-shadow: none; background: white; }
#user-management .users-button, #user-action-dialog button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 9px 16px; border: 1px solid transparent; border-radius: 9px; font: inherit; font-size: 13px; font-weight: 600; line-height: 20px; white-space: nowrap; cursor: pointer; box-shadow: none; transition: background .15s, color .15s; }
#user-management .users-button[hidden] { display: none; }
#user-management .users-button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#user-management .users-button-primary, #user-action-dialog .primary-button { color: white; background: #2165df; }
#user-management .users-button-primary:hover, #user-action-dialog .primary-button:hover { background: #1955c2; }
#user-management .users-button-soft { color: #2464cc; background: #edf4ff; }
#user-management .users-button-soft:hover { background: #dfebff; }
#user-management .users-button-quiet, #user-action-dialog .secondary-button { color: #576b85; background: #f3f6fa; }
#user-management .users-button-quiet:hover, #user-action-dialog .secondary-button:hover { background: #e8edf5; color: #213b5c; }
#user-management button:focus-visible { outline: 2px solid #2563eb; outline-offset: 3px; }
#user-management button:disabled, #user-action-dialog button:disabled { opacity: .5; cursor: wait; }
#users-status { margin: 20px 0 14px; font-size: 13px; color: #7b8ba1; }
.users-table th { background: #f8fafd; color: #72839b; font-size: 12px; letter-spacing: .02em; }
.users-table th:first-child { border-radius: 9px 0 0 9px; }
.users-table th:last-child { border-radius: 0 9px 9px 0; }
.users-table td { padding-top: 20px; padding-bottom: 20px; color: #344760; font-variant-numeric: tabular-nums; }
.users-table tbody tr:last-child td { border-bottom: none; }
.users-table tbody tr:hover { background: #fbfcff; }
.users-table td:nth-child(4) { color: #203858; font-weight: 600; }
.users-role { display: inline-block; padding: 4px 10px; border-radius: 6px; background: #f2f5f8; color: #738297; font-size: 12px; }
.users-role.is-admin { background: #edf3ff; color: #4e74b6; }
.users-table th:last-child, .users-table td:last-child:not([colspan]) { width: 1%; white-space: nowrap; }
#user-management .users-operations .users-button { min-height: 30px; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 500; line-height: 20px; }
.users-table .users-empty { padding: 52px 16px; text-align: center; color: #8a98ab; font-weight: 400; }
#user-action-account { background: #f6f8fc; padding: 12px 14px; border-radius: 9px; line-height: 1.8; }
@media (max-width: 640px) {
  .users-panel { padding: 16px; }
  .users-toolbar { flex-wrap: wrap; }
  .users-search { width: 100%; flex-basis: 100%; flex-wrap: wrap; }
  .users-search-field { flex: 1; min-width: 180px; }
}
@media (prefers-reduced-motion: reduce) { .users-search-field input, #user-management .users-button, #user-action-dialog button { transition: none; } }

.user-role-select { position: relative; }
#user-action-dialog #user-role-trigger { width: 100%; min-height: 44px; justify-content: space-between; padding: 10px 12px; border: 1px solid #d5deeb; border-radius: 8px; background: white; color: var(--ink); font-size: 14px; font-weight: 400; }
#user-role-trigger svg { width: 18px; height: 18px; fill: none; stroke: #7b8ba1; stroke-width: 1.8; }
#user-role-options { position: relative; max-height: min(180px, 40dvh); overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; margin: 6px 0 0; padding: 5px; list-style: none; background: white; border: 1px solid #e2e8f1; border-radius: 9px; box-shadow: 0 8px 24px #21395718; }
#user-role-options[hidden] { display: none; }
#user-role-options [role="option"] { padding: 9px 12px; border-radius: 5px; color: #344760; font-size: 14px; cursor: pointer; }
#user-role-options [role="option"]:hover, #user-role-options .is-active { background: #f3f6fa; }
#user-role-options [aria-selected="true"] { color: #2165df; }
#user-role-options [aria-selected="true"]::after { content: '✓'; float: right; }

#user-action-form .credit-operation { padding: 0; margin: 20px 0 0; border: 0; }
.credit-operation legend { margin-bottom: 10px; font-size: 14px; font-weight: 500; }
.credit-operation-options { display: flex; gap: 10px; }
#user-action-form .credit-operation label { position: relative; flex: 1; margin: 0; cursor: pointer; }
#user-action-form .credit-operation input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; padding: 0; }
.credit-operation span { display: block; padding: 11px 10px; border: 1px solid #e2e8f1; border-radius: 8px; text-align: center; font-size: 14px; color: #64758c; background: #f8fafd; }
.credit-operation input:checked + span { color: #2165df; border-color: #8bb1ef; background: #edf4ff; }
.credit-operation input:focus-visible + span { outline: 2px solid #2563eb; outline-offset: 3px; }
.credit-operation:disabled { opacity: .6; }

/* 使用提供的原图素材，二维码保留完整图案与留白。 */
/* 保留原图方格排列；496px 区域按 1/2 比例显示，高分屏对应原始像素。 */
.credits-qr { position: relative; overflow: hidden; width: min(248px, calc(100% - 24px)); aspect-ratio: 1; margin: 20px auto; background: white; border: 12px solid white; box-sizing: content-box; }
.credits-qr img { position: absolute; display: block; width: 235.8871%; max-width: none; height: auto; left: -68.1452%; top: -150%; image-rendering: crisp-edges; image-rendering: pixelated; }
.brand { align-items: center; }
.brand .brand-logo, body:has(#input-view:not([hidden])) .brand-logo { width: 54px; height: 54px; border-radius: 10px; }
/* 用原文字轮廓作为遮罩，保留字形并统一为与鲸鱼协调的纯海蓝色。 */
.product-wordmark { position: relative; display: block; flex-shrink: 0; width: 112px; aspect-ratio: 477 / 169; overflow: hidden; }
.product-wordmark img { display: none; }
.product-wordmark::before { content: ""; position: absolute; width: 170.8595%; aspect-ratio: 815 / 217; left: -70.8595%; top: -28.4024%; background-color: #0068d9; -webkit-mask: url('../assets/tuohaijing-logo.png') center / contain no-repeat; mask: url('../assets/tuohaijing-logo.png') center / contain no-repeat; }
.sidebar-brand { display: flex; align-items: center; gap: 8px; padding: 0; }
.sidebar-brand img { width: 52px; height: 52px; flex-shrink: 0; border-radius: 10px; }
.sidebar-brand .product-wordmark { width: 100px; }

.research-card .field-validation { margin: 7px 0 0; font-size: 12px; line-height: 1.5; color: #be4e4e; }
.research-card .field-validation[hidden] { display: none; }
.research-card input[aria-invalid="true"], .research-card .market-select-trigger[aria-invalid="true"] { border-color: #d79595; background: #fffafa; }
.research-card input[aria-invalid="true"]:focus-visible, .research-card .market-select-trigger[aria-invalid="true"]:focus-visible { outline: none; border-color: #ce7777; box-shadow: none; }
#user-management .users-button-records { color: #2165df; background: #fff; border-color: #bfd2f5; }
#user-management .users-button-records:hover { background: #edf4ff; border-color: #2165df; }
#user-research-dialog { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(480px, 100%); max-width: 100%; height: 100dvh; max-height: 100dvh; padding: 0; border: 0; border-left: 1px solid #e5ebf5; border-radius: 16px 0 0 16px; background: #fff; color: #203858; box-shadow: -12px 0 40px #142a4614; }
#user-research-dialog[open] { display: flex; flex-direction: column; }
#user-research-dialog::backdrop { background: rgb(20 38 65 / 24%); }
.research-drawer-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 18px 24px 14px; border-bottom: 1px solid #e5ebf5; }
#user-research-dialog h2 { margin: 0; font-size: 18px; }
#user-research-account { margin: 6px 0 0; color: #65768e; font-size: 12px; }
#user-research-dialog button, #user-research-dialog a { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; padding: 3px 8px; border: 0; border-radius: 7px; background: #edf3ff; color: #2165df; font: inherit; font-size: 12px; text-decoration: none; cursor: pointer; box-shadow: none; }
#user-research-dialog button:hover, #user-research-dialog a:hover { background: #dfeaff; }
#user-research-dialog button:disabled { opacity: .45; cursor: default; }
#user-research-dialog button[hidden] { display: none; }
#user-research-dialog #user-research-close { background: transparent; font-size: 26px; min-width: 40px; }
.research-drawer-body { overflow-y: auto; padding: 4px 24px; flex: 1; min-height: 0; }
#user-research-status { color: #65768e; font-size: 12px; margin: 0 0 16px; }
#user-research-status:empty { display: none; }
.research-record { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 7px 0; }
#user-research-dialog h3 { font-size: 12px; font-weight: 500; line-height: 1.5; margin: 0; overflow-wrap: anywhere; }
.research-record-market { color: #65768e; font-size: 12px; }
.research-record a { white-space: nowrap; }
.research-drawer-footer { display: flex; justify-content: space-between; align-items: center; padding: 10px 24px; border-top: 1px solid #e5ebf5; font-size: 12px; color: #65768e; }
@media (max-width: 520px) { #user-research-dialog { border-radius: 0; } #user-research-dialog button, #user-research-dialog a, #user-management .users-operations .users-button { min-height: 44px; } }

#auth-company-field { display: grid; gap: 8px; }
#auth-company-field[hidden] { display: none; }
#auth-company-field .auth-company-required { color: var(--muted); font-size: 12px; font-weight: 400; }

.users-company-name { display: block; margin-top: 6px; max-width: 220px; overflow-wrap: anywhere; font-size: 12px; line-height: 1.5; color: var(--muted); }

/* 分析按钮下同步展示可用次数。 */
#analysis-credits-hint { flex: 0 0 100%; box-sizing: border-box; margin: -4px 0 0; padding: 0; color: #758399; font-size: 12px; font-weight: 400; line-height: 1.5; text-align: center; font-variant-numeric: tabular-nums; }
#analysis-credits-hint[hidden] { display: none; }
@media (min-width: 681px) {
  .research-card .form-bottom { display: grid; grid-template-columns: max-content; justify-content: start; gap: 12px; }
}
