:root {
  color-scheme: light;
  --ink: #15171a;
  --muted: #667085;
  --paper: #ffffff;
  --panel: #ffffff;
  --line: #e5e7eb;
  --accent: #e6512f;
  --accent-2: #1f8f7a;
  --field: #f8fafc;
  --shadow: 0 18px 55px rgba(15, 23, 42, 0.08);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --transition: 160ms cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html.auth-popup-callback,
html.auth-popup-callback body {
  background: #ffffff;
}

html.auth-popup-callback body {
  visibility: hidden;
}

/* ── Global Controls ── */
button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition), border-color var(--transition);
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

input,
select {
  transition: border-color var(--transition), box-shadow var(--transition);
}

/* ── Layout Shell ── */
.shell {
  display: grid;
  grid-template-columns: minmax(330px, 380px) minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

/* ── Side Panel ── */
.panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  height: 100%;
  padding: 24px 20px;
  padding-bottom: 30px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  overflow-y: auto;
  overflow-x: hidden;
  overflow-y: overlay;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* Custom scrollbar */
.panel::-webkit-scrollbar,
.component-list::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.panel::-webkit-scrollbar-track,
.component-list::-webkit-scrollbar-track {
  background: transparent;
}

.panel::-webkit-scrollbar-thumb,
.component-list::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 10px;
}

.panel::-webkit-scrollbar-thumb:hover,
.component-list::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* ── Version Badge ── */
.version-badge {
  margin-top: -4px;
  padding-top: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.7;
}

/* ── Site About ── */
.site-about {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.about-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.about-language-slot {
  justify-self: start;
}

.desktop-about-slot {
  display: contents;
}

.mobile-about-slot {
  display: none;
}

.site-about p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.about-facts {
  display: grid;
  gap: 4px;
}

.about-facts span {
  position: relative;
  padding-left: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
}

.about-facts span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--muted), transparent 28%);
}

.site-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.site-links a,
.legal-shell a,
.back-link {
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.site-links a:hover,
.legal-shell a:hover,
.back-link:hover {
  text-decoration: underline;
}

.support-help {
  position: relative;
  padding-top: 2px;
}

.support-help-button {
  width: 100%;
  min-height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.support-help-button:hover {
  color: #bf3f25;
}

.support-beta-note {
  margin: 2px 0 0;
  color: color-mix(in srgb, var(--ink), transparent 22%);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.5;
}

.support-popover {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 30;
  display: grid;
  gap: 10px;
  max-height: min(460px, calc(100vh - 160px));
  padding: 12px;
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--accent-2), var(--line) 55%);
  border-radius: var(--radius-md);
  background: #fffdf9;
  box-shadow: 0 14px 34px rgba(30, 33, 29, 0.16);
}

.support-popover[hidden] {
  display: none;
}

.support-popover-body {
  display: grid;
  gap: 14px;
}

.support-help-topic {
  display: grid;
  gap: 8px;
}

.support-topic-title {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.42;
}

.support-popover-body p {
  margin: 0;
  color: color-mix(in srgb, var(--ink), transparent 12%);
  font-size: 12px;
  line-height: 1.62;
}

/* ── Brand ── */
.brand {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
  min-height: 70px;
}

.brand-copy {
  grid-column: 2;
  justify-self: center;
  min-width: 0;
  text-align: center;
}

.mobile-auth-slot,
.desktop-auth-slot {
  display: flex;
  align-items: center;
}

.mobile-auth-slot {
  display: none;
}

.mark {
  justify-self: end;
  width: 64px;
  height: 64px;
  border-radius: 0;
  border: 0;
  display: block;
  flex-shrink: 0;
  object-fit: contain;
}

h1,
h2,
p {
  margin: 0;
}

.brand h1 {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0;
}

.language-control {
  display: grid;
  gap: 4px;
  min-width: 88px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.language-control select {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--ink);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 700;
}

