:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d9dee7;
  --soft-line: #edf0f4;
  --blue: #2563eb;
  --cyan: #0891b2;
  --green: #15803d;
  --amber: #b45309;
  --rose: #be123c;
  --violet: #7c3aed;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
  --radius: 8px;
  font-family:
    "Noto Sans SC",
    "Microsoft YaHei UI",
    "Microsoft YaHei",
    "PingFang SC",
    "Hiragino Sans GB",
    "Inter",
    system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(246, 247, 249, 0.94)),
    #f6f7f9;
  color: var(--ink);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body.modal-open {
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  min-width: 0;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #17202a;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

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

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

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

.nav-list {
  display: grid;
  min-width: 0;
  gap: 8px;
  scrollbar-width: none;
}

.sidebar-navigation,
.sidebar-group {
  display: grid;
  min-width: 0;
}

.sidebar-navigation {
  gap: 20px;
}

.sidebar-group {
  gap: 8px;
}

.sidebar-label {
  margin: 0 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
}

.utility-group {
  padding-top: 18px;
  border-top: 1px solid var(--soft-line);
}

.category-block {
  display: grid;
  gap: 3px;
}

.secondary-list {
  display: grid;
  gap: 2px;
  margin-left: 26px;
  padding-left: 18px;
  border-left: 1px solid #dbe3ef;
}

.secondary-item {
  min-height: 32px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  text-align: left;
}

.secondary-item:hover,
.secondary-item.is-active {
  background: #f0f5ff;
  color: #1d4ed8;
  font-weight: 800;
}

.nav-list::-webkit-scrollbar {
  display: none;
}

.nav-item,
.soft-button,
.icon-button,
.primary-button,
.segmented button {
  border: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: 8px;
  background: transparent;
  color: #475467;
  text-align: left;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-item:hover,
.nav-item.is-active {
  background: #eaf1ff;
  color: #1d4ed8;
}

.nav-item:active {
  transform: translateY(1px);
}

i[data-lucide] {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.credit-box {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.credit-box div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.credit-box strong {
  color: var(--ink);
  font-size: 18px;
}

.meter {
  height: 8px;
  margin: 14px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf5;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
}

.credit-box p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 22px;
  align-content: start;
  min-width: 0;
  padding: 24px;
}

.main > * {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

.topbar-actions,
.section-heading,
.control-row,
.toggle-row,
.segmented {
  display: flex;
  align-items: center;
}

.topbar-actions {
  min-width: 0;
  gap: 10px;
  flex: 0 1 auto;
  flex-wrap: nowrap;
}

.topbar > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(280px, 26vw);
  min-width: 180px;
  flex: 0 1 min(280px, 26vw);
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

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

.search-box input::placeholder {
  color: #98a2b3;
}

.icon-button,
.avatar-button {
  display: grid;
  min-width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: #344054;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.icon-button.small {
  min-width: 34px;
  height: 34px;
}

.avatar-button {
  border-color: #17202a;
  background: #17202a;
  color: #fff;
  font-weight: 800;
}

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

.stats-strip article,
.tool-panel,
.composer-panel,
.queue-panel,
.gallery-panel,
.workflow-panel,
.usage-panel,
.workflow-card,
.usage-summary {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stats-strip article {
  padding: 16px;
}

.stats-strip span,
.stats-strip small {
  display: block;
  color: var(--muted);
}

.stats-strip span {
  font-size: 13px;
}

.stats-strip strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 28px;
}

.stats-strip small {
  font-size: 12px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(310px, 0.88fr) minmax(380px, 1.14fr) minmax(280px, 0.72fr);
  gap: 18px;
  align-items: start;
}

.tool-panel,
.composer-panel,
.queue-panel,
.gallery-panel,
.workflow-panel,
.usage-panel {
  padding: 18px;
}

.section-heading {
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.section-heading.compact {
  margin-bottom: 12px;
}

.soft-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 8px;
  white-space: nowrap;
}

.soft-button {
  padding: 0 12px;
  background: #f2f5fa;
  color: #344054;
}

.primary-button {
  width: 100%;
  padding: 0 18px;
  background: #17202a;
  color: #fff;
  font-weight: 800;
}

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

.tool-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.tool-card:hover,
.tool-card.is-selected {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 10px 26px rgba(37, 99, 235, 0.12);
}

.tool-card:active {
  transform: translateY(1px);
}

.tool-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
}

.tool-card strong,
.tool-card small {
  display: block;
}

.tool-card strong {
  margin-bottom: 3px;
  font-size: 14px;
}

.tool-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.tool-price {
  color: var(--muted);
  font-size: 12px;
}

.composer-panel {
  display: grid;
  gap: 16px;
}

.composer-visual {
  position: relative;
  min-height: 234px;
  overflow: hidden;
  border-radius: 8px;
  background: #101828;
}

.composer-visual img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 234px;
  object-fit: cover;
}

.composer-visual::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, rgba(23, 32, 42, 0.08), rgba(23, 32, 42, 0.64));
}

