:root {
  color-scheme: dark;
  --bg: #000000;
  --panel: rgba(20, 20, 20, 0.92);
  --panel-soft: rgba(26, 26, 26, 0.88);
  --panel-strong: rgba(0, 0, 0, 0.98);
  --border: rgba(148, 163, 184, 0.18);
  --border-strong: rgba(148, 163, 184, 0.26);
  --text: #e5eefc;
  --muted: #a8b3c9;
  --muted-soft: #7f8ba3;
  --accent: #7c9cff;
  --accent-strong: #5d7dff;
  --accent-soft: rgba(124, 156, 255, 0.14);
  --success: #34d399;
  --danger: #fb7185;
  --shadow: 0 20px 45px rgba(15, 23, 42, 0.32);
  --shadow-soft: 0 18px 40px rgba(4, 8, 18, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(180deg, #000000, #050505 68%, #090909 100%);
  color: var(--text);
}

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

.shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  padding: 24px;
}

.dashboard-shell {
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 20px;
  padding: 20px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.sidebar {
  padding: 24px;
  position: sticky;
  top: 24px;
  height: fit-content;
}

.dashboard-sidebar {
  position: sticky;
  top: 20px;
  display: grid;
  gap: 18px;
  padding: 22px;
  border-radius: 28px;
  background: #000000;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-soft);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.dashboard-sidebar .brand {
  align-items: flex-start;
  padding-bottom: 2px;
}

.brand-logo {
  width: 76px;
  height: 76px;
  object-fit: contain;
  display: block;
  flex: 0 0 auto;
}

.dashboard-sidebar .brand-logo {
  width: 58px;
  height: 58px;
  padding: 10px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(124, 156, 255, 0.12), rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.brand h1,
.hero h2,
.panel h2,
.section-title-row h3 {
  margin: 0;
}

.brand p,
.hero p,
.subtle,
.upload-copy span,
.result-state p,
.tips-panel li,
#configText {
  color: var(--muted);
}

.dashboard-sidebar .brand h1 {
  font-size: 20px;
  letter-spacing: 0.01em;
}

.dashboard-sidebar .brand p {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.6;
}

.status-row {
  margin: 22px 0 12px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.page-nav {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
  gap: 10px;
}

.dashboard-sidebar .page-nav {
  margin-top: 2px;
  grid-template-columns: 1fr;
  gap: 8px;
}

.nav-link {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(7, 7, 7, 0.92);
  color: #dce5fa;
  text-decoration: none;
}

.dashboard-sidebar .nav-link {
  justify-content: flex-start;
  min-height: 46px;
  padding: 12px 16px;
  border-radius: 16px;
  font-weight: 500;
}

.nav-link.active {
  background: rgba(124, 156, 255, 0.16);
  border-color: rgba(124, 156, 255, 0.32);
  color: #f3f7ff;
}

.dashboard-sidebar .nav-link.active {
  background:
    linear-gradient(90deg, rgba(124, 156, 255, 0.26), rgba(124, 156, 255, 0.12)),
    rgba(255, 255, 255, 0.04);
  border-color: rgba(124, 156, 255, 0.32);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #64748b;
}

.status-dot.ok {
  background: var(--success);
  box-shadow: 0 0 0 8px rgba(52, 211, 153, 0.14);
}

.status-dot.warn {
  background: #f59e0b;
  box-shadow: 0 0 0 8px rgba(245, 158, 11, 0.16);
}

.panel {
  margin-top: 20px;
}

.dashboard-sidebar .panel {
  margin-top: 0;
}

.panel h2 {
  font-size: 16px;
  margin-bottom: 16px;
}

.preset-editor {
  display: grid;
  gap: 12px;
}

.preset-toolbar,
.preset-save-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.preset-save-row {
  grid-template-columns: 1fr auto auto;
  margin-top: 10px;
}

.preset-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  max-height: 360px;
  overflow: auto;
}

.history-list {
  display: grid;
  gap: 10px;
  max-height: 340px;
  overflow: auto;
}

.preset-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: var(--panel-soft);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.preset-title-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.preset-item strong {
  font-size: 14px;
}

.preset-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

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

.history-item {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  background: var(--panel-soft);
  border: 1px solid rgba(148, 163, 184, 0.1);
}

.history-image-link {
  display: block;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}

.history-image {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.history-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.history-item p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.history-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.warehouse-card {
  padding: 22px;
}

.warehouse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.warehouse-grid .history-item {
  min-height: 210px;
}

.workspace {
  display: grid;
  gap: 24px;
}

.workspace-dashboard {
  position: relative;
  min-width: 0;
  gap: 18px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 8px 2px 0;
}

.workspace-layout {
  display: grid;
  grid-template-columns: minmax(420px, 520px) minmax(480px, 1fr);
  gap: 24px;
  align-items: start;
}

.workspace-dashboard .workspace-layout {
  grid-template-columns: minmax(420px, 500px) minmax(0, 1fr);
  gap: 18px;
}

.editor-card,
.result-panel {
  padding: 22px;
  min-height: 100%;
}

.workspace-topbar,
.editor-card,
.result-panel {
  position: relative;
  overflow: hidden;
}

.workspace-topbar::before,
.editor-card::before,
.result-panel::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 120px;
  background: linear-gradient(180deg, rgba(124, 156, 255, 0.08), transparent 78%);
  pointer-events: none;
}

.workspace-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px 22px;
  border-radius: 26px;
  background: #000000;
  border-color: rgba(255, 255, 255, 0.08);
}

.topbar-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.topbar-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  font-size: 13px;
}

