@import url('/static/styles/finance-news.css');
@import url('/static/styles/reminders.css');

:root {
  color-scheme: light;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --login-bg-a: #eaf4f7;
  --login-bg-b: #f5f8fc;
  --login-bg-c: #7ea5bc;
  --login-accent-rgb: 126, 165, 188;
  background:
    radial-gradient(circle at top, rgba(14, 165, 233, 0.14), transparent 28%),
    linear-gradient(180deg, #f4f7fb 0%, #eef3f8 100%);
  color: #1f2937;
}

html[data-theme="dark"] {
  color-scheme: dark;
  background:
    radial-gradient(circle at top, rgba(56, 189, 248, 0.18), transparent 22%),
    linear-gradient(180deg, #08111f 0%, #0f172a 100%);
  color: #e5eefb;
}

* { box-sizing: border-box; }
body { margin: 0; background: transparent; }
.container { max-width: 1440px; margin: 0 auto; padding: 24px; }
.page-header { margin-bottom: 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-header h1 { margin: 0 0 8px; }
.page-header p { margin: 0; color: #4b5563; }
.link-button { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.page-header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
  border-color: rgba(59, 130, 246, 0.28);
  outline: none;
}

.theme-toggle-icon {
  font-size: 18px;
  line-height: 1;
}

.header-user-menu {
  position: relative;
  display: flex;
  justify-content: flex-end;
}

.user-menu-trigger {
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(255, 255, 255, 0.85);
  color: #0f172a;
  padding: 8px 12px 8px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background-color 160ms ease;
}

.user-menu-trigger:hover,
.user-menu-trigger:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.12);
  border-color: rgba(59, 130, 246, 0.28);
  outline: none;
}

.user-menu-trigger.is-open .user-menu-caret {
  transform: rotate(180deg);
}

.user-menu-avatar-shell {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #dbeafe 0%, #e0f2fe 100%);
  border: 1px solid #dbe5f0;
  flex: 0 0 auto;
}

.user-menu-avatar-image,
.user-menu-avatar-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-menu-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
  font-weight: 800;
  font-size: 16px;
}

.user-menu-text {
  font-weight: 700;
  white-space: nowrap;
}

.user-menu-caret {
  color: #64748b;
  transition: transform 160ms ease;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 196px;
  padding: 8px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 22px 44px rgba(15, 23, 42, 0.14);
  display: grid;
  gap: 4px;
  z-index: 20;
}

.user-menu-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: #0f172a;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}

.user-menu-item:hover,
.user-menu-item:focus-visible {
  background: #f8fafc;
  color: #2563eb;
  outline: none;
}

.user-menu-dropdown form {
  margin: 0;
}

html[data-theme="dark"] .page-header p,
html[data-theme="dark"] .status,
html[data-theme="dark"] .preview-title,
html[data-theme="dark"] .history-meta,
html[data-theme="dark"] .empty-preview-text,
html[data-theme="dark"] .finance-news-page-label,
html[data-theme="dark"] .market-model-picker span,
html[data-theme="dark"] .market-cache-meta,
html[data-theme="dark"] .market-card-meta,
html[data-theme="dark"] .market-detail-label,
html[data-theme="dark"] .admin-user-id {
  color: #94a3b8;
}

html[data-theme="dark"] .panel,
html[data-theme="dark"] .app-tabs,
html[data-theme="dark"] .user-menu-dropdown,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .user-menu-trigger,
html[data-theme="dark"] .market-model-picker,
html[data-theme="dark"] .drop-zone,
html[data-theme="dark"] .empty-history,
html[data-theme="dark"] .empty,
html[data-theme="dark"] .preview-box,
html[data-theme="dark"] .finance-news-table-wrap,
html[data-theme="dark"] .profile-card,
html[data-theme="dark"] .profile-meta-item,
html[data-theme="dark"] .admin-user-card,
html[data-theme="dark"] .market-table-shell,
html[data-theme="dark"] .market-card,
html[data-theme="dark"] .market-card-featured,
html[data-theme="dark"] .market-alert-summary,
html[data-theme="dark"] .market-alert-history-item,
html[data-theme="dark"] .market-alert-history-empty,
html[data-theme="dark"] .market-detail-block,
html[data-theme="dark"] .market-modal-dialog,
html[data-theme="dark"] .market-ai-panel,
html[data-theme="dark"] .market-ai-structured-card,
html[data-theme="dark"] .market-ai-chat-bubble.assistant,
html[data-theme="dark"] .market-ai-chat-bubble.user,
html[data-theme="dark"] .market-trend-hint-soft,
html[data-theme="dark"] .market-trend-hint-warn {
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow: 0 18px 40px rgba(2, 6, 23, 0.35);
}

html[data-theme="dark"] .panel,
html[data-theme="dark"] .app-tabs,
html[data-theme="dark"] .history-item,
html[data-theme="dark"] .finance-news-table,
html[data-theme="dark"] .user-menu-item,
html[data-theme="dark"] .user-menu-trigger,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .profile-meta-value,
html[data-theme="dark"] .admin-user-name,
html[data-theme="dark"] .market-model-picker select,
html[data-theme="dark"] .market-card,
html[data-theme="dark"] .market-card-featured,
html[data-theme="dark"] .market-table-primary,
html[data-theme="dark"] .market-card-title,
html[data-theme="dark"] .market-price,
html[data-theme="dark"] .market-section-title,
html[data-theme="dark"] .market-alert-history-title,
html[data-theme="dark"] .market-ai-result,
html[data-theme="dark"] .market-ai-structured-value,
html[data-theme="dark"] .market-detail-content,
html[data-theme="dark"] .market-detail-title {
  color: #e5eefb;
}

html[data-theme="dark"] .history-item,
html[data-theme="dark"] .json-result-view,
html[data-theme="dark"] textarea,
html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] .finance-news-table thead th,
html[data-theme="dark"] .finance-news-table td,
html[data-theme="dark"] .finance-news-table th,
html[data-theme="dark"] .history-open-btn {
  background: rgba(15, 23, 42, 0.72);
  color: #e5eefb;
  border-color: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .market-table th,
html[data-theme="dark"] .market-table td,
html[data-theme="dark"] .market-table thead th,
html[data-theme="dark"] .market-alert-history-item,
html[data-theme="dark"] .market-alert-history-empty,
html[data-theme="dark"] .market-alert-summary,
html[data-theme="dark"] .market-empty-card {
  color: #e5eefb;
}

html[data-theme="dark"] textarea,
html[data-theme="dark"] input,
html[data-theme="dark"] select {
  border: 1px solid rgba(148, 163, 184, 0.22);
}

html[data-theme="dark"] .market-table th,
html[data-theme="dark"] .market-table td {
  border-bottom-color: rgba(148, 163, 184, 0.16);
}

html[data-theme="dark"] .market-table th {
  background: rgba(30, 41, 59, 0.9);
  color: #cbd5e1;
}

html[data-theme="dark"] .market-table-row-clickable:hover {
  background: rgba(30, 41, 59, 0.92);
}

html[data-theme="dark"] .history-item:hover,
html[data-theme="dark"] .finance-news-table tbody tr:hover,
html[data-theme="dark"] .user-menu-item:hover,
html[data-theme="dark"] .user-menu-item:focus-visible,
html[data-theme="dark"] .history-open-btn:hover {
  background: rgba(30, 41, 59, 0.96);
  border-color: rgba(96, 165, 250, 0.28);
  color: #93c5fd;
}

html[data-theme="dark"] .app-tab {
  color: #94a3b8;
}

html[data-theme="dark"] .app-tab.is-active {
  background: #dbeafe;
  color: #0f172a;
}

html[data-theme="dark"] .secondary {
  background: #1e293b;
}

html[data-theme="dark"] .primary {
  background: #3b82f6;
}

html[data-theme="dark"] .json-tool-actions {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .json-tool-action-section + .json-tool-action-section {
  border-left-color: rgba(148, 163, 184, 0.18);
  border-top-color: rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .json-tool-action-title {
  color: #94a3b8;
}

html[data-theme="dark"] .json-tool-actions .primary,
html[data-theme="dark"] .json-tool-actions .secondary {
  color: #cbd5e1;
}

html[data-theme="dark"] .json-tool-actions .primary:hover:not(:disabled),
html[data-theme="dark"] .json-tool-actions .secondary:hover:not(:disabled) {
  background: rgba(30, 41, 59, 0.96);
  color: #e5eefb;
}

html[data-theme="dark"] .json-tool-actions .primary.is-active,
html[data-theme="dark"] .json-tool-actions .secondary.is-active {
  background: rgba(30, 41, 59, 0.92);
  color: #f8fafc;
  box-shadow: 0 1px 2px rgba(2, 6, 23, 0.3);
}

html[data-theme="dark"] .copy-btn {
  background: #0f766e;
}

html[data-theme="dark"] .status-banner {
  background: rgba(15, 23, 42, 0.82);
  color: #dbeafe;
  border: 1px solid rgba(148, 163, 184, 0.18);
}

html[data-theme="dark"] .market-alert-summary.is-active {
  background: rgba(120, 53, 15, 0.34);
  border-color: rgba(251, 191, 36, 0.28);
  color: #fde68a;
}

html[data-theme="dark"] .market-alert-summary.is-warn {
  background: rgba(127, 29, 29, 0.34);
  border-color: rgba(248, 113, 113, 0.28);
  color: #fecaca;
}

html[data-theme="dark"] .market-alert-history-item.is-unread {
  background: rgba(120, 53, 15, 0.24);
  border-color: rgba(251, 191, 36, 0.24);
}

html[data-theme="dark"] .market-alert-history-item.is-active {
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.18);
}

html[data-theme="dark"] .market-alert-history-meta,
html[data-theme="dark"] .market-table-secondary,
html[data-theme="dark"] .market-note,
html[data-theme="dark"] .market-card-foot,
html[data-theme="dark"] .market-card-meta,
html[data-theme="dark"] .market-ai-meta,
html[data-theme="dark"] .market-ai-structured-label,
html[data-theme="dark"] .market-trend-stat-label,
html[data-theme="dark"] .market-detail-meta,
html[data-theme="dark"] .market-detail-axis,
html[data-theme="dark"] .market-detail-chart-stats,
html[data-theme="dark"] .market-trend-hint,
html[data-theme="dark"] .market-chart-empty {
  color: #94a3b8;
}

html[data-theme="dark"] .market-empty-card {
  background: rgba(15, 23, 42, 0.72);
}

html[data-theme="dark"] .market-chart-wrap,
html[data-theme="dark"] .market-chart-wrap-detail {
  background: rgba(2, 6, 23, 0.32);
}

html[data-theme="dark"] .market-position-import-summary {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
}

html[data-theme="dark"] .market-position-import-dropzone strong {
  color: #e5eefb;
}

html[data-theme="dark"] .market-position-import-dropzone span {
  color: #94a3b8;
}

html[data-theme="dark"] .market-position-import-image {
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.35);
}

html[data-theme="dark"] .market-position-import-warning {
  color: #94a3b8;
}

html[data-theme="dark"] .market-position-import-loading strong {
  color: #f8fafc;
}

html[data-theme="dark"] .market-position-import-loading span {
  color: #cbd5e1;
}

html[data-theme="dark"] .market-modal-backdrop {
  background: rgba(2, 6, 23, 0.76);
}

html[data-theme="dark"] .market-badge.flat {
  background: rgba(71, 85, 105, 0.45);
  color: #cbd5e1;
}

html[data-theme="dark"] .market-badge.up {
  background: rgba(127, 29, 29, 0.34);
}

html[data-theme="dark"] .market-badge.down {
  background: rgba(6, 78, 59, 0.34);
}

html[data-theme="dark"] .market-alert-chip.idle {
  background: rgba(71, 85, 105, 0.4);
  color: #cbd5e1;
}

html[data-theme="dark"] .market-alert-chip.warn {
  background: rgba(120, 53, 15, 0.3);
  color: #fde68a;
}

html[data-theme="dark"] .market-alert-chip.profit {
  background: rgba(127, 29, 29, 0.3);
  color: #fecaca;
}

html[data-theme="dark"] .market-alert-chip.watch {
  background: rgba(30, 64, 175, 0.3);
  color: #bfdbfe;
}

html[data-theme="dark"] .login-error {
  background: rgba(127, 29, 29, 0.42);
  color: #fecaca;
}

html[data-theme="dark"] .admin-success {
  background: rgba(6, 78, 59, 0.42);
  color: #a7f3d0;
}
.app-tabs {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  margin-bottom: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}
.app-tab {
  border: 0;
  background: transparent;
  color: #475569;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}
.app-tab.is-active {
  background: #0f172a;
  color: white;
}
.app-tab:hover {
  transform: translateY(-1px);
}
.workspace { display: grid; grid-template-columns: 320px minmax(360px, 1fr) 420px; gap: 16px; align-items: start; }
.manuscript-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; align-items: start; }
.finance-news-layout { display: block; }
.reminder-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; }
.profile-layout { display: block; }
.panel {
  background: white; border-radius: 16px; padding: 20px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  transition: box-shadow 180ms ease, transform 180ms ease;
}
.panel-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.panel-title h2, .panel-title h3 { margin: 0; }
.market-detail-actions { display: flex; align-items: center; gap: 8px; }
.market-model-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #dbe3ee;
  color: #334155;
  font-size: 13px;
}

