:root {
  --bg: #f5f7fc;
  --panel: #ffffff;
  --panel-soft: rgba(252, 253, 255, 0.96);
  --surface: rgba(255, 255, 255, 0.95);
  --surface-soft: rgba(255, 255, 255, 0.88);
  --surface-muted: #f3f6fd;
  --frame-bg: #f8faff;
  --frame-grid: rgba(47, 91, 234, 0.04);
  --upload-bg-top: rgba(237, 242, 255, 0.9);
  --upload-bg-bottom: rgba(248, 250, 255, 0.96);
  --meta-bg: #eef2f8;
  --status-bg: #f3f6fd;
  --secondary-text: #2347b8;
  --badge-idle-bg: #eef2f8;
  --badge-queued-bg: #fff1db;
  --badge-processing-bg: #eaf1ff;
  --badge-processing-text: #2953c7;
  --badge-done-bg: #e4f6eb;
  --badge-failed-bg: #fde9e7;
  --toggle-track: #d7deed;
  --toggle-knob: #ffffff;
  --upload-ring: rgba(47, 91, 234, 0.18);
  --upload-ring-bg: rgba(47, 91, 234, 0.04);
  --upload-core-top: rgba(47, 91, 234, 0.2);
  --upload-core-bottom: rgba(47, 91, 234, 0.09);
  --upload-core-color: #2f5bea;
  --line: #dce2ef;
  --text: #162033;
  --muted: #6a7488;
  --primary: #2f5bea;
  --primary-soft: #edf2ff;
  --success: #157347;
  --warn: #b06a11;
  --danger: #c0352b;
  --shadow: 0 18px 44px rgba(18, 31, 59, 0.08);
  --theme-button-color: #5b5c5c;
  --theme-button-hover-bg: #e6eaeb;
  --theme-button-active-bg: #d5d7d8;
  --theme-tooltip-bg: #737373;
  --theme-tooltip-color: #ffffff;
}

body.dark-theme {
  --bg: #0b0d11;
  --panel: #11151c;
  --panel-soft: rgba(17, 21, 28, 0.96);
  --surface: rgba(20, 26, 36, 0.96);
  --surface-soft: rgba(20, 26, 36, 0.92);
  --surface-muted: #182131;
  --frame-bg: #121824;
  --frame-grid: rgba(215, 226, 255, 0.06);
  --upload-bg-top: rgba(27, 35, 51, 0.92);
  --upload-bg-bottom: rgba(18, 24, 36, 0.98);
  --meta-bg: #182131;
  --status-bg: #172030;
  --secondary-text: #c6d6ff;
  --badge-idle-bg: #182131;
  --badge-queued-bg: #2b2417;
  --badge-processing-bg: #18283d;
  --badge-processing-text: #b6ccff;
  --badge-done-bg: #173125;
  --badge-failed-bg: #321c1d;
  --toggle-track: #32405b;
  --toggle-knob: #f4f7ff;
  --upload-ring: rgba(215, 226, 255, 0.16);
  --upload-ring-bg: rgba(215, 226, 255, 0.05);
  --upload-core-top: rgba(215, 226, 255, 0.16);
  --upload-core-bottom: rgba(215, 226, 255, 0.08);
  --upload-core-color: #d7e2ff;
  --line: #283041;
  --text: #edf2ff;
  --muted: #9aa6bf;
  --primary: #d7e2ff;
  --primary-soft: #1b2333;
  --success: #7be0a3;
  --warn: #f4c66b;
  --danger: #ff928b;
  --shadow: 0 22px 50px rgba(0, 0, 0, 0.34);
  --theme-button-color: #a2adc0;
  --theme-button-hover-bg: #4b586a;
  --theme-button-active-bg: #333d4b;
  --theme-tooltip-bg: #737373;
  --theme-tooltip-color: #ffffff;
}

* {
  box-sizing: border-box;
}

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

