:root {
  color-scheme: light;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-soft: #f9f9ff;
  --line: #e5e7f3;
  --line-strong: #d7daf0;
  --text: #12162f;
  --muted: #68708a;
  --muted-strong: #505875;
  --accent: #6d5dfc;
  --accent-strong: #5747ef;
  --accent-soft: #eeecff;
  --blue-soft: #eef6ff;
  --green-soft: #ecf8f0;
  --amber-soft: #fff7e3;
  --danger-soft: #fff0f0;
  --shadow: 0 20px 70px rgba(64, 56, 128, 0.11);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  letter-spacing: 0;
}

.auth-gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(420px, 0.95fr) minmax(520px, 1.05fr);
  background: #fff;
}

.auth-brand-panel {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  padding: clamp(30px, 4.2vw, 64px);
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 18% 84%, rgba(255, 255, 255, 0.13), transparent 25%),
    radial-gradient(circle at 84% 12%, rgba(255, 255, 255, 0.1), transparent 22%),
    #6354ef;
  color: #fff;
}

.auth-brand-panel::after {
  content: "";
  position: absolute;
  width: 380px;
  height: 380px;
  right: -180px;
  bottom: -190px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  box-shadow:
    0 0 0 54px rgba(255, 255, 255, 0.025),
    0 0 0 108px rgba(255, 255, 255, 0.018);
  pointer-events: none;
}

.auth-brand,
.auth-mobile-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand .brand-mark {
  color: var(--accent-strong);
  background: #fff;
  box-shadow: 0 14px 36px rgba(34, 26, 117, 0.2);
}

.auth-brand strong,
.auth-brand span,
.auth-mobile-brand strong,
.auth-mobile-brand span {
  display: block;
}

.auth-brand strong {
  font-size: 19px;
}

.auth-brand span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.68);
}

.auth-brand-copy {
  position: relative;
  z-index: 1;
  max-width: 540px;
  margin-top: clamp(58px, 10vh, 112px);
}

.auth-brand-copy h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(42px, 5vw, 68px);
  font-weight: 750;
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.auth-brand-copy p {
  max-width: 430px;
  margin-top: 24px;
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(15px, 1.5vw, 18px);
  line-height: 1.8;
}

.auth-preview {
  position: relative;
  z-index: 1;
  width: min(100%, 560px);
  aspect-ratio: 1.85;
  margin-top: clamp(34px, 7vh, 74px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.09);
  box-shadow: 0 26px 70px rgba(35, 25, 132, 0.25);
  backdrop-filter: blur(8px);
}

.auth-preview-toolbar {
  height: 34px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.13);
}

.auth-preview-toolbar span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
}

.auth-preview-body {
  height: calc(100% - 34px);
  display: grid;
  grid-template-columns: 20% 29% minmax(0, 1fr);
}

.auth-preview-nav,
.auth-preview-list,
.auth-preview-editor {
  padding: 16px 13px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.11);
}

.auth-preview-editor {
  border-right: 0;
}

.auth-preview i,
.auth-preview b {
  display: block;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.auth-preview b {
  width: 68%;
  height: 10px;
  background: rgba(255, 255, 255, 0.48);
}

.auth-preview-nav i:nth-child(2),
.auth-preview-nav i:nth-child(4) {
  width: 72%;
}

.auth-preview-list i {
  height: 42px;
  border-radius: 7px;
}

.auth-preview-list i:first-of-type {
  background: rgba(255, 255, 255, 0.3);
  box-shadow: inset 2px 0 0 rgba(255, 255, 255, 0.75);
}

.auth-preview-editor i:nth-child(2) {
  width: 88%;
}

.auth-preview-editor i:nth-child(3) {
  width: 72%;
}

.auth-preview-editor i:nth-child(4) {
  width: 82%;
}

.auth-brand-footnote {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding-top: 30px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
}

.auth-form-panel {
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding: clamp(28px, 5vw, 76px);
  display: grid;
  place-items: center;
  background: #fff;
}

.auth-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.auth-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: auth-spin 700ms linear infinite;
}

@keyframes auth-spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-card {
  width: min(100%, 470px);
}

.auth-mobile-brand {
  display: none;
  margin-bottom: 28px;
}

.auth-mobile-brand strong {
  font-size: 17px;
}