.market-model-picker span {
  white-space: nowrap;
  color: #475569;
  font-weight: 600;
}

.market-model-picker select {
  border: 0;
  background: transparent;
  color: #0f172a;
  font-size: 13px;
  font-weight: 600;
  min-width: 210px;
}

.market-model-picker select:focus {
  outline: none;
}

.market-detail-actions .secondary,
.market-detail-actions .primary {
  flex: 0 0 auto;
}
.small-title { margin-top: 20px; }
.drop-zone {
  border: 2px dashed #94a3b8; border-radius: 16px; padding: 28px 16px; text-align: center; cursor: pointer;
  background: #f8fafc;
}
.drop-zone.dragover { border-color: #2563eb; background: #eff6ff; }
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.primary, .copy-btn, .secondary {
  border: 0; background: #2563eb; color: white; padding: 10px 16px; border-radius: 10px; cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.primary[disabled] { opacity: 0.5; cursor: not-allowed; }
.copy-btn { background: #0f766e; padding: 8px 12px; }
.secondary { background: #0f172a; }
.secondary.small,
.primary.small {
  padding: 6px 12px;
  font-size: 12px;
}
.primary:hover:not([disabled]),
.copy-btn:hover:not([disabled]),
.secondary:hover:not([disabled]) {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}
.status { color: #475569; font-size: 14px; }
.preview-panel, .result-panel { min-height: 720px; }
.preview-image {
  width: 100%; min-height: 520px; max-height: 720px; object-fit: contain; border-radius: 12px; background: #f8fafc;
}
.hidden { display: none !important; }
.empty {
  min-height: 520px; display: flex; align-items: center; justify-content: center; color: #64748b; background: #f8fafc; border-radius: 12px;
}
.history-list {
  display: flex; flex-direction: column; gap: 10px; max-height: 360px; overflow-y: auto;
}
.empty-history {
  min-height: 120px; border-radius: 12px; background: #f8fafc; color: #64748b; display: flex; align-items: center; justify-content: center;
}
.history-item {
  border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px 12px; background: #fff; cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}
.history-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
}
.history-name { font-weight: 600; margin-bottom: 4px; word-break: break-all; }
.history-meta { color: #64748b; font-size: 13px; }
.history-open-btn {
  margin-top: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #334155;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
}
.field-block { margin-bottom: 14px; }
.field-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px;
}
.collapsible-header {
  cursor: pointer;
  user-select: none;
}
.collapsible-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.collapse-indicator {
  color: #64748b;
  font-size: 13px;
}
.collapsible-block.is-collapsed textarea {
  display: none;
}
.collapsible-block.is-collapsed .collapse-indicator::before {
  content: "▸ ";
}
.collapsible-block:not(.is-collapsed) .collapse-indicator::before {
  content: "▾ ";
}
textarea {
  width: 100%; border: 1px solid #cbd5e1; border-radius: 10px; padding: 12px; resize: vertical; font-family: ui-monospace, SFMono-Regular, monospace;
}
.preview-box {
  margin-top: 12px; border-radius: 12px; background: #f8fafc; padding: 14px; overflow-x: auto;
}
.preview-title { color: #64748b; font-size: 14px; margin-bottom: 8px; }
.latex-preview { min-height: 56px; }
.empty-preview-text { color: #64748b; }
.status-banner.error-banner {
  border-color: rgba(220, 38, 38, 0.25);
  background: rgba(254, 242, 242, 0.92);
  color: #b91c1c;
}

.profile-grid {
  display: grid;
  grid-template-columns: 280px minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 16px;
}

.profile-card {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 18px;
  background: #fff;
  display: grid;
  gap: 14px;
  align-content: start;
}

.profile-avatar-shell {
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar-image,
.profile-avatar-fallback {
  width: 144px;
  height: 144px;
  border-radius: 28px;
  object-fit: cover;
  background: linear-gradient(135deg, #dbeafe 0%, #e0f2fe 100%);
  border: 1px solid #dbe5f0;
}

.profile-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #0f172a;
  font-size: 54px;
  font-weight: 700;
}

.profile-avatar-actions {
  display: grid;
  gap: 10px;
}

.profile-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.profile-meta-item {
  border-radius: 12px;
  background: #f8fafc;
  padding: 12px 14px;
}

.profile-meta-value {
  color: #0f172a;
  line-height: 1.6;
  word-break: break-word;
}

kbd {
  border: 1px solid #cbd5e1; border-bottom-width: 2px; border-radius: 6px; padding: 2px 6px; background: white;
}

.login-page {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 14% 18%, rgba(var(--login-accent-rgb), 0.2), transparent 28%),
    radial-gradient(circle at 84% 18%, rgba(var(--login-accent-rgb), 0.14), transparent 24%),
    linear-gradient(135deg, var(--login-bg-a) 0%, var(--login-bg-b) 52%, #fbfdff 100%);
  transition: background 400ms ease;
}

.login-page,
.login-page * {
  -webkit-tap-highlight-color: transparent;
}

.login-page :where(.login-shell, .login-card, .login-panel, .login-header, .login-field-label, .captcha-row, .captcha-modal, .captcha-dialog) {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.login-page input {
  -webkit-touch-callout: default;
  -webkit-user-select: text;
  user-select: text;
}

.login-background-gradient,
.login-background-aurora,
.login-background-matrix,
.login-background-rings {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.login-background-matrix {
  z-index: 0;
  width: 100%;
  height: 100%;
  opacity: 0.78;
  mix-blend-mode: multiply;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.8) 48%, rgba(0, 0, 0, 0.18) 100%);
}

.login-background-gradient {
  z-index: 0;
  background:
    radial-gradient(circle at 22% 24%, rgba(var(--login-accent-rgb), 0.14), transparent 30%),
    radial-gradient(circle at 76% 22%, rgba(var(--login-accent-rgb), 0.1), transparent 26%),
    radial-gradient(circle at 58% 78%, rgba(255, 255, 255, 0.4), transparent 24%);
  opacity: 0.95;
}

.login-background-aurora {
  z-index: 0;
  inset: -18%;
  background:
    linear-gradient(120deg, rgba(var(--login-accent-rgb), 0) 8%, rgba(var(--login-accent-rgb), 0.12) 32%, rgba(255, 255, 255, 0.06) 54%, rgba(255, 255, 255, 0) 74%),
    linear-gradient(300deg, rgba(var(--login-accent-rgb), 0) 20%, rgba(var(--login-accent-rgb), 0.08) 44%, rgba(var(--login-accent-rgb), 0.12) 58%, rgba(255, 255, 255, 0) 82%);
  filter: blur(34px);
  transform: translate3d(0, 0, 0);
  animation: loginAuroraDrift 18s ease-in-out infinite alternate;
}

.login-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1120px;
}

.login-card {
  display: grid;
  grid-template-columns: minmax(0, 440px) minmax(0, 1fr);
  min-height: 700px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(22px);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 34px;
  box-shadow: 0 38px 90px rgba(15, 23, 42, 0.16);
  position: relative;
  overflow: hidden;
}

.login-background-orb {
  position: fixed;
  z-index: 0;
  border-radius: 999px;
  filter: blur(24px);
  opacity: 0.9;
  pointer-events: none;
}

.login-background-orb-a {
  top: -80px;
  left: -80px;
  width: 320px;
  height: 320px;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.32), rgba(45, 212, 191, 0));
  animation: loginFloatA 14s ease-in-out infinite;
}

.login-background-orb-b {
  right: -60px;
  bottom: -60px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.26), rgba(59, 130, 246, 0));
  animation: loginFloatB 16s ease-in-out infinite;
}

.login-background-orb-c {
  top: 32%;
  right: 18%;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.16), rgba(251, 191, 36, 0));
  animation: loginFloatC 13s ease-in-out infinite;
}

.login-background-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.38;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at center, black 36%, transparent 85%);
}