.site-about .language-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: color-mix(in srgb, var(--muted), var(--ink) 10%);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.site-about .language-control select {
  width: auto;
  min-height: 26px;
  padding: 0 7px;
  font-size: 11px;
}

.brand p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

/* ── Auth ── */
.auth-block {
  display: grid;
  gap: 16px;
}

.auth-panel-title {
  padding-right: 38px;
  font-size: 20px !important;
  font-weight: 800 !important;
  letter-spacing: -0.01em !important;
  text-transform: none !important;
  color: var(--ink) !important;
  margin-bottom: 4px;
}

.auth-login-panel,
.auth-signup-panel,
.auth-reset-panel,
.auth-signed-in {
  display: grid;
  gap: 14px;
}

.auth-login-panel[hidden],
.auth-signup-panel[hidden],
.auth-reset-panel[hidden],
.auth-signed-in[hidden] {
  display: none;
}

.auth-form,
.auth-signup-form,
.auth-reset-form {
  display: grid;
  gap: 12px;
}

.auth-form label,
.auth-signup-form label,
.auth-reset-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.auth-form input,
.auth-signup-form input,
.auth-reset-form input,
.auth-code-section input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
  font-size: 14px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.auth-form input:focus,
.auth-signup-form input:focus,
.auth-reset-form input:focus,
.auth-code-section input:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2), transparent 82%);
  outline: none;
}

.auth-reset-email-card {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
}

.auth-reset-email-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.auth-reset-email-card strong {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-primary {
  width: 100%;
  min-height: 42px;
  border: 1px solid color-mix(in srgb, var(--accent-2), black 8%);
  border-radius: var(--radius-md);
  background: var(--accent-2);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: all var(--transition);
}

.auth-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--accent-2), black 12%);
  box-shadow: 0 6px 18px rgba(31, 143, 122, 0.24);
}

/* ── Auth Divider ── */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.auth-divider span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ── Google Button ── */
.auth-google {
  width: 100%;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.auth-google-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.auth-google:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--ink), transparent 40%);
  box-shadow: 0 4px 14px rgba(30, 33, 29, 0.08);
  background: #fafafa;
}

/* ── Auth Switch (signup/login link) ── */
.auth-switch {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding-top: 4px;
}

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

.auth-switch-link {
  background: transparent;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all var(--transition);
}

.auth-switch-link:hover {
  background: color-mix(in srgb, var(--accent-2), white 88%);
  text-decoration: underline;
}

.auth-turnstile-slot {
  display: flex;
  justify-content: center;
  min-height: 65px;
  margin: -2px 0 2px;
}

.auth-turnstile-slot:empty {
  display: none;
}

.auth-turnstile {
  display: flex;
  justify-content: center;
  width: 100%;
  min-height: 65px;
}

.auth-turnstile:empty {
  display: none;
}

.auth-turnstile iframe {
  max-width: 100%;
}

/* ── Password Guide ── */
.auth-pw-guide {
  display: grid;
  gap: 6px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent-2), white 96%);
}

.pw-rule {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  transition: color var(--transition);
}

.pw-check {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border: 1px solid color-mix(in srgb, var(--muted), white 44%);
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--muted), transparent 92%);
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.pw-rule.is-valid {
  color: #0d4e43;
}

.pw-rule.is-valid .pw-check {
  border-color: var(--accent-2);
  background: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2), transparent 84%);
}

/* ── Password Match Message ── */
.auth-pw-match-msg {
  font-size: 11px;
  font-weight: 700;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
}

.auth-pw-match-msg[hidden] {
  display: none;
}

.auth-pw-match-msg.is-match {
  background: color-mix(in srgb, var(--accent-2), white 90%);
  color: #0d4e43;
}

.auth-pw-match-msg.is-mismatch {
  background: color-mix(in srgb, var(--accent), white 90%);
  color: #7a1f10;
}

/* ── Code Section ── */
.auth-code-section {
  display: grid;
  gap: 12px;
}

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

.auth-code-section label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

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

.auth-resend-btn {
  width: 128px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition);
}

