/* 观潮 · 接口模式工作台：榜单、报告、文案（依赖 styles.css 中的设计变量） */

.api-mode .main { max-width: 1800px; margin: auto; }
.api-mode .main, .api-mode .panel, .ws-writing-layout > *, .ws-custom-layout > * { min-width: 0; }
.api-mode .page-heading { align-items: flex-start; }
.api-mode .heading-actions { flex-wrap: wrap; justify-content: flex-end; }
.api-mode .topbar { justify-content: space-between; }
.api-mode .table-panel + .table-panel { margin-top: 20px; }
.api-mode .search-field { max-width: 100%; }

.api-startup-error { max-width: 560px; margin: 16vh auto; padding: 36px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: var(--shadow-md); }
.api-startup-error h1 { font-size: 24px; }
.api-startup-error p { margin: 12px 0 22px; font-size: 14px; line-height: 1.8; color: var(--ink-500); }
.api-startup-error .btn { margin-top: 4px; }

/* ---------- Sidebar + top bar ---------- */
.ws-sidebar { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.ws-sidebar .brand, .ws-sidebar .workspace { flex-shrink: 0; }
.ws-sidebar .nav-item .platform-symbol { width: 20px; height: 20px; border-radius: 5px; background: transparent; }
.ws-sidebar .nav-item .platform-symbol svg { width: 18px; height: 18px; }
.ws-sidebar-note { padding: 2px 12px 8px; font-size: 12px; line-height: 1.6; color: var(--ink-500); }
.ws-sidebar-note p { margin-top: 3px; font-size: 11px; color: var(--ink-400); }
.ws-status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: #12b76a; box-shadow: 0 0 0 3px rgba(18, 183, 106, .16); }
.ws-top-location { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--ink-400); }
.ws-top-location strong { overflow: hidden; color: var(--ink-800); font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.ws-page-kicker { display: flex; justify-content: space-between; gap: 12px; margin: 0 0 12px; font-size: 11px; font-weight: 500; letter-spacing: 1.6px; color: var(--ink-400); }
.ws-page-kicker > span:last-child { display: inline-flex; align-items: center; font-size: 12px; font-weight: 400; letter-spacing: 0; color: var(--ink-500); }
.ws-entitlement { margin: 0 0 18px; box-shadow: var(--shadow-sm); }
.ws-entitlement .text-link { flex: none; margin-left: auto; white-space: nowrap; }
.ws-eyebrow { display: block; margin-bottom: 8px; color: var(--accent-600); font-size: 11px; font-weight: 700; letter-spacing: 1.5px; }

/* ---------- Ranking data ---------- */
.api-data-notice { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; padding: 12px 16px; border: 1px solid #cdeadc; border-radius: 12px; background: #f1faf5; color: #0b5c43; }
.api-data-notice > svg { margin-top: 2px; }
.api-data-notice.fixture { border-color: #f5e2bf; background: #fffaf0; color: #7a5310; }
.api-data-notice strong { font-size: 13px; font-weight: 600; }
.api-data-notice p { margin-top: 2px; font-size: 12.5px; line-height: 1.7; opacity: .92; }
.api-data-notice p:only-child { margin: 0; }
.api-data-notice > span { margin-left: auto; font-size: 12px; line-height: 1.6; text-align: right; white-space: nowrap; opacity: .85; }

.api-kpis .kpi-card { min-height: 128px; }
.api-kpis .kpi-card p { margin-top: 10px; font-size: 12px; color: var(--ink-400); }
.api-count { font-size: 12px; color: var(--ink-400); }

.api-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 14px; }
.api-filters label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 500; color: var(--ink-600); }
.api-filters select {
  appearance: none;
  -webkit-appearance: none;
  max-width: 220px;
  min-height: 34px;
  padding: 0 32px 0 11px;
  border: 1px solid #d5d9e1;
  border-radius: var(--radius-sm);
  background-color: #fff;
  background-image: linear-gradient(45deg, transparent 50%, #8a94a6 50%), linear-gradient(135deg, #8a94a6 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px;
  background-repeat: no-repeat;
  color: var(--ink-800);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.api-filters select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.api-filters > span { font-size: 12px; color: var(--ink-400); }

.api-ranking-tabs, .ws-report-tabs { display: flex; gap: 4px; width: max-content; max-width: 100%; padding: 4px; border-radius: 12px; background: #e9ecf1; }
.api-ranking-tabs { margin: 0 0 14px; }
.api-ranking-tabs button, .ws-report-tabs button { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 16px; border-radius: 9px; color: var(--ink-500); font-size: 13px; font-weight: 500; transition: background .15s, color .15s; }
.api-ranking-tabs button:hover, .ws-report-tabs button:hover { color: var(--ink-900); }
.api-ranking-tabs button.active, .ws-report-tabs button.active { background: #fff; color: var(--ink-900); font-weight: 600; box-shadow: 0 1px 3px rgba(16, 24, 40, .1), 0 1px 2px rgba(16, 24, 40, .06); }
.api-ranking-tabs button span, .ws-report-tabs button span { min-width: 20px; padding: 0 6px; border-radius: 999px; background: rgba(16, 24, 40, .07); color: var(--ink-500); font-size: 11.5px; font-weight: 500; line-height: 18px; text-align: center; }
.api-ranking-tabs button.active span, .ws-report-tabs button.active span { background: var(--accent-soft); color: var(--accent-600); }

.api-table { width: 100%; min-width: 760px; }
.api-table th { white-space: nowrap; }
.api-table small { display: block; font-size: 12px; line-height: 1.6; color: var(--ink-400); }
/* Metric timestamps wrap under the value so the action column stays in view. */
.api-table td { padding-right: 12px; padding-left: 12px; }
.api-table th:first-child, .api-table td:first-child { padding-left: 20px; }
.api-table th:last-child, .api-table td:last-child { padding-right: 20px; }
.api-table td:not(.api-content-title) > small { max-width: 124px; font-size: 11.5px; white-space: normal; }
.api-table .text-link { white-space: nowrap; }
.api-table + .empty, .table-scroll + .empty { border-top: 1px solid var(--line-soft); }
.api-creator { display: flex; align-items: center; gap: 11px; max-width: 280px; text-align: left; }
.api-creator strong { display: block; color: var(--ink-900); font-size: 13.5px; font-weight: 600; transition: color .15s; }
.api-creator:hover strong { color: var(--accent-600); }
.api-creator small { display: block; max-width: 215px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.api-avatar { flex-shrink: 0; overflow: hidden; background: linear-gradient(145deg, #e3f5ec, #cdebdd); color: #0b6e50; }
.api-avatar img { width: 100%; height: 100%; object-fit: cover; }
.api-category { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--blue-soft); color: var(--blue); font-size: 12px; font-weight: 500; }
.api-keywords { display: flex; flex-wrap: wrap; gap: 4px; max-width: 200px; margin-top: 5px; }
.api-keyword { padding: 1px 7px; border-radius: 6px; background: #eff1f5; color: var(--ink-600); font-size: 11.5px; overflow-wrap: anywhere; }
.api-source { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.api-source.fixture { background: var(--amber-soft); color: var(--amber); }
.api-time { margin-top: 3px; }
.api-row-actions { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.api-content-title { min-width: 220px; max-width: 350px; }
.api-content-title > button { display: -webkit-box; overflow: hidden; color: var(--ink-900); font-size: 13.5px; font-weight: 500; line-height: 1.6; text-align: left; white-space: normal; -webkit-line-clamp: 2; -webkit-box-orient: vertical; transition: color .15s; }
.api-content-title > button:hover { color: var(--accent-600); }
.api-content-title small { margin-top: 3px; }
.api-content-title small .text-link { color: var(--ink-500); font-size: 12px; font-weight: 400; }
.ws-rank { display: inline-grid; place-items: center; min-width: 28px; height: 24px; margin-right: 10px; padding: 0 6px; border-radius: 7px; background: #f0f2f5; color: var(--ink-500); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; vertical-align: middle; }
.ws-rank.top { background: linear-gradient(145deg, #ffa76f, #ee5a25); color: #fff; box-shadow: 0 3px 8px rgba(240, 98, 45, .28); }

.api-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--ink-500); }
.api-pagination > div { display: flex; gap: 8px; }
.api-page-actions { flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.api-page-jump { display: flex; align-items: center; gap: 7px; margin: 0 0 0 4px; }
.api-page-jump label { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.api-page-jump input { width: 60px; min-height: 30px; padding: 0 8px; border: 1px solid #d5d9e1; border-radius: 8px; background: #fff; color: var(--ink-800); font-size: 12.5px; text-align: center; }
.api-page-jump input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

.api-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 56px 24px; }
.api-empty > svg { margin-bottom: 8px; }
.api-empty h3 { font-size: 16px; font-weight: 650; color: var(--ink-800); }
.api-empty p { max-width: 480px; font-size: 13.5px; line-height: 1.8; }
.api-empty .btn { margin-top: 12px; }

/* ---------- Detail sheets ---------- */
.api-detail-title { font-size: 18px; font-weight: 700; line-height: 1.6; }
.api-detail-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 14px 0; font-size: 12.5px; color: var(--ink-500); }
.api-detail-meta .api-keywords { max-width: none; margin: 0; }
.detail-note + .api-source { margin-top: 10px; }
.api-identifiers { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 16px; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 12.5px; }
.api-identifiers dt { color: var(--ink-500); }
.api-identifiers dd { margin: 0; color: var(--ink-800); font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; word-break: break-word; }
.api-source-statistics { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.creator-frame-modal { display: flex; flex-direction: column; width: min(1000px, calc(100vw - 40px)); max-width: 1000px; max-height: 90vh; overflow: hidden; }
.creator-frame-modal .modal-body { flex: 1; min-height: 0; padding: 0; overflow: hidden; }
.creator-detail-frame { display: block; width: 100%; height: min(720px, 76vh); border: 0; background: #fff; }

/* ---------- Workspace building blocks ---------- */
.ws-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.ws-panel-heading h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.ws-panel-heading p { margin-top: 4px; font-size: 12.5px; line-height: 1.6; color: var(--ink-500); }
.ws-panel-heading > span { padding: 1px 9px; border-radius: 999px; background: #eef0f4; color: var(--ink-600); font-size: 11.5px; font-weight: 500; white-space: nowrap; }
.ws-panel-heading .ws-eyebrow { margin-bottom: 4px; }
.ws-panel-foot { padding: 13px 20px; border-top: 1px solid var(--line-soft); font-size: 12px; line-height: 1.7; color: var(--ink-400); }
.ws-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ws-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ws-full { width: 100%; justify-content: center; min-height: 42px; font-size: 14px; }
.ws-hint { margin-top: 10px; font-size: 12px; line-height: 1.8; color: var(--ink-400); }
.ws-cost-warning { color: var(--accent-600) !important; }
.ws-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 190px; padding: 40px 22px; color: var(--ink-500); text-align: center; }
.ws-empty > svg { width: 52px; height: 52px; padding: 12px; border: 1px dashed var(--ink-300); border-radius: 16px; background: var(--surface-2); color: var(--ink-400); }
.ws-empty h3 { margin-top: 14px; font-size: 15px; font-weight: 650; color: var(--ink-800); }
.ws-empty p { max-width: 340px; margin-top: 6px; font-size: 13px; line-height: 1.8; }
.ws-empty .btn { margin-top: 16px; }
.ws-inline-note { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; padding: 11px 14px; border: 1px solid #d9e4f7; border-radius: 12px; background: #f4f8ff; color: #33507f; font-size: 13px; line-height: 1.7; }
.ws-inline-note > svg { color: var(--blue); }
.ws-inline-note .text-link { margin-left: auto; }

/* ---------- Reports ---------- */
.ws-report-navigation { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: 0 0 16px; }
.ws-report-tabs { flex-shrink: 0; }
.ws-report-section-note { font-size: 12.5px; color: var(--ink-400); }
.ws-history { padding: 4px 20px; }
.ws-history-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.ws-history-row:last-child { border: 0; }
.ws-file-icon { flex: none; display: grid; place-items: center; width: 40px; height: 46px; border: 1px solid var(--accent-line); border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.ws-history-open { flex: 1; min-width: 0; text-align: left; }
.ws-history-open strong { display: block; color: var(--ink-900); font-size: 14px; font-weight: 600; line-height: 1.6; overflow-wrap: anywhere; transition: color .15s; }
.ws-history-open:hover strong { color: var(--accent-600); }
.ws-history-open small { display: block; margin-top: 2px; font-size: 12px; line-height: 1.6; color: var(--ink-400); }
.ws-history-row .icon-btn { flex: none; color: var(--ink-400); }

.ws-weekly-panel { margin: 0 0 24px; }
.ws-weekly-filters { display: flex; align-items: center; gap: 16px; padding: 12px 20px; border-bottom: 1px solid var(--line-soft); background: var(--surface-2); }
.ws-weekly-filters label { display: flex; align-items: center; gap: 9px; font-size: 12.5px; font-weight: 500; color: var(--ink-600); white-space: nowrap; }
.ws-weekly-filters select { width: auto; min-width: 150px; min-height: 34px; margin: 0; font-size: 13px; }
.ws-weekly-filters > span { margin-left: auto; font-size: 12px; color: var(--ink-400); }
.ws-weekly-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 20px; }
.ws-weekly-grid > .ws-empty { grid-column: 1 / -1; }
.ws-weekly-card { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; text-align: left; transition: box-shadow .18s, border-color .18s, transform .18s; }
.ws-weekly-card:hover { border-color: #f6b99b; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.ws-weekly-card > svg { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.ws-weekly-industry { padding: 2px 9px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-600); font-size: 12px; font-weight: 500; }
.ws-weekly-card strong { margin-top: 4px; padding-right: 40px; color: var(--ink-900); font-size: 15.5px; font-weight: 650; line-height: 1.55; overflow-wrap: anywhere; }
.ws-weekly-card small { font-size: 12.5px; color: var(--ink-400); }
.ws-weekly-card p { margin: 0; font-size: 12.5px; color: var(--ink-500); }
.ws-weekly-card .text-link { display: flex; align-items: center; gap: 5px; margin-top: 6px; }

.ws-report-editor-intro { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.ws-report-editor-intro h2 { margin: 6px 0 8px; font-size: 24px; font-weight: 700; letter-spacing: -.2px; }
.ws-report-editor-intro p { font-size: 13.5px; line-height: 1.7; color: var(--ink-500); }
.workspace-frame-body #ws-report-form, .workspace-frame-body .ws-report-editor-intro { max-width: 920px; margin-right: auto; margin-left: auto; }
.workspace-frame-body #ws-report-form > .form-label { display: block; margin-bottom: 0; }
.workspace-frame-body #ws-report-form > .ws-field-grid { margin-bottom: 0; }
.workspace-frame-body .ws-reference-summary { margin: 4px 0 18px; }
.workspace-frame-body .ws-report-includes { margin: 18px 0; }
.ws-report-includes { display: flex; flex-direction: column; gap: 4px; margin-bottom: 18px; padding: 14px 16px; border: 1px solid var(--accent-line); border-radius: 12px; background: var(--accent-soft); color: var(--ink-900); font-size: 13.5px; }
.ws-report-includes span { font-size: 12.5px; line-height: 1.7; color: #8a4a2b; }
.ws-back-to-report { margin-top: 10px; }

.ws-reference-summary { margin-top: 4px; padding: 16px 0; border-top: 1px solid var(--line-soft); }
.ws-reference-summary > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ws-reference-summary strong { color: var(--ink-900); font-size: 13.5px; }
.ws-reference-summary strong span { margin-left: 7px; color: var(--ink-400); font-size: 12px; font-weight: 400; }
.ws-reference-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.ws-reference-chips > span { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 4px 6px 4px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink-700); font-size: 12.5px; overflow-wrap: anywhere; }
.ws-reference-chips button { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; color: var(--ink-400); font-size: 15px; line-height: 1; }
.ws-reference-chips button:hover { background: var(--red-soft); color: var(--red); }
.ws-reference-list { max-height: 390px; margin: 12px 0 20px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.ws-reference-choice { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background .12s; }
.ws-reference-choice:last-child { border-bottom: 0; }
.ws-reference-choice:hover { background: var(--surface-2); }
.ws-reference-choice:has(input:checked) { background: var(--accent-soft); }
.ws-reference-choice input { flex-shrink: 0; }
.ws-reference-kind { flex-shrink: 0; width: 64px; padding: 2px 4px; border-radius: 6px; background: #eff1f5; color: var(--ink-600); font-size: 12px; text-align: center; }
.ws-reference-choice > span:last-child { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ws-reference-choice strong { color: var(--ink-900); font-size: 13.5px; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
.ws-reference-choice small { font-size: 12px; color: var(--ink-400); }
.ws-cost-confirm h3 { margin: 4px 0 4px; font-size: 20px; font-weight: 700; line-height: 1.5; }
.ws-cost-confirm .ws-full { margin-top: 16px; }
.ws-cost-confirm .ws-back-to-report { margin-top: 10px; }
.ws-recovered-copy { min-height: 380px; margin-top: 14px; white-space: pre-wrap; }
.ws-edit-confirm p { font-size: 14px; line-height: 1.8; color: var(--ink-700); }
.ws-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.ws-report-document { padding: 4px 6px; }
.ws-report-document > h2 { font-size: 24px; font-weight: 700; line-height: 1.5; letter-spacing: -.2px; overflow-wrap: anywhere; }
.ws-report-byline { margin-top: 6px; font-size: 12.5px; line-height: 1.7; color: var(--ink-400); }
.ws-report-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 20px 0; }
.ws-report-summary > div { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.ws-report-summary small { display: block; font-size: 12px; color: var(--ink-500); }
.ws-report-summary strong { display: block; margin-top: 8px; color: var(--ink-900); font-size: 23px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ws-report-document section { margin-top: 26px; }
.ws-report-document h3 { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; font-size: 15.5px; font-weight: 650; }
.ws-report-document h3::before { content: ""; flex: none; width: 3px; height: 15px; border-radius: 2px; background: var(--accent); }
.ws-report-document p { margin: 8px 0; font-size: 13.5px; line-height: 1.9; color: var(--ink-600); }
.ws-report-document .table-scroll { border: 1px solid var(--line); border-radius: 12px; }
.ws-report-document .api-table { min-width: 520px; }
.ws-report-content { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.ws-report-content strong { color: var(--ink-900); font-size: 13.5px; font-weight: 600; line-height: 1.7; }
.ws-report-content p { margin: 2px 0 0; font-size: 12.5px; }
.ws-report-method { padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.ws-report-method p { font-size: 12.5px; }
.ws-report-analysis { padding: 14px 16px; border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; background: var(--accent-soft); color: var(--ink-800) !important; white-space: pre-line; overflow-wrap: anywhere; }
.ws-report-buttons { justify-content: flex-end; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---------- Custom rankings ---------- */
.ws-custom-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); align-items: start; gap: 18px; margin-bottom: 24px; }
.ws-ranking-detail { overflow: hidden; }
.ws-ranking-detail .api-ranking-tabs { margin: 14px 20px; }
.ws-ranking-detail > .ws-inline-note { margin: 14px 20px 0; }
.ws-ranking-detail > .ws-hint { margin: 0 20px 12px; }
.ws-ranking-list { padding: 8px; }
.ws-list-choice { display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 12px; border: 1px solid transparent; border-radius: 11px; text-align: left; transition: background .15s, border-color .15s; }
.ws-list-choice:hover { background: #f3f4f7; }
.ws-list-choice.active { border-color: var(--accent-line); background: var(--accent-soft); }
.ws-list-choice > span:not(.platform-symbol) { flex: 1; min-width: 0; }
.ws-list-choice .platform-symbol { width: 34px; height: 34px; border-radius: 10px; }
.ws-list-choice strong { display: block; color: var(--ink-900); font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.ws-list-choice small { display: block; margin-top: 2px; font-size: 12px; color: var(--ink-400); }
.ws-list-choice > svg { color: var(--ink-300); }
.ws-list-choice.active > svg { color: var(--accent); }
.ws-add-list { display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; min-height: 42px; margin-top: 8px; border: 1px dashed var(--ink-300); border-radius: 11px; color: var(--ink-500); font-size: 13px; transition: border-color .15s, color .15s, background .15s; }
.ws-add-list:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-600); }
.ws-candidate-count { margin-bottom: 8px; font-size: 12.5px; color: var(--ink-500); }
.ws-candidates { max-height: 290px; margin-bottom: 16px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.ws-candidate { display: flex; align-items: center; gap: 11px; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background .12s; }
.ws-candidate:last-child { border-bottom: 0; }
.ws-candidate:hover { background: var(--surface-2); }
.ws-candidate:has(input:checked) { background: var(--accent-soft); }
.ws-candidate > span:not(.avatar) { flex: 1; min-width: 0; }
.ws-candidate strong { display: block; color: var(--ink-900); font-size: 13.5px; font-weight: 600; }
.ws-candidate small { display: block; max-width: 300px; margin-top: 2px; overflow: hidden; color: var(--ink-400); font-size: 12px; text-overflow: ellipsis; }
.ws-candidate b { color: var(--ink-800); font-size: 13.5px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.ws-candidate b small { margin-top: 0; font-weight: 400; }

/* ---------- Writing ---------- */
.ws-writing-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); align-items: start; gap: 18px; margin-bottom: 24px; }
.ws-template-panel { padding-bottom: 14px; }
.ws-template { display: flex; align-items: center; gap: 12px; width: calc(100% - 20px); margin: 8px 10px 0; padding: 11px 12px; border: 1px solid transparent; border-radius: 11px; text-align: left; transition: background .15s, border-color .15s; }
.ws-template:hover { background: #f3f4f7; }
.ws-template.active { border-color: var(--accent-line); background: var(--accent-soft); }
.ws-template-icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink-500); }
.ws-template.active .ws-template-icon { border-color: transparent; background: var(--accent-gradient); color: #fff; }
.ws-template strong { display: block; color: var(--ink-900); font-size: 13.5px; font-weight: 600; }
.ws-template small { display: block; margin-top: 2px; font-size: 12px; line-height: 1.6; color: var(--ink-400); }
.ws-template-panel .ws-hint { padding: 0 20px; }
.ws-draft-list { margin-top: 18px; overflow: hidden; }
.ws-draft-list > .ws-hint { margin-top: 0; padding: 14px 20px 16px; }
.ws-draft-item { display: flex; align-items: center; gap: 8px; padding: 12px 14px 12px 20px; border-bottom: 1px solid var(--line-soft); transition: background .12s; }
.ws-draft-item:last-child { border-bottom: 0; }
.ws-draft-item:hover { background: var(--surface-2); }
.ws-draft-item.active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.ws-draft-item > button:first-child { flex: 1; min-width: 0; text-align: left; }
.ws-draft-item strong { display: block; color: var(--ink-900); font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.ws-draft-item small { display: block; margin-top: 2px; font-size: 12px; line-height: 1.6; color: var(--ink-400); }
.ws-draft-item .icon-btn { width: 28px; height: 28px; color: var(--ink-400); }
.ws-editor-panel { overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.ws-editor-panel:focus-within { border-color: #f6c3aa; box-shadow: 0 0 0 4px rgba(240, 98, 45, .08), var(--shadow); }
.ws-editor-toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 18px 12px 22px; border-bottom: 1px solid var(--line-soft); background: var(--surface-2); }
.ws-editor-toolbar > span:first-child { display: flex; align-items: center; gap: 7px; color: var(--ink-800); font-size: 13px; font-weight: 600; }
.ws-editor-toolbar > span:first-child svg { color: var(--accent); }
.ws-save-status { margin-left: auto; font-size: 12px; color: var(--ink-400); }
.ws-editor-body { padding: 24px 28px 22px; }
.ws-brief { min-height: 110px; resize: vertical; }
.ws-copy-options { margin: 0 0 14px; border: 1px solid var(--line); border-radius: 10px; }
.ws-copy-options-toggle { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 8px 12px; text-align: left; }
.ws-copy-options-toggle > span { color: var(--ink-800); font-size: 13px; font-weight: 600; }
.ws-copy-options-toggle small { color: var(--ink-500); font-size: 12px; }
.ws-copy-options-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }
.ws-copy-options-fields { padding: 12px 12px 0; border-top: 1px solid var(--line-soft); }
.ws-copy-options-note { margin: 0 0 8px; color: var(--ink-500); font-size: 12px; }
.ws-copy-options-fields label { min-width: 0; }
.ws-copy-options-fields textarea { resize: vertical; }
.ws-ai-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 10px 9px 14px; border: 1px solid #f4dfd2; border-radius: 12px; background: linear-gradient(90deg, #fff6f0 0%, #f9f6ff 100%); color: var(--ink-600); font-size: 12.5px; }
.ws-ai-tools > span { display: flex; align-items: center; gap: 7px; }
.ws-ai-tools > span svg { color: var(--accent); }
.ws-ai-tools .text-link { margin-left: auto; }
.ws-ai-tools .btn { background: #fff; white-space: nowrap; }
.ws-copy-result { margin-top: 20px; padding: 18px 0 0; border-top: 1px solid var(--line-soft); color: var(--ink-800); overflow-wrap: anywhere; }
.ws-copy-result-header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.ws-copy-result-header h3 { margin: 0; font-size: 15px; }
.ws-copy-result-header small { color: var(--ink-500); font-size: 12px; }
.ws-manuscript { min-height: 280px; resize: vertical; font-size: 15px; line-height: 1.8; }
.ws-copy-actions { margin-top: 12px; }
.ws-ai-tools { flex-wrap: wrap; }

/* ---------- Points ---------- */
.points-strip { display: flex; align-items: center; gap: 20px; margin: 0 0 18px; padding: 18px 24px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); }
.points-strip > div { display: flex; align-items: center; gap: 13px; }
.points-strip > div > span { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--accent-gradient); color: #fff; box-shadow: 0 6px 14px rgba(240, 98, 45, .26); }
.points-strip small { display: block; font-size: 12px; color: var(--ink-500); }
.points-strip strong { color: var(--ink-900); font-size: 26px; font-weight: 800; line-height: 1.25; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.points-strip em { margin-left: 6px; color: var(--ink-500); font-size: 12.5px; font-style: normal; font-weight: 400; letter-spacing: 0; }
.points-strip > p { flex: 1; padding-left: 20px; border-left: 1px solid var(--line); font-size: 13px; line-height: 1.8; color: var(--ink-500); }
.points-strip > p b { color: var(--ink-900); }
.points-wallet { position: relative; overflow: hidden; margin-bottom: 18px; padding: 22px 24px; border-radius: 16px; color: #fff; background: radial-gradient(360px 200px at 100% 0%, rgba(240, 98, 45, .55), transparent 65%), linear-gradient(135deg, #131b2e 0%, #1c1a2b 100%); }
.points-wallet .ws-eyebrow { color: #ffb48f; }
.points-wallet h3 { margin: 6px 0 8px; color: #fff; font-size: 42px; font-weight: 800; line-height: 1.15; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.points-wallet h3 small { margin-left: 10px; color: #aeb9cd; font-size: 13px; font-weight: 400; letter-spacing: 0; }
.points-wallet p { font-size: 13px; color: #c5cede; }
.points-wallet + .modal-info { margin-bottom: 16px; }
.points-pack { display: flex; flex-direction: column; justify-content: center; gap: 4px; min-height: 40px; margin-bottom: 16px; padding: 10px 14px; border: 1px solid var(--accent-line); border-radius: 10px; background: var(--accent-soft); font-size: 13.5px; }
.points-pack strong { color: var(--ink-900); }
.points-pack span { color: #8a4a2b; font-size: 12.5px; }
.points-ledger { margin-top: 24px; }
.points-ledger h3 { margin-bottom: 10px; font-size: 15px; font-weight: 650; }
.points-ledger .api-table { min-width: 0; }
.points-ledger .table-scroll { max-height: 300px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.points-ledger .ws-hint { margin: 0; padding: 16px; text-align: center; }

/* ---------- Platform rankings stay compact so the list is visible above the fold ---------- */
.api-mode .ws-ranking-page { padding-top: 18px; }
.ws-ranking-page .ws-page-kicker { display: none; }
.ws-ranking-page .page-heading { align-items: center; margin-bottom: 12px; }
.ws-ranking-page .heading-title h1 { font-size: 23px; }
.ws-ranking-page .subtitle { margin-top: 3px; font-size: 13px; }
.ws-ranking-page .ws-entitlement { margin-bottom: 12px; padding: 7px 12px; }
.ws-ranking-page .ws-entitlement > svg { width: 26px; height: 26px; padding: 5px; }
.ws-ranking-page .api-kpis { gap: 12px; margin-bottom: 12px; }
.ws-ranking-page .api-kpis .kpi-card { min-height: 0; padding: 12px 60px 12px 16px; }
.ws-ranking-page .api-kpis .kpi-top { font-size: 12.5px; }
.ws-ranking-page .api-kpis .kpi-symbol { position: absolute; top: 50%; right: 14px; width: 36px; height: 36px; margin: -18px 0 0; }
.ws-ranking-page .api-kpis .kpi-value { margin: 2px 0 0; font-size: 24px; }
.ws-ranking-page .api-kpis .kpi-card p { margin-top: 2px; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.ws-ranking-page .api-data-notice { align-items: center; gap: 10px; margin-bottom: 12px; padding: 8px 14px; }
.ws-ranking-page .api-data-notice > svg { margin-top: 0; }
.ws-ranking-page .api-data-notice p { margin-top: 0; line-height: 1.55; }
.ws-ranking-page .api-filters { gap: 8px 12px; margin-bottom: 12px; }
.ws-ranking-page .api-ranking-tabs { margin-bottom: 12px; }
.ws-ranking-page .api-ranking-tabs button { min-height: 32px; }
.ws-ranking-page .panel-head { padding: 14px 18px 0; }
.ws-ranking-page .table-toolbar { padding: 10px 18px 12px; }

/* ---------- Responsive ---------- */
@media (min-width: 1600px) {
  .ws-writing-layout { grid-template-columns: 310px minmax(0, 1fr); }
  .ws-custom-layout { grid-template-columns: 300px minmax(0, 1fr); }
}
@media (max-width: 1150px) {
  .ws-custom-layout { grid-template-columns: 1fr; }
  .ws-ranking-list { display: flex; flex-wrap: wrap; gap: 8px; }
  .ws-list-choice { width: auto; min-width: 220px; }
  .ws-add-list { width: auto; min-width: 180px; margin-top: 0; padding: 0 16px; }
  .ws-writing-layout { grid-template-columns: 230px minmax(0, 1fr); }
  .ws-editor-body { padding: 22px; }
  .ws-editor-toolbar { flex-wrap: wrap; }
  .ws-template { gap: 8px; padding: 10px; }
  .ws-template-icon { display: none; }
  .ws-ranking-detail .ws-panel-heading { flex-wrap: wrap; }
}
@media (max-width: 1100px) {
  .api-mode .page-heading { flex-wrap: wrap; }
  .api-mode .heading-actions { justify-content: flex-start; }
  .ws-weekly-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ws-weekly-filters { flex-wrap: wrap; }
  .ws-weekly-filters > span { margin-left: 0; }
  .points-strip { flex-wrap: wrap; }
  .points-strip > p { min-width: 220px; }
  .ws-ranking-page .api-kpis .kpi-card { padding-right: 16px; }
  .ws-ranking-page .api-kpis .kpi-symbol { display: none; }
}
@media (max-width: 760px) {
  .api-mode .topbar { gap: 8px; padding: 0 12px; }
  .api-mode .member-top-link { display: none; }
  .api-mode .heading-actions { width: 100%; flex-direction: row; align-items: center; justify-content: flex-start; }
  .api-mode .heading-actions .date-select { flex: 1 1 130px; min-width: 0; max-width: 100%; }
  .api-mode .heading-actions > .btn { flex: none; white-space: nowrap; }
  .api-mode .toolbar-right { flex-wrap: wrap; }
  .table-toolbar .api-count { display: none; }
  .ws-top-location { flex: 1; }
  .ws-page-kicker { font-size: 10px; letter-spacing: .8px; }
  .api-data-notice { flex-wrap: wrap; gap: 9px; padding: 12px 14px; }
  .api-data-notice > div { flex: 1; min-width: 200px; }
  .api-data-notice > span { margin-left: 28px; text-align: left; }
  .api-table { min-width: 730px; }
  .api-startup-error { margin: 12vh 14px; padding: 24px; }
  .api-kpis .kpi-card { min-height: 0; }
  .api-empty { padding: 40px 16px; }
  .api-filters { gap: 9px; }
  .api-filters > span { width: 100%; }
  .api-filters select { max-width: 170px; }
  .ws-panel-heading { padding: 14px 16px; }
  .ws-history { padding: 2px 16px; }
  .ws-history-row { gap: 10px; }
  .ws-custom-layout, .ws-writing-layout { gap: 14px; }
  .ws-writing-layout { grid-template-columns: 1fr; }
  .ws-writing-layout > aside { display: contents; }
  .ws-template-panel { order: 0; }
  .ws-editor-panel { order: 1; }
  .ws-draft-list { order: 2; margin: 0; }
  .ws-template { display: inline-flex; width: calc(33.33% - 14px); min-height: 78px; margin: 8px 0 0 10px; vertical-align: top; }
  .ws-editor-toolbar { gap: 8px; padding: 12px 16px; }
  .ws-editor-body { padding: 18px; }
  .ws-field-grid { gap: 12px; }
  .ws-ai-tools { align-items: flex-start; flex-wrap: wrap; }
  .ws-ai-tools > span { align-items: flex-start; line-height: 1.7; }
  .ws-ai-tools > span svg { margin-top: 3px; }
  .ws-report-summary { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .ws-report-summary > div { padding: 13px; }
  .ws-report-document { padding: 0; }
  .ws-report-document > h2 { font-size: 20px; }
  .ws-candidate small { max-width: 160px; }
  .ws-list-choice { flex: 1; min-width: 180px; }
  .ws-sidebar .sidebar-bottom { position: relative; margin-top: 22px; }
  .ws-ranking-page .page-heading { gap: 8px; }
  .ws-ranking-page .api-kpis .kpi-card { padding: 10px 12px; }
  .ws-ranking-page .api-kpis .kpi-value { font-size: 21px; }
  .ws-ranking-page .api-data-notice { flex-wrap: wrap; }
  .ws-ranking-page .api-data-notice > div { flex: 1; min-width: 180px; }
  .ws-ranking-page .api-data-notice > span { margin-left: 28px; text-align: left; }
  .ws-ranking-page .api-data-notice > span br { display: none; }
}
@media (max-width: 680px) {
  .ws-report-navigation { flex-direction: column; align-items: flex-start; gap: 10px; }
  .ws-report-tabs { width: 100%; }
  .ws-report-tabs button { flex: 1; justify-content: center; padding: 0 10px; }
  .ws-report-editor-intro h2 { font-size: 21px; }
  .creator-frame-modal { width: calc(100vw - 16px); max-height: 94vh; }
  .creator-detail-frame { height: 80vh; }
  .ws-weekly-grid { grid-template-columns: 1fr; padding: 16px; }
  .ws-weekly-filters { padding: 14px 16px; }
  .ws-weekly-filters label { flex: 1; flex-direction: column; align-items: stretch; }
  .ws-weekly-filters select { min-width: 0; width: 100%; }
  .points-strip { padding: 16px; }
  .points-strip > p { min-width: 100%; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--line-soft); border-left: 0; }
  .points-strip > .btn { width: 100%; }
  .ws-reference-summary > div:first-child { flex-direction: column; align-items: flex-start; }
  .ws-points-top { display: none; }
  .ws-reference-choice { gap: 8px; padding: 11px 10px; }
  .api-page-actions { justify-content: flex-start; }
  .api-pagination > div { margin-left: 0; }
  .api-ranking-tabs button { padding: 0 14px; }
}
@media (max-width: 560px) {
  .api-mode .page-heading { gap: 14px; }
  .api-mode .heading-title h1 { font-size: 22px; line-height: 1.4; }
  .api-filters { align-items: flex-start; }
  .api-filters label { flex: 1 1 130px; flex-direction: column; align-items: stretch; min-width: 0; }
  .api-filters select { width: 100%; max-width: none; min-height: 38px; }
  .api-mode .table-toolbar .search-field { flex-basis: 100%; min-height: 38px; }
  .api-mode .api-row-actions { gap: 12px; }
  .ws-entitlement { flex-wrap: wrap; gap: 8px; }
  .ws-template { width: calc(50% - 15px); min-height: 86px; }
  .ws-field-grid { grid-template-columns: 1fr; gap: 0; }
  .ws-weekly-filters label { flex-basis: 100%; }
  .api-mode .creator-frame-modal .modal-body { padding: 0; }
}

/* Draft previews stay isolated from the editor and its authentication context. */
.ws-editor-toolbar { flex-wrap: wrap; }
.ws-template-panel .ws-hint .text-link { display: block; margin-top: 7px; }
.ws-preview-tools { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.ws-preview-tools [role="group"] { display: flex; gap: 6px; }
.ws-preview-tools [aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); border-color: var(--accent-line); }
.ws-preview-hint { color: var(--ink-400); font-size: 12px; line-height: 1.8; margin: 10px 0; }
.ws-preview-stage { display: flex; justify-content: center; padding: 16px; background: #e9ede8; border: 1px solid var(--line); border-radius: 10px; }
.ws-draft-preview-frame { display: block; flex: none; width: min(100%, 390px); height: min(68vh, 720px); min-height: 320px; border: 0; background: white; box-shadow: 0 3px 18px #203c291c; }
.ws-preview-stage[data-mode="wide"] .ws-draft-preview-frame { width: 100%; }
.ws-format-guide section { padding: 12px 0; border-bottom: 1px solid var(--line); }
.ws-format-guide h3 { margin: 0 0 8px; font-size: 16px; }
.ws-format-guide p { font-size: 13px; line-height: 1.9; }
@media (max-width: 600px) {
  .ws-preview-stage { padding: 4px; }
  .ws-draft-preview-frame { height: 65vh; min-height: 280px; }
  .ws-editor-toolbar .ws-save-status { flex: 1; text-align: right; }
}
