:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #687086;
  --line: rgba(33, 42, 68, 0.12);
  --glass: rgba(255, 255, 255, 0.72);
  --glass-strong: rgba(255, 255, 255, 0.88);
  --blue: #2677ff;
  --green: #26b36b;
  --orange: #ff8a1f;
  --pink: #ff4f8b;
  --violet: #7f5cff;
  --shadow: 0 18px 60px rgba(45, 58, 92, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Microsoft YaHei", sans-serif;
  cursor: default;
  caret-color: transparent;
  background:
    radial-gradient(circle at 8% 12%, rgba(38, 119, 255, 0.18), transparent 26rem),
    radial-gradient(circle at 88% 8%, rgba(255, 79, 139, 0.18), transparent 25rem),
    radial-gradient(circle at 78% 82%, rgba(38, 179, 107, 0.16), transparent 26rem),
    linear-gradient(135deg, #f6f9ff 0%, #fff8fb 52%, #f7fff9 100%);
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.56;
}

input,
textarea,
[contenteditable="true"] {
  cursor: text;
  caret-color: auto;
  -webkit-user-select: text;
  user-select: text;
}

select {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
  padding: 18px;
  gap: 16px;
  transition: grid-template-columns 180ms ease;
}

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

.sidebar,
.workspace,
.list-panel,
.editor-panel,
.wide-panel {
  border: 1px solid var(--line);
  background: var(--glass);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.3);
}

.sidebar {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  border-radius: 28px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  overflow: hidden;
  transition: padding 180ms ease, gap 180ms ease;
}

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

.brand-copy {
  min-width: 0;
}

.brand-copy h1,
.brand-copy p,
.nav-item strong,
.import-panel,
.status-panel div {
  transition: opacity 140ms ease, transform 140ms ease;
}

.brand-mark {
  width: 54px;
  height: 54px;
  min-width: 54px;
  min-height: 54px;
  border: 0;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  font-size: 25px;
  line-height: 1;
  background: linear-gradient(145deg, #2677ff, #7f5cff 48%, #ff4f8b);
  box-shadow: 0 12px 28px rgba(38, 119, 255, 0.28);
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.brand-mark:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(38, 119, 255, 0.32);
}

.brand-mark:focus-visible {
  outline: 3px solid rgba(38, 119, 255, 0.26);
  outline-offset: 3px;
}

.brand h1,
.topbar h2,
.panel-head h3,
.editor-title h3,
.empty-state h3 {
  margin: 0;
}

.brand h1 {
  font-size: 19px;
}

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

.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 11px 12px;
  color: var(--muted);
  background: transparent;
  min-width: 0;
}

.nav-item span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  border: 1px solid rgba(36, 48, 71, 0.10);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: none;
}

.nav-item.active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5), 0 10px 24px rgba(50, 64, 98, 0.12);
}

.nav-item.active span {
  border-color: rgba(38, 119, 255, 0.18);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: none;
}

.sidebar-panel,
.status-panel {
  border-radius: 20px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid rgba(255, 255, 255, 0.7);
}

.field-label,
label span {
  display: block;
  margin-bottom: 7px;
  color: #536078;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(35, 44, 70, 0.13);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(38, 119, 255, 0.58);
  box-shadow: 0 0 0 4px rgba(38, 119, 255, 0.13);
}

.select-shell {
  position: relative;
  width: 100%;
}

.native-select {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  pointer-events: none;
}

.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(35, 44, 70, 0.13);
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 255, 255, 0.72)),
    rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
  font-weight: 700;
}

.custom-select-trigger:focus-visible {
  border-color: rgba(38, 119, 255, 0.58);
  box-shadow: 0 0 0 4px rgba(38, 119, 255, 0.13);
  outline: none;
}

.custom-select-arrow {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 9px;
  color: var(--blue);
  background: rgba(38, 119, 255, 0.10);
  transition: transform 150ms ease;
}

.custom-options {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: grid;
  gap: 4px;
  max-height: 310px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-radius: 18px;
  padding: 7px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 22px 54px rgba(45, 58, 92, 0.20);
  backdrop-filter: blur(18px) saturate(1.25);
  opacity: 0;
  transform: translateY(-4px) scale(0.98);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.custom-select.open {
  z-index: 35;
}

.custom-select.open .custom-options {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.custom-select.open .custom-select-arrow {
  transform: rotate(180deg);
}

.custom-option {
  width: 100%;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-radius: 12px;
  padding: 8px 10px;
  color: var(--ink);
  background: transparent;
  font-weight: 700;
  text-align: left;
}

.custom-option strong {
  opacity: 0;
  color: white;
  font-size: 13px;
}

.custom-option:hover {
  background: rgba(38, 119, 255, 0.10);
}

.custom-option.active {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  box-shadow: 0 10px 22px rgba(38, 119, 255, 0.20);
}

.custom-option.active span,
.custom-option.active strong {
  color: white;
}

.custom-option.active strong {
  opacity: 1;
}

.custom-option.active:hover {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--violet));
}

.sidebar-panel input,
.sidebar-panel select,
.sidebar-panel .select-shell {
  margin-bottom: 12px;
}

.primary-btn,
.success-btn,
.warning-btn,
.secondary-btn,
.danger-btn,
.file-drop {
  min-height: 42px;
  border-radius: 14px;
  border: 0;
  padding: 10px 15px;
  font-weight: 800;
}

.panel-head .danger-btn,
.panel-head .secondary-btn,
.panel-head .primary-btn {
  min-height: 36px;
  padding: 7px 11px;
  white-space: nowrap;
}

.primary-btn {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  box-shadow: 0 12px 26px rgba(38, 119, 255, 0.24);
}

.success-btn,
#markTodoBtn {
  color: white;
  background: linear-gradient(135deg, var(--green), #4bd985);
  border: 0;
  box-shadow: 0 12px 26px rgba(38, 179, 107, 0.24);
}