.auth-resend-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent-2), white 90%);
  border-color: color-mix(in srgb, var(--accent-2), transparent 40%);
}

/* ── Signed In Panel ── */
.auth-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--field);
}

.auth-user-avatar {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  color: var(--accent-2);
}

.auth-user-info {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.auth-user-info span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.auth-user-info strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-daily-stat {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--accent-2), var(--line) 55%);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent-2), white 94%);
}

.auth-daily-stat span {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.auth-daily-stat strong {
  color: #0d4e43;
  font-size: 18px;
  font-weight: 900;
}

.auth-signout-btn {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}

.auth-signout-btn:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent), white 92%);
  border-color: color-mix(in srgb, var(--accent), transparent 50%);
}

/* ── Auth Message ── */
.auth-feedback {
  min-height: 18px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 8px;
}

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

.auth-message {
  min-width: 0;
  margin: 0;
  color: #0d4e43;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.45;
}

.auth-message:empty {
  display: none;
}

.auth-message.is-error {
  color: #7a1f10;
}

.auth-inline-action {
  min-height: 22px;
  padding: 1px 5px;
  border-radius: 4px;
  background: transparent;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  transition: all var(--transition);
}

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

.auth-inline-action:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent-2), white 88%);
  text-decoration: underline;
}

.auth-block.is-busy button,
.auth-block.is-busy input {
  cursor: wait;
}

.auth-block button:disabled,
.auth-block input:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
  box-shadow: none;
}


/* ── Upload / Dropzone ── */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 131px;
  padding: 20px 16px;
  border: 2px dashed color-mix(in srgb, var(--accent), transparent 50%);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--accent), white 94%);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  text-align: center;
}

.dropzone:hover,
.dropzone.is-drag-over {
  background: color-mix(in srgb, var(--accent), white 88%);
  border-color: color-mix(in srgb, var(--accent), black 8%);
}

.dropzone input {
  display: none;
}

.dropzone .upload-icon {
  width: 36px;
  height: 36px;
  color: var(--accent);
  opacity: 0.8;
}

.dropzone span {
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
}

.dropzone .upload-meta {
  display: block;
  max-width: 100%;
  min-height: 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropzone .upload-meta.has-file {
  font-weight: 600;
}

/* ── Action Buttons ── */
.actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin-top: 8px;
}

.primary,
.ghost,
.download {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--panel);
  font-weight: 600;
  font-size: 13px;
  transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
}

.primary:hover,
.download:hover {
  transform: translateY(-1px);
  background: #2d332c;
  box-shadow: 0 4px 12px rgba(30, 33, 29, 0.15);
}

.primary:active,
.download:active {
  transform: translateY(0);
  box-shadow: none;
}

.ghost {
  background: transparent;
  color: var(--ink);
  font-weight: 600;
}

.ghost:hover {
  background: rgba(30, 33, 29, 0.06);
}

.sample-actions {
  grid-template-columns: auto;
  justify-content: end;
  margin-top: 0;
  margin-left: auto;
}

.sample-button {
  width: auto;
  min-height: 26px;
  padding: 0 10px;
  border-color: var(--line);
  background: color-mix(in srgb, var(--accent-2), white 88%);
  color: #0d4e43;
  font-size: 11px;
}

/* ── Status Strip ── */
.status-strip {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent-2);
  background: color-mix(in srgb, var(--accent-2), white 92%);
  color: #0e5145;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.status-strip > span {
  flex: 0 1 auto;
  min-width: 0;
}

.status-strip.error {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), white 92%);
  color: #7a1f10;
}

.status-strip.busy::after {
  content: "";
  width: 12px;
  height: 12px;
  margin-left: auto;
  flex: 0 0 12px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  opacity: 0.72;
  animation: statusSpin 760ms linear infinite;
}

@keyframes statusSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .status-strip.busy::after {
    animation: none;
  }
}