.login-background-rings {
  z-index: 0;
  background:
    radial-gradient(circle at 16% 76%, transparent 0 58px, rgba(148, 163, 184, 0.12) 60px 61px, transparent 63px),
    radial-gradient(circle at 84% 66%, transparent 0 78px, rgba(96, 165, 250, 0.14) 80px 81px, transparent 83px);
  opacity: 0.8;
}

.login-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0)),
    linear-gradient(135deg, rgba(var(--login-accent-rgb), 0.08), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.login-panel {
  position: relative;
  z-index: 1;
}

.login-panel-form {
  padding: 42px 38px 36px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(248, 250, 252, 0.74));
}

.login-panel-visual {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(2, 6, 23, 0.08), rgba(2, 6, 23, 0.36)),
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.22), transparent 28%);
}

.login-panel-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.06), rgba(15, 23, 42, 0.42)),
    linear-gradient(110deg, rgba(var(--login-accent-rgb), 0.12), rgba(255, 255, 255, 0));
  pointer-events: none;
  z-index: 1;
}

.login-visual-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-visual-content {
  position: absolute;
  inset: auto 34px 34px 34px;
  display: grid;
  gap: 12px;
  z-index: 2;
  color: #f8fafc;
  text-shadow: 0 2px 18px rgba(15, 23, 42, 0.56);
}

.login-visual-pill {
  width: fit-content;
  min-height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  background: rgba(15, 23, 42, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.24);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-visual-content h2 {
  margin: 0;
  font-size: 34px;
  line-height: 1.18;
  letter-spacing: -0.03em;
  max-width: 12ch;
}

.login-header h1 {
  margin: 0 0 10px;
  font-size: 38px;
  letter-spacing: -0.02em;
}

.login-header p {
  margin: 0;
  color: #475569;
  line-height: 1.6;
}

.eyebrow {
  margin: 0 0 12px;
  color: #0369a1;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 28px;
}

.login-form label {
  font-size: 14px;
  color: #334155;
  font-weight: 600;
}

.login-field-label {
  font-size: 14px;
  color: #334155;
  font-weight: 600;
}

.login-form input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 15px;
  background: rgba(255, 255, 255, 0.92);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.login-form input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.16);
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.08);
}

.password-field {
  position: relative;
}

.password-field input {
  padding-right: 78px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  border: 1px solid rgba(148, 163, 184, 0.2);
  background: rgba(248, 250, 252, 0.92);
  color: #334155;
  border-radius: 999px;
  min-width: 56px;
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  background: rgba(239, 246, 255, 1);
  color: #1d4ed8;
  border-color: rgba(96, 165, 250, 0.34);
  outline: none;
}

.login-submit {
  margin-top: 8px;
  min-height: 48px;
  font-size: 15px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.login-submit-spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: rgba(255, 255, 255, 0.98);
  display: none;
  animation: loginSpin 0.7s linear infinite;
}

.login-form.is-submitting .login-submit-spinner {
  display: inline-block;
}

.login-form.is-submitting .login-submit {
  cursor: wait;
  opacity: 0.92;
}

.login-form.is-submitting input,
.login-form.is-submitting .password-toggle,
.login-form.is-submitting .captcha-refresh,
.login-form.is-submitting .captcha-trigger {
  pointer-events: none;
}

.login-submit:disabled {
  cursor: wait;
}

.captcha-row {
  display: grid;
  grid-template-columns: 1fr 128px;
  gap: 12px;
  align-items: center;
}

.captcha-row-advanced {
  grid-template-columns: 1fr;
  gap: 14px;
}

.captcha-visual {
  display: flex;
  align-items: center;
  gap: 10px;
}