.warning-btn {
  color: white;
  background: linear-gradient(135deg, var(--orange), #ffb33c);
  border: 0;
  box-shadow: 0 12px 26px rgba(255, 138, 31, 0.24);
}

.secondary-btn,
.danger-btn,
.file-drop {
  color: #243047;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(36, 48, 71, 0.1);
}

.danger-btn {
  color: #9a2450;
  background: rgba(255, 227, 239, 0.82);
  border-color: rgba(255, 79, 139, 0.24);
}

.full {
  width: 100%;
}

.file-drop {
  display: grid;
  place-items: center;
  margin-top: 10px;
  text-align: center;
}

.import-panel .secondary-btn {
  margin-top: 10px;
}

.import-panel .project-reset-btn {
  margin-top: 10px;
  min-height: 38px;
}

.file-drop.compact {
  margin-top: 0;
  min-width: 180px;
}

.file-drop input {
  display: none;
}

.status-panel {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.status-panel small {
  color: var(--muted);
}

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

.app-shell.sidebar-collapsed .sidebar {
  padding: 14px;
  gap: 16px;
  align-items: center;
}

.app-shell.sidebar-collapsed .brand {
  flex-direction: column;
  gap: 10px;
}

.app-shell.sidebar-collapsed .brand-copy,
.app-shell.sidebar-collapsed .nav-item strong,
.app-shell.sidebar-collapsed .import-panel,
.app-shell.sidebar-collapsed .status-panel div {
  display: none;
}

.app-shell.sidebar-collapsed .nav {
  width: 100%;
}

.app-shell.sidebar-collapsed .nav-item {
  justify-content: center;
  gap: 0;
  padding: 12px;
}

.app-shell.sidebar-collapsed .nav-item span {
  width: 34px;
  height: 34px;
}

.app-shell.sidebar-collapsed .status-panel {
  width: 54px;
  height: 54px;
  margin-top: auto;
  justify-content: center;
  padding: 0;
  border-radius: 18px;
}

.pulse {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(38, 179, 107, 0.14);
}

.workspace {
  container-type: inline-size;
  border-radius: 34px;
  padding: 22px;
  overflow: hidden;
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(190px, max-content) minmax(460px, 1fr) minmax(360px, 408px);
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
}

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

.topbar h2 {
  font-size: 30px;
}

.global-filter-bar {
  display: grid;
  grid-template-columns: minmax(142px, 0.8fr) minmax(180px, 1fr) minmax(170px, 0.95fr);
  gap: 10px;
  align-items: end;
  min-width: 0;
}

.filter-field {
  display: block;
  min-width: 0;
}

.filter-field span {
  display: block;
  margin-bottom: 6px;
  color: #536078;
  font-size: 12px;
  font-weight: 800;
}

.filter-field input,
.filter-field .custom-select-trigger {
  height: 42px;
  min-height: 42px;
  border-color: rgba(35, 44, 70, 0.11);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.filter-field input {
  padding: 9px 13px;
}

.filter-field .custom-select-trigger {
  padding: 8px 12px;
}

.filter-field .select-shell,
.filter-field .custom-select {
  min-width: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  justify-self: end;
  width: min(100%, 408px);
}

.stat-card {
  min-width: 0;
  border-radius: 20px;
  padding: 12px 13px;
  color: white;
  box-shadow: 0 12px 28px rgba(45, 58, 92, 0.14);
}

.stat-card small {
  opacity: 0.86;
}

.stat-card strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

@container (max-width: 1060px) {
  .topbar {
    grid-template-columns: minmax(170px, max-content) minmax(0, 1fr);
  }

  .stats-grid {
    grid-column: 1 / -1;
    justify-self: stretch;
    width: 100%;
    grid-template-columns: repeat(4, minmax(92px, 1fr));
  }

  .stat-card {
    border-radius: 18px;
    padding: 10px 12px;
  }
}

@container (max-width: 720px) {
  .topbar {
    grid-template-columns: 1fr;
  }

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

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

.accent-blue {
  background: linear-gradient(135deg, #2677ff, #69a6ff);
}

.accent-orange {
  background: linear-gradient(135deg, #ff8a1f, #ffbd4a);
}

.accent-green {
  background: linear-gradient(135deg, #26b36b, #73d66d);
}

.accent-pink {
  background: linear-gradient(135deg, #ff4f8b, #f776d8);
}

.empty-table {
  padding: 26px 14px;
  color: var(--muted);
  text-align: center;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.cards-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  height: calc(100vh - 184px);
  min-height: 620px;
}

.list-panel,
.editor-panel,
.wide-panel {
  border-radius: 26px;
}

.list-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.list-panel .panel-head {
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
}

.list-panel .panel-head h3 {
  flex: 0 0 auto;
  white-space: nowrap;
  writing-mode: horizontal-tb;
}

.list-panel .panel-actions {
  flex: 1 1 210px;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.card-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 12px;
  scrollbar-gutter: stable;
  cursor: default;
  caret-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.task-center {
  margin: 10px 12px 0;
  border: 1px solid rgba(36, 48, 71, 0.1);
  border-radius: 16px;
  padding: 11px;
  background: rgba(255, 255, 255, 0.72);
  caret-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.task-center-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.task-center-head strong {
  display: block;
  color: #243047;
  font-size: 14px;
  font-weight: 900;
}

.task-center-head span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.task-concurrency {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.task-concurrency label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.task-concurrency input {
  width: 44px;
  min-height: 30px;
  border: 1px solid rgba(36, 48, 71, 0.12);
  border-radius: 10px;
  padding: 4px 6px;
  text-align: center;
  font-weight: 850;
  background: rgba(255, 255, 255, 0.86);
}

.task-status-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 10px;
}

.task-status-grid span {
  display: grid;
  place-items: center;
  min-height: 50px;
  border: 1px solid rgba(36, 48, 71, 0.08);
  border-radius: 12px;
  background: rgba(248, 250, 255, 0.84);
}

.task-status-grid small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.task-status-grid b {
  color: #243047;
  font-size: 18px;
  font-weight: 900;
}

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

.task-actions button {
  min-height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(36, 48, 71, 0.10);
  padding: 6px 8px;
  color: #2a3650;
  background: rgba(248, 250, 255, 0.86);
  box-shadow: 0 8px 18px rgba(45, 58, 92, 0.08);
  font-size: 12px;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease, background 160ms ease;
}

.task-actions button:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(45, 58, 92, 0.12);
}

.task-actions #continueRecognitionBtn {
  color: #1f5fc8;
  background: linear-gradient(135deg, rgba(38, 119, 255, 0.17), rgba(127, 92, 255, 0.12));
  border-color: rgba(38, 119, 255, 0.24);
}

.task-actions #pauseRecognitionBtn {
  color: #536078;
  background: linear-gradient(135deg, rgba(104, 112, 134, 0.15), rgba(143, 152, 174, 0.10));
  border-color: rgba(104, 112, 134, 0.22);
}

.task-actions #pauseRecognitionBtn:disabled {
  color: #7a8397;
  background: linear-gradient(135deg, rgba(104, 112, 134, 0.12), rgba(255, 255, 255, 0.34));
  border-color: rgba(104, 112, 134, 0.16);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 1;
}

.task-actions #retryFailedBtn {
  color: #a52a52;
  background: linear-gradient(135deg, rgba(255, 79, 139, 0.17), rgba(217, 47, 95, 0.10));
  border-color: rgba(217, 47, 95, 0.24);
}

.task-actions #clearCardsBtn {
  color: #9a5c07;
  background: linear-gradient(135deg, rgba(255, 138, 31, 0.18), rgba(255, 179, 60, 0.12));
  border-color: rgba(255, 138, 31, 0.25);
}

.task-actions #saveProjectSnapshotBtn {
  color: #1f7b4f;
  background: linear-gradient(135deg, rgba(38, 179, 107, 0.17), rgba(75, 217, 133, 0.12));
  border-color: rgba(38, 179, 107, 0.25);
}

.task-actions .task-blue-btn {
  color: #2164bd;
  background: linear-gradient(135deg, rgba(38, 119, 255, 0.15), rgba(72, 197, 255, 0.13));
  border-color: rgba(38, 119, 255, 0.24);
}

.recognition-progress {
  margin: 10px 12px 0;
  border: 1px solid rgba(38, 119, 255, 0.18);
  border-radius: 16px;
  padding: 10px 12px;
  color: #243047;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 10px 24px rgba(38, 119, 255, 0.08);
}

.recognition-progress > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
}

.recognition-progress strong {
  font-weight: 900;
}

.recognition-progress span {
  color: var(--muted);
  font-weight: 800;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(38, 119, 255, 0.12);
}

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

.recognition-progress.has-error {
  border-color: rgba(255, 138, 31, 0.3);
  background: rgba(255, 247, 235, 0.84);
}

.recognition-progress.has-error .progress-track span {
  background: linear-gradient(90deg, var(--orange), var(--pink));
}

.gap-alert {
  margin: 12px 12px 0;
  border: 1px solid rgba(255, 79, 139, 0.28);
  border-radius: 14px;
  min-height: 40px;
  padding: 9px 12px;
  color: #9a2450;
  background: rgba(255, 227, 239, 0.76);
  font-size: 13px;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: default;
  caret-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.gap-alert strong,
.gap-alert b {
  line-height: inherit;
}

.wide-panel > .gap-alert {
  margin: 16px 18px 0;
}

.card-item {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 13px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, 0.58);
  cursor: pointer;
  caret-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.card-item * {
  cursor: inherit;
}

.card-item.active {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(38, 119, 255, 0.28);
  box-shadow: 0 12px 30px rgba(38, 119, 255, 0.12);
}

.card-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-top-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.serial {
  font-size: 19px;
  font-weight: 850;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 10px;
  color: #8a3a00;
  background: #fff0d8;
  font-size: 12px;
  font-weight: 800;
}

.badge.ok {
  color: #07663d;
  background: #dff8ea;
}

.badge.warn {
  color: #9a2450;
  background: #ffe3ef;
}

.badge.pending {
  color: #3451a4;
  background: #e6edff;
}

.badge.running {
  color: #8a3a00;
  background: #fff0d8;
}

.badge.done {
  color: #27525e;
  background: #e5f8ff;
}

.badge.failed {
  color: #9a2450;
  background: #ffe3ef;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.delete-card-btn {
  flex: 0 0 auto;
  min-height: 26px;
  border: 0;
  border-radius: 10px;
  padding: 4px 9px;
  color: #9a2450;
  background: rgba(255, 227, 239, 0.9);
  font-size: 12px;
  font-weight: 800;
}

.editor-panel {
  overflow: hidden;
  min-width: 0;
}

.empty-state {
  height: 100%;
  display: grid;
  place-items: center;
  align-content: center;
  padding: 32px;
  text-align: center;
}

.empty-icon {
  width: 80px;
  height: 80px;
  margin-bottom: 18px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  color: white;
  font-size: 36px;
  background: linear-gradient(135deg, var(--green), var(--blue));
}

.editor {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(300px, 46%) minmax(380px, 1fr);
}

.image-stage {
  position: relative;
  overflow: auto;
  padding: 18px;
  background: rgba(20, 28, 45, 0.84);
}

.stage-tabs {
  position: sticky;
  z-index: 2;
  top: 0;
  display: inline-flex;
  gap: 5px;
  padding: 5px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
}

.stage-tab {
  min-height: 32px;
  border: 0;
  border-radius: 10px;
  padding: 6px 12px;
  color: rgba(255, 255, 255, 0.76);
  background: transparent;
  font-weight: 800;
}

.stage-tab.active {
  color: #111827;
  background: white;
}

.card-image-frame {
  position: relative;
  width: min(100%, 660px);
  margin: 16px auto 0;
}

.image-stage img {
  display: block;
  width: 100%;
  margin: 0;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.recognition-frame {
  position: absolute;
  inset: 8px;
  border: 3px solid rgba(38, 179, 107, 0.96);
  border-radius: 14px;
  pointer-events: none;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.58),
    inset 0 0 0 1px rgba(255, 255, 255, 0.36),
    0 0 28px rgba(38, 179, 107, 0.34);
}

.card-image-frame.corrected img {
  outline: 2px solid rgba(38, 179, 107, 0.34);
  outline-offset: 3px;
}

.recognition-frame span {
  position: absolute;
  top: -3px;
  left: -3px;
  border-radius: 12px 0 12px 0;
  padding: 7px 10px;
  color: white;
  background: rgba(22, 163, 74, 0.96);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.card-image-frame.uncorrected .recognition-frame {
  border-color: rgba(255, 138, 31, 0.96);
  border-style: dashed;
  background: rgba(255, 196, 87, 0.08);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.58),
    inset 0 0 0 1px rgba(255, 255, 255, 0.34),
    0 0 26px rgba(255, 138, 31, 0.28);
}

.card-image-frame.uncorrected .recognition-frame span {
  color: #4a2a00;
  background: rgba(255, 213, 120, 0.96);
}

.card-image-frame.corrected::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 14px;
  background:
    linear-gradient(to right, rgba(38, 179, 107, 0.18) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(38, 179, 107, 0.18) 1px, transparent 1px);
  background-size: 20% 20%;
  pointer-events: none;
}

.form-panel {
  overflow: auto;
  padding: 12px;
  background: rgba(255, 255, 255, 0.6);
  font-size: 13px;
}

.editor-title,
.actions,
.panel-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-panel .editor-title {
  gap: 8px;
}

.form-panel .editor-title .eyebrow {
  margin-top: 0;
  font-size: 11px;
  line-height: 1.1;
}

.form-panel .editor-title h3 {
  margin-top: 1px;
  font-size: 18px;
  line-height: 1.15;
}

.form-panel .badge {
  min-height: 22px;
  padding: 3px 8px;
  font-size: 11px;
}

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

.form-panel label span {
  margin-bottom: 4px;
  font-size: 12px;
  line-height: 1.1;
}

.form-panel input,
.form-panel textarea,
.form-panel .custom-select-trigger {
  min-height: 32px;
  border-radius: 10px;
  padding: 5px 8px;
}

.form-panel .custom-select-arrow {
  width: 21px;
  height: 21px;
  border-radius: 7px;
}

.form-panel textarea {
  min-height: 38px;
  line-height: 1.35;
  resize: vertical;
}

.process-table-wrap,
.table-scroll {
  overflow: auto;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.62);
}

.wide-panel > .table-scroll {
  margin: 10px 18px 18px;
}

.form-panel .process-table-wrap {
  border-radius: 12px;
}

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

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

.form-panel th,
.form-panel td {
  padding: 4px 6px;
}

th {
  color: #536078;
  font-size: 13px;
  background: rgba(255, 255, 255, 0.72);
}

.form-panel th {
  font-size: 12px;
  line-height: 1.15;
}

.process-table td:first-child {
  width: 62px;
}

.process-table td:nth-child(2),
.process-table td:nth-child(3) {
  width: 82px;
}

.process-table td strong {
  font-size: 13px;
  line-height: 1.1;
}

td input {
  min-height: 36px;
  padding: 7px 9px;
  border-radius: 11px;
}

.form-panel td input {
  min-height: 28px;
  padding: 3px 7px;
  border-radius: 8px;
}

.raw-text {
  max-width: 220px;
  color: var(--muted);
  font-size: 12px;
}

.form-panel .raw-text {
  max-width: 150px;
  overflow: hidden;
  color: #6a7286;
  font-size: 11px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notes-field {
  display: block;
  margin-top: 8px;
}

.actions {
  justify-content: flex-end;
  margin-top: 10px;
}

.form-panel .actions {
  gap: 8px;
  flex-wrap: wrap;
}

.form-panel .actions .primary-btn,
.form-panel .actions .success-btn,
.form-panel .actions .warning-btn,
.form-panel .actions .secondary-btn,
.form-panel .actions .danger-btn {
  min-height: 32px;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13px;
  white-space: nowrap;
}

.wide-panel {
  min-height: calc(100vh - 156px);
  overflow: hidden;
}

.price-matrix-form {
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.price-table-scroll {
  margin: 10px 18px 18px;
}

.personnel-form {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

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

.personnel-toolbar strong,
.personnel-toolbar small {
  display: block;
}

.personnel-toolbar small {
  margin-top: 4px;
  color: var(--muted);
}

.compact-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.personnel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(235px, 1fr));
  gap: 10px;
}

.personnel-role-cell {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid rgba(102, 122, 170, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.66);
}

.personnel-role-cell span {
  font-size: 12px;
  color: var(--muted);
}

.personnel-role-cell input {
  min-height: 36px;
  font-size: 13px;
}

.personnel-table-scroll {
  margin: 10px 18px 18px;
}

.worker-chip-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

.worker-chip-strip .worker-badge {
  transform: scale(0.92);
}

.matrix-editor-scroll {
  overflow-x: auto;
  padding-bottom: 3px;
}

.price-editor-grid {
  display: grid;
  grid-template-columns: 160px repeat(12, 72px);
  grid-auto-columns: 72px;
  grid-auto-flow: column;
  gap: 8px;
  min-width: 1120px;
}

.matrix-product-cell,
.process-price-cell {
  display: block;
}

.process-price-cell input {
  text-align: right;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 220px));
  gap: 14px;
  padding: 18px;
}