/* ── Metrics Grid ── */
.metrics {
  display: none;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.metric {
  padding: 12px;
  min-width: 0;
}

.metric:nth-child(odd) {
  border-right: 1px solid var(--line);
}

.metric:nth-child(n + 3) {
  border-top: 1px solid var(--line);
}

.metric strong {
  display: block;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
}

.metric span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Controls & Settings ── */
.controls,
.settings {
  display: grid;
  gap: 10px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

h2 {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.text-button {
  background: transparent;
  color: var(--accent-2);
  font-weight: 700;
  font-size: 12px;
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}

.text-button:hover {
  background: color-mix(in srgb, var(--accent-2), white 88%);
}

/* ── Component Lists ── */
.component-list {
  display: grid;
  gap: 6px;
}

.component-list {
  max-height: 275px;
  overflow-y: auto;
  overflow-x: hidden;
  overflow-y: overlay;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.component-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.5);
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
}

.component-row.active {
  border-color: var(--ink);
  background: color-mix(in srgb, var(--accent), white 94%);
}

.swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

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

.row-main strong {
  display: block;
  font-size: 13px;
  line-height: 1.12;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-main span,
.row-count {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
  font-weight: 500;
}

.empty-selection {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ── Settings Inputs ── */
.settings:not(.cut-toolbox) {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.section-title > h2,
.settings:not(.cut-toolbox) > h2,
.cut-tool-heading > h2,
.about-heading > h2 {
  color: var(--ink);
}

.settings label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.setting-field {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.settings:not(.cut-toolbox) label > span:first-child,
.settings:not(.cut-toolbox) .setting-field > span:first-child {
  color: var(--muted);
  font-weight: 800;
}

.settings input,
.settings select,
.toggle-button {
  width: 100%;
  height: 36px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--field);
  color: var(--ink);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 500;
}

.settings input:focus,
.settings select:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-2), transparent 82%);
}

.toggle-button {
  background: color-mix(in srgb, var(--accent-2), white 88%);
  border-color: color-mix(in srgb, var(--accent-2), transparent 60%);
  color: #0d4e43;
  font-weight: 700;
  font-size: 12px;
  text-align: left;
}

.toggle-button[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent), white 88%);
  border-color: color-mix(in srgb, var(--accent), transparent 60%);
  color: #7a1f10;
}

/* ── Cut Toolbox ── */
.cut-toolbox {
  gap: 8px;
  padding-top: 2px;
}

.split-panel-action {
  width: 100%;
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid color-mix(in srgb, var(--accent), black 10%);
  border-radius: var(--radius-lg);
  background: var(--accent);
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 20px rgba(230, 81, 47, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.split-panel-action kbd,
.split-action kbd {
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  opacity: 0.76;
  white-space: nowrap;
}

.split-panel-action:not(.is-ready) {
  background: color-mix(in srgb, var(--accent), white 72%);
  border-color: color-mix(in srgb, var(--accent), white 52%);
  box-shadow: none;
}

.split-panel-action:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #d94627;
  box-shadow: 0 8px 26px rgba(230, 81, 47, 0.34);
}

.split-panel-action:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
  box-shadow: none;
}

.cut-tool-heading {
  display: flex;
  align-items: center;
  min-height: 20px;
  margin-top: 0;
}

.split-action-divider {
  height: 1px;
  margin: 6px 0 2px;
  background: var(--line);
}

.cut-launch-button {
  width: 100%;
  min-height: 36px;
  border: 1px solid color-mix(in srgb, var(--accent-2), transparent 45%);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent-2), white 90%);
  color: #0d4e43;
  font-weight: 700;
  font-size: 12px;
  text-align: center;
}

.cut-launch-button:hover {
  background: color-mix(in srgb, var(--accent-2), white 84%);
  box-shadow: 0 3px 10px rgba(31, 143, 122, 0.14);
  transform: translateY(-1px);
}

.cut-launch-button[aria-expanded="true"] {
  background: color-mix(in srgb, var(--accent-2), white 80%);
  border-color: color-mix(in srgb, var(--accent-2), black 8%);
}

.cut-tool-panel {
  display: none;
  gap: 10px;
}