body.dark-theme {
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

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

.page {
  min-height: 100vh;
}

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

.header {
  margin: 0 0 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  text-align: left;
}

.header-actions {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.copy-job-id-btn {
  flex: 0 1 auto;
  min-width: 0;
  max-width: min(220px, 28vw);
  min-height: 32px;
  padding: 5px 9px;
  border-radius: 8px;
  background: transparent;
  color: var(--secondary-text);
  box-shadow: none;
  font-size: 0.84rem;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  user-select: text;
}

.copy-job-id-btn span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-job-id-btn:not(:disabled):hover {
  background: var(--primary-soft);
}

.copy-job-id-btn:disabled {
  opacity: 0.72;
  cursor: default;
}

.side-rail {
  position: sticky;
  z-index: 80;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  padding: 14px 10px;
  border-right: 1px solid var(--line);
  background: var(--panel);
}

.rail-spacer {
  flex: 1;
}

.side-rail .shell-icon-btn {
  width: 44px;
  min-width: 44px;
  border-color: transparent;
  border-radius: 10px;
}

.shell.sidebar-open .user-menu-btn,
.side-rail .shell-icon-btn:hover {
  background: var(--primary-soft);
  color: var(--secondary-text);
}

.app-content {
  min-width: 0;
  padding: 22px 24px 24px;
}

.user-menu-btn,
.account-menu-btn,
.github-menu-btn,
.contact-menu-btn,
.assistant-menu-btn,
.admin-menu-btn {
  position: relative;
}

.github-menu-btn svg,
.contact-menu-btn svg,
.assistant-menu-btn svg,
.admin-menu-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-mark {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: var(--secondary-text);
}

.site-mark svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.top-user-avatar {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary-soft);
  background-position: center;
  background-size: cover;
  color: var(--secondary-text);
  font-size: 0.78rem;
  font-weight: 700;
}

.top-user-avatar.has-image {
  color: transparent;
}

.account-preview-avatar {
  position: relative;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--primary-soft);
  background-position: center;
  background-size: cover;
  color: var(--secondary-text);
  font-size: 0.95rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.account-preview-avatar.has-image {
  color: transparent;
}

.shell-icon-btn {
  width: auto;
  height: 39px;
  min-width: 42px;
  min-height: 39px;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  border: 1px solid var(--theme-button-color);
  background: transparent;
  color: var(--theme-button-color);
  text-decoration: none;
  box-shadow: none;
  transition: background-color 0.2s linear, border-color 0.2s linear, color 0.2s linear;
}

.theme-toggle {
  position: relative;
}

.header .theme-toggle {
  flex: 0 0 auto;
}

.user-menu-btn::before,
.user-menu-btn::after,
.github-menu-btn::before,
.github-menu-btn::after,
.contact-menu-btn::before,
.contact-menu-btn::after,
.assistant-menu-btn::before,
.assistant-menu-btn::after,
.admin-menu-btn::before,
.admin-menu-btn::after,
.account-menu-btn::before,
.account-menu-btn::after,
.theme-toggle::before,
.theme-toggle::after {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
  z-index: 20;
}

.user-menu-btn::before,
.github-menu-btn::before,
.contact-menu-btn::before,
.assistant-menu-btn::before,
.admin-menu-btn::before,
.account-menu-btn::before,
.theme-toggle::before {
  content: "";
  top: 50%;
  left: calc(100% + 4px);
  transform: translateY(-50%);
  border: 6px solid transparent;
  border-right-color: var(--theme-tooltip-bg);
}

.header .theme-toggle::before {
  top: calc(100% + 4px);
  left: auto;
  right: 14px;
  transform: none;
  border-color: transparent;
  border-bottom-color: var(--theme-tooltip-bg);
}

.user-menu-btn::after,
.github-menu-btn::after,
.contact-menu-btn::after,
.assistant-menu-btn::after,
.admin-menu-btn::after,
.account-menu-btn::after,
.theme-toggle::after {
  content: attr(data-tooltip);
  top: 50%;
  left: calc(100% + 16px);
  transform: translateY(-50%);
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--theme-tooltip-bg);
  color: var(--theme-tooltip-color);
  box-shadow: #00000050 0 3px 10px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.header .theme-toggle::after {
  top: calc(100% + 16px);
  left: auto;
  right: 0;
  transform: none;
}

.user-menu-btn:hover::before,
.user-menu-btn:hover::after,
.user-menu-btn:focus-visible::before,
.user-menu-btn:focus-visible::after,
.github-menu-btn:hover::before,
.github-menu-btn:hover::after,
.github-menu-btn:focus-visible::before,
.github-menu-btn:focus-visible::after,
.contact-menu-btn:hover::before,
.contact-menu-btn:hover::after,
.contact-menu-btn:focus-visible::before,
.contact-menu-btn:focus-visible::after,
.assistant-menu-btn:hover::before,
.assistant-menu-btn:hover::after,
.assistant-menu-btn:focus-visible::before,
.assistant-menu-btn:focus-visible::after,
.admin-menu-btn:hover::before,
.admin-menu-btn:hover::after,
.admin-menu-btn:focus-visible::before,
.admin-menu-btn:focus-visible::after,
.account-menu-btn:hover::before,
.account-menu-btn:hover::after,
.account-menu-btn:focus-visible::before,
.account-menu-btn:focus-visible::after,
.theme-toggle:hover::before,
.theme-toggle:hover::after,
.theme-toggle:focus-visible::before,
.theme-toggle:focus-visible::after {
  opacity: 1;
}

.button-label {
  display: none;
  white-space: nowrap;
}

.buttonIcon {
  display: block;
  width: 14px;
  height: 14px;
  line-height: 0;
}

