:root {
  color-scheme: light;
  --bg: #f6f4f1;
  --panel: #ffffff;
  --ink: #23211f;
  --muted: #746f68;
  --line: #ddd7cf;
  --accent: #6d3ff2;
  --accent-hover: #3b218a;
  --accent-soft: #eee8ff;
  --accent-ink: #ffffff;
  --danger: #9a342c;
  --shadow: 0 16px 40px rgba(30, 24, 18, .08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body:not(.app-shell) {
  line-height: 1.4;
}

header {
  display: flex;
  position: sticky;
  top: 12px;
  z-index: 5;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: min(1564px, calc(100% - 36px));
  margin: 12px auto 0;
  padding: 14px 18px;
  border: 0;
  border-radius: 10px;
  background: #fff;
  backdrop-filter: none;
  box-shadow: 0 8px 24px rgba(30, 24, 18, .06);
}

@media (min-width: 1636px) {
  html:has(> body.app-look),
  html:has(> body.app-model),
  html:has(> body.app-help),
  html:has(> body.app-logs) {
    scrollbar-gutter: stable both-edges;
  }
}

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

.brand-home-link {
  color: inherit;
  text-decoration: none;
  border-radius: 6px;
}

.brand-home-link:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 5px;
}

.brand-logo {
  width: 146px;
  height: auto;
  object-fit: contain;
  flex: 0 0 auto;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 22px;
}

h2,
.panel-head h2 {
  font-size: 15px;
}

.subtle {
  min-width: 0;
  max-width: 100%;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

section,
aside {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

form {
  display: grid;
  gap: 18px;
  min-width: 0;
  padding: 18px;
}

fieldset {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea,
button {
  font: inherit;
  letter-spacing: 0;
}

input[type="text"],
select,
textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

select {
  min-height: 40px;
  padding-right: 38px;
  border-color: #d5d1ca;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4.5 6 3.5 3.5L11.5 6' stroke='%236b655d' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 16px;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  font-style: normal;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}

select option,
select optgroup {
  color: var(--ink);
  background: #fff;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif !important;
  font-size: 13px;
  font-style: normal;
  font-weight: 500;
}

select:hover:not(:disabled) {
  border-color: #aaa39a;
  background-color: #fdfcfb;
}

select:focus-visible {
  outline: 0;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(109, 63, 242, .14);
}

select:disabled {
  border-color: #ddd9d3;
  background-color: #eeece8;
  color: #918b83;
  cursor: not-allowed;
  opacity: 1;
}

textarea {
  min-height: 116px;
  resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
}

button,
.tab {
  min-height: 40px;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  cursor: pointer;
  box-shadow: none;
}

button:hover,
.tab:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: var(--accent-ink);
}

button:disabled {
  opacity: .55;
  cursor: wait;
}

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

.background-image-control {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfaf8;
}

.background-image-control[hidden] {
  display: none;
}

.background-preview {
  display: flex;
  align-items: center;
  min-height: 72px;
  margin: 10px 0;
}

.background-preview img {
  display: block;
  width: min(100%, 320px);
  max-height: 190px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.background-library-page {
  width: min(1564px, calc(100% - 36px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.background-library-panel {
  overflow: hidden;
}

.background-library-panel .page-heading {
  margin-bottom: 0;
}

.background-library-panel > .status-line {
  margin: 0;
  padding: 0 20px;
}

.background-library-panel > .status-line:not(:empty) {
  padding-top: 12px;
}

.background-library-panel > .empty-state {
  margin: 18px;
}

.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 8px;
  padding: 18px 20px;
}

.page-heading h1,
.page-heading p {
  margin: 0;
}

.page-heading p {
  margin-top: 5px;
}

/* Home dashboard */
.home-page {
  width: min(1564px, calc(100% - 36px));
  margin: 0 auto;
  padding: 18px 0 48px;
}

.home-intro {
  overflow: visible;
  margin: 0 0 16px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.home-intro h1 {
  font-size: 28px;
}

.home-intro p {
  margin: 3px 0 0;
}

.home-models,
.home-detail-panel {
  padding: 16px 18px;
}

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

.home-section-head h2,
.home-section-head p {
  margin: 0;
}

.home-section-head p {
  margin-top: 3px;
}

.home-link {
  flex: 0 0 auto;
  min-height: auto;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

.home-link:hover {
  background: transparent;
  color: var(--accent-hover);
}

.home-model-list {
  display: grid;
  grid-auto-columns: 112px;
  grid-auto-flow: column;
  gap: 14px;
  overflow-x: auto;
  padding: 0 0 6px;
  scrollbar-width: thin;
}

.home-model {
  display: grid;
  gap: 4px;
  min-width: 112px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.home-model:hover {
  background: transparent;
  color: var(--accent-hover);
}

.home-model-image {
  display: block;
  overflow: hidden;
  aspect-ratio: 1;
  margin-bottom: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f2efeb;
}

.home-model-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transform: scale(3);
  transform-origin: center 8%;
}

.home-model strong,
.home-model small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-model small {
  color: var(--muted);
  font-size: 11px;
}

.home-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  overflow: visible;
  margin: 12px 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.home-metric {
  display: grid;
  justify-items: start;
  min-height: 116px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  text-align: left;
}

.home-metric:hover {
  border-color: color-mix(in srgb, var(--accent) 70%, var(--line));
  background: var(--accent-soft);
  color: var(--ink);
}

.home-metric:hover > span,
.home-metric:hover strong {
  color: var(--ink);
}

.home-metric:hover small {
  color: var(--muted);
}

.home-metric:hover small.has-warning {
  color: #9a6100;
}

.home-metric > span {
  font-size: 13px;
  font-weight: 700;
}

.home-metric strong {
  align-self: end;
  font-size: 30px;
  line-height: 1;
}

.home-metric small {
  color: var(--muted);
  font-size: 11px;
}

.home-metric small.has-warning {
  color: #9a6100;
  font-weight: 700;
}

.home-metric .home-metric-insight {
  align-self: end;
  color: var(--accent-hover);
  font-weight: 800;
  line-height: 1.25;
}

.home-metric:hover .home-metric-insight {
  color: var(--accent-hover);
}

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

.home-health-row,
.home-error-row,
.home-activity-row {
  display: grid;
  grid-template-columns: minmax(130px, .45fr) minmax(0, 1fr);
  gap: 6px 14px;
  width: 100%;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  text-align: left;
}

button.home-health-row,
.home-error-row {
  color: var(--ink);
}

.home-health-row + .home-health-row,
.home-error-row + .home-error-row {
  margin-top: 7px;
}

.home-health-row.is-ok {
  border-color: #cce2c8;
  background: #eef8ed;
}

.home-health-row.is-warning {
  border-color: #ead39d;
  background: #fff7e5;
}

.home-health-row.is-warning:hover {
  background: #fff1ce;
}

.home-health-row span,
.home-error-row span,
.home-activity-row span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.home-health-row strong,
.home-error-row strong,
.home-activity-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.home-health-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-more {
  margin: 10px 0 0;
}

.home-look-summary {
  margin: 0;
}

.home-look-summary > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
}

.home-look-summary > div:last-child {
  border: 0;
}

.home-look-summary .is-accent {
  margin-top: 6px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.home-look-summary dt {
  font-weight: 700;
}

.home-look-summary dd {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
}

.home-activity-row {
  grid-template-columns: minmax(130px, auto) minmax(120px, .35fr) minmax(0, 1fr);
  align-items: center;
  padding-inline: 0;
}

.home-activity-row time,
.home-error-row time {
  color: var(--muted);
  font-size: 11px;
}

.home-error-row {
  grid-template-columns: minmax(120px, auto) minmax(110px, .4fr) minmax(0, 1fr);
  align-items: center;
  border-color: #edc6c2;
  background: #fff0ee;
}

.home-error-row:hover {
  background: #f8dedb;
}

.home-empty {
  margin: 12px 0 0;
}

.home-page > .status-line {
  margin-bottom: 0;
  text-align: right;
  font-size: 11px;
}

/* Help */
.help-page {
  display: grid;
  gap: 14px;
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 18px 0 40px;
  transform: translateX(var(--scrollbar-center-offset, 0px));
}

.help-page > section {
  padding: 18px 20px;
}

.help-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.help-intro h1,
.help-intro p,
.help-section-head h2,
.help-section-head p {
  margin: 0;
}

.help-intro h1 {
  font-size: 28px;
}

.help-intro p,
.help-section-head p {
  margin-top: 3px;
}

.help-start h2 {
  margin-bottom: 14px;
}

.help-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: help-step;
}

.help-steps li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 4px 10px;
  align-content: start;
  counter-increment: help-step;
}

.help-steps li::before {
  display: grid;
  grid-row: span 2;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 800;
  content: counter(help-step);
}

.help-steps span,
.help-workflow-grid p,
.help-signals dd,
.help-faq p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.help-section-head {
  margin-bottom: 14px;
}

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

.help-workflow-grid article {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfaf8;
}

.help-workflow-grid h3,
.help-workflow-grid p {
  margin: 0;
}

.help-workflow-grid h3 {
  font-size: 15px;
}

.help-workflow-grid .home-link {
  justify-self: start;
}

.help-signals dl {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
}

.help-signals dl > div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.help-signals dt {
  font-weight: 800;
}

.help-signals dd {
  margin: 0;
}

.help-signals .is-warning {
  border-color: #ead39d;
  background: #fff7e5;
}

.help-signals .is-success {
  border-color: #cce2c8;
  background: #eef8ed;
}

.help-signals .is-error {
  border-color: #edc6c2;
  background: #fff0ee;
}

.help-faq details {
  border-top: 1px solid var(--line);
}

.help-faq details:last-child {
  border-bottom: 1px solid var(--line);
}

.help-faq summary {
  padding: 13px 2px;
  font-weight: 700;
  cursor: pointer;
}

.help-faq p {
  max-width: 850px;
  margin: 0;
  padding: 0 2px 14px;
}

@media (max-width: 900px) {
  .help-steps,
  .help-workflow-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .help-page {
    width: calc(100% - 20px);
  }

  .help-page > section {
    padding: 15px;
  }

  .help-intro {
    align-items: flex-start;
    flex-direction: column;
  }

  .help-steps,
  .help-workflow-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .help-signals dl > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
}

/* Help wiki */
.help-wiki {
  width: min(1564px, calc(100% - 36px));
}

.help-eyebrow,
.help-breadcrumb {
  margin: 0 0 5px;
  color: var(--accent-hover);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.help-wiki-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.help-wiki-nav {
  position: sticky;
  top: 14px;
  max-height: calc(100vh - 28px);
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  scrollbar-width: thin;
}

.help-wiki-nav nav {
  display: grid;
  gap: 2px;
}

.help-nav-title {
  margin: 0 7px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.help-wiki-nav a,
.help-wiki-nav .is-upcoming {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 9px;
  border-left: 3px solid transparent;
  border-radius: 4px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}

.help-wiki-nav a:hover,
.help-wiki-nav a.active {
  border-left-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.help-wiki-nav a.is-section {
  color: var(--ink);
  font-weight: 800;
}

.help-wiki-nav .is-upcoming {
  opacity: .64;
}

.help-wiki-nav small {
  font-size: 9px;
}

.help-nav-divider {
  height: 1px;
  margin: 8px 7px;
  background: var(--line);
}

.help-wiki-content {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.help-wiki-section {
  scroll-margin-top: 18px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.help-wiki-section h2,
.help-wiki-section h3,
.help-wiki-section p {
  margin-top: 0;
}

.help-wiki-section h2 {
  margin-bottom: 10px;
  font-size: 22px;
}

.help-wiki-section > p,
.help-option-list p,
.help-mode-grid p,
.help-view-grid span,
.help-procedure p,
.help-action-table span,
.help-do-dont p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.help-lead {
  max-width: 760px;
}

.help-topic-grid,
.help-mode-grid,
.help-view-grid,
.help-do-dont {
  display: grid;
  gap: 10px;
}

.help-topic-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
}

.help-topic-grid > * {
  display: grid;
  gap: 3px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfaf8;
  color: var(--ink);
  text-decoration: none;
}

.help-topic-grid .is-ready {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  background: var(--accent-soft);
}

.help-topic-grid span span {
  color: var(--muted);
  font-size: 11px;
}

.help-chapter-intro {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: linear-gradient(135deg, var(--panel), var(--accent-soft));
}

.help-chapter-heading,
.help-chapter-heading > div,
.help-chapter-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.help-chapter-heading h2 {
  margin: 0;
}

.help-chapter-number {
  color: var(--accent);
  font-size: 34px;
  font-weight: 900;
}

.help-callout {
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 4px solid #87a8c7;
  border-radius: 5px;
  background: #eef5fb;
  color: #294861;
  font-size: 13px;
  line-height: 1.55;
}

.help-callout.is-tip {
  border-color: #82b27c;
  background: #eef8ed;
  color: #31572d;
}

.help-callout.is-warning {
  border-color: #d8b65f;
  background: #fff7e5;
  color: #75500b;
}

.help-callout.is-danger {
  border-color: #c56f68;
  background: #fff0ee;
  color: #74352f;
}

.help-option-list {
  margin: 18px 0 0;
  border-top: 1px solid var(--line);
}

.help-option-list > div {
  display: grid;
  grid-template-columns: minmax(150px, .3fr) minmax(0, 1fr);
  gap: 22px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.help-option-list dt {
  font-weight: 800;
}

.help-option-list dd,
.help-option-list p:last-child {
  margin: 0;
}

.help-mode-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 16px 0;
}

.help-mode-grid article,
.help-view-grid article {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfaf8;
}

.help-mode-grid h3 {
  margin: 10px 0 5px;
}

.help-mode-grid p {
  margin-bottom: 0;
}

.help-badge {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 999px;
  background: #e9f3e7;
  color: #426b3d;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.help-badge.is-accent {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.help-badge.is-neutral {
  background: #eeeae5;
  color: var(--muted);
}

.help-view-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 16px 0;
}

.help-view-grid article {
  display: grid;
  gap: 6px;
}

.help-note {
  margin-bottom: 0;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}

.help-inline-button {
  display: inline;
  min-height: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  text-decoration: underline;
}

.help-do-dont {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.help-do-dont > div {
  padding: 15px;
  border: 1px solid #cce2c8;
  border-radius: 7px;
  background: #eef8ed;
}

.help-do-dont .is-dont {
  border-color: #ead39d;
  background: #fff7e5;
}

.help-do-dont p {
  margin: 5px 0 0;
}

.help-procedure,
.help-checklist {
  display: grid;
  gap: 10px;
  margin: 16px 0;
  padding: 0;
  list-style: none;
}

.help-procedure li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.help-procedure li > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-hover);
  font-weight: 900;
}

.help-procedure p {
  margin: 3px 0 0;
}

.help-action-table {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.help-action-table > div {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.help-action-table > div:last-child {
  border: 0;
}

.help-checklist {
  counter-reset: help-check;
}

.help-checklist li {
  position: relative;
  padding: 11px 14px 11px 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  counter-increment: help-check;
}

.help-checklist li::before {
  position: absolute;
  top: 10px;
  left: 13px;
  color: var(--accent);
  font-weight: 900;
  content: counter(help-check) ".";
}

.help-chapter-footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.help-chapter-footer a {
  color: var(--accent-hover);
  font-weight: 800;
}

@media (max-width: 960px) {
  .help-wiki-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .help-wiki-nav {
    position: static;
    max-height: none;
  }

  .help-wiki-nav nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 5px;
  }

  .help-wiki-nav a,
  .help-wiki-nav .is-upcoming {
    flex: 0 0 auto;
    border-left: 0;
    border-bottom: 3px solid transparent;
  }

  .help-wiki-nav a:hover,
  .help-wiki-nav a.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }

  .help-nav-title,
  .help-nav-divider,
  .help-wiki-nav .is-upcoming {
    display: none;
  }
}

@media (max-width: 700px) {
  .help-wiki-section {
    padding: 18px 16px;
  }

  .help-topic-grid,
  .help-mode-grid,
  .help-view-grid,
  .help-do-dont {
    grid-template-columns: minmax(0, 1fr);
  }

  .help-option-list > div,
  .help-action-table > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .help-chapter-heading,
  .help-chapter-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 900px) {
  .home-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .home-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 700px) {
  .home-page {
    width: calc(100% - 20px);
  }

  .home-intro h1 {
    font-size: 24px;
  }

  .home-models,
  .home-detail-panel {
    padding: 14px;
  }

  .home-section-head {
    align-items: flex-start;
  }

  .home-metrics {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }

  .home-metric {
    min-height: 105px;
    padding: 14px;
  }

  .home-health-row,
  .home-error-row,
  .home-activity-row {
    grid-template-columns: minmax(0, 1fr);
  }
}

.button-like {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 9px 14px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  cursor: pointer;
}

.status-line {
  min-height: 24px;
  margin: 14px 0;
}

.status-line[data-type="error"] {
  color: var(--danger);
  font-weight: 700;
}

.background-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 18px;
  padding: 18px;
}

.background-library-grid:empty {
  display: none;
}

.background-library-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.background-library-preview {
  aspect-ratio: 2 / 3;
  background: #f2efeb;
}

.background-library-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.background-library-copy {
  display: grid;
  gap: 4px;
  padding: 12px;
}

.background-library-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.background-library-card > button {
  margin: 0 12px 12px;
}

.empty-state {
  padding: 56px 24px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
}

@media (max-width: 700px) {
  .background-library-page {
    width: calc(100% - 20px);
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .background-library-grid {
    padding: 14px;
  }
}

.segmented,
.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.choice input {
  margin: 0;
}

.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

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

.workspace {
  display: grid;
  gap: 18px;
  min-width: 0;
}

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

.panel-head > * {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

pre {
  margin: 0;
  padding: 16px;
  overflow: auto;
  background: #171615;
  color: #f4efe8;
  font-size: 12px;
  white-space: pre-wrap;
}

.empty {
  padding: 18px;
  color: var(--muted);
  font-size: 13px;
}

.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(24, 22, 20, .78);
}

.lightbox.open {
  display: block;
}

.lightbox-stage {
  position: absolute;
  inset: 0;
  overflow: auto;
  padding: 72px 24px 24px;
  text-align: center;
}

.lightbox img {
  display: inline-block;
  max-width: min(92vw, 1100px);
  max-height: calc(100vh - 96px);
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
  cursor: zoom-in;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
  vertical-align: top;
}

.lightbox.actual-size img {
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

.lightbox-toolbar {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
}

.lightbox-toolbar span {
  min-width: 52px;
  color: #fff;
  font-size: 12px;
  text-align: center;
}

.lightbox-toolbar button {
  min-width: 58px;
  height: 42px;
  padding: 0 14px;
  border-radius: 999px;
}

.lightbox-toolbar #lightbox-close {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  width: 50px;
  min-width: 50px;
  height: 50px;
  padding: 0;
  border-radius: 999px;
  font-size: 34px;
  line-height: 1;
  transform: translateY(-50%);
}

.lightbox-prev { left: 18px; }
.lightbox-next { right: 18px; }
.lightbox-nav[hidden] { display: none; }

@media (max-width: 640px) {
  .lightbox-nav {
    top: auto;
    bottom: 18px;
    transform: none;
  }
}

/* Unified shell */
.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  overflow: hidden;
}

.app-shell header {
  z-index: 10;
  gap: 18px;
  padding: 14px 18px;
}

.app-model:not(.is-embedded) > header {
  width: min(1564px, calc(100% - 36px));
}

.app-shell h1 {
  font-size: 20px;
}

.app-shell nav {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.app-shell .tab {
  padding: 10px 13px;
  text-decoration: none;
  font-size: 14px;
}

.app-shell .tab.active {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.app-shell iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 0;
  background: var(--bg);
}

.page-footer {
  padding: 10px 18px 18px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

/* Generator pages */
.app-model main,
.app-look main {
  display: grid;
  gap: 18px;
  min-width: 0;
  margin: 0 auto;
  padding: 18px;
  transform: translateX(var(--scrollbar-center-offset, 0px));
}

.is-embedded > header {
  display: none;
}

.is-embedded > main {
  padding-top: 18px;
}

.app-model main {
  grid-template-columns: minmax(360px, 520px) minmax(0, 1fr);
  max-width: 1600px;
}

.app-look main {
  display: block;
  max-width: 1600px;
}

.app-look textarea {
  min-height: 118px;
}

.batch-confirm-dialog {
  width: min(520px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(30, 24, 18, .22);
}

.batch-confirm-dialog::backdrop {
  background: rgba(24, 22, 20, .42);
}

.batch-confirm-dialog form {
  gap: 14px;
  padding: 24px;
}

.batch-confirm-dialog p {
  margin: 0;
}

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

.batch-estimate-summary > div {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf8;
}

.batch-estimate-summary dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.batch-estimate-summary dd {
  margin: 4px 0 0;
  font-size: 20px;
  font-weight: 800;
}

.app-model .references {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(118px, 100%), 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 10px;
  min-width: 0;
  max-height: 280px;
  padding-right: 4px;
  overflow: auto;
}

.app-model .ref,
.app-model .output-card,
.app-look .card {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  padding: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf8;
}

.app-model .ref {
  position: relative;
  grid-template-rows: auto auto auto auto;
  justify-items: start;
  align-items: start;
  gap: 7px;
  color: var(--ink);
}

.app-model .ref-select {
  display: contents;
  cursor: pointer;
}

.app-model .ref input[type="checkbox"] {
  width: 16px;
  min-width: 16px;
  height: 16px;
  margin: 0;
  align-self: start;
  justify-self: start;
  flex: 0 0 auto;
}

.app-model .ref img {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 5px;
  background: #eee;
  object-fit: cover;
  justify-self: stretch;
}

.app-model .ref span {
  min-width: 0;
  max-width: 100%;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
  word-break: break-word;
  justify-self: stretch;
}

.app-model .ref .delete-item {
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border-color: var(--danger);
  background: transparent;
  color: var(--danger);
  font-size: 12px;
}

.app-model .ref .delete-item:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.app-model .outputs,
.app-look .thumbs,
.app-look .outputs {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  overflow: hidden;
}

.app-model .outputs {
  grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr));
}

.app-look .thumbs,
.app-look .outputs {
  grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr));
}

.app-model .output-card img,
.app-look .card img {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 5px;
  background: #fff;
  object-fit: contain;
  cursor: zoom-in;
}

.app-model .output-card strong,
.app-model .output-card span,
.app-look .card strong,
.app-look .card span {
  min-width: 0;
  max-width: 100%;
  font-size: 13px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.app-look .card.recognized {
  border-color: #b8d8b2;
  background: #eef8ed;
}

.app-look .card.unrecognized {
  border-color: #e2aaa2;
  background: #fff0ee;
}

.app-look .output-generation-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
}

.app-look .output-generation-count,
.app-look .output-generation-cost {
  width: fit-content;
  padding: 4px 7px;
  border: 1px solid #d9d1ff;
  border-radius: 5px;
  background: #f2efff;
  color: #5d45aa;
  font-size: 10px !important;
  font-weight: 750;
}

.app-look.hide-look-costs .output-generation-cost {
  display: none;
}

.app-look .output-generation-cost {
  margin-left: auto;
  border-color: #d9d5ce;
  background: #f4f2ee;
  color: #625d56;
  white-space: nowrap;
}

.app-look .output-empty-card {
  align-content: start;
  gap: 11px;
  padding: 10px;
  border-color: #d8d3ca;
  border-style: dashed;
  background:
    linear-gradient(145deg, rgba(109, 63, 242, .045), transparent 48%),
    #faf9f7;
}

.output-empty-visual {
  display: grid;
  position: relative;
  place-items: center;
  width: 100%;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid #e4e0da;
  border-radius: 6px;
  background:
    radial-gradient(circle at 50% 42%, #fff 0, #f4f1ec 58%, #ede9e3 100%);
  color: #aaa39a;
}

.output-empty-visual::after {
  content: "";
  position: absolute;
  right: -32px;
  bottom: -34px;
  width: 100px;
  height: 100px;
  border: 1px solid rgba(109, 63, 242, .1);
  border-radius: 50%;
}

.output-empty-visual svg {
  width: 48px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.output-empty-index {
  position: absolute;
  top: 10px;
  left: 10px;
  min-width: 28px !important;
  padding: 4px 6px;
  border: 1px solid #ddd7ce;
  border-radius: 5px;
  background: rgba(255, 255, 255, .78);
  color: #817a71;
  font-size: 10px !important;
  font-weight: 800;
  letter-spacing: .08em;
  text-align: center;
}

.output-empty-copy {
  display: grid;
  gap: 2px;
}

.output-empty-copy strong {
  color: var(--ink);
  font-size: 14px !important;
}

.output-empty-copy span {
  color: var(--muted);
  font-size: 11px !important;
}

.output-empty-path {
  padding-top: 8px;
  border-top: 1px solid #e7e3dd;
  color: #99928a;
  font-size: 10px !important;
  line-height: 1.35;
}

.app-look .role-badge {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 4px 7px;
  border: 1px solid var(--accent);
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.app-look .card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.app-look .card-actions button,
.app-look .card-actions .card-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}

.app-look .card-actions .card-download:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  color: var(--accent-ink);
}

.app-model pre,
.app-look pre {
  min-height: 260px;
  max-height: 420px;
}

/* Utility pages */
.app-logs main,
.app-settings main {
  display: grid;
  gap: 18px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 18px;
}

.app-logs main {
  transform: translateX(var(--scrollbar-center-offset, 0px));
}

.app-logs .actions {
  padding: 16px;
}

.app-logs #cleanup-output {
  min-height: 360px;
  max-height: calc(100vh - 260px);
}

.app-logs .log-toolbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.app-logs .log-toolbar label {
  min-width: 190px;
}

.app-logs .operation-log-list {
  display: grid;
  gap: 10px;
  padding: 0 16px 16px;
}

.app-logs .operation-log-card {
  overflow: visible;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid #7b746c;
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}

.app-logs .operation-log-card.is-warning {
  border-left-color: #b7791f;
}

.app-logs .operation-log-card.is-error {
  border-left-color: var(--danger);
  background: #fff9f8;
}

.app-logs .operation-log-heading,
.app-logs .operation-log-heading > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.app-logs .operation-log-heading > div {
  justify-content: flex-start;
  min-width: 0;
}

.app-logs .operation-log-heading strong {
  overflow-wrap: anywhere;
}

.app-logs .log-status {
  padding: 3px 7px;
  border-radius: 999px;
  background: #ebe7e2;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.app-logs .log-status.is-succeeded {
  background: #e0f3e5;
  color: #24653a;
}

.app-logs .log-status.is-failed,
.app-logs .log-status.is-denied {
  background: #f8dedb;
  color: var(--danger);
}

.app-logs .operation-log-card details {
  margin-top: 10px;
}

.app-logs .operation-log-card summary {
  color: var(--accent-hover);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.app-logs .operation-log-card pre {
  min-height: 0;
  max-height: 320px;
  margin: 10px 0 0;
}

.app-logs .empty-state {
  margin: 0 16px 16px;
}

@media (max-width: 700px) {
  .app-logs .operation-log-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-logs .log-toolbar > *,
  .app-logs .log-toolbar label {
    width: 100%;
  }
}

.app-settings .editor {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.app-settings textarea {
  min-height: 430px;
  padding: 12px;
  font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  line-height: 1.5;
}

.settings-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
}

.settings-options #save-ui {
  margin-left: auto;
}

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

.settings-editors > section {
  box-shadow: none;
}

.settings-editors code {
  overflow-wrap: anywhere;
}

.gemini-secret-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line, #ddd);
}

.admin-user-list {
  grid-template-columns: minmax(0, 1fr);
  padding: 0 18px 20px;
}

.admin-user-list .settings-options {
  align-items: end;
}

.create-user-form {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(150px, 1fr) minmax(150px, 1fr) minmax(110px, .6fr) auto;
  align-items: end;
  padding: 0;
}

.create-user-form label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.create-user-form input,
.create-user-form select {
  width: 100%;
}

.create-tenant-form,
.tenant-selector-row {
  align-items: end;
}

.create-tenant-form label,
.tenant-selector-row label {
  display: grid;
  gap: 6px;
  min-width: min(360px, 100%);
}

.tenant-admin-list {
  display: grid;
  gap: 8px;
  padding: 0 16px 16px;
}

.app-admin main {
  max-width: 1280px;
  gap: 24px;
  padding: clamp(18px, 3vw, 32px);
}

.app-admin .admin-help {
  margin: 12px 0 0;
  padding: 0;
}

.app-admin .admin-status {
  margin: 0;
  padding: 0;
}

.admin-create-user-panel {
  margin: 4px 16px 26px;
  padding: 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 5%, white);
  box-shadow: 0 8px 24px rgba(59, 42, 109, .07);
}

.admin-section-heading {
  margin-bottom: 18px;
}

.admin-section-heading h2,
.admin-existing-users-head h2 {
  margin: 3px 0 0;
}

.admin-section-heading p {
  margin: 6px 0 0;
}

.admin-section-kicker {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.admin-existing-users-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 18px 14px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

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

.tenant-admin-card > div {
  display: grid;
  gap: 3px;
}

.tenant-admin-main {
  flex: 1;
  min-width: 220px;
}

.tenant-admin-main label {
  display: grid;
  gap: 5px;
  font-weight: 700;
}

.tenant-admin-main input {
  width: min(420px, 100%);
}

.admin-card-actions {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px !important;
}

.app-admin button.danger {
  border-color: color-mix(in srgb, var(--danger) 55%, white);
  background: white;
  color: var(--danger);
}

.app-admin button.danger:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: white;
}

.gemini-secret-panel h3 {
  margin: 0;
}

.secret-input-label {
  display: grid;
  gap: .4rem;
  min-width: 0;
  margin: 0;
}

.secret-input-label input {
  width: 100%;
  box-sizing: border-box;
}

.secret-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: end;
  margin: 0;
}

.secret-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: end;
  gap: 14px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #faf9fc;
}

.secret-actions button {
  min-height: 42px;
  white-space: nowrap;
}

/* Product folder manager */
.app-products [hidden] {
  display: none !important;
}

.app-products main {
  display: grid;
  gap: 14px;
  min-width: 0;
  max-width: 1600px;
  margin: 0 auto;
  padding: 18px;
}

.app-products input[type="search"] {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.app-products button.secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.app-products button.secondary:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.app-products button.danger {
  border-color: #d7aaa6;
  background: #fff;
  color: var(--danger);
}

.app-products button.danger:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.product-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 420px) minmax(0, 1fr) auto;
  align-items: end;
  gap: 18px;
  padding: 14px;
  box-shadow: none;
}

.product-search span {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.product-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px 16px;
  min-width: 0;
  padding-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.product-summary strong {
  color: var(--ink);
  font-size: 15px;
}

.product-summary .has-warning,
.product-summary .has-warning strong {
  color: #9a5a18;
}

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

.product-toolbar-actions button {
  white-space: nowrap;
}

.product-manager {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  min-height: calc(100vh - 232px);
}

.product-folders,
.product-content {
  min-height: 0;
  box-shadow: none;
}

.product-folders {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.folder-list {
  display: grid;
  align-content: start;
  gap: 4px;
  min-height: 0;
  max-height: calc(100vh - 300px);
  padding: 8px;
  overflow: auto;
}

.folder-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 54px;
  padding: 8px 9px;
  border-color: transparent;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font-weight: 400;
}

.folder-row:hover {
  border-color: var(--line);
  background: #f7f5f2;
  color: var(--ink);
}

.folder-row.active {
  border-color: #5f5a52;
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px #5f5a52;
}

.product-folders .folder-row.has-inconsistency {
  border-color: #ead39d;
  background: #fff7e5;
}

.product-folders .folder-row.has-inconsistency:hover {
  border-color: #d8b65f;
  background: #fff1ce;
}

.product-folders .folder-row.has-inconsistency.active {
  border-color: #9a6100;
  background: #fff1ce;
  box-shadow: inset 0 0 0 1px #9a6100;
}

.folder-row.approved {
  border-color: #b9d8b4;
  background: #edf7eb;
}

.folder-row.approved:hover {
  border-color: #8fbd87;
  background: #e4f3e1;
}

.folder-row.approved.active {
  border-color: #5f5a52;
  background: #edf7eb;
  box-shadow: inset 0 0 0 1px #5f5a52;
}

.folder-row-tail {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 18px;
}

.folder-selection-arrow {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: #5f5a52;
  font-size: 17px !important;
  font-weight: 800;
  line-height: 1;
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .16s ease, transform .16s ease;
}

.folder-row.active .folder-selection-arrow {
  opacity: 1;
  transform: translateX(0);
}

.folder-mark {
  display: grid;
  place-items: center;
  color: var(--accent);
}

.folder-mark svg {
  width: 23px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.folder-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.folder-copy strong,
.folder-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-copy strong {
  font-size: 13px;
}

.folder-copy .folder-name-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  overflow: visible;
  white-space: normal;
}

.folder-name-row > span:first-child {
  flex: 1 1 140px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-generated {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 4px;
  border: 1px solid #b9d8b4;
  border-radius: 5px;
  background: #eaf6e8;
  color: #356831;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.folder-generated-views {
  display: inline-flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 3px;
  max-width: 100%;
  overflow: visible;
  white-space: normal;
}

.folder-generated-views:empty {
  display: none;
}

.folder-copy small {
  color: var(--muted);
  font-size: 11px;
}

.folder-warning {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff0d8;
  color: #8a4b0f;
  font-size: 11px;
  font-weight: 800;
}

.product-content {
  position: relative;
}

.product-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  min-height: 420px;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.product-empty[hidden],
.product-detail[hidden] {
  display: none !important;
}

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

.product-detail {
  min-width: 0;
}

.product-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.product-detail-head > div:first-child {
  min-width: 0;
}

.product-detail-head h2 {
  margin: 2px 0 3px;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.product-path {
  color: var(--accent);
  font: 11px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: .02em;
}

.upload-zone {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 16px 20px;
  padding: 14px 16px;
  border: 1px dashed #bcb5ac;
  border-radius: 8px;
  background: #fbfaf8;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}

.upload-zone:hover,
.upload-zone:focus-visible,
.upload-zone.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.upload-zone > div:nth-child(3) {
  display: grid;
  gap: 2px;
  min-width: 0;
}

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

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

/* Look manager */
.job-banner[hidden] {
  display: none;
}

.job-banner {
  display: grid;
  position: sticky;
  top: 91px;
  z-index: 4;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: calc(100% - 36px);
  max-width: 1564px;
  min-height: 68px;
  margin: 14px auto 0;
  padding: 12px 14px 14px;
  overflow: hidden;
  border: 1px solid #cdbfff;
  border-radius: 8px;
  background: #f5f1ff;
  color: var(--ink);
  box-shadow: 0 12px 32px rgba(52, 35, 105, .14);
}

.is-embedded .job-banner {
  top: 0;
}

.job-banner.error {
  border-color: #e2aaa2;
  background: #fff0ee;
}

.job-banner.success {
  border-color: #b8d8b2;
  background: #eef8ed;
}

.job-banner-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}

.job-banner.running .job-banner-icon span {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: job-spin .8s linear infinite;
}

.job-banner.error .job-banner-icon {
  background: var(--danger);
}

.job-banner.error .job-banner-icon::before {
  content: "!";
}

.job-banner.success .job-banner-icon {
  background: #3f7b39;
}

.job-banner.success .job-banner-icon::before {
  content: "✓";
}

.job-banner-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  font-size: 13px;
}

.job-banner-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.job-banner-heading strong {
  font-size: 14px;
}

#job-banner-elapsed,
.job-banner-detail {
  color: var(--muted);
  font-size: 12px;
}

.job-banner-detail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.job-banner-close {
  width: 32px;
  min-height: 32px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.job-banner-close:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, .7);
  color: var(--ink);
}

.job-banner.running .job-banner-close {
  visibility: hidden;
}

.job-banner-progress {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  overflow: hidden;
  background: rgba(109, 63, 242, .12);
}

.job-banner-progress span {
  display: block;
  width: 38%;
  height: 100%;
  background: var(--accent);
  animation: job-progress 1.5s ease-in-out infinite;
}

.job-banner:not(.running) .job-banner-progress {
  display: none;
}

@keyframes job-spin {
  to { transform: rotate(360deg); }
}

@keyframes job-progress {
  from { transform: translateX(-105%); }
  to { transform: translateX(265%); }
}

.look-manager {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 14px;
  min-width: 0;
  min-height: calc(100vh - 120px);
}

.look-folders,
.look-configuration,
.look-results > aside {
  min-height: 0;
  box-shadow: none;
}

.look-folders {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-self: start;
  position: sticky;
  top: 104px;
}

.look-folder-actions {
  display: grid;
  gap: 7px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.look-folder-actions label {
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.look-folder-actions select {
  min-height: 36px;
  padding: 8px 34px 8px 9px;
  background-position: right 9px center;
  font-size: 11px;
}

.look-folder-actions button {
  width: 100%;
}

.look-folder-actions button:disabled {
  border-color: #d5d2cc;
  background: #e7e5e1;
  color: #96918a;
  cursor: not-allowed;
  opacity: 1;
}

.is-embedded .look-folders {
  top: 18px;
}

.look-folders .folder-list {
  max-height: calc(100vh - 180px);
}

.look-folders .folder-list.batch-mode {
  background: linear-gradient(180deg, var(--accent-soft), transparent 84px);
}

.look-main {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
}

.look-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
}

.look-detail-head > div {
  min-width: 0;
}

.look-detail-head h2 {
  margin-top: 3px;
  font-size: 22px;
  overflow-wrap: anywhere;
}

.look-approval {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.look-approval input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.look-approval span {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid #c9c5bd;
  border-radius: 5px;
  color: transparent;
  font-size: 12px;
}

.look-approval:has(input:checked) {
  border-color: #8fbd87;
  background: #eaf6e8;
  color: #356831;
}

.look-approval:has(input:checked) span {
  border-color: #70a867;
  background: #70a867;
  color: #fff;
}

.look-path {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.look-configuration form {
  padding: 16px 18px 18px;
}

.look-parameter-grid {
  display: grid;
  grid-template-columns: minmax(260px, .95fr) minmax(320px, 1.15fr) minmax(280px, 1fr);
  align-items: start;
  gap: 18px;
}

.look-parameter-grid fieldset {
  margin: 0;
}

.look-view-settings {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
}

.look-feedback textarea {
  min-height: 166px;
}

.look-runbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.look-runbar #run {
  min-width: 180px;
}

.look-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}

.look-output-panel,
.look-log-panel {
  grid-column: 1 / -1;
}

.app-look .look-output-panel .outputs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.look-output-actions {
  display: flex;
  justify-content: flex-end;
  padding: 16px 18px 18px;
  border-top: 1px solid var(--line);
}

.look-output-actions button {
  min-width: 160px;
}

.app-look .look-log-panel pre {
  min-height: 180px;
  max-height: 360px;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 7px;
  background: #fff;
  color: var(--accent);
}

.upload-icon svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.overwrite-choice {
  display: flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  white-space: nowrap;
  cursor: pointer;
}

.product-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 20px 14px;
}

.filter-button {
  min-height: 32px;
  padding: 6px 10px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

.filter-button:hover,
.filter-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  align-content: start;
  gap: 12px;
  min-height: 280px;
  max-height: calc(100vh - 490px);
  padding: 0 20px 20px;
  overflow: auto;
}

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

.product-card.unrecognized {
  border-color: #e2aaa2;
}

.product-preview {
  display: block;
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: #f3f1ee;
}

.product-preview:hover {
  border: 0;
  background: #f3f1ee;
}

.product-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #f3f1ee;
  object-fit: contain;
  transition: transform .18s ease;
}

.product-preview:hover img {
  transform: scale(1.025);
}

.product-card-body {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  padding: 11px;
}

.product-labels {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.product-card .role-badge,
.product-card .association {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
}

.product-card .role-badge {
  background: var(--accent-soft);
  color: #5130b5;
}

.product-card .association.associated {
  background: #e5f4e3;
  color: #356831;
}

.product-card .association.missing {
  background: #fff0d8;
  color: #8a4b0f;
}

.product-code {
  min-width: 0;
  margin-top: 2px;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-filename {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 0 10px 10px;
}

.product-card-actions button {
  min-height: 31px;
  padding: 5px 7px;
  font-size: 11px;
}

.product-card-actions .label-file {
  grid-column: 1 / -1;
}

.product-grid-empty {
  grid-column: 1 / -1;
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--muted);
  font-size: 13px;
}

.product-status {
  min-height: 22px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.product-status[data-type="success"] {
  color: #356831;
}

.product-status[data-type="error"] {
  color: var(--danger);
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--danger) 45%, white);
  border-left: 4px solid var(--danger);
  border-radius: 8px;
  background: color-mix(in srgb, var(--danger) 9%, white);
  box-shadow: 0 8px 24px rgba(130, 35, 35, .12);
  font-size: 14px;
  font-weight: 650;
}

.product-status[data-type="error"]::before {
  content: "Errore — ";
}

.app-products dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 28px 80px rgba(30, 24, 18, .24);
}

.app-products dialog::backdrop {
  background: rgba(24, 22, 20, .46);
  backdrop-filter: blur(3px);
}

.app-products dialog form {
  padding: 20px;
}

.app-products dialog h2 {
  margin-bottom: 6px;
  font-size: 19px;
}

.app-products dialog p {
  margin: 0;
  font-size: 13px;
}

.app-products dialog code {
  padding: 2px 4px;
  border-radius: 4px;
  background: #f3f1ee;
  font-size: 12px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

@media (prefers-reduced-motion: reduce) {
  .product-preview img {
    transition: none;
  }

  .job-banner.running .job-banner-icon span,
  .job-banner-progress span {
    animation: none;
  }

  .job-banner-progress span {
    width: 100%;
  }
}

@media (max-width: 1080px) {
  .product-toolbar {
    grid-template-columns: minmax(220px, 1fr) auto;
  }

  .product-summary {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    padding: 0;
  }

  .product-manager {
    grid-template-columns: 248px minmax(0, 1fr);
  }

  .upload-zone {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .overwrite-choice {
    grid-column: 2;
  }

  .look-manager {
    grid-template-columns: 248px minmax(0, 1fr);
  }

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

  .look-feedback {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .app-products header {
    position: sticky;
    align-items: flex-start;
    flex-direction: column;
    top: 10px;
    width: calc(100% - 20px);
    margin-top: 10px;
    padding: 12px;
  }

  .app-products main {
    padding: 10px;
  }

  .product-toolbar,
  .product-manager {
    grid-template-columns: 1fr;
  }

  .product-toolbar-actions {
    width: 100%;
  }

  .product-toolbar-actions button {
    flex: 1 1 0;
  }

  .product-manager {
    min-height: 0;
  }

  .folder-list {
    display: flex;
    max-height: none;
    padding: 8px;
    overflow-x: auto;
  }

  .folder-row {
    flex: 0 0 210px;
  }

  .product-detail-head {
    align-items: stretch;
    flex-direction: column;
  }

  .product-detail-head .actions button {
    flex: 1 1 150px;
  }

  .upload-zone {
    grid-template-columns: 36px minmax(0, 1fr);
    margin: 12px;
  }

  .overwrite-choice {
    grid-column: 1 / -1;
  }

  .product-controls {
    align-items: flex-start;
    flex-direction: column;
    padding: 0 12px 12px;
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    max-height: none;
    padding: 0 12px 14px;
  }

  .look-manager,
  .look-parameter-grid,
  .look-results {
    grid-template-columns: 1fr;
  }

  .look-manager {
    min-height: 0;
  }

  .look-folders {
    position: static;
  }

  .look-folders .folder-list {
    display: flex;
    max-height: none;
    overflow-x: auto;
  }

  .look-folders .folder-row {
    flex: 0 0 210px;
  }

  .look-feedback,
  .look-output-panel,
  .look-log-panel {
    grid-column: auto;
  }

  .app-look .look-output-panel .outputs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .look-runbar {
    align-items: stretch;
    flex-direction: column;
  }

  .job-banner {
    top: 0;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    width: calc(100% - 20px);
    margin-top: 10px;
  }
}

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

  .app-look .look-output-panel .outputs {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .app-look header {
    position: sticky;
    align-items: flex-start;
    flex-direction: column;
    top: 10px;
    width: calc(100% - 20px);
    margin-top: 10px;
    padding: 12px;
  }

  .app-look main {
    padding: 12px;
  }

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

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

  .app-model header {
    position: sticky;
    align-items: flex-start;
    flex-direction: column;
    top: 10px;
    width: calc(100% - 20px);
    margin-top: 10px;
    padding: 12px;
  }

  .app-model main {
    grid-template-columns: 1fr;
    padding: 12px;
  }

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

@media (max-width: 600px) {
  .app-settings main {
    padding: 10px;
  }

  .app-admin main {
    gap: 14px;
  }

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

  .settings-options {
    align-items: stretch;
    flex-direction: column;
  }

  .create-user-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-create-user-panel {
    margin: 4px 10px 20px;
    padding: 16px;
  }

  .admin-existing-users-head {
    align-items: flex-start;
    flex-direction: column;
    margin-inline: 12px;
  }

  .secret-controls {
    grid-template-columns: minmax(0, 1fr);
  }

  .secret-actions button {
    flex: 1 1 140px;
  }

  .settings-options #save-ui {
    width: 100%;
    margin-left: 0;
  }

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

@media (max-width: 800px) {
  .app-shell header {
    position: sticky;
    align-items: flex-start;
    flex-direction: column;
    top: 10px;
    width: calc(100% - 20px);
    margin-top: 10px;
    padding: 12px;
  }

  .app-shell nav {
    justify-content: flex-start;
  }

  .app-shell iframe {
    height: 100%;
  }
}

@media (max-width: 1000px) and (min-width: 601px) {
  .create-user-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .secret-controls {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Danger zone */
.app-shell .danger-tab {
  border-color: #d8aaa5;
  background: #fff4f2;
  color: var(--danger);
}

.app-shell .danger-tab:hover,
.app-shell .danger-tab.active {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.app-danger-zone main {
  max-width: 980px;
  margin: 0 auto;
  padding: 24px;
}

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

.danger-page-head h1 {
  margin: 0 0 3px;
  font-size: 26px;
}

.danger-card {
  display: grid;
  gap: 20px;
  padding: 24px;
  border: 1px solid #d8aaa5;
  border-top: 5px solid var(--danger);
  box-shadow: 0 18px 48px rgba(117, 36, 31, .1);
}

.danger-card h2 {
  margin: 5px 0 8px;
  font-size: 24px;
}

.danger-card p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.danger-kicker {
  color: var(--danger);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

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

.danger-summary span {
  display: grid;
  gap: 2px;
  padding: 12px;
  border: 1px solid #ead3d0;
  border-radius: 8px;
  background: #fff8f7;
  color: var(--muted);
  font-size: 12px;
}

.danger-summary strong {
  color: var(--danger);
  font-size: 20px;
}

.danger-look-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.danger-look-list code {
  padding: 5px 7px;
  border-radius: 5px;
  background: #f2efeb;
}

.danger-confirm {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.danger-confirm input {
  max-width: 420px;
}

.danger-card button.danger {
  width: fit-content;
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.danger-card button.danger:disabled {
  border-color: #d5d2cc;
  background: #e7e5e1;
  color: #96918a;
  cursor: not-allowed;
  opacity: 1;
}

.danger-status[data-type="error"] {
  padding: 12px;
  border-left: 4px solid var(--danger);
  background: #fff0ee;
  color: var(--danger);
  font-weight: 700;
}

.danger-status[data-type="success"] {
  color: #356831;
  font-weight: 700;
}

@media (max-width: 700px) {
  .danger-summary {
    grid-template-columns: 1fr 1fr;
  }
}

.tenant-switcher {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.tenant-switcher[hidden] {
  display: none;
}

.tenant-switcher select {
  width: auto;
  min-width: 120px;
  min-height: 38px;
  padding: 7px 28px 7px 9px;
  font-size: 13px;
  text-transform: none;
}
