:root {
  --bg: #ebe7dd;
  --panel: rgba(255, 252, 247, 0.92);
  --panel-strong: #fffdf9;
  --panel-soft: #f6f1e7;
  --text: #1f1b16;
  --muted: #6d6357;
  --line: rgba(45, 34, 21, 0.12);
  --accent: #c8572c;
  --accent-dark: #933717;
  --accent-soft: #f8d7ca;
  --success: #dcefdc;
  --error: #ffe0d6;
  --shadow: 0 24px 60px rgba(52, 32, 11, 0.1);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 214, 153, 0.58), transparent 32%),
    linear-gradient(180deg, #f5f0e6 0%, var(--bg) 100%);
}

a {
  color: inherit;
}

.page-shell {
  min-height: 100vh;
  padding: 28px 16px 48px;
}

.dashboard,
.results-layout,
.auth-layout {
  width: min(1240px, 100%);
  margin: 0 auto;
}

.flash-stack {
  width: min(1240px, 100%);
  margin: 0 auto 14px;
}

.flash {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
}

.flash-error {
  background: var(--error);
}

.flash-success {
  background: var(--success);
}

.auth-layout {
  min-height: calc(100vh - 80px);
  display: grid;
  place-items: center;
}

.auth-card,
.hero,
.panel,
.status-card,
.app-card,
.inspector-row,
.empty-state {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.auth-card,
.panel {
  padding: 28px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 28px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(30px, 5vw, 54px);
  line-height: 0.96;
  margin-bottom: 12px;
}

h2 {
  margin-bottom: 0;
}

.lede,
.muted-copy,
.meta-line,
.store-link,
.description-block p {
  color: var(--muted);
}

.lede {
  font-size: 18px;
  max-width: 760px;
  line-height: 1.5;
}

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

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

label {
  font-weight: 700;
}

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

input,
textarea,
select,
button,
.solid-link,
.ghost-button {
  font: inherit;
}

input,
textarea,
select {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  padding: 14px 16px;
}

textarea {
  resize: vertical;
}

button,
.solid-link,
.ghost-button,
.danger-button {
  border-radius: 999px;
  padding: 12px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

button,
.solid-link {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff8f2;
}

.ghost-button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

.danger-button {
  background: #f6d6ce;
  border: 1px solid rgba(147, 55, 23, 0.18);
  color: #8c3012;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--muted);
}

.status-chip-ok {
  background: #e6f4e6;
  color: #266b34;
}

.status-chip-off {
  background: #f8ddd6;
  color: #9b3b22;
}

.setup-error {
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: var(--error);
}

.input-row-panel {
  margin-bottom: 22px;
  padding: 18px;
}

.inline-parse-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
}

.inline-input-wrap textarea {
  min-height: 64px;
}

.inspector-list {
  display: grid;
  gap: 18px;
}

.list-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.list-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.view-switcher {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.view-switcher .ghost-button.is-active {
  background: var(--panel-soft);
  border-color: rgba(147, 55, 23, 0.18);
}

.row-stack {
  display: grid;
  gap: 16px;
}

.inspector-row {
  padding: 18px;
  position: relative;
  z-index: 0;
}

.inspector-row.is-latest {
  border-color: rgba(200, 87, 44, 0.35);
  box-shadow: 0 24px 60px rgba(200, 87, 44, 0.12);
}

.app-inspector-hero-compact {
  align-items: center;
}

.app-inspector-hero-compact h1 {
  margin-bottom: 0;
}

.row-main {
  display: grid;
  grid-template-columns: minmax(280px, 1.15fr) minmax(260px, 1fr) minmax(260px, 1.05fr);
  gap: 18px;
  align-items: start;
}

.row-app-card {
  display: grid;
  gap: 12px;
}

.row-bundle-block {
  display: grid;
  gap: 8px;
  justify-items: start;
}

.row-app {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 14px;
}

.row-icon,
.app-icon {
  border-radius: 22px;
  object-fit: cover;
  box-shadow: 0 14px 24px rgba(15, 9, 4, 0.16);
}

.row-icon {
  width: 84px;
  height: 84px;
}

.app-icon {
  width: 96px;
  height: 96px;
}

.row-title-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
}

.row-title-line h3 {
  margin: 0;
}

.row-chip {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.badge-row span {
  border-radius: 999px;
  padding: 7px 11px;
  background: var(--panel-soft);
  color: var(--accent-dark);
  font-size: 13px;
}

.compact-badges {
  margin: 12px 0 0;
}

.bundle-line {
  margin: 0;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  width: auto;
  max-width: 100%;
  justify-self: start;
}

.row-bundle-block .status-chip {
  justify-self: start;
  width: auto;
  max-width: fit-content;
}

.row-copy {
  display: grid;
  gap: 12px;
}

.row-copy-compact {
  gap: 8px;
}

.row-label {
  margin-bottom: 6px;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.row-copy p:last-child,
.row-banners p:last-child {
  margin-bottom: 0;
}

.mini-shots,
.shots-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
  align-items: flex-start;
}

.mini-shot,
.shot {
  border: 1px solid var(--line);
  background: #fff;
}

.mini-shot {
  width: 94px;
  min-width: 94px;
  height: 188px;
  border-radius: 18px;
  object-fit: cover;
  display: block;
}

.shot {
  width: 136px;
  min-width: 136px;
  height: 292px;
  border-radius: 22px;
  object-fit: cover;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  align-items: flex-start;
  position: relative;
  z-index: 2;
}

.inspector-row-mini {
  padding: 14px 18px;
}

.mini-row-layout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 84px;
}

.mini-row-main {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 14px;
  align-items: center;
  min-width: 0;
  flex: 1;
}

.mini-row-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
  align-content: center;
}

