:root {
  --app-shell-max: 1500px;
  --rail-divider-color: rgba(15, 23, 42, 0.12);
  --batch-header-bg: #f4f8ff;
  --batch-header-border: #dbe7fb;
  --batch-cell-bg: rgba(255, 255, 255, 0.96);
  --batch-selected-bg: rgba(237, 244, 255, 0.92);
  --batch-empty-bg: #e2e8f0;
  --batch-empty-text: #64748b;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
}

body.has-preview-modal {
  overflow: hidden;
}

.app-hero__inner {
  width: 100%;
}

.hero.app-hero .app-kicker,
.hero.app-hero .app-title,
.hero.app-hero .app-subtitle,
.app-hero__actions {
  width: 100%;
  max-width: none;
}

.batch-page {
  display: grid;
  gap: 1rem;
  margin-bottom: 2rem;
}

.batch-toolbar {
  display: grid;
  gap: 1rem;
}

.batch-toolbar__actions {
  align-items: center;
}

.download-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.72rem 1rem;
  border: 1px solid #bdd0ea;
  border-radius: 12px;
  background: #ffffff;
  color: #264268;
  font-weight: 700;
  text-decoration: none;
}

.download-chip:hover,
.download-chip:focus-visible {
  background: #f5f8ff;
}

.batch-guide-layout {
  margin: 0;
}

.batch-guide-layout .guide-card {
  box-shadow: none;
  background: var(--surface-soft);
}

.batch-guide-layout .guide-card strong {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text);
}

.batch-workspace-stack {
  display: grid;
  gap: 1rem;
  width: 100%;
  align-items: start;
}

.sheet-panel {
  display: grid;
  gap: 1rem;
  width: 100%;
}

.sheet-defaults-panel,
.sheet-review-panel {
  width: 100%;
}

.sheet-panel,
.sheet-defaults-panel,
.sheet-review-panel {
  min-width: 0;
}

.sheet-panel__header {
  margin-bottom: 0;
}

.sheet-panel__header .hint {
  max-width: 38rem;
}

.sheet-actions {
  margin-bottom: 0;
}

.sheet-defaults-panel {
  display: grid;
  gap: 1rem;
}

.sheet-defaults-panel.is-collapsed {
  gap: 0;
}

.sheet-defaults-panel__body {
  display: grid;
  gap: 1rem;
}

.sheet-defaults-panel__body[hidden] {
  display: none !important;
}

.sheet-inline-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.sheet-inline-header h3,
.sheet-review-card h4 {
  margin: 0;
}

.sheet-inline-header .hint {
  margin: 0.3rem 0 0;
  max-width: 48rem;
}

.sheet-column-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.7rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-soft);
}

.sheet-column-toggle__hint {
  flex: 1 1 32rem;
  min-width: 0;
  margin: 0;
  text-align: right;
  white-space: nowrap;
}

.sheet-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.sheet-toolbar__status {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  min-height: 36px;
}

.score-badge.invalid {
  background: var(--risky-bg);
  color: var(--risky-text);
}

.sheet-banner {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 1rem;
}

.sheet-banner strong,
.sheet-banner p {
  margin: 0;
}

.sheet-review-grid {
  display: grid;
  gap: 1rem;
}

.sheet-review-panel {
  display: grid;
  gap: 1rem;
}

.sheet-review-card {
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #ffffff;
}

.sheet-review-card h4 {
  margin-bottom: 0.9rem;
}

.sheet-review-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.sheet-review-card__header h4 {
  margin-bottom: 0;
}

.sheet-wrapper {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
}

.sheet-table {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.sheet-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 0.56rem 0.5rem;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--batch-header-border);
  background: var(--batch-header-bg);
  color: #284062;
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  text-align: left;
  white-space: nowrap;
}

.sheet-table tbody td {
  padding: 0.3rem;
  border-bottom: 1px solid #e7eefb;
  border-right: 1px solid #eef4ff;
  background: var(--batch-cell-bg);
  vertical-align: top;
}

.sheet-table tbody tr.is-selected td {
  background: var(--batch-selected-bg);
}

.sheet-table tbody tr.is-invalid td {
  background: #fff7f7;
}

.sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
}

.sheet-table thead .sticky-col {
  z-index: 5;
  background: var(--batch-header-bg);
}

.sheet-table tbody .sticky-col {
  background: #f8fbff;
  background-clip: padding-box;
  box-shadow: inset -1px 0 0 #e3ebfa;
}

.sheet-table tbody tr.is-selected .sticky-col {
  background: #e7f1ff;
}

.sheet-table tbody tr.is-invalid .sticky-col {
  background: #fff1f1;
}

.sticky-col--left {
  left: 0;
  min-width: 2.9rem;
}