.min-icon {
  width: 14px;
  height: 14px;
  display: block;
  fill: currentColor;
}

.theme-mode-icon-sun {
  display: none;
}

body.dark-theme .theme-mode-icon-moon {
  display: none;
}

body.dark-theme .theme-mode-icon-sun {
  display: block;
}

.shell-icon-btn:hover {
  background: var(--theme-button-hover-bg);
  border-color: var(--theme-button-color);
  color: var(--theme-button-color);
}

.shell-icon-btn:active {
  background: var(--theme-button-active-bg);
}

.shell-icon-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--theme-button-color) 42%, transparent);
  outline-offset: 2px;
}

.header h1 {
  margin: 0;
  font-size: 1.72rem;
  letter-spacing: 0;
}

.header p {
  margin: 0;
  color: var(--muted);
  max-width: 560px;
  line-height: 1.6;
}

.workspace {
  --drawer-width: 0px;
  --drawer-gap: 0px;
  display: grid;
  grid-template-columns: var(--drawer-width) minmax(0, 1fr);
  gap: var(--drawer-gap);
  align-items: start;
  transition:
    grid-template-columns 0.24s cubic-bezier(0.22, 1, 0.36, 1),
    gap 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.shell.sidebar-open .workspace {
  --drawer-width: clamp(268px, 22vw, 304px);
  --drawer-gap: 16px;
}

.workspace-main {
  min-width: 0;
}

.admin-panel {
  display: grid;
  gap: 14px;
}

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

.admin-head h2 {
  margin: 0;
  font-size: 1.26rem;
  letter-spacing: 0;
}

.admin-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.admin-back-btn,
.admin-toolbar .secondary {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 8px;
}

.admin-tabs {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(84px, 1fr));
  width: min(260px, 100%);
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-tab {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.admin-tab.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(18, 31, 59, 0.08);
}

.admin-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 320px) auto;
  gap: 10px;
  align-items: center;
}

.admin-message {
  min-height: 20px;
}

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

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

.admin-row-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.admin-row-main strong {
  color: var(--text);
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-row-main span {
  color: var(--muted);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.admin-row-meta,
.admin-row-actions {
  display: flex;
  gap: 7px;
  align-items: center;
}

.admin-action-btn {
  min-width: 74px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
}

.admin-empty {
  margin: 0;
  padding: 18px 2px;
  color: var(--muted);
}

.workspace-sidebar {
  position: sticky;
  z-index: 30;
  top: 16px;
  width: 100%;
  min-width: 0;
  height: calc(100vh - 40px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 12px;
  padding: 14px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  opacity: 0;
  overflow: hidden auto;
  pointer-events: none;
  transform: translate3d(-10px, 0, 0);
  transition:
    opacity 0.16s ease,
    transform 0.22s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform, opacity;
  contain: layout paint;
}

.workspace-sidebar.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
}

.intro-notes {
  display: grid;
  gap: 8px;
  margin-bottom: 0;
  justify-items: start;
}

.intro-notes:has(.error:not(.hidden)) {
  margin-bottom: 10px;
}

.frame-toolbar {
  display: none;
}

#uploadFile {
  display: none;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
textarea,
select {
  width: 100%;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
}

textarea {
  resize: vertical;
  min-height: 44px;
  line-height: 1.5;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
  outline: 0;
  border-color: rgba(47, 91, 234, 0.55);
  box-shadow: 0 0 0 4px rgba(47, 91, 234, 0.12);
}

button {
  border: 0;
  border-radius: 14px;
  padding: 11px 16px;
  min-height: 42px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(47, 91, 234, 0.18);
}

.action-btn {
  min-width: 112px;
  justify-content: center;
  white-space: nowrap;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.secondary {
  background: var(--primary-soft);
  color: var(--secondary-text);
  box-shadow: none;
}

.secondary.is-downloaded {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(47, 91, 234, 0.18);
}

.meta,
.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--meta-bg);
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.badge-idle {
  background: var(--badge-idle-bg);
  color: var(--muted);
}

.badge-queued {
  background: var(--badge-queued-bg);
  color: var(--warn);
}

.badge-processing {
  background: var(--badge-processing-bg);
  color: var(--badge-processing-text);
}

.badge-done {
  background: var(--badge-done-bg);
  color: var(--success);
}

.badge-failed {
  background: var(--badge-failed-bg);
  color: var(--danger);
}

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

.status-line {
  max-width: min(42vw, 440px);
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--status-bg);
  font-size: 0.9rem;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.error {
  color: var(--danger);
  margin-bottom: 0;
}

.hidden {
  display: none;
}

.frame-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.frame-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: var(--panel-soft);
  display: flex;
  flex-direction: column;
}

.upload-form {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.account-title {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 600;
}

.account-heading {
  min-width: 0;
}

.account-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.account-forms {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(280px, 1fr);
  gap: 18px;
  align-items: stretch;
}

.account-forms.hidden {
  display: none;
}

.auth-aside {
  display: grid;
  align-content: space-between;
  gap: 22px;
  min-height: 300px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-muted);
}

.auth-aside strong {
  display: block;
  margin-bottom: 8px;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 650;
}

.auth-aside p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.auth-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(47, 91, 234, 0.2);
}