.captcha-image {
  display: block;
  width: 184px;
  height: 64px;
  border: 1px dashed #93c5fd;
  background: #eff6ff;
  border-radius: 12px;
  cursor: pointer;
}

.captcha-refresh {
  border: 1px solid #bfdbfe;
  background: white;
  color: #2563eb;
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 600;
  cursor: pointer;
}

.captcha-refresh[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.captcha-trigger {
  position: relative;
  overflow: hidden;
  min-height: 72px;
  border-radius: 18px;
  border: 1px solid rgba(var(--login-accent-rgb), 0.28);
  background:
    radial-gradient(circle at top left, rgba(var(--login-accent-rgb), 0.24), transparent 38%),
    linear-gradient(135deg, rgba(239, 246, 255, 0.96), rgba(219, 234, 254, 0.96) 48%, rgba(248, 250, 252, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), 0 12px 28px rgba(15, 23, 42, 0.08);
  cursor: pointer;
  user-select: none;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.captcha-trigger:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), 0 16px 32px rgba(15, 23, 42, 0.1);
}

.captcha-trigger:focus-visible {
  outline: 2px solid rgba(var(--login-accent-rgb), 0.3);
  outline-offset: 2px;
}

.captcha-trigger-progress {
  position: absolute;
  inset: 0;
  width: 0;
  background: linear-gradient(90deg, rgba(var(--login-accent-rgb), 0.14), rgba(var(--login-accent-rgb), 0.24));
  transition: width 0.2s ease;
}

.captcha-trigger-glow {
  position: absolute;
  inset: auto -30% -120% auto;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0));
  opacity: 0;
  transform: translate3d(0, 0, 0);
}

.captcha-trigger-content {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 72px;
  padding: 16px 18px;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.captcha-trigger-label {
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
}

.captcha-trigger-hint {
  color: #475569;
  font-size: 13px;
}

.captcha-trigger.is-holding .captcha-trigger-progress {
  width: 100%;
  transition: width 0.9s linear;
}

.captcha-trigger.is-holding .captcha-trigger-glow {
  opacity: 1;
  animation: captchaGlowSweep 0.9s linear forwards;
}

.captcha-trigger.is-ready {
  border-color: rgba(var(--login-accent-rgb), 0.42);
}

.captcha-trigger.is-verified {
  border-color: rgba(34, 197, 94, 0.42);
  background:
    radial-gradient(circle at top left, rgba(134, 239, 172, 0.35), transparent 40%),
    linear-gradient(135deg, #f0fdf4, #dcfce7 44%, #f8fafc);
}

.captcha-status {
  min-height: 22px;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
}

.captcha-status.is-verified {
  color: #15803d;
}

.captcha-status.is-pending {
  color: #475569;
}

.captcha-modal-open {
  overflow: hidden;
  touch-action: none;
}

.captcha-modal[hidden] {
  display: none;
}

.captcha-modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  padding: 20px;
  box-sizing: border-box;
  isolation: isolate;
  overflow: auto;
}

.captcha-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(6px);
}

.captcha-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  margin: auto;
  border-radius: 24px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background:
    radial-gradient(circle at top right, rgba(186, 230, 253, 0.65), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.28);
  padding: 22px;
}

.captcha-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.captcha-dialog-head h2 {
  margin: 2px 0 0;
  font-size: 20px;
}

.captcha-dialog-eyebrow {
  margin: 0;
  color: #0284c7;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.captcha-dialog-close {
  border: 1px solid #cbd5e1;
  background: rgba(255, 255, 255, 0.9);
  color: #475569;
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}

.captcha-stage-wrap {
  margin-top: 18px;
  padding: 12px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(241, 245, 249, 0.98), rgba(226, 232, 240, 0.78));
  display: flex;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.captcha-stage {
  position: relative;
  width: 100%;
  max-width: var(--captcha-width, 320px);
  flex: 0 1 var(--captcha-width, 320px);
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 18px;
  overflow: hidden;
  background: #dbeafe;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
}

.captcha-stage-sheen {
  position: absolute;
  inset: -20% auto -20% -32%;
  width: 36%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0));
  transform: rotate(12deg);
  z-index: 1;
  animation: captchaStageSheen 5.8s linear infinite;
}

.captcha-stage-bg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.captcha-stage-slot {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  border-radius: 16px;
  border: 1px dashed rgba(255, 255, 255, 0.85);
  background: rgba(15, 23, 42, 0.26);
  box-shadow:
    inset 0 0 0 999px rgba(2, 6, 23, 0.08),
    0 0 0 1px rgba(15, 23, 42, 0.1);
  opacity: 0.92;
  transition: transform 0.18s ease, opacity 0.18s ease, box-shadow 0.18s ease;
}

.captcha-stage-slot.is-active {
  box-shadow:
    inset 0 0 0 999px rgba(34, 197, 94, 0.16),
    0 0 0 2px rgba(74, 222, 128, 0.4);
  opacity: 1;
}

.captcha-stage-piece {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  pointer-events: none;
  filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.28));
  transition: transform 0.08s linear;
}

.captcha-slider-shell {
  margin-top: 18px;
  display: flex;
  justify-content: center;
}

.captcha-slider-track {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  max-width: var(--captcha-width, 320px);
  height: 56px;
  border-radius: 999px;
  background: linear-gradient(180deg, #e2e8f0, #cbd5e1);
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
  transition: box-shadow 0.18s ease, transform 0.18s ease, background 0.18s ease;
}

.captcha-slider-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.2), rgba(59, 130, 246, 0.28));
  transition: width 0.08s linear;
}

.captcha-slider-track.is-snapping {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 0 0 3px rgba(var(--login-accent-rgb), 0.16);
}

