:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f0f4f8;
  --text: #17202a;
  --muted: #667085;
  --line: #dbe3ed;
  --brand: #1f7a8c;
  --brand-2: #2ec4b6;
  --accent: #f6b73c;
  --danger: #e5484d;
  --shadow: 0 18px 50px rgba(22, 34, 51, 0.12);
  --shadow-soft: 0 10px 28px rgba(22, 34, 51, 0.08);
  --ring: 0 0 0 4px rgba(46, 196, 182, 0.14);
}

.admin-page {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(9, 78, 94, 0.08), rgba(233, 154, 48, 0.08)),
    var(--bg);
}

.admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
}

.admin-back-link {
  margin-top: auto;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  background: var(--surface);
}

.admin-main {
  min-width: 0;
  padding: 28px;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.admin-topbar h1,
.login-card h2 {
  margin: 4px 0 0;
}

.admin-login {
  min-height: calc(100vh - 120px);
  display: grid;
  place-items: center;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--surface-soft);
}

.admin-workspace.hidden,
.admin-login.hidden {
  display: none;
}

.admin-panel {
  display: none;
}

.admin-panel.active {
  display: block;
}

.metric-card {
  min-height: 132px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 10px 0;
  font-size: 34px;
}

.table-wrap {
  overflow: auto;
}

.empty-state,
.form-error {
  display: block;
  color: #b42318;
  font-size: 13px;
  line-height: 1.6;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.admin-table th,
.admin-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

.admin-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

@media (max-width: 860px) {
  .admin-page {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-main {
    padding: 18px;
  }

  .admin-form-grid {
    grid-template-columns: 1fr;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(46, 196, 182, 0.16), transparent 32rem),
    linear-gradient(180deg, #fbfcfe 0%, var(--bg) 100%);
  color: var(--text);
  font-family:
    Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 0;
  box-shadow: var(--ring);
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  height: 100vh;
  min-height: 0;
  padding: 18px 14px;
  background: rgba(255, 255, 255, 0.82);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(14px);
  box-shadow: 14px 0 40px rgba(22, 34, 51, 0.04);
  overflow: hidden;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 3px;
  border-radius: 50%;
  background: #fff;
  color: #fff;
  font-weight: 800;
  border: 1px solid rgba(219, 231, 238, 0.85);
  box-shadow: 0 12px 24px rgba(31, 122, 140, 0.28);
  overflow: hidden;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.quota-panel small,
.eyebrow,
.hero-copy span {
  color: var(--muted);
  font-size: 12px;
}

.new-chat,
.nav-item,
.section-title button,
.toolbar input,
.toolbar select,
.composer,
.tool-panel,
.preview-panel,
.mindmap,
.account-card,
.plan-card {
  border: 1px solid var(--line);
  background: var(--panel);
}

.new-chat {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--brand);
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}

kbd {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  color: #2b3440;
  text-align: left;
}

.nav-item.active {
  border-color: rgba(31, 122, 140, 0.3);
  background: #e8f6f5;
  color: #105f6e;
  font-weight: 800;
  box-shadow: inset 3px 0 0 var(--brand);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--brand);
  position: relative;
  flex: 0 0 auto;
}

.nav-icon::before,
.nav-icon::after {
  content: "";
  position: absolute;
}

.icon-chat::before {
  width: 13px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 5px;
}

.icon-chat::after {
  width: 5px;
  height: 5px;
  left: 5px;
  bottom: 4px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: skew(-18deg);
}

.icon-project::before {
  width: 13px;
  height: 16px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.icon-project::after {
  width: 8px;
  height: 2px;
  top: 7px;
  background: currentColor;
  box-shadow: 0 5px 0 currentColor;
}

.icon-apps::before {
  left: 50%;
  top: 50%;
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 5px;
  box-sizing: border-box;
  opacity: 0.88;
  transform: translate(-50%, -50%);
}

.icon-apps::after {
  left: 50%;
  top: 50%;
  width: 3px;
  height: 3px;
  border-radius: 1.5px;
  background: currentColor;
  box-shadow:
    6px 0 0 currentColor,
    0 6px 0 currentColor,
    6px 6px 0 currentColor;
  transform: translate(-4.5px, -4.5px);
}

.icon-draw::before {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: linear-gradient(135deg, currentColor 0 48%, transparent 50%);
  border: 2px solid currentColor;
}

.icon-mind::before {
  width: 14px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 -5px 0 currentColor, 0 5px 0 currentColor;
}

.icon-mind::after {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  left: 4px;
  top: 4px;
  box-shadow: 9px 5px 0 currentColor;
}

.icon-user::before {
  width: 7px;
  height: 7px;
  top: 4px;
  border-radius: 50%;
  background: currentColor;
}

.icon-user::after {
  width: 13px;
  height: 7px;
  bottom: 4px;
  border-radius: 10px 10px 4px 4px;
  background: currentColor;
}

.icon-pdf::before {
  width: 12px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.icon-pdf::after {
  content: "P";
  font-size: 8px;
  font-weight: 900;
  line-height: 1;
}

.icon-ticket::before {
  width: 14px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.icon-ticket::after {
  width: 2px;
  height: 8px;
  border-radius: 2px;
  background: currentColor;
  box-shadow: 4px 0 0 currentColor;
}

.icon-admin::before {
  width: 14px;
  height: 10px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}

.icon-admin::after {
  width: 3px;
  height: 12px;
  bottom: 5px;
  background: currentColor;
  box-shadow: 5px 4px 0 currentColor, 10px -2px 0 currentColor;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.history-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.history-tabs button {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.history-tabs button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 8px 18px rgba(22, 34, 51, 0.08);
}

.section-title button,
.row-actions button,
.export-row button,
.composer-tools button,
.plan-card button,
.primary,
.chip,
.login-btn,
.icon-btn,
.icon-close {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  min-height: 36px;
  padding: 0 12px;
}

.history-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(31, 122, 140, 0.38) transparent;
}

.history-list::-webkit-scrollbar {
  width: 6px;
}

.history-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(31, 122, 140, 0.34);
}

.history-list::-webkit-scrollbar-track {
  background: transparent;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 8px 8px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid transparent;
  font-size: 14px;
  text-align: left;
}

.history-item.active {
  border-color: #b6dde0;
  background: #eef9f8;
}

.history-main {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.history-spark {
  flex: 0 0 auto;
  color: #4f7cff;
}

.history-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-app-badge {
  flex: 0 0 auto;
  max-width: 68px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(46, 196, 182, 0.12);
  color: var(--brand);
  font-size: 11px;
  font-weight: 800;
}

.history-empty {
  padding: 14px 10px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.history-actions {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  opacity: 0.72;
}

.history-item:hover .history-actions,
.history-item.active .history-actions {
  opacity: 1;
}

.history-action {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  color: #4f7cff;
  font-size: 14px;
  line-height: 1;
}

.history-action:hover,
.history-action:focus-visible,
.history-action.active {
  background: rgba(79, 124, 255, 0.1);
  outline: 0;
}

.history-action.delete {
  color: #ef4444;
}

.history-action.delete:hover,
.history-action.delete:focus-visible {
  background: rgba(239, 68, 68, 0.1);
}

.quota-panel {
  margin-top: auto;
  position: relative;
  min-height: 38px;
  padding: 7px 12px 9px;
  border-radius: 8px;
  background: #102a34;
  color: #fff;
  box-shadow: 0 10px 24px rgba(16, 42, 52, 0.16);
  overflow: hidden;
}

.quota-panel div:first-child {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quota-panel span {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  line-height: 1;
}

.quota-panel strong {
  font-size: 15px;
  line-height: 1;
}

.quota-bar {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 5px;
  height: 4px;
  margin: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.quota-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.quota-panel small {
  display: none;
}

.workspace-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.workspace-status strong,
.workspace-status small {
  display: block;
}

.workspace-status strong {
  font-size: 13px;
}

.workspace-status small {
  color: var(--muted);
  font-size: 11px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #29b36a;
  box-shadow: 0 0 0 6px rgba(41, 179, 106, 0.12);
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  overflow: hidden;
  padding: 18px 22px 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.54), transparent 220px),
    transparent;
}

.topbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 62px;
}

.topbar h1 {
  margin: 3px 0 0;
  font-size: clamp(22px, 3vw, 34px);
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0;
  font-weight: 800;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(20, 31, 44, 0.08);
}

.top-actions .chip[hidden] {
  display: none !important;
}

.chip.nav-pill {
  min-width: auto;
  height: 38px;
  padding: 0 15px;
  border: 1px solid rgba(14, 116, 144, 0.18);
  background: rgba(255, 255, 255, 0.78);
  color: #0f4f5c;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  backdrop-filter: blur(18px);
}

.chip.nav-pill:hover {
  border-color: rgba(14, 116, 144, 0.34);
  background: rgba(238, 252, 253, 0.96);
  box-shadow: 0 12px 28px rgba(14, 116, 144, 0.13);
}

.chip.nav-pill span {
  top: -7px;
  right: -5px;
  background: #0f766e;
}

.chip.wide {
  min-width: 136px;
  padding: 0 16px;
}

.lang-chip {
  min-width: 48px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
}

.chip span {
  position: absolute;
  top: -8px;
  right: -4px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
}

.login-btn,
.primary,
.send-btn {
  border-color: transparent;
  background: #111827;
  color: #fff;
  font-weight: 800;
}

.user-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: #111827;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.18);
}

.avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 22px rgba(22, 34, 51, 0.16);
}

.ai-avatar {
  background: linear-gradient(135deg, #1f7a8c, #2ec4b6);
}

.user-avatar {
  background: linear-gradient(135deg, #111827, #556070);
}

.scholar-avatar {
  background: linear-gradient(135deg, #f6b73c, #d66a2f);
}

.message-logo-avatar {
  background: #fff;
  color: transparent;
  overflow: hidden;
}

.message-logo-avatar img {
  width: 28px;
  height: 28px;
  display: block;
  object-fit: contain;
  border-radius: 0;
}

.view {
  display: none;
  flex: 1;
  min-height: 0;
  padding-top: 16px;
  padding-bottom: 18px;
  overflow-y: auto;
}

.view.active {
  display: block;
}

.workspace:has(#chatView.active) {
  overflow: hidden;
}

#chatView.active {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
  overflow: hidden;
}

#chatView .hero-strip,
#chatView .insight-row {
  flex: 0 0 auto;
}

#chatView .hero-strip {
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  padding: 14px 18px;
}

#chatView .hero-strip::after,
#chatView .hero-visual {
  display: none;
}

#chatView .hero-copy h2 {
  margin: 4px 0;
  font-size: 22px;
}

#chatView .hero-copy p {
  max-width: 880px;
  line-height: 1.5;
}

#chatView .insight-row {
  display: none;
}

#chatView .insight-row article {
  padding: 8px 10px;
}

#chatView .insight-row strong {
  margin: 2px 0;
  font-size: 20px;
}

.site-footer {
  display: flex;
  flex: 0 0 auto;
  justify-content: center;
  align-items: center;
  min-height: 30px;
  margin: 0 -22px;
  padding: 2px 22px 3px;
  border-top: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  text-align: center;
  box-shadow: none;
  backdrop-filter: none;
  z-index: 4;
}

.site-footer-inner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 100%;
  min-height: 24px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 800;
}

.site-footer a:hover {
  color: var(--brand);
  text-decoration: underline;
}

.hero-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 22px;
  min-height: 180px;
  padding: 24px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(31, 122, 140, 0.94), rgba(20, 46, 58, 0.96)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cpath d='M0 80h160M80 0v160' stroke='%23ffffff' stroke-opacity='.12'/%3E%3C/svg%3E");
  color: #fff;
  overflow: hidden;
  position: relative;
  box-shadow: 0 24px 70px rgba(16, 42, 52, 0.16);
}

.hero-strip::after {
  content: "";
  position: absolute;
  inset: auto -80px -120px auto;
  width: 320px;
  height: 320px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}

.hero-copy h2 {
  margin: 10px 0;
  font-size: 30px;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 620px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.7;
}

.hero-copy span {
  color: rgba(255, 255, 255, 0.72);
  font-weight: 800;
}

.hero-visual {
  position: relative;
  min-height: 140px;
}

.avatar-stack {
  position: absolute;
  top: 2px;
  right: 10px;
  display: flex;
  z-index: 2;
}

.avatar-stack .avatar {
  width: 38px;
  height: 38px;
  margin-left: -9px;
}

.orbit-core,
.orbit-card {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-weight: 900;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

.orbit-core {
  inset: 42px 86px auto auto;
  width: 88px;
  height: 88px;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.88), transparent 30%),
    linear-gradient(135deg, #ffffff, #d9fbf7);
  color: var(--brand);
  font-size: 30px;
  border-radius: 50%;
}

.orbit-card {
  width: 62px;
  height: 42px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
}

.orbit-card.one {
  top: 12px;
  right: 128px;
}

.orbit-card.two {
  top: 72px;
  right: 8px;
}

.orbit-card.three {
  bottom: 6px;
  right: 128px;
}

.insight-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.insight-row article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-soft);
}

.insight-row span,
.insight-row small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.insight-row strong {
  display: block;
  margin: 5px 0;
  font-size: 26px;
  letter-spacing: 0;
}

.chat-layout {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  flex: 1 1 auto;
  gap: 12px;
  min-height: 0;
  margin-top: 0;
  overflow: hidden;
}

.chat-thread {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  padding: 6px 4px 12px 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(31, 122, 140, 0.4) transparent;
}

.chat-thread::-webkit-scrollbar {
  width: 8px;
}

.chat-thread::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(31, 122, 140, 0.34);
}

.chat-thread::-webkit-scrollbar-track {
  background: transparent;
}

.message-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  animation: messageIn 180ms ease-out both;
}

.message-row .avatar {
  flex: 0 0 34px;
  overflow: hidden;
}

.message-row.user {
  justify-content: flex-end;
}

.message-row.user .avatar {
  order: 2;
}

.message {
  max-width: min(760px, 92%);
  padding: 14px 16px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  line-height: 1.65;
  box-shadow: var(--shadow-soft);
}

.message.user {
  background: #e8f6f5;
  border-color: #bce1df;
}

.generated-media {
  display: block;
  width: min(100%, 520px);
  max-height: 520px;
  object-fit: contain;
  margin-top: 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: #fff;
}

.message.pending {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.message-model-avatar {
  display: grid;
  place-items: center;
  background: #e8f6f5;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

.message-status {
  display: block;
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.4;
}

.failure-status {
  color: #b45309;
}

.fallback-status {
  color: var(--muted);
}

.typing-copy {
  white-space: nowrap;
}

.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.typing-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2aa7a0;
  opacity: 0.35;
  animation: typingDot 900ms ease-in-out infinite;
}

.typing-dots i:nth-child(2) {
  animation-delay: 120ms;
}

.typing-dots i:nth-child(3) {
  animation-delay: 240ms;
}

.message small {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-weight: 800;
}

.prompt-strip {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  flex: 0 0 auto;
  max-height: 42px;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.prompt-chip {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #c9dde2;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #23505b;
  font-size: 13px;
}

.prompt-chip:hover {
  border-color: var(--brand);
  background: #eef9f8;
}

.composer {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
  padding: 12px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  border-color: rgba(31, 122, 140, 0.18);
  background: var(--panel);
}

.composer textarea,
.tool-panel textarea {
  width: 100%;
  resize: vertical;
  min-height: 96px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.composer textarea {
  min-height: 74px;
  max-height: 180px;
  resize: none;
}

.chat-file-input {
  display: none;
}

.composer-attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  margin: 8px 0 10px;
  padding: 8px 10px;
  border: 1px solid rgba(31, 122, 140, 0.18);
  border-radius: 8px;
  background: #f4fbfb;
}

.composer-attachment[hidden] {
  display: none;
}

.attachment-main {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.attachment-icon {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, #1f7a8c, #23c4c6);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.attachment-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.attachment-name {
  overflow: hidden;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-meta {
  color: var(--muted);
  font-size: 12px;
}

.attachment-remove {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.attachment-remove:hover {
  border-color: #ef6b6b;
  color: #d93030;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.model-selector-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: calc(100% - 96px);
}

.model-selector-label {
  flex: 0 0 auto;
  color: #111827;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.model-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: min(280px, 100%);
  min-height: 32px;
  padding: 0 4px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
  color: #111827;
}

.model-picker strong {
  min-width: 0;
  overflow: hidden;
  color: #111827;
  font-size: 16px;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-dot {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand-2);
}

.composer-tools {
  display: flex;
  gap: 8px;
}

.composer-tools button {
  position: relative;
  display: grid;
  place-items: center;
  width: 38px;
  padding: 0;
}

.upload-chat-btn {
  background: #fff;
  color: var(--brand);
}

.upload-chat-btn::before {
  content: "";
  width: 17px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 3px;
  box-sizing: border-box;
  transform: translateY(2px);
}

.upload-chat-btn::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 10px;
  width: 9px;
  height: 5px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 3px 3px 0 0;
  background: #fff;
  box-sizing: border-box;
}

.upload-chat-btn.loading::before {
  border-radius: 50%;
  border-top-color: transparent;
  transform: none;
  animation: uploadSpin 0.8s linear infinite;
}

.upload-chat-btn.loading::after {
  display: none;
}

.send-btn {
  overflow: hidden;
}

.send-loading {
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1px;
}

.send-btn svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transform: translateX(1px);
}

.composer-tools button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.send-btn.sending {
  background: #23505b;
}

@keyframes uploadSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes typingDot {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(180px, 220px);
  align-items: center;
  gap: 12px;
  margin: 14px 0 12px;
  padding: 10px;
  border: 1px solid rgba(219, 231, 238, 0.85);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-soft);
}

.page-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
  padding: 18px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(232, 246, 245, 0.92)),
    #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.page-summary h2 {
  margin: 8px 0 0;
  font-size: 24px;
  letter-spacing: 0;
}

.page-summary p {
  max-width: 540px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.toolbar input,
.toolbar select {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  padding: 0 12px;
}

.toolbar input {
  background: #fff;
}

.toolbar select {
  justify-self: end;
  color: var(--text);
  background: #fff;
  font-weight: 800;
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.category-pills button {
  border: 1px solid var(--line);
  border-radius: 999px;
  min-height: 34px;
  padding: 0 12px;
  background: #fff;
}

.category-pills button.active {
  color: var(--brand);
  border-color: #9ed8d5;
  background: #e8f6f5;
  font-weight: 800;
}

.project-toolbar {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid rgba(216, 227, 237, 0.92);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
}

.project-create,
.project-search {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px auto;
  gap: 10px;
}

.project-search {
  grid-template-columns: minmax(280px, 1.3fr) minmax(420px, 1fr) auto;
  align-items: center;
}

.project-search-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(94px, 0.72fr)) repeat(2, minmax(126px, 1fr));
  gap: 8px;
}

