:root {
  color-scheme: light;
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-soft: #f7f9fb;
  --line: #d8dee8;
  --text: #17202e;
  --muted: #667085;
  --primary: #175cd3;
  --primary-dark: #0f3f8f;
  --accent: #0f766e;
  --warning: #b45309;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(24, 39, 75, 0.12);
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    Arial,
    sans-serif;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

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

.side {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 20px;
  background: #111827;
  color: #ffffff;
}

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

.mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  background: #175cd3;
  font-weight: 800;
}

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

.brand h1 {
  font-size: 18px;
  line-height: 1.25;
}

.brand p,
.eyebrow,
.locked-panel p {
  margin: 4px 0 0;
  color: var(--muted);
}

.brand p {
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}

.tabs {
  display: grid;
  gap: 8px;
}

.tab {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: rgba(255, 255, 255, 0.76);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.tab.active,
.tab:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
}

.auth-box {
  margin-top: auto;
  display: grid;
  gap: 8px;
}

.auth-box[hidden] {
  display: none;
}

.auth-box label,
.auth-box p {
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}

.auth-box p {
  margin: 0;
  line-height: 1.5;
}

.dark-field {
  margin-bottom: 10px;
}

.dark-field span {
  color: rgba(255, 255, 255, 0.72);
}

.dark-field input {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  padding: 11px 12px;
  color: #ffffff;
  background: #1f2937;
}

.dark-field input::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

.login-action {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  background: var(--primary);
  cursor: pointer;
  font-weight: 800;
}

.secondary-login {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: transparent;
}

.user-box strong {
  display: block;
  color: #ffffff;
  font-size: 16px;
}

.logged-out .main {
  display: none;
}

.logged-out .shell {
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.logged-out .side {
  width: min(420px, 100%);
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.logged-out .brand,
.logged-out .tabs,
.logged-out .user-box {
  display: none;
}

.logged-out .auth-box {
  width: 100%;
  margin: 0;
}

.logged-out .dark-field span {
  color: var(--text);
}

.logged-out .dark-field input {
  border-color: var(--line);
  color: var(--text);
  background: var(--surface);
}

.logged-out .dark-field input::placeholder {
  color: #98a2b3;
}

.login-heading {
  margin-bottom: 22px;
  text-align: center;
}

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

.login-heading p {
  margin-top: 6px;
  color: var(--muted) !important;
}

.records-module {
  margin-top: 20px;
}

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

.compact-grid {
  margin-top: 10px;
}

.config-help {
  margin: 10px 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.async-config-panel {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.async-config-panel summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 700;
}

.async-config-panel[open] summary {
  margin-bottom: 8px;
}

.field-error {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12);
}

.sheet-module {
  margin-bottom: 20px;
  padding: 0;
  overflow: hidden;
}

.sheet-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid #b7c5da;
  padding: 12px 14px;
  background: #ffffff;
}

.sheet-title h3 {
  margin: 0;
  font-size: 24px;
  font-weight: 500;
}

.sheet-scroll {
  overflow-x: auto;
  background: #ffffff;
}

.workflow-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  table-layout: fixed;
  background: #ffffff;
}

.workflow-table th,
.workflow-table td {
  border: 1px solid #b7c5da;
  padding: 0;
  text-align: center;
  vertical-align: middle;
}

.workflow-table th {
  height: 36px;
  color: #000000;
  background: #ffffff;
  font-size: 15px;
  font-weight: 400;
}

.header-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 14px 0 4px;
  cursor: pointer;
  white-space: nowrap;
}

.header-select::after {
  content: "";
  position: absolute;
  right: 2px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid #000000;
  border-bottom: 1.5px solid #000000;
  transform: translateY(-64%) rotate(45deg);
  pointer-events: none;
}

.header-select select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.workflow-table td {
  height: 96px;
  min-width: 88px;
}

.cutout-table th,
.cutout-table td {
  width: 25%;
}