.auth-main {
  display: grid;
  gap: 14px;
  align-content: start;
}

.account-form {
  display: grid;
  gap: 12px;
  align-items: stretch;
}

.account-form.hidden {
  display: none;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-muted);
}

.auth-tab {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
  font-weight: 600;
}

.auth-tab.active {
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(18, 31, 59, 0.08);
}

.auth-field input {
  width: 100%;
}

.auth-field textarea {
  width: 100%;
  min-height: 98px;
  resize: vertical;
}

.auth-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.auth-code-btn {
  min-width: 104px;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: 10px;
  white-space: nowrap;
}

.auth-submit-btn {
  width: 100%;
  margin-top: 2px;
}

body.dark-theme .auth-dialog-panel {
  background: #111722;
  border-color: #273142;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.44);
}

body.dark-theme .auth-aside,
body.dark-theme .auth-tabs {
  background: #151d2b;
  border-color: #2a3548;
}

body.dark-theme .auth-tab.active {
  background: #202a3a;
  color: #eef4ff;
  box-shadow: none;
}

body.dark-theme .auth-field input,
body.dark-theme .auth-field textarea {
  background: #121a27;
  border-color: #2b3648;
  color: #edf2ff;
}

body.dark-theme .auth-field input::placeholder,
body.dark-theme .auth-field textarea::placeholder {
  color: #7f8aa0;
}

body.dark-theme .auth-field input:focus,
body.dark-theme .auth-field textarea:focus {
  border-color: #5f78b8;
  box-shadow: 0 0 0 4px rgba(95, 120, 184, 0.16);
}

body.dark-theme .auth-submit-btn {
  background: #d7e2ff;
  color: #111827;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

body.dark-theme .auth-code-btn {
  background: #202a3a;
  color: #d7e2ff;
  border: 1px solid #34415a;
}

.profile-form {
  padding-top: 2px;
}

.profile-form.hidden {
  display: none;
}

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

.profile-summary {
  min-width: 0;
}

.profile-summary strong {
  display: block;
  margin-bottom: 3px;
  font-size: 1rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-summary span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.workspace-sidebar .drawer-actions .action-btn {
  width: 100%;
}

.profile-description-field {
  grid-column: 1 / -1;
}

.profile-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.profile-aside {
  min-height: 260px;
}

.account-message {
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--status-bg);
  font-size: 0.86rem;
  line-height: 1.4;
}

.logout-btn {
  color: var(--danger);
}

.profile-preview-avatar {
  width: 64px;
  height: 64px;
  padding: 0;
  cursor: pointer;
  box-shadow: none;
}

.profile-preview-avatar.avatar-upload-disabled {
  cursor: default;
  opacity: 1;
}

.profile-preview-avatar:hover {
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
}

.profile-preview-avatar:not(.avatar-upload-disabled)::after {
  content: "";
  position: absolute;
  inset: auto 4px 4px auto;
  width: 14px;
  height: 14px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--secondary-text);
}

.auth-dialog {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-dialog.hidden {
  display: none;
}

.auth-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.36);
  opacity: 0;
  transition: opacity 0.16s ease;
}