.cut-tool-panel.is-open {
  display: grid;
}

.cut-tabs,
.axis-buttons,
.sketch-actions {
  display: grid;
  gap: 6px;
}

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

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

.cut-tab,
.axis-buttons button {
  height: 36px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
  font-weight: 700;
  font-size: 12px;
}

.cut-tab:hover,
.axis-buttons button:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: color-mix(in srgb, var(--ink), transparent 50%);
}

.cut-tab.active,
.axis-buttons button.active {
  border-color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2), white 86%);
  color: #0d4e43;
}

.cut-panel {
  display: none;
  gap: 10px;
}

.cut-panel.active {
  display: grid;
}

.cut-range-stack {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.62);
}

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

.range-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

#cutOffsetValue,
#planeTiltValue {
  color: var(--ink);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.settings input.center-range {
  --range-fill-start: 50%;
  --range-fill-end: 50%;
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 22px;
  min-height: 22px;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}

.settings input.center-range:focus {
  border-color: transparent;
  box-shadow: none;
}

.settings input.center-range:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent-2), transparent 24%);
  outline-offset: 4px;
}

.settings input.center-range::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--ink), white 86%) 0 var(--range-fill-start),
    var(--ink) var(--range-fill-start) var(--range-fill-end),
    color-mix(in srgb, var(--ink), white 86%) var(--range-fill-end) 100%
  );
}

.settings input.center-range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--ink), white 86%) 0 var(--range-fill-start),
    var(--ink) var(--range-fill-start) var(--range-fill-end),
    color-mix(in srgb, var(--ink), white 86%) var(--range-fill-end) 100%
  );
}

.settings input.center-range::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -5px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 2px 7px rgba(36, 31, 28, 0.24);
}

.settings input.center-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 2px 7px rgba(36, 31, 28, 0.24);
}

.settings input.center-range:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.sketch-state {
  min-height: 54px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  padding: 10px 12px;
}

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

.cut-tool-panel .download {
  margin-top: 0;
}

/* ── Download Buttons ── */
.download-pair {
  display: grid;
  gap: 8px;
}

.download {
  width: 100%;
  margin-top: 4px;
  background: var(--accent);
  border-color: color-mix(in srgb, var(--accent), black 12%);
  border-radius: var(--radius-sm);
}

.download.secondary {
  background: var(--ink);
  border-color: var(--ink);
}

.download:disabled,
.text-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ── Stage (3D Viewer Area) ── */
.stage {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  background: var(--paper);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: flex-start;
  gap: 16px;
  padding: 20px 28px 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel), transparent 40%);
}

.topbar-title {
  justify-self: start;
  min-width: 0;
  overflow: hidden;
}

#modelTitle {
  margin: 2px 0 0;
  min-width: 0;
  font-size: clamp(22px, 2.6vw, 36px);
  font-weight: 800;
  letter-spacing: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  position: relative;
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.auth-menu {
  position: relative;
  flex: 0 0 auto;
}

.auth-icon-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(30, 33, 29, 0.05);
}

.auth-icon-button svg {
  width: 18px;
  height: 18px;
}

.auth-icon-button:hover,
.auth-icon-button[aria-expanded="true"] {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--accent-2), black 4%);
  background: color-mix(in srgb, var(--accent-2), white 90%);
  color: #0d4e43;
  box-shadow: 0 4px 12px rgba(31, 143, 122, 0.12);
}

.auth-icon-button.is-signed-in {
  border-color: color-mix(in srgb, var(--accent-2), black 8%);
  background: color-mix(in srgb, var(--accent-2), white 84%);
  color: #0d4e43;
}

.auth-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 45;
  display: grid;
  gap: 12px;
  width: min(360px, calc(100vw - 36px));
  max-height: none;
  padding: 14px;
  overflow: visible;
  border: 1px solid color-mix(in srgb, var(--accent-2), var(--line) 55%);
  border-radius: var(--radius-md);
  background: #fffdf9;
  box-shadow: 0 14px 34px rgba(30, 33, 29, 0.16);
}

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