.topbar-pill.active {
  background: rgba(124, 156, 255, 0.18);
  border-color: rgba(124, 156, 255, 0.28);
  color: #f4f7ff;
}

.topbar-copy {
  text-align: right;
}

.topbar-copy h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0.01em;
}

.topbar-copy p {
  max-width: 560px;
  margin: 8px 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.editor-card {
  display: grid;
  gap: 18px;
}

.editor-card,
.result-panel {
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(24, 24, 24, 0.96), rgba(16, 16, 16, 0.98)),
    var(--panel);
  border-color: rgba(255, 255, 255, 0.08);
}

.editor-card-header,
.result-panel-header {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.editor-card-header h3,
.result-panel-header h3 {
  margin: 8px 0 0;
  font-size: 22px;
  line-height: 1.25;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(124, 156, 255, 0.12);
  color: #d8e3ff;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.panel-tag {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(148, 163, 184, 0.12);
  color: #dbe6ff;
  font-size: 13px;
  white-space: nowrap;
}

.editor-section {
  display: grid;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.editor-card .editor-section {
  position: relative;
  z-index: 1;
  gap: 14px;
}

.editor-section:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.section-title-row.tight {
  margin-bottom: 6px;
}

.editor-actions {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  margin-top: 4px;
}

.wide-btn {
  width: 100%;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.editor-card .section-title-row {
  margin-bottom: 0;
}

.editor-card .section-title-row h3 {
  font-size: 15px;
  font-weight: 600;
}

.field {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.field label {
  font-size: 14px;
  color: #dbe6ff;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 16px;
  background: rgba(10, 10, 10, 0.96);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(124, 156, 255, 0.5);
  box-shadow: 0 0 0 4px rgba(124, 156, 255, 0.14);
}

textarea {
  min-height: 280px;
  resize: vertical;
  line-height: 1.7;
}

.prompt-editor {
  min-height: 140px;
}

.upload-zone {
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 290px;
  padding: 20px;
  border: 1px dashed rgba(124, 156, 255, 0.4);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(124, 156, 255, 0.08), transparent 40%),
    rgba(15, 23, 42, 0.72);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease;
  overflow: hidden;
}

.compose-card .upload-zone {
  min-height: 170px;
  border-radius: 24px;
  border-color: rgba(124, 156, 255, 0.28);
  background:
    radial-gradient(circle at top, rgba(124, 156, 255, 0.08), transparent 50%),
    linear-gradient(180deg, rgba(10, 10, 10, 0.98), rgba(18, 18, 18, 0.94));
}

.upload-zone.compact {
  min-height: 150px;
}

.upload-zone:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 156, 255, 0.7);
}

.upload-zone.is-dragover,
.compose-card.is-dragover .upload-zone {
  border-color: rgba(124, 156, 255, 0.92);
  background:
    linear-gradient(180deg, rgba(124, 156, 255, 0.18), transparent 42%),
    rgba(15, 23, 42, 0.86);
  box-shadow: inset 0 0 0 1px rgba(124, 156, 255, 0.35);
}

.compose-card.is-dragover {
  box-shadow:
    var(--shadow),
    0 0 0 1px rgba(124, 156, 255, 0.18);
}

.upload-zone.has-image {
  min-height: 160px;
}

.upload-copy {
  display: grid;
  gap: 8px;
  text-align: center;
}

.upload-copy strong {
  max-width: 320px;
  font-size: 15px;
  line-height: 1.6;
}

.upload-meta {
  margin-top: 12px;
}

.preview-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 12px;
}

