:root {
  color-scheme: light;
  --bg: #eef5f4;
  --card: #ffffff;
  --ink: #153243;
  --muted: #5c7080;
  --line: #d6e2e1;
  --primary: #0b7a75;
  --primary-deep: #095b57;
  --soft: #ebf7f6;
  --accent: #f4b942;
  --danger: #d64545;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, #dff4ef 0, transparent 32%),
    linear-gradient(180deg, #f4fbfa 0%, var(--bg) 100%);
}

.page {
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
}

.hero,
.card {
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 14px 38px rgba(15, 23, 42, 0.06);
}

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

.hero h1 {
  margin: 4px 0 10px;
  font-size: 34px;
}

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

.eyebrow {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: #dcf2ee;
  color: var(--primary-deep);
}

.hero-actions,
.header-actions,
.dialog-actions,
.upload-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.context-actions {
  margin-bottom: 14px;
}

.btn {
  appearance: none;
  border: 0;
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #fff;
  box-shadow: 0 10px 22px rgba(11, 122, 117, 0.22);
}

.btn-soft {
  background: var(--soft);
  color: var(--primary-deep);
  border: 1px solid #cbe8e5;
}

.btn-small {
  padding: 8px 12px;
  font-size: 13px;
}

.card {
  padding: 20px;
  margin-bottom: 18px;
}

.card-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
}

.panel-head {
  margin-bottom: 14px;
}

.panel-head.inline {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.panel-head h2 {
  margin: 0 0 6px;
  font-size: 21px;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.status-good {
  background: #dff6ef;
  color: #0f6d52;
  border: 1px solid #aee3d1;
}

.status-bad {
  background: #fff1ef;
  color: #b53d31;
  border: 1px solid #f2c1ba;
}

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

.form-grid label,
.mapping-table input,
.roster-table input,
.roster-table select {
  font-size: 13px;
}

.form-grid label span {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

.span-3 {
  grid-column: span 3;
}

input[type="text"],
input[type="number"],
select,
textarea,
input[type="file"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  background: #fff;
}

textarea {
  resize: vertical;
}

.screenshot-wrap {
  min-height: 420px;
  margin-top: 14px;
  border: 2px dashed #c9dfdc;
  border-radius: 18px;
  background: linear-gradient(180deg, #f7fbfb 0%, #eef6f4 100%);
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

#screenshotPreview {
  display: block;
  max-width: 100%;
  max-height: 700px;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

.empty-state {
  text-align: center;
  max-width: 380px;
  color: var(--muted);
  line-height: 1.55;
}

.mapping-table-wrap,
.preview-table-wrap,
.roster-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.mapping-table,
.preview-table,
.roster-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.mapping-table th,
.mapping-table td,
.preview-table th,
.preview-table td,
.roster-table th,
.roster-table td {
  border-bottom: 1px solid #e5efee;
  padding: 10px 8px;
  vertical-align: top;
}

.mapping-table th,
.preview-table th,
.roster-table th {
  position: sticky;
  top: 0;
  background: #f6fbfa;
  z-index: 2;
  text-align: left;
  font-size: 12px;
  letter-spacing: 0.02em;
}

.th-action,
.col-action {
  width: 74px;
}

.mapping-table input,
.roster-table input,
.roster-table select {
  min-width: 82px;
  padding: 7px 8px;
  border-radius: 9px;
}

.roster-table .sticky-col,
.roster-table .sticky-col-2,
.roster-table .sticky-col-3,
.roster-table .sticky-col-4,
.roster-table .sticky-col-5,
.roster-table .sticky-col-6 {
  position: sticky;
  background: #fff;
  z-index: 1;
}

.roster-table th.sticky-col,
.roster-table th.sticky-col-2,
.roster-table th.sticky-col-3,
.roster-table th.sticky-col-4,
.roster-table th.sticky-col-5,
.roster-table th.sticky-col-6 {
  z-index: 3;
  background: #f6fbfa;
}

.roster-table .sticky-col { left: 0; min-width: 58px; }
.roster-table .sticky-col-2 { left: 58px; min-width: 128px; }
.roster-table .sticky-col-3 { left: 186px; min-width: 220px; }
.roster-table .sticky-col-4 { left: 406px; min-width: 220px; }
.roster-table .sticky-col-5 { left: 626px; min-width: 110px; }
.roster-table .sticky-col-6 { left: 736px; min-width: 170px; }

.token-header {
  min-width: 64px;
  text-align: center;
}

.token-cell input {
  min-width: 58px;
  text-align: center;
  text-transform: uppercase;
}

.checkbox-col {
  width: 58px;
  text-align: center;
}

.header-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.header-checkbox input {
  margin: 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.draft-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid #dbeceb;
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfefd 0%, #f0f7f6 100%);
}

.draft-status {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

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

.draft-actions input[type="text"] {
  min-width: 230px;
}

.draft-actions select {
  min-width: 220px;
}

.upload-row input[type="text"] {
  min-width: 240px;
  width: 240px;
}

.btn-danger-lite {
  color: var(--danger);
  border-color: #f0c1c1;
  background: #fff8f8;
}

.summary-item {
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, #fbfefd 0%, #eef7f6 100%);
  border: 1px solid #d6ece9;
}

.summary-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.summary-item strong {
  font-size: 24px;
}

.preview-alert {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff7dc;
  color: #8b5d00;
  border: 1px solid #f4d87b;
}

.preview-empty {
  text-align: center;
  color: var(--muted);
  padding: 24px 18px !important;
  line-height: 1.55;
}

.bulk-helper {
  margin-bottom: 14px;
}

.bulk-helper summary {
  cursor: pointer;
  font-weight: 700;
}

.bulk-helper-content {
  padding-top: 10px;
  color: var(--muted);
}

.bulk-helper pre {
  padding: 10px 12px;
  border-radius: 12px;
  background: #f5f9f8;
  border: 1px solid #dcebe8;
  overflow: auto;
}

.dialog-content pre {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f5f9f8;
  border: 1px solid #dcebe8;
  overflow: auto;
  color: var(--muted);
}

.dialog {
  border: 0;
  border-radius: 18px;
  width: min(780px, calc(100vw - 40px));
  padding: 0;
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.22);
}

.dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.dialog-content {
  padding: 20px;
}

.dialog-content h3 {
  margin-top: 0;
}

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

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

  .span-3 {
    grid-column: span 2;
  }
}

@media (max-width: 760px) {
  .page {
    padding: 14px;
  }

  .hero,
  .panel-head.inline {
    flex-direction: column;
  }

  .form-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .span-3 {
    grid-column: span 1;
  }

  .draft-toolbar {
    align-items: flex-start;
  }

  .draft-actions {
    width: 100%;
  }

  .draft-actions input[type="text"],
  .draft-actions select {
    min-width: 0;
    width: 100%;
  }
}