.visual-overlay {
  position: absolute;
  z-index: 1;
  right: 16px;
  bottom: 16px;
  left: 16px;
  color: #fff;
}

.visual-overlay span,
.visual-overlay strong {
  display: block;
}

.visual-overlay span {
  width: max-content;
  max-width: 100%;
  margin-bottom: 8px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 12px;
  font-weight: 800;
}

.visual-overlay strong {
  max-width: 440px;
  font-size: 24px;
  line-height: 1.15;
  text-wrap: balance;
}

.composer {
  display: grid;
  gap: 14px;
}

.field-group,
.select-field,
.slider-field {
  display: grid;
  gap: 8px;
}

.field-group label,
.select-field span,
.slider-field label {
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

textarea,
select,
input[type="url"],
input[type="password"],
input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--ink);
}

textarea {
  min-height: 112px;
  resize: vertical;
  padding: 12px;
  line-height: 1.6;
}

.template-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 4px;
  scrollbar-width: thin;
}

.template-chip {
  flex: 0 0 auto;
  max-width: 260px;
  min-height: 32px;
  overflow: hidden;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #344054;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-chip:hover {
  border-color: rgba(37, 99, 235, 0.55);
  color: var(--blue);
}

.ratio-picker,
.reference-uploader {
  display: grid;
  gap: 10px;
}

.ratio-heading,
.reference-uploader > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.ratio-heading span,
.reference-uploader span {
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.ratio-heading strong {
  color: #475467;
  font-size: 13px;
}

.reference-uploader small {
  color: var(--muted);
  font-size: 12px;
}

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

.ratio-option {
  display: grid;
  min-width: 0;
  min-height: 40px;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #17202a;
  font-weight: 700;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.ratio-option:hover {
  border-color: rgba(37, 99, 235, 0.5);
  color: var(--blue);
}

.ratio-option.is-active {
  border-color: rgba(37, 99, 235, 0.72);
  background: #eef5ff;
  color: #1d4ed8;
}

.ratio-option strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ratio-shape {
  display: block;
  width: 24px;
  max-height: 22px;
  aspect-ratio: var(--ratio-aspect);
  border: 1px solid currentColor;
  border-radius: 4px;
  background: rgba(37, 99, 235, 0.08);
}

.upload-dropzone {
  display: grid;
  min-height: 96px;
  place-items: center;
  align-content: center;
  gap: 4px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfcfe, #f5f7fb);
  color: #344054;
  text-align: center;
  cursor: pointer;
}

.upload-dropzone:hover {
  border-color: rgba(37, 99, 235, 0.58);
  background: #f8fbff;
}

.upload-dropzone i {
  width: 24px;
  height: 24px;
  color: var(--blue);
}

.upload-dropzone strong {
  font-size: 13px;
}

.reference-preview {
  display: grid;
  min-height: 44px;
  overflow: hidden;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
}

.reference-preview.is-empty {
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.reference-preview img {
  display: block;
  width: 100%;
  max-height: 168px;
  object-fit: cover;
}

.reference-meta {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-top: 1px solid var(--soft-line);
}

.reference-meta strong {
  min-width: 0;
  overflow: hidden;
  color: #17202a;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.is-hidden {
  display: none !important;
}

select {
  min-height: 42px;
  padding: 0 12px;
}

input[type="url"],
input[type="password"],
input[type="text"] {
  min-height: 42px;
  padding: 0 12px;
}

textarea:focus,
select:focus,
input[type="url"]:focus,
input[type="password"]:focus,
input[type="text"]:focus,
input[type="range"]:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  outline-offset: 2px;
}

.control-row {
  gap: 12px;
}

.control-row > * {
  flex: 1 1 0;
}

.slider-field > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slider-field strong {
  color: var(--blue);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--blue);
}

.toggle-row {
  flex-wrap: wrap;
  gap: 10px;
}

.toggle-row label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: #344054;
  font-size: 13px;
}