.captcha-slider-track.is-success {
  background: linear-gradient(180deg, #dcfce7, #bbf7d0);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.captcha-slider-track.is-success .captcha-slider-fill {
  width: 100% !important;
  background: linear-gradient(90deg, rgba(74, 222, 128, 0.42), rgba(59, 130, 246, 0.3));
}

.captcha-slider-track.is-success .captcha-slider-text {
  color: #166534;
}

.captcha-slider-text {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #475569;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.captcha-slider-handle {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 30%, #ffffff, #e2e8f0 70%),
    linear-gradient(180deg, #ffffff, #dbeafe);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
  cursor: grab;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.captcha-slider-handle::before {
  content: '\203A\203A';
  color: #2563eb;
  font-size: 18px;
  font-weight: 700;
}

.captcha-slider-track.is-success .captcha-slider-handle {
  background:
    radial-gradient(circle at 30% 30%, #ffffff, #dcfce7 70%),
    linear-gradient(180deg, #ffffff, #bbf7d0);
  box-shadow: 0 10px 24px rgba(34, 197, 94, 0.24);
}

.captcha-slider-track.is-success .captcha-slider-handle::before {
  content: '\2713';
  color: #16a34a;
}

.captcha-dialog-status {
  min-height: 22px;
  margin-top: 14px;
  color: #475569;
  font-size: 14px;
  font-weight: 600;
}

.captcha-dialog-status.is-error {
  color: #b91c1c;
}

.captcha-dialog-status.is-success {
  color: #15803d;
}

.captcha-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.captcha-text-target-panel {
  margin-top: 18px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(241, 245, 249, 0.96), rgba(226, 232, 240, 0.82));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.captcha-text-target-label {
  margin: 0;
  padding: 12px 14px 0;
  color: #334155;
  font-size: 13px;
  font-weight: 700;
}

.captcha-target-sequence {
  position: relative;
  margin-top: 8px;
  display: block;
  width: 100%;
  aspect-ratio: 320 / 76;
  min-height: 0;
  overflow: hidden;
}

.captcha-target-image {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
}

.captcha-text-board-wrap {
  margin-top: 14px;
  border-radius: 20px;
  overflow: hidden;
  background: radial-gradient(circle at top, rgba(186, 230, 253, 0.35), rgba(241, 245, 249, 0.96) 45%, rgba(226, 232, 240, 0.9));
}

.captcha-text-board {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 0;
  border-radius: inherit;
  background: #0f172a;
  overflow: hidden;
}

.captcha-board-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.captcha-click-layer {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  cursor: crosshair;
}

.captcha-click-marker {
  position: absolute;
  width: 24px;
  height: 24px;
  margin-left: -12px;
  margin-top: -12px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: linear-gradient(180deg, rgba(59, 130, 246, 0.95), rgba(37, 99, 235, 0.92));
  box-shadow: 0 6px 12px rgba(2, 6, 23, 0.28);
  pointer-events: none;
}

.captcha-selection {
  margin-top: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.captcha-selection-label {
  color: #334155;
  font-size: 13px;
  font-weight: 700;
  line-height: 34px;
}

.captcha-selection-list {
  flex: 1;
  min-height: 34px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.captcha-selection-char {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(59, 130, 246, 0.3);
  background: rgba(239, 246, 255, 0.92);
  color: #0f172a;
  font-size: 15px;
  font-weight: 700;
}

.captcha-selection-index {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  background: #2563eb;
}

@keyframes captchaGlowSweep {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-180px, -80px, 0);
  }
}

@keyframes loginAuroraDrift {
  0% {
    transform: translate3d(-2%, 0, 0) scale(1);
  }
  100% {
    transform: translate3d(2%, -3%, 0) scale(1.04);
  }
}

@keyframes loginFloatA {
  0%, 100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(16px, 20px, 0);
  }
}

@keyframes loginFloatB {
  0%, 100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(-18px, -20px, 0);
  }
}

@keyframes loginFloatC {
  0%, 100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(14px, -10px, 0) scale(1.08);
  }
}

@keyframes captchaStageSheen {
  0% {
    transform: translate3d(0, 0, 0) rotate(12deg);
  }
  100% {
    transform: translate3d(420px, 0, 0) rotate(12deg);
  }
}

@keyframes loginSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #334155;
  font-size: 14px;
  font-weight: 500;
}

.remember-row input {
  width: auto;
  margin: 0;
}

.login-error {
  margin-top: 18px;
  border-radius: 12px;
  background: #fef2f2;
  color: #b91c1c;
  padding: 12px 14px;
  font-size: 14px;
}

.admin-container {
  max-width: 1320px;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-header-actions > * {
  margin: 0;
}

.admin-header-actions form {
  margin: 0;
}

.admin-header-actions .secondary,
.admin-header-actions .link-button {
  min-height: 42px;
  padding: 10px 16px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-panel {
  min-height: 240px;
}

.admin-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-form label,
.admin-password-form label {
  font-size: 14px;
  color: #334155;
  font-weight: 600;
}

.admin-form input,
.admin-password-form input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 15px;
  background: #fff;
}

.admin-form .remember-row {
  width: 100%;
  align-items: center;
  flex-wrap: nowrap;
}

.admin-form .remember-row input {
  width: auto;
  flex: 0 0 auto;
  margin: 0;
}

.admin-form .remember-row span {
  flex: 1;
}

.admin-user-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-user-card {
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 16px;
  background: #fbfdff;
}

.admin-user-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.admin-user-name {
  font-size: 18px;
  font-weight: 700;
}

.admin-user-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.admin-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}

.admin-tag.active {
  background: #dcfce7;
  color: #166534;
}

.admin-tag.inactive {
  background: #fee2e2;
  color: #b91c1c;
}

.admin-tag.admin {
  background: #dbeafe;
  color: #1d4ed8;
}

.admin-tag.member {
  background: #e2e8f0;
  color: #334155;
}

.admin-user-id {
  color: #64748b;
  font-size: 13px;
}

.admin-user-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.admin-password-form {
  margin-top: 14px;
}

.admin-inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px;
  gap: 10px;
  margin-top: 8px;
}

.slim-btn {
  padding: 10px 12px;
}

.admin-flash {
  margin-top: 0;
  margin-bottom: 16px;
}

.admin-success {
  border-radius: 12px;
  background: #ecfdf5;
  color: #047857;
  padding: 12px 14px;
  font-size: 14px;
}

.manuscript-sidebar,
.manuscript-result-panel {
  min-height: 620px;
}

.manuscript-form-actions {
  display: flex;
  gap: 10px;
}

.manuscript-profile-list .history-item {
  cursor: default;
}

.manuscript-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.status-banner {
  border-radius: 14px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 14px 16px;
  font-weight: 600;
  margin-bottom: 16px;
  transition: background-color 180ms ease, color 180ms ease;
}

.status-banner.is-error {
  background: #fef2f2;
  color: #b91c1c;
}

.manuscript-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.manuscript-card {
  border-radius: 14px;
  background: #f8fafc;
  padding: 16px;
  min-height: 118px;
}

.manuscript-value {
  font-size: 16px;
  line-height: 1.6;
  word-break: break-word;
}

.manuscript-highlight {
  font-size: 24px;
  font-weight: 800;
  color: #0f766e;
  line-height: 1.3;
}

.manuscript-extra-box {
  margin-top: 16px;
}

.manuscript-link {
  color: #2563eb;
  word-break: break-all;
  text-decoration: none;
}

.json-tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

.json-tool-panel {
  min-height: 760px;
}

.json-tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.json-tool-column {
  display: grid;
  gap: 10px;
}

.json-tool-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #dbe5f0;
  border-radius: 16px;
  background: #f8fafc;
}

.json-tool-toolbar {
  margin-bottom: 12px;
}

.json-tool-action-section {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 0;
}

.json-tool-action-section + .json-tool-action-section {
  padding-left: 12px;
  border-left: 1px solid #dbe5f0;
}

.json-tool-action-title {
  color: #475569;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.json-tool-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.json-tool-action-group .market-model-picker {
  min-width: 190px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #dbe5f0;
  padding: 8px 10px;
}

.json-model-picker {
  position: relative;
  min-width: 260px;
  padding: 10px 42px 10px 12px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #cfe0f3;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.08);
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.json-model-picker::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 10px;
  height: 10px;
  border-right: 2px solid #2563eb;
  border-bottom: 2px solid #2563eb;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
  transition: transform 180ms ease;
}

.json-model-picker:hover,
.json-model-picker:focus-within {
  border-color: #93c5fd;
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.14);
  transform: translateY(-1px);
}

.json-model-picker:focus-within::after {
  transform: translateY(-35%) rotate(225deg);
}