.mini-row-copy h3,
.mini-row-copy .meta-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-row-copy .status-chip {
  justify-self: start;
  width: auto;
  max-width: fit-content;
  padding: 7px 12px;
}

.mini-row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inline-action-form {
  margin: 0;
}

.assign-form {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.assign-form-inline {
  min-width: 170px;
}

.assign-form-inline .row-label {
  display: none;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.meta-pill {
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
}

.meta-pill span {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.meta-pill strong {
  display: block;
  font-size: 14px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.meta-pill-wide {
  grid-column: span 2;
}

.expandable-text {
  margin-top: 8px;
}

.expandable-text summary {
  list-style: none;
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 700;
}

.expandable-text summary::-webkit-details-marker {
  display: none;
}

.expandable-text[open] summary {
  margin-bottom: 8px;
}

.expandable-text p {
  color: var(--muted);
  white-space: pre-wrap;
}

.download-menu {
  position: relative;
}

.download-menu[open] {
  z-index: 20;
}

.download-menu summary {
  list-style: none;
}

.download-menu summary::-webkit-details-marker {
  display: none;
}

.download-menu-list {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  min-width: 140px;
  padding: 8px;
  display: grid;
  gap: 6px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 10;
}

.row-details,
.stitch-panel {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.stitch-panel-inline {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.row-details summary,
.stitch-panel summary {
  list-style: none;
  cursor: pointer;
  color: var(--accent-dark);
  font-weight: 700;
}

.row-details summary::-webkit-details-marker,
.stitch-panel summary::-webkit-details-marker {
  display: none;
}

.row-details-body {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.stitch-form {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.stitch-shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}

.stitch-shot-option {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  cursor: pointer;
}

.stitch-shot-option input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.stitch-shot-preview {
  width: 100%;
  aspect-ratio: 9 / 19.5;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  display: block;
}

.stitch-shot-option span {
  font-size: 13px;
  color: var(--muted);
}

.download-menu-list a {
  padding: 9px 12px;
  border-radius: 10px;
  text-decoration: none;
}

.download-menu-list a:hover {
  background: var(--panel-soft);
}

.app-dialog {
  border: 0;
  padding: 0;
  background: transparent;
}

.app-dialog::backdrop {
  background: rgba(31, 27, 22, 0.42);
  backdrop-filter: blur(4px);
}

.app-dialog-card {
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  padding: 20px;
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.app-dialog-card-small {
  width: min(420px, calc(100vw - 24px));
}

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

.dialog-head h3 {
  margin: 0;
}

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

.empty-state {
  padding: 28px;
  text-align: center;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.status-monitor-grid {
  display: grid;
  gap: 16px;
}

.status-monitor-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  padding: 20px;
}

.status-monitor-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.status-monitor-app {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
}

.status-monitor-app h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

.status-monitor-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 10px 18px rgba(15, 9, 4, 0.14);
}

.status-monitor-meta {
  margin-top: 14px;
}

.team-user-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  align-items: end;
}

.status-card,
.app-card {
  padding: 22px;
}

.compact-app-card {
  display: grid;
  gap: 16px;
}

.status-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.card-stack {
  display: grid;
  gap: 18px;
}

.app-head {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 18px;
  align-items: center;
}

.app-card-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.app-head-compact {
  grid-template-columns: 84px 1fr;
  gap: 14px;
}

.card-actions-inline {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.store-link {
  text-decoration: underline;
}

.copy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.compact-card-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(220px, 0.9fr);
  gap: 14px;
}

.compact-copy-block,
.compact-description-block,
.compact-meta-section,
.compact-banner-section {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.compact-copy-block,
.compact-description-block {
  display: grid;
  gap: 10px;
}

.compact-copy-block p:last-child,
.compact-description-block p:last-child {
  margin-bottom: 0;
}

.compact-meta-grid {
  margin-top: 0;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

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

.copy-grid section,
.description-block {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

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

@media (max-width: 980px) {
  .row-main {
    grid-template-columns: 1fr;
  }

  .compact-card-grid {
    grid-template-columns: 1fr;
  }

  .meta-pill-wide {
    grid-column: span 1;
  }
}

@media (max-width: 720px) {
  .page-shell {
    padding: 18px 12px 36px;
  }

  .hero,
  .app-head,
  .app-card-top,
  .status-monitor-top,
  .mini-row-layout,
  .row-app,
  .inline-parse-form,
  .list-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .hero,
  .auth-card,
  .panel,
  .inspector-row,
  .app-card,
  .status-card,
  .empty-state {
    padding: 18px;
  }

  .hero-actions {
    justify-content: start;
  }
}
