:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f5;
  --surface-3: #e9edf1;
  --text: #20242a;
  --muted: #6e7681;
  --subtle: #9aa1aa;
  --border: #e2e6ea;
  --border-strong: #cfd5dc;
  --accent: #ff4263;
  --accent-dark: #d92f4e;
  --accent-soft: #fff0f3;
  --green: #138a68;
  --green-soft: #eaf7f2;
  --blue: #3379d9;
  --blue-soft: #eef5ff;
  --amber: #a46b04;
  --amber-soft: #fff7df;
  --danger: #c53644;
  --shadow: 0 8px 24px rgba(26, 33, 42, 0.08);
  --sidebar-width: 224px;
  --topbar-height: 72px;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button,
select,
input[type="color"],
input[type="checkbox"],
input[type="range"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(51, 121, 217, 0.18);
  outline-offset: 1px;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.8;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

.brand-row {
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  gap: 10px;
  padding: 0 17px;
  border-bottom: 1px solid var(--border);
}

.brand-row strong,
.brand-row small {
  display: block;
}

.brand-row strong {
  font-size: 16px;
}

.brand-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid #20242a;
  border-radius: 7px;
  background: #16191d;
  box-shadow: inset 0 0 0 3px #30363d;
}

.brand-mark span {
  color: #59e5ce;
  font-size: 13px;
  font-weight: 800;
}

.sidebar-close {
  display: none;
  margin-left: auto;
}

.nav-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.nav-item {
  display: grid;
  width: 100%;
  min-height: 42px;
  margin: 2px 0;
  padding: 0 12px;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #515963;
  text-align: left;
  transition: background 160ms ease, color 160ms ease;
}

.nav-item:hover {
  background: #f4f5f7;
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
}

.nav-item.active::before {
  position: absolute;
  left: 0;
  width: 3px;
  height: 24px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  content: "";
}

.nav-count {
  display: grid;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  place-items: center;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
}

.nav-item.active .nav-count {
  background: #fff;
  color: var(--accent-dark);
}

.nav-divider {
  margin: 16px 10px 7px;
  color: var(--subtle);
  font-size: 11px;
  font-weight: 700;
}

.sidebar-account {
  display: flex;
  min-height: 70px;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: #fbfcfd;
}

.avatar,
.avatar-button {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #20242a;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.account-copy {
  min-width: 0;
  flex: 1;
}

.account-copy strong,
.account-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong {
  font-size: 12px;
}

.account-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: #20a979;
}

.main-shell {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  gap: 16px;
  padding: 9px 26px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
}

.menu-button {
  display: none;
}

.page-heading {
  min-width: 0;
  flex: 1;
}

.page-heading h1 {
  margin: 2px 0 1px;
  font-size: 21px;
  line-height: 1.2;
}

.page-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.breadcrumb {
  color: var(--subtle);
  font-size: 10px;
}

.topbar-actions,
.inline-actions,
.dock-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.energy-chip {
  display: flex;
  height: 34px;
  align-items: center;
  gap: 6px;
  padding: 0 11px;
  border: 1px solid #eadca7;
  border-radius: 6px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 11px;
}

.energy-chip svg {
  width: 15px;
  height: 15px;
}

.energy-chip strong {
  color: #725013;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: #5d6570;
}

.icon-button:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
}

.content-wrap {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 24px 26px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.workflow-steps {
  display: grid;
  margin-bottom: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.workflow-step {
  position: relative;
  display: grid;
  min-height: 72px;
  padding: 12px 18px 12px 54px;
  align-content: center;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  text-align: left;
}

.workflow-step:last-child {
  border-right: 0;
}

.workflow-step:hover,
.workflow-step.active {
  background: #fbfbfc;
}

.workflow-step.active::after {
  position: absolute;
  inset: auto 16px 0;
  height: 2px;
  background: var(--accent);
  content: "";
}

.workflow-step > span {
  position: absolute;
  left: 16px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.workflow-step.active > span {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.workflow-step strong,
.workflow-step small {
  display: block;
}

.workflow-step strong {
  font-size: 13px;
}

.workflow-step small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.work-section {
  scroll-margin-top: 90px;
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.section-heading {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.section-heading > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.section-heading h2,
.section-heading p {
  margin: 0;
}

.section-heading h2 {
  font-size: 16px;
}

.section-heading p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.step-badge {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  background: #20242a;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.section-status,
.section-meta,
.autosave-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.section-status {
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fafbfc;
}

.section-status.success {
  border-color: #b8dfd0;
  background: var(--green-soft);
  color: var(--green);
}

.section-status svg,
.autosave-state svg {
  width: 14px;
  height: 14px;
}

.collect-bar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto auto;
  gap: 10px;
}

.url-field {
  display: flex;
  height: 42px;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
}

.url-field:focus-within {
  border-color: #8eb2e5;
  box-shadow: 0 0 0 3px rgba(51, 121, 217, 0.1);
}

.url-field svg {
  color: var(--muted);
}

.url-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
}

.button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.button svg {
  width: 16px;
  height: 16px;
}

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

.button.primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.button.secondary {
  border-color: var(--border-strong);
  background: var(--surface);
  color: #3e4650;
}

.button.secondary:hover,
.button.ghost:hover {
  background: var(--surface-2);
}

.button.ghost {
  border-color: var(--border);
  background: #f8f9fa;
  color: #5b636d;
}

.button.accent {
  border-color: #a7dfd2;
  background: #dff5ef;
  color: #087f61;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.full-button {
  width: 100%;
}

.import-progress {
  position: relative;
  height: 34px;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid #cfe6dd;
  border-radius: 5px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 11px;
  line-height: 32px;
  text-align: center;
}

.import-progress span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 32%;
  background: rgba(19, 138, 104, 0.1);
  animation: loading-bar 1.2s ease-in-out infinite;
}

.collected-results {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.collected-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}

.collected-results-header h3 {
  margin: 3px 0 0;
  font-size: 13px;
}

.collected-sync-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--green);
  font-size: 10px;
}

.collected-sync-state svg {
  width: 14px;
  height: 14px;
}

.collected-image-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 10px;
}

.collected-image-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
}

.collected-image-card:hover {
  border-color: #9abbe8;
  box-shadow: 0 5px 14px rgba(26, 33, 42, 0.08);
}

.collected-image-preview {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: var(--surface-2);
}

.collected-image-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.collected-image-preview::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(24, 29, 35, 0.46);
  color: #fff;
  content: "预览";
  font-size: 11px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 150ms ease;
}

.collected-image-preview:hover::after {
  opacity: 1;
}

.collected-image-zoom,
.edu-source-preview {
  position: absolute;
  z-index: 3;
  display: grid;
  width: 25px;
  height: 25px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: rgba(32, 36, 42, 0.76);
  color: #fff;
  box-shadow: 0 2px 8px rgba(24, 30, 38, 0.2);
}

.collected-image-zoom {
  top: 7px;
  right: 7px;
}

.edu-source-preview {
  top: 35px;
  left: 6px;
}

.collected-image-zoom:hover,
.edu-source-preview:hover {
  background: var(--blue);
}

.collected-image-zoom svg,
.edu-source-preview svg {
  width: 13px;
  height: 13px;
}

.collected-image-meta {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 7px 8px;
}

.collected-image-meta strong,
.collected-image-meta span {
  display: block;
}

.collected-image-meta strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collected-image-meta span {
  margin-top: 2px;
  color: var(--green);
  font-size: 8px;
}

.collected-image-remove {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: #fff;
  color: var(--muted);
}

.collected-image-remove:hover {
  border-color: #efb3ba;
  background: #fff3f4;
  color: var(--danger);
}

.collected-image-remove svg {
  width: 13px;
  height: 13px;
}

@keyframes loading-bar {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(420%); }
}

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

.editor-pane {
  min-width: 0;
  padding: 0;
  border: 0;
  background: #fff;
}