.summary-strip div {
  border-radius: 20px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.7);
}

.summary-strip small {
  color: var(--muted);
}

.summary-strip strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.summary-mode-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(74px, 1fr));
  gap: 4px;
  min-height: 40px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.68);
}

.summary-mode-tabs button {
  min-height: 30px;
  border: 0;
  border-radius: 10px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.summary-mode-tabs button.active {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--green));
  box-shadow: 0 8px 20px rgba(38, 119, 255, 0.18);
}

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

.matrix-table {
  min-width: 1120px;
}

.matrix-table th,
.matrix-table td {
  padding: 8px 6px;
  white-space: nowrap;
}

.price-table-scroll .matrix-table th:first-child,
.price-table-scroll .matrix-table td:first-child {
  padding-left: 12px;
}

.price-table-scroll .matrix-table th:last-child,
.price-table-scroll .matrix-table td:last-child {
  padding-right: 12px;
}

.price-table-scroll .process-cell {
  min-width: 58px;
  text-align: center;
}

.price-table-scroll .matrix-table th:not(:first-child):not(:last-child) {
  text-align: center;
}

.price-table-scroll .editing-row {
  background: rgba(38, 119, 255, 0.045);
}

.price-table-scroll .inline-price-input {
  width: 64px;
  min-height: 30px;
  border: 1px solid rgba(126, 139, 166, 0.28);
  border-radius: 10px;
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  color: var(--text);
  outline: none;
}

.price-table-scroll .inline-price-input:focus {
  border-color: rgba(38, 119, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(38, 119, 255, 0.12);
}

.price-table-scroll .inline-product-input {
  width: 118px;
}

.price-table-scroll .inline-carton-input {
  width: 58px;
}

.price-row-actions {
  min-width: 188px;
}

.price-disabled,
.price-empty {
  display: inline-flex;
  width: 100%;
  justify-content: center;
  color: #7a8498;
  font-weight: 700;
}

.price-empty {
  color: #a3adbf;
}

.price-table-scroll .edit-price,
.price-table-scroll .delete-price-product,
.price-table-scroll .save-inline-price,
.price-table-scroll .cancel-inline-price {
  min-height: 34px;
  border-radius: 12px;
  padding: 7px 12px;
  border: 1px solid transparent;
  box-shadow: 0 8px 18px rgba(45, 58, 92, 0.10);
}

.price-table-scroll .edit-price {
  color: #1556d8;
  background: linear-gradient(135deg, rgba(38, 119, 255, 0.15), rgba(127, 92, 255, 0.12));
  border-color: rgba(38, 119, 255, 0.22);
}

.price-table-scroll .delete-price-product {
  color: #c51f5a;
  background: linear-gradient(135deg, rgba(255, 79, 139, 0.16), rgba(255, 138, 31, 0.12));
  border-color: rgba(255, 79, 139, 0.26);
}

.price-table-scroll .save-inline-price {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  border-color: rgba(38, 119, 255, 0.24);
}

.price-table-scroll .cancel-inline-price {
  color: #64708a;
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(126, 139, 166, 0.22);
}

.price-table-scroll .edit-price:hover {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--violet));
}

.price-table-scroll .delete-price-product:hover {
  color: white;
  background: linear-gradient(135deg, var(--pink), var(--orange));
}

.settings-panel {
  min-height: auto;
}

.settings-form {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.settings-card {
  display: block;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: 0 14px 32px rgba(45, 58, 92, 0.08);
}

.settings-bottom-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
}

.settings-bottom-row .settings-card {
  height: 100%;
}

.settings-section {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 260px);
  gap: 18px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.settings-section h4 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}

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

.ai-usage-strip {
  display: grid;
  grid-template-columns: minmax(130px, 0.75fr) minmax(150px, 0.9fr) minmax(220px, 1.35fr) auto;
  gap: 10px;
  align-items: stretch;
  margin-top: 14px;
}

.ai-usage-card {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(102, 122, 170, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.ai-usage-card small,
.ai-usage-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.ai-usage-card strong {
  display: block;
  overflow: hidden;
  margin: 3px 0;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-usage-card.wide strong {
  font-size: 14px;
}

#refreshAiUsageBtn {
  align-self: center;
  min-height: 38px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

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

.ai-strategy-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.ai-model-panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.ai-model-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255, 45, 85, 0.22);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 45, 85, 0.08), rgba(255, 255, 255, 0.62));
}

.ai-model-card.accent {
  border-color: rgba(52, 199, 89, 0.28);
  background: linear-gradient(135deg, rgba(52, 199, 89, 0.08), rgba(255, 255, 255, 0.62));
}

.ai-model-card h5 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 14px;
}

.official-model-choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.official-model-card {
  position: relative;
  display: grid;
  gap: 10px;
  min-height: 172px;
  padding: 15px;
  border: 1px solid rgba(102, 122, 170, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.62);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.official-model-card:hover {
  transform: translateY(-2px);
  border-color: rgba(38, 119, 255, 0.28);
}

.official-model-card.active {
  border-color: rgba(38, 119, 255, 0.42);
  background: linear-gradient(135deg, rgba(38, 119, 255, 0.12), rgba(255, 255, 255, 0.70));
  box-shadow: inset 0 0 0 1px rgba(38, 119, 255, 0.12);
}

.official-model-card input {
  position: absolute;
  top: 13px;
  right: 13px;
  width: 18px;
  height: 18px;
}

.official-model-card span {
  display: grid;
  gap: 6px;
  padding-right: 26px;
}

.official-model-card strong {
  color: var(--ink);
  font-size: 16px;
}

.official-model-card small,
.official-model-card i {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.45;
}

.official-model-card em,
.official-model-card b {
  justify-self: start;
  border-radius: 999px;
  padding: 5px 9px;
  color: #1556d8;
  background: rgba(38, 119, 255, 0.10);
  font-size: 12px;
  font-style: normal;
}

.official-model-card b {
  color: #137b49;
  background: rgba(38, 179, 107, 0.12);
}

.official-model-empty {
  grid-column: 1 / -1;
  border: 1px dashed rgba(102, 122, 170, 0.24);
  border-radius: 16px;
  padding: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.50);
}

.admin-panel {
  overflow: visible;
}

.admin-dashboard {
  display: grid;
  gap: 16px;
  padding: 18px;
}

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