.auth-mobile-brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.auth-tabs {
  height: 44px;
  padding: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  border-radius: 10px;
  background: #f1f2f8;
}

.auth-tab {
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.auth-tab:hover {
  color: var(--text);
}

.auth-tab.is-active {
  color: var(--accent-strong);
  background: #fff;
  box-shadow: 0 2px 9px rgba(44, 45, 74, 0.09);
}

.auth-panel {
  padding-top: 38px;
}

.auth-heading h2 {
  color: var(--text);
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.auth-heading p {
  margin-top: 9px;
  color: var(--muted);
  line-height: 1.6;
}

.auth-form {
  margin-top: 30px;
  display: grid;
  gap: 18px;
}

.auth-field {
  display: grid;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 600;
}

.auth-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-inline-link {
  min-height: 44px;
  padding: 0 2px;
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--accent-strong);
  font-weight: 650;
  cursor: pointer;
}

.auth-inline-link:hover,
.auth-inline-link:focus-visible {
  text-decoration: underline;
}

.auth-input-wrap {
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.auth-input-wrap:focus-within {
  border-color: #aaa1ff;
  box-shadow: 0 0 0 3px rgba(109, 93, 252, 0.11);
}

.auth-input-wrap i {
  flex: 0 0 auto;
  font-size: 16px;
}

.auth-input-wrap input {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 400;
}

.auth-input-wrap input::placeholder {
  color: var(--muted);
}

.auth-password-toggle {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  margin-right: -10px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
}

.auth-password-toggle:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.auth-password-toggle i {
  font-size: 17px;
}

.auth-field-hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
}

.auth-password-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.primary-action.auth-submit {
  width: 100%;
  min-height: 46px;
  justify-content: center;
  font-weight: 650;
  box-shadow: 0 12px 24px rgba(109, 93, 252, 0.19);
}

.auth-submit i {
  font-size: 17px;
}

.auth-switch-copy {
  margin-top: 22px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.auth-switch-copy button {
  min-height: 44px;
  margin: -12px -4px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  background: transparent;
  color: var(--accent-strong);
  font-weight: 650;
}

.auth-trust-note {
  margin-top: 16px;
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted-strong);
  font-size: 11px;
  line-height: 1.6;
}

.auth-trust-note i {
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--accent-strong);
  font-size: 14px;
}

.auth-feedback-button {
  display: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  overflow: hidden;
}

.sidebar {
  min-height: 0;
  height: 100%;
  padding: 24px 18px;
  background: rgba(255, 255, 255, 0.86);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 14px 28px rgba(109, 93, 252, 0.26);
  flex: 0 0 auto;
}

.brand-mark i {
  font-size: 22px;
}

.brand strong,
.brand span {
  display: block;
  white-space: nowrap;
}

.brand strong {
  font-size: 20px;
  line-height: 1.15;
}

.brand span {
  color: var(--muted);
  margin-top: 3px;
}

.nav-stack {
  display: grid;
  gap: 6px;
}

.nav-stack.compact {
  gap: 4px;
}

.nav-item {
  min-height: 38px;
  border-radius: var(--radius);
  padding: 0 10px;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--muted-strong);
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.nav-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-item small {
  color: var(--muted);
}

.sidebar-section {
  display: grid;
  gap: 8px;
}

.account-panel {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
}

.workspace-feedback-button,
.editor-toolbar .mobile-back-button {
  display: none;
}

.workspace-feedback-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted-strong);
  background: #fff;
}

.workspace-feedback-button:hover {
  color: var(--accent-strong);
  border-color: #c5bfff;
  background: var(--accent-soft);
}

.account-button {
  width: 100%;
  min-height: 56px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted-strong);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 8px;
  text-align: left;
}

.account-profile-button {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  text-align: left;
}

.account-profile-button:hover strong {
  color: var(--accent-strong);
}

.account-avatar {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--accent);
  font-size: 12px;
  font-weight: 750;
  overflow: hidden;
}

.account-avatar img,
.settings-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-button span,
.account-button strong,
.account-button small {
  min-width: 0;
  display: block;
}

.account-button strong {
  color: var(--text);
  font-size: 13px;
}

.account-button small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-logout-button {
  width: 28px;
  height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
}