.compose-card .preview-grid {
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 14px;
}

.preview-item {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.9);
}

.compose-card .preview-item {
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.preview-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.preview-item button {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  cursor: pointer;
}

.preview-item-footer {
  padding: 10px 12px 12px;
  display: grid;
  gap: 4px;
}

.preview-item-footer strong {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-item-footer span {
  color: var(--muted);
  font-size: 12px;
}

.primary-btn,
.secondary-btn,
.ghost-btn,
.mini-btn {
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.primary-btn:hover,
.secondary-btn:hover,
.ghost-btn:hover,
.mini-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
  padding: 14px 20px;
  min-width: 132px;
  font-weight: 600;
}

.primary-btn:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(0.1);
}

.secondary-btn {
  background: rgba(124, 156, 255, 0.14);
  color: #dae5ff;
  padding: 12px 14px;
}

.ghost-btn,
.mini-btn {
  background: transparent;
  color: #dce5fa;
  border: 1px solid rgba(148, 163, 184, 0.16);
  padding: 10px 14px;
}

.editor-actions .ghost-btn,
.editor-actions .primary-btn {
  min-height: 48px;
}

.mini-btn.danger {
  color: #ffc3ce;
  border-color: rgba(251, 113, 133, 0.3);
}

.prompt-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.result-state {
  min-height: 320px;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background:
    radial-gradient(circle at top, rgba(124, 156, 255, 0.06), transparent 42%),
    rgba(8, 8, 8, 0.98);
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
}

.result-stage {
  min-height: 680px;
}

.result-canvas-shell {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  min-height: 100%;
  padding-top: 6px;
}

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

.task-stream-empty {
  margin: 0;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px dashed rgba(148, 163, 184, 0.16);
  background: rgba(255, 255, 255, 0.02);
  color: var(--muted);
}

.task-chip {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  background: rgba(7, 7, 7, 0.94);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.task-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 156, 255, 0.22);
}

.task-chip.is-selected {
  border-color: rgba(124, 156, 255, 0.32);
  background:
    linear-gradient(180deg, rgba(124, 156, 255, 0.08), rgba(124, 156, 255, 0.02)),
    rgba(7, 7, 7, 0.98);
  box-shadow: 0 0 0 1px rgba(124, 156, 255, 0.08) inset;
}

.task-chip-top,
.task-chip-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.task-chip-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.task-chip-body {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.task-chip-copy {
  display: grid;
  gap: 10px;
}

.task-chip-title {
  font-size: 13px;
  font-weight: 700;
  color: #f3f7ff;
}

.task-chip-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.task-chip-status.is-queued {
  color: #fcd34d;
  border-color: rgba(252, 211, 77, 0.22);
  background: rgba(252, 211, 77, 0.08);
}

.task-chip-status.is-processing {
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.22);
  background: rgba(147, 197, 253, 0.08);
}

.task-chip-status.is-success {
  color: #86efac;
  border-color: rgba(134, 239, 172, 0.22);
  background: rgba(134, 239, 172, 0.08);
}