.admin-stats article,
.admin-section,
.admin-model-card {
  border: 1px solid rgba(102, 122, 170, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.admin-stats article {
  display: grid;
  gap: 5px;
  min-height: 96px;
  padding: 14px;
}

.admin-stats small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.admin-stats strong {
  color: var(--blue);
  font-size: 30px;
}

.admin-section {
  padding: 14px;
  overflow: visible;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-title-row h4 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 18px;
}

.section-title-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

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

.admin-grid label span {
  display: block;
  margin-bottom: 7px;
  color: #536078;
  font-size: 12px;
  font-weight: 900;
}

.admin-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.admin-model-card .admin-actions {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid rgba(102, 122, 170, 0.12);
}

.admin-panel-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 10px 24px rgba(35, 47, 76, 0.06);
}

.admin-panel-tabs button {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 7px 14px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 900;
}

.admin-panel-tabs button.active {
  color: #1f55c8;
  border-color: rgba(38, 119, 255, 0.18);
  background: rgba(38, 119, 255, 0.12);
}

.admin-panel-section {
  display: none;
}

.admin-panel-section.active {
  display: block;
}

.admin-orders-table .soft {
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 10px;
}

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

.admin-model-card {
  padding: 14px;
  overflow: visible;
}

.admin-model-card .custom-select.open,
.admin-tenants-table .custom-select.open {
  z-index: 90;
}

.admin-model-card .custom-options,
.admin-tenants-table .custom-options {
  z-index: 90;
  max-height: 238px;
  min-width: 100%;
}

.admin-model-card .custom-option,
.admin-tenants-table .custom-option {
  min-height: 34px;
  font-size: 13px;
}

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

.admin-model-head strong {
  color: var(--ink);
}

.admin-model-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.ai-test-result {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.ai-test-summary,
.ai-test-row {
  border: 1px solid rgba(35, 49, 80, 0.10);
  border-radius: 10px;
  padding: 9px 10px;
  background: rgba(246, 248, 252, 0.76);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.ai-test-summary.ok,
.ai-test-row.ok {
  border-color: rgba(39, 191, 115, 0.22);
  background: rgba(39, 191, 115, 0.10);
  color: #17704a;
}

.ai-test-summary.failed,
.ai-test-row.failed {
  border-color: rgba(232, 92, 92, 0.22);
  background: rgba(232, 92, 92, 0.10);
  color: #9f3030;
}

.ai-test-summary.pending {
  border-color: rgba(255, 152, 31, 0.20);
  background: rgba(255, 152, 31, 0.10);
  color: #8a4d0a;
}

.ai-test-row {
  display: grid;
  gap: 3px;
}

.ai-test-row strong {
  color: var(--ink);
  font-size: 13px;
}

.ai-test-row span,
.ai-test-row em {
  font-style: normal;
  word-break: break-word;
}

.admin-tenants-table input,
.admin-tenants-table select {
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 10px;
}

.tenant-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 220px;
}

.tenant-admin-actions button {
  min-height: 30px;
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 12px;
}

.subscription-panel {
  overflow: hidden;
}

.subscription-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 18px;
  align-items: stretch;
  padding: 20px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(38, 119, 255, 0.1), rgba(38, 179, 107, 0.08)),
    rgba(255, 255, 255, 0.42);
}

.subscription-hero h3 {
  margin: 2px 0 8px;
  font-size: 26px;
}

.subscription-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.subscription-meter {
  display: grid;
  align-content: center;
  gap: 5px;
  min-height: 132px;
  padding: 18px;
  border: 1px solid rgba(38, 119, 255, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
}

.subscription-meter small,
.subscription-meter span,
.subscription-overview small,
.subscription-overview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.subscription-meter strong {
  color: var(--blue);
  font-size: 42px;
  line-height: 1;
}

.subscription-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 16px 18px 0;
}

.subscription-overview > div,
.recharge-panel,
.billing-history-panel {
  border: 1px solid rgba(102, 122, 170, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

.subscription-overview > div {
  display: grid;
  gap: 5px;
  min-height: 94px;
  padding: 14px;
}

.subscription-overview strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 20px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.plan-card {
  position: relative;
  overflow: hidden;
  min-height: 270px;
  padding: 18px;
  border: 1px solid rgba(102, 122, 170, 0.16);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.68);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.plan-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 18px 38px rgba(45, 58, 92, 0.14);
}

.plan-card.active {
  border-color: rgba(38, 119, 255, 0.38);
  box-shadow: inset 0 0 0 1px rgba(38, 119, 255, 0.16);
}

.plan-orbit {
  position: absolute;
  right: -38px;
  top: -42px;
  width: 128px;
  height: 128px;
  border-radius: 999px;
  opacity: 0.2;
  transition: transform 260ms ease;
}

.plan-card:hover .plan-orbit {
  transform: scale(1.18) rotate(10deg);
}

.plan-card.emerald .plan-orbit {
  background: var(--green);
}

.plan-card.violet .plan-orbit {
  background: var(--violet);
}

.plan-card.gold .plan-orbit {
  background: var(--orange);
}

.plan-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.plan-head b {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--blue);
  background: rgba(38, 119, 255, 0.1);
  font-size: 11px;
}

.plan-card > strong {
  position: relative;
  display: block;
  margin-top: 16px;
  color: var(--ink);
  font-size: 34px;
}

.plan-card p {
  position: relative;
  min-height: 42px;
  margin: 8px 0 14px;
  color: var(--muted);
  line-height: 1.55;
}

.plan-card ul {
  position: relative;
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.plan-card li {
  color: #536078;
  font-size: 13px;
}

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

.plan-card button {
  position: relative;
  width: 100%;
}

.recharge-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 16px;
  align-items: center;
  margin: 0 18px 18px;
  padding: 16px;
}

.recharge-panel h4 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 18px;
}

.recharge-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.recharge-controls {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.recharge-controls label span {
  display: block;
  margin-bottom: 7px;
  color: #536078;
  font-size: 12px;
  font-weight: 800;
}

.billing-history-panel {
  margin: 0 18px 18px;
  padding: 14px;
}

.manual-payment-panel {
  margin: 0 18px 18px;
  padding: 14px;
  border: 1px solid rgba(102, 122, 170, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
}

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

.manual-payment-card {
  display: grid;
  gap: 9px;
  min-height: 132px;
  padding: 14px;
  border: 1px solid rgba(38, 119, 255, 0.16);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.68);
}

.manual-payment-card small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.manual-payment-card div {
  display: grid;
  place-items: center;
  min-height: 72px;
  border: 1px dashed rgba(102, 122, 170, 0.22);
  border-radius: 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
  text-align: center;
  word-break: break-all;
}

.manual-payment-card img {
  max-width: 96px;
  max-height: 96px;
  border-radius: 10px;
  object-fit: contain;
}

.manual-payment-card.receiver {
  background: linear-gradient(135deg, rgba(38, 179, 107, 0.10), rgba(255, 255, 255, 0.62));
}

.manual-payment-card.receiver strong {
  align-self: center;
  color: var(--ink);
  font-size: 18px;
}

.manual-payment-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.order-status {
  display: inline-grid;
  min-width: 64px;
  place-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}

.order-status.pending {
  color: #9a5a00;
  background: rgba(255, 179, 90, 0.20);
}

.order-status.approved {
  color: #137b49;
  background: rgba(38, 179, 107, 0.16);
}

.order-status.rejected {
  color: #b2264d;
  background: rgba(255, 79, 139, 0.16);
}

.panel-head.compact {
  min-height: auto;
  padding: 0 0 12px;
  border-bottom: 0;
}

.ai-model-grid {
  grid-template-columns: repeat(2, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 0;
}

.settings-grid label,
.switch-row {
  min-width: 0;
}

.settings-grid span,
.switch-row span {
  display: block;
  margin-bottom: 7px;
  color: #536078;
  font-size: 12px;
  font-weight: 800;
}

.switch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.58);
}

.switch-row span {
  margin: 0;
  font-size: 14px;
}

.switch-row input {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  appearance: none;
  border: 0;
  border-radius: 999px;
  background: rgba(83, 96, 120, 0.18);
  box-shadow: inset 0 1px 3px rgba(30, 38, 58, 0.16);
  cursor: pointer;
  transition: background 160ms ease;
}

.switch-row input::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: white;
  box-shadow: 0 4px 10px rgba(30, 38, 58, 0.18);
  transition: transform 160ms ease;
}

.switch-row input:checked {
  background: linear-gradient(135deg, var(--green), var(--blue));
}

.switch-row input:checked::before {
  transform: translateX(20px);
}

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

.appearance-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(244, 247, 255, 0.76));
}

.brand-mark-preview {
  justify-self: end;
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  color: white;
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(145deg, #2677ff, #7f5cff 48%, #ff4f8b);
  box-shadow: 0 12px 28px rgba(38, 119, 255, 0.24);
}

.theme-setting {
  min-width: 0;
}

.theme-setting > span {
  display: block;
  margin-bottom: 7px;
  color: #536078;
  font-size: 13px;
  font-weight: 700;
}

.theme-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  min-height: 42px;
  border: 1px solid rgba(35, 44, 70, 0.13);
  border-radius: 14px;
  padding: 5px;
  background: rgba(255, 255, 255, 0.58);
}

.theme-segmented button {
  min-height: 30px;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.theme-segmented button.active {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  box-shadow: 0 8px 18px rgba(38, 119, 255, 0.22);
}

.account-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(246, 249, 255, 0.78));
}

.account-status-badge {
  justify-self: end;
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 14px;
  padding: 8px 14px;
  color: #1556d8;
  background: rgba(38, 119, 255, 0.12);
  border: 1px solid rgba(38, 119, 255, 0.20);
  font-size: 13px;
  font-weight: 900;
}