.generate-table {
  min-width: 1420px;
}

.generate-table th,
.generate-table td {
  min-width: 0;
}

.generate-table th:nth-child(1),
.generate-table th:nth-child(2),
.generate-table td:nth-child(1),
.generate-table td:nth-child(2) {
  width: 96px;
}

.generate-table th:nth-child(5),
.generate-table td:nth-child(5),
.generate-table th:nth-child(11),
.generate-table td:nth-child(11) {
  width: 150px;
}

.generate-table th:nth-child(3),
.generate-table td:nth-child(3) {
  width: 118px;
}

.generate-table th:nth-child(4),
.generate-table td:nth-child(4) {
  width: 146px;
}

.generate-table th:nth-child(6),
.generate-table td:nth-child(6),
.generate-table th:nth-child(7),
.generate-table td:nth-child(7),
.generate-table th:nth-child(9),
.generate-table td:nth-child(9),
.generate-table th:nth-child(10),
.generate-table td:nth-child(10) {
  width: 82px;
}

.generate-table th:nth-child(8),
.generate-table td:nth-child(8) {
  width: 260px;
}

.sheet-upload {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  height: 96px;
  cursor: pointer;
  background: #ffffff;
  outline: none;
}

.sheet-upload input {
  display: none;
}

.sheet-upload:focus-visible {
  box-shadow: inset 0 0 0 2px #2563eb;
}

.sheet-upload.drag-over {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
  background: #eff6ff;
}

.sheet-upload .plus {
  color: #000000;
  font-size: 46px;
  line-height: 1;
}

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

.sheet-thumb {
  display: block;
  max-width: 100%;
  width: 100%;
  height: 96px;
  object-fit: contain;
  background:
    linear-gradient(45deg, #d8dee8 25%, transparent 25%),
    linear-gradient(-45deg, #d8dee8 25%, transparent 25%),
    #ffffff;
  background-size: 14px 14px;
}

.sheet-button {
  min-width: 72px;
  min-height: 36px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #000000;
  cursor: pointer;
}

.sheet-button:hover {
  background: #eef4ff;
}

.sheet-button:disabled {
  cursor: wait;
  color: #64748b;
  background: #f1f5f9;
}

.generation-progress {
  position: relative;
  width: calc(100% - 12px);
  height: 18px;
  margin: 4px auto;
  overflow: hidden;
  border: 1px solid #b7c5da;
  background: #f8fafc;
}

.generation-progress-bar {
  height: 100%;
  background: #2563eb;
  transition: width 0.45s ease;
}

.generation-progress span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #0f172a;
  font-size: 11px;
  line-height: 1;
}

.generation-state {
  width: calc(100% - 12px);
  margin: 4px auto;
  padding: 3px 4px;
  font-size: 12px;
  line-height: 1.2;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
}

.generation-state-error {
  color: #b42318;
  border-color: #fecdca;
  background: #fffbfa;
}

.generation-state-warning {
  color: #92400e;
  border-color: #fed7aa;
  background: #fffbeb;
}

.workflow-table select,
.workflow-table textarea {
  width: 100%;
  min-height: 36px;
  border: 0;
  outline: 0;
  background: #ffffff;
  color: #000000;
  text-align: center;
}

.workflow-table .row-select {
  height: 96px;
  min-height: 96px;
  padding: 0 22px 0 8px;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
}

.workflow-table .compact-row-select {
  padding-right: 18px;
}

.workflow-table textarea {
  height: 96px;
  resize: none;
  padding: 8px;
  text-align: left;
}

.row-output-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(58px, 58px));
  justify-content: center;
  gap: 4px;
  padding: 4px;
}

.row-output-grid .sheet-thumb {
  height: 58px;
  border: 1px solid #d8dee8;
}

.sheet-thumb.is-previewable {
  cursor: zoom-in;
}

.sheet-thumb.is-previewable:hover {
  outline: 2px solid #2563eb;
  outline-offset: -2px;
}