.pane-header {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.pane-header h3,
.pane-header p {
  margin: 0;
}

.pane-header h3 {
  font-size: 20px;
  line-height: 1.3;
}

.source-pane-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.source-pane-meta > span {
  color: #4e5660;
  font-size: 11px;
}

.source-pane-meta strong {
  color: var(--text);
}

.eyebrow {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.document-editor {
  display: block;
  width: 100%;
  min-height: 268px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  line-height: 1.7;
}

.result-pane .document-editor {
  min-height: 300px;
}

.document-editor:focus {
  border-color: #8eb2e5;
}

.editor-controls {
  display: grid;
  margin: 20px 0 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
  row-gap: 16px;
}

.ai-provider-toolbar {
  display: flex;
  min-height: 30px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: -2px 0 12px;
  padding: 0;
  border: 0;
  background: transparent;
}

.ai-provider-toolbar > span {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ai-provider-toolbar > span.configured {
  color: var(--green);
}

.ai-provider-toolbar svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.ai-provider-toolbar .button {
  min-height: 28px;
  padding: 0 10px;
  border-color: #d7dce2;
  background: #fff;
  font-size: 10px;
}

.ai-config-form {
  display: grid;
  gap: 14px;
}

.ai-config-form .field-label input,
.ai-config-form .field-label select {
  width: 100%;
}

.ai-config-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
  color: #36516f;
  font-size: 11px;
  line-height: 1.55;
}

.editor-controls label,
.field-label,
.four-fields label,
.two-fields label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.editor-controls label {
  color: #30363d;
  font-size: 12px;
  font-weight: 500;
}

select,
input[type="text"],
input[type="url"],
input[type="password"],
input[type="number"],
textarea {
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
}

select,
input[type="text"],
input[type="url"],
input[type="password"],
input[type="number"] {
  height: 36px;
  padding: 0 10px;
}

select:focus,
input:focus,
textarea:focus {
  border-color: #8eb2e5;
  outline: 0;
}

.title-generate-row {
  display: grid;
  margin-bottom: 18px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0;
}

.title-generate-row input {
  height: 40px;
  border-radius: 6px 0 0 6px;
}

.button.title-generate-button {
  min-height: 40px;
  padding: 0 18px;
  border-radius: 0 6px 6px 0;
  background: #3c72ef;
  color: #fff;
}

.button.title-generate-button:hover {
  background: #2f62d9;
}

.button.rewrite-primary {
  min-height: 40px;
  border-radius: 20px;
  background: #19b99b;
  color: #fff;
  box-shadow: 0 2px 4px rgba(25, 185, 155, 0.2);
}

.button.rewrite-primary:hover {
  background: #12a98c;
}

.result-footer {
  display: grid;
  min-height: 48px;
  align-items: center;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.result-footer .inline-actions {
  grid-column: 2;
  gap: 14px;
}

.button.sensitive-action,
.button.copy-action {
  min-width: 126px;
  min-height: 38px;
  border-radius: 20px;
  color: #fff;
  box-shadow: 0 2px 4px rgba(35, 60, 80, 0.12);
}

.button.sensitive-action {
  background: #19b9aa;
}

.button.sensitive-action:hover {
  background: #12a496;
}

.button.copy-action {
  background: #4eb5ed;
}

.button.copy-action:hover {
  background: #3aa5dd;
}

.sensitive-result {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.sensitive-result.safe {
  color: var(--green);
}

.sensitive-result.warning {
  color: var(--danger);
}

.template-filter {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f7f8f9;
}

.filter-chip {
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.filter-chip.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(20, 25, 30, 0.08);
  font-weight: 700;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
}

.template-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  text-align: left;
  transition: border 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.template-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: 0 7px 18px rgba(24, 30, 38, 0.09);
}

.template-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 66, 99, 0.12);
}

.template-card.selected::after {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  content: "✓";
  font-size: 12px;
  font-weight: 800;
}

.template-preview {
  position: relative;
  display: flex;
  aspect-ratio: 4 / 5;
  flex-direction: column;
  justify-content: space-between;
  padding: 14px 11px;
  overflow: hidden;
}

.template-preview strong {
  position: relative;
  z-index: 1;
  max-width: 90%;
  font-size: 14px;
  line-height: 1.35;
}

.template-preview span {
  position: relative;
  z-index: 1;
  width: 46%;
  height: 4px;
  background: currentColor;
  opacity: 0.35;
}

.template-shape {
  position: absolute;
  right: -14px;
  bottom: 14px;
  width: 72px;
  height: 72px;
  border: 10px solid currentColor;
  border-radius: 50%;
  opacity: 0.12;
}

.template-card footer {
  padding: 9px 10px;
  border-top: 1px solid var(--border);
}

.template-card footer strong,
.template-card footer span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-card footer strong {
  font-size: 11px;
}

.template-card footer span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.image-ai-heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.image-ai-status,
.selected-image-count {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
}

.image-ai-status.configured {
  color: var(--green);
}

.image-ai-status svg {
  width: 15px;
  height: 15px;
}

.edu-image-workbench {
  display: grid;
  grid-template-columns: minmax(310px, 0.38fr) minmax(480px, 0.62fr);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.edu-source-column,
.edu-generation-column {
  min-width: 0;
  padding: 18px 0;
}

.edu-source-column {
  padding-right: 20px;
  border-right: 1px solid var(--border);
}

.edu-generation-column {
  padding-left: 20px;
}

.edu-column-heading,
.edu-results-heading {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.edu-column-heading h3,
.edu-results-heading h3 {
  margin: 3px 0 0;
  font-size: 14px;
}

.edu-column-heading h3 strong,
.edu-results-heading h3 strong {
  color: var(--blue);
}

.compact-button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 11px;
}

.edu-source-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.clear-all-icon-button {
  width: 30px;
  height: 30px;
  border-color: #e9c5ca;
  background: #fff7f8;
  color: var(--danger);
}

.clear-all-icon-button:not(:disabled):hover {
  border-color: var(--danger);
  background: #fff0f2;
}

.edu-source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(84px, 1fr));
  gap: 9px;
  max-height: 385px;
  padding-right: 5px;
  overflow-y: auto;
}

.edu-source-item {
  position: relative;
  min-width: 0;
}

.edu-source-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  text-align: left;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.edu-source-item .edu-source-card {
  width: 100%;
}

.edu-source-card:hover {
  border-color: #9abbe8;
}

.edu-source-card.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(51, 121, 217, 0.13);
}

.edu-source-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  background: #f2f4f6;
  object-fit: cover;
}

.edu-source-check {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: rgba(32, 36, 42, 0.72);
  color: #fff;
}

.edu-source-card.selected .edu-source-check {
  background: var(--blue);
}

.edu-source-check svg {
  width: 13px;
  height: 13px;
}

.edu-source-label {
  display: block;
  padding: 7px 8px;
  overflow: hidden;
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edu-source-remove {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  display: grid;
  width: 23px;
  height: 23px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: rgba(32, 36, 42, 0.72);
  color: #fff;
}

.edu-source-remove:hover {
  background: var(--danger);
}

.edu-source-remove svg {
  width: 12px;
  height: 12px;
}

.edu-generation-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) repeat(2, minmax(120px, 0.8fr));
  gap: 12px;
}

.edu-generation-controls select,
.edu-generation-controls textarea {
  width: 100%;
}

.edu-custom-prompt {
  grid-column: 1 / -1;
}

.edu-custom-prompt textarea {
  min-height: 92px;
  resize: vertical;
}