.account-grid {
  grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.account-actions {
  justify-content: flex-start;
}

.backup-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(238, 252, 247, 0.76));
}

.reset-card {
  border-color: rgba(255, 79, 139, 0.24);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.78), rgba(255, 237, 244, 0.78));
}

.backup-status-badge {
  justify-self: end;
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 14px;
  padding: 8px 14px;
  color: #087c5d;
  background: rgba(0, 196, 140, 0.12);
  border: 1px solid rgba(0, 196, 140, 0.22);
  font-size: 13px;
  font-weight: 900;
}

.reset-status-badge {
  justify-self: end;
  min-height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 14px;
  padding: 8px 14px;
  color: #b61e53;
  background: rgba(255, 79, 139, 0.12);
  border: 1px solid rgba(255, 79, 139, 0.22);
  font-size: 13px;
  font-weight: 900;
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.backup-note {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(102, 122, 170, 0.16);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  line-height: 1.55;
}

#restoreBackupBtn {
  color: #b61e53;
  border-color: rgba(255, 79, 139, 0.28);
  background: linear-gradient(135deg, rgba(255, 79, 139, 0.12), rgba(255, 138, 31, 0.10));
}

.process-cell {
  min-width: 64px;
}

.process-cell strong {
  display: block;
  color: var(--ink);
}

.process-cell small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.process-empty-cell {
  text-align: center;
}

.process-empty {
  display: inline-flex;
  width: 100%;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  color: #9aa4b8;
  font-weight: 800;
}

.summary-matrix .process-cell {
  min-width: 72px;
  text-align: center;
}

.summary-matrix .process-cell strong,
.summary-matrix .process-cell small {
  text-align: center;
}

.summary-matrix .summary-total-cell {
  text-align: center;
  font-weight: 800;
}

.records-table .process-cell {
  min-width: 66px;
  text-align: center;
}

.records-table th.process-cell {
  text-align: center;
}

.records-table td.process-cell {
  padding-left: 4px;
  padding-right: 4px;
}

.records-table td.process-cell .worker-badge,
.records-table td.process-cell .worker-empty {
  display: grid;
  margin: 0 auto;
}

.records-table .process-cell small {
  width: 28px;
  margin: 3px auto 0;
  text-align: center;
}

.summary-matrix th,
.summary-matrix td,
.records-table th,
.records-table td {
  padding-left: 7px;
  padding-right: 7px;
}

.summary-matrix th:first-child,
.summary-matrix td:first-child,
.records-table th:first-child,
.records-table td:first-child {
  padding-left: 12px;
}

.summary-matrix th:last-child,
.summary-matrix td:last-child,
.records-table th:last-child,
.records-table td:last-child {
  padding-right: 12px;
}

.worker-badge,
.worker-empty {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.worker-badge {
  color: hsl(var(--worker-hue), 76%, 24%);
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.9), transparent 34%),
    hsl(var(--worker-hue), 88%, 78%);
  border: 1px solid hsl(var(--worker-hue), 82%, 56%);
  box-shadow: 0 6px 16px hsla(var(--worker-hue), 74%, 44%, 0.22);
}

.worker-empty {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
}

.row-warn td {
  background: rgba(255, 227, 239, 0.46);
}

.mini-warn {
  display: inline-flex;
  margin-left: 8px;
  border-radius: 999px;
  padding: 2px 7px;
  color: #9a2450;
  background: #ffe3ef;
  font-size: 11px;
  font-weight: 800;
}

.learning-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  padding: 18px;
  max-height: calc(100vh - 230px);
  overflow: auto;
}

.learning-trainer {
  border-bottom: 1px solid var(--line);
  padding: 18px;
}

.trainer-tools {
  display: grid;
  grid-template-columns: 190px minmax(320px, 1fr) minmax(180px, 240px) 130px;
  gap: 12px;
  align-items: end;
}

.digit-picker-field {
  min-width: 0;
}

.digit-picker {
  display: grid;
  grid-template-columns: repeat(10, minmax(30px, 1fr));
  gap: 6px;
}

.digit-choice {
  min-height: 36px;
  border: 1px solid rgba(36, 48, 71, 0.1);
  border-radius: 12px;
  color: #243047;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.72)),
    rgba(255, 255, 255, 0.82);
  font-size: 17px;
  font-weight: 900;
}

.digit-choice.active {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--blue), var(--violet) 48%, var(--pink));
  box-shadow: 0 10px 22px rgba(38, 119, 255, 0.20);
}

.trainer-stage {
  margin-top: 16px;
}

.trainer-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: #536078;
  font-size: 13px;
  font-weight: 800;
}

.trainer-status strong {
  display: inline-grid;
  min-width: 30px;
  min-height: 30px;
  place-items: center;
  border-radius: 11px;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--pink));
}

.trainer-canvas-wrap {
  position: relative;
  width: min(100%, 860px);
  max-height: 640px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(20, 28, 45, 0.86);
  user-select: none;
  touch-action: none;
}

.trainer-canvas-wrap img {
  display: block;
  width: min(100%, 760px);
  height: auto;
  margin: 0 auto;
}

.selection-box {
  position: absolute;
  border: 2px solid var(--pink);
  background: rgba(255, 79, 139, 0.16);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.16);
  pointer-events: none;
}

.trainer-canvas-wrap.saving .selection-box {
  border-color: var(--green);
  background: rgba(38, 179, 107, 0.16);
}

.selection-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sample-marker {
  position: absolute;
  border: 2px solid rgba(38, 179, 107, 0.95);
  border-radius: 8px;
  background: rgba(38, 179, 107, 0.10);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.88);
}

.sample-marker span {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, var(--green), var(--blue));
  font-size: 13px;
  font-weight: 900;
}

.digit-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.66);
}

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

.digit-head strong {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: white;
  font-size: 26px;
  background: linear-gradient(135deg, var(--blue), var(--pink));
}

.digit-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.sample-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  align-content: start;
  gap: 7px;
  padding: 8px;
  max-height: 280px;
  overflow: auto;
}

.sample-tile {
  position: relative;
  margin: 0;
  border: 1px solid rgba(35, 44, 70, 0.1);
  border-radius: 12px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.78);
}

.sample-delete-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  z-index: 2;
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  color: white;
  background: rgba(154, 36, 80, 0.9);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.sample-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #fff;
}

.sample-tile figcaption {
  display: none;
  padding: 6px 7px 7px;
}

.sample-tile figcaption strong,
.sample-tile figcaption span,
.sample-tile figcaption small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sample-tile figcaption strong {
  font-size: 12px;
}

.sample-tile figcaption span,
.sample-tile figcaption small,
.empty-samples {
  color: var(--muted);
  font-size: 11px;
}

.empty-samples {
  padding: 12px;
}

.learning-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 18px 0;
}

.learning-tab {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 16px;
  color: #34405a;
  background: rgba(255, 255, 255, 0.68);
  font-weight: 900;
}

.learning-tab.active {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--blue), var(--violet) 48%, var(--pink));
  box-shadow: 0 12px 28px rgba(38, 119, 255, 0.18);
}

.learning-tabs .primary-btn {
  margin-left: auto;
}

.learning-tabs .secondary-btn.danger-soft {
  color: #a52a52;
  background: linear-gradient(135deg, rgba(255, 79, 139, 0.14), rgba(217, 47, 95, 0.08));
  border-color: rgba(217, 47, 95, 0.22);
}

.learning-tabs .secondary-btn.success-soft {
  color: #1f7b4f;
  background: linear-gradient(135deg, rgba(38, 179, 107, 0.15), rgba(75, 217, 133, 0.10));
  border-color: rgba(38, 179, 107, 0.24);
}

.learning-pane {
  display: none;
}

.learning-pane.active {
  display: block;
}

.sample-marker {
  pointer-events: auto;
  cursor: move;
}

.sample-marker.saving {
  opacity: 0.68;
}

.marker-delete-btn {
  position: absolute;
  top: -12px;
  left: -12px;
  z-index: 2;
  width: 24px;
  height: 24px;
  min-height: 24px;
  border: 0;
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, #ff4f8b, #ff8a1f);
  box-shadow: 0 8px 18px rgba(255, 79, 139, 0.26);
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
}

.preset-workbench {
  display: grid;
  grid-template-columns: minmax(170px, 220px) minmax(540px, 1fr) minmax(300px, 360px);
  gap: 16px;
  padding: 18px;
  height: clamp(720px, calc(100vh - 198px), 1120px);
}

.preset-image-panel,
.preset-controls-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.62);
  overflow: hidden;
}

.preset-image-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.preset-controls-panel {
  padding: 14px;
  align-self: stretch;
  overflow: auto;
}

.preset-list-panel {
  align-self: stretch;
  min-width: 0;
  overflow: visible;
}

.preset-list-panel .file-drop.compact {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  margin: 0;
  color: white;
  border: 0;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  box-shadow: 0 12px 26px rgba(38, 119, 255, 0.22);
}

.preset-list-panel .file-drop.compact,
.preset-list-panel .file-drop.compact span {
  color: white;
}

.preset-list-panel .file-drop.compact:hover,
.preset-list-panel .file-drop.compact:focus-within {
  color: white;
}

.preset-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-height: calc(100vh - 280px);
  overflow: auto;
}

.preset-item {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.74);
}

.preset-item.active {
  border-color: rgba(38, 119, 255, 0.42);
  box-shadow: 0 12px 28px rgba(38, 119, 255, 0.14);
}

.preset-item img {
  width: 58px;
  height: 78px;
  border-radius: 12px;
  object-fit: cover;
  background: white;
}

.preset-item strong,
.preset-item span,
.preset-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset-item span,
.preset-item small {
  color: var(--muted);
  font-size: 12px;
}

.preset-delete-btn {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  padding: 0 10px;
  color: #9a2450;
  background: #ffe3ef;
  font-size: 12px;
  font-weight: 900;
}