.account-logout-button:hover {
  color: #be3439;
  background: var(--danger-soft);
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  padding: 0 8px;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-pill {
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--muted-strong);
  background: #fff;
  border: 1px solid var(--line);
}

.tag-pill.is-active {
  color: var(--accent-strong);
  border-color: #c5bfff;
  background: var(--accent-soft);
}

.workspace {
  min-width: 0;
  min-height: 0;
  height: 100%;
  padding: 28px;
  display: grid;
  grid-template-columns: 304px minmax(360px, 1fr);
  gap: 18px;
}

.prompt-panel,
.editor-panel {
  min-height: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.prompt-panel {
  min-width: 0;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: hidden;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
  margin-top: 2px;
}

.view-summary {
  display: block;
  margin-top: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.view-summary-row {
  display: grid;
  grid-template-columns: 22px minmax(0, auto) auto;
  align-items: center;
  justify-content: start;
  gap: 8px;
  color: var(--accent-strong);
  font-size: 14px;
  line-height: normal;
}

.view-summary-row i {
  width: 22px;
  display: grid;
  place-items: center;
  font-size: 14px;
}

.view-summary-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view-summary-row small {
  color: var(--muted);
  font-size: 14px;
}

h2 {
  font-size: 15px;
  line-height: 1.2;
}

.icon-button {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--muted-strong);
  background: #fff;
  border: 1px solid var(--line);
}

.icon-button:hover {
  color: var(--accent-strong);
  border-color: #c7c1ff;
  background: var(--accent-soft);
}

.icon-button.is-active {
  color: var(--accent-strong);
  border-color: #c5bfff;
  background: var(--accent-soft);
}

.search-box {
  height: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.prompt-list {
  min-height: 0;
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.load-more-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--accent-strong);
  background: var(--surface-soft);
}

.load-more-button:hover {
  border-color: #c5bfff;
  background: var(--accent-soft);
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 16px;
  display: grid;
  gap: 8px;
  color: var(--muted);
  background: var(--surface-soft);
}

.empty-state strong {
  color: var(--text);
}

.text-button {
  justify-self: start;
  color: var(--accent-strong);
  background: transparent;
  padding: 0;
}

.empty-state-action {
  justify-self: start;
  margin-top: 2px;
}

.prompt-card {
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 8px;
  text-align: left;
}

.prompt-card:hover,
.prompt-card.is-active {
  border-color: #d0cbff;
  background: #f6f4ff;
}

.prompt-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.prompt-card-title i {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #ff6b57;
  background: var(--danger-soft);
  flex: 0 0 auto;
}

.prompt-card:nth-child(2n) .prompt-card-title i {
  color: #2a79d4;
  background: var(--blue-soft);
}

.prompt-card:nth-child(3n) .prompt-card-title i {
  color: #1f9955;
  background: var(--green-soft);
}

.prompt-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.prompt-card-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.prompt-card-meta span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.editor-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.editor-toolbar,
.editor-footer {
  min-width: 0;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.editor-toolbar {
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.editor-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.category-picker {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(190px, 260px);
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.category-picker .select-pill {
  min-width: 0;
  width: 100%;
  border-color: transparent;
  box-shadow: inset 0 0 0 1px var(--line);
}

.category-menu-button {
  justify-content: flex-start;
}

.category-menu-button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-menu-button i:last-child {
  margin-left: auto;
}

.category-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  width: min(320px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 18px 48px rgba(64, 56, 128, 0.15);
  padding: 8px;
}

.category-menu-list {
  max-height: 252px;
  overflow: auto;
  display: grid;
  gap: 3px;
  padding-bottom: 7px;
}

.category-menu-actions {
  border-top: 1px solid var(--line);
  padding-top: 7px;
  display: grid;
  gap: 3px;
}

.category-menu-item,
.menu-action {
  width: 100%;
  min-height: 34px;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted-strong);
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 0 9px;
  text-align: left;
}

.menu-action {
  grid-template-columns: 22px minmax(0, 1fr);
}

.category-menu-item:hover,
.category-menu-item.is-active,
.menu-action:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.category-menu-item span,
.menu-action span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-menu-item small {
  color: var(--muted);
}

.editor-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.select-pill,
.toolbar-button,
.footer-action,
.primary-action {
  min-height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted-strong);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  white-space: nowrap;
}

.select-pill select {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--muted-strong);
  background: transparent;
}

.toolbar-button:hover,
.footer-action:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: #c5bfff;
}