.sticky-col--preview {
  left: 2.9rem;
  min-width: 6rem;
}

.sheet-checkbox {
  text-align: center;
  vertical-align: middle;
}

.sheet-checkbox input {
  width: 1rem;
  height: 1rem;
  display: block;
  margin: 0 auto;
}

.sheet-preview-action {
  text-align: center;
  vertical-align: middle;
}

.sheet-preview-button {
  width: 100%;
  min-height: 38px;
  padding: 0.4rem 0.6rem;
  font-size: 0.88rem;
  font-weight: 700;
}

.sheet-table input[type="text"],
.sheet-table textarea {
  min-width: 7rem;
  min-height: 38px;
  padding: 0.45rem 0.55rem;
  font-size: 0.92rem;
}

.sheet-table textarea {
  min-width: 14rem;
  min-height: 2.9rem;
  resize: vertical;
}

.sheet-col--id input {
  min-width: 7.25rem;
}

.sheet-col--type input,
.sheet-col--preset input,
.sheet-col--card_style input {
  min-width: 7rem;
}

.sheet-col--value textarea,
.sheet-table thead .sheet-col--value {
  min-width: 14rem;
}

.sheet-col--file_name input,
.sheet-col--frame_title input,
.sheet-col--frame_subtitle input {
  min-width: 8.5rem;
}

.sheet-col--foreground input,
.sheet-col--background input,
.sheet-col--gradient_from input,
.sheet-col--gradient_to input {
  min-width: 6.5rem;
}

.sheet-col--gradient_type input,
.sheet-col--dot_shape input,
.sheet-col--finder_style input {
  min-width: 7.5rem;
}

.sheet-col--logo_url input {
  min-width: 10.5rem;
}

.sheet-footnote {
  margin: -0.2rem 0 0;
  padding: 0 0.1rem;
}

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

.summary-grid--tight {
  margin-bottom: 1rem;
}

.summary-card {
  padding: 0.9rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-soft);
}

.summary-card__label {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.summary-card strong {
  font-size: 1.25rem;
}

.issue-list {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.issue-list li {
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
}

.issue-list strong {
  display: block;
  margin-bottom: 0.25rem;
}

.preview-card__placeholder {
  max-width: 16rem;
  font-weight: 600;
}

.button-stack,
.download-stack {
  display: grid;
  gap: 0.65rem;
}

.download-stack .download-link {
  width: 100%;
}

.export-status {
  display: grid;
  gap: 0.5rem;
  margin: 1rem 0;
}

.export-status p {
  margin: 0;
}

.export-status progress {
  width: 100%;
  height: 0.8rem;
  border-radius: 999px;
  overflow: hidden;
  accent-color: var(--primary);
}

.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.54);
}

.preview-modal.hidden {
  display: none;
}

.preview-dialog {
  width: min(820px, 100%);
  max-height: min(90vh, 860px);
  display: grid;
  gap: 1rem;
  padding: 1.15rem;
  border: 1px solid rgba(220, 228, 242, 0.9);
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24);
}

.preview-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.preview-dialog__header p,
.preview-dialog__meta p {
  margin: 0.3rem 0 0;
}

.preview-dialog__body {
  display: grid;
  gap: 1rem;
  min-height: 0;
}

.preview-dialog__stage {
  min-height: 22rem;
  padding: 1.1rem;
}

.preview-dialog__stage .preview-image {
  max-height: min(62vh, 32rem);
}

.preview-dialog__meta {
  display: grid;
  gap: 0.3rem;
}

@media (min-width: 980px) {
  .sheet-review-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.95fr);
  }
}

@media (min-width: 1080px) {
  .hero.app-hero .app-subtitle {
    white-space: nowrap;
  }

  .preview-dialog__body {
    grid-template-columns: minmax(0, 1fr) 240px;
    align-items: start;
  }
}

@media (max-width: 860px) {
  .sheet-toolbar {
    align-items: stretch;
  }

  .sheet-inline-header {
    align-items: stretch;
  }
}

@media (max-width: 760px) {
  .summary-grid,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .batch-toolbar__actions > *,
  .sheet-actions > *,
  .sheet-column-toggle > * {
    flex: 1 1 100%;
  }

  .sheet-column-toggle__hint {
    text-align: left;
    white-space: normal;
  }

  .sheet-inline-header > *,
  .sheet-review-grid > * {
    width: 100%;
  }

  .sheet-table {
    min-width: 60rem;
  }

  .preview-modal {
    padding: 0.75rem;
  }

  .preview-dialog {
    padding: 0.95rem;
    border-radius: 20px;
  }

  .preview-dialog__stage {
    min-height: 16rem;
  }
}