.project-toolbar input,
.project-toolbar select,
.project-panel input,
.project-panel select,
.project-panel textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(207, 220, 231, 0.96);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  font: inherit;
}

.project-panel textarea {
  min-height: 112px;
  padding: 12px;
  resize: vertical;
  line-height: 1.65;
}

.project-layout {
  display: grid;
  grid-template-columns: minmax(260px, 310px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.project-list-panel,
.project-main-panel,
.project-panel,
.project-hero-card {
  border: 1px solid rgba(216, 227, 237, 0.92);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(251, 253, 254, 0.98));
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
}

.project-list-panel {
  position: sticky;
  top: 14px;
  padding: 14px;
}

.project-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 310px);
  overflow: auto;
  padding-right: 4px;
}

.project-list-item,
.project-login-card {
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 86px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.project-list-item:hover,
.project-list-item.active {
  border-color: rgba(19, 123, 140, 0.36);
  background: #edfafa;
}

.project-list-item span,
.project-list-item small,
.project-empty-mini span,
.project-empty-state span {
  color: var(--muted);
  font-size: 12px;
}

.project-list-item strong {
  font-size: 14px;
  line-height: 1.35;
}

.project-main-panel {
  min-height: 520px;
  padding: 14px;
}

.project-empty-state,
.project-empty-mini {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 160px;
  padding: 18px;
  border: 1px dashed rgba(148, 163, 184, 0.34);
  border-radius: 8px;
  background: rgba(248, 252, 253, 0.72);
  text-align: center;
}

.project-empty-state strong,
.project-empty-mini strong {
  color: var(--text);
}

.project-hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
  padding: 18px;
  background:
    radial-gradient(circle at right top, rgba(47, 200, 189, 0.18), transparent 14rem),
    #fff;
}

.project-hero-card h2 {
  margin: 8px 0 6px;
  font-size: 23px;
}

.project-hero-card p {
  margin: 0;
  color: var(--muted);
}

.project-score {
  display: grid;
  place-items: center;
  flex: 0 0 104px;
  width: 104px;
  height: 104px;
  border: 1px solid rgba(19, 123, 140, 0.18);
  border-radius: 50%;
  background: #f2fbfb;
}

.project-score strong {
  color: #0f7180;
  font-size: 30px;
  line-height: 1;
}

.project-score span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.project-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.project-compliance-note {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding: 11px 12px;
  border: 1px solid rgba(181, 137, 0, 0.24);
  border-radius: 8px;
  background: #fffaf0;
}

.project-compliance-note strong {
  flex: 0 0 auto;
  color: #9a6700;
}

.project-compliance-note span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.project-metrics div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.project-metrics strong,
.project-metrics span {
  display: block;
}

.project-metrics strong {
  font-size: 22px;
}

.project-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.project-work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.project-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
}

.project-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.project-editor-panel {
  grid-row: span 2;
}

.project-editor-panel textarea:last-child {
  min-height: 220px;
}

@media (max-width: 1500px) {
  .project-work-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .project-editor-panel {
    grid-row: auto;
  }
}

.reference-list,
.evidence-list,
.deliverable-list,
.citation-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.reference-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.reference-item-critical {
  border-color: rgba(180, 35, 24, 0.38);
  background: #fff6f5;
}

.reference-index {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #e8f8f7;
  color: #0f7180;
  font-weight: 900;
}

.reference-item strong,
.reference-item small,
.reference-item p,
.reference-item em {
  display: block;
}

.reference-item small,
.reference-item p,
.reference-item em {
  color: var(--muted);
  font-size: 12px;
}

.reference-item p {
  margin: 6px 0 0;
  line-height: 1.55;
}

.reference-status {
  width: fit-content;
  margin-top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2f7;
  font-style: normal;
  font-weight: 900;
}

.reference-status.high,
.reference-status.needs_review {
  color: #b42318;
  background: #fee4e2;
}

.reference-status.partial,
.reference-status.medium {
  color: #b54708;
  background: #fff3d6;
}

.reference-status.verified_candidate,
.reference-status.candidate,
.reference-status.verified,
.reference-status.low {
  color: #067647;
  background: #dcfae6;
}

.reference-status.retracted,
.reference-status.critical {
  color: #fff;
  background: #b42318;
}

.reference-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.reference-actions .reference-status {
  margin-top: 0;
}

.reference-doi {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.source-link {
  width: fit-content;
  color: #087788;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.source-link:hover {
  text-decoration: underline;
}

.source-link-button {
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.project-document-note {
  padding: 9px 11px;
  border-left: 3px solid #0f7180;
  background: #f2fbfb;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.project-document-list {
  display: grid;
  gap: 8px;
  max-height: 310px;
  overflow-y: auto;
  padding-right: 3px;
}

.project-document-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(19, 123, 140, 0.16);
  border-radius: 8px;
  background: #fff;
}

.project-document-icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: #eaf8f8;
  color: #0f7180;
  font-size: 11px;
  font-weight: 900;
}

.project-document-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.project-document-copy strong,
.project-document-copy span,
.project-document-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-document-copy span,
.project-document-copy small {
  color: var(--muted);
  font-size: 12px;
}

.evidence-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(19, 123, 140, 0.16);
  border-radius: 8px;
  background: #f4fbfb;
}

.evidence-item span {
  color: #0f7180;
  font-size: 12px;
  font-weight: 900;
}

.evidence-item strong {
  display: block;
  margin: 4px 0;
  line-height: 1.5;
}

.evidence-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.evidence-item ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.evidence-matches {
  display: grid;
  gap: 8px;
}

.evidence-match {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(19, 123, 140, 0.16);
  border-radius: 8px;
  background: #fff;
}

.evidence-match.excluded {
  border-color: rgba(180, 35, 24, 0.3);
  background: #fff6f5;
}

.evidence-match-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.evidence-match-head strong {
  margin: 0;
  font-size: 13px;
}

.evidence-match-head span {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  color: #0f7180;
  background: #e8f8f7;
}

.evidence-match small,
.evidence-excerpt {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.evidence-match .evidence-excerpt {
  margin: 0;
}

.evidence-document-match {
  border-color: rgba(49, 125, 107, 0.22);
  background: #f8fcfb;
}

.evidence-document-match blockquote {
  margin: 0;
  padding: 9px 10px;
  border-left: 3px solid #2f7d6d;
  background: #fff;
  color: #31424b;
  font-size: 12px;
  line-height: 1.65;
}

.evidence-reasons {
  gap: 3px !important;
  font-size: 12px !important;
}

.evidence-disclaimer {
  padding: 9px 10px;
  border-left: 3px solid #b54708;
  border-radius: 0 6px 6px 0;
  color: #7a2e0e !important;
  background: #fff6e8;
  font-size: 12px !important;
  font-weight: 800;
  line-height: 1.55;
}

.deliverable-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(32, 109, 130, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(46, 196, 182, 0.08), rgba(255, 255, 255, 0) 62%),
    #f8fbfc;
}

.deliverable-item strong,
.deliverable-item span {
  display: block;
}

.deliverable-item strong {
  color: var(--text);
}

.deliverable-item span,
.deliverable-item p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.deliverable-item p {
  margin: 0;
}

.quality-checklist {
  display: grid;
  gap: 8px;
}

.quality-checklist div {
  display: grid;
  grid-template-columns: 26px minmax(0, 0.5fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8f1;
}

.quality-checklist div.ok {
  background: #f0fdf4;
}

.quality-checklist strong {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #fff;
  color: #b54708;
}

.quality-checklist .ok strong {
  color: #067647;
}

.quality-checklist span {
  font-weight: 900;
}

.quality-checklist small {
  color: var(--muted);
  line-height: 1.4;
}

.citation-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.citation-summary .citation-critical {
  border-color: rgba(180, 35, 24, 0.24);
  background: #fff6f5;
}

.citation-summary .citation-critical strong,
.citation-item.critical span {
  color: #b42318;
}

.citation-summary div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.citation-summary strong,
.citation-summary span {
  display: block;
}

.citation-summary strong {
  font-size: 20px;
}

.citation-summary span,
.citation-list span,
.citation-list small {
  color: var(--muted);
  font-size: 12px;
}

.citation-list article {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.citation-item.critical {
  border-color: rgba(180, 35, 24, 0.3);
  background: #fff6f5;
}

.app-grid,
.model-grid,
.account-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.app-card,
.model-card {
  min-height: 190px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.app-card:hover,
.model-card:hover,
.plan-card:hover {
  transform: translateY(-3px);
  border-color: rgba(31, 122, 140, 0.28);
  box-shadow: 0 18px 46px rgba(22, 34, 51, 0.12);
}

.model-card.unavailable {
  background: #f8fafc;
  border-style: dashed;
  opacity: 0.82;
}

.model-card.unavailable:hover {
  transform: none;
  box-shadow: var(--shadow-soft);
}

.model-status.pending {
  color: #b45309;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 900;
}

.app-card {
  display: grid;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.app-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2), var(--accent));
  opacity: 0;
  transition: opacity 180ms ease;
}

.app-card:hover::before {
  opacity: 1;
}

.app-card h3,
.model-card h3,
.plan-card h3 {
  margin: 0;
  font-size: 17px;
}

.app-card p,
.model-card p,
.tool-panel p,
.preview-panel p,
.plan-card p,
.account-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 14px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.app-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: #e8f6f5;
  color: var(--brand);
  font-size: 24px;
  font-weight: 900;
  position: relative;
  overflow: hidden;
  box-shadow: 0 14px 28px rgba(22, 34, 51, 0.12);
}

.app-icon::before {
  content: "";
  position: absolute;
  inset: -26px auto auto -20px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.34);
}

.app-icon span {
  position: relative;
  z-index: 1;
}

.skill-avatar-svg {
  position: relative;
  z-index: 1;
  width: 38px;
  height: 38px;
  color: #fff;
  filter: drop-shadow(0 6px 10px rgba(15, 23, 42, 0.14));
}