.footer-action-group {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-footer-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
}

.prompt-character-count {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.prompt-character-count.is-warning {
  color: #a66a14;
}

.prompt-character-count.is-over-limit {
  color: #be3439;
  font-weight: 700;
}

.danger-secondary {
  color: #be3439;
}

.danger-secondary:hover {
  color: #be3439;
  background: var(--danger-soft);
  border-color: #f2b8ba;
}

.primary-action {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.primary-action:hover {
  background: var(--accent-strong);
}

.editor-title-row {
  padding: 16px 18px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.prompt-title-input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  background: transparent;
}

.meta-pill {
  flex: 0 0 auto;
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}

.run-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.run-result-header span {
  font-weight: 700;
}

.run-result-header small {
  color: var(--muted);
  font-size: 12px;
}

.editor-surface {
  min-width: 0;
  min-height: 0;
  padding: 6px 18px 18px;
  display: flex;
  overflow: hidden;
}

.editor-surface textarea {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  resize: none;
  border: 0;
  outline: 0;
  color: #171a32;
  background: #fff;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px;
  line-height: 1.75;
}

.run-result {
  border-top: 1px solid var(--line);
  padding: 12px 18px;
  display: grid;
  gap: 10px;
  background: #fff;
}

.run-result[hidden] {
  display: none;
}

.run-result pre {
  margin: 0;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-soft);
  color: #282d46;
  line-height: 1.65;
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
}

.search-box:focus-within {
  border-color: #b8b0ff;
  box-shadow: 0 0 0 3px rgba(109, 93, 252, 0.12);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(109, 93, 252, 0.28);
  outline-offset: 2px;
}

.auth-input-wrap input:focus-visible {
  outline: 0;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  min-width: 220px;
  max-width: min(420px, calc(100vw - 32px));
  border-radius: var(--radius);
  background: #12162f;
  color: #fff;
  padding: 11px 14px;
  text-align: center;
  transition: opacity 160ms ease, transform 160ms ease;
  box-shadow: 0 16px 42px rgba(18, 22, 47, 0.24);
}

.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.feedback-tab {
  position: fixed;
  z-index: 30;
  right: 0;
  top: 50%;
  min-height: 112px;
  padding: 14px 10px;
  border: 0;
  border-radius: 12px 0 0 12px;
  background: #12162f;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 14px 36px rgba(18, 22, 47, 0.22);
  transform: translateY(-50%);
}

.feedback-tab:hover {
  background: var(--accent-strong);
}

body:not(.is-authenticated) .feedback-tab {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.96);
  color: var(--accent-strong);
  box-shadow: 0 12px 32px rgba(64, 56, 128, 0.14);
}

body:not(.is-authenticated) .feedback-tab:hover {
  border-color: #c5bfff;
  background: var(--accent-soft);
}

.feedback-tab i {
  font-size: 19px;
}

.feedback-tab span {
  writing-mode: vertical-rl;
  letter-spacing: 0.14em;
  font-size: 12px;
  font-weight: 700;
}