.preset-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(38, 119, 255, 0.10), rgba(38, 179, 107, 0.08));
}

.preset-stage-head strong,
.preset-stage-head span {
  display: block;
}

.preset-stage-head span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

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

.preset-step-pills {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
}

.preset-step-pills button {
  display: grid;
  place-items: center;
  min-height: 34px;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.preset-step-pills button:hover {
  background: rgba(38, 119, 255, 0.08);
}

.preset-step-pills button:active {
  transform: translateY(1px);
}

.preset-step-pills button.active {
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--green));
  box-shadow: 0 10px 24px rgba(38, 119, 255, 0.18);
}

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

.preset-size-grid label {
  min-width: 0;
}

.preset-size-grid label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.preset-size-grid input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  font: inherit;
  font-weight: 800;
  outline: none;
}

.preset-size-grid input:focus {
  border-color: rgba(38, 119, 255, 0.46);
  box-shadow: 0 0 0 4px rgba(38, 119, 255, 0.12);
}

.compact-action {
  min-height: 42px;
  margin-top: 0;
}

.preset-mode-tabs,
.preset-anchor-picker {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.preset-anchor-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
}

.preset-mode-tabs .stage-tab:disabled {
  cursor: default;
  opacity: 0.46;
}

.preset-anchor-choice {
  width: 100%;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #34405a;
  background: rgba(255, 255, 255, 0.78);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.preset-anchor-choice.active {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--green), var(--blue));
}

.preset-picker-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 32px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
  font-size: 12px;
  font-weight: 900;
}

.preset-recognition-tools {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(255, 153, 31, 0.26);
  border-radius: 14px;
  background: rgba(255, 247, 235, 0.78);
}

.preset-recognition-tools label span {
  display: block;
  margin-bottom: 6px;
  color: #7a4a11;
  font-size: 12px;
  font-weight: 900;
}

.preset-recognition-tools input {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 153, 31, 0.34);
  border-radius: 12px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  font: inherit;
  font-weight: 800;
  outline: none;
}

.preset-recognition-tools input:focus {
  border-color: rgba(255, 128, 0, 0.58);
  box-shadow: 0 0 0 4px rgba(255, 153, 31, 0.14);
}

.recognition-tool-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.preset-stage {
  flex: 1;
  min-height: 0;
  padding: 10px;
  overflow: hidden;
}

.preset-canvas-wrap {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(20, 28, 45, 0.88);
  user-select: none;
  touch-action: none;
  overscroll-behavior: contain;
  cursor: crosshair;
  scrollbar-width: thin;
}

.preset-canvas-wrap.panning {
  cursor: grabbing;
}

.preset-canvas-help {
  position: absolute;
  z-index: 30;
  top: 10px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(18, 24, 38, 0.68);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
  backdrop-filter: blur(12px);
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
  white-space: nowrap;
}

.preset-canvas-wrap img {
  display: block;
  width: auto;
  max-width: none;
  height: auto;
  margin: 0 auto;
  user-select: none;
  -webkit-user-drag: none;
}

.preset-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.preset-point,
.preset-feature-box {
  pointer-events: auto;
}

.preset-perspective-preview {
  position: absolute;
  z-index: 1;
  pointer-events: none;
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.34;
  mix-blend-mode: screen;
  filter: saturate(1.35) contrast(1.05);
}

.preset-point-lines {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}

.preset-point-lines polygon {
  fill: rgba(83, 91, 255, 0.12);
  stroke: rgba(92, 105, 255, 0.95);
  stroke-width: 4;
  stroke-dasharray: 12 8;
  vector-effect: non-scaling-stroke;
}

.preset-point {
  position: absolute;
  z-index: 5;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  width: 42px;
  height: 42px;
  min-height: 42px;
  border: 3px solid rgba(255, 255, 255, 0.98);
  border-radius: 16px;
  color: white;
  background: linear-gradient(135deg, #356dff, #8a5cff 52%, #ff4f8b);
  box-shadow: 0 12px 28px rgba(72, 91, 255, 0.34);
  font-weight: 900;
  cursor: grab;
}

.preset-point span {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: rgba(16, 24, 44, 0.45);
  line-height: 1;
}

.preset-point::before,
.preset-point::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 50% auto auto 50%;
  background: rgba(255, 255, 255, 0.72);
  transform: translate(-50%, -50%);
}

.preset-point::before {
  width: 22px;
  height: 2px;
}

.preset-point::after {
  width: 2px;
  height: 22px;
}

.preset-point.active {
  outline: 5px solid rgba(255, 204, 0, 0.34);
  background: linear-gradient(135deg, #00c781, #2477ff);
}

.preset-feature-box {
  position: absolute;
  z-index: 4;
  min-width: 8px;
  min-height: 8px;
  border: 3px dashed rgba(38, 179, 107, 0.98);
  border-radius: 6px;
  background: rgba(38, 179, 107, 0.12);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.88);
  cursor: crosshair;
}

.preset-feature-box.active {
  border-color: #ff4f8b;
  background: rgba(255, 79, 139, 0.16);
}

.preset-recognition-box {
  border-style: solid;
  border-color: rgba(255, 136, 0, 0.98);
  background: rgba(255, 153, 31, 0.13);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.preset-recognition-box.active {
  border-color: #ff4f8b;
  background: rgba(255, 79, 139, 0.17);
}

.preset-feature-box span {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: white;
  background: linear-gradient(135deg, var(--green), var(--blue));
  font-size: 12px;
  font-weight: 900;
}

.preset-recognition-box span {
  width: auto;
  min-width: 28px;
  max-width: 96px;
  padding: 0 8px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff9f1c, #ff4f8b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-process-editor {
  display: none !important;
  gap: 8px;
  margin-top: 16px;
}

.preset-process-editor label span,
.preset-process-editor label small {
  display: block;
}

.preset-process-editor label small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.preset-process-editor textarea {
  min-height: 250px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  font: inherit;
  line-height: 1.55;
  outline: none;
}

.preset-process-editor textarea:focus {
  border-color: rgba(38, 119, 255, 0.42);
  box-shadow: 0 0 0 4px rgba(38, 119, 255, 0.12);
}

.full-width {
  width: 100%;
  margin-top: 14px;
}

.compact-empty {
  margin: 18px;
  min-height: 320px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  max-width: 420px;
  padding: 14px 18px;
  border-radius: 18px;
  color: white;
  font-weight: 800;
  background: rgba(23, 32, 51, 0.92);
  box-shadow: 0 18px 50px rgba(23, 32, 51, 0.24);
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 38% 28%, rgba(38, 119, 255, 0.20), transparent 20rem),
    radial-gradient(circle at 62% 64%, rgba(255, 79, 139, 0.18), transparent 18rem),
    rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(12px) saturate(1.2);
}

.app-modal {
  width: min(100%, 460px);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 26px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 28px 90px rgba(23, 32, 51, 0.28);
  animation: modal-in 160ms ease-out;
}

.modal-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  color: white;
  font-size: 24px;
  font-weight: 900;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  box-shadow: 0 12px 28px rgba(38, 119, 255, 0.24);
}

.app-modal.danger .modal-icon {
  background: linear-gradient(135deg, #ff4f8b, #ff8a1f);
  box-shadow: 0 12px 28px rgba(255, 79, 139, 0.24);
}

.modal-copy {
  margin-top: 16px;
}

.modal-copy h3 {
  margin: 4px 0 0;
  font-size: 22px;
}

.modal-copy p:not(.eyebrow),
.modal-copy #modalMessage {
  margin: 9px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.mobile-upload-box {
  display: grid;
  gap: 12px;
}

.mobile-qr-card {
  display: grid;
  place-items: center;
  border: 1px solid rgba(36, 48, 71, 0.10);
  border-radius: 22px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.78);
}

.mobile-qr-card img {
  width: min(235px, 70vw);
  aspect-ratio: 1;
  border-radius: 14px;
  image-rendering: pixelated;
}