.skill-avatar-svg path,
.skill-avatar-svg circle,
.skill-avatar-svg ellipse,
.skill-avatar-svg line,
.skill-avatar-svg polyline,
.skill-avatar-svg polygon,
.skill-avatar-svg rect {
  fill: none;
  stroke: currentColor;
  stroke-width: 3.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.tone-teal {
  background: linear-gradient(135deg, #0e7490, #2dd4bf);
  color: #fff;
}

.tone-blue {
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  color: #fff;
}

.tone-amber {
  background: linear-gradient(135deg, #d97706, #facc15);
  color: #fff;
}

.tone-rose {
  background: linear-gradient(135deg, #e11d48, #fb7185);
  color: #fff;
}

.tone-violet {
  background: linear-gradient(135deg, #7c3aed, #c084fc);
  color: #fff;
}

.tone-green {
  background: linear-gradient(135deg, #15803d, #4ade80);
  color: #fff;
}

.tone-red {
  background: linear-gradient(135deg, #b91c1c, #fb923c);
  color: #fff;
}

.tone-slate {
  background: linear-gradient(135deg, #334155, #94a3b8);
  color: #fff;
}

.tone-cyan {
  background: linear-gradient(135deg, #0891b2, #67e8f9);
  color: #fff;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.star-btn {
  display: grid;
  place-items: center;
  position: relative;
  width: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid rgba(31, 122, 140, 0.18);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.98), rgba(255, 255, 255, 0) 44%),
    linear-gradient(180deg, #ffffff, #f7fbfc);
  color: var(--brand);
  box-shadow:
    0 8px 18px rgba(22, 34, 51, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.star-btn span::before {
  content: "☆";
  display: block;
  font-size: 19px;
  font-weight: 900;
  line-height: 1;
  transform: translateY(-1px);
}

.star-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(246, 183, 60, 0.5);
  color: #b7791f;
  box-shadow:
    0 12px 24px rgba(22, 34, 51, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.star-btn:focus-visible {
  outline: 3px solid rgba(246, 183, 60, 0.28);
  outline-offset: 2px;
}

.star-btn.active {
  border-color: rgba(246, 183, 60, 0.68);
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 42%),
    linear-gradient(135deg, #fff4d6 0%, #f6b73c 58%, #d89012 100%);
  color: #7c4a03;
  box-shadow:
    0 10px 24px rgba(246, 183, 60, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.star-btn.active span::before {
  content: "★";
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.app-card.favorited {
  border-color: rgba(246, 183, 60, 0.5);
  box-shadow:
    0 14px 34px rgba(246, 183, 60, 0.12),
    var(--shadow-soft);
}

.app-card.favorited::before {
  opacity: 1;
  background: linear-gradient(90deg, #f6b73c, var(--brand-2), var(--accent));
}

.app-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 180px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  text-align: center;
}

.app-empty strong {
  color: var(--text);
  font-size: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: #fff4dc;
  color: #8a5a00;
  font-size: 12px;
  font-weight: 800;
}

.app-meta,
.model-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  gap: 8px;
  flex-wrap: wrap;
}

.skill-detail-btn {
  border: 1px solid rgba(31, 122, 140, 0.24);
  border-radius: 8px;
  background: #f3fbfb;
  color: var(--brand);
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 900;
}

.skill-detail-btn:hover {
  border-color: rgba(31, 122, 140, 0.42);
  background: #e8f6f5;
  box-shadow: 0 8px 18px rgba(31, 122, 140, 0.1);
}

.app-use-count {
  margin-left: auto;
}

.app-use-btn,
.model-card button {
  border: 0;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  min-height: 34px;
  padding: 0 12px;
  font-weight: 800;
}

.model-card button:disabled {
  cursor: not-allowed;
  background: #94a3b8;
  color: #f8fafc;
  opacity: 0.85;
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(360px, 1.15fr);
  gap: 16px;
}

.tool-panel,
.preview-panel,
.mindmap,
.account-card,
.plan-card {
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.tool-panel h2,
.preview-panel h3,
.account-card h2 {
  margin: 0 0 8px;
}

.tool-panel textarea {
  min-height: 180px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.tool-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.tool-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tool-form-grid select,
.tool-panel select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--text);
  padding: 0 10px;
  font: inherit;
}

.tool-panel textarea + textarea {
  min-height: 96px;
  margin-top: 10px;
}

.tool-panel select {
  margin-top: 10px;
}

.upload-zone {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 168px;
  margin-top: 14px;
  padding: 18px;
  border: 1px dashed rgba(31, 122, 140, 0.38);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(46, 196, 182, 0.08), rgba(246, 183, 60, 0.08)),
    #fbfcfe;
  text-align: center;
  cursor: pointer;
}

.upload-zone input {
  display: none;
}

.upload-zone small {
  color: var(--muted);
}

.upload-icon,
.doc-avatar {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: linear-gradient(135deg, #e11d48, #fb7185);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 14px 28px rgba(225, 29, 72, 0.18);
}

.pdf-result {
  min-height: 420px;
}

.pdf-result ul {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.pdf-result li {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.admin-card.wide {
  grid-column: 1 / -1;
}

.admin-card h3,
.card-heading h3 {
  margin: 0 0 14px;
}

.data-foundation-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.data-foundation-section .card-heading {
  margin-bottom: 14px;
}

#refreshDataFoundationBtn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.data-foundation-section h2 {
  margin: 2px 0 4px;
  font-size: 20px;
}

.data-foundation-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.model-economics-shell {
  width: 100%;
  min-height: 1180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}

.model-economics-head,
.model-economics-section-head,
.model-economics-toolbar,
.model-economics-feedback,
.model-economics-trace-form {
  display: flex;
  align-items: center;
}

.model-economics-head,
.model-economics-section-head {
  justify-content: space-between;
  gap: 18px;
}

.model-economics-head h2,
.model-economics-section-head h3,
.model-economics-analysis-grid h4,
.model-economics-category-list h4 {
  margin: 0;
}

.model-economics-head h2 {
  margin-top: 2px;
  font-size: 22px;
}

.model-economics-head p:last-child,
.model-economics-section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.model-economics-toolbar {
  flex: 0 0 auto;
  gap: 10px;
}

.model-economics-range {
  display: grid;
  grid-template-columns: repeat(3, minmax(54px, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.model-economics-range button {
  min-height: 36px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 0 12px;
  color: var(--muted);
  background: #ffffff;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.model-economics-range button:last-child {
  border-right: 0;
}

.model-economics-range button.active {
  color: #ffffff;
  background: #0f766e;
}

.model-economics-range button:disabled,
.model-economics-toolbar button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.model-economics-feedback {
  min-height: 28px;
  margin-top: 8px;
  gap: 10px;
}

.model-economics-feedback .form-status {
  margin-right: auto;
}

.model-economics-feedback .admin-inline-btn {
  min-height: 32px;
}

.model-economics-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: #f8fafc;
}

.model-economics-metric {
  min-width: 0;
  min-height: 92px;
  padding: 12px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.model-economics-metric:nth-child(3n) {
  border-right: 0;
}

.model-economics-metric:nth-last-child(-n + 3) {
  border-bottom: 0;
}

.model-economics-metric span,
.model-economics-metric small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.model-economics-metric strong {
  display: block;
  overflow-wrap: anywhere;
  margin: 7px 0 5px;
  color: #153f48;
  font-size: 20px;
  line-height: 1.2;
}

.model-economics-metric.estimated strong {
  color: #8a4b08;
}

.model-economics-metric.warning strong,
.model-economics-metric.unknown strong {
  color: #a13d32;
}

.model-economics-metric.credits strong {
  color: #2458a6;
  font-size: 17px;
}

.model-economics-band {
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.model-economics-analysis-grid,
.model-economics-diagnostics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.model-economics-analysis-grid {
  margin-top: 14px;
}

.model-economics-analysis-grid > section,
.model-economics-diagnostics > section {
  min-width: 0;
}

.model-economics-analysis-grid h4 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.model-economics-model-filter {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.model-economics-model-filter select,
.model-economics-trace-form input,
.commercial-config-editor input,
.commercial-config-editor select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
  font-weight: 600;
}

.model-economics-model-filter select {
  width: min(280px, 36vw);
}

.model-economics-table-scroll {
  width: 100%;
  height: 282px;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  overscroll-behavior: contain;
}

.model-economics-table-scroll .admin-table th,
.model-economics-table-scroll .admin-table td {
  padding: 10px;
  font-size: 13px;
  line-height: 18px;
  vertical-align: top;
}

.model-economics-table-scroll .admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f7fa;
}

.model-economics-diagnostics {
  align-items: start;
}

.model-economics-alerts,
.model-economics-trace {
  height: 306px;
  margin-top: 12px;
  overflow: auto;
  border: 1px solid var(--line);
  padding: 12px;
  background: #fbfcfd;
  overscroll-behavior: contain;
}

.model-economics-alert-list,
.model-economics-category-list ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.model-economics-alert-item,
.model-economics-category-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  padding: 8px 10px;
  border-left: 3px solid #d0d5dd;
  background: #ffffff;
  font-size: 13px;
}

.model-economics-alert-item.warning {
  border-left-color: #d97706;
  background: #fff8eb;
}

.model-economics-alert-item.clear {
  border-left-color: #15956f;
  background: #edf9f4;
}

.model-economics-category-list {
  margin-top: 14px;
}

.model-economics-category-list h4 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.model-economics-trace-form {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 12px;
}

.model-economics-trace-form label {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.model-economics-trace-form input {
  width: 100%;
}

.model-economics-trace-form + .form-status {
  margin-top: 6px;
}

.model-economics-trace {
  height: 244px;
  margin-top: 4px;
}

.model-economics-trace-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.model-economics-trace-summary div {
  min-width: 0;
  padding: 8px;
  border-left: 2px solid #94a3b8;
  background: #ffffff;
}

.model-economics-trace-summary dt {
  color: var(--muted);
  font-size: 11px;
}

.model-economics-trace-summary dd {
  overflow-wrap: anywhere;
  margin: 3px 0 0;
  font-size: 13px;
  font-weight: 700;
}

.model-economics-trace-credits {
  margin: 10px 0;
  color: #2458a6;
  font-size: 13px;
  font-weight: 800;
}

.model-economics-trace-table {
  height: 282px;
}

.commercial-cost-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 8px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.commercial-cost-status.verified {
  color: #087a60;
  background: #e9f8f2;
}

.commercial-cost-status.estimated {
  color: #8a4b08;
  background: #fff3d6;
}

.commercial-cost-status.unknown {
  color: #596579;
  background: #eef1f5;
}

.model-economics-config-scroll {
  margin-top: 14px;
}

#commercialConfigEditor {
  z-index: 90;
}

.commercial-config-editor {
  width: min(860px, 100%);
}

.commercial-config-model,
.commercial-fallback-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.commercial-config-grid {
  margin-top: 14px;
}

.commercial-config-grid input,
.commercial-config-grid select {
  width: 100%;
}

.commercial-config-grid select[multiple] {
  min-height: 124px;
}

.commercial-config-grid input:disabled,
.commercial-config-grid select:disabled {
  color: #788497;
  background: #eef1f5;
  cursor: not-allowed;
}

.commercial-fallback-toggle {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.commercial-fallback-note {
  min-height: 20px;
}

.commercial-config-editor .admin-editor-actions button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.commercial-config-editor .form-status[data-state="error"] {
  color: #b42318;
}

.commercial-config-editor .form-status[data-state="success"] {
  color: #087a60;
}

body.dark .model-economics-shell,
body.dark .model-economics-metric,
body.dark .model-economics-range button,
body.dark .model-economics-model-filter select,
body.dark .model-economics-trace-form input,
body.dark .commercial-config-editor input,
body.dark .commercial-config-editor select,
body.dark .model-economics-alerts,
body.dark .model-economics-trace {
  border-color: rgba(125, 151, 176, 0.28);
  color: #edf5fb;
  background: rgba(16, 27, 40, 0.96);
}

body.dark .model-economics-range button.active {
  background: #0f766e;
}

body.dark .model-economics-table-scroll .admin-table th {
  background: #142233;
}

@media (max-width: 1100px) {
  .model-economics-analysis-grid,
  .model-economics-diagnostics {
    grid-template-columns: minmax(0, 1fr);
  }

  .model-economics-shell {
    min-height: 1740px;
  }
}

@media (max-width: 720px) {
  .model-economics-shell {
    min-height: 1840px;
    padding: 14px;
  }

  .model-economics-head,
  .model-economics-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .model-economics-toolbar,
  .model-economics-range,
  .model-economics-model-filter {
    width: 100%;
  }

  .model-economics-toolbar {
    align-items: stretch;
  }

  .model-economics-range {
    flex: 1 1 auto;
  }

  .model-economics-model-filter {
    justify-content: space-between;
  }

  .model-economics-model-filter select {
    width: min(70vw, 320px);
  }

  .model-economics-metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .model-economics-metric,
  .model-economics-metric:nth-child(3n),
  .model-economics-metric:nth-last-child(-n + 3) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .model-economics-metric:last-child {
    border-bottom: 0;
  }

  .model-economics-trace-form {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .model-economics-trace-form label {
    grid-column: 1 / -1;
  }

  .model-economics-trace-summary {
    grid-template-columns: minmax(0, 1fr);
  }
}

.card-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.primary-action,
.admin-inline-btn {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}

.primary-action {
  color: #ffffff;
  background: #0f766e;
}

.admin-inline-btn {
  border: 1px solid var(--line);
  color: var(--text);
  background: #ffffff;
}

.redemption-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.redemption-panel-feedback {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 20px;
  margin: -4px 0 12px;
}

.redemption-panel-feedback .form-status {
  margin-right: auto;
}

.redemption-admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.redemption-batch-form,
.redemption-batch-editor {
  display: grid;
  gap: 12px;
}

.redemption-batch-form label,
.redemption-batch-editor label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.redemption-batch-form input,
.redemption-batch-form select,
.redemption-batch-form textarea,
.redemption-batch-editor input,
.redemption-batch-editor textarea,
.redemption-filter-row input,
.redemption-filter-row select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
  font-weight: 600;
}

.redemption-batch-form textarea,
.redemption-batch-editor textarea {
  resize: vertical;
  line-height: 1.65;
}

.redemption-batch-form [hidden] {
  display: none;
}

.redemption-batch-list .card-heading {
  margin-bottom: 14px;
}

.redemption-batch-list #loadMoreRedemptionBatchesBtn,
.redemption-attempt-list #loadMoreRedemptionAttemptsBtn {
  margin-top: 12px;
}

.redemption-filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 180px;
  gap: 10px;
  margin-bottom: 12px;
}

.redemption-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 178px;
}

.redemption-table-actions .admin-inline-btn {
  min-height: 32px;
  padding: 0 10px;
}

.redemption-danger-btn {
  border-color: rgba(180, 35, 24, 0.3);
  color: #b42318;
  background: #fff7f6;
}

.redemption-code-list,
.redemption-attempt-list {
  margin-top: 16px;
}

.redemption-code-list .table-wrap {
  max-height: 420px;
  overflow: auto;
}

.redemption-code-list #loadMoreRedemptionCodesBtn {
  margin-top: 12px;
}

.redemption-batch-list .admin-inline-btn:disabled,
.redemption-attempt-list .admin-inline-btn:disabled {
  cursor: wait;
  opacity: 0.65;
}

.form-status {
  display: block;
  min-height: 20px;
  color: var(--muted);
  line-height: 1.45;
}

.redemption-batch-editor {
  width: min(480px, 100%);
}

body.dark .redemption-batch-form input,
body.dark .redemption-batch-form select,
body.dark .redemption-batch-form textarea,
body.dark .redemption-batch-editor input,
body.dark .redemption-batch-editor textarea,
body.dark .redemption-filter-row input,
body.dark .redemption-filter-row select,
body.dark .redemption-table-actions .admin-inline-btn {
  border-color: rgba(125, 151, 176, 0.28);
  color: #edf5fb;
  background: rgba(16, 27, 40, 0.96);
}

body.dark .redemption-danger-btn {
  border-color: rgba(255, 129, 119, 0.38);
  color: #ffb4ad;
  background: rgba(107, 29, 25, 0.38);
}

@media (max-width: 900px) {
  .redemption-admin-layout,
  .redemption-filter-row,
  .redemption-metrics {
    grid-template-columns: 1fr;
  }

  .redemption-table-actions {
    min-width: 224px;
  }
}

.admin-muted {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.admin-status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.admin-status.enabled {
  color: #067647;
  background: #dcfae6;
}

.admin-status.disabled {
  color: #b42318;
  background: #fee4e2;
}

.admin-skill-editor {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
}

.admin-skill-editor.open {
  display: grid;
}

.admin-skill-card {
  width: min(920px, 100%);
  max-height: min(820px, 92vh);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.admin-form-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-form-grid label.full {
  grid-column: 1 / -1;
}

.admin-form-grid input,
.admin-form-grid select,
.admin-form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #ffffff;
  font: inherit;
  font-weight: 600;
}

.admin-form-grid textarea {
  resize: vertical;
  line-height: 1.65;
}

.admin-toggle-row {
  align-content: start;
}

.admin-toggle-row input {
  width: 22px;
  height: 22px;
  padding: 0;
}

.admin-editor-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.admin-editor-actions small {
  margin-right: auto;
  color: var(--muted);
}

.admin-editor-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
  background: #ffffff;
}

.admin-editor-actions .primary-action {
  border: 0;
  background: #0f766e;
}

.admin-editor-actions.compact {
  margin-top: 12px;
}

.admin-message-manager {
  padding: 16px;
  border: 1px solid rgba(14, 116, 144, 0.14);
  border-radius: 8px;
  background: rgba(248, 252, 253, 0.86);
}

.message-manager-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.message-manager-head h4 {
  margin: 0 0 4px;
  color: #0f172a;
  font-size: 17px;
}

.message-manager-head p {
  margin: 0;
  color: #637189;
  font-size: 13px;
  line-height: 1.6;
}

.message-editor-grid {
  margin-top: 0;
}

.announcement-message-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.announcement-message-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
}

.announcement-message-list article.current {
  border-color: rgba(14, 116, 144, 0.24);
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.82), rgba(240, 249, 255, 0.88));
}

.announcement-message-list span {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(14, 116, 144, 0.1);
  color: #0f7f91;
  font-size: 12px;
  font-weight: 900;
}

.announcement-message-list h4 {
  margin: 8px 0 4px;
  color: #0f172a;
  font-size: 16px;
}

.announcement-message-list p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: #526178;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.announcement-message-list small {
  display: block;
  margin-top: 8px;
  color: #77849a;
}

.announcement-message-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.announcement-message-actions button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-weight: 800;
}

.announcement-message-actions button.danger {
  border-color: rgba(239, 68, 68, 0.18);
  color: #dc2626;
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.admin-metrics div,
.channel-list div,
.file-list div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.admin-metrics strong,
.admin-metrics span,
.channel-list strong,
.channel-list span,
.file-list strong,
.file-list span {
  display: block;
}

.admin-metrics strong {
  font-size: 24px;
}

.admin-metrics span,
.channel-list span,
.file-list span {
  color: var(--muted);
  font-size: 12px;
}

.channel-list,
.file-list {
  display: grid;
  gap: 10px;
}

.row-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.figure-preview {
  display: grid;
  grid-template-columns: 1fr 44px 1fr 44px 1fr;
  align-items: center;
  gap: 8px;
  min-height: 210px;
  padding: 18px;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(31, 122, 140, 0.08), rgba(246, 183, 60, 0.12)),
    #f7fafc;
  border: 1px solid rgba(31, 122, 140, 0.12);
}

.figure-preview span {
  display: grid;
  place-items: center;
  min-height: 78px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  font-weight: 800;
}

.figure-preview i {
  height: 2px;
  background: var(--brand);
}

.mindmap {
  min-height: 420px;
  background:
    linear-gradient(135deg, rgba(246, 183, 60, 0.12), rgba(46, 196, 182, 0.12)),
    #fff;
}

.mind-node {
  width: fit-content;
  margin: 32px auto;
  padding: 16px 22px;
  border-radius: 8px;
  background: #102a34;
  color: #fff;
  font-weight: 900;
}

.mind-branches {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.mind-branches span {
  display: grid;
  place-items: center;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(22, 34, 51, 0.06);
}

.export-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 28px;
}

.account-grid {
  align-items: stretch;
}

.account-card {
  grid-column: span 3;
  background: #102a34;
  color: #fff;
}

.account-summary {
  align-items: center;
}

.account-overview {
  grid-template-columns: 1.15fr 1fr 1fr;
  margin-bottom: 16px;
}

.account-overview .account-card {
  grid-column: auto;
  min-height: 230px;
}

.account-card p {
  color: rgba(255, 255, 255, 0.74);
}

.account-card h3 {
  margin: 8px 0 0;
  font-size: 18px;
}

.account-login-btn {
  margin-top: 16px;
}

.account-records {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.account-records .account-card {
  grid-column: auto;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.account-records .card-heading {
  align-items: flex-start;
}

.account-records .card-heading span,
.record-list > span {
  color: var(--muted);
  font-size: 13px;
}

.record-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.account-records .record-list {
  max-height: 444px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(96, 112, 134, 0.34) transparent;
}

.account-records .record-list::-webkit-scrollbar {
  width: 7px;
}

.account-records .record-list::-webkit-scrollbar-track {
  background: transparent;
}

.account-records .record-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(96, 112, 134, 0.28);
}

.account-records .record-list::-webkit-scrollbar-thumb:hover {
  background: rgba(96, 112, 134, 0.46);
}

.record-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfc;
}

.record-item strong,
.record-item span {
  display: block;
}

.record-item strong {
  font-size: 14px;
}

.record-item span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.record-item em {
  flex: 0 0 auto;
  font-style: normal;
  font-size: 13px;
  font-weight: 800;
  color: #6b7280;
  white-space: nowrap;
}

.record-item em.success {
  color: #0f766e;
}

.legal-page {
  min-height: 100vh;
  background: #f5f8fb;
  color: var(--text);
}

.legal-main {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0;
}

.legal-main h1 {
  margin: 18px 0 8px;
  font-size: 32px;
}

.legal-main section {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.legal-main h2 {
  margin: 0 0 10px;
  font-size: 18px;
}

.legal-main p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.pricing-card {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.pricing-card p {
  color: var(--muted);
  line-height: 1.7;
}

.pricing-card ul {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.pricing-card li {
  position: relative;
  padding-left: 18px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.pricing-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 7px;
  min-height: 7px;
  border-radius: 50%;
  background: var(--brand);
}

.pricing-card.accent {
  border-color: rgba(246, 183, 60, 0.42);
  background:
    radial-gradient(circle at 16% 10%, rgba(246, 183, 60, 0.18), rgba(246, 183, 60, 0) 28%),
    #fff;
}

.mini-funnel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 18px;
}

.mini-funnel span {
  display: grid;
  place-items: center;
  min-height: 38px;
  border-radius: 8px;
  background: #eef8f7;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.pricing-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin: 18px 0 12px;
}

.pricing-head h2 {
  margin: 8px 0 0;
}

.pricing-head p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.purchase-channel-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 16px 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.purchase-channel-bar > div {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.purchase-channel-bar strong {
  overflow-wrap: anywhere;
}

.redeem-code-btn {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(19, 123, 140, 0.25);
  border-radius: 8px;
  background: #f4fbfb;
  color: #0f7180;
  font: inherit;
  font-weight: 800;
  white-space: nowrap;
}

.redeem-code-btn:hover {
  background: #e8f8f7;
}

.ticket-icon {
  width: 16px;
  height: 12px;
  border: 2px solid currentColor;
  border-radius: 3px;
  background: linear-gradient(90deg, transparent 45%, currentColor 45%, currentColor 55%, transparent 55%);
}

.redemption-modal-card {
  width: min(520px, calc(100vw - 32px));
}

#redemptionModal {
  z-index: 100;
}

#redemptionForm {
  display: grid;
  gap: 14px;
}

.redemption-code-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.redemption-code-field input {
  width: 100%;
  min-height: 48px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  letter-spacing: 0;
  outline: none;
}

.redemption-code-field input:focus {
  border-color: rgba(19, 123, 140, 0.42);
  box-shadow: var(--ring);
}

.redemption-help {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.redemption-submit {
  width: 100%;
}

.redemption-result:empty {
  display: none;
}

.redemption-success {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(19, 123, 140, 0.2);
  border-radius: 8px;
  background: rgba(42, 167, 160, 0.08);
}

.redemption-success > strong {
  color: #0c6370;
}

.redemption-refresh-warning {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(245, 182, 66, 0.45);
  border-radius: 8px;
  background: #fff8e7;
}

.redemption-refresh-warning strong {
  color: #926100;
}

.redemption-refresh-warning p {
  margin: 0;
  color: var(--muted);
}

.redemption-refresh-warning button {
  justify-self: start;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(146, 97, 0, 0.28);
  border-radius: 8px;
  background: #ffffff;
  color: #765000;
  font: inherit;
  font-weight: 800;
}

.redemption-success p,
.redemption-success small {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.redemption-credit-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.redemption-credit-list span {
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
}

body.dark .purchase-channel-bar,
body.dark .redemption-code-field input,
body.dark .redemption-credit-list span {
  border-color: var(--apple-border-soft);
  background: var(--apple-surface-strong);
  color: var(--text);
}

body.dark .redeem-code-btn {
  border-color: rgba(47, 200, 189, 0.28);
  background: rgba(47, 200, 189, 0.1);
  color: #8ee8dc;
}

body.dark .redemption-success {
  border-color: rgba(47, 200, 189, 0.25);
  background: rgba(47, 200, 189, 0.1);
}

body.dark .redemption-success > strong {
  color: #8ee8dc;
}

body.dark .redemption-refresh-warning {
  border-color: rgba(246, 183, 60, 0.36);
  background: rgba(246, 183, 60, 0.12);
}

body.dark .redemption-refresh-warning strong,
body.dark .redemption-refresh-warning button {
  color: #f6d06d;
}

body.dark .redemption-refresh-warning button {
  background: rgba(16, 27, 40, 0.96);
}

@media (max-width: 640px) {
  .purchase-channel-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .redeem-code-btn {
    width: 100%;
  }

  .redemption-modal-card {
    width: 100%;
  }
}

.plan-top,
.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.plan-cycle,
.plan-audience {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.plan-subtitle {
  min-height: 45px;
}

.price-row {
  justify-content: flex-start;
  margin: 14px 0 6px;
}

.old-price {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
  text-decoration: line-through;
}

.plan-quota {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0;
}

.plan-quota div {
  padding: 10px 8px;
  border-radius: 8px;
  background: #f6fafb;
  text-align: center;
}

.plan-quota strong,
.plan-quota span {
  display: block;
}

.plan-quota strong {
  color: var(--text);
  font-size: 15px;
}

.plan-quota span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.plan-features {
  display: grid;
  gap: 8px;
  min-height: 128px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.plan-features li {
  position: relative;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.plan-features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 7px;
  min-height: 7px;
  border-radius: 50%;
  background: #35b7a8;
}

.plan-card.current {
  border-color: rgba(42, 167, 160, 0.52);
}

.plan-card .buy-plan-btn {
  width: 100%;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.metric-row div {
  padding: 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.metric-row strong,
.metric-row span {
  display: block;
}

.metric-row strong {
  font-size: 28px;
}

.metric-row span {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
}

.plan-card.featured {
  border-color: #f3c56a;
  box-shadow: 0 18px 46px rgba(246, 183, 60, 0.16);
}

.price {
  display: block;
  font-size: 30px;
}

.addon-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.addon-grid article {
  display: flex;
  flex-direction: column;
  min-height: 126px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.addon-grid span,
.addon-grid strong {
  display: block;
}

.addon-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.addon-grid strong {
  margin-top: 8px;
  color: var(--text);
  font-size: 22px;
}

.addon-grid p {
  flex: 1;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}

.addon-grid button {
  width: 100%;
  min-height: 40px;
  margin-top: 14px;
  border: 1px solid rgba(31, 122, 140, 0.26);
  border-radius: 8px;
  background: #102a34;
  color: #fff;
  font-weight: 900;
}

.addon-grid button:hover {
  background: var(--brand);
  box-shadow: 0 10px 22px rgba(42, 167, 160, 0.16);
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(10, 16, 24, 0.38);
  z-index: 20;
}

.modal.open {
  display: flex;
}

.modal-card {
  width: min(980px, 100%);
  max-height: 88vh;
  overflow: auto;
  padding: 18px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.skill-card {
  width: min(1120px, 100%);
  padding: 20px;
}

.skill-subtitle {
  max-width: 720px;
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.skill-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(360px, 1.1fr);
  gap: 16px;
  margin-top: 18px;
}

.skill-form,
.skill-output {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.skill-form {
  display: grid;
  gap: 14px;
  padding: 14px;
}

.skill-fields {
  display: grid;
  gap: 12px;
}

.skill-field {
  display: grid;
  gap: 8px;
}

.skill-field span {
  color: var(--text);
  font-size: 13px;
  font-weight: 900;
}

.skill-field b {
  color: #ef4444;
}

.skill-field input,
.skill-field select,
.skill-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
  outline: 0;
}

.skill-field input,
.skill-field select {
  min-height: 40px;
}

.skill-field textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.6;
}

.skill-field textarea.large {
  min-height: 180px;
}

.skill-field input:focus,
.skill-field select:focus,
.skill-field textarea:focus {
  border-color: #75a7ff;
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.14);
}

.skill-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.skill-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 0 16px;
  font-weight: 900;
}

.skill-output {
  min-height: 520px;
  padding: 16px;
  overflow: auto;
}

.skill-output h3 {
  margin: 12px 0 8px;
}

.skill-output p,
.skill-output li {
  color: var(--muted);
  line-height: 1.75;
}

.skill-answer {
  margin-top: 12px;
  color: var(--text);
  line-height: 1.78;
  white-space: normal;
}

.skill-evidence {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.skill-evidence li {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
}

.skill-evidence small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.skill-project-save {
  display: flex;
  gap: 10px;
  align-items: end;
  justify-content: space-between;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid rgba(19, 123, 140, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(46, 196, 182, 0.08), rgba(255, 255, 255, 0) 62%),
    #f8fbfc;
}

.skill-project-save label {
  display: grid;
  flex: 1;
  gap: 6px;
}

.skill-project-save label span,
.skill-project-save > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.55;
}

.skill-project-save select {
  width: 100%;
  min-height: 38px;
}

.skill-project-save button {
  white-space: nowrap;
}

.research-integrity-note {
  display: grid;
  gap: 4px;
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid rgba(181, 137, 0, 0.24);
  border-radius: 8px;
  background: #fffaf0;
}

.research-integrity-note strong {
  color: #9a6700;
}

.research-integrity-note span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.skill-output.loading {
  position: relative;
}

.skill-output.loading::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 16px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #2ec4b6;
  box-shadow: 18px 0 0 #4f7cff, 36px 0 0 #f6b73c;
  animation: skillPulse 900ms infinite ease-in-out;
}

@keyframes skillPulse {
  50% {
    opacity: 0.35;
    transform: translateY(-3px);
  }
}

.skill-detail-card {
  width: min(980px, 100%);
  padding: 22px;
}

.skill-detail-intro {
  max-width: 820px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.skill-detail-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr 1fr;
  gap: 14px;
  margin-top: 20px;
}

.skill-detail-grid article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(46, 196, 182, 0.06), rgba(255, 255, 255, 0) 40%),
    #fff;
  box-shadow: var(--shadow-soft);
}

.detail-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(31, 122, 140, 0.1);
  color: var(--brand);
  font-size: 11px;
  font-weight: 900;
}

.skill-detail-grid h3 {
  margin: 10px 0 10px;
  font-size: 16px;
}

.skill-detail-grid ol,
.skill-detail-grid ul {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 18px;
}

.skill-detail-grid li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.skill-detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.skill-detail-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 0 18px;
  font-weight: 900;
}

.skill-detail-actions .primary {
  border-color: transparent;
  background: #111827;
  color: #fff;
}

.skill-model-card {
  width: min(920px, calc(100vw - 32px));
  height: min(760px, calc(100dvh - 32px));
  max-height: none;
  padding: 24px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.skill-model-subtitle {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.skill-model-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 324px;
  align-content: start;
  gap: 16px;
  margin-top: 18px;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 8px 2px 0;
  scrollbar-width: thin;
}

.skill-model-tabs,
.skill-model-provider-tabs {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  min-height: 40px;
  padding: 2px 0 4px;
  line-height: 1;
}

.skill-model-tabs {
  margin-top: 18px;
}

.skill-model-provider-tabs {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(219, 231, 238, 0.8);
}

.skill-model-tabs button,
.skill-model-provider-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  color: var(--muted);
  background: #ffffff;
  font-weight: 900;
  cursor: pointer;
}

.skill-model-tabs button span,
.skill-model-provider-tabs button span {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  min-height: 20px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
}

.skill-model-tabs button.active {
  border-color: rgba(31, 122, 140, 0.5);
  color: #0f172a;
  background: #e8f7f6;
}

.skill-model-provider-tabs button.active {
  border-color: rgba(79, 124, 255, 0.35);
  color: #0f172a;
  background: rgba(79, 124, 255, 0.1);
}

.skill-model-option {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  height: 324px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.skill-model-option.current {
  border-color: rgba(31, 122, 140, 0.4);
  background: #f3fbfb;
}

.skill-model-option .model-logo {
  flex: 0 0 auto;
  position: static;
  width: 38px;
  height: 38px;
}

.skill-model-option .model-meta {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  min-height: 18px;
}

.skill-model-option .model-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-model-option h3 {
  margin: 0;
  min-height: 42px;
  color: var(--text);
  font-size: 17px;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.skill-model-option p {
  display: none !important;
}

.skill-model-cost {
  flex: 0 0 auto;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.skill-model-cost span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.skill-model-cost strong {
  color: var(--text);
  font-size: 13px;
}

.skill-model-confirmation {
  display: grid;
  gap: 3px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.skill-model-confirmation span,
.skill-model-confirmation strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-model-confirmation strong {
  color: var(--text);
  font-weight: 800;
}

.skill-model-option button {
  flex: 0 0 auto;
  width: 100%;
  min-height: 38px;
  border-radius: 8px;
}

.skill-model-card-actions {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 8px;
}

.skill-model-card-actions button {
  width: 100%;
  min-width: 0;
  padding: 0 10px;
  font-size: 13px;
  white-space: nowrap;
}

.skill-model-detail-btn {
  border: 1px solid rgba(31, 122, 140, 0.24);
  background: #f3fbfb;
  color: var(--brand);
  font-weight: 900;
}

.skill-model-detail-btn:hover {
  border-color: rgba(31, 122, 140, 0.42);
  background: #e8f6f5;
}

.skill-model-actions {
  flex: 0 0 auto;
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.skill-model-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 0 18px;
  font-weight: 900;
}

.model-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 160px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.model-empty strong {
  color: var(--text);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-head h2 {
  margin: 2px 0 0;
}

.chat-config-card {
  width: min(800px, 100%);
  padding: 20px;
}

.chat-config-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-config-title h2 {
  font-size: 20px;
}

.chat-config-gear {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: #4f7cff;
  font-size: 22px;
  line-height: 1;
}

.close-config-btn {
  color: #15803d;
  font-size: 24px;
}

.chat-config-form {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.chat-config-form label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.chat-config-form b {
  color: #ef4444;
}

.chat-config-form input,
.chat-config-form select,
.chat-config-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  outline: 0;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.05);
}

.chat-config-form input,
.chat-config-form select {
  min-height: 42px;
  padding: 0 12px;
}

.chat-config-form textarea {
  min-height: 80px;
  padding: 12px;
  resize: vertical;
}

.chat-config-form input:focus,
.chat-config-form select:focus,
.chat-config-form textarea:focus {
  border-color: #75a7ff;
  box-shadow: 0 0 0 3px rgba(79, 124, 255, 0.14);
}

.chat-config-advanced {
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: var(--panel-soft);
}

.chat-config-advanced summary {
  cursor: pointer;
  padding: 12px;
  color: var(--text);
  font-weight: 900;
  list-style: none;
}

.chat-config-advanced summary::-webkit-details-marker {
  display: none;
}

.chat-config-advanced summary::before {
  content: "›";
  display: inline-block;
  margin-right: 8px;
  font-size: 20px;
  line-height: 0;
  transform: translateY(2px);
}

.chat-config-advanced[open] summary::before {
  transform: rotate(90deg) translateX(2px);
}

.chat-config-advanced summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.chat-config-advanced p {
  margin: 0;
  padding: 0 12px 12px 30px;
  color: var(--muted);
  font-size: 13px;
}

.chat-config-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 2px;
}

.chat-config-actions button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  padding: 0 18px;
  font-weight: 900;
}

.icon-btn {
  width: 36px;
  padding: 0;
}

.icon-btn,
.icon-close {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  min-height: 38px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 50%;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 253, 0.92)),
    #ffffff;
  color: transparent;
  box-shadow:
    0 10px 22px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.82);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.icon-btn::before,
.icon-btn::after,
.icon-close::before,
.icon-close::after {
  content: "";
  position: absolute;
  width: 13px;
  height: 2px;
  border-radius: 999px;
  background: #0f172a;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.icon-btn::before,
.icon-close::before {
  transform: rotate(45deg);
}

.icon-btn::after,
.icon-close::after {
  transform: rotate(-45deg);
}

.icon-btn:hover,
.icon-close:hover {
  transform: translateY(-1px);
  border-color: rgba(31, 122, 140, 0.36);
  background:
    linear-gradient(180deg, #ffffff, #eefaf8),
    #ffffff;
  box-shadow:
    0 14px 28px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.icon-btn:hover::before,
.icon-btn:hover::after,
.icon-close:hover::before,
.icon-close:hover::after {
  background: #0f766e;
}

.icon-btn:active,
.icon-close:active {
  transform: translateY(0) scale(0.96);
  box-shadow:
    0 7px 14px rgba(15, 23, 42, 0.08),
    inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.icon-btn:focus-visible,
.icon-close:focus-visible {
  outline: 3px solid rgba(46, 196, 182, 0.24);
  outline-offset: 3px;
}

.model-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  margin: 16px 0 10px;
  line-height: 1;
}

.model-provider-tabs {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin: 0 0 16px;
  padding: 10px 12px;
  border: 1px solid #dbe7ee;
  border-radius: 8px;
  background: #f8fbfc;
  line-height: 1;
}

.model-tabs button,
.model-provider-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 0 12px;
  color: #344054;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.model-tabs button span,
.model-provider-tabs button span {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  margin-left: 0;
  border-radius: 999px;
  background: #eef4f8;
  color: inherit;
  font-size: 12px;
  opacity: 0.72;
}

.model-tabs button.active {
  background: #111827;
  color: #fff;
}

.model-tabs button.active span {
  background: rgba(255, 255, 255, 0.18);
}

.model-provider-tabs button {
  min-height: 32px;
  border-color: #cfdee6;
}

.model-provider-tabs button.active {
  border-color: rgba(31, 122, 140, 0.38);
  background: #e9f7f6;
  color: #125866;
}

.model-market-card {
  width: min(1080px, 100%);
  height: min(680px, 88vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.model-market-card .model-grid {
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 2px 6px 2px 0;
  align-content: start;
  grid-auto-rows: minmax(210px, auto);
  scrollbar-width: thin;
}

.model-card {
  min-height: 160px;
  position: relative;
  padding-top: 58px;
}

.model-market-card .model-card {
  display: flex;
  flex-direction: column;
  min-height: 210px;
}

.model-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

.model-card .model-detail-btn {
  border: 1px solid #c9dde2;
  background: #fff;
  color: #23505b;
}

.model-card .model-detail-btn:hover {
  border-color: rgba(31, 122, 140, 0.46);
  background: #eef9f8;
}

.model-placeholder {
  min-height: 210px;
  visibility: hidden;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

.model-placeholder:hover {
  transform: none;
  box-shadow: none;
}

.model-detail-card {
  width: min(720px, 100%);
}

#modelDetailModal.open {
  z-index: 30;
}

.model-detail-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.model-detail-body {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.model-detail-body section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.model-detail-body h3 {
  margin: 0 0 8px;
  color: #101828;
  font-size: 15px;
}

.model-detail-body p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.model-detail-body p + p {
  margin-top: 8px;
}

.model-detail-body ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: #344054;
  line-height: 1.6;
}

.model-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.model-detail-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eef9f8;
  color: #125866;
  font-weight: 800;
}

.model-card.current {
  border-color: #9ed8d5;
  background: #f2fbfa;
}

.model-logo {
  position: absolute;
  top: 14px;
  left: 14px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(22, 34, 51, 0.16);
}

.model-logo.image-logo {
  overflow: hidden;
  padding: 2px;
  background: #fff;
}

.model-logo.image-logo img {
  width: 100%;
  height: 100%;
  border-radius: 9px;
  object-fit: contain;
  display: block;
}

.model-logo.image-logo span {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.provider-openai {
  background: linear-gradient(135deg, #111827, #475569);
}

.provider-claude {
  background: linear-gradient(135deg, #9a3412, #f97316);
}

.provider-google {
  background: linear-gradient(135deg, #2563eb, #22c55e);
}

.provider-deepseek {
  background: linear-gradient(135deg, #1d4ed8, #06b6d4);
}

.provider-qwen {
  background: linear-gradient(135deg, #5b5cf6, #12b6cb);
}

.provider-kimi {
  background: linear-gradient(135deg, #111827, #00d6c9);
}

.provider-glm {
  background: linear-gradient(135deg, #050505, #2a2a2a);
}

.provider-ark {
  background: linear-gradient(135deg, #0f766e, #2563eb);
}

.provider-baidu {
  background: linear-gradient(135deg, #1d4ed8, #7c3aed);
}

.provider-hunyuan {
  background: linear-gradient(135deg, #0369a1, #0f766e);
}

.provider-spark {
  background: linear-gradient(135deg, #c2410c, #f59e0b);
}

.provider-baichuan {
  background: linear-gradient(135deg, #0f172a, #0891b2);
}

.provider-grok {
  background: linear-gradient(135deg, #18181b, #71717a);
}

.provider-draw {
  background: linear-gradient(135deg, #7c3aed, #ec4899);
}

.auth-card {
  width: min(460px, 100%);
  max-height: calc(100dvh - 32px);
  padding: 16px 18px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
  padding: 4px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.auth-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.auth-tabs button.active {
  background: #111827;
  color: #fff;
  box-shadow: 0 10px 24px rgba(17, 24, 39, 0.14);
}

.auth-login-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin: -2px 0 12px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.auth-login-methods button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-login-methods button.active {
  background: #eaf7f7;
  color: #075e6c;
  box-shadow: inset 0 0 0 1px rgba(19, 123, 140, 0.18);
}

.auth-form {
  display: grid;
  gap: 10px;
}

.auth-form[hidden],
.auth-login-methods[hidden],
.code-row[hidden],
.auth-form-links[hidden],
#passwordField[hidden],
#confirmPasswordField[hidden],
.auth-user-panel[hidden] {
  display: none;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.auth-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
}

.auth-form input:focus {
  border-color: #2aa7a0;
  box-shadow: 0 0 0 4px rgba(42, 167, 160, 0.12);
}

.code-row div {
  display: grid;
  grid-template-columns: 1fr 118px;
  gap: 8px;
}

.code-row button,
.auth-user-panel button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 900;
}

.code-row button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  background: var(--panel-soft);
}

.auth-submit {
  width: 100%;
  min-height: 44px;
  border-radius: 8px;
  margin-top: 4px;
}

.auth-form-links {
  display: flex;
  justify-content: flex-end;
  min-height: 30px;
  margin-top: -8px;
}

.auth-text-btn {
  min-height: 30px;
  padding: 0 2px;
  border: 0;
  background: transparent;
  color: #137b8c;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
}

.auth-text-btn:hover {
  color: #0b5964;
}

.session-review-card {
  width: min(440px, 100%);
  text-align: center;
}

.session-review-icon {
  display: grid;
  place-items: center;
  width: 52px;
  min-height: 52px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: #e7f7f5;
  color: #087f78;
  font-size: 24px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(8, 127, 120, 0.12);
}

.session-review-card h2 {
  margin: 6px 0 10px;
}

.session-review-card > p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.session-review-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 24px;
}

.session-review-actions button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 900;
}

.session-review-actions button.primary {
  border-color: #111827;
  background: #111827;
  color: #fff;
}

.session-review-actions button:disabled {
  cursor: wait;
  opacity: 0.62;
}

@media (max-width: 520px) {
  .session-review-actions {
    grid-template-columns: 1fr;
  }
}

.auth-user-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.auth-user-panel div {
  display: grid;
  gap: 4px;
}

.auth-user-panel span,
.auth-note {
  color: var(--muted);
  font-size: 13px;
}

.auth-note {
  margin: 10px 0 0;
  line-height: 1.6;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  box-shadow: var(--shadow);
  transition: 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.favorite-toast {
  left: 50%;
  right: auto;
  top: 50%;
  bottom: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid rgba(246, 183, 60, 0.5);
  border-radius: 999px;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0) 40%),
    linear-gradient(135deg, #fff8e6, #f6b73c);
  color: #653b02;
  font-weight: 900;
  box-shadow:
    0 18px 42px rgba(22, 34, 51, 0.18),
    0 8px 24px rgba(246, 183, 60, 0.24);
  transform: translate(-50%, -42%) scale(0.96);
}

.toast.favorite-toast::before {
  content: "★";
  display: grid;
  place-items: center;
  width: 22px;
  min-height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.58);
  color: #b7791f;
  font-size: 14px;
  line-height: 1;
}

.toast.favorite-toast.show {
  transform: translate(-50%, -50%) scale(1);
}

body.dark {
  --bg: #0f1720;
  --panel: #151f2b;
  --panel-soft: #1d2a38;
  --text: #ecf2f7;
  --muted: #a8b4c2;
  --line: #2a3948;
  --shadow-soft: 0 10px 28px rgba(0, 0, 0, 0.24);
}

body.dark .sidebar,
body.dark .composer,
body.dark .app-card,
body.dark .model-card,
body.dark .tool-panel,
body.dark .preview-panel,
body.dark .mindmap,
body.dark .plan-card,
body.dark .toolbar input,
body.dark .toolbar select,
body.dark .tool-panel textarea,
body.dark .tool-form-grid select,
body.dark .tool-panel select,
body.dark .app-empty,
body.dark .category-pills button,
body.dark .modal-card,
body.dark .skill-form,
body.dark .skill-output,
body.dark .skill-detail-grid article,
body.dark .skill-model-option,
body.dark .skill-model-actions button,
body.dark .model-empty,
body.dark .skill-field input,
body.dark .skill-field select,
body.dark .skill-field textarea,
body.dark .skill-actions button,
body.dark .skill-detail-actions button,
body.dark .message,
body.dark .new-chat,
body.dark .nav-item,
body.dark .chip,
body.dark .login-btn:not(.primary),
body.dark .icon-btn,
body.dark .auth-tabs,
body.dark .auth-login-methods,
body.dark .auth-form input,
body.dark .chat-config-form input,
body.dark .chat-config-form select,
body.dark .chat-config-form textarea,
body.dark .chat-config-advanced,
body.dark .code-row button,
body.dark .auth-user-panel,
body.dark .auth-user-panel button,
body.dark .chat-config-actions button,
body.dark .row-actions button,
body.dark .export-row button,
body.dark .composer-attachment,
body.dark .attachment-remove {
  background: var(--panel);
  color: var(--text);
}

body.dark .auth-login-methods button.active {
  background: rgba(47, 200, 189, 0.16);
  color: #8de3dc;
}

body.dark .hero-strip {
  background: linear-gradient(135deg, #123943, #111827);
}

body.dark .workspace-status,
body.dark .insight-row article,
body.dark .page-summary,
body.dark .prompt-chip {
  background: rgba(21, 31, 43, 0.92);
  color: var(--text);
}

body.dark .prompt-chip {
  border-color: var(--line);
}

body.dark .site-footer {
  background: transparent;
  color: var(--muted);
}

body.dark .site-footer-inner {
  background: transparent;
}

body.dark .site-footer a {
  background: transparent;
  color: var(--muted);
}

body.dark .site-footer a:hover {
  color: #8ee8dc;
}

body.dark .pricing-card,
body.dark .addon-grid article,
body.dark .plan-quota div {
  background: var(--panel-soft);
  color: var(--text);
  border-color: var(--line);
}

body.dark .pricing-card.accent {
  background:
    radial-gradient(circle at 16% 10%, rgba(246, 183, 60, 0.14), rgba(246, 183, 60, 0) 30%),
    var(--panel-soft);
}

body.dark .mini-funnel span {
  background: rgba(42, 167, 160, 0.16);
  color: #8ee8dc;
}

body.dark .plan-card.current {
  border-color: rgba(42, 167, 160, 0.52);
}

body.dark .addon-grid button {
  border-color: rgba(125, 211, 252, 0.22);
  background: #203040;
  color: #ecf2f7;
}

body.dark .addon-grid button:hover {
  background: #1f7a8c;
}

body.dark .skill-detail-grid article {
  background:
    linear-gradient(180deg, rgba(46, 196, 182, 0.08), rgba(21, 31, 43, 0) 40%),
    var(--panel);
}

body.dark .skill-detail-btn {
  border-color: rgba(125, 211, 252, 0.22);
  background: rgba(46, 196, 182, 0.1);
  color: #8ee8dc;
}

body.dark .skill-detail-actions .primary {
  background: #203040;
  color: #ecf2f7;
}

body.dark .skill-model-option.current {
  border-color: rgba(46, 196, 182, 0.42);
  background: rgba(46, 196, 182, 0.1);
}

body.dark .skill-model-cost {
  background: var(--panel-soft);
}

body.dark .icon-btn,
body.dark .icon-close {
  border-color: rgba(125, 211, 252, 0.18);
  background:
    linear-gradient(180deg, rgba(32, 48, 64, 0.96), rgba(22, 34, 50, 0.94)),
    #162232;
  box-shadow:
    0 12px 24px rgba(0, 0, 0, 0.24),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body.dark .icon-btn::before,
body.dark .icon-btn::after,
body.dark .icon-close::before,
body.dark .icon-close::after {
  background: #d9e7f2;
}

body.dark .icon-btn:hover,
body.dark .icon-close:hover {
  border-color: rgba(46, 196, 182, 0.38);
  background:
    linear-gradient(180deg, rgba(39, 60, 78, 0.98), rgba(22, 42, 54, 0.96)),
    #162232;
}

body.dark .icon-btn:hover::before,
body.dark .icon-btn:hover::after,
body.dark .icon-close:hover::before,
body.dark .icon-close:hover::after {
  background: #8ee8dc;
}

body.dark .star-btn {
  border-color: rgba(125, 211, 252, 0.2);
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0) 42%),
    linear-gradient(180deg, #203040, #162232);
  color: #7dd3fc;
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

body.dark .star-btn:hover {
  border-color: rgba(246, 183, 60, 0.52);
  color: #f6d06d;
}

body.dark .star-btn.active {
  border-color: rgba(246, 183, 60, 0.62);
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0) 42%),
    linear-gradient(135deg, #3b2a0b 0%, #c88718 50%, #f6b73c 100%);
  color: #fff7d6;
  box-shadow:
    0 12px 28px rgba(246, 183, 60, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

body.dark .toast.favorite-toast {
  border-color: rgba(246, 183, 60, 0.55);
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 42%),
    linear-gradient(135deg, #3b2a0b, #c88718 58%, #f6b73c);
  color: #fff7d6;
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.36),
    0 8px 24px rgba(246, 183, 60, 0.16);
}

body.dark .toast.favorite-toast::before {
  background: rgba(255, 255, 255, 0.18);
  color: #fff7d6;
}

@media (max-width: 900px) {
  .skill-layout {
    grid-template-columns: 1fr;
  }

  .skill-detail-grid {
    grid-template-columns: 1fr;
  }

  .skill-model-grid {
    grid-template-columns: 1fr;
  }

  .skill-output {
    min-height: 320px;
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: block;
    height: auto;
    min-height: 0;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    height: auto;
    overflow: visible;
    padding-bottom: 0;
  }

  .workspace:has(#chatView.active) {
    height: calc(100vh - 92px);
    height: calc(100dvh - 92px);
    overflow: hidden;
  }

  #chatView.active {
    flex: 1 1 auto;
    height: auto;
  }

  .brand,
  .new-chat,
  .history-tabs,
  .section-title,
  .history-list,
  .quota-panel,
  .workspace-status {
    display: none;
  }

  .nav {
    grid-template-columns: repeat(7, 1fr);
  }

  .nav-item {
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 0 6px;
    font-size: 12px;
  }

  .nav-icon {
    display: grid;
  }

  .hero-strip,
  .tool-grid,
  .project-layout,
  .project-create,
  .project-search,
  .toolbar,
  .page-summary {
    grid-template-columns: 1fr;
  }

  .project-search-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-list-panel {
    position: static;
    top: auto;
  }

  .page-summary {
    display: block;
  }

  .hero-visual {
    display: none;
  }

  .app-grid,
  .model-grid,
  .account-grid,
  .account-records,
  .project-work-grid,
  .project-metrics,
  .pricing-grid,
  .addon-grid,
  .insight-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-card {
    grid-column: span 2;
  }

  .account-overview .account-card {
    grid-column: span 2;
  }

  .pricing-head {
    display: block;
  }

  .pricing-head p {
    margin-top: 10px;
  }
}

@media (max-width: 640px) {
  .workspace {
    padding: 14px;
  }

  .topbar,
  .composer-footer,
  .top-actions {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .topbar {
    display: block;
  }

  .top-actions {
    margin-top: 12px;
  }

  .model-selector-inline {
    width: 100%;
    max-width: 100%;
  }

  .model-picker {
    flex: 1 1 auto;
    max-width: 100%;
  }

  .model-market-card {
    height: min(720px, calc(100dvh - 28px));
  }

  .model-market-card .model-grid {
    max-height: none;
  }

  .model-card-actions {
    grid-template-columns: 1fr;
  }

  .model-provider-tabs {
    padding: 8px;
  }

  .app-grid,
  .model-grid,
  .account-grid,
  .account-records,
  .project-work-grid,
  .project-metrics,
  .project-create,
  .project-search,
  .pricing-grid,
  .addon-grid,
  .mind-branches,
  .metric-row,
  .insight-row,
  .admin-grid,
  .admin-metrics {
    grid-template-columns: 1fr;
  }

  .admin-card.wide {
    grid-column: auto;
  }

  .data-foundation-grid {
    grid-template-columns: 1fr;
  }

  .account-card,
  .account-overview .account-card {
    grid-column: auto;
  }

  .project-hero-card {
    display: grid;
  }

  .project-search-filters,
  .citation-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .evidence-match-head {
    display: grid;
  }

  .project-document-item {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .project-document-item > button {
    grid-column: 2;
    justify-self: start;
  }

  .project-score {
    width: 88px;
    height: 88px;
  }

  .quality-checklist div {
    grid-template-columns: 26px minmax(0, 1fr);
  }

  .quality-checklist small {
    grid-column: 2;
  }

  .nav {
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-item {
    min-width: 72px;
    min-height: 46px;
    border-radius: 8px;
  }

  .hero-copy h2,
  .page-summary h2 {
    font-size: 22px;
  }

  .prompt-strip {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .prompt-chip {
    flex: 0 0 auto;
  }

  .account-card {
    grid-column: span 1;
  }

  .figure-preview {
    grid-template-columns: 1fr;
  }

  .figure-preview i {
    width: 2px;
    height: 22px;
    justify-self: center;
  }
}

/* Admin console overrides: keep the management UI separated from client responsive nav rules. */
body.admin-page {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

body.admin-page .admin-sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  border-bottom: 0;
}

body.admin-page .admin-sidebar .nav {
  display: grid;
  grid-template-columns: 1fr;
  overflow: visible;
}

body.admin-page .admin-sidebar .nav-item {
  width: 100%;
  min-width: 0;
  justify-content: flex-start;
}

body.admin-page .admin-back-link {
  margin-top: auto;
}

body.admin-page .admin-main {
  min-width: 0;
}

@media (max-width: 860px) {
  body.admin-page {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  body.admin-page .admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    gap: 10px;
    width: 100%;
    min-width: 0;
    max-width: 100vw;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: hidden;
  }

  body.admin-page .admin-sidebar .brand {
    padding: 0;
  }

  body.admin-page .admin-sidebar .brand-mark {
    width: 40px;
    height: 40px;
  }

  body.admin-page .admin-sidebar .nav {
    display: flex;
    gap: 8px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
  }

  body.admin-page .admin-sidebar .nav-item {
    flex: 0 0 auto;
    width: auto;
    min-height: 40px;
    padding: 0 12px;
    white-space: nowrap;
  }

  body.admin-page .admin-back-link {
    display: none;
  }

  body.admin-page .admin-main,
  body.admin-page .admin-workspace,
  body.admin-page .admin-panel {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  body.admin-page .redemption-admin-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  body.admin-page .redemption-admin-layout > * {
    min-width: 0;
  }

  body.admin-page .redemption-batch-list .table-wrap,
  body.admin-page .redemption-code-list .table-wrap,
  body.admin-page .redemption-attempt-list .table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
  }
}

/* DeepWrite client visual refresh */
:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #f7fafc;
  --text: #0f172a;
  --muted: #607086;
  --line: #d8e3ed;
  --brand: #137b8c;
  --brand-2: #2fc8bd;
  --accent: #f5b642;
  --danger: #e5484d;
  --shadow: 0 22px 60px rgba(15, 23, 42, 0.13);
  --shadow-soft: 0 12px 34px rgba(15, 23, 42, 0.075);
  --ring: 0 0 0 4px rgba(47, 200, 189, 0.18);
}

body:not(.admin-page) {
  background:
    radial-gradient(circle at 12% 0%, rgba(47, 200, 189, 0.18), transparent 30rem),
    radial-gradient(circle at 95% 8%, rgba(245, 182, 66, 0.12), transparent 24rem),
    linear-gradient(180deg, #fbfdff 0%, #eef4f8 100%);
}

body:not(.admin-page)::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(19, 123, 140, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19, 123, 140, 0.035) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 62%);
  z-index: -1;
}

.app-shell {
  grid-template-columns: 304px minmax(0, 1fr);
}

.sidebar {
  padding: 20px 16px;
  border-right: 1px solid rgba(202, 216, 229, 0.78);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 251, 252, 0.9)),
    rgba(255, 255, 255, 0.92);
  box-shadow: 18px 0 50px rgba(15, 23, 42, 0.055);
}

.brand {
  gap: 14px;
  padding: 2px 8px 12px;
}

.brand-mark {
  width: 54px;
  height: 54px;
  padding: 5px;
  border-color: rgba(203, 232, 234, 0.95);
  box-shadow:
    0 16px 34px rgba(19, 123, 140, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.brand strong {
  color: #071827;
  font-size: 18px;
  letter-spacing: 0;
}

.brand small {
  margin-top: 2px;
  color: #708093;
}

.new-chat {
  min-height: 46px;
  border-color: rgba(19, 123, 140, 0.18);
  background:
    linear-gradient(180deg, #ffffff, #f4fbfb);
  color: #0f7180;
  box-shadow: 0 14px 30px rgba(19, 123, 140, 0.1);
}

.new-chat:hover {
  border-color: rgba(19, 123, 140, 0.34);
  box-shadow: 0 18px 36px rgba(19, 123, 140, 0.16);
}

.nav {
  gap: 9px;
}

.nav-item {
  min-height: 44px;
  border-color: transparent;
  background: transparent;
  color: #334155;
  font-weight: 760;
}

.nav-item:hover {
  border-color: rgba(19, 123, 140, 0.16);
  background: rgba(240, 250, 250, 0.9);
}

.nav-item.active {
  border-color: rgba(19, 123, 140, 0.24);
  background:
    linear-gradient(90deg, rgba(19, 123, 140, 0.16), rgba(47, 200, 189, 0.08)),
    #eefafa;
  color: #075e6c;
  box-shadow:
    inset 3px 0 0 var(--brand),
    0 10px 24px rgba(19, 123, 140, 0.08);
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon {
  background: #ffffff;
  color: #087180;
  box-shadow: 0 8px 18px rgba(19, 123, 140, 0.12);
}

.history-tabs {
  padding: 4px;
  border: 1px solid rgba(216, 227, 237, 0.85);
  border-radius: 8px;
  background: #eef4f7;
}

.history-tabs button {
  border-radius: 7px;
  background: transparent;
}

.history-tabs button.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.section-title {
  padding: 0 2px;
}

.section-title button {
  border-color: rgba(19, 123, 140, 0.18);
  background: #ffffff;
  color: #275667;
}

.history-list {
  padding-right: 4px;
}

.history-item {
  border-color: rgba(216, 227, 237, 0.72);
  background: rgba(255, 255, 255, 0.74);
}

.history-item.active,
.history-item:hover {
  border-color: rgba(19, 123, 140, 0.22);
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.075);
}

.workspace {
  padding: 20px 24px 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.42), transparent 230px),
    transparent;
}

.topbar {
  min-height: 68px;
  padding: 4px 2px 12px;
}

.topbar h1 {
  color: #071827;
  font-size: clamp(25px, 3vw, 38px);
  font-weight: 900;
}

.eyebrow {
  color: #6a7a8e;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.chip,
.user-badge {
  border: 1px solid rgba(216, 227, 237, 0.95);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 251, 252, 0.96));
  color: #142133;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.user-badge {
  border-color: transparent;
  background:
    linear-gradient(135deg, #0d1b2a, #102a34 58%, #0f7180);
  color: #ffffff;
}

#chatView .hero-strip {
  border: 1px solid rgba(19, 123, 140, 0.14);
  background:
    radial-gradient(circle at 92% 15%, rgba(245, 182, 66, 0.18), transparent 18rem),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(235, 249, 248, 0.94));
  color: #0f172a;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.075);
}

#chatView .hero-copy span {
  color: #0b7180;
}

#chatView .hero-copy h2 {
  color: #071827;
  font-weight: 900;
}

#chatView .hero-copy p {
  color: #52657a;
}

.message {
  border-color: rgba(216, 227, 237, 0.9);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.07);
}

.message.user {
  border-color: rgba(47, 200, 189, 0.32);
  background:
    linear-gradient(180deg, #f2fffe, #e8f8f7);
}

.message small {
  color: #61738a;
}

.prompt-strip {
  padding: 2px 0 6px;
}

.prompt-chip {
  border-color: rgba(199, 216, 227, 0.9);
  background: rgba(255, 255, 255, 0.86);
  color: #2d5563;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.045);
}

.prompt-chip:hover {
  border-color: rgba(19, 123, 140, 0.34);
  background: #ffffff;
}

.composer {
  padding: 14px;
  border-color: rgba(19, 123, 140, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(250, 253, 253, 0.98));
  box-shadow:
    0 22px 54px rgba(15, 23, 42, 0.12),
    0 0 0 1px rgba(255, 255, 255, 0.85) inset;
}

.composer textarea::placeholder,
.toolbar input::placeholder,
.skill-field textarea::placeholder,
.chat-config-form textarea::placeholder {
  color: #94a3b8;
}

.composer-footer {
  border-top-color: rgba(216, 227, 237, 0.82);
}

.model-selector-label,
.model-picker strong {
  color: #0f172a;
}

.model-picker {
  padding: 0 10px;
  border: 1px solid rgba(216, 227, 237, 0.9);
  border-radius: 999px;
  background: #ffffff;
}

.composer-tools button,
.upload-chat-btn,
.send-btn {
  width: 40px;
  height: 40px;
  min-height: 40px;
  border-radius: 8px;
}

.upload-chat-btn {
  border-color: rgba(19, 123, 140, 0.22);
  background: #f8fcfc;
}

.send-btn,
.primary,
.app-use-btn,
.model-card button,
.addon-grid button {
  background:
    linear-gradient(135deg, #0b1728, #111827);
  box-shadow: 0 12px 26px rgba(17, 24, 39, 0.16);
}

.send-btn:hover,
.primary:hover,
.app-use-btn:hover,
.model-card button:hover,
.addon-grid button:hover {
  background:
    linear-gradient(135deg, #0f2c36, #137b8c);
  box-shadow: 0 16px 32px rgba(19, 123, 140, 0.18);
}

.page-summary {
  padding: 20px 22px;
  border-color: rgba(19, 123, 140, 0.14);
  background:
    radial-gradient(circle at right top, rgba(47, 200, 189, 0.18), transparent 20rem),
    linear-gradient(135deg, #ffffff, #f0fbfa);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.07);
}

.page-summary h2 {
  color: #071827;
  font-weight: 900;
}

.badge {
  border: 1px solid rgba(245, 182, 66, 0.28);
  background: #fff8e7;
  color: #926100;
}

.toolbar {
  padding: 12px;
  border-color: rgba(216, 227, 237, 0.92);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
}

.toolbar input,
.toolbar select,
.skill-field input,
.skill-field select,
.skill-field textarea,
.chat-config-form input,
.chat-config-form select,
.chat-config-form textarea,
.auth-form input {
  border-color: rgba(207, 220, 231, 0.96);
  background: #ffffff;
}

.toolbar input:focus,
.toolbar select:focus,
.skill-field input:focus,
.skill-field select:focus,
.skill-field textarea:focus,
.chat-config-form input:focus,
.chat-config-form select:focus,
.chat-config-form textarea:focus,
.auth-form input:focus {
  border-color: rgba(19, 123, 140, 0.42);
  box-shadow: var(--ring);
}

.category-pills button,
.model-tabs button,
.model-provider-tabs button,
.skill-model-tabs button,
.skill-model-provider-tabs button {
  border-color: rgba(207, 220, 231, 0.96);
  background: #ffffff;
}

.category-pills button.active,
.model-provider-tabs button.active,
.skill-model-tabs button.active,
.skill-model-provider-tabs button.active {
  border-color: rgba(19, 123, 140, 0.36);
  background: #e9f8f7;
  color: #0c6370;
}

.model-tabs button.active {
  background:
    linear-gradient(135deg, #0b1728, #102a34);
}

.app-card,
.model-card,
.tool-panel,
.preview-panel,
.mindmap,
.account-card,
.plan-card,
.addon-grid article,
.admin-card {
  border-color: rgba(216, 227, 237, 0.92);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(251, 253, 254, 0.98));
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.07);
}

.app-card:hover,
.model-card:hover,
.plan-card:hover,
.addon-grid article:hover {
  border-color: rgba(19, 123, 140, 0.28);
  box-shadow: 0 24px 54px rgba(15, 23, 42, 0.12);
}

.app-card::before {
  height: 4px;
  background: linear-gradient(90deg, #137b8c, #2fc8bd 58%, #f5b642);
}

.app-icon {
  border-radius: 8px;
  box-shadow:
    0 14px 28px rgba(15, 23, 42, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.skill-detail-btn,
.model-card .model-detail-btn,
.skill-model-detail-btn {
  border-color: rgba(19, 123, 140, 0.22);
  background: #f4fbfb;
  color: #0f7180;
}

.skill-detail-btn:hover,
.model-card .model-detail-btn:hover,
.skill-model-detail-btn:hover {
  background: #e8f8f7;
}

.star-btn {
  border-color: rgba(216, 227, 237, 0.95);
  background: #ffffff;
}

.modal {
  background:
    radial-gradient(circle at 50% 20%, rgba(47, 200, 189, 0.13), transparent 28rem),
    rgba(8, 15, 23, 0.46);
  backdrop-filter: blur(8px);
}

.modal-card {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 253, 0.98));
  box-shadow:
    0 34px 90px rgba(15, 23, 42, 0.26),
    0 0 0 1px rgba(216, 227, 237, 0.72) inset;
}

.modal-head {
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(216, 227, 237, 0.72);
}

.icon-btn,
.icon-close {
  border-color: rgba(207, 220, 231, 0.95);
  background: #ffffff;
}

.skill-detail-grid article,
.model-detail-body section,
.skill-form,
.skill-output,
.skill-model-option {
  border-color: rgba(216, 227, 237, 0.92);
  background: #ffffff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.skill-model-option.current,
.model-card.current {
  border-color: rgba(19, 123, 140, 0.38);
  background:
    linear-gradient(180deg, #ffffff, #f2fbfb);
}

.account-card {
  background:
    radial-gradient(circle at right top, rgba(47, 200, 189, 0.2), transparent 16rem),
    linear-gradient(135deg, #0b1728, #102a34);
}

.account-records .account-card,
.pricing-card,
.addon-grid article,
.plan-card {
  color: var(--text);
  background: #ffffff;
}

.pricing-card.accent,
.plan-card.featured {
  border-color: rgba(245, 182, 66, 0.46);
  background:
    radial-gradient(circle at 12% 0%, rgba(245, 182, 66, 0.16), transparent 14rem),
    #ffffff;
}

.site-footer {
  color: #6b7d91;
}

.view:not(#chatView) {
  padding-bottom: 118px;
  scrollbar-gutter: stable;
}

#chatView.active {
  padding-bottom: 10px;
}

body.dark {
  --bg: #0b1420;
  --panel: #101b28;
  --panel-soft: #162333;
  --text: #edf5f8;
  --muted: #a6b5c5;
  --line: #253648;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.38);
  --shadow-soft: 0 14px 34px rgba(0, 0, 0, 0.24);
}

body.dark:not(.admin-page) {
  background:
    radial-gradient(circle at 12% 0%, rgba(47, 200, 189, 0.16), transparent 30rem),
    radial-gradient(circle at 96% 10%, rgba(245, 182, 66, 0.08), transparent 24rem),
    linear-gradient(180deg, #07111d 0%, #0b1420 100%);
}

body.dark .brand strong,
body.dark .topbar h1,
body.dark #chatView .hero-copy h2,
body.dark .model-selector-label,
body.dark .model-picker strong {
  color: #f6fbff;
}

body.dark .sidebar,
body.dark .modal-card,
body.dark .composer,
body.dark .app-card,
body.dark .model-card,
body.dark .tool-panel,
body.dark .preview-panel,
body.dark .mindmap,
body.dark .plan-card,
body.dark .addon-grid article,
body.dark .pricing-card,
body.dark .account-records .account-card {
  border-color: rgba(125, 151, 176, 0.22);
  background:
    linear-gradient(180deg, rgba(16, 27, 40, 0.98), rgba(13, 23, 35, 0.98));
}

body.dark #chatView .hero-strip,
body.dark .page-summary {
  border-color: rgba(47, 200, 189, 0.18);
  background:
    radial-gradient(circle at 92% 12%, rgba(245, 182, 66, 0.12), transparent 18rem),
    linear-gradient(135deg, rgba(16, 27, 40, 0.98), rgba(11, 38, 46, 0.96));
}

body.dark #chatView .hero-copy p,
body.dark .page-summary p,
body.dark .message small {
  color: #a6b5c5;
}

body.dark .message,
body.dark .prompt-chip,
body.dark .toolbar,
body.dark .model-picker,
body.dark .category-pills button,
body.dark .model-tabs button,
body.dark .model-provider-tabs button,
body.dark .skill-model-tabs button,
body.dark .skill-model-provider-tabs button,
body.dark .skill-detail-grid article,
body.dark .model-detail-body section,
body.dark .skill-form,
body.dark .skill-output,
body.dark .skill-model-option,
body.dark .history-tabs,
body.dark .history-item,
body.dark .icon-btn,
body.dark .icon-close {
  border-color: rgba(125, 151, 176, 0.22);
  background: rgba(16, 27, 40, 0.96);
}

body.dark .message.user,
body.dark .nav-item.active,
body.dark .category-pills button.active,
body.dark .model-provider-tabs button.active,
body.dark .skill-model-tabs button.active,
body.dark .skill-model-provider-tabs button.active {
  background: rgba(47, 200, 189, 0.12);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .sidebar {
    padding: 14px;
    max-width: 100vw;
  }

  .workspace,
  .view {
    max-width: 100vw;
    overflow-x: hidden;
  }
}

@media (max-width: 640px) {
  body:not(.admin-page) {
    overflow-x: hidden;
  }

  .sidebar {
    padding: 10px 10px 8px;
  }

  .nav {
    display: flex;
    grid-template-columns: none;
    gap: 6px;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    flex: 0 0 58px;
    min-width: 58px;
    min-height: 48px;
    padding: 0 4px;
    font-size: 11px;
    white-space: nowrap;
  }

  .workspace {
    padding: 14px 14px 0;
  }

  .topbar h1 {
    font-size: 27px;
    line-height: 1.2;
  }

  .top-actions {
    gap: 8px;
  }

  #chatView .hero-strip {
    padding: 14px;
  }

  #chatView .hero-copy h2 {
    font-size: 21px;
    line-height: 1.28;
  }

  #chatView .hero-copy p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .message-row {
    max-width: 100%;
  }

  .message {
    max-width: calc(100% - 46px);
    padding: 12px 13px;
  }

  .prompt-strip {
    max-width: 100%;
  }

  .composer {
    padding: 12px;
  }

  .composer-footer {
    align-items: stretch;
  }

  .model-selector-inline {
    max-width: 100%;
  }

  .composer-tools {
    flex: 0 0 auto;
  }

  .site-footer {
    margin: 0 -14px;
    padding-inline: 14px;
  }

  .site-info-history-grid,
  .site-info-notice,
  .announcement-message-list article {
    grid-template-columns: 1fr;
  }

  .announcement-message-actions {
    justify-content: flex-start;
  }
}

/* Apple-inspired product polish */
:root {
  --apple-bg: #f5f7f9;
  --apple-surface: rgba(255, 255, 255, 0.82);
  --apple-surface-strong: rgba(255, 255, 255, 0.94);
  --apple-border: rgba(17, 24, 39, 0.1);
  --apple-border-soft: rgba(17, 24, 39, 0.065);
  --apple-black: #05070a;
  --apple-blue: #007aff;
  --apple-teal: #18b8aa;
  --apple-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  --apple-shadow-soft: 0 10px 30px rgba(15, 23, 42, 0.07);
}

body:not(.admin-page) {
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
    "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 16% -6%, rgba(24, 184, 170, 0.18), transparent 32rem),
    radial-gradient(circle at 100% 0%, rgba(0, 122, 255, 0.08), transparent 30rem),
    linear-gradient(180deg, #ffffff 0%, var(--apple-bg) 100%);
}

button,
.app-card,
.model-card,
.plan-card,
.addon-grid article,
.message,
.composer,
.modal-card,
.toolbar,
.page-summary {
  will-change: transform, box-shadow;
}

button {
  transition:
    transform 140ms cubic-bezier(0.2, 0.8, 0.2, 1),
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease,
    opacity 160ms ease;
}

button:active {
  transform: scale(0.985);
}

.sidebar,
.topbar,
.toolbar,
.composer,
.modal-card,
.page-summary,
.history-tabs {
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 249, 251, 0.82));
}

.brand-mark,
.message-logo-avatar,
.model-logo.image-logo {
  background: var(--apple-surface-strong);
  border-color: rgba(255, 255, 255, 0.9);
}

.new-chat,
.nav-item,
.history-item,
.history-tabs,
.section-title button,
.chip,
.user-badge,
.prompt-chip,
.model-picker,
.toolbar input,
.toolbar select,
.category-pills button,
.model-tabs button,
.model-provider-tabs button,
.skill-model-tabs button,
.skill-model-provider-tabs button,
.skill-actions button,
.skill-detail-actions button,
.skill-model-actions button,
.chat-config-actions button,
.row-actions button,
.export-row button,
.code-row button,
.auth-user-panel button,
.attachment-remove {
  border-color: var(--apple-border-soft);
  background: var(--apple-surface-strong);
  box-shadow:
    0 1px 1px rgba(255, 255, 255, 0.72) inset,
    0 8px 20px rgba(15, 23, 42, 0.045);
}

.new-chat:hover,
.nav-item:hover,
.history-item:hover,
.chip:hover,
.prompt-chip:hover,
.model-picker:hover,
.category-pills button:hover,
.model-tabs button:hover,
.model-provider-tabs button:hover,
.skill-model-tabs button:hover,
.skill-model-provider-tabs button:hover,
.skill-actions button:hover,
.skill-detail-actions button:hover,
.skill-model-actions button:hover,
.chat-config-actions button:hover,
.row-actions button:hover,
.export-row button:hover {
  border-color: rgba(0, 122, 255, 0.22);
  background: #ffffff;
  box-shadow:
    0 1px 1px rgba(255, 255, 255, 0.78) inset,
    0 14px 30px rgba(15, 23, 42, 0.08);
}

.user-badge {
  border-color: transparent;
  background:
    linear-gradient(180deg, #172033, #070a10);
  color: #ffffff;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.14) inset,
    0 14px 32px rgba(5, 7, 10, 0.22);
}

.user-badge:hover {
  background:
    linear-gradient(180deg, #202a40, #0a0d14);
  color: #ffffff;
}

.nav-item.active,
.history-tabs button.active,
.category-pills button.active,
.model-provider-tabs button.active,
.skill-model-tabs button.active,
.skill-model-provider-tabs button.active {
  border-color: rgba(24, 184, 170, 0.3);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(232, 250, 248, 0.88));
  box-shadow:
    0 1px 1px rgba(255, 255, 255, 0.85) inset,
    0 14px 30px rgba(24, 184, 170, 0.1);
}

.topbar h1,
.page-summary h2,
.hero-copy h2,
.app-card h3,
.model-card h3,
.plan-card h3,
.tool-panel h2,
.preview-panel h3,
.account-card h2,
.modal-head h2 {
  letter-spacing: 0;
  text-wrap: balance;
}

.page-summary,
#chatView .hero-strip {
  border-color: var(--apple-border-soft);
  background:
    radial-gradient(circle at 94% 10%, rgba(24, 184, 170, 0.12), transparent 18rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(250, 252, 253, 0.82));
}

.composer {
  border-color: rgba(17, 24, 39, 0.085);
  background: rgba(255, 255, 255, 0.9);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 22px 58px rgba(15, 23, 42, 0.13);
}

.composer textarea {
  line-height: 1.7;
}

.model-picker {
  min-height: 36px;
  padding: 0 12px;
}

.model-dot {
  box-shadow: 0 0 0 4px rgba(24, 184, 170, 0.12);
}

.composer-tools button,
.upload-chat-btn,
.send-btn,
.icon-btn,
.icon-close,
.star-btn {
  box-shadow:
    0 1px 1px rgba(255, 255, 255, 0.82) inset,
    0 10px 24px rgba(15, 23, 42, 0.08);
}

.send-btn,
.primary,
.app-use-btn,
.model-card button:not(.model-detail-btn),
.buy-plan-btn.primary,
.buy-addon-btn,
.auth-submit {
  border: 0;
  background:
    linear-gradient(180deg, #181b20, var(--apple-black));
  color: #ffffff;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.12) inset,
    0 12px 28px rgba(5, 7, 10, 0.24);
}

.send-btn:hover,
.primary:hover,
.app-use-btn:hover,
.model-card button:not(.model-detail-btn):hover,
.buy-plan-btn.primary:hover,
.buy-addon-btn:hover,
.auth-submit:hover {
  background:
    linear-gradient(180deg, #242830, #080a0d);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.16) inset,
    0 16px 34px rgba(5, 7, 10, 0.28);
}

.send-btn:active,
.primary:active,
.app-use-btn:active,
.model-card button:not(.model-detail-btn):active,
.buy-plan-btn.primary:active,
.buy-addon-btn:active,
.auth-submit:active {
  transform: scale(0.972);
}

.send-btn:disabled,
.primary:disabled,
.app-use-btn:disabled,
.model-card button:disabled,
.buy-plan-btn:disabled,
.buy-addon-btn:disabled,
.auth-submit:disabled {
  cursor: not-allowed;
  opacity: 0.62;
  background: #b8c2cc;
  color: #ffffff;
  box-shadow: none;
  transform: none;
}

.upload-chat-btn:hover {
  color: var(--apple-blue);
}

.send-btn svg {
  transition: transform 150ms ease;
}

.send-btn:hover svg {
  transform: translate(2px, -2px);
}

.app-card,
.model-card,
.tool-panel,
.preview-panel,
.mindmap,
.account-card,
.plan-card,
.addon-grid article,
.skill-detail-grid article,
.model-detail-body section,
.skill-form,
.skill-output,
.skill-model-option {
  border-color: var(--apple-border-soft);
  background: var(--apple-surface-strong);
  box-shadow: var(--apple-shadow-soft);
}

.app-card:hover,
.model-card:hover,
.plan-card:hover,
.addon-grid article:hover,
.skill-model-option:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 122, 255, 0.16);
  box-shadow: var(--apple-shadow);
}

.app-icon,
.model-logo,
.attachment-icon,
.doc-avatar,
.upload-icon {
  border-radius: 8px;
}

.skill-detail-btn,
.model-card .model-detail-btn,
.skill-model-detail-btn {
  color: #006adc;
  background: rgba(0, 122, 255, 0.06);
  border-color: rgba(0, 122, 255, 0.14);
}

.skill-detail-btn:hover,
.model-card .model-detail-btn:hover,
.skill-model-detail-btn:hover {
  color: #0056c7;
  background: rgba(0, 122, 255, 0.1);
}

.modal {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.22), transparent 24rem),
    rgba(10, 16, 24, 0.42);
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  animation: modalBackdropIn 160ms ease both;
}

.modal-card {
  border-color: rgba(255, 255, 255, 0.72);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.92));
  box-shadow:
    0 40px 110px rgba(15, 23, 42, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.85) inset;
}

.modal.open .modal-card {
  animation: modalCardIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.site-info-card {
  width: min(620px, calc(100vw - 28px));
  padding: 24px;
}

.site-info-body {
  margin-top: 18px;
  color: #26384d;
  font-size: 15px;
}

.site-info-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid rgba(14, 116, 144, 0.14);
  border-radius: 8px;
  background: rgba(241, 249, 250, 0.72);
}

.site-info-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: #ffffff;
  color: #0f7f91;
  font-size: 12px;
  font-weight: 900;
}

.site-info-summary strong {
  color: #0f172a;
  font-weight: 800;
}

.site-info-content,
.site-info-panel {
  margin-top: 14px;
  max-height: min(54vh, 420px);
  overflow-y: auto;
  padding: 18px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.06) inset;
}

.site-info-content p,
.site-info-panel p {
  margin: 0;
  line-height: 1.8;
}

.site-info-content p + p {
  margin-top: 10px;
}

.site-info-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 8px;
  border: 1px solid rgba(14, 116, 144, 0.14);
  border-radius: 8px;
  background: rgba(241, 249, 250, 0.72);
}

.site-info-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #617086;
  font-weight: 900;
}

.site-info-tabs button.active {
  border-color: rgba(14, 116, 144, 0.14);
  background: #ffffff;
  color: #0f7f91;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.07);
}

.site-info-tabs strong {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
  font-size: 12px;
}

.site-info-panel {
  display: none;
}

.site-info-panel.active {
  display: block;
}

.site-info-notice {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  border-radius: 8px;
}

.site-info-notice.latest {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.08), rgba(20, 184, 166, 0.08));
}

.site-info-notice time,
.site-info-history-list time {
  color: #0f7f91;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.7;
}

.site-info-notice h3 {
  margin: 0 0 6px;
  color: #0f172a;
  font-size: 16px;
  font-weight: 900;
}

.site-info-notice p {
  color: #54657a;
}

.site-info-history-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.25fr);
  gap: 12px;
}

.site-info-history-list {
  display: grid;
  gap: 8px;
  align-content: start;
}

.site-info-history-list button {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  text-align: left;
}

.site-info-history-list button.active {
  border-color: rgba(14, 116, 144, 0.24);
  background: rgba(241, 249, 250, 0.92);
}

.site-info-history-list strong {
  color: #0f172a;
  font-size: 14px;
  line-height: 1.35;
}

.site-info-history-list small {
  overflow: hidden;
  color: #69788d;
  font-size: 12px;
  line-height: 1.45;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.site-info-message-detail > div {
  display: none;
}

.site-info-message-detail > div.active {
  display: block;
}

.site-info-empty {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: #7a8798;
  font-weight: 800;
}

.modal-head {
  border-bottom-color: rgba(17, 24, 39, 0.07);
}

.icon-btn,
.icon-close {
  width: 40px;
  height: 40px;
  min-height: 40px;
  background: rgba(255, 255, 255, 0.86);
}

.icon-btn:hover,
.icon-close:hover {
  border-color: rgba(0, 122, 255, 0.2);
  background: #ffffff;
}

.icon-btn:hover::before,
.icon-btn:hover::after,
.icon-close:hover::before,
.icon-close:hover::after {
  background: var(--apple-blue);
}

.toast {
  border: 1px solid rgba(255, 255, 255, 0.62);
  background:
    linear-gradient(180deg, rgba(20, 24, 31, 0.9), rgba(8, 10, 14, 0.88));
  backdrop-filter: saturate(180%) blur(18px);
  -webkit-backdrop-filter: saturate(180%) blur(18px);
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.26);
}

.toast.show {
  animation: toastIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.auth-tabs,
.chat-config-advanced,
.skill-model-cost,
.plan-quota div,
.metric-row div,
.mini-funnel span {
  border: 1px solid var(--apple-border-soft);
  background: rgba(245, 247, 250, 0.72);
}

.account-card {
  background:
    radial-gradient(circle at 88% 12%, rgba(24, 184, 170, 0.24), transparent 16rem),
    linear-gradient(135deg, #0b111c, #122533);
}

.pricing-card.accent,
.plan-card.featured {
  background:
    radial-gradient(circle at 12% 4%, rgba(255, 204, 77, 0.18), transparent 12rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 253, 247, 0.94));
}

.account-overview .account-card.pricing-card {
  color: var(--text);
  border-color: rgba(245, 182, 66, 0.46);
  background:
    radial-gradient(circle at 12% 4%, rgba(255, 204, 77, 0.18), transparent 12rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 253, 247, 0.94));
}

.account-overview .account-card.pricing-card p {
  color: var(--muted);
}

@keyframes modalBackdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalCardIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}

/* Document parsing observability */
.document-parsing-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding: 4px 2px;
}

.document-parsing-head h2,
.document-parsing-head p {
  margin: 0;
}

.document-parsing-head h2 {
  margin: 4px 0 8px;
  font-size: 26px;
}

.document-parsing-head > div > p:last-child {
  color: var(--muted);
  line-height: 1.65;
}

.monitor-only-badge {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid #cbd8e6;
  border-radius: 999px;
  background: #f7fafc;
  color: #46576b;
  font-size: 12px;
  font-weight: 800;
}

.document-parsing-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.document-parsing-metrics .metric-card {
  min-height: 118px;
}

.document-parsing-log-card {
  min-height: 360px;
}

.document-parsing-table {
  max-height: 520px;
  overflow: auto;
}

.document-parsing-table .admin-table {
  min-width: 980px;
}

.document-parsing-table .admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel);
}

.parse-channel-list {
  display: grid;
  gap: 4px;
  min-width: 150px;
}

.parse-channel-list span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.parser-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #fff0f1;
  color: #b4232d;
  font-size: 12px;
  font-weight: 800;
}

.parser-status-pill.success {
  background: #e9f8f2;
  color: #087a60;
}

.upload-privacy-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  margin: -2px 0 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.upload-privacy-note::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-2);
}

.upload-privacy-note a {
  color: var(--brand);
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 860px) {
  .document-parsing-head {
    display: grid;
    gap: 12px;
  }

  .monitor-only-badge {
    justify-self: start;
  }

  .document-parsing-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .document-parsing-metrics {
    grid-template-columns: 1fr;
  }

  .document-parsing-head h2 {
    font-size: 22px;
  }
}

body.dark {
  --apple-surface: rgba(16, 27, 40, 0.82);
  --apple-surface-strong: rgba(16, 27, 40, 0.94);
  --apple-border: rgba(255, 255, 255, 0.12);
  --apple-border-soft: rgba(255, 255, 255, 0.08);
}

body.dark .new-chat,
body.dark .nav-item,
body.dark .history-item,
body.dark .history-tabs,
body.dark .section-title button,
body.dark .chip,
body.dark .prompt-chip,
body.dark .model-picker,
body.dark .toolbar input,
body.dark .toolbar select,
body.dark .category-pills button,
body.dark .model-tabs button,
body.dark .model-provider-tabs button,
body.dark .skill-model-tabs button,
body.dark .skill-model-provider-tabs button,
body.dark .skill-actions button,
body.dark .skill-detail-actions button,
body.dark .skill-model-actions button,
body.dark .chat-config-actions button,
body.dark .row-actions button,
body.dark .export-row button,
body.dark .code-row button,
body.dark .auth-user-panel button,
body.dark .attachment-remove,
body.dark .composer,
body.dark .modal-card,
body.dark .app-card,
body.dark .model-card,
body.dark .tool-panel,
body.dark .preview-panel,
body.dark .mindmap,
body.dark .plan-card,
body.dark .addon-grid article,
body.dark .pricing-card,
body.dark .skill-detail-grid article,
body.dark .model-detail-body section,
body.dark .skill-form,
body.dark .skill-output,
body.dark .skill-model-option {
  border-color: var(--apple-border-soft);
  background: var(--apple-surface-strong);
}

body.dark .send-btn,
body.dark .primary,
body.dark .app-use-btn,
body.dark .model-card button:not(.model-detail-btn),
body.dark .buy-plan-btn.primary,
body.dark .buy-addon-btn,
body.dark .auth-submit {
  background:
    linear-gradient(180deg, #f7fbff, #dbe7f0);
  color: #07111d;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.72) inset,
    0 14px 34px rgba(0, 0, 0, 0.28);
}

body.dark .send-btn:hover,
body.dark .primary:hover,
body.dark .app-use-btn:hover,
body.dark .model-card button:not(.model-detail-btn):hover,
body.dark .buy-plan-btn.primary:hover,
body.dark .buy-addon-btn:hover,
body.dark .auth-submit:hover {
  background:
    linear-gradient(180deg, #ffffff, #edf5fb);
}

body.dark .send-btn:disabled,
body.dark .primary:disabled,
body.dark .app-use-btn:disabled,
body.dark .model-card button:disabled,
body.dark .buy-plan-btn:disabled,
body.dark .buy-addon-btn:disabled,
body.dark .auth-submit:disabled {
  opacity: 0.56;
  background: #526173;
  color: #dbe5ef;
  box-shadow: none;
  transform: none;
}

body.dark .modal {
  background:
    radial-gradient(circle at 50% 18%, rgba(24, 184, 170, 0.1), transparent 24rem),
    rgba(1, 5, 10, 0.58);
}

.mobile-menu-btn,
.mobile-drawer-close,
.mobile-nav-backdrop {
  display: none;
}

/* DeepWrite mobile app shell */
@media (max-width: 640px) {
  body:not(.admin-page) {
    height: 100dvh;
    overflow: hidden;
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  .app-shell {
    display: block;
    width: 100%;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    display: flex;
    width: min(86vw, 320px);
    max-width: 320px;
    height: 100dvh;
    min-height: 0;
    gap: 12px;
    padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
    overflow: hidden;
    border: 0;
    border-right: 1px solid rgba(17, 24, 39, 0.08);
    background: rgba(250, 252, 253, 0.98);
    box-shadow: 28px 0 72px rgba(15, 23, 42, 0.24);
    transform: translateX(-104%);
    transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar .brand,
  .sidebar .new-chat,
  .sidebar .history-tabs,
  .sidebar .section-title,
  .sidebar .history-list {
    display: flex;
  }

  .sidebar .brand {
    flex: 0 0 auto;
    min-height: 52px;
    padding: 0 2px 6px;
  }

  .sidebar .brand-mark {
    width: 42px;
    height: 42px;
  }

  .sidebar .brand > div:nth-child(2) {
    min-width: 0;
    flex: 1 1 auto;
  }

  .sidebar .brand strong {
    font-size: 16px;
  }

  .sidebar .brand small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-drawer-close,
  .mobile-menu-btn {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    min-height: 42px;
    padding: 0;
    border: 1px solid rgba(17, 24, 39, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.92);
    color: #0f5968;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.08);
  }

  .mobile-drawer-close {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    min-height: 38px;
  }

  .mobile-menu-btn svg,
  .mobile-drawer-close svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
  }

  .sidebar .new-chat {
    display: grid;
    flex: 0 0 auto;
    min-height: 46px;
  }

  .sidebar .nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 0 0 auto;
    gap: 8px;
    max-width: none;
    overflow: visible;
    padding: 0;
  }

  .sidebar .nav-item {
    flex: none;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    flex-direction: row;
    justify-content: flex-start;
    gap: 8px;
    padding: 0 10px;
    font-size: 13px;
    white-space: nowrap;
  }

  .sidebar .nav-icon {
    width: 24px;
    height: 24px;
  }

  .sidebar .history-tabs {
    display: grid;
    flex: 0 0 auto;
  }

  .sidebar .section-title {
    flex: 0 0 auto;
  }

  .sidebar .history-list {
    display: grid;
    flex: 1 1 auto;
    min-height: 100px;
    overflow-y: auto;
  }

  .mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 45;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(5, 12, 20, 0.42);
    opacity: 0;
    pointer-events: none;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: opacity 180ms ease;
  }

  .mobile-nav-backdrop.open {
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .workspace {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(236, 250, 250, 0.9), #f7f9fb 220px);
  }

  .workspace:has(#chatView.active) {
    height: 100dvh;
    overflow: hidden;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    grid-template-rows: 42px 38px;
    align-items: center;
    gap: 8px 10px;
    width: 100%;
    min-height: 104px;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
    border-bottom: 1px solid rgba(17, 24, 39, 0.07);
    background: rgba(250, 252, 253, 0.9);
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
    backdrop-filter: saturate(180%) blur(18px);
    -webkit-backdrop-filter: saturate(180%) blur(18px);
  }

  .mobile-menu-btn {
    grid-column: 1;
    grid-row: 1;
  }

  .topbar-copy {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .topbar-copy .eyebrow {
    display: none;
  }

  .topbar h1 {
    max-width: 100%;
    margin: 0;
    overflow: hidden;
    font-size: 22px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    gap: 8px;
    width: 100%;
    margin: 0;
  }

  .top-actions .chip {
    width: 100%;
    min-width: 0;
    min-height: 38px;
    height: 38px;
    padding: 0 8px;
    font-size: 12px;
    box-shadow: none;
  }

  .top-actions #themeBtn,
  .top-actions #langBtn {
    width: 42px;
    padding: 0;
  }

  .top-actions #promotionBtn {
    grid-column: 1;
    grid-row: 1;
  }

  .top-actions #supportBtn {
    grid-column: 2;
    grid-row: 1;
  }

  .top-actions #noticeBtn {
    grid-column: 3;
    grid-row: 1;
  }

  .top-actions #themeBtn {
    grid-column: 1;
    grid-row: 2;
    justify-self: start;
  }

  .top-actions #langBtn {
    grid-column: 2;
    grid-row: 2;
    justify-self: center;
  }

  .top-actions .user-badge {
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
    width: 100%;
    max-width: 104px;
    min-height: 38px;
    padding: 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .view {
    max-width: 100%;
  }

  .view:not(#chatView) {
    padding: 12px 12px 24px;
  }

  #chatView.active {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 104px - env(safe-area-inset-top));
    min-height: 0;
    padding: 0;
  }

  #chatView .hero-strip,
  #chatView .insight-row {
    display: none;
  }

  #chatView .chat-layout {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto;
    flex: 1 1 auto;
    gap: 8px;
    width: 100%;
    min-height: 0;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  }

  .chat-thread {
    gap: 10px;
    padding: 2px 0 8px;
  }

  .message-row {
    gap: 8px;
  }

  .message-row .avatar {
    flex-basis: 30px;
    width: 30px;
    height: 30px;
  }

  .message {
    max-width: calc(100% - 38px);
    padding: 11px 12px;
    font-size: 14px;
    line-height: 1.65;
  }

  .prompt-strip {
    width: 100%;
    max-height: 38px;
    gap: 7px;
    padding: 0 0 3px;
    scrollbar-width: none;
  }

  .prompt-strip::-webkit-scrollbar,
  .category-pills::-webkit-scrollbar {
    display: none;
  }

  .prompt-chip {
    min-height: 34px;
    padding: 0 11px;
    font-size: 12px;
  }

  .composer {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    box-shadow: 0 12px 36px rgba(15, 23, 42, 0.12);
  }

  .composer textarea {
    min-height: 54px;
    max-height: 120px;
    font-size: 15px;
    line-height: 1.55;
  }

  .composer-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
    padding-top: 8px;
  }

  .model-selector-inline {
    display: grid;
    width: auto;
    min-width: 0;
    max-width: 100%;
    gap: 4px;
  }

  .model-selector-label {
    font-size: 12px;
    line-height: 1.2;
  }

  .model-picker {
    width: 100%;
    max-width: 220px;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid rgba(17, 24, 39, 0.08);
    border-radius: 8px;
    background: #f5f8fa;
  }

  .model-picker strong {
    font-size: 14px;
  }

  .composer-tools {
    align-self: end;
    gap: 7px;
  }

  .composer-tools button,
  .upload-chat-btn,
  .send-btn {
    width: 42px;
    min-height: 42px;
  }

  .page-summary,
  .hero-strip {
    margin: 0 0 12px;
    padding: 16px;
    border-radius: 8px;
  }

  .page-summary .badge,
  .page-summary > div > span {
    margin-bottom: 6px;
  }

  .page-summary h2,
  .hero-copy h2 {
    margin: 0;
    font-size: 22px;
    line-height: 1.28;
  }

  .page-summary p,
  .hero-copy p {
    margin: 8px 0 0;
    font-size: 14px;
    line-height: 1.65;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
    padding: 10px;
  }

  .toolbar input,
  .toolbar select,
  .project-toolbar input,
  .project-toolbar select,
  .project-toolbar button {
    min-height: 44px;
  }

  .category-pills {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    width: calc(100% + 24px);
    margin: 0 -12px 12px;
    padding: 0 12px 4px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .category-pills button {
    flex: 0 0 auto;
    min-height: 38px;
    white-space: nowrap;
  }

  .app-grid,
  .model-grid,
  .account-grid,
  .account-records,
  .project-layout,
  .tool-grid,
  .pricing-grid,
  .addon-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .app-card,
  .account-card,
  .plan-card,
  .tool-panel,
  .preview-panel,
  .project-list-panel,
  .project-main-panel {
    width: 100%;
    min-width: 0;
    padding: 16px;
  }

  .app-card h3,
  .account-card h2,
  .account-card h3 {
    overflow-wrap: anywhere;
  }

  .account-card,
  .account-overview .account-card {
    grid-column: auto;
  }

  .account-card .metric-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .account-card .metric-row > div {
    min-width: 0;
    min-height: 76px;
    padding: 12px 6px;
  }

  .account-card .metric-row strong {
    font-size: 20px;
  }

  .account-card .metric-row span {
    overflow-wrap: anywhere;
    font-size: 11px;
  }

  .account-records .record-list {
    max-height: 390px;
  }

  .modal {
    align-items: flex-end;
    padding: 12px;
  }

  .modal-card {
    width: 100%;
    max-height: calc(100dvh - 24px);
    padding: 16px;
    border-radius: 8px;
    overscroll-behavior: contain;
  }

  .modal-head {
    position: sticky;
    top: -16px;
    z-index: 4;
    margin: -16px -16px 12px;
    padding: 16px 16px 12px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }

  .modal-head h2 {
    font-size: 22px;
  }

  .site-footer {
    margin: 0;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  }

  .site-footer-inner {
    justify-content: center;
    gap: 5px 10px;
    font-size: 11px;
  }

  .toast {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    max-width: calc(100vw - 24px);
  }

  body.dark .sidebar {
    border-right-color: rgba(255, 255, 255, 0.08);
    background: rgba(13, 23, 34, 0.98);
  }

  body.dark .topbar,
  body.dark .modal-head {
    border-color: rgba(255, 255, 255, 0.08);
    background: rgba(13, 23, 34, 0.94);
  }

  body.dark .model-picker {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
  }
}