.edu-generation-action {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.edu-generation-progress {
  position: relative;
  display: flex;
  min-height: 38px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f7f8f9;
  color: var(--muted);
}

.edu-generation-progress span {
  position: absolute;
  inset: auto auto 0 0;
  width: 0;
  height: 3px;
  background: var(--blue);
  transition: width 180ms ease;
}

.edu-generation-progress strong {
  position: relative;
  z-index: 1;
  padding: 0 12px;
  font-size: 10px;
}

.edu-generation-progress.complete {
  border-color: #bfe2d7;
  background: var(--green-soft);
  color: var(--green);
}

.edu-generation-progress.complete span {
  background: var(--green);
}

.edu-results-section {
  padding-top: 18px;
}

.edu-results-heading {
  margin-bottom: 12px;
}

.edu-results-heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.save-all-button {
  min-height: 34px;
  padding: 0 12px;
  border-color: #356fb6;
  background: #356fb6;
  color: #ffffff;
  font-size: 12px;
}

.save-all-button:not(:disabled):hover {
  border-color: #295e9f;
  background: #295e9f;
}

.save-all-button:disabled {
  border-color: #d5dfda;
  background: #eef2f0;
  color: #9aa59f;
}

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

.edu-result-item {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
}

.edu-result-comparison,
.edu-preview-modal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
}

.edu-result-comparison figure,
.edu-preview-modal figure {
  position: relative;
  min-width: 0;
  margin: 0;
  background: #f0f2f4;
}

.edu-result-output,
.edu-result-output-state {
  position: relative;
  min-width: 0;
}

.edu-result-output-state {
  aspect-ratio: var(--edu-result-ratio, 4 / 5);
  background: #f7f8f9;
}

.edu-result-image-preview {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}

.edu-result-image-preview:focus-visible {
  outline: 3px solid rgba(47, 125, 209, 0.42);
  outline-offset: -3px;
}

.edu-result-image-tools {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 3;
  display: flex;
  gap: 5px;
}

.edu-result-image-tools .icon-button {
  width: 30px;
  height: 30px;
  border-color: rgba(255, 255, 255, 0.82);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 2px 10px rgba(24, 30, 38, 0.16);
}

.edu-result-image-tools .danger-icon-button {
  color: var(--danger);
}

.edu-result-comparison figure > span,
.edu-preview-modal figure > span {
  position: absolute;
  top: 7px;
  left: 7px;
  z-index: 1;
  padding: 4px 7px;
  border-radius: 4px;
  background: rgba(32, 36, 42, 0.76);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
}

.edu-result-comparison img {
  display: block;
  width: 100%;
  aspect-ratio: var(--edu-result-ratio, 4 / 5);
  object-fit: contain;
  background: #f0f2f4;
}

.edu-preview-modal img {
  display: block;
  width: 100%;
  max-height: 62vh;
  object-fit: contain;
}

.edu-preview-modal.single {
  grid-template-columns: minmax(0, 1fr);
  background: #f0f2f4;
}