.auth-dialog-panel {
  position: relative;
  width: min(760px, 100%);
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(18, 31, 59, 0.24);
  opacity: 0;
  transform: translateY(8px) scale(0.985);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

.auth-dialog.open .auth-dialog-backdrop {
  opacity: 1;
}

.auth-dialog.open .auth-dialog-panel {
  opacity: 1;
  transform: translateY(0) scale(1);
}

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

.contact-dialog .auth-dialog-head {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  background: rgba(16, 24, 40, 0.22);
}

.drawer-backdrop.hidden {
  display: none;
}

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

.drawer-close-btn {
  min-width: 36px;
  width: 36px;
  height: 36px;
  min-height: 36px;
  color: var(--muted);
}

.drawer-close-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-panel {
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  grid-template-rows: auto minmax(0, 1fr);
}

.assistant-dialog {
  place-items: end;
}

.assistant-panel {
  width: min(440px, 100%);
  height: min(680px, calc(100vh - 40px));
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

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

.assistant-chip {
  min-height: 34px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.86rem;
  box-shadow: none;
}

.assistant-messages {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-muted);
}

.assistant-message {
  max-width: 88%;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.assistant-message-user {
  align-self: flex-end;
  background: var(--primary);
  border-color: transparent;
  color: #fff;
}

.assistant-message-system {
  align-self: center;
  max-width: 100%;
  background: transparent;
  border-style: dashed;
  color: var(--muted);
}

.assistant-message-title {
  margin: 0;
  font-weight: 700;
}

.assistant-message-body {
  margin: 0;
}

.assistant-message-list {
  margin: 0;
  padding-left: 18px;
}

.assistant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.assistant-form input {
  min-width: 0;
}

.contact-preview-avatar {
  border-radius: 14px;
}

.contact-preview-avatar svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.contact-body {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  min-height: 0;
  overflow: auto;
}

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

.contact-link {
  width: fit-content;
  color: var(--secondary-text);
  font-weight: 600;
  text-decoration: none;
}

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

.readme-source-link {
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  font-size: 0.82rem;
}

.markdown-body {
  display: grid;
  gap: 10px;
  color: var(--text);
  line-height: 1.65;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body pre {
  margin: 0;
}

.markdown-body h1 {
  font-size: 1.3rem;
}

.markdown-body h2 {
  padding-top: 6px;
  font-size: 1.08rem;
}

.markdown-body h3,
.markdown-body h4 {
  padding-top: 4px;
  font-size: 0.98rem;
}

.markdown-body p,
.markdown-body li {
  color: var(--muted);
  font-size: 0.92rem;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 20px;
}

.markdown-body code {
  padding: 2px 5px;
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 0.86em;
}

.markdown-body pre {
  overflow: auto;
  padding: 10px;
  border-radius: 10px;
  background: var(--surface-muted);
}

.markdown-body pre code {
  padding: 0;
  background: transparent;
}

.markdown-body a {
  color: var(--secondary-text);
  text-decoration: none;
}

.markdown-body a:hover {
  text-decoration: underline;
}

.crop-dialog .auth-dialog-backdrop {
  background: rgba(6, 8, 12, 0.74);
}

.crop-panel {
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: 14px;
  border-color: rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  background: rgba(14, 17, 23, 0.96);
  color: #f7f8fb;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

.crop-dialog-head {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  align-items: center;
  min-height: 36px;
}

.crop-title {
  margin: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.94);
  font-size: 15px;
  font-weight: 650;
}

.crop-text-btn {
  min-height: 36px;
  padding: 0 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  font-size: 14px;
  cursor: pointer;
}

.crop-text-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.crop-done-btn {
  justify-self: end;
  color: #8ab4ff;
  font-weight: 650;
}

.crop-viewport {
  position: relative;
  width: min(520px, calc(100vw - 72px));
  aspect-ratio: 1 / 1;
  justify-self: center;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px),
    #090b10;
  background-size: 32px 32px, 32px 32px, auto;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.38);
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}

.crop-viewport:active {
  cursor: grabbing;
}

.crop-frame {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--crop-frame-width, 100%);
  height: var(--crop-frame-height, 100%);
  transform: translate(calc(-50% + var(--crop-frame-offset-x, 0px)), calc(-50% + var(--crop-frame-offset-y, 0px)));
  border: 1px solid rgba(255, 255, 255, 0.88);
  box-shadow:
    0 0 0 999px rgba(0, 0, 0, 0.36),
    0 0 0 1px rgba(0, 0, 0, 0.22);
  pointer-events: auto;
  z-index: 2;
}

.crop-frame::before,
.crop-frame::after {
  content: "";
  position: absolute;
  inset: 33.333% 0;
  border-top: 1px solid rgba(255, 255, 255, 0.34);
  border-bottom: 1px solid rgba(255, 255, 255, 0.34);
}

.crop-frame::after {
  inset: 0 33.333%;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.34);
  border-right: 1px solid rgba(255, 255, 255, 0.34);
}

.crop-viewport.is-circle-crop .crop-frame {
  border-radius: 999px;
}

.crop-viewport.is-original-crop .crop-frame {
  border-style: dashed;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.22);
}

.crop-resize-handle {
  position: absolute;
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: rgba(12, 15, 22, 0.72);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.32);
  pointer-events: auto;
  z-index: 3;
}

.crop-viewport.is-free-crop .crop-resize-handle {
  display: block;
}

.crop-resize-n {
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.crop-resize-e {
  top: 50%;
  right: -9px;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.crop-resize-s {
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  cursor: ns-resize;
}

.crop-resize-w {
  top: 50%;
  left: -9px;
  transform: translateY(-50%);
  cursor: ew-resize;
}

.crop-resize-ne {
  top: -9px;
  right: -9px;
  cursor: nesw-resize;
}

.crop-resize-se {
  right: -9px;
  bottom: -9px;
  cursor: nwse-resize;
}

.crop-resize-sw {
  bottom: -9px;
  left: -9px;
  cursor: nesw-resize;
}

.crop-resize-nw {
  top: -9px;
  left: -9px;
  cursor: nwse-resize;
}

.crop-viewport img {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: none;
  max-height: none;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center;
}

.crop-controls {
  display: grid;
  justify-items: center;
}

.crop-tools {
  display: inline-grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  max-width: 100%;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(18px);
}

.crop-mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(68px, 1fr));
  gap: 3px;
}