@media (max-width: 640px) {
  .chip,
  .user-badge,
  .composer-tools button,
  .upload-chat-btn,
  .send-btn {
    min-height: 42px;
  }

  .modal {
    padding: 12px;
  }

  .modal-card {
    max-height: calc(100dvh - 24px);
  }
}

/* Product story entry */
.product-story[hidden] {
  display: none !important;
}

body.product-story-active {
  overflow: hidden;
}

.product-story {
  --product-story-ink: #111318;
  --product-story-muted: #5f6875;
  --product-story-line: #d9e0e7;
  --product-story-paper: #f5f7f9;
  --product-story-teal: #06727a;
  --product-story-alignment-progress: 0;
  position: fixed;
  inset: 0;
  z-index: 1200;
  overflow: hidden;
  overflow-x: clip;
  color: var(--product-story-ink);
  background: #fff;
  letter-spacing: 0;
  opacity: 1;
}

.product-story.is-ready {
  opacity: 1;
}

.product-story.is-leaving {
  opacity: 1;
  pointer-events: none;
}

.product-story-nav {
  position: absolute;
  inset: 0 0 auto;
  z-index: 4;
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 20px;
  padding: 12px 34px;
  border-bottom: 1px solid var(--product-story-line);
  background: #fff;
}

.product-story-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  color: inherit;
  font-weight: 750;
  text-decoration: none;
}