.json-model-picker span {
  color: #2563eb;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.json-model-picker select {
  min-width: 0;
  width: 100%;
  appearance: none;
  border: 0;
  background: transparent;
  padding-right: 6px;
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.json-tool-actions .primary,
.json-tool-actions .secondary {
  border: 0;
  background: transparent;
  color: #475569;
  border-radius: 10px;
  padding: 8px 12px;
  min-height: 34px;
  box-shadow: none;
  font-weight: 600;
}

.json-tool-actions .primary:hover:not(:disabled),
.json-tool-actions .secondary:hover:not(:disabled) {
  background: #eef2f7;
  color: #1e293b;
}

.json-tool-actions .primary.is-active,
.json-tool-actions .secondary.is-active {
  background: #ffffff;
  color: #0f172a;
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.json-tool-textarea {
  min-height: 560px;
  font-size: 13px;
  line-height: 1.7;
}

.json-result-view {
  min-height: 560px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 14px;
  background: #ffffff;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 13px;
  line-height: 1.7;
  white-space: nowrap;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.json-text-view {
  margin: 0;
  min-width: max-content;
  font: inherit;
  line-height: inherit;
  white-space: pre;
}

.json-tree,
.json-tree-children {
  display: grid;
  gap: 2px;
}

.json-tree-line {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.json-tree-indent {
  display: inline-block;
  width: 18px;
  flex: 0 0 18px;
}

.json-tree-toggle {
  border: 0;
  background: transparent;
  color: #2563eb;
  cursor: pointer;
  padding: 0;
  width: 14px;
  flex: 0 0 14px;
  line-height: 1.4;
  font-family: inherit;
}

.json-tree-toggle.placeholder {
  cursor: default;
  color: transparent;
}

.json-tree-node.is-collapsed > .json-tree-children {
  display: none;
}

.json-tree-node > .json-tree-line {
  transition: background-color 140ms ease;
}

.json-tree-node > .json-tree-line:hover {
  background: rgba(37, 99, 235, 0.05);
}

.json-tree-node.is-collapsed > .json-tree-line .json-tree-toggle::before {
  content: "▸";
}

.json-tree-node:not(.is-collapsed) > .json-tree-line .json-tree-toggle::before {
  content: "▾";
}

.json-tree-key {
  color: #9f1239;
}

.json-tree-string {
  color: #047857;
}

.json-tree-number {
  color: #1d4ed8;
}

.json-tree-boolean {
  color: #7c3aed;
}

.json-tree-null {
  color: #64748b;
}

.json-tree-punct {
  color: #475569;
}

.json-tree-preview {
  color: #64748b;
}

.json-tool-hint,
.json-tool-meta {
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.market-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.market-sidebar {
  min-height: 760px;
  position: sticky;
  top: 20px;
}

.market-board {
  min-height: 760px;
  display: grid;
  gap: 16px;
  align-content: start;
  grid-template-rows: auto 1fr;
}

.market-board-top {
  display: grid;
  gap: 12px;
}

.market-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #dbe5f0;
  border-radius: 12px;
}

.market-toolbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.market-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.market-board-content {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 16px;
}

.market-board-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.market-board-sidebar {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.market-section {
  display: grid;
  gap: 10px;
}

.market-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.market-section-stat {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

.market-overview-grid {
  display: grid;
  gap: 8px;
}

.market-overview-grid {
  display: grid;
  gap: 8px;
}

.market-overview-grid .market-card {
  min-height: auto;
  padding: 10px;
  border-color: #e2e8f0;
}

.market-overview-grid .market-card-head,
.market-overview-grid .market-price-row,
.market-overview-grid .market-card-foot {
  gap: 8px;
}

.market-overview-grid .market-card-title {
  font-size: 12px;
}

.market-overview-grid .market-card-meta,
.market-overview-grid .market-price-label {
  font-size: 11px;
}

.market-overview-grid .market-price-value {
  font-size: 12px;
}

.modal-open {
  overflow: hidden;
}

.market-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 0.04em;
}

.market-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.market-card-grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  align-items: stretch;
}

.market-card-grid-watchlist {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.market-empty-card {
  min-height: 132px;
}

.market-table-shell {
  border: 1px solid #dbe5f0;
  border-radius: 14px;
  background: #ffffff;
  overflow: hidden;
}

.market-position-import-summary {
  border: 1px solid #dbe5f0;
  border-radius: 14px;
  padding: 12px 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: #334155;
  line-height: 1.7;
}

.market-position-import-dropzone {
  display: grid;
  gap: 6px;
  min-height: 120px;
  align-content: center;
  text-align: center;
  overflow: hidden;
}

.market-position-import-dropzone.is-disabled {
  pointer-events: none;
  opacity: 0.72;
}

.market-position-import-dropzone-copy {
  display: grid;
  gap: 6px;
}

.market-position-import-image {
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.market-position-import-dropzone strong {
  font-size: 16px;
  color: #0f172a;
}

.market-position-import-dropzone span {
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.market-position-import-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.market-position-import-warning {
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
  margin-top: 4px;
}

.market-position-import-loading {
  display: grid;
  gap: 6px;
}

.market-position-import-loading strong {
  font-size: 15px;
  color: #0f172a;
}

.market-position-import-loading span {
  color: #475569;
  font-size: 13px;
  line-height: 1.6;
}

.market-position-import-loading strong::after {
  content: '...';
  display: inline-block;
  width: 1.4em;
  overflow: hidden;
  vertical-align: bottom;
  animation: market-position-import-dots 1.2s steps(4, end) infinite;
}

@keyframes market-position-import-dots {
  0% { width: 0; }
  100% { width: 1.4em; }
}

.market-table-scroll {
  overflow-x: auto;
}

.market-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.market-table th,
.market-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.market-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
}

.market-sort-btn {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
}

.market-sort-btn.is-active {
  color: #0f172a;
}

.market-table tbody tr:last-child td {
  border-bottom: 0;
}

.market-table-row-clickable {
  cursor: pointer;
}

.market-table-row-clickable:hover {
  background: #f8fbff;
}

.market-table-primary {
  font-weight: 700;
  color: #0f172a;
}

.market-table-secondary {
  color: #64748b;
  font-size: 12px;
  margin-top: 2px;
}

.market-value-up {
  color: #b91c1c;
}

.market-value-down {
  color: #047857;
}

.market-value-flat {
  color: #475569;
}

.market-cache-meta {
  color: #64748b;
  font-size: 12px;
  white-space: nowrap;
  flex-shrink: 0;
}

.market-model-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #475569;
}

.market-model-picker span {
  font-weight: 500;
  white-space: nowrap;
}

.market-model-picker select {
  padding: 4px 8px;
  font-size: 12px;
  border: 1px solid #d2dce6;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  min-width: 150px;
}

.market-model-picker select:focus {
  outline: none;
  border-color: #0f766e;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

/* Hide legacy alert and status elements */
.market-alert-center,
.market-alert-center-head,
.market-alert-center-actions,
.market-alert-history-wrap,
.market-alert-history,
.market-alert-history-item,
#market-auto-ai-meta,
#market-status-banner {
  display: none !important;
}

.market-alert-history {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.market-alert-history-item {
  border: 1px solid #dbe5f0;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  width: 100%;
  text-align: left;
  cursor: pointer;
  appearance: none;
}

.market-alert-history-item.is-unread {
  border-color: #f2d6b3;
  background: #fff9f2;
}

.market-alert-history-item.is-active {
  box-shadow: inset 0 0 0 1px rgba(185, 28, 28, 0.06);
}

.market-alert-history-title,
.market-alert-history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.market-alert-history-title {
  font-size: 13px;
  color: #334155;
  font-weight: 600;
}

.market-alert-history-meta {
  margin-top: 4px;
  font-size: 12px;
  color: #64748b;
}

.market-alert-history-empty {
  border: 1px dashed #dbe5f0;
  border-radius: 12px;
  padding: 10px 12px;
  color: #64748b;
  font-size: 13px;
  background: #fff;
}

.market-watch-list .history-item {
  cursor: default;
}

.market-watch-item {
  padding: 12px;
}

.market-card {
  border: 1px solid #dbe5f0;
  border-radius: 14px;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  min-height: 208px;
}

.market-card-featured {
  border-color: #c7d9f7;
  background: linear-gradient(180deg, #ffffff 0%, #f2f7ff 100%);
  min-height: 220px;
}

.market-card-head,
.market-price-row,
.market-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.market-card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
}

.market-card-meta,
.market-card-foot,
.market-note {
  color: #64748b;
  font-size: 13px;
}

.market-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.market-badge.up,
.market-change.up {
  color: #b91c1c;
}

.market-badge.down,
.market-change.down {
  color: #047857;
}

.market-badge.flat,
.market-change.flat {
  color: #475569;
}

.market-badge.up {
  background: #fee2e2;
}

.market-badge.down {
  background: #dcfce7;
}

.market-badge.flat {
  background: #e2e8f0;
}

.market-price-row {
  margin-top: 10px;
  align-items: flex-end;
}

.market-price {
  font-size: 22px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
}

.market-chart-wrap {
  margin-top: 10px;
  border-radius: 10px;
  background: #f8fafc;
  padding: 4px;
  min-height: 92px;
}

.market-chart {
  width: 100%;
  height: 84px;
}

.market-chart.up {
  color: #dc2626;
}

.market-chart.down {
  color: #059669;
}

.market-chart.flat {
  color: #64748b;
}

.market-chart polyline,
.market-chart circle {
  stroke: currentColor;
  fill: currentColor;
}

.market-chart-empty {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 13px;
}

.market-card-foot {
  margin-top: 6px;
  font-size: 12px;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 6px 12px;
}

.market-note {
  margin-top: 6px;
  line-height: 1.5;
}

.market-alert-state-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.market-alert-state-row.table {
  margin-top: 8px;
}

.market-alert-state-row.detail {
  margin-top: 12px;
}

.market-alert-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  border: 1px solid #dbe5f0;
  background: #f8fafc;
  color: #475569;
}

.market-alert-chip.warn {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #b91c1c;
}

.market-alert-chip.profit {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

.market-alert-chip.watch {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.market-alert-chip.idle {
  background: #f8fafc;
  border-color: #dbe5f0;
  color: #64748b;
}

.market-strategy-summary {
  color: #475569;
  font-size: 13px;
  line-height: 1.6;
}

.market-table-row-clickable.is-alert {
  background: rgba(254, 242, 242, 0.7);
}

.market-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
}

.market-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.market-modal-dialog {
  position: relative;
  z-index: 1;
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  margin: 20px auto;
  background: #ffffff;
  border-radius: 18px;
  padding: 18px;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.2);
}

.market-modal-dialog-narrow {
  width: min(460px, calc(100vw - 32px));
}

.market-detail-content {
  display: grid;
  gap: 16px;
}

.market-detail-summary {
  display: grid;
  gap: 12px;
}

.market-detail-block {
  display: grid;
  gap: 10px;
  border: 1px solid #dbe5f0;
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.market-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.market-detail-chart {
  display: grid;
  gap: 10px;
}

.market-detail-block-trend {
  gap: 12px;
}

.market-detail-trend-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.market-detail-trend-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(220px, 0.8fr);
  gap: 14px;
  align-items: start;
}

.market-period-switch {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.market-period-btn {
  border: 1px solid #dbe3ee;
  background: #f8fafc;
  color: #334155;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.market-period-btn.is-active {
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}

.market-period-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.market-trend-side {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.market-trend-stat {
  border: 1px solid #dbe5f0;
  border-radius: 14px;
  background: #ffffff;
  padding: 12px;
}

.market-trend-stat-label {
  color: #64748b;
  font-size: 12px;
  margin-bottom: 8px;
}

.market-trend-stat-value {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
  color: #0f172a;
}

.market-chart-wrap-detail {
  min-height: 160px;
}

.market-chart-wrap-detail .market-chart,
.market-chart-wrap-detail .market-chart-empty {
  height: 152px;
  min-height: 152px;
}

.market-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: #64748b;
  font-size: 13px;
}

.market-detail-axis,
.market-detail-chart-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #64748b;
  font-size: 13px;
  flex-wrap: wrap;
}

.market-trend-hint {
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.6;
}

.market-trend-hint-soft,
.market-detail-block-trend.market-trend-hint-soft {
  background: linear-gradient(180deg, #ffffff 0%, #fff8ef 100%);
  border-color: #f2d6b3;
}

.market-trend-hint-soft {
  color: #9a5b14;
  background: rgba(251, 191, 36, 0.12);
}

.market-trend-hint-warn,
.market-detail-block-trend.market-trend-hint-warn {
  background: linear-gradient(180deg, #ffffff 0%, #fff4f4 100%);
  border-color: #f1c5c5;
}

.market-trend-hint-warn {
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.08);
}

.market-ai-panel {
  margin-top: 4px;
}

.market-ai-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.market-ai-collapse-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: none;
  background: transparent;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.market-ai-collapse-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.market-ai-collapse-icon {
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.market-ai-panel-body.hidden {
  display: none;
}

.market-ai-meta {
  color: #64748b;
  font-size: 12px;
}

.market-ai-result {
  white-space: normal;
  line-height: 1.75;
  color: #0f172a;
  font-size: 14px;
  min-height: 120px;
}

.market-ai-progress {
  display: block;
  margin-bottom: 14px;
  padding: 0;
}

.market-ai-progress-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.88));
}

.market-ai-progress-text {
  color: #334155;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
}

.market-ai-progress-time {
  flex-shrink: 0;
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.market-ai-structured-card {
  border: 1px solid #dbe5f0;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding: 12px;
  margin-bottom: 14px;
}

.market-ai-structured-title {
  font-size: 12px;
  font-weight: 800;
  color: #475569;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.market-ai-structured-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
}

.market-ai-structured-item {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  padding: 8px 10px;
}

.market-ai-structured-label {
  color: #64748b;
  font-size: 11px;
  margin-bottom: 4px;
}

.market-ai-structured-value {
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.market-ai-body {
  display: grid;
  gap: 0;
}

.market-ai-placeholder,
.market-ai-loading {
  color: #64748b;
}

.market-ai-loading::after {
  content: '';
  display: inline-block;
  width: 0.6ch;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: currentColor;
  opacity: 0.75;
  animation: market-ai-caret-blink 0.9s steps(1, end) infinite;
}

.market-ai-error {
  color: #b91c1c;
}

.market-ai-chat-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.market-ai-chat-bubble {
  white-space: normal;
  line-height: 1.7;
  font-size: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  max-width: 90%;
  overflow-wrap: anywhere;
}

.market-ai-result h3,
.market-ai-result h4,
.market-ai-result h5,
.market-ai-chat-bubble h3,
.market-ai-chat-bubble h4,
.market-ai-chat-bubble h5 {
  margin: 0 0 8px;
  line-height: 1.45;
}

.market-ai-result p,
.market-ai-chat-bubble p {
  margin: 0 0 10px;
}

.market-ai-result p:last-child,
.market-ai-chat-bubble p:last-child,
.market-ai-result h3:last-child,
.market-ai-result h4:last-child,
.market-ai-result h5:last-child,
.market-ai-chat-bubble h3:last-child,
.market-ai-chat-bubble h4:last-child,
.market-ai-chat-bubble h5:last-child {
  margin-bottom: 0;
}

.market-ai-result code,
.market-ai-chat-bubble code {
  background: rgba(148, 163, 184, 0.16);
  border-radius: 6px;
  padding: 1px 6px;
  font-family: "SFMono-Regular", "JetBrains Mono", "Consolas", monospace;
  font-size: 0.92em;
}

.market-ai-chat-bubble.user {
  align-self: flex-end;
  background: #e0f2fe;
  color: #0f172a;
}

.market-ai-chat-bubble.assistant {
  align-self: flex-start;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}

.market-ai-chat-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.market-ai-chat-form textarea {
  min-height: 88px;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

.market-ai-chat-actions {
  display: flex;
  justify-content: flex-end;
}

.market-chart-detail {
  overflow: visible;
}

.market-chart-detail polygon {
  stroke: none;
  fill: currentColor;
}

.market-chart-guide {
  stroke: rgba(100, 116, 139, 0.18);
  stroke-width: 1;
  stroke-dasharray: 4 6;
}

.market-chart-reference {
  stroke-width: 2;
  stroke-dasharray: 6 6;
}

.market-chart-reference.prev-close {
  stroke: rgba(37, 99, 235, 0.72);
}

.market-chart-reference.cost-price {
  stroke: rgba(245, 158, 11, 0.82);
}

.market-chart-marker {
  fill: #ffffff;
  stroke: currentColor;
  stroke-width: 3;
}

@media (max-width: 1200px) {
  .workspace { grid-template-columns: 1fr; }
  .manuscript-layout { grid-template-columns: 1fr; }
  .json-tool-grid { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .market-layout { grid-template-columns: 1fr; }
  .market-sidebar {
    position: static;
    min-height: auto;
  }
  .market-board-content {
    grid-template-columns: 1fr;
  }
  .market-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .market-toolbar-left,
  .market-toolbar-right {
    flex-direction: column;
  }
  .market-card-grid,
  .market-card-grid-watchlist,
  .market-card-grid-compact { grid-template-columns: 1fr; }
  .market-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-detail-trend-layout { grid-template-columns: 1fr; }
  .preview-panel, .result-panel { min-height: auto; }
  .preview-image, .empty { min-height: 320px; }
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .container { padding: 16px; }
  .page-header { flex-direction: column; align-items: stretch; }
  .page-header-tools { justify-content: space-between; }
  .header-user-menu { justify-content: flex-start; }
  .panel { padding: 16px; border-radius: 14px; }
  .profile-meta-grid { grid-template-columns: 1fr; }
  .panel-title {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .panel-title h2,
  .panel-title h3 {
    line-height: 1.35;
  }
  .market-detail-actions {
    width: 100%;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 8px;
  }
  .market-detail-actions > * {
    min-width: 0;
  }
  .market-detail-actions .secondary,
  .market-detail-actions .primary,
  .market-detail-actions .market-model-picker {
    width: 100%;
  }
  .market-model-picker {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 10px 12px;
  }
  .market-model-picker span {
    font-size: 12px;
  }
  .market-model-picker select {
    min-width: 0;
    width: 100%;
    font-size: 14px;
  }
  .login-page {
    min-height: 100dvh;
    padding: 14px;
    place-items: start center;
  }
  .login-shell {
    max-width: 680px;
  }
  .login-card {
    grid-template-columns: 1fr;
    min-height: auto;
    border-radius: 24px;
  }
  .login-panel-form { padding: 26px 24px 24px; }
  .login-panel-visual {
    display: block;
    min-height: 220px;
    order: -1;
  }
  .login-header h1 { font-size: 26px; }
  .login-visual-content {
    inset: auto 22px 22px 22px;
    gap: 10px;
  }
  .login-visual-content h2 {
    font-size: 24px;
    max-width: none;
  }
  .password-toggle {
    min-width: 52px;
    padding: 0 10px;
  }
  .captcha-row { grid-template-columns: 1fr; }
  .captcha-trigger,
  .captcha-trigger-content {
    min-height: 66px;
  }
  .captcha-modal {
    align-items: flex-start;
    height: 100dvh;
    padding: 12px;
  }
  .reminder-layout { grid-template-columns: 1fr; }
  .reminder-summary-grid,
  .reminder-board-grid { grid-template-columns: 1fr; }
  .captcha-visual { justify-content: space-between; }
  .captcha-dialog {
    padding: 18px;
  }
  .captcha-dialog-head {
    flex-direction: column;
  }
  .captcha-dialog-close,
  .captcha-refresh {
    width: 100%;
  }
  .captcha-dialog-actions {
    justify-content: stretch;
  }
  .admin-header-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .admin-header-actions .secondary,
  .admin-header-actions .link-button,
  .admin-header-actions form {
    width: 100%;
  }
  .admin-inline-form { grid-template-columns: 1fr; }
  .admin-user-head,
  .manuscript-form-actions,
  .admin-user-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .manuscript-summary-grid { grid-template-columns: 1fr; }
  .json-tool-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .json-tool-action-section {
    align-items: stretch;
  }
  .json-tool-action-section + .json-tool-action-section {
    padding-left: 0;
    padding-top: 10px;
    border-left: 0;
    border-top: 1px solid #dbe5f0;
  }
  .json-tool-action-group {
    width: 100%;
    align-items: stretch;
  }
  .json-tool-action-group .market-model-picker {
    min-width: 0;
    width: 100%;
  }
  .json-model-picker {
    min-width: 0;
    width: 100%;
  }
  .finance-news-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  .finance-news-table,
  .finance-news-table tbody,
  .finance-news-table tr,
  .finance-news-table td {
    display: block;
    width: 100%;
  }
  .finance-news-table thead {
    display: none;
  }
  .finance-news-table tbody {
    display: grid;
    gap: 10px;
  }
  .finance-news-table tbody tr {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
  }
  .finance-news-table td {
    border-bottom: 0;
    padding: 0;
  }
  .finance-news-time-cell,
  .finance-news-source-cell {
    display: none;
  }
  .finance-news-content-cell {
    padding: 12px 14px;
  }
  .finance-news-mobile-meta {
    display: block;
  }
  .finance-news-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .finance-news-pagination {
    justify-content: space-between;
  }
  .app-tabs { display: flex; width: 100%; }
  .app-tab { flex: 1; }
  .user-menu-trigger {
    width: 100%;
    justify-content: space-between;
  }
  .market-layout { gap: 12px; }
  .market-board { gap: 12px; }
  .market-board-section { gap: 8px; }
  .market-card-grid { gap: 10px; }
  .market-cache-meta { font-size: 12px; }
  .market-table-shell {
    border-radius: 12px;
  }
  .market-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .market-table th,
  .market-table td { padding: 8px 10px; font-size: 12px; }
  .market-card,
  .market-card-featured { min-height: 176px; padding: 10px; }
  .market-card-title { font-size: 14px; }
  .market-price { font-size: 20px; }
  .market-chart-wrap { min-height: 76px; }
  .market-chart,
  .market-chart-empty { height: 68px; min-height: 68px; }
  .market-card-head,
  .market-price-row {
    align-items: flex-start;
  }
  .market-badge {
    padding: 4px 8px;
    font-size: 11px;
  }
  .market-detail-grid { grid-template-columns: 1fr; }
  .market-detail-trend-head {
    flex-direction: column;
    align-items: stretch;
  }
  .market-period-switch {
    width: 100%;
  }
  .market-period-btn {
    flex: 1 1 calc(50% - 8px);
    text-align: center;
  }
  .market-trend-side {
    grid-template-columns: 1fr 1fr;
  }
  .market-detail-block {
    padding: 12px;
    gap: 8px;
  }
  .market-detail-meta,
  .market-detail-axis,
  .market-detail-chart-stats {
    font-size: 12px;
    gap: 8px;
  }
  .market-modal-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    margin: 8px auto;
    padding: 12px;
    border-radius: 14px;
  }
  .market-modal-dialog-narrow {
    width: calc(100vw - 16px);
  }
  .market-detail-content {
    gap: 12px;
  }
  .market-ai-panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .market-ai-collapse-toggle,
  .market-ai-collapse-meta {
    width: 100%;
  }
  .market-ai-collapse-meta {
    justify-content: space-between;
  }
  .market-ai-result {
    font-size: 13px;
    line-height: 1.7;
    min-height: 96px;
  }
  .market-ai-structured-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .market-ai-chat-bubble {
    max-width: 100%;
    padding: 10px 12px;
    font-size: 13px;
  }
  .market-ai-chat-form {
    gap: 8px;
  }
  .market-ai-chat-form textarea {
    min-height: 76px;
    padding: 10px 12px;
    font-size: 14px;
  }
  .market-ai-chat-actions {
    justify-content: stretch;
  }
  .market-ai-chat-actions .primary,
  .market-ai-chat-actions .secondary {
    width: 100%;
  }
  .status-banner { padding: 12px 14px; margin-bottom: 12px; }
}

@media (max-width: 420px) {
  .login-page {
    padding: 10px;
  }
  .login-card {
    border-radius: 20px;
  }
  .login-panel-form {
    padding: 22px 16px 18px;
  }
  .login-panel-visual {
    min-height: 168px;
  }
  .login-form {
    gap: 10px;
    margin-top: 22px;
  }
  .login-form input {
    border-radius: 12px;
    font-size: 16px;
    padding: 12px 13px;
  }
  .remember-row {
    align-items: flex-start;
  }
  .captcha-trigger-content {
    padding: 14px;
  }
  .captcha-trigger-hint {
    line-height: 1.4;
  }
  .captcha-dialog {
    width: 100%;
    padding: 14px;
    border-radius: 20px;
  }
  .captcha-dialog-actions {
    flex-direction: column;
  }
  .container {
    padding: 12px;
  }
  .app-tabs {
    gap: 6px;
    padding: 4px;
    border-radius: 14px;
  }
  .app-tab {
    padding: 9px 10px;
    font-size: 13px;
  }
  .panel {
    padding: 14px;
  }
  .market-card,
  .market-card-featured {
    min-height: 164px;
    padding: 9px;
  }
  .market-price {
    font-size: 18px;
  }
  .market-card-foot,
  .market-card-meta,
  .market-note {
    font-size: 12px;
  }
  .market-modal-dialog,
  .market-modal-dialog-narrow {
    width: calc(100vw - 12px);
    max-height: calc(100vh - 12px);
    margin: 6px auto;
    padding: 10px;
  }
}

.market-position-history-table td:last-child {
  min-width: 280px;
}

.market-modal-backdrop-locked {
  cursor: not-allowed;
}

.market-ai-conclusion-card,
.market-ai-comparison-card {
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(241, 245, 249, 0.82));
}

.market-ai-conclusion-text {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.market-ai-conclusion-meta,
.market-ai-comparison-summary {
  margin-top: 8px;
  font-size: 13px;
  color: #64748b;
}

.market-ai-comparison-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.market-ai-comparison-item {
  display: grid;
  grid-template-columns: minmax(72px, auto) 1fr auto 1fr;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: #334155;
}

.market-ai-details {
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
}

.market-ai-details summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 600;
  color: #0f172a;
}

.market-ai-details[open] summary {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.market-ai-details .market-ai-body {
  padding: 0 16px 16px;
}

.market-ai-source-list {
  display: grid;
  gap: 12px;
}

.market-ai-source-item {
  display: grid;
  gap: 6px;
  padding: 12px 0;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}

.market-ai-source-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.market-ai-source-title {
  color: #0f172a;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.market-ai-source-link {
  color: #2563eb;
  font-size: 13px;
  line-height: 1.5;
  word-break: break-all;
  text-decoration: none;
}

.market-ai-source-link:hover {
  text-decoration: underline;
}

@keyframes market-ai-caret-blink {
  0%, 48% { opacity: 0.75; }
  49%, 100% { opacity: 0; }
}