.crop-mode-btn,
.crop-icon-btn,
.crop-zoom-status {
  min-height: 42px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: rgba(255, 255, 255, 0.64);
}

.crop-mode-btn {
  display: grid;
  justify-items: center;
  gap: 3px;
  padding: 5px 9px;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}

.crop-mode-btn svg,
.crop-icon-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.crop-mode-btn:hover,
.crop-icon-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.crop-mode-btn.is-active {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.crop-rotate-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.crop-icon-btn {
  width: 42px;
  min-width: 42px;
  padding: 0;
}

.crop-zoom-status {
  display: inline-flex;
  min-width: 54px;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  font-size: 11px;
}

@media (max-width: 720px) {
  .crop-panel {
    width: calc(100vw - 16px);
    padding: 12px;
    border-radius: 18px;
  }

  .crop-viewport {
    width: min(100%, calc(100vw - 40px));
  }

  .crop-tools {
    width: 100%;
    grid-template-columns: 1fr;
  }

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

  .crop-rotate-actions,
  .crop-zoom-status,
  .crop-text-btn,
  .crop-mode-btn,
  .crop-icon-btn {
    width: auto;
  }
}

.drawer-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.drawer-actions .badge {
  min-width: 34px;
  justify-content: center;
  padding: 5px 9px;
}

.refresh-jobs-btn {
  position: relative;
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  border-color: transparent;
  color: var(--muted);
}

.refresh-jobs-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drawer-tasks-table {
  min-height: 0;
  overflow: auto;
}

.tasks-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.tasks-pager span {
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.pager-btn {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
  border-color: transparent;
  color: var(--muted);
}

.pager-btn svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.drawer-tasks-table .task-row {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
}

.drawer-tasks-table .task-actions {
  grid-column: 2;
  justify-content: flex-start;
}

.tasks-title {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 600;
}

.tasks-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.tasks-table {
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: transparent;
}

.task-row {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.tasks-list {
  display: grid;
}

.task-row {
  padding: 8px 6px;
  min-height: 56px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.16s ease;
}

.task-row:hover,
.task-row.active {
  background: var(--primary-soft);
}

.task-cell {
  min-width: 0;
  color: var(--muted);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.task-thumb {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, var(--frame-grid) 1px, transparent 1px),
    linear-gradient(var(--frame-grid) 1px, transparent 1px),
    var(--frame-bg);
  background-size: 12px 12px, 12px 12px, auto;
  color: var(--muted);
  font-size: 0.7rem;
  overflow: hidden;
}

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

.task-title-cell {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.task-title-cell strong {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-title-cell span {
  color: var(--muted);
  font-size: 0.78rem;
}

.task-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.task-action-btn {
  min-width: 48px;
  min-height: 30px;
  padding: 6px 9px;
  border-radius: 8px;
  font-size: 0.8rem;
}

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

.task-delete-btn:hover {
  background: var(--badge-failed-bg);
}

.file-meta {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
}

.file-size-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-size-text {
  flex: 0 1 auto;
  max-width: min(180px, 100%);
  justify-content: flex-end;
  text-align: right;
}

.jobs-empty {
  padding: 8px 2px 0;
}

.frame-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  min-height: 38px;
  min-width: 0;
}

.frame-head h2 {
  flex: 0 0 auto;
  margin: 0;
  font-size: 1.06rem;
}

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

.actions-with-status {
  justify-content: flex-end;
}

.frame-head .actions-with-status,
.frame-head-sub .actions-with-status {
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  row-gap: 8px;
}

.frame-head .action-btn,
.frame-head-sub .action-btn {
  flex: 0 0 auto;
}

.image-frame {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(90deg, var(--frame-grid) 1px, transparent 1px),
    linear-gradient(var(--frame-grid) 1px, transparent 1px),
    var(--frame-bg);
  background-size: 24px 24px, 24px 24px, auto;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 12px;
}

.frame-image {
  display: none;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 12px;
}

.result-full-frame {
  padding: 0;
}

.result-full-frame .frame-image {
  object-fit: cover;
  border-radius: 0;
}

.preview-subsection {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.frame-head-sub {
  min-height: 0;
  margin-bottom: 0;
  align-items: center;
}

.frame-head-sub h3 {
  flex: 0 0 auto;
  margin: 0;
  font-size: 0.96rem;
  white-space: nowrap;
}

.image-frame.has-image .frame-image {
  display: block;
}

.image-frame.has-image .placeholder {
  display: none;
}

.stl-frame {
  position: relative;
  padding: 0;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.18), transparent 38%),
    linear-gradient(90deg, var(--frame-grid) 1px, transparent 1px),
    linear-gradient(var(--frame-grid) 1px, transparent 1px),
    var(--frame-bg);
  background-size: auto, 24px 24px, 24px 24px, auto;
}

.stl-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.stl-frame:not(.has-stl) .stl-canvas {
  display: none;
}

.stl-frame.has-stl .placeholder {
  display: none;
}

body.dark-theme .stl-frame {
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.06), transparent 42%),
    linear-gradient(90deg, var(--frame-grid) 1px, transparent 1px),
    linear-gradient(var(--frame-grid) 1px, transparent 1px),
    #101722;
  background-size: auto, 24px 24px, 24px 24px, auto;
}

.placeholder {
  width: 100%;
  height: 100%;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  line-height: 1.6;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-placeholder {
  width: 100%;
  height: 100%;
  padding: 28px;
  text-align: center;
  transition: transform 0.18s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.upload-anim {
  position: relative;
  width: 88px;
  height: 88px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
}

.upload-anim-ring,
.upload-anim-core {
  position: absolute;
  inset: 0;
  border-radius: 20px;
}

.upload-anim-ring {
  border: 1px solid var(--upload-ring);
  background: var(--upload-ring-bg);
  animation: uploadPulse 2.2s ease-in-out infinite;
}

.upload-anim-core {
  inset: 10px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: linear-gradient(180deg, var(--upload-core-top), var(--upload-core-bottom));
  color: var(--upload-core-color);
  animation: uploadFloat 2.2s ease-in-out infinite;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.upload-anim-core svg {
  width: 40px;
  height: 40px;
  stroke: currentColor;
  stroke-width: 1.65;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.upload-placeholder strong {
  display: block;
  color: var(--text);
  font-size: 1.1rem;
  margin-bottom: 10px;
  letter-spacing: 0;
}

.upload-placeholder span {
  display: block;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.65;
}

.upload-frame {
  cursor: pointer;
  background:
    linear-gradient(180deg, var(--upload-bg-top), var(--upload-bg-bottom)),
    linear-gradient(90deg, var(--frame-grid) 1px, transparent 1px),
    linear-gradient(var(--frame-grid) 1px, transparent 1px);
  background-size: auto, 24px 24px, 24px 24px;
}

.upload-frame:not(.has-image) {
  border-style: dashed;
}

.upload-frame:not(.has-image):hover .upload-placeholder {
  transform: translateY(-1px);
}

.upload-frame:not(.has-image):hover .upload-anim-ring {
  border-color: rgba(47, 91, 234, 0.28);
}

.upload-frame:not(.has-image):hover .upload-anim-core {
  background: linear-gradient(180deg, rgba(47, 91, 234, 0.22), rgba(47, 91, 234, 0.12));
}

@keyframes uploadFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes uploadPulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.06);
    opacity: 1;
  }
}

.upload-frame.has-image .upload-placeholder {
  display: none;
}

.sample-gallery {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.sample-gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.sample-gallery-head p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

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

.sample-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0;
  background: var(--surface);
  box-shadow: none;
  overflow: hidden;
  aspect-ratio: 1 / 1;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease;
}

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

.sample-item:hover {
  transform: translateY(-1px);
  border-color: rgba(47, 91, 234, 0.35);
}

.sample-item.active {
  border-color: var(--primary);
  box-shadow: 0 10px 22px rgba(47, 91, 234, 0.2);
}

.settings-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: var(--panel);
  box-shadow: none;
}

.settings-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.settings-title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.settings-subtitle {
  display: none;
}

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

.settings-stack {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
  gap: 10px;
  align-items: stretch;
}

.settings-group {
  display: grid;
  gap: 8px;
  align-content: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.settings-group-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.settings-group-title {
  margin: 0;
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text);
}

.settings-group-note {
  display: none;
}

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

.settings-grid-shape {
  grid-template-columns: 1.2fr 1fr 1fr;
  align-items: end;
}

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

.field-label {
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 20px;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.field-value {
  color: var(--secondary-text);
  font-weight: 600;
}

.field-help {
  display: none;
}

.field-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.field-input input,
.field-input select {
  border: 0;
  padding: 7px 9px;
  background: transparent;
  box-shadow: none;
}

.field-input input:focus,
.field-input select:focus {
  box-shadow: none;
}

.field-unit {
  padding: 6px 9px;
  border-radius: 10px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.82rem;
}

.field-range-wide {
  grid-column: 1 / -1;
}

.range-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.range-control input {
  width: 100%;
  margin: 0;
}

.range-edge {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.field-input-select {
  grid-template-columns: minmax(0, 1fr);
}

.field-input-static {
  min-height: 44px;
  color: var(--muted);
  font-size: 0.95rem;
}

.field-input-static span {
  padding: 8px 10px;
}

.disc-only {
  transition: opacity 0.16s ease;
}

.disc-only.is-disabled {
  opacity: 0.5;
}

.disc-only.is-disabled .field-input {
  background: var(--surface-muted);
}

.disc-only.is-disabled input {
  color: var(--muted);
  cursor: not-allowed;
}

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

.toggle-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.toggle-card:hover {
  transform: translateY(-1px);
  border-color: rgba(47, 91, 234, 0.2);
}

.toggle-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.toggle-indicator {
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: var(--toggle-track);
  position: relative;
  transition: background 0.18s ease;
}

.toggle-indicator::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--toggle-knob);
  box-shadow: 0 3px 9px rgba(17, 30, 61, 0.18);
  transition: transform 0.18s ease;
}

.toggle-copy {
  display: grid;
}

.toggle-copy strong {
  font-size: 0.95rem;
}

.toggle-copy span {
  display: none;
}

.toggle-card:has(input:checked) {
  border-color: rgba(47, 91, 234, 0.26);
  box-shadow: 0 12px 26px rgba(47, 91, 234, 0.08);
}

.toggle-card:has(input:checked) .toggle-indicator {
  background: var(--primary);
}

.toggle-card:has(input:checked) .toggle-indicator::after {
  transform: translateX(18px);
}

@media (max-width: 920px) {
  .page {
    padding: 0;
  }

  .shell {
    grid-template-columns: 56px minmax(0, 1fr);
    padding: 0;
    border-radius: 0;
  }

  .side-rail {
    padding: 10px 8px;
  }

  .app-content {
    padding: 16px;
  }

  .shell.sidebar-open .app-content {
    padding-left: 16px;
  }

  .header {
    margin: 0 0 16px;
    align-items: flex-start;
  }

  .header-actions {
    align-items: flex-end;
    flex-direction: column-reverse;
  }

  .status-line {
    max-width: calc(100vw - 96px);
  }

  .shell-icon-btn {
    width: auto;
    height: 36px;
    min-width: 39px;
    min-height: 36px;
    border-radius: 3px;
  }

  .buttonIcon {
    width: 14px;
    height: 14px;
  }

  .min-icon {
    width: 14px;
    height: 14px;
  }

  .frame-grid,
  .frame-toolbar,
  .account-forms,
  .admin-toolbar,
  .admin-row,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .auth-aside {
    min-height: auto;
    grid-template-columns: auto minmax(0, 1fr);
    align-content: center;
    align-items: center;
    padding: 14px;
  }

  .admin-row-meta,
  .admin-row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .workspace,
  .shell.sidebar-open .workspace {
    display: block;
  }

  .workspace-sidebar {
    position: fixed;
    z-index: 70;
    top: 0;
    left: 56px;
    width: min(360px, calc(100vw - 56px));
    height: 100vh;
    max-height: none;
    border-radius: 0;
    border-top: 0;
    border-bottom: 0;
    border-left: 0;
    box-shadow: 22px 0 54px rgba(18, 31, 59, 0.18);
    opacity: 1;
    transform: translateX(calc(-100% - 16px));
  }

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

  .drawer-backdrop:not(.hidden) {
    display: block;
  }

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

  .auth-dialog {
    align-items: start;
    padding: 14px;
  }

  .auth-dialog-head {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .contact-dialog .auth-dialog-head {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
  }

  .tasks-table {
    border-radius: 12px;
  }

  .task-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .task-actions {
    justify-content: stretch;
  }

  .settings-grid,
  .settings-grid-wide,
  .settings-grid-shape,
  .settings-stack,
  .toggle-grid {
    grid-template-columns: 1fr;
  }

  .settings-head {
    flex-direction: column;
  }

  .settings-group-head {
    flex-direction: column;
    align-items: flex-start;
  }

  button {
    width: 100%;
  }

  .assistant-chip,
  .assistant-form button {
    width: auto;
  }

  .assistant-panel {
    width: 100%;
    height: min(720px, calc(100vh - 28px));
  }

  .drawer-close-btn {
    width: 36px;
    min-width: 36px;
    justify-self: end;
  }

  .header .theme-toggle {
    width: 40px;
    min-width: 40px;
  }

  .copy-job-id-btn {
    width: auto;
    max-width: 38vw;
  }

  .side-rail .shell-icon-btn {
    width: 40px;
    min-width: 40px;
  }

  .image-frame {
    aspect-ratio: 1 / 1;
  }

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

.shell.sidebar-open .settings-stack {
  grid-template-columns: 1fr;
}