.product-story-brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 50%;
}

.product-story-status {
  display: grid;
  justify-items: center;
  gap: 5px;
}

.product-story-current-chapter {
  color: var(--product-story-muted);
  font-size: 12px;
  line-height: 1;
  font-weight: 750;
}

.product-story-progress {
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-story-progress span {
  width: 26px;
  height: 3px;
  border-radius: 2px;
  background: var(--product-story-line);
  transition: width 280ms ease, background-color 280ms ease;
}

.product-story-progress span.is-active {
  width: 48px;
  background: var(--product-story-ink);
}

.product-story-skip {
  justify-self: end;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--product-story-ink);
  border-radius: 6px;
  color: #fff;
  background: var(--product-story-ink);
  font-weight: 700;
  cursor: pointer;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.product-story-scroll {
  height: 100dvh;
  overflow-y: auto;
  overflow-x: clip;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  background: #fff;
  opacity: 0;
  transition: opacity 420ms ease;
}

.product-story.is-ready .product-story-scroll {
  opacity: 1;
}

.product-story.is-leaving .product-story-scroll {
  opacity: 0;
}

.product-story-chapter {
  position: relative;
  min-height: 100dvh;
  display: grid;
  overflow-x: clip;
  background: #fff;
}

.product-story-hero {
  min-height: calc(100dvh - 140px);
  padding: 96px 6vw 0;
  grid-template-rows: auto auto;
  align-content: start;
  background: #fff;
}

.product-story-detail {
  min-height: 100dvh;
  padding: 72px 6vw 72px;
  grid-template-rows: auto auto;
  align-content: center;
  gap: 42px;
  overflow-x: clip;
  overflow-y: visible;
}

.product-story-detail:nth-of-type(even) {
  background: var(--product-story-paper);
}

.product-story-copy {
  position: relative;
  z-index: 2;
  width: min(920px, 100%);
  margin: 0 auto;
  text-align: center;
}

.product-story-eyebrow {
  margin: 0 0 14px;
  color: var(--product-story-teal);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 800;
}

.product-story-copy h1,
.product-story-copy h2 {
  max-width: 980px;
  margin: 0 auto 18px;
  font-size: 64px;
  line-height: 1.06;
  font-weight: 760;
  letter-spacing: 0;
  text-wrap: balance;
}

.product-story-copy > p:not(.product-story-eyebrow) {
  max-width: 760px;
  margin: 0 auto;
  color: var(--product-story-muted);
  font-size: 18px;
  line-height: 1.65;
}

.product-story-copy button {
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid var(--product-story-ink);
  border-radius: 6px;
  color: #fff;
  background: var(--product-story-ink);
  font: inherit;
  font-size: 15px;
  font-weight: 750;
  cursor: pointer;
}

.product-story-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.product-story-hero-actions {
  margin-top: 24px;
}

.product-story-copy .product-story-back {
  border: 1px solid var(--product-story-line);
  color: var(--product-story-ink);
  background: #fff;
}

.product-story-product {
  position: relative;
  width: min(1060px, 88vw);
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--product-story-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(17, 19, 24, 0.12);
  transform: translateY(24px) scale(1);
  opacity: 0;
  transition:
    transform 680ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 520ms ease;
}

.product-story-hero-stage {
  width: min(700px, 78vw, 76dvh);
  aspect-ratio: 16 / 8.8;
  margin: 22px auto 0;
}

.product-story-product img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: top center;
  background: #fff;
}