.modal.image-preview-dialog {
  width: min(760px, 100%);
  height: min(760px, calc(100vh - 36px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal.image-preview-dialog.image-preview-portrait {
  width: min(470px, 100%);
}

.modal.image-preview-dialog.image-preview-square {
  width: min(640px, 100%);
}

.modal.image-preview-dialog .modal-header,
.modal.image-preview-dialog .modal-actions {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
}

.modal.image-preview-dialog .modal-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
}

.modal.image-preview-dialog .edu-preview-modal.single,
.modal.image-preview-dialog .edu-preview-modal.single figure {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.modal.image-preview-dialog .edu-preview-modal.single {
  display: flex;
}

.modal.image-preview-dialog .edu-preview-modal.single figure {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal.image-preview-dialog .edu-preview-modal.single img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: none;
  object-fit: contain;
}

.modal.image-preview-dialog .edu-preview-modal.single img {
  max-height: 100%;
}

.edu-result-pending {
  display: flex;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  background: #f7f8f9;
  color: var(--blue);
  text-align: center;
}

.edu-result-pending.error {
  background: #fff4f5;
  color: var(--danger);
}

.edu-result-pending svg {
  width: 24px;
  height: 24px;
}

.edu-result-pending.pending svg,
.edu-generation-action .button:disabled svg {
  animation: edu-spin 1s linear infinite;
}

.edu-result-pending strong,
.edu-result-pending span {
  display: block;
}

.edu-result-pending span {
  max-width: 230px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.edu-result-item > footer {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
}

.edu-result-item > footer > div:first-child {
  min-width: 0;
}

.edu-result-item > footer strong,
.edu-result-item > footer span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edu-result-item > footer strong {
  font-size: 11px;
}

.edu-result-item > footer span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.edu-result-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
}

.edu-result-actions .icon-button {
  width: 30px;
  height: 30px;
}

.edu-result-actions .danger-icon-button {
  color: var(--danger);
}

.edu-result-actions .danger-icon-button:hover {
  border-color: #efb3ba;
  background: #fff3f4;
}

.edu-result-actions .button {
  min-height: 30px;
  padding: 0 10px;
  font-size: 10px;
}

.edu-empty-state {
  display: grid;
  min-height: 190px;
  place-items: center;
  align-content: center;
  gap: 7px;
  border: 1px dashed var(--border-strong);
  border-radius: 7px;
  background: #fafbfc;
  color: var(--muted);
  text-align: center;
}

.edu-empty-state[hidden] {
  display: none;
}

.edu-empty-state.compact {
  min-height: 120px;
}

.edu-empty-state svg {
  width: 25px;
  height: 25px;
  color: var(--blue);
}

.edu-empty-state strong {
  color: var(--text);
  font-size: 12px;
}

.edu-empty-state span {
  max-width: 300px;
  font-size: 10px;
  line-height: 1.5;
}

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

.preview-scale-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.preview-scale-control .icon-button {
  width: 30px;
  height: 30px;
}

.composer-layout {
  display: grid;
  min-height: 620px;
  grid-template-columns: 280px minmax(420px, 1fr) 190px;
  gap: 16px;
}

.style-panel,
.page-panel {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fbfcfd;
}

.style-panel {
  padding: 12px;
}

.segmented-control {
  display: grid;
  margin-bottom: 14px;
  padding: 3px;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f0f2f4;
}

.segmented-control button {
  height: 30px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.segmented-control button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 4px rgba(20, 25, 30, 0.08);
}

.style-tab {
  display: none;
}

.style-tab.active {
  display: grid;
  gap: 13px;
}

.two-fields,
.four-fields {
  display: grid;
  gap: 8px;
}

.two-fields {
  grid-template-columns: 1fr 1fr;
}

.four-fields {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.four-fields input {
  width: 100%;
  padding: 0 5px;
  text-align: center;
}

.color-field {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 7px;
}

.color-field input[type="color"] {
  width: 42px;
  height: 36px;
  padding: 3px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
}

.icon-segment {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
}

.icon-segment button {
  display: grid;
  height: 34px;
  place-items: center;
  border: 0;
  border-right: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
}

.icon-segment button:last-child {
  border-right: 0;
}

.icon-segment button.active {
  background: var(--blue-soft);
  color: var(--blue);
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
}

.toggle-row strong,
.toggle-row small {
  display: block;
}

.toggle-row strong {
  font-size: 11px;
}

.toggle-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.toggle-row input {
  width: 34px;
  height: 18px;
  accent-color: var(--green);
}

.upload-drop {
  display: grid;
  min-height: 110px;
  place-items: center;
  align-content: center;
  gap: 5px;
  border: 1px dashed #9fa8b3;
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  text-align: center;
}

.upload-drop:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.upload-drop strong {
  color: var(--text);
  font-size: 11px;
}

.upload-drop span {
  font-size: 9px;
}

.upload-drop input {
  display: none;
}

.media-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.media-thumb {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--surface-3);
}

.media-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-thumb button {
  position: absolute;
  top: 2px;
  right: 2px;
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(20, 24, 29, 0.75);
  color: #fff;
  font-size: 10px;
}

.preview-stage {
  position: relative;
  display: grid;
  min-width: 0;
  place-items: center;
  align-content: center;
  overflow: hidden;
  border: 1px solid #d6dbe1;
  border-radius: 7px;
  background-color: #e8ebef;
  background-image: linear-gradient(45deg, #dfe3e8 25%, transparent 25%), linear-gradient(-45deg, #dfe3e8 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #dfe3e8 75%), linear-gradient(-45deg, transparent 75%, #dfe3e8 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.canvas-frame {
  width: min(420px, 80%);
  transform-origin: center;
  box-shadow: 0 18px 45px rgba(24, 30, 38, 0.22);
  transition: transform 180ms ease;
}

#previewCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #fff;
}

.preview-note {
  display: inline-flex;
  margin-top: 18px;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--muted);
  font-size: 10px;
}

.preview-note svg {
  width: 13px;
  height: 13px;
}

.page-panel {
  padding: 10px;
}

.page-panel-header {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.page-panel-header strong,
.page-panel-header span {
  display: block;
}

.page-panel-header strong {
  font-size: 12px;
}

.page-panel-header span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.page-panel-header .icon-button {
  width: 30px;
  height: 30px;
}

.page-thumbnails {
  display: grid;
  gap: 9px;
}

.page-thumbnail {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  text-align: left;
}

.page-thumbnail:hover,
.page-thumbnail.active {
  border-color: var(--blue);
}

.page-thumbnail canvas {
  display: block;
  width: 70px;
  height: 93px;
  background: #fff;
}

.page-thumbnail strong,
.page-thumbnail span {
  display: block;
}

.page-thumbnail strong {
  font-size: 10px;
}

.page-thumbnail span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.action-dock {
  position: fixed;
  right: 26px;
  bottom: 18px;
  left: calc(var(--sidebar-width) + 26px);
  z-index: 25;
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 12px 9px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.dock-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 11px;
}

.dock-status svg {
  width: 16px;
  height: 16px;
}

/* Auxiliary views */
.aux-band {
  margin-bottom: 18px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.aux-band h2,
.aux-band h3,
.aux-band p {
  margin: 0;
}

.aux-band h2 {
  font-size: 18px;
}

.aux-band h3 {
  font-size: 14px;
}

.aux-band > p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

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

.metric-card,
.quick-action,
.plan-card {
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
}

.metric-card {
  min-height: 120px;
  padding: 17px;
}

.metric-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.metric-card header svg {
  width: 17px;
  height: 17px;
}

.metric-card strong {
  display: block;
  margin-top: 16px;
  font-size: 26px;
}

.metric-card small {
  display: block;
  margin-top: 5px;
  color: var(--green);
  font-size: 10px;
}

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

.quick-action {
  display: grid;
  min-height: 112px;
  padding: 17px;
  grid-template-columns: 42px minmax(0, 1fr);
  align-content: center;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.quick-action:hover {
  border-color: var(--border-strong);
  box-shadow: 0 5px 16px rgba(26, 33, 42, 0.06);
}

.quick-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue);
}

.quick-action:nth-child(2) .quick-icon {
  background: var(--green-soft);
  color: var(--green);
}

.quick-action:nth-child(3) .quick-icon {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.quick-action strong,
.quick-action span {
  display: block;
}

.quick-action strong {
  font-size: 13px;
}

.quick-action span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.toolbar-row .search-box {
  display: flex;
  min-width: 260px;
  height: 38px;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: #fff;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: #f7f8f9;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.data-table td {
  font-size: 11px;
}

.table-title {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
}

.status-pill {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.status-pill.success {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.progress {
  background: var(--blue-soft);
  color: var(--blue);
}

.status-pill.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.table-actions {
  display: flex;
  gap: 5px;
}

.table-actions .button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 10px;
}

.empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  align-content: center;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 38px;
  height: 38px;
  margin-bottom: 10px;
  color: #b2bac4;
}

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

.empty-state p {
  margin: 6px 0 14px;
  font-size: 10px;
}

.batch-input {
  width: 100%;
  min-height: 180px;
  padding: 13px;
  resize: vertical;
  line-height: 1.7;
}

.input-counter {
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.template-library {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 14px;
}

.watermark-layout,
.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.drop-panel {
  display: grid;
  min-height: 260px;
  place-items: center;
  align-content: center;
  padding: 24px;
  border: 1px dashed #9fa8b3;
  border-radius: 7px;
  background: #fafbfc;
  text-align: center;
}

.drop-panel svg {
  width: 42px;
  height: 42px;
  margin-bottom: 10px;
  color: var(--blue);
}

.drop-panel p {
  max-width: 460px;
  margin: 7px 0 16px;
  color: var(--muted);
  font-size: 11px;
}

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

.plan-card {
  padding: 18px;
}

.plan-card.featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 66, 99, 0.08);
}

.plan-card .plan-name {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.plan-card .price {
  margin: 16px 0;
  font-size: 28px;
  font-weight: 800;
}

.plan-card .price small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 400;
}

.plan-card ul {
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.plan-card li {
  margin: 9px 0;
  color: #535c66;
  font-size: 11px;
}

.plan-card li::before {
  margin-right: 7px;
  color: var(--green);
  content: "✓";
  font-weight: 800;
}

.profile-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.profile-form .full {
  grid-column: 1 / -1;
}

.profile-preview {
  display: grid;
  min-height: 320px;
  place-items: center;
  align-content: center;
  border-left: 1px solid var(--border);
  text-align: center;
}

.profile-preview .avatar {
  width: 72px;
  height: 72px;
  margin-bottom: 13px;
  font-size: 24px;
}

.profile-preview p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.invite-code {
  display: grid;
  min-height: 170px;
  padding: 20px;
  place-items: center;
  align-content: center;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #f7faf9;
}

.invite-code strong {
  font-family: Consolas, monospace;
  font-size: 24px;
  letter-spacing: 2px;
}

/* Modal and notifications */
.toast-stack {
  position: fixed;
  top: 86px;
  right: 18px;
  z-index: 100;
  display: grid;
  width: min(340px, calc(100vw - 36px));
  gap: 8px;
}

.toast {
  display: grid;
  min-height: 52px;
  padding: 10px 12px;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--blue);
  border-radius: 7px;
  background: #fff;
  box-shadow: var(--shadow);
  animation: toast-in 180ms ease-out;
}

.toast.success {
  border-left-color: var(--green);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast strong,
.toast span {
  display: block;
}

.toast strong {
  font-size: 11px;
}

.toast span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

@keyframes toast-in {
  from { transform: translateY(-8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(26, 30, 35, 0.48);
}

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

.modal {
  width: min(560px, 100%);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 70px rgba(12, 16, 20, 0.3);
}

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

.modal-header h2 {
  margin: 3px 0 0;
  font-size: 17px;
}

.modal-body {
  padding: 18px;
  color: #4f5761;
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
}

.sidebar-scrim {
  display: none;
}

body.compact .work-section {
  padding: 17px;
}

body.compact .document-editor {
  min-height: 210px;
}

@media (max-width: 1280px) {
  .collected-image-grid {
    grid-template-columns: repeat(4, minmax(110px, 1fr));
  }

  .template-grid {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .composer-layout {
    grid-template-columns: 250px minmax(360px, 1fr) 170px;
  }

  .editor-controls {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-close,
  .menu-button {
    display: inline-grid;
  }

  body.sidebar-open .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: block;
    border: 0;
    background: rgba(24, 28, 33, 0.42);
  }

  .main-shell {
    margin-left: 0;
  }

  .action-dock {
    left: 26px;
  }

  .rewrite-layout {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .edu-image-workbench {
    grid-template-columns: 1fr;
  }

  .edu-source-column {
    padding-right: 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .edu-generation-column {
    padding-left: 0;
  }

  .composer-layout {
    grid-template-columns: 260px minmax(380px, 1fr);
  }

  .page-panel {
    grid-column: 1 / -1;
  }

  .page-thumbnails {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .page-thumbnail {
    grid-template-columns: 60px minmax(0, 1fr);
  }

  .page-thumbnail canvas {
    width: 60px;
    height: 80px;
  }

  .metric-grid,
  .plan-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .topbar {
    min-height: 64px;
    padding: 8px 14px;
  }

  .page-heading p,
  .breadcrumb,
  .energy-chip span {
    display: none;
  }

  .page-heading h1 {
    font-size: 18px;
  }

  .energy-chip {
    padding: 0 8px;
  }

  .content-wrap {
    padding: 14px 12px 24px;
  }

  .workflow-steps {
    grid-template-columns: repeat(3, minmax(70px, 1fr));
    overflow-x: auto;
  }

  .workflow-step {
    min-height: 64px;
    padding: 10px;
    text-align: center;
  }

  .workflow-step > span {
    position: static;
    width: 22px;
    height: 22px;
    margin: 0 auto 4px;
  }

  .workflow-step small {
    display: none;
  }

  .work-section,
  .aux-band {
    padding: 16px;
  }

  .section-heading {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .section-heading > div:nth-child(2) {
    width: calc(100% - 52px);
  }

  .section-heading p {
    line-height: 1.5;
  }

  .section-status,
  .section-meta,
  .template-filter,
  .preview-scale-control {
    margin-left: 50px;
  }

  .image-ai-heading-actions {
    width: 100%;
    margin-left: 50px;
  }

  .edu-column-heading {
    align-items: flex-start;
  }

  .edu-source-grid {
    grid-template-columns: repeat(4, minmax(74px, 1fr));
  }

  .edu-source-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .edu-generation-controls {
    grid-template-columns: 1fr 1fr;
  }

  .edu-generation-controls .field-label:first-child,
  .edu-custom-prompt {
    grid-column: 1 / -1;
  }

  .edu-result-grid {
    grid-template-columns: 1fr;
  }

  .collect-bar {
    grid-template-columns: 1fr 1fr;
  }

  .url-field {
    grid-column: 1 / -1;
  }

  .collect-bar .primary {
    grid-column: 1 / -1;
  }

  .collected-results-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .collected-image-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editor-pane {
    padding: 12px;
  }

  #step-rewrite .editor-pane {
    padding: 0;
  }

  .editor-controls {
    grid-template-columns: 1fr 1fr;
  }

  .result-footer {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .result-footer .sensitive-result,
  .result-footer .inline-actions {
    grid-column: 1;
  }

  .inline-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .template-grid,
  .template-library {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .composer-layout {
    grid-template-columns: 1fr;
  }

  .preview-stage {
    min-height: 520px;
    grid-row: 1;
  }

  .style-panel {
    grid-row: 2;
  }

  .page-panel {
    grid-column: auto;
    grid-row: 3;
  }

  .page-thumbnails {
    grid-template-columns: 1fr 1fr;
  }

  .action-dock {
    right: 10px;
    bottom: 10px;
    left: 10px;
    align-items: stretch;
    flex-direction: column;
    padding: 9px;
  }

  .dock-status {
    display: none;
  }

  .dock-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .dock-actions .primary {
    grid-column: 1 / -1;
  }

  .metric-grid,
  .quick-grid,
  .plan-grid,
  .watermark-layout,
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-preview {
    min-height: 220px;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .toolbar-row {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-row .search-box {
    min-width: 0;
  }

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

  .data-table {
    min-width: 720px;
  }
}

@media (max-width: 430px) {
  .topbar-actions .icon-button,
  .avatar-button {
    display: none;
  }

  .workflow-step strong {
    font-size: 10px;
  }

  .editor-controls,
  .two-fields,
  .profile-form {
    grid-template-columns: 1fr;
  }

  .profile-form .full {
    grid-column: auto;
  }

  .four-fields {
    grid-template-columns: 1fr 1fr;
  }

  .section-status,
  .section-meta,
  .template-filter,
  .preview-scale-control {
    margin-left: 0;
  }

  .image-ai-heading-actions {
    align-items: stretch;
    flex-direction: column;
    margin-left: 0;
  }

  .image-ai-heading-actions .button {
    width: 100%;
  }

  .edu-source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .edu-generation-controls,
  .edu-generation-action {
    grid-template-columns: 1fr;
  }

  .edu-generation-controls .field-label:first-child,
  .edu-custom-prompt {
    grid-column: auto;
  }

  .edu-result-item > footer {
    align-items: stretch;
    flex-direction: column;
  }

  .edu-result-actions .button {
    flex: 1;
  }

  .template-filter {
    width: 100%;
    overflow-x: auto;
  }

  .template-grid,
  .template-library {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .preview-stage {
    min-height: 430px;
  }

  .canvas-frame {
    width: 88%;
  }
}

/* Commercial visual refresh */
:root {
  --bg: #eef2f0;
  --surface: #ffffff;
  --surface-2: #f5f8f6;
  --surface-3: #e8eeeb;
  --text: #18211e;
  --muted: #65716c;
  --subtle: #8b9691;
  --border: #dbe4df;
  --border-strong: #c6d2cc;
  --accent: #167c65;
  --accent-dark: #0f6653;
  --accent-soft: #e8f4ef;
  --green: #238464;
  --green-soft: #e9f6f1;
  --blue: #356fb6;
  --blue-soft: #edf3fb;
  --amber: #976814;
  --amber-soft: #fff6dc;
  --danger: #cf4854;
  --shadow: 0 10px 28px rgba(29, 48, 40, 0.08);
  --sidebar-width: 236px;
  --topbar-height: 74px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

button,
input,
select,
textarea {
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(22, 124, 101, 0.18);
  outline-offset: 1px;
}

.sidebar {
  border-right-color: #d5dfda;
  background: #f9fbfa;
  box-shadow: 8px 0 26px rgba(28, 45, 38, 0.04);
}

.brand-row {
  min-height: var(--topbar-height);
  padding: 0 18px;
  border-bottom-color: #dfe7e3;
  background: #ffffff;
}

.brand-row strong {
  color: #15221d;
  font-size: 15px;
}

.brand-row small {
  color: #74817b;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 7px;
  background: #1c2924;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09), 0 4px 12px rgba(24, 42, 34, 0.16);
}

.brand-mark span {
  color: #7ee0bd;
}

.nav-list {
  padding: 14px 12px;
}

.nav-item {
  position: relative;
  min-height: 44px;
  margin: 3px 0;
  padding: 0 12px;
  border-radius: 7px;
  color: #56635d;
}

.nav-item:hover {
  background: #edf3f0;
  color: #26342e;
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: inset 0 0 0 1px rgba(22, 124, 101, 0.08);
}

.nav-item.active::before {
  left: -12px;
  width: 4px;
  height: 26px;
  background: var(--accent);
}

.nav-item.active .nav-count {
  background: #ffffff;
  color: var(--accent-dark);
}

.nav-divider {
  color: #89948f;
}

.sidebar-account {
  min-height: 76px;
  border-top-color: #dfe7e3;
  background: #ffffff;
}

.avatar,
.avatar-button {
  background: #25342e;
}

.topbar {
  min-height: var(--topbar-height);
  padding: 10px 28px;
  border-bottom-color: #d8e1dd;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 4px 16px rgba(31, 49, 42, 0.04);
}

.page-heading h1 {
  color: #17231e;
  font-size: 20px;
  font-weight: 760;
}

.breadcrumb {
  color: #87938d;
}

.energy-chip {
  border-color: #eadba5;
  background: var(--amber-soft);
  color: var(--amber);
}

.icon-button {
  border-color: var(--border);
  border-radius: 6px;
  background: #ffffff;
  color: #56635d;
}

.icon-button:hover {
  border-color: #aebdb6;
  background: #f1f5f3;
  color: #24332d;
}

.content-wrap {
  width: min(1460px, 100%);
  padding: 26px 30px 34px;
}

.workflow-steps {
  margin-bottom: 20px;
  border-color: #d3ddd8;
  border-radius: 8px;
  background: #f8faf9;
  box-shadow: 0 4px 16px rgba(31, 49, 42, 0.04);
}

.workflow-step {
  min-height: 66px;
  border-right-color: #dce5e1;
  background: #f8faf9;
}

.workflow-step:hover {
  background: #f1f6f3;
}

.workflow-step.active {
  background: #ffffff;
  color: var(--accent-dark);
  box-shadow: inset 0 -3px 0 var(--accent);
}

.workflow-step > span {
  border-color: #c7d3cd;
  background: #ffffff;
  color: #68756f;
}

.workflow-step.active > span {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.work-section {
  margin-bottom: 20px;
  padding: 24px;
  border-color: #d5dfda;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(30, 49, 41, 0.055);
}

.section-heading {
  min-height: 46px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e4ebe7;
}

.section-heading h2 {
  color: #1a2721;
  font-size: 17px;
}

.section-heading p {
  color: #6c7872;
}

.step-badge {
  width: 40px;
  height: 40px;
  border-radius: 7px;
  background: #23322c;
  box-shadow: 0 4px 12px rgba(26, 42, 35, 0.14);
}

.section-status,
.autosave-state,
.collected-sync-state {
  color: var(--green);
}

.collect-bar {
  gap: 9px;
}

.url-field,
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
select,
textarea {
  border-color: var(--border-strong);
  border-radius: 6px;
  background: #ffffff;
}

.url-field {
  height: 44px;
  padding: 0 13px;
}

.url-field:focus-within,
input:focus,
select:focus,
textarea:focus,
.document-editor:focus {
  border-color: #6cae99;
  box-shadow: 0 0 0 3px rgba(22, 124, 101, 0.1);
}

.button {
  min-height: 40px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
}

.button > svg,
.button > span,
label[for="eduImageUpload"] * {
  cursor: pointer;
}

label[for="eduImageUpload"] > svg {
  pointer-events: none;
}

.button:disabled {
  cursor: not-allowed;
}

.button:not(:disabled):hover {
  transform: translateY(-1px);
}

.button.primary,
.button.rewrite-primary {
  border-color: var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(22, 124, 101, 0.16);
}

.button.primary:hover,
.button.rewrite-primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.button.secondary {
  border-color: #bdcac4;
  background: #ffffff;
  color: #3d4b45;
}

.button.ghost {
  border-color: #d5dfda;
  background: #f6f8f7;
  color: #596660;
}

.button.title-generate-button {
  background: var(--blue);
}

.button.title-generate-button:hover {
  background: #295e9f;
}

.button.sensitive-action,
.button.copy-action {
  border-radius: 6px;
}

.button.sensitive-action {
  background: var(--green);
}

.button.copy-action {
  background: #4388c7;
}

.collected-results {
  margin-top: 18px;
  padding-top: 18px;
  border-top-color: #e2e9e5;
}

.collected-image-card,
.edu-source-card,
.edu-result-item {
  border-color: #d8e2dd;
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 3px 12px rgba(32, 51, 43, 0.045);
}

.collected-image-card:hover,
.edu-result-item:hover {
  border-color: #a8bbb2;
  box-shadow: 0 8px 22px rgba(30, 49, 41, 0.09);
}

.collected-image-preview,
.edu-result-comparison figure,
.edu-preview-modal figure {
  background: #f0f4f2;
}

.rewrite-layout {
  gap: 40px;
}

.editor-pane {
  background: transparent;
}

.pane-header h3 {
  color: #1c2923;
  font-size: 17px;
}

.document-editor {
  border-color: #cbd7d1;
  background: #fbfcfb;
}

.ai-provider-toolbar {
  color: #69756f;
}

.edu-image-workbench {
  border-color: #e1e9e5;
}

.edu-source-column {
  border-right-color: #e1e9e5;
}

.edu-source-card:hover {
  border-color: #86a99b;
}

.edu-source-card.selected {
  border-color: #5d786d;
  box-shadow: 0 0 0 1px rgba(93, 120, 109, 0.16), 0 6px 16px rgba(31, 49, 42, 0.07);
}

.edu-source-card.selected .edu-source-check {
  background: #1d7a63;
}

.edu-generation-progress {
  border-color: #d4dfda;
  background: #f4f7f5;
}

.edu-generation-progress span {
  background: var(--blue);
}

.edu-result-grid {
  gap: 14px;
}

.edu-result-item > footer {
  border-top: 1px solid #e4ebe7;
  background: #ffffff;
}

.edu-result-image-tools .icon-button {
  border-color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 3px 12px rgba(24, 39, 33, 0.18);
}

.edu-empty-state {
  border-color: #c7d5cf;
  background: #f8faf9;
}

.toast {
  border-color: #d0dbd6;
  border-left-color: var(--blue);
  border-radius: 7px;
  box-shadow: 0 14px 34px rgba(23, 39, 32, 0.16);
}

.modal-backdrop {
  background: rgba(18, 28, 24, 0.56);
}

.modal {
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  box-shadow: 0 28px 80px rgba(12, 22, 18, 0.32);
}

.modal-actions {
  border-top-color: #dfe7e3;
  background: #f6f8f7;
}

@media (max-width: 760px) {
  .content-wrap {
    padding: 16px 12px 24px;
  }

  .work-section {
    padding: 18px;
  }

  .workflow-step {
    min-height: 62px;
  }

  .rewrite-layout {
    gap: 24px;
  }
}

@media (max-width: 430px) {
  .work-section {
    padding: 15px;
  }

  .section-heading {
    padding-bottom: 14px;
  }

  .workflow-step {
    min-height: 58px;
  }
}

/* Desktop license activation */
body.license-locked {
  overflow: hidden;
}

body.license-locked .app-shell {
  pointer-events: none;
  user-select: none;
}

.license-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: auto;
  background: #edf2ef;
}

.license-gate[hidden] {
  display: none;
}

.license-panel {
  width: min(440px, 100%);
  padding: 28px;
  border: 1px solid #d7e1dc;
  border-top: 4px solid var(--accent);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(20, 38, 30, 0.17);
}

.license-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-bottom: 22px;
  border-bottom: 1px solid #e5ebe8;
}

.license-brand > div:last-child {
  display: grid;
  gap: 2px;
}

.license-brand strong {
  color: #17241e;
  font-size: 15px;
}

.license-brand small {
  color: #79857f;
  font-size: 12px;
}

.license-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 25px 0 18px;
  place-items: center;
  border: 1px solid #cbe0d7;
  border-radius: 8px;
  background: #edf8f4;
  color: var(--accent);
}

.license-icon svg {
  width: 24px;
  height: 24px;
}

.license-panel h1 {
  margin: 8px 0 9px;
  color: #15221c;
  font-size: 25px;
  line-height: 1.28;
}

.license-subtitle {
  margin: 0;
  color: #66736d;
  line-height: 1.7;
}

.license-form {
  display: grid;
  gap: 10px;
  margin-top: 23px;
}

.license-form > label {
  color: #394740;
  font-size: 13px;
  font-weight: 700;
}

.license-input-row {
  display: flex;
  min-width: 0;
  height: 48px;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid #becdc6;
  border-radius: 6px;
  background: #fbfcfb;
}

.license-input-row:focus-within {
  border-color: #6cae99;
  box-shadow: 0 0 0 3px rgba(22, 124, 101, 0.1);
}

.license-input-row svg {
  flex: 0 0 auto;
  color: #78857f;
}

.license-input-row input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 13px;
}

.license-form .button {
  width: 100%;
  min-height: 46px;
  margin-top: 3px;
}

.license-message {
  min-height: 20px;
  margin-top: 12px;
  color: #b42c3b;
  font-size: 13px;
  line-height: 1.5;
}

.license-message.success {
  color: var(--accent);
}

.license-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 12px;
  margin-top: 15px;
  padding-top: 17px;
  border-top: 1px solid #e5ebe8;
  color: #77837d;
  font-size: 12px;
}

.license-footer svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.license-footer span:last-child {
  margin-left: auto;
}

.license-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.license-summary > div {
  padding: 14px;
  border: 1px solid #dce5e1;
  border-radius: 7px;
  background: #f8faf9;
}

.license-summary span,
.license-summary strong {
  display: block;
}

.license-summary span {
  margin-bottom: 6px;
  color: #7a8680;
  font-size: 12px;
}

.license-summary strong {
  overflow-wrap: anywhere;
  color: #24322b;
  font-size: 14px;
}

@media (max-width: 600px) {
  .license-gate {
    align-items: start;
    padding: 16px;
  }

  .license-panel {
    margin-top: 28px;
    padding: 22px 18px;
  }

  .license-panel h1 {
    font-size: 22px;
  }

  .license-footer span:last-child {
    width: 100%;
    margin-left: 23px;
  }

  .license-summary {
    grid-template-columns: 1fr;
  }

  .edu-results-heading {
    align-items: flex-start;
  }

  .edu-results-heading-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
}

/* A11 branded skin system */
html[data-skin="sweet-potato"] {
  --bg: #f6f4f5;
  --surface: #ffffff;
  --surface-2: #fff5f5;
  --surface-3: #f3e8ea;
  --text: #29262d;
  --muted: #716b73;
  --subtle: #9b9298;
  --border: #eadfe2;
  --border-strong: #d8c7cc;
  --accent: #e24b56;
  --accent-dark: #bd3042;
  --accent-soft: #fff0f1;
  --green: #168169;
  --green-soft: #eaf7f2;
  --blue: #356fb8;
  --blue-soft: #edf4ff;
  --amber: #a86812;
  --amber-soft: #fff5d9;
  --danger: #c93447;
  --sidebar-bg: #fffafa;
  --sidebar-brand-bg: #ffffff;
  --sidebar-account-bg: #ffffff;
  --sidebar-text: #5e555c;
  --sidebar-title: #29262d;
  --sidebar-muted: #82777e;
  --sidebar-hover: #f8edef;
  --sidebar-border: #eadfe2;
  --nav-active-bg: #ffe9ec;
  --nav-active-text: #b62f42;
  --topbar-bg: rgba(255, 255, 255, 0.97);
  --brand-bg: #e24b56;
  --brand-spark: #ffd166;
  --focus-ring: rgba(226, 75, 86, 0.15);
  --card-shadow: 0 10px 28px rgba(80, 45, 53, 0.07);
}

html[data-skin="lime"] {
  --bg: #edf5f2;
  --surface: #ffffff;
  --surface-2: #f1f8f5;
  --surface-3: #e3efea;
  --text: #1e2926;
  --muted: #65736e;
  --subtle: #8c9a95;
  --border: #d7e5df;
  --border-strong: #bdd2ca;
  --accent: #147d68;
  --accent-dark: #0f6556;
  --accent-soft: #e2f4ee;
  --green: #147d68;
  --green-soft: #e3f4ee;
  --blue: #3974b7;
  --blue-soft: #edf4fc;
  --amber: #a8621c;
  --amber-soft: #fff1df;
  --danger: #d04b48;
  --sidebar-bg: #f7fbf9;
  --sidebar-brand-bg: #ffffff;
  --sidebar-account-bg: #ffffff;
  --sidebar-text: #52645e;
  --sidebar-title: #1e2926;
  --sidebar-muted: #768780;
  --sidebar-hover: #eaf3ef;
  --sidebar-border: #d2e0da;
  --nav-active-bg: #dcf1ea;
  --nav-active-text: #0f6656;
  --topbar-bg: rgba(255, 255, 255, 0.97);
  --brand-bg: #147d68;
  --brand-spark: #ffcc66;
  --focus-ring: rgba(20, 125, 104, 0.15);
  --card-shadow: 0 10px 28px rgba(31, 73, 60, 0.075);
}

html[data-skin="sky"] {
  --bg: #f1f4f8;
  --surface: #ffffff;
  --surface-2: #f4f7fb;
  --surface-3: #e6ebf3;
  --text: #222a38;
  --muted: #687386;
  --subtle: #929cac;
  --border: #dce2eb;
  --border-strong: #c4cedc;
  --accent: #3b66c1;
  --accent-dark: #294d9a;
  --accent-soft: #eaf0ff;
  --green: #168169;
  --green-soft: #e8f6f1;
  --blue: #3b66c1;
  --blue-soft: #eaf0ff;
  --amber: #ad601d;
  --amber-soft: #fff0e1;
  --danger: #ca4250;
  --sidebar-bg: #24314b;
  --sidebar-brand-bg: #202b43;
  --sidebar-account-bg: #1e293f;
  --sidebar-text: #d2daeb;
  --sidebar-title: #ffffff;
  --sidebar-muted: #a6b3cb;
  --sidebar-hover: #303f5d;
  --sidebar-border: #3a4864;
  --nav-active-bg: #fff0e3;
  --nav-active-text: #ad571c;
  --topbar-bg: rgba(255, 255, 255, 0.97);
  --brand-bg: #f06445;
  --brand-spark: #ffe08a;
  --focus-ring: rgba(59, 102, 193, 0.15);
  --card-shadow: 0 10px 28px rgba(38, 51, 77, 0.08);
}

html[data-skin] body {
  background: var(--bg);
  color: var(--text);
}

html[data-skin] button:focus-visible,
html[data-skin] input:focus-visible,
html[data-skin] select:focus-visible,
html[data-skin] textarea:focus-visible {
  outline-color: var(--focus-ring);
}

html[data-skin] .sidebar {
  border-right-color: var(--sidebar-border);
  background: var(--sidebar-bg);
  box-shadow: 8px 0 24px rgba(30, 35, 46, 0.045);
}

html[data-skin] .brand-row {
  border-bottom-color: var(--sidebar-border);
  background: var(--sidebar-brand-bg);
}

html[data-skin] .brand-row strong { color: var(--sidebar-title); }
html[data-skin] .brand-row small,
html[data-skin] .account-copy span,
html[data-skin] .nav-divider { color: var(--sidebar-muted); }

.brand-mark {
  position: relative;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  background: var(--brand-bg);
  box-shadow: 0 6px 16px rgba(106, 43, 51, 0.18);
}

.brand-mark span {
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.brand-mark svg {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 12px;
  height: 12px;
  color: var(--brand-spark);
  stroke-width: 2.4;
}

html[data-skin] .nav-item { color: var(--sidebar-text); }
html[data-skin] .nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-title);
}
html[data-skin] .nav-item.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  box-shadow: none;
}
html[data-skin] .nav-item.active::before { background: var(--nav-active-text); }
html[data-skin] .sidebar-account {
  border-top-color: var(--sidebar-border);
  background: var(--sidebar-account-bg);
  color: var(--sidebar-title);
}
html[data-skin] .sidebar .icon-button {
  border-color: var(--sidebar-border);
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

html[data-skin] .topbar {
  border-bottom-color: var(--border);
  background: var(--topbar-bg);
  box-shadow: 0 4px 18px rgba(36, 42, 54, 0.045);
}
html[data-skin] .page-heading h1,
html[data-skin] .section-heading h2,
html[data-skin] .pane-header h3 { color: var(--text); }
html[data-skin] .breadcrumb,
html[data-skin] .section-heading p { color: var(--muted); }
html[data-skin] .energy-chip {
  border-color: color-mix(in srgb, var(--amber) 28%, white);
  background: var(--amber-soft);
  color: var(--amber);
}
html[data-skin] .energy-chip strong { color: var(--amber); }

.theme-control {
  position: relative;
  flex: 0 0 auto;
}
.theme-control > .icon-button[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.theme-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 90;
  width: 286px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 20px 56px rgba(28, 34, 44, 0.2);
}
.theme-menu-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 10px;
  border-bottom: 1px solid var(--border);
}
.theme-menu-heading span { font-size: 13px; font-weight: 800; }
.theme-menu-heading small { color: var(--muted); font-size: 10px; }
.theme-option {
  display: grid;
  width: 100%;
  min-height: 58px;
  margin-top: 4px;
  padding: 8px;
  grid-template-columns: 48px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.theme-option:hover,
.theme-option.active {
  border-color: var(--border);
  background: var(--surface-2);
}
.theme-option > span:nth-child(2) strong,
.theme-option > span:nth-child(2) small { display: block; }
.theme-option > span:nth-child(2) strong { font-size: 12px; }
.theme-option > span:nth-child(2) small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}
.theme-option > svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
  opacity: 0;
}
.theme-option.active > svg { opacity: 1; }
.theme-swatch {
  display: grid;
  width: 48px;
  height: 36px;
  padding: 5px;
  grid-template-columns: 11px 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 3px;
  overflow: hidden;
  border: 1px solid rgba(25, 30, 40, 0.1);
  border-radius: 6px;
}
.theme-swatch i { display: block; border-radius: 2px; }
.theme-swatch i:first-child { grid-row: 1 / -1; }
.theme-swatch.sweet-potato { background: #f6f4f5; }
.theme-swatch.sweet-potato i:first-child { background: #e24b56; }
.theme-swatch.sweet-potato i:nth-child(2) { background: #ffffff; }
.theme-swatch.sweet-potato i:nth-child(3) { background: #356fb8; }
.theme-swatch.lime { background: #edf5f2; }
.theme-swatch.lime i:first-child { background: #147d68; }
.theme-swatch.lime i:nth-child(2) { background: #ffffff; }
.theme-swatch.lime i:nth-child(3) { background: #e66a4b; }
.theme-swatch.sky { background: #f1f4f8; }
.theme-swatch.sky i:first-child { background: #24314b; }
.theme-swatch.sky i:nth-child(2) { background: #ffffff; }
.theme-swatch.sky i:nth-child(3) { background: #f06445; }

html[data-skin] .workflow-steps {
  border-color: var(--border);
  background: var(--surface-2);
  box-shadow: 0 4px 16px rgba(35, 41, 53, 0.04);
}
html[data-skin] .workflow-step {
  border-right-color: var(--border);
  background: var(--surface-2);
}
html[data-skin] .workflow-step:hover { background: var(--accent-soft); }
html[data-skin] .workflow-step.active {
  background: var(--surface);
  color: var(--accent-dark);
  box-shadow: inset 0 -3px 0 var(--accent);
}
html[data-skin] .workflow-step > span {
  border-color: var(--border-strong);
  background: var(--surface);
}
html[data-skin] .workflow-step.active > span,
html[data-skin] .step-badge {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}
html[data-skin] .step-badge {
  box-shadow: 0 5px 14px color-mix(in srgb, var(--accent) 24%, transparent);
}
html[data-skin] .work-section,
html[data-skin] .aux-band,
html[data-skin] .metric-card,
html[data-skin] .plan-card {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: var(--card-shadow);
}
html[data-skin] .section-heading { border-bottom-color: var(--border); }
html[data-skin] .url-field,
html[data-skin] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
html[data-skin] select,
html[data-skin] textarea,
html[data-skin] .document-editor {
  border-color: var(--border-strong);
  background: var(--surface);
}
html[data-skin] .url-field:focus-within,
html[data-skin] input:focus,
html[data-skin] select:focus,
html[data-skin] textarea:focus,
html[data-skin] .document-editor:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
html[data-skin] .button.primary,
html[data-skin] .button.rewrite-primary {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 4px 13px color-mix(in srgb, var(--accent) 22%, transparent);
}
html[data-skin] .button.primary:hover,
html[data-skin] .button.rewrite-primary:hover {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}
html[data-skin] .button.secondary,
html[data-skin] .icon-button {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
}
html[data-skin] .button.ghost {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--muted);
}
html[data-skin] .collected-image-card,
html[data-skin] .edu-source-card,
html[data-skin] .edu-result-item {
  border-color: var(--border);
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(32, 40, 52, 0.055);
}
html[data-skin] .collected-image-card:hover,
html[data-skin] .edu-source-card:hover,
html[data-skin] .edu-result-item:hover {
  border-color: var(--accent);
  box-shadow: 0 9px 24px color-mix(in srgb, var(--accent) 10%, transparent);
}
html[data-skin] .edu-source-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--focus-ring);
}
html[data-skin] .edu-source-card.selected .edu-source-check,
html[data-skin] .edu-generation-progress span { background: var(--accent); }
html[data-skin] .collected-image-preview,
html[data-skin] .edu-result-comparison figure,
html[data-skin] .edu-preview-modal figure,
html[data-skin] .edu-empty-state,
html[data-skin] .edu-generation-progress {
  border-color: var(--border);
  background: var(--surface-2);
}
html[data-skin] .modal {
  border-color: var(--border);
  background: var(--surface);
}
html[data-skin] .modal-actions {
  border-top-color: var(--border);
  background: var(--surface-2);
}
html[data-skin] .license-gate { background: var(--bg); }
html[data-skin] .license-panel {
  border-color: var(--border);
  border-top-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(31, 37, 49, 0.16);
}
html[data-skin] .license-brand,
html[data-skin] .license-footer { border-color: var(--border); }
html[data-skin] .license-brand strong,
html[data-skin] .license-panel h1 { color: var(--text); }
html[data-skin] .license-brand small,
html[data-skin] .license-subtitle,
html[data-skin] .license-footer { color: var(--muted); }
html[data-skin] .license-icon {
  border-color: var(--border);
  background: var(--accent-soft);
  color: var(--accent);
}
html[data-skin] .license-input-row {
  border-color: var(--border-strong);
  background: var(--surface-2);
}
html[data-skin] .license-input-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

@media (max-width: 760px) {
  .theme-menu {
    position: fixed;
    top: 66px;
    right: 12px;
    width: min(286px, calc(100vw - 24px));
  }
}

@media (max-width: 430px) {
  .topbar-actions #themeButton { display: inline-grid; }
  .topbar-actions .theme-control { display: block; }
}

.prompt-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
}

.prompt-select-row .prompt-manager-button {
  width: 38px;
  height: 38px;
  color: var(--accent);
}

.modal.prompt-manager-dialog {
  width: min(1080px, 100%);
  max-height: min(820px, calc(100vh - 32px));
}

.prompt-manager-dialog .modal-body {
  padding: 16px;
}

.prompt-manager-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(420px, 1.28fr);
  gap: 14px;
  min-height: 530px;
}

.prompt-editor-panel,
.prompt-library-panel {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-2);
}

.prompt-editor-panel {
  padding: 14px;
}

.prompt-library-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.prompt-panel-heading {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--border);
}

.prompt-editor-panel .prompt-panel-heading {
  min-height: 40px;
  margin-bottom: 13px;
  border-bottom: 0;
}

.prompt-library-panel > .prompt-panel-heading {
  padding: 9px 12px;
  background: var(--surface);
}

.prompt-panel-heading strong,
.prompt-panel-heading span {
  display: block;
}

.prompt-panel-heading strong {
  color: var(--text);
  font-size: 13px;
}

.prompt-panel-heading span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.prompt-editor-form {
  display: grid;
  gap: 13px;
}

.prompt-editor-form input,
.prompt-editor-form textarea {
  width: 100%;
}

.prompt-editor-form textarea {
  min-height: 310px;
  resize: vertical;
  line-height: 1.65;
}

.prompt-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-library-list {
  min-height: 0;
  max-height: 590px;
  overflow: auto;
  scrollbar-gutter: stable;
}

.prompt-library-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 70px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.prompt-library-row:last-child {
  border-bottom: 0;
}

.prompt-library-row.selected {
  box-shadow: inset 3px 0 0 var(--accent);
  background: var(--accent-soft);
}

.prompt-library-copy {
  min-width: 0;
}

.prompt-library-copy strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-library-copy p {
  display: -webkit-box;
  overflow: hidden;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.prompt-library-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.prompt-library-actions .icon-button {
  width: 30px;
  height: 30px;
}

.prompt-library-actions .danger-icon-button {
  color: var(--danger);
}

@media (max-width: 900px) {
  .modal.prompt-manager-dialog {
    width: min(720px, 100%);
  }

  .prompt-manager-layout {
    grid-template-columns: 1fr;
  }

  .prompt-editor-form textarea {
    min-height: 190px;
  }

  .prompt-library-list {
    max-height: 360px;
  }
}

@media (max-width: 560px) {
  .prompt-library-row {
    grid-template-columns: 1fr;
  }

  .prompt-library-actions {
    justify-content: flex-end;
  }
}