.auth-close-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: color-mix(in srgb, var(--ink), transparent 18%);
}

.auth-close-button svg {
  width: 17px;
  height: 17px;
}

.auth-close-button:hover {
  border-color: var(--line);
  background: color-mix(in srgb, var(--field), white 30%);
  color: var(--ink);
}

.top-download-button {
  flex: 0 0 224px;
  inline-size: 224px;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--accent), black 10%);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(230, 81, 47, 0.22);
}

.top-download-button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #d94627;
  box-shadow: 0 4px 14px rgba(230, 81, 47, 0.24);
}

.top-download-button:disabled {
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.top-download-button.is-disabled-note {
  border-color: color-mix(in srgb, var(--accent), black 10%);
  background: var(--accent);
  color: #ffffff;
  opacity: 0.86;
}

.model-tabs {
  justify-self: center;
  min-width: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.model-tab {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  transition: transform var(--transition), border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.model-tab:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--ink), transparent 40%);
  box-shadow: 0 2px 8px rgba(30, 33, 29, 0.08);
}

.model-tab.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), white 90%);
  color: #7a1f10;
}

/* ── 3D Viewer ── */
.viewer {
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: 4px 6px 6px;
  border: 1px solid color-mix(in srgb, var(--line), var(--ink) 8%);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.viewer.can-pick canvas {
  cursor: pointer;
}

.viewer canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.viewer-history-controls {
  position: absolute;
  top: 15px;
  left: 15px;
  z-index: 5;
  display: inline-flex;
  gap: 2px;
}

.viewer-history-button {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: color-mix(in srgb, var(--ink), transparent 52%);
  padding: 0;
  box-shadow: none;
  transition: transform var(--transition), color var(--transition), opacity var(--transition);
}

.viewer-history-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.viewer-history-button.is-active {
  cursor: pointer;
  color: var(--ink);
}

.viewer-history-button:not(.is-active) {
  opacity: 0.42;
  cursor: not-allowed;
}

.viewer-history-button.is-active:hover {
  transform: translateY(-1px);
}

.viewer-history-button.is-active:active {
  transform: translateY(0);
}

.viewer-reset-button {
  position: absolute;
  left: 22px;
  bottom: 22px;
  z-index: 4;
  min-width: 96px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid color-mix(in srgb, var(--accent), black 10%);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent), white 88%);
  color: #7a1f10;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 6px 18px rgba(230, 81, 47, 0.16);
  backdrop-filter: blur(8px);
}

.viewer-reset-button:hover {
  transform: translateY(-1px);
  background: color-mix(in srgb, var(--accent), white 82%);
  box-shadow: 0 8px 22px rgba(230, 81, 47, 0.2);
}

.viewer-reset-button:active {
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(230, 81, 47, 0.14);
}