.cell-muted {
  color: #000000;
  font-size: 14px;
}

.main {
  padding: 30px;
  overflow: hidden auto;
}

.security-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto 18px;
  border: 1px solid #f0a39b;
  border-radius: 8px;
  padding: 12px 14px;
  color: #7a271a;
  background: #fff4f2;
  box-shadow: 0 8px 24px rgba(180, 35, 24, 0.08);
}

.security-alert[hidden] {
  display: none;
}

.security-alert strong {
  margin-right: 8px;
}

.top-user {
  position: fixed;
  top: 18px;
  right: 24px;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 30px rgba(24, 39, 75, 0.12);
}

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

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

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.toolbar h2 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.1;
}

.eyebrow {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.status-pill,
.mini-meta {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.studio-layout {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.cutout-module {
  margin-bottom: 20px;
}

.module-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.cutout-module-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.cutout-output {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.compact-title {
  margin-bottom: 12px;
}

.compact-title h3 {
  font-size: 16px;
}

.panel,
.locked-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 18px;
}

.locked-panel {
  padding: 32px;
}

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

.section-title h3 {
  font-size: 18px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-soft);
  cursor: pointer;
}

.icon-button:hover {
  border-color: #a6b1c2;
  background: #eef4ff;
}

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

.upload-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.product-source {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.source-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.source-head h3 {
  margin: 0;
  font-size: 16px;
}

.source-head p,
.compact-source-head span {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

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

.file-action {
  position: relative;
  overflow: hidden;
}

.file-action input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.product-input-list,
.mini-list {
  display: grid;
  gap: 8px;
}

.mini-list {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

.mini-list span,
.empty-inline {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--muted);
  background: #ffffff;
  font-size: 12px;
}

.product-chip {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #ffffff;
}

.product-chip img {
  width: 54px;
  height: 54px;
  object-fit: contain;
  border-radius: 6px;
  background:
    linear-gradient(45deg, #d8dee8 25%, transparent 25%),
    linear-gradient(-45deg, #d8dee8 25%, transparent 25%),
    #ffffff;
  background-size: 12px 12px;
}

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

.product-chip strong {
  font-size: 13px;
}

.product-chip span {
  color: var(--muted);
  font-size: 12px;
}

.cutout-picker {
  display: grid;
  gap: 8px;
}

.compact-source-head {
  align-items: center;
}

.cutout-choice-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

.cutout-choice {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
  background: #ffffff;
  cursor: pointer;
  text-align: left;
}

.cutout-choice.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 92, 211, 0.12);
}

.cutout-choice img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 6px;
  background:
    linear-gradient(45deg, #d8dee8 25%, transparent 25%),
    linear-gradient(-45deg, #d8dee8 25%, transparent 25%),
    #ffffff;
  background-size: 12px 12px;
}

.cutout-choice span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 164px;
  overflow: hidden;
  border: 1px dashed #a6b1c2;
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(23, 92, 211, 0.06) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(23, 92, 211, 0.06) 25%, transparent 25%),
    #fbfcfe;
  background-size: 18px 18px;
  cursor: pointer;
}

.upload-zone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.upload-zone img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.upload-zone.has-image img {
  opacity: 1;
  background: #ffffff;
}

.single-upload {
  min-height: 260px;
}

.single-upload.has-image img {
  background:
    linear-gradient(45deg, #d8dee8 25%, transparent 25%),
    linear-gradient(-45deg, #d8dee8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8dee8 75%),
    linear-gradient(-45deg, transparent 75%, #d8dee8 75%),
    #ffffff;
  background-position:
    0 0,
    0 10px,
    10px -10px,
    -10px 0;
  background-size: 20px 20px;
}

.upload-copy {
  z-index: 1;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  font-weight: 700;
}

.upload-zone small {
  z-index: 1;
  color: var(--muted);
}

.field {
  display: grid;
  gap: 8px;
}

.field span,
.score-line label,
.prompt-box span {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  outline: 0;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  background: #ffffff;
}

.field.dark-field span {
  color: rgba(255, 255, 255, 0.72);
}

.field.dark-field input {
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
  background: #1f2937;
}

.field textarea {
  resize: vertical;
  min-height: 86px;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.dark-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 92, 211, 0.14);
}

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

.prompt-box {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.prompt-box > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.prompt-box p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  text-decoration: none;
}

.primary-action {
  border: 0;
  color: #ffffff;
  background: var(--primary);
  font-weight: 800;
}

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

.primary-action.compact {
  min-height: 42px;
}

.secondary-action {
  border: 1px solid var(--line);
  color: var(--text);
  background: #ffffff;
}

.secondary-action:hover {
  border-color: #a6b1c2;
  background: #f4f7fb;
}

.compact-action {
  min-height: 38px;
  padding: 0 12px;
  white-space: nowrap;
}

.output-panel {
  min-height: 640px;
}

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

.output-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.output-card canvas,
.output-card img {
  display: block;
  width: 100%;
  aspect-ratio: var(--output-ratio, 1 / 1);
  object-fit: cover;
  background: #f2f4f7;
}

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

.empty-output {
  display: grid;
  place-items: center;
  min-height: 460px;
  border: 1px dashed #a6b1c2;
  border-radius: 8px;
  background: #fbfcfe;
  color: var(--muted);
}

.empty-frame {
  width: min(58%, 320px);
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.14), transparent),
    linear-gradient(45deg, transparent 48%, rgba(23, 92, 211, 0.18) 50%, transparent 52%),
    #f6f8fb;
}

.cutout-preview {
  display: grid;
  min-height: 300px;
}

.transparent-stage {
  display: grid;
  place-items: center;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, #d8dee8 25%, transparent 25%),
    linear-gradient(-45deg, #d8dee8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8dee8 75%),
    linear-gradient(-45deg, transparent 75%, #d8dee8 75%),
    #ffffff;
  background-position:
    0 0,
    0 12px,
    12px -12px,
    -12px 0;
  background-size: 24px 24px;
}

.transparent-stage img {
  width: 100%;
  max-height: 430px;
  object-fit: contain;
  padding: 18px;
}

.transparent-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  align-items: center;
}

.transparent-grid img {
  max-height: 260px;
}

.cutout-library {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.library-title {
  margin-bottom: 0;
}

.cutout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.cutout-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.cutout-card:hover {
  border-color: var(--primary);
  background: #eef4ff;
}

.cutout-card img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  border-radius: 6px;
  background:
    linear-gradient(45deg, #d8dee8 25%, transparent 25%),
    linear-gradient(-45deg, #d8dee8 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d8dee8 75%),
    linear-gradient(-45deg, transparent 75%, #d8dee8 75%),
    #ffffff;
  background-position:
    0 0,
    0 8px,
    8px -8px,
    -8px 0;
  background-size: 16px 16px;
}

.cutout-card span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-empty {
  min-height: 300px;
}

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

.score-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#scoreValue {
  display: grid;
  place-items: center;
  width: 38px;
  height: 30px;
  border-radius: 8px;
  background: #ecfdf3;
  color: #027a48;
  font-weight: 800;
}

input[type="range"] {
  accent-color: var(--primary);
}

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

.suggestion {
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  background: #f0fdfa;
  color: #134e4a;
  line-height: 1.55;
}

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

.cutout-history-block {
  border-top: 1px solid var(--line);
  padding: 14px 16px 16px;
}

.cutout-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.cutout-history-heading h4,
.cutout-history-heading p {
  margin: 0;
}

.cutout-history-heading p,
.cutout-history-controls > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.cutout-history-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.cutout-history-list {
  display: grid;
  gap: 8px;
}

.cutout-history-item {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: var(--surface);
}

.cutout-history-media {
  display: grid;
  grid-template-columns: 72px 20px 72px;
  align-items: center;
  justify-content: start;
  gap: 4px;
}

.cutout-history-media img,
.cutout-history-media > span {
  width: 72px;
  height: 64px;
  object-fit: contain;
  border: 1px solid var(--line);
  background: #eef1f5;
}

.cutout-history-media img {
  cursor: zoom-in;
}

.cutout-history-media > span {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.cutout-history-media b {
  color: var(--muted);
  text-align: center;
}

.cutout-history-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.cutout-history-copy small {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cutout-history-copy .error-text,
.cutout-history-status.is-failed {
  color: #b42318;
}

.cutout-history-empty {
  border: 1px dashed var(--line);
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.record-item {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
}

.production-record {
  align-items: start;
}

.record-thumb {
  width: 92px;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  object-fit: cover;
  background: #eef1f5;
}

.record-status-placeholder {
  display: grid;
  place-items: center;
  padding: 8px;
  color: #526071;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  border: 1px solid var(--line);
}

.record-status-placeholder.record-status-failed,
.record-status-placeholder.record-status-error {
  color: #b42318;
  background: #fff1f0;
  border-color: #f3b6b2;
}

.record-status-placeholder.record-status-queued,
.record-status-placeholder.record-status-running {
  color: #175cd3;
  background: #eff6ff;
  border-color: #b2ccff;
}

.record-main h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.record-main p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.record-score {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 8px;
  background: #eef4ff;
  color: var(--primary);
  font-size: 20px;
  font-weight: 900;
}

.record-detail {
  grid-column: 1 / -1;
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.record-detail[hidden] {
  display: none;
}

.record-media {
  display: grid;
  gap: 14px;
}

.record-media-section {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.record-media-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.record-media-section h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 14px;
}

.record-media-section h4 span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  color: var(--primary-dark);
  background: #eaf2ff;
  font-size: 11px;
}

.record-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.record-images img {
  width: 100%;
  aspect-ratio: var(--output-ratio, 1 / 1);
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef1f5;
}

.record-input-media .record-images,
.record-reference-media .record-images {
  grid-template-columns: repeat(auto-fill, minmax(110px, 150px));
}

.record-input-media .record-images img,
.record-reference-media .record-images img {
  aspect-ratio: 1 / 1;
  object-fit: contain;
}

.record-empty-result {
  min-height: 72px;
  display: grid;
  place-items: center;
  padding: 12px;
  border: 1px dashed var(--line);
  color: var(--muted);
  background: #f8fafc;
}

.record-download-button {
  width: 100%;
  margin-top: 6px;
}

.record-meta {
  display: grid;
  gap: 10px;
  margin: 0;
}

.record-meta div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface-soft);
}

.record-meta dt,
.record-meta dd {
  margin: 0;
  line-height: 1.55;
}

.record-meta dt {
  color: #344054;
  font-weight: 800;
}

.record-meta dd {
  color: var(--muted);
  word-break: break-word;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  max-width: 1120px;
  margin: 0 auto;
}

.admin-bottom-section {
  border-top: 2px solid #c8d3e1;
  margin-top: 28px;
  padding-top: 28px;
}

#usersView .admin-grid {
  max-width: none;
}

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

.employee-search {
  width: min(560px, 100%);
}

.employee-search input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: var(--surface);
}

.employee-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.employee-table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  background: var(--surface);
}

.employee-table th,
.employee-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

.employee-table th:last-child,
.employee-table td:last-child {
  border-right: 0;
}

.employee-table tr:last-child td {
  border-bottom: 0;
}

.employee-table th {
  color: #344054;
  background: var(--surface-soft);
  white-space: nowrap;
}

.employee-table td small {
  display: block;
  margin-top: 4px;
}

.primary-account-note {
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
}

.employee-permission-summary {
  display: block;
  max-width: 240px;
  color: #344054;
  line-height: 1.45;
}

.employee-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
}

.employee-status.enabled {
  border-color: #a6f4c5;
  color: #067647;
  background: #ecfdf3;
}

.employee-status.disabled {
  border-color: #fda29b;
  color: var(--danger);
  background: #fef3f2;
}

.employee-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.table-action {
  border: 0;
  padding: 5px 6px;
  color: var(--primary);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.table-action:hover:not(:disabled) {
  text-decoration: underline;
}

.table-action:disabled {
  color: #98a2b3;
  cursor: not-allowed;
}

.danger-text {
  color: var(--danger);
}

.success-text {
  color: #067647;
}

.employee-table-footer {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.54);
}

.dialog-overlay[hidden] {
  display: none;
}

.dialog-card {
  width: min(620px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  background: var(--surface);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.28);
}

.dialog-card-small {
  width: min(480px, 100%);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.dialog-head h3,
.dialog-head p {
  margin: 0;
}

.dialog-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

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

.dialog-full-field {
  grid-column: 1 / -1;
}

.dialog-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.permission-dialog-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface-soft);
}

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

.login-records-panel {
  display: grid;
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
}

.login-record-filters {
  display: grid;
  grid-template-columns: minmax(200px, 1.5fr) minmax(160px, 1fr) minmax(160px, auto) auto;
  align-items: end;
  gap: 12px;
}

.login-record-summary {
  color: var(--muted);
  font-size: 13px;
}

.login-record-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.login-record-table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
  background: var(--surface);
}

.login-record-table th,
.login-record-table td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.login-record-table th {
  color: #344054;
  background: var(--surface-soft);
  white-space: nowrap;
}

.login-record-table tr:last-child td {
  border-bottom: 0;
}

.login-record-table td small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.login-record-table code {
  color: var(--text);
  font-family: Consolas, "Microsoft YaHei", monospace;
}

.login-result-badge,
.login-risk-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.login-result-badge.success,
.login-risk-badge.normal {
  border-color: #a6f4c5;
  color: #067647;
  background: #ecfdf3;
}

.login-result-badge.failed,
.login-risk-badge.abnormal {
  border-color: #fda29b;
  color: var(--danger);
  background: #fef3f2;
}

.login-device {
  max-width: 360px;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.login-record-empty {
  padding: 32px !important;
  color: var(--muted);
  text-align: center !important;
}

.permission-check {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  color: var(--text);
  font-size: 13px;
}

.permission-check input {
  width: 18px;
  height: 18px;
}

.delete-account {
  color: var(--danger);
}

.admin-grid > .panel {
  width: 100%;
}

.settings-panel {
  grid-column: auto;
}

.admin-wide-field {
  margin-bottom: 14px;
}

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

.admin-section-fold {
  padding: 0;
  overflow: hidden;
}

.admin-section-fold > summary {
  display: grid;
  grid-template-columns: minmax(160px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 58px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  background: var(--surface);
}

.admin-section-fold > summary::-webkit-details-marker,
.config-entry-fold > summary::-webkit-details-marker {
  display: none;
}

.admin-section-fold > summary::after,
.config-entry-fold > summary::after {
  content: "+";
  justify-self: end;
  color: var(--primary);
  font-size: 22px;
  line-height: 1;
}

.admin-section-fold[open] > summary::after,
.config-entry-fold[open] > summary::after {
  content: "−";
}

.admin-section-fold > summary > span {
  color: var(--muted);
  font-size: 13px;
}

.admin-section-body {
  border-top: 1px solid var(--line);
  padding: 16px 18px 18px;
}

.admin-section-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.config-item {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface-soft);
}

.config-entry-fold {
  display: block;
  padding: 0;
  overflow: hidden;
}

.config-entry-fold > summary {
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.config-entry-fold > summary span {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.config-entry-body {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 12px;
}

.reference-input-cell {
  position: relative;
  height: 100%;
}

.reference-library-button {
  position: absolute;
  right: 5px;
  bottom: 5px;
  z-index: 2;
  border: 1px solid #84adff;
  border-radius: 6px;
  padding: 3px 7px;
  color: var(--primary-dark);
  background: #eff6ff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

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

.reference-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 0.8fr)) minmax(220px, 1.4fr);
  gap: 12px;
}

.reference-summary {
  color: var(--muted);
  font-size: 13px;
}

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

.reference-card {
  display: grid;
  grid-template-rows: 180px auto auto;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}

.reference-card > img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: #eef1f5;
  cursor: zoom-in;
}

.reference-card-body {
  min-width: 0;
  padding: 11px 12px 8px;
}

.reference-card-body strong,
.reference-card-body p,
.reference-card-body small {
  display: block;
  overflow: hidden;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reference-card-body p,
.reference-card-body small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.reference-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 9px 12px;
}

.reference-empty {
  grid-column: 1 / -1;
  min-height: 180px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  color: var(--muted);
  background: var(--surface-soft);
}

.reference-admin-total {
  margin-bottom: 12px;
  font-weight: 800;
}

.reference-summary-group {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.reference-summary-group div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.reference-summary-group span {
  border: 1px solid #c7d7ee;
  border-radius: 999px;
  padding: 3px 8px;
  color: #344054;
  background: #f8fafc;
  font-size: 12px;
}

.config-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.config-head input {
  min-width: 0;
}

.delete-button {
  border-color: #fecdca;
  color: var(--danger);
  background: #fffbfa;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 48px));
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  border-radius: 8px;
  padding: 12px 14px;
  background: #111827;
  color: #ffffff;
  box-shadow: var(--shadow);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.preview-open {
  overflow: hidden;
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
}

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

.image-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.72);
}

.image-preview-dialog {
  position: absolute;
  inset: 28px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  grid-template-rows: minmax(0, 1fr) auto;
  place-items: center;
  gap: 10px;
}

.image-preview-img {
  grid-column: 2;
  grid-row: 1;
  max-width: 100%;
  max-height: calc(100vh - 104px);
  object-fit: contain;
  background:
    linear-gradient(45deg, #d8dee8 25%, transparent 25%),
    linear-gradient(-45deg, #d8dee8 25%, transparent 25%),
    #ffffff;
  background-size: 18px 18px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
}

.image-preview-img.is-changing {
  animation: preview-image-in 0.2s ease-out;
}

@keyframes preview-image-in {
  from { opacity: 0.35; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

.image-preview-caption {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #ffffff;
}

.image-preview-title {
  max-width: min(720px, 92vw);
  color: #ffffff;
  font-size: 14px;
  text-align: center;
}

.image-preview-counter {
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  white-space: nowrap;
}

.image-preview-nav {
  display: grid;
  place-items: center;
  width: 46px;
  height: 56px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.72);
  color: #ffffff;
  font-size: 36px;
  cursor: pointer;
}

.image-preview-prev {
  grid-column: 1;
  grid-row: 1;
}

.image-preview-next {
  grid-column: 3;
  grid-row: 1;
}

.image-preview-close {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.8);
  color: #ffffff;
  font-size: 26px;
  cursor: pointer;
}

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

  .side {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 16px;
  }

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

  .auth-box {
    margin-top: 0;
  }

  .studio-layout,
  .cutout-module-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .main {
    padding: 18px;
  }

  .toolbar,
  .record-item {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar {
    display: grid;
  }

  .tabs,
  .upload-grid,
  .config-grid,
  .field-row,
  .login-record-filters,
  .reference-filters,
  .dialog-form-grid,
  .permission-dialog-list {
    grid-template-columns: 1fr;
  }

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

  .image-preview-dialog {
    inset: 18px 8px;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
  }

  .image-preview-nav {
    width: 40px;
    height: 48px;
  }

  .record-item {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .record-score,
  .compact-action {
    grid-column: 1 / -1;
    width: 100%;
    height: 42px;
  }

  .record-meta div {
    grid-template-columns: 1fr;
  }
}