.task-chip-status.is-failed {
  color: #fda4af;
  border-color: rgba(253, 164, 175, 0.22);
  background: rgba(253, 164, 175, 0.08);
}

.task-delete-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(248, 113, 113, 0.16);
  background: rgba(248, 113, 113, 0.06);
  color: #ffb4b4;
  border-radius: 10px;
  padding: 0;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.task-delete-btn:hover {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.24);
  transform: translateY(-1px);
}

.task-delete-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.task-thumb-shell {
  position: relative;
  width: 74px;
  height: 74px;
}

.task-thumb {
  width: 74px;
  height: 74px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.03);
  display: block;
}

.task-thumb-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.task-thumb-popover {
  position: absolute;
  left: 86px;
  top: -10px;
  width: 220px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(4, 4, 4, 0.98);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 20;
}

.task-thumb-popover img {
  width: 100%;
  display: block;
  border-radius: 12px;
}

.task-thumb-shell:hover .task-thumb-popover {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.task-chip-meta,
.task-chip-progress span,
.task-chip p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.task-chip-progress {
  display: grid;
  gap: 8px;
}

.task-chip-progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.12);
}

.task-chip-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8b5cf6, #6ea8ff);
}

.task-chip p {
  margin: 0;
}

.result-state.is-loading {
  color: #dce5fa;
  font-size: 15px;
}

.loading-panel {
  width: min(100%, 420px);
  display: grid;
  gap: 14px;
  justify-items: center;
}

.loading-panel strong {
  font-size: 18px;
  color: #f3f7ff;
}

.loading-percent {
  font-size: 42px;
  font-weight: 700;
  color: #f3f7ff;
}

.loading-bar {
  width: 100%;
  height: 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.14);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.loading-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #8b5cf6, #6ea8ff);
  transition: width 0.28s ease;
}

.result-state.has-image {
  padding: 24px;
}

.result-state img {
  width: auto;
  max-width: min(100%, 720px);
  max-height: 520px;
  display: block;
  margin: 0 auto;
  object-fit: contain;
  border-radius: 16px;
}

.mode-badge {
  display: inline-flex;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(124, 156, 255, 0.12);
  color: #dae5ff;
  font-size: 13px;
}

.result-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.03);
  color: #9cb4ff;
  text-decoration: none;
}

.result-link:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.user-panel {
  margin-top: 20px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.dashboard-sidebar .user-panel {
  margin-top: 0;
  padding: 16px 16px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    rgba(8, 8, 8, 0.96);
}

.user-panel strong {
  display: block;
  margin-top: 4px;
}

.credit-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 88px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(124, 156, 255, 0.14);
  color: #e8eeff;
}

.sidebar-actions {
  margin-top: 12px;
}

.dashboard-sidebar .sidebar-actions {
  margin-top: -4px;
}

.compact-status-panel {
  padding: 16px 16px;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(8, 8, 8, 0.96);
}

.compact-status-row {
  margin: 0;
  font-size: 13px;
}

.tips-panel {
  padding: 18px 18px 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(10, 10, 10, 0.96);
}

.tips-panel ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
}

.tips-panel li {
  line-height: 1.65;
  font-size: 13px;
}

.result-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.auth-page {
  min-height: 100vh;
}

.auth-shell {
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  padding: 24px;
}

.auth-brand-card,
.auth-card {
  padding: 24px;
}

.auth-card {
  display: grid;
  gap: 20px;
}

.compact-hero {
  padding: 0;
}

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

.auth-form {
  display: grid;
  gap: 6px;
  padding: 20px;
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(6, 6, 6, 0.98), rgba(14, 14, 14, 0.96));
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.auth-form-single {
  max-width: 420px;
}

.text-switch-btn {
  width: fit-content;
  padding: 0;
  border: none;
  background: transparent;
  color: #9cb4ff;
  cursor: pointer;
}

.text-switch-btn:hover {
  text-decoration: underline;
}

.auth-message {
  margin: 0;
  min-height: 24px;
}