/* ── Split CTA Button ── */
.split-action {
  position: absolute;
  right: 22px;
  bottom: 22px;
  z-index: 4;
  min-width: 120px;
  min-height: 46px;
  padding: 0 20px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.01em;
  box-shadow: 0 6px 24px rgba(230, 81, 47, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease, box-shadow var(--transition);
}

.split-action.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.split-action:hover {
  transform: translateY(-2px);
  background: #d94627;
  box-shadow: 0 8px 32px rgba(230, 81, 47, 0.4);
}

.split-action:active {
  transform: translateY(0);
  box-shadow: 0 4px 16px rgba(230, 81, 47, 0.3);
}

/* ── Responsive ── */
@media (max-width: 900px) {
  html {
    overflow-x: hidden;
  }

  body {
    width: 100%;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .shell {
    display: block;
    width: 100%;
    max-width: 100vw;
    height: auto;
    min-height: 100svh;
    overflow-x: hidden;
    overflow-y: visible;
  }

  .panel {
    width: 100%;
    max-width: 100vw;
    height: auto;
    min-height: 100svh;
    max-height: none;
    padding: 18px 16px 24px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: hidden;
    overflow-y: visible;
    overscroll-behavior: auto;
  }

  .stage {
    width: 100vw;
    max-width: 100vw;
    height: auto;
    min-height: 0;
    grid-template-rows: auto auto;
    padding-bottom: 6px;
    border-top: 1px solid var(--line);
    overflow-x: hidden;
    overflow-y: visible;
  }

  @supports (height: 100dvh) {
    .shell {
      min-height: 100dvh;
    }

    .panel {
      min-height: 100dvh;
    }

  }

  .desktop-auth-slot,
  .desktop-about-slot {
    display: none;
  }

  .mobile-auth-slot {
    display: flex;
    position: absolute;
    right: 0;
    margin-left: 0;
  }

  .version-badge {
    margin-top: 0;
  }

  .mobile-about-slot {
    display: block;
    width: 100vw;
    max-width: 100vw;
    padding: 16px 14px 24px;
    overflow: visible;
    border-top: 1px solid var(--line);
    background: var(--panel);
  }

  .mobile-about-slot:empty {
    display: none;
  }

  .mobile-about-slot .site-about {
    width: 100%;
    max-width: 100%;
  }

  .mobile-about-slot .support-help {
    position: relative;
  }

  .mobile-about-slot .support-popover {
    position: absolute;
    bottom: calc(100% + 8px);
    max-height: min(420px, calc(100vh - 120px));
    margin-top: 0;
  }

  .topbar {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100vw;
    gap: 10px;
    padding: 14px 14px 10px;
    overflow: hidden;
  }

  #modelTitle {
    font-size: clamp(16px, 5vw, 22px);
    line-height: 1.12;
  }

  .model-tabs {
    width: 100%;
    max-width: 100%;
    justify-self: start;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
  }

  .topbar-actions {
    width: 100%;
    justify-self: stretch;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .top-download-button {
    flex: 1 1 100%;
    inline-size: auto;
    min-height: 38px;
  }

  .auth-menu {
    margin-left: auto;
  }

  .auth-popover {
    position: fixed;
    top: 10px;
    right: 10px;
    left: auto;
    bottom: auto;
    width: min(340px, calc(100vw - 20px));
    max-height: none;
    padding: 12px;
    overflow: visible;
  }

  @supports (height: 100dvh) {
    .auth-popover {
      max-height: none;
    }
  }

  .auth-block {
    gap: 10px;
  }

  .auth-panel-title {
    margin-bottom: 0;
    font-size: 18px !important;
  }

  .auth-login-panel,
  .auth-signup-panel,
  .auth-reset-panel,
  .auth-signed-in {
    gap: 10px;
  }

  .auth-form,
  .auth-signup-form,
  .auth-reset-form {
    gap: 9px;
  }

  .auth-form label,
  .auth-signup-form label,
  .auth-reset-form label {
    gap: 4px;
    font-size: 10px;
  }

  .auth-form input,
  .auth-signup-form input,
  .auth-reset-form input,
  .auth-code-section input,
  .auth-primary,
  .auth-google {
    min-height: 36px;
  }

  .auth-turnstile-slot,
  .auth-turnstile {
    min-height: 0;
    margin: 0;
  }

  .auth-divider {
    margin: 0;
  }

  .viewer {
    width: calc(100% - 8px);
    max-width: calc(100vw - 8px);
    aspect-ratio: 4 / 3;
    margin: 4px auto 0;
    min-height: 0;
    border: 1px solid color-mix(in srgb, var(--line), var(--ink) 8%);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    overflow: hidden;
  }

  .viewer canvas {
    width: 100% !important;
    height: 100% !important;
    max-width: 100%;
  }

  .viewer-history-controls {
    display: none;
  }

  .viewer-reset-button {
    left: 14px;
    bottom: 14px;
    min-height: 36px;
  }

  .split-action {
    right: 14px;
    bottom: 14px;
    min-width: 112px;
    min-height: 44px;
    border-radius: var(--radius-md);
  }
}

@media (max-width: 520px) {
  .panel {
    gap: 12px;
    padding: 14px 12px 20px;
  }

  .brand {
    min-height: 54px;
    gap: 10px;
  }

  .mark {
    width: 48px;
    height: 48px;
  }

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

  .language-control {
    min-width: 82px;
  }

  .dropzone {
    height: 124px;
    padding: 16px 12px;
  }

  .topbar-actions {
    gap: 6px;
  }

  .split-action kbd,
  .split-panel-action kbd {
    display: none;
  }
}

/* ── Model List ── */
.model-list-section {
  margin-top: 10px;
}

.model-list {
  display: grid;
  gap: 6px;
}

.empty-list {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
  line-height: 1.5;
}

.model-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: all 200ms cubic-bezier(0.16, 1, 0.3, 1);
  animation: fadeInSlide 0.26s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.model-index {
  --model-accent: var(--accent-2);
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--model-accent), transparent 60%);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--model-accent), white 86%);
  color: color-mix(in srgb, var(--model-accent), black 42%);
  font-size: 11px;
  font-weight: 800;
}