.product-story-product.is-image-fallback::before {
  content: "DeepWrite";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--product-story-muted);
  background: var(--product-story-paper);
  font-size: 18px;
  font-weight: 750;
}

.product-story-product.is-image-fallback img {
  visibility: hidden;
}

.product-story.is-ready .product-story-product,
.product-story.is-ready .product-story-hero-stage {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.product-story-detail .product-story-copy h2 {
  font-size: 42px;
  line-height: 1.12;
}

.product-story-detail .product-story-copy {
  width: 100%;
  text-align: left;
}

.product-story-detail .product-story-copy h2,
.product-story-detail .product-story-copy > p:not(.product-story-eyebrow) {
  margin-inline: 0;
}

.product-story-narrative {
  width: min(1240px, 100%);
  margin: 0 auto;
}

.product-story-capability-list {
  counter-reset: product-story-capability;
  display: grid;
  grid-template-columns: 1fr;
  margin: 38px 0 0;
  padding: 0;
  border-top: 1px solid var(--product-story-ink);
  list-style: none;
}

.product-story-capability-list li {
  counter-increment: product-story-capability;
  min-height: 104px;
  display: grid;
  grid-template-columns: 48px minmax(210px, 0.8fr) minmax(0, 1.7fr);
  align-items: center;
  gap: 20px;
  padding: 22px 0;
  border-bottom: 1px solid var(--product-story-line);
}

.product-story-capability-list li::before {
  content: counter(product-story-capability, decimal-leading-zero);
  align-self: start;
  padding-top: 2px;
  color: var(--product-story-teal);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 800;
}

.product-story-capability-list strong {
  font-size: 17px;
  line-height: 1.45;
}

.product-story-capability-list span {
  color: var(--product-story-muted);
  font-size: 15px;
  line-height: 1.7;
}

.product-story-model-directory {
  display: grid;
  grid-template-columns: 1fr;
  gap: 34px;
  margin-top: 40px;
}

.product-story-model-provider {
  min-width: 0;
  border-top: 1px solid var(--product-story-ink);
}

.product-story-model-provider summary {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 14px 0;
  cursor: pointer;
}

.product-story-model-provider-name {
  min-width: 0;
  font-size: 18px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.product-story-model-provider-count,
.product-story-skill-group-count {
  min-width: 32px;
  color: var(--product-story-teal);
  font-size: 13px;
  line-height: 1.4;
  font-weight: 800;
  text-align: right;
}

.product-story-model-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 6px 0 2px;
}

.product-story-model-item {
  min-width: 0;
  min-height: 118px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--product-story-line);
  border-radius: 6px;
  background: #fff;
}