.mobile-upload-url {
  display: block;
  overflow-wrap: anywhere;
  border: 1px solid rgba(38, 119, 255, 0.14);
  border-radius: 14px;
  padding: 10px 11px;
  color: #234991;
  background: rgba(38, 119, 255, 0.08);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.mobile-upload-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.modal-input-wrap {
  margin-top: 16px;
}

.modal-input-wrap input {
  background: rgba(255, 255, 255, 0.92);
}

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

.modal-actions .primary-btn,
.modal-actions .secondary-btn,
.modal-actions .danger-btn {
  min-width: 96px;
}

.login-body {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  align-items: start;
  justify-items: center;
  padding: clamp(96px, 22vh, 220px) 24px 48px;
}

.login-shell {
  width: min(100%, 460px);
}

.login-panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 24px;
  background: var(--glass-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(1.24);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.login-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(38, 119, 255, 0.2);
  border-radius: 18px;
  color: white;
  background: linear-gradient(135deg, var(--blue), var(--violet));
  box-shadow: 0 14px 30px rgba(38, 119, 255, 0.2);
  font-size: 24px;
  font-weight: 900;
}

.login-brand h1 {
  margin: 2px 0 0;
  font-size: 24px;
}

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

.login-form label span {
  display: block;
  margin-bottom: 7px;
  color: #536078;
  font-size: 12px;
  font-weight: 800;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: #b52c57;
  font-size: 13px;
}

.login-footnote {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
}

.login-footnote button {
  border: 1px solid rgba(36, 48, 71, 0.1);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.hidden {
  display: none !important;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #eef4ff;
  --muted: #aab7ce;
  --line: rgba(184, 202, 235, 0.18);
  --glass: rgba(19, 25, 38, 0.84);
  --glass-strong: rgba(27, 35, 51, 0.94);
  --blue: #6da2ff;
  --green: #53d493;
  --orange: #ffb35a;
  --pink: #ff78a9;
  --violet: #a68cff;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.38);
}

html[data-theme="dark"] body {
  background:
    radial-gradient(circle at 8% 12%, rgba(109, 162, 255, 0.16), transparent 25rem),
    radial-gradient(circle at 88% 8%, rgba(255, 120, 169, 0.14), transparent 25rem),
    radial-gradient(circle at 78% 82%, rgba(83, 212, 147, 0.12), transparent 26rem),
    linear-gradient(135deg, #0d1320 0%, #15101d 50%, #0e1816 100%);
}

html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .workspace,
html[data-theme="dark"] .list-panel,
html[data-theme="dark"] .editor-panel,
html[data-theme="dark"] .wide-panel,
html[data-theme="dark"] .settings-card {
  border-color: var(--line);
  background: var(--glass);
  box-shadow: var(--shadow);
}

html[data-theme="dark"] .nav-item span,
html[data-theme="dark"] .nav-item.active,
html[data-theme="dark"] .nav-item.active span,
html[data-theme="dark"] .sidebar-panel,
html[data-theme="dark"] .status-panel,
html[data-theme="dark"] .task-center,
html[data-theme="dark"] .switch-row,
html[data-theme="dark"] .card-item,
html[data-theme="dark"] .card-item:hover,
html[data-theme="dark"] .card-item.active,
html[data-theme="dark"] .recognition-progress,
html[data-theme="dark"] .ai-usage-card,
html[data-theme="dark"] .process-row,
html[data-theme="dark"] .digit-card,
html[data-theme="dark"] .sample-strip,
html[data-theme="dark"] .preset-list-panel,
html[data-theme="dark"] .preset-controls-panel,
html[data-theme="dark"] .preset-stage,
html[data-theme="dark"] .mobile-qr-card {
  border-color: rgba(184, 202, 235, 0.16);
  background: rgba(28, 36, 52, 0.74);
  box-shadow: none;
}

html[data-theme="dark"] .task-center-head strong,
html[data-theme="dark"] .task-status-grid b {
  color: var(--ink);
}

html[data-theme="dark"] .task-center-head span,
html[data-theme="dark"] .task-concurrency label,
html[data-theme="dark"] .task-status-grid small {
  color: var(--muted);
}

html[data-theme="dark"] .task-status-grid span {
  border-color: rgba(155, 177, 214, 0.16);
  background:
    linear-gradient(180deg, rgba(35, 45, 65, 0.92), rgba(24, 32, 47, 0.86)),
    rgba(20, 28, 42, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .custom-select-trigger,
html[data-theme="dark"] .custom-options,
html[data-theme="dark"] .theme-segmented,
html[data-theme="dark"] .modal-input-wrap input {
  border-color: rgba(184, 202, 235, 0.18);
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(31, 40, 58, 0.96), rgba(23, 30, 44, 0.88)),
    rgba(24, 32, 46, 0.9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: rgba(170, 183, 206, 0.68);
}

html[data-theme="dark"] .secondary-btn,
html[data-theme="dark"] .file-drop {
  color: var(--ink);
  border-color: rgba(184, 202, 235, 0.18);
  background: rgba(30, 39, 55, 0.78);
}

html[data-theme="dark"] .danger-btn {
  color: #ffd0df;
  border-color: rgba(255, 120, 169, 0.26);
  background: rgba(116, 34, 63, 0.38);
}

html[data-theme="dark"] .warning-btn {
  color: #231407;
  box-shadow: 0 10px 22px rgba(255, 179, 90, 0.12);
}

html[data-theme="dark"] .primary-btn,
html[data-theme="dark"] .success-btn,
html[data-theme="dark"] .theme-segmented button.active {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

html[data-theme="dark"] .admin-panel-tabs {
  border-color: rgba(184, 202, 235, 0.16);
  background: rgba(24, 32, 46, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html[data-theme="dark"] .admin-panel-tabs button {
  color: rgba(194, 205, 224, 0.82);
}

html[data-theme="dark"] .admin-panel-tabs button.active {
  color: #d9e6ff;
  border-color: rgba(103, 151, 255, 0.28);
  background: rgba(70, 118, 224, 0.24);
}

html[data-theme="dark"] .appearance-card,
html[data-theme="dark"] .account-card,
html[data-theme="dark"] .backup-card,
html[data-theme="dark"] .reset-card,
html[data-theme="dark"] .ai-model-card,
html[data-theme="dark"] .ai-model-card.accent,
html[data-theme="dark"] .official-model-card,
html[data-theme="dark"] .official-model-empty,
html[data-theme="dark"] .manual-payment-panel,
html[data-theme="dark"] .manual-payment-card,
html[data-theme="dark"] .admin-stats article,
html[data-theme="dark"] .admin-section,
html[data-theme="dark"] .admin-model-card,
html[data-theme="dark"] .license-card,
html[data-theme="dark"] .login-panel,
html[data-theme="dark"] .subscription-meter,
html[data-theme="dark"] .subscription-overview > div,
html[data-theme="dark"] .plan-card,
html[data-theme="dark"] .recharge-panel,
html[data-theme="dark"] .billing-history-panel {
  background: linear-gradient(135deg, rgba(31, 40, 58, 0.84), rgba(20, 28, 42, 0.76));
}

html[data-theme="dark"] .subscription-hero {
  background:
    linear-gradient(135deg, rgba(109, 162, 255, 0.12), rgba(83, 212, 147, 0.08)),
    rgba(20, 28, 42, 0.58);
}

html[data-theme="dark"] .subscription-overview > div,
html[data-theme="dark"] .plan-card,
html[data-theme="dark"] .recharge-panel,
html[data-theme="dark"] .billing-history-panel {
  border-color: rgba(184, 202, 235, 0.16);
}

html[data-theme="dark"] .manual-payment-card div {
  border-color: rgba(155, 177, 214, 0.20);
  background: rgba(16, 24, 38, 0.82);
}

html[data-theme="dark"] .manual-payment-card.receiver,
html[data-theme="dark"] .official-model-card.active {
  background: linear-gradient(135deg, rgba(53, 89, 133, 0.42), rgba(26, 36, 54, 0.86));
}

html[data-theme="dark"] .ai-test-summary,
html[data-theme="dark"] .ai-test-row {
  border-color: rgba(184, 202, 235, 0.16);
  background: rgba(16, 24, 38, 0.62);
}

html[data-theme="dark"] .ai-test-summary.ok,
html[data-theme="dark"] .ai-test-row.ok {
  border-color: rgba(75, 216, 145, 0.28);
  background: rgba(31, 92, 67, 0.28);
  color: #8de3b4;
}

html[data-theme="dark"] .ai-test-summary.failed,
html[data-theme="dark"] .ai-test-row.failed {
  border-color: rgba(255, 122, 122, 0.26);
  background: rgba(105, 38, 49, 0.28);
  color: #ffb1b1;
}

html[data-theme="dark"] .ai-test-summary.pending {
  border-color: rgba(255, 184, 89, 0.28);
  background: rgba(102, 70, 30, 0.28);
  color: #ffd18f;
}

html[data-theme="dark"] .official-model-card em {
  color: #bdd6ff;
  background: rgba(109, 162, 255, 0.14);
}

html[data-theme="dark"] .official-model-card b {
  color: #bdf0d2;
  background: rgba(83, 212, 147, 0.12);
}

html[data-theme="dark"] .order-status.pending {
  color: #ffe1aa;
  background: rgba(255, 179, 90, 0.18);
}

html[data-theme="dark"] .order-status.approved {
  color: #bdf0d2;
  background: rgba(83, 212, 147, 0.14);
}

html[data-theme="dark"] .order-status.rejected {
  color: #ffd2e0;
  background: rgba(255, 120, 169, 0.14);
}

html[data-theme="dark"] .plan-card li,
html[data-theme="dark"] .recharge-controls label span,
html[data-theme="dark"] .login-form label span {
  color: var(--muted);
}

html[data-theme="dark"] .plan-card.active {
  border-color: rgba(109, 162, 255, 0.42);
  box-shadow: inset 0 0 0 1px rgba(109, 162, 255, 0.18);
}

html[data-theme="dark"] .login-footnote button {
  color: var(--muted);
  border-color: rgba(184, 202, 235, 0.18);
  background: rgba(30, 39, 55, 0.78);
}

html[data-theme="dark"] .login-error {
  color: #ff9cbd;
}

html[data-theme="dark"] table,
html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] .records-table,
html[data-theme="dark"] .summary-table {
  color: var(--ink);
}

html[data-theme="dark"] thead,
html[data-theme="dark"] th {
  color: var(--muted);
  background: rgba(35, 45, 64, 0.72);
}

html[data-theme="dark"] td,
html[data-theme="dark"] tr {
  border-color: rgba(184, 202, 235, 0.12);
}

html[data-theme="dark"] .empty-state,
html[data-theme="dark"] .image-stage,
html[data-theme="dark"] .learning-canvas-wrap,
html[data-theme="dark"] .preset-editor-stage,
html[data-theme="dark"] .app-modal {
  border-color: rgba(184, 202, 235, 0.16);
  background: rgba(18, 25, 38, 0.88);
}

html[data-theme="dark"] .modal-layer {
  background:
    radial-gradient(circle at 38% 28%, rgba(109, 162, 255, 0.14), transparent 20rem),
    radial-gradient(circle at 62% 64%, rgba(255, 120, 169, 0.13), transparent 18rem),
    rgba(4, 7, 13, 0.66);
}

html[data-theme="dark"] .gap-alert {
  color: #ffd4e1;
  border-color: rgba(255, 120, 169, 0.28);
  background: rgba(93, 31, 58, 0.54);
}

html[data-theme="dark"] .mobile-upload-url {
  color: #bdd6ff;
  border-color: rgba(109, 162, 255, 0.24);
  background: rgba(109, 162, 255, 0.10);
}

html[data-theme="dark"] .backup-note {
  color: #c8d4e8;
  border-color: rgba(184, 202, 235, 0.16);
  background: rgba(29, 38, 55, 0.72);
}

html[data-theme="dark"] .theme-setting > span,
html[data-theme="dark"] .field-label,
html[data-theme="dark"] label span {
  color: var(--muted);
}

html[data-theme="dark"] .switch-row input {
  background: rgba(76, 91, 118, 0.45);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.28);
}

html[data-theme="dark"] .switch-row input::before {
  background: #dbe6f6;
}

html[data-theme="dark"] .switch-row input:checked {
  background: linear-gradient(135deg, var(--green), var(--blue));
}

html[data-theme="dark"] .form-panel {
  color: var(--ink);
  background: linear-gradient(180deg, rgba(20, 28, 42, 0.92), rgba(15, 22, 35, 0.86));
}

html[data-theme="dark"] .process-table-wrap,
html[data-theme="dark"] .table-scroll,
html[data-theme="dark"] .personnel-table-scroll,
html[data-theme="dark"] .price-table-scroll {
  border-color: rgba(155, 177, 214, 0.18);
  background: rgba(14, 21, 34, 0.82);
}

html[data-theme="dark"] .process-table,
html[data-theme="dark"] .data-table,
html[data-theme="dark"] .matrix-table {
  background: rgba(15, 23, 36, 0.72);
}

html[data-theme="dark"] .process-table tbody tr,
html[data-theme="dark"] .data-table tbody tr,
html[data-theme="dark"] .matrix-table tbody tr {
  background: rgba(21, 30, 45, 0.72);
}

html[data-theme="dark"] .process-table tbody tr:nth-child(even),
html[data-theme="dark"] .data-table tbody tr:nth-child(even),
html[data-theme="dark"] .matrix-table tbody tr:nth-child(even) {
  background: rgba(25, 36, 54, 0.78);
}

html[data-theme="dark"] .process-table th,
html[data-theme="dark"] .data-table th,
html[data-theme="dark"] .matrix-table th {
  color: #c3d0e4;
  border-color: rgba(155, 177, 214, 0.16);
  background: rgba(42, 54, 76, 0.88);
}

html[data-theme="dark"] .process-table td,
html[data-theme="dark"] .data-table td,
html[data-theme="dark"] .matrix-table td {
  color: #e7eefb;
  border-color: rgba(155, 177, 214, 0.10);
}

html[data-theme="dark"] .form-panel .raw-text,
html[data-theme="dark"] .raw-text,
html[data-theme="dark"] .process-cell small,
html[data-theme="dark"] .summary-matrix .process-cell small {
  color: #8fa1bd;
}

html[data-theme="dark"] .summary-strip div,
html[data-theme="dark"] .personnel-role-cell {
  border: 1px solid rgba(155, 177, 214, 0.16);
  background: linear-gradient(135deg, rgba(31, 42, 62, 0.82), rgba(18, 27, 42, 0.76));
}

html[data-theme="dark"] .summary-mode-tabs {
  border-color: rgba(155, 177, 214, 0.18);
  background: rgba(21, 30, 45, 0.82);
}

html[data-theme="dark"] .summary-mode-tabs button {
  color: #aebbd0;
}

html[data-theme="dark"] .summary-mode-tabs button.active {
  color: white;
}

html[data-theme="dark"] .summary-strip strong,
html[data-theme="dark"] .summary-total-cell,
html[data-theme="dark"] .process-cell strong {
  color: #f2f7ff;
}

html[data-theme="dark"] .worker-empty,
html[data-theme="dark"] .price-empty,
html[data-theme="dark"] .price-disabled,
html[data-theme="dark"] .process-empty {
  color: #8fa1bd;
  border-color: rgba(155, 177, 214, 0.14);
  background: rgba(28, 38, 55, 0.72);
}

html[data-theme="dark"] .row-warn td {
  background: rgba(110, 38, 67, 0.46);
}

html[data-theme="dark"] .mini-warn {
  color: #ffd7e4;
  background: rgba(116, 34, 63, 0.58);
}

html[data-theme="dark"] .price-table-scroll .editing-row {
  background: rgba(109, 162, 255, 0.10);
}

html[data-theme="dark"] .price-table-scroll .inline-price-input {
  color: var(--ink);
  border-color: rgba(155, 177, 214, 0.20);
  background: rgba(17, 26, 41, 0.92);
}

html[data-theme="dark"] .preset-image-panel,
html[data-theme="dark"] .preset-controls-panel {
  border-color: rgba(155, 177, 214, 0.18);
  background: rgba(16, 24, 38, 0.86);
}

html[data-theme="dark"] .preset-stage-head {
  border-color: rgba(155, 177, 214, 0.16);
  background: linear-gradient(135deg, rgba(31, 42, 62, 0.92), rgba(24, 42, 51, 0.74));
}

html[data-theme="dark"] .preset-stage-head strong {
  color: #eef4ff;
}

html[data-theme="dark"] .preset-stage-head span {
  color: #91a3bf;
}

html[data-theme="dark"] .preset-item {
  border-color: rgba(155, 177, 214, 0.16);
  background: rgba(27, 37, 55, 0.78);
}

html[data-theme="dark"] .preset-item.active {
  border-color: rgba(109, 162, 255, 0.46);
  background: linear-gradient(135deg, rgba(55, 76, 112, 0.82), rgba(25, 36, 54, 0.86));
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24), inset 0 0 0 1px rgba(109, 162, 255, 0.12);
}

html[data-theme="dark"] .preset-item img {
  background: rgba(14, 21, 34, 0.82);
}

html[data-theme="dark"] .preset-item span,
html[data-theme="dark"] .preset-item small {
  color: #8fa1bd;
}

html[data-theme="dark"] .preset-delete-btn {
  color: #ffd2e0;
  background: rgba(116, 34, 63, 0.58);
}

html[data-theme="dark"] .preset-step-pills,
html[data-theme="dark"] .preset-anchor-picker,
html[data-theme="dark"] .preset-picker-empty {
  border-color: rgba(155, 177, 214, 0.18);
  background: rgba(20, 29, 44, 0.82);
}

html[data-theme="dark"] .preset-step-pills button,
html[data-theme="dark"] .preset-anchor-choice {
  color: #afbdd2;
  border-color: rgba(155, 177, 214, 0.16);
  background: rgba(29, 39, 57, 0.74);
}

html[data-theme="dark"] .preset-step-pills button:hover,
html[data-theme="dark"] .preset-anchor-choice:hover {
  background: rgba(43, 59, 86, 0.82);
}

html[data-theme="dark"] .preset-step-pills button.active,
html[data-theme="dark"] .preset-anchor-choice.active {
  color: white;
  border-color: transparent;
  background: linear-gradient(135deg, var(--blue), var(--green));
}

html[data-theme="dark"] .preset-size-grid input,
html[data-theme="dark"] .preset-recognition-tools input,
html[data-theme="dark"] .preset-process-editor textarea {
  color: var(--ink);
  border-color: rgba(155, 177, 214, 0.18);
  background: rgba(17, 26, 41, 0.92);
}

html[data-theme="dark"] .preset-recognition-tools {
  border-color: rgba(255, 179, 90, 0.26);
  background: rgba(82, 55, 23, 0.34);
}

html[data-theme="dark"] .preset-recognition-tools label span {
  color: #ffd394;
}

html[data-theme="dark"] .preset-canvas-wrap {
  border-color: rgba(155, 177, 214, 0.18);
  background: rgba(12, 19, 31, 0.9);
}

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

  .ai-strategy-grid,
  .ai-model-panels,
  .official-model-choices,
  .admin-model-list {
    grid-template-columns: 1fr;
  }

  .manual-payment-cards,
  .admin-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .app-shell.sidebar-collapsed .sidebar {
    align-items: stretch;
    padding: 22px;
    gap: 22px;
  }

  .app-shell.sidebar-collapsed .brand {
    flex-direction: row;
    gap: 14px;
  }

  .app-shell.sidebar-collapsed .brand-copy,
  .app-shell.sidebar-collapsed .nav-item strong,
  .app-shell.sidebar-collapsed .import-panel,
  .app-shell.sidebar-collapsed .status-panel div {
    display: block;
  }

  .app-shell.sidebar-collapsed .nav-item {
    justify-content: flex-start;
    gap: 12px;
    padding: 13px 14px;
  }

  .app-shell.sidebar-collapsed .status-panel {
    width: auto;
    height: auto;
    justify-content: space-between;
    padding: 16px;
  }

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

  .topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

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

  .subscription-hero,
  .subscription-overview,
  .plan-cards,
  .recharge-panel,
  .manual-payment-cards,
  .admin-stats,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .cards-layout,
  .editor,
  .preset-workbench {
    grid-template-columns: 1fr;
    height: auto;
  }

  .image-stage {
    max-height: 720px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 10px;
  }

  .topbar,
  .editor-title,
  .actions,
  .panel-head,
  .panel-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .stats-grid,
  .form-grid,
  .price-form,
  .settings-bottom-row,
  .settings-section,
  .ai-model-grid,
  .trainer-tools,
  .preset-editor-tools,
  .global-filter-bar,
  .subscription-hero,
  .subscription-overview,
  .plan-cards,
  .manual-payment-cards,
  .official-model-choices,
  .admin-stats,
  .admin-grid,
  .recharge-panel,
  .recharge-controls,
  .summary-strip,
  .nav {
    grid-template-columns: 1fr;
  }

  .subscription-hero,
  .plan-cards,
  .subscription-overview {
    padding-inline: 12px;
  }

  .recharge-panel,
  .manual-payment-panel,
  .billing-history-panel {
    margin-inline: 12px;
  }

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

  .learning-tabs .primary-btn {
    margin-left: 0;
  }
}