.form-dialog {
  width: min(420px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  box-shadow: var(--shadow);
}

.form-dialog::backdrop {
  background: rgba(22, 24, 48, 0.34);
  backdrop-filter: blur(4px);
}

.dialog-header {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog-header .icon-button {
  width: 40px;
  height: 40px;
}

.dialog-header > div {
  min-width: 0;
}

.dialog-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.dialog-form {
  margin: 0;
}

.dialog-body {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.dialog-body p {
  color: var(--muted-strong);
  line-height: 1.6;
}

.dialog-field {
  display: grid;
  gap: 7px;
  color: var(--muted-strong);
  font-size: 12px;
}

.dialog-field input {
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
  padding: 0 10px;
  outline: 0;
}

.dialog-field select,
.dialog-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #fff;
  padding: 9px 10px;
  outline: 0;
  resize: vertical;
  font: inherit;
}

.dialog-field select {
  min-height: 40px;
}

.dialog-field textarea:focus,
.dialog-field select:focus {
  border-color: #b8b0ff;
  box-shadow: 0 0 0 3px rgba(109, 93, 252, 0.12);
}

.feedback-dialog {
  width: min(500px, calc(100vw - 28px));
}

.feedback-dialog .dialog-body {
  gap: 15px;
}

.feedback-dialog .dialog-field > span small {
  color: var(--muted);
  font-weight: 400;
}

.field-hint {
  justify-self: end;
  color: var(--muted);
  font-size: 11px;
}

.feedback-privacy {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 10px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  font-size: 11px;
}

.feedback-honeypot {
  position: fixed;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (max-width: 720px) {
  body:not(.is-authenticated) .feedback-tab {
    display: none;
  }

  .auth-feedback-button {
    min-height: 44px;
    margin: 28px auto 0;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: #fff;
    color: var(--accent-strong);
    font-weight: 650;
  }

  .auth-feedback-button:hover {
    border-color: #c5bfff;
    background: var(--accent-soft);
  }

  .feedback-tab {
    top: auto;
    right: 16px;
    bottom: 16px;
    min-height: 44px;
    padding: 0 15px;
    border-radius: 999px;
    flex-direction: row;
    transform: none;
  }

  .feedback-tab span {
    writing-mode: horizontal-tb;
    letter-spacing: 0;
  }
}

.verification-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.verification-code-button {
  min-width: 104px;
  min-height: 38px;
  justify-content: center;
}

.auth-form .verification-code-button {
  min-height: 44px;
}

.form-status {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.form-status.is-success {
  color: #167847;
}

.form-status.is-error {
  color: #be3439;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-choice {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--muted-strong);
  background: #fff;
}

.icon-choice:hover,
.icon-choice.is-active {
  color: var(--accent-strong);
  border-color: #c5bfff;
  background: var(--accent-soft);
}

.icon-choice i {
  font-size: 18px;
}

.dialog-field input:focus {
  border-color: #b8b0ff;
  box-shadow: 0 0 0 3px rgba(109, 93, 252, 0.12);
}

.dialog-actions {
  padding: 12px 14px 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid var(--line);
}

.dialog-actions .footer-action,
.dialog-actions .primary-action {
  min-height: 40px;
}

.danger-action {
  background: #e5484d;
  border-color: #e5484d;
}

.danger-action:hover {
  background: #c93439;
}

.account-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 40px));
  border-color: rgba(215, 218, 240, 0.88);
  border-radius: 16px;
  background: #f7f7fc;
  box-shadow: 0 28px 90px rgba(39, 34, 92, 0.2);
}

.account-dialog .dialog-header {
  min-height: 86px;
  padding: 18px 20px;
  border-color: rgba(215, 218, 240, 0.85);
  background: rgba(255, 255, 255, 0.94);
}

.account-dialog-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-dialog-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 20px;
}

.account-dialog-title h2 {
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.account-dialog .dialog-subtitle {
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.5;
}

.account-dialog-close {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-color: transparent;
  border-radius: 10px;
  background: var(--surface-soft);
  font-size: 18px;
}

.account-dialog-close:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(109, 93, 252, 0.2);
}

.account-dialog-body {
  overflow-y: auto;
  max-height: calc(100vh - 126px);
  padding: 16px;
  display: grid;
  gap: 12px;
  overscroll-behavior: contain;
}

.account-settings-section {
  padding: 18px 20px;
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(32, 28, 79, 0.025);
}

.settings-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.settings-section-heading > div {
  min-width: 0;
}

.settings-section-icon {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 16px;
}

.settings-section-heading h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}

.settings-section-heading p,
.avatar-summary p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.settings-section-heading strong {
  color: var(--muted-strong);
}

.bound-email {
  display: inline-flex;
  margin-left: 4px;
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--accent-strong) !important;
  background: var(--accent-soft);
  font-weight: 650;
}

.profile-settings-grid {
  display: grid;
  grid-template-columns: minmax(235px, 0.88fr) minmax(0, 1.12fr);
  gap: 22px;
  align-items: start;
}