.error-text {
  color: #ffc0cb;
}

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

.stat-card {
  padding: 20px 22px;
  display: grid;
  gap: 10px;
}

.stat-card strong {
  font-size: 34px;
  line-height: 1;
}

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

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

.data-table th,
.data-table td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  vertical-align: top;
}

.data-table th {
  color: #dfe8ff;
  font-weight: 600;
}

.empty-cell {
  color: var(--muted);
}

.credit-form {
  display: grid;
  grid-template-columns: 110px 90px 1fr auto;
  gap: 10px;
  min-width: 520px;
}

.log-list {
  display: grid;
  gap: 12px;
}

.log-item {
  padding: 16px;
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.log-item p {
  margin: 10px 0;
  color: var(--muted);
}

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

.log-positive {
  color: #6ee7b7;
}

.log-negative {
  color: #fda4af;
}

.rich-history-item {
  align-content: start;
}

.history-main-link {
  display: block;
  border-radius: 16px;
  overflow: hidden;
}

.history-placeholder {
  display: grid;
  place-items: center;
  min-height: 220px;
  background:
    radial-gradient(circle at top, rgba(124, 156, 255, 0.08), transparent 40%),
    rgba(10, 10, 10, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.history-placeholder-copy {
  display: grid;
  gap: 10px;
  justify-items: center;
  padding: 24px;
  text-align: center;
}

.history-placeholder-copy strong {
  font-size: 18px;
}

.history-placeholder-copy span {
  color: var(--muted);
  line-height: 1.7;
}

.history-main-image {
  aspect-ratio: 4 / 3;
}

.history-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(255, 255, 255, 0.04);
}

.history-status-badge.is-queued {
  color: #fcd34d;
  border-color: rgba(252, 211, 77, 0.22);
  background: rgba(252, 211, 77, 0.08);
}

.history-status-badge.is-processing {
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.22);
  background: rgba(147, 197, 253, 0.08);
}

.history-status-badge.is-success {
  color: #86efac;
  border-color: rgba(134, 239, 172, 0.22);
  background: rgba(134, 239, 172, 0.08);
}

.history-status-badge.is-failed {
  color: #fda4af;
  border-color: rgba(253, 164, 175, 0.22);
  background: rgba(253, 164, 175, 0.08);
}

.history-reference-grid {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.history-reference-link {
  width: 68px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.12);
}

.history-reference-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

.empty-state {
  color: var(--muted);
  padding: 16px 4px;
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .dashboard-shell {
    padding: 16px;
  }

  .workspace-topbar {
    grid-template-columns: 1fr;
  }

  .topbar-copy {
    text-align: left;
  }

  .topbar-copy p {
    margin-left: 0;
  }
}

@media (max-width: 920px) {
  .workspace-layout {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .auth-grid {
    grid-template-columns: 1fr;
  }

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

  .editor-actions,
  .preset-toolbar,
  .preset-save-row,
  .credit-form {
    grid-template-columns: 1fr;
  }

  .dashboard-sidebar .page-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editor-card-header,
  .result-panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .result-toolbar {
    justify-content: flex-start;
  }

  .task-stream {
    grid-template-columns: 1fr;
  }

  .task-chip-body {
    grid-template-columns: 1fr;
  }

  .task-thumb-shell,
  .task-thumb {
    width: 100%;
    height: 130px;
  }

  .task-thumb-popover {
    display: none;
  }

  .result-stage {
    min-height: 520px;
  }
}

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

@media (max-width: 640px) {
  .dashboard-shell {
    padding: 12px;
    gap: 14px;
  }

  .dashboard-sidebar,
  .workspace-topbar,
  .editor-card,
  .result-panel {
    padding: 18px;
    border-radius: 22px;
  }

  .dashboard-sidebar .page-nav {
    grid-template-columns: 1fr;
  }

  .topbar-copy h2,
  .editor-card-header h3,
  .result-panel-header h3 {
    font-size: 20px;
  }

  .result-stage {
    min-height: 420px;
  }

  .result-state img {
    max-height: 360px;
  }
}