.toggle-row input {
  accent-color: var(--blue);
}

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

.task-card {
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fbfcfe;
}

.task-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.task-head strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-status {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf5;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  transition: width 280ms ease;
}

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

.gallery-panel {
  display: grid;
  gap: 4px;
}

.segmented {
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2f5fa;
}

.segmented button {
  min-height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}

.segmented button.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

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

.output-card {
  display: block;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: inherit;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.output-card:hover {
  border-color: rgba(37, 99, 235, 0.45);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.1);
}

.output-card:active {
  transform: translateY(1px);
}

.output-media {
  position: relative;
  display: block;
  min-height: 172px;
  overflow: hidden;
  background: #101828;
}

.output-media img {
  display: block;
  width: 100%;
  height: 172px;
  object-fit: cover;
}

.video-badge,
.type-badge {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.video-badge {
  top: 10px;
  left: 10px;
}

.type-badge {
  right: 10px;
  bottom: 10px;
}

.output-body {
  display: block;
  padding: 12px;
}

.output-body strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.output-body p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-row span {
  padding: 4px 7px;
  border-radius: 999px;
  background: #f2f5fa;
  color: #475467;
  font-size: 11px;
}

.empty-state {
  display: grid;
  grid-column: 1 / -1;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 10px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
  text-align: center;
}

.empty-state i {
  width: 28px;
  height: 28px;
  color: var(--blue);
}

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

.empty-state p {
  max-width: 300px;
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

.modal-backdrop {
  position: fixed;
  z-index: 50;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(280px, 1fr);
  width: min(920px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.34);
}

.modal-close {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
}

.modal-media {
  min-height: 480px;
  background: #101828;
}

.modal-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-content {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 34px;
}

.modal-type {
  width: max-content;
  max-width: 100%;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eaf1ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}

.modal-content h2 {
  font-size: 28px;
}

.modal-content p {
  margin-bottom: 0;
  color: #344054;
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.modal-primary {
  width: auto;
  min-width: 132px;
}

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

.workflow-card {
  padding: 18px;
}

.workflow-card i {
  width: 28px;
  height: 28px;
  color: var(--blue);
}

.workflow-card p,
.usage-summary p {
  color: var(--muted);
  line-height: 1.6;
}

.workflow-card span {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.usage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.65fr);
  gap: 14px;
}

.usage-chart {
  display: flex;
  align-items: end;
  gap: 18px;
  height: 260px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfcfe, #f2f5fa);
}

.bar {
  position: relative;
  flex: 1;
  min-width: 24px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--blue), var(--cyan));
}

.bar span {
  position: absolute;
  right: 0;
  bottom: -26px;
  left: 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.usage-summary {
  padding: 20px;
}

.usage-summary strong {
  display: block;
  margin-bottom: 12px;
  font-size: 30px;
}

.integrations-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.admin-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.admin-stats article {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fbfcfe;
}

.admin-stats span {
  color: var(--muted);
  font-size: 13px;
}

.admin-stats strong {
  font-size: 24px;
}

.admin-table-wrap {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.admin-table-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-table-heading h3 {
  margin: 0;
}

.admin-user-list {
  display: grid;
  gap: 8px;
}

.admin-user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
}

.admin-user-row > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.admin-user-row strong,
.admin-user-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-user-row > span {
  color: var(--muted);
  font-size: 12px;
}

.auth-card {
  position: relative;
  width: min(440px, 100%);
  overflow: hidden;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.34);
}