.avatar-summary {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.avatar-summary > div {
  min-width: 0;
}

.avatar-summary > div > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.avatar-summary p {
  margin-top: 6px;
  white-space: nowrap;
}

.settings-avatar {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  overflow: hidden;
  border: 3px solid #fff;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 23px;
  font-weight: 750;
  box-shadow: 0 0 0 1px var(--line), 0 8px 20px rgba(76, 62, 196, 0.16);
}

.settings-form {
  display: grid;
  gap: 12px;
}

.nickname-summary {
  padding-left: 22px;
  border-left: 1px solid var(--line);
}

.nickname-summary > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.nickname-summary > strong {
  display: block;
  margin-top: 6px;
  color: var(--text);
  font-size: 18px;
  overflow-wrap: anywhere;
}

.nickname-summary > p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.nickname-summary code {
  color: var(--accent-strong);
  font-family: inherit;
  font-weight: 700;
}

.settings-fields-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 1.08fr);
  gap: 12px;
}

.current-email-verification-field {
  width: calc((100% - 12px) / 2);
}

.account-dialog .dialog-field {
  gap: 7px;
  font-weight: 600;
}

.account-dialog .dialog-field input {
  min-height: 40px;
  border-color: var(--line-strong);
  border-radius: 9px;
  padding: 0 12px;
  background: #fcfcff;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.account-dialog .dialog-field input:hover {
  border-color: #c9cce1;
}

.account-dialog .dialog-field input:focus {
  background: #fff;
}

.account-dialog .verification-code-button {
  min-height: 40px;
  border-radius: 9px;
}

.settings-form-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-form-action .form-status {
  flex: 1;
  margin: 0;
}

.settings-form-action .form-status:empty {
  min-height: 0;
}

.settings-form-action .primary-action {
  flex: 0 0 auto;
  min-height: 38px;
  border-radius: 9px;
  padding: 0 13px;
  font-weight: 650;
  box-shadow: 0 7px 16px rgba(109, 93, 252, 0.18);
}

.danger-zone {
  border-color: #f2d6d7;
  background: #fffafa;
  box-shadow: none;
}

.danger-zone .settings-section-heading h3 {
  color: #a82f34;
}

.danger-zone .settings-section-icon {
  color: #b73339;
  background: var(--danger-soft);
}

.danger-zone .danger-action {
  box-shadow: 0 7px 16px rgba(229, 72, 77, 0.16);
}