.product-story-model-name {
  min-width: 0;
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.product-story-model-status {
  align-self: start;
  color: var(--product-story-muted);
  font-size: 12px;
  line-height: 1.5;
  font-weight: 750;
  text-align: right;
}

.product-story-model-status.is-available,
.product-story-model-status.is-configured {
  color: var(--product-story-teal);
}

.product-story-model-badges {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.product-story-model-badge {
  color: var(--product-story-muted);
  font-size: 12px;
  line-height: 1.5;
}

.product-story-model-badge + .product-story-model-badge {
  padding-left: 10px;
  border-left: 1px solid var(--product-story-line);
}

.product-story-public-facts {
  margin-top: 26px;
}

.product-story-public-facts-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  margin: 0;
  padding: 18px 0;
  border-block: 1px solid var(--product-story-line);
}

.product-story-public-facts-list div {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.product-story-public-facts-list dt {
  color: var(--product-story-muted);
  font-size: 13px;
}

.product-story-public-facts-list dd {
  margin: 0;
  color: var(--product-story-ink);
  font-size: 20px;
  font-weight: 800;
}

.product-story-skill-directory {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 34px 44px;
  margin-top: 40px;
}

.product-story-skill-group {
  min-width: 0;
  min-height: 244px;
  padding-top: 16px;
  border-top: 1px solid var(--product-story-ink);
  border-radius: 0;
}

.product-story-skill-group > header {
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 18px;
}

.product-story-skill-group-name {
  min-width: 0;
  font-size: 17px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.product-story-skill-list {
  display: grid;
  grid-template-columns: 1fr;
}

.product-story-skill-item {
  min-width: 0;
  min-height: 104px;
  padding: 16px 0;
  border-bottom: 1px solid var(--product-story-line);
  border-radius: 0px;
  background: transparent;
}

.product-story-skill-name {
  display: block;
  font-size: 15px;
  line-height: 1.5;
}

.product-story-skill-description {
  margin: 7px 0 0;
  color: var(--product-story-muted);
  font-size: 13px;
  line-height: 1.65;
}

.product-story-catalog-note,
.product-story-catalog-notice {
  margin: 18px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--product-story-line);
  color: var(--product-story-muted);
  font-size: 13px;
  line-height: 1.65;
}

.product-story-tech-flow {
  counter-reset: product-story-technology;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 42px 0 24px;
  padding: 0;
  border-top: 1px solid var(--product-story-ink);
  list-style: none;
}

.product-story-tech-flow li {
  counter-increment: product-story-technology;
  position: relative;
  min-width: 0;
  min-height: 210px;
  padding: 46px 20px 24px 0;
  border-bottom: 1px solid var(--product-story-line);
}

.product-story-tech-flow li::before {
  content: counter(product-story-technology, decimal-leading-zero);
  position: absolute;
  top: 16px;
  left: 0;
  color: var(--product-story-teal);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 800;
}

.product-story-tech-flow li::after {
  content: "";
  position: absolute;
  top: -4px;
  left: 0;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--product-story-teal);
}

.product-story-tech-flow strong,
.product-story-tech-flow span {
  display: block;
}

.product-story-tech-flow strong {
  min-height: 48px;
  font-size: 16px;
  line-height: 1.5;
}

.product-story-tech-flow span {
  margin-top: 10px;
  color: var(--product-story-muted);
  font-size: 13px;
  line-height: 1.65;
}

.product-story-narrative > [data-product-story-copy="technologyCaveat"] {
  max-width: 920px;
  margin: 24px 0 0;
  color: var(--product-story-muted);
  font-size: 13px;
  line-height: 1.7;
}

.product-story-deliverables {
  counter-reset: product-story-deliverable;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 40px;
  margin: 38px 0 0;
  padding: 0;
  border-top: 1px solid var(--product-story-ink);
  list-style: none;
  text-align: left;
}

.product-story-deliverables li {
  counter-increment: product-story-deliverable;
  min-height: 72px;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--product-story-line);
  font-size: 15px;
  line-height: 1.55;
}