@keyframes fadeInSlide {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.model-item:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--ink), transparent 50%);
  box-shadow: 0 4px 14px rgba(54, 45, 31, 0.07);
}

.model-item.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), white 94%);
  box-shadow: inset 3px 0 0 var(--accent);
}

.model-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.model-item.base-model {
  border: 1.5px solid color-mix(in srgb, var(--ink), transparent 40%);
  background: #ffffff;
}

.model-item.base-model.active {
  border-color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2), white 92%);
  box-shadow: inset 3px 0 0 var(--accent-2);
}

.model-item.base-model:hover {
  background: #f8fafc;
}

.model-item.base-model.active:hover {
  background: color-mix(in srgb, var(--accent-2), white 88%);
}

.model-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.model-item-info strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-item-info span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.model-item-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: max-content;
}

.model-item-actions button {
  min-height: 28px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid var(--ink);
  border-radius: var(--radius-sm);
  transition: all 120ms ease;
}

.btn-download {
  background: var(--ink);
  color: var(--panel);
  white-space: nowrap;
}

.btn-download:hover {
  background: #2d332c;
  box-shadow: 0 2px 8px rgba(30, 33, 29, 0.15);
}

.btn-download:disabled,
.btn-download:disabled:hover {
  cursor: not-allowed;
  transform: none;
  border-color: var(--line);
  background: #d1d5db;
  color: #6b7280;
  box-shadow: none;
}

.model-item.base-model .btn-download {
  background: var(--accent-2);
  border-color: color-mix(in srgb, var(--accent-2), black 10%);
  color: var(--panel);
}

.model-item.base-model .btn-download:hover {
  background: color-mix(in srgb, var(--accent-2), black 15%);
}

.model-item.base-model .btn-download:disabled,
.model-item.base-model .btn-download:disabled:hover {
  border-color: var(--line);
  background: #d1d5db;
  color: #6b7280;
}

.btn-revert {
  background: transparent;
  color: var(--accent);
  border-color: var(--line) !important;
  border-radius: var(--radius-sm);
}

.btn-revert:hover {
  background: color-mix(in srgb, var(--accent), white 92%);
  border-color: var(--accent) !important;
}

/* ── Legal Pages ── */
.legal-body {
  min-height: 100%;
  display: block;
  overflow: auto;
  background: var(--paper);
}

.legal-shell {
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 64px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 26px;
}

.legal-header {
  display: grid;
  gap: 8px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.legal-header p {
  color: var(--accent-2);
  font-size: 13px;
  font-weight: 900;
}

.legal-header h1 {
  color: var(--ink);
  font-size: 38px;
  line-height: 1.05;
  letter-spacing: 0;
}

.legal-header span,
.legal-shell section p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.legal-shell section {
  display: grid;
  gap: 8px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.legal-shell h2 {
  color: var(--ink);
  font-size: 15px;
  letter-spacing: 0;
  text-transform: none;
}