@media (max-width: 720px) {
  .profile-settings-grid,
  .settings-fields-grid {
    grid-template-columns: 1fr;
  }

  .nickname-summary {
    padding-top: 16px;
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .current-email-verification-field {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .account-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    border-radius: 14px;
  }

  .account-dialog .dialog-header {
    min-height: 74px;
    padding: 14px;
  }

  .account-dialog-mark {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .account-dialog .dialog-subtitle {
    max-width: 230px;
  }

  .account-dialog-body {
    max-height: calc(100vh - 94px);
    padding: 10px;
    gap: 10px;
  }

  .account-settings-section {
    padding: 15px;
    gap: 16px;
  }

  .avatar-summary {
    align-items: flex-start;
  }

  .avatar-summary p {
    white-space: normal;
  }

  .verification-code-button {
    min-width: 98px;
  }

  .settings-form-action {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-form-action .primary-action {
    justify-content: center;
  }
}

@media (max-width: 1180px) {
  .auth-gate {
    grid-template-columns: minmax(380px, 0.82fr) minmax(500px, 1.18fr);
  }

  .auth-brand-copy h1 {
    font-size: 50px;
  }

  .app-shell {
    grid-template-columns: 212px minmax(0, 1fr);
  }

  .workspace {
    grid-template-columns: 280px minmax(340px, 1fr);
  }
}

@media (max-width: 1320px) and (min-width: 1181px) {
  .app-shell {
    grid-template-columns: 224px minmax(0, 1fr);
  }

  .sidebar {
    padding: 22px 14px;
  }

  .workspace {
    padding: 20px;
    grid-template-columns: 270px minmax(390px, 1fr);
    gap: 16px;
  }
}

@media (min-width: 881px) and (max-height: 760px) {
  .auth-brand-panel {
    padding: 34px 42px;
  }

  .auth-brand-copy {
    margin-top: 42px;
  }

  .auth-brand-copy h1 {
    font-size: 44px;
  }

  .auth-brand-copy p {
    margin-top: 16px;
    font-size: 15px;
    line-height: 1.65;
  }

  .auth-preview {
    width: min(100%, 450px);
    margin-top: 28px;
  }

  .auth-brand-footnote {
    padding-top: 18px;
  }

  .auth-form-panel {
    padding-top: 28px;
    padding-bottom: 28px;
  }

  .sidebar {
    padding: 18px 14px;
    gap: 14px;
  }

  .workspace {
    padding: 18px;
  }

  .prompt-panel {
    padding: 14px;
    gap: 10px;
  }

  .editor-toolbar,
  .editor-footer {
    padding: 10px 12px;
  }

  .editor-title-row {
    padding: 12px 18px 8px;
  }

}

@media (max-width: 880px) {
  .auth-gate {
    grid-template-columns: 1fr;
  }

  .auth-brand-panel {
    display: none;
  }

  .auth-form-panel {
    padding: 38px 22px;
    background: var(--bg);
  }

  .auth-card {
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    box-shadow: var(--shadow);
  }

  .auth-mobile-brand {
    display: flex;
  }

  .select-pill,
  .toolbar-button,
  .footer-action,
  .primary-action,
  .workspace-feedback-button,
  .nav-item,
  .category-menu-item,
  .menu-action {
    min-height: 44px;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .dialog-header .icon-button {
    width: 44px;
    height: 44px;
  }

  .dialog-actions .footer-action,
  .dialog-actions .primary-action {
    min-height: 44px;
  }

  .auth-password-toggle {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
    margin-right: -12px;
  }

  .app-shell {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .sidebar {
    min-height: auto;
    height: auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    gap: 12px;
  }

  .sidebar > .nav-stack {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sidebar > .nav-stack .nav-item {
    min-height: 44px;
    padding: 0 8px;
  }

  .sidebar-section {
    gap: 6px;
  }

  .account-panel {
    margin-top: 0;
    padding-top: 10px;
  }

  body.is-authenticated .feedback-tab {
    display: none;
  }

  .workspace-feedback-button {
    display: inline-flex;
  }

  .section-title {
    padding: 0;
  }

  .sidebar .nav-stack.compact {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .sidebar .nav-stack.compact .nav-item {
    min-width: 132px;
  }

  .tag-cloud {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .tag-pill {
    flex: 0 0 auto;
  }

  .workspace {
    height: auto;
    padding: 16px;
    grid-template-columns: 1fr;
  }

  .app-shell:not(.mobile-editor-open) .editor-panel {
    display: none;
  }

  .app-shell.mobile-editor-open .sidebar,
  .app-shell.mobile-editor-open .prompt-panel {
    display: none;
  }

  .app-shell.mobile-editor-open .workspace {
    min-height: 100vh;
    min-height: 100dvh;
    padding: 12px;
  }

  .app-shell.mobile-editor-open .editor-panel {
    min-height: calc(100vh - 24px);
    min-height: calc(100dvh - 24px);
  }

  .app-shell.mobile-editor-open .editor-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }

  .app-shell.mobile-editor-open .mobile-back-button {
    display: inline-flex;
  }

  .app-shell.mobile-editor-open .category-picker {
    width: auto;
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell.mobile-editor-open .editor-toolbar-actions {
    width: auto;
  }

  .editor-panel {
    grid-template-rows: auto auto minmax(320px, auto) auto;
  }

  .editor-surface textarea {
    min-height: 320px;
  }

  .editor-toolbar,
  .editor-footer {
    flex-wrap: wrap;
  }

  .category-picker {
    flex: 1 1 100%;
    grid-template-columns: minmax(0, 1fr);
  }

  .category-menu {
    width: 100%;
  }

  .editor-toolbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .editor-footer {
    justify-content: stretch;
  }

  .footer-action-group {
    width: 100%;
  }

  .editor-footer button {
    flex: 1 1 112px;
    justify-content: center;
  }

  .primary-footer-actions {
    justify-content: stretch;
  }
}

@media (max-width: 560px) {
  .auth-form-panel {
    padding: 0;
    align-items: stretch;
  }

  .auth-card {
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 28px 20px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .auth-password-row {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .auth-panel {
    padding-top: 30px;
  }

  .auth-heading h2 {
    font-size: 25px;
  }

  .sidebar,
  .workspace {
    padding: 12px;
  }

  .brand strong {
    font-size: 17px;
  }

  .prompt-title-input {
    font-size: 18px;
  }

  .category-picker {
    grid-template-columns: minmax(0, 1fr);
  }

  .editor-title-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