.product-story-deliverables li::before {
  content: counter(product-story-deliverable, decimal-leading-zero);
  color: var(--product-story-teal);
  font-size: 11px;
  font-weight: 800;
}

.product-story-final {
  min-height: 100dvh;
  padding: 124px 0 72px;
  align-content: center;
  gap: 42px;
  background: var(--product-story-paper);
}

.product-story-final-cta {
  max-width: 1040px;
  margin: 0 auto;
  text-align: center;
}

.product-story-final .product-story-copy h2 {
  font-size: 46px;
  line-height: 1.1;
}

.product-story-final .product-story-actions {
  margin-top: 24px;
}

.product-story-final .product-story-product {
  width: min(760px, 88vw);
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  transition:
    transform 140ms linear,
    opacity 140ms linear,
    box-shadow 280ms ease;
}

.product-story.is-ready .product-story-final .product-story-product {
  opacity: calc(0.72 + (var(--product-story-alignment-progress) * 0.28));
  transform: translateY(calc((1 - var(--product-story-alignment-progress)) * 24px));
}

.product-story.is-product-aligned .product-story-final .product-story-product {
  box-shadow: 0 18px 44px rgba(22, 31, 43, 0.1);
}

#productStoryReplay {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 2px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

#productStoryReplay:hover,
#productStoryReplay:focus-visible {
  color: var(--brand);
  text-decoration: underline;
}

.product-story-brand:focus-visible,
.product-story button:focus-visible {
  outline: 3px solid var(--product-story-ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 7px var(--product-story-teal);
}

.product-story button:disabled {
  cursor: wait;
}

@media (max-width: 1280px) {
  .product-story-copy h1,
  .product-story-copy h2 {
    font-size: 56px;
  }

  .product-story-detail .product-story-copy h2,
  .product-story-final .product-story-copy h2 {
    font-size: 40px;
  }
}

@media (min-width: 1440px) {
  .product-story-tech-flow {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .product-story-tech-flow li {
    min-height: 256px;
    padding-right: 22px;
  }
}

@media (max-width: 960px) {
  .product-story-model-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-story-skill-directory {
    grid-template-columns: 1fr;
  }

  .product-story-skill-group {
    min-height: 0;
  }

  .product-story-tech-flow {
    grid-template-columns: 1fr;
    gap: 0;
    border-top: 0;
  }

  .product-story-tech-flow li {
    min-height: 0;
    padding: 18px 0 24px 64px;
    border-left: 1px solid var(--product-story-line);
  }

  .product-story-tech-flow li::before {
    top: 18px;
    left: 20px;
  }

  .product-story-tech-flow li::after {
    top: 24px;
    left: -4px;
  }

  .product-story-tech-flow strong {
    min-height: 0;
  }
}

@media (max-width: 768px) {
  .skill-model-card {
    width: min(100vw - 24px, 560px);
    height: min(760px, calc(100dvh - 24px));
    padding: 16px;
  }

  .skill-model-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-auto-rows: 304px;
    gap: 12px;
  }

  .skill-model-option {
    height: 304px;
  }

  .product-story-nav {
    min-height: 64px;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px 12px;
  }

  .product-story-brand span {
    display: none;
  }

  .product-story-brand {
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
  }

  .product-story-brand img {
    width: 38px;
    height: 38px;
  }

  .product-story-current-chapter {
    display: none;
  }

  .product-story-status {
    gap: 0;
  }

  .product-story-progress {
    gap: 4px;
  }

  .product-story-progress span {
    width: 10px;
  }

  .product-story-progress span.is-active {
    width: 20px;
  }

  .product-story-skip {
    min-height: 44px;
    padding: 0 10px;
    font-size: 13px;
  }

  .product-story-chapter {
    min-height: 100dvh;
    padding-top: 104px;
    padding-inline: 18px;
    padding-bottom: 56px;
    overflow-x: clip;
  }

  .product-story-hero {
    min-height: calc(100dvh - 140px);
    padding: 90px 18px 20px;
    grid-template-rows: auto auto;
  }

  .product-story-detail {
    padding: 88px 18px 56px;
    gap: 28px;
  }

  .product-story-final {
    padding: 104px 18px 56px;
    gap: 28px;
  }

  .product-story-copy {
    width: 100%;
  }

  .product-story-copy h1 {
    font-size: 40px;
    line-height: 1.08;
  }

  .product-story-copy h2,
  .product-story-detail .product-story-copy h2,
  .product-story-final .product-story-copy h2 {
    font-size: 34px;
    line-height: 1.16;
  }

  html:lang(en) #productStoryTitle0 {
    font-size: 29px;
  }

  .product-story-copy > p:not(.product-story-eyebrow) {
    font-size: 16px;
    line-height: 1.6;
  }

  .product-story-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-story-hero-stage {
    width: min(300px, 80vw, 50dvh);
    margin: 20px auto 0;
    aspect-ratio: 4 / 3;
  }

  .product-story-product {
    width: 100%;
    aspect-ratio: 4 / 3;
  }

  .product-story-capability-list {
    grid-template-columns: 1fr;
    margin-top: 30px;
  }

  .product-story-capability-list li {
    min-height: 0;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 8px 12px;
    padding: 18px 0;
  }

  .product-story-capability-list li::before {
    grid-row: 1 / span 2;
  }

  .product-story-capability-list span {
    grid-column: 2;
  }

  .product-story-model-directory,
  .product-story-skill-directory {
    margin-top: 30px;
  }

  .product-story-model-list,
  .product-story-skill-directory,
  .product-story-skill-list,
  .product-story-deliverables {
    grid-template-columns: 1fr;
  }

  .product-story-model-provider summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .product-story-model-provider-name,
  .product-story-skill-group-name,
  .product-story-model-name {
    overflow-wrap: anywhere;
  }

  .product-story-model-item {
    min-height: 104px;
    grid-template-columns: minmax(0, 1fr);
  }

  .product-story-model-status {
    white-space: normal;
    text-align: left;
  }

  .product-story-public-facts-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .product-story-skill-group {
    min-height: 0;
  }

  .product-story-tech-flow {
    grid-template-columns: 1fr;
    margin-top: 30px;
  }

  .product-story-deliverables {
    gap: 0;
  }

  .product-story-actions button {
    width: 100%;
    min-height: 44px;
  }

  .product-story-actions button:only-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 430px) {
  .product-story-chapter {
    padding-inline: 16px;
  }

  .product-story-chapter * {
    min-width: 0;
  }

  .product-story-copy h1 {
    font-size: 36px;
  }

  .product-story-copy h2,
  .product-story-detail .product-story-copy h2,
  .product-story-final .product-story-copy h2 {
    font-size: 30px;
  }

  html:lang(en) #productStoryTitle0 {
    font-size: 29px;
  }

  .product-story-actions {
    grid-template-columns: 1fr;
  }

  .product-story-actions button {
    min-height: 44px;
  }

  .product-story-skip {
    max-width: 84px;
    overflow-wrap: anywhere;
  }
}

@media (prefers-reduced-motion: reduce) {
  .product-story,
  .product-story *,
  .product-story *::before,
  .product-story *::after {
    scroll-behavior: auto !important;
    animation: none !important;
    transition: none !important;
  }

  .product-story-scroll {
    opacity: 1 !important;
  }

  .product-story-product {
    transform: none !important;
    opacity: 1 !important;
  }

  .product-story.is-ready .product-story-hero-stage {
    transform: none !important;
    opacity: 1 !important;
  }
}