.auth-content {
  display: grid;
  gap: 14px;
  padding: 34px;
}

.auth-content h2 {
  font-size: 28px;
}

.auth-subtitle {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 13px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: #f2f5fa;
}

.auth-tabs button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.auth-tabs button.is-active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

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

.auth-error {
  min-height: 20px;
  margin: -4px 0 -4px;
  color: #b42318;
  font-size: 13px;
}

.auth-logout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #344054;
  font-weight: 800;
}

.admin-nav-item {
  margin-top: 2px;
}

.save-status {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f2f5fa;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.save-status.is-ok {
  background: #dcfce7;
  color: #166534;
}

.save-status.is-warning {
  background: #fef3c7;
  color: #92400e;
}

.integration-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(300px, 1.12fr);
  gap: 16px;
  align-items: start;
}

.integration-form,
.provider-map {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

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

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

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

.provider-map h3 {
  margin-bottom: 14px;
}

.route-list {
  display: grid;
  gap: 10px;
}

.route-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--soft-line);
  border-radius: 8px;
  background: #fff;
}

.route-list span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.route-list strong {
  color: #17202a;
  font-size: 13px;
  text-align: right;
}

[hidden] {
  display: none !important;
}

@media (max-width: 1320px) {
  .workspace-grid {
    grid-template-columns: minmax(280px, 0.82fr) minmax(420px, 1.18fr);
  }

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

  .task-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    justify-content: center;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
  }

  .credit-box {
    display: none;
  }

  .main {
    padding: 18px;
  }

  .topbar {
    align-items: start;
  }

  .stats-strip,
  .workspace-grid,
  .workflow-grid,
  .usage-layout,
  .integration-layout,
  .admin-stats {
    grid-template-columns: 1fr;
  }

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

  .modal-card {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .modal-media {
    min-height: 320px;
  }

  .modal-content {
    align-content: start;
  }
}

@media (max-width: 620px) {
  .main {
    padding: 14px;
    overflow-x: hidden;
  }

  h1 {
    max-width: 100%;
    font-size: 28px;
    line-height: 1.18;
    word-break: break-word;
  }

  .topbar,
  .section-heading,
  .control-row {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .search-box {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }

  .stats-strip,
  .task-list,
  .output-grid {
    grid-template-columns: 1fr;
  }

  .tool-panel,
  .composer-panel,
  .queue-panel,
  .gallery-panel,
  .workflow-panel,
  .usage-panel,
  .integrations-panel {
    padding: 14px;
  }

  .tool-card {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .tool-price {
    grid-column: 2;
  }

  .visual-overlay strong {
    font-size: 20px;
  }

  .segmented {
    width: 100%;
    justify-content: space-between;
  }

  .segmented button {
    flex: 1 1 76px;
  }

  .template-chip {
    max-width: 220px;
  }

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

  .reference-uploader > div:first-child {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .modal-backdrop {
    padding: 12px;
  }

  .modal-media {
    min-height: 230px;
  }

  .modal-content {
    padding: 22px;
  }

  .modal-content h2 {
    font-size: 22px;
  }

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

  .modal-actions .soft-button,
  .modal-primary {
    width: 100%;
  }

  .form-actions .soft-button,
  .form-actions .primary-button {
    width: 100%;
  }

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

  .route-list div {
    align-items: flex-start;
    flex-direction: column;
  }

  .route-list strong {
    text-align: left;
  }

  .admin-user-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .admin-user-row > span {
    grid-column: 1;
  }

  .admin-user-row > button {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .auth-content {
    padding: 24px 20px;
  }
}
