/* Picsaw Editor - panel styles.
   Colours live in tokens on :root; dark values are applied either by the OS
   setting (when no explicit choice is saved) or by data-theme="dark". */

:root {
  color-scheme: light;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dfe3e8;
  --text: #1f2430;
  --text-muted: #5f6877;
  --accent: #3b63c4;
  --accent-soft: #e8eefb;
  --accent-text: #ffffff;
  --ok: #2f8f5b;
  --error: #c2413b;
  --pending: #9aa3af;
  --ok-soft: #e3f3ea;
  --error-soft: #fbe9e8;
  --warn: #9a6400;
  --warn-soft: #fdf1d8;
  --shadow: 0 1px 2px rgba(20, 24, 31, 0.06);
  /* level statistics: the design sheet's colours */
  --stat-high: #e06666;
  --stat-high-text: #1f2430;
  --stat-mid: #f4cccc;

  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;

    --bg: #15181d;
    --surface: #1c2027;
    --surface-2: #232831;
    --border: #2e343e;
    --text: #dfe3ea;
    --text-muted: #9aa3b2;
    --accent: #8aa9ef;
    --accent-soft: #253150;
    --accent-text: #10141b;
    --ok: #5cbf8a;
    --error: #e5736b;
    --pending: #6b7381;
    --ok-soft: #1d3428;
    --error-soft: #3a2224;
    --warn: #e2b154;
    --warn-soft: #3a3020;
    --shadow: none;
    --stat-high: #a94442;
    --stat-high-text: #ffffff;
    --stat-mid: #4a2b2c;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --bg: #15181d;
  --surface: #1c2027;
  --surface-2: #232831;
  --border: #2e343e;
  --text: #dfe3ea;
  --text-muted: #9aa3b2;
  --accent: #8aa9ef;
  --accent-soft: #253150;
  --accent-text: #10141b;
  --ok: #5cbf8a;
  --error: #e5736b;
  --pending: #6b7381;
  --ok-soft: #1d3428;
  --error-soft: #3a2224;
  --warn: #e2b154;
  --warn-soft: #3a3020;
  --shadow: none;
  --stat-high: #a94442;
  --stat-high-text: #ffffff;
  --stat-mid: #4a2b2c;
}

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

/* The hidden attribute must win over any display rule below (.btn, .empty...). */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
}

h1 {
  font-size: 20px;
}

h2 {
  font-size: 15px;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 56px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 600;
}

.brand-mark {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background:
    linear-gradient(var(--accent-text), var(--accent-text)) 5px 5px / 5px 5px no-repeat,
    linear-gradient(var(--accent-text), var(--accent-text)) 12px 5px / 5px 5px no-repeat,
    linear-gradient(var(--accent-text), var(--accent-text)) 5px 12px / 5px 5px no-repeat,
    var(--accent);
}

.brand-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.badge {
  flex: none;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
}

.topbar-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.switch {
  display: inline-flex;
  flex: none;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.switch button {
  padding: 4px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.switch button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.switch button[aria-checked="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.switch button:focus-visible,
.btn:focus-visible,
.nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* ---------- Layout ---------- */

.layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

.sidebar {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 210px;
  padding: 16px 12px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
}

.nav-item:hover {
  background: var(--surface-2);
}

.nav-group {
  margin: 14px 10px 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Groups of pages, a thin rule between them (the first, Overview, has no
   title). */
.nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section + .nav-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.nav-section .nav-group {
  margin: 0 10px 4px;
}

.nav-item.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 500;
}

.content {
  flex: 1;
  min-width: 0;
  max-width: 980px;
  padding: 24px 28px;
}

.lead {
  margin: 4px 0 20px;
  color: var(--text-muted);
}

.section-title {
  margin-top: 40px;
  font-size: 18px;
}

.stats-empty {
  padding-bottom: 16px;
}

/* ---------- Card ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.btn:hover {
  background: var(--surface-2);
}

/* ---------- Status list ---------- */

.status-list {
  margin: 0;
  padding: 4px 16px;
}

.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.status-row:last-child {
  border-bottom: 0;
}

.status-row dt {
  color: var(--text-muted);
}

.status-row dd {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 500;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pending);
}

.dot[data-state="ok"] {
  background: var(--ok);
}

.dot[data-state="error"] {
  background: var(--error);
}

/* ---------- User ---------- */

.user {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-left: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.user-email {
  max-width: 220px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

.btn-primary:hover {
  background: var(--accent);
  filter: brightness(1.08);
}

.btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--text-muted);
}

/* ---------- Forms ---------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}

.field > label,
.field > legend {
  padding: 0;
  font-weight: 500;
}

.field legend {
  margin-bottom: 6px;
}

.radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 16px;
  cursor: pointer;
}

input[type="text"],
input[type="email"],
input[type="file"],
select,
textarea {
  width: 100%;
  max-width: 640px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  resize: vertical;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.radio input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.actions {
  display: flex;
  gap: 8px;
}

/* ---------- Alerts ---------- */

.alert {
  margin: 16px 0;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
}

.alert-error {
  background: var(--error-soft);
  border-color: var(--error);
  color: var(--text);
}

.form-alert {
  margin: 0 16px 16px;
}

.alert-warn {
  background: var(--warn-soft);
  border-color: var(--warn);
  color: var(--text);
}

/* ---------- Tables ---------- */

.table-wrap {
  position: relative; /* holds .sr-only headers, which would widen the page */
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.table th {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--text-muted);
}

.strong {
  font-weight: 500;
}

.nowrap {
  white-space: nowrap;
}

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.pill-warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.pill-created {
  background: var(--accent-soft);
  color: var(--accent);
}

.pill-updated {
  background: var(--ok-soft);
  color: var(--ok);
}

.pill-unchanged {
  background: var(--surface-2);
  color: var(--text-muted);
}

.card + .card,
.card + .alert,
.alert + .card {
  margin-top: 16px;
}

.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.card-footer .hint {
  flex: 1;
  min-width: 200px;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 16px;
}

.empty p {
  margin: 0;
  color: var(--text-muted);
}

/* ---------- Login ---------- */

.content-center {
  display: flex;
  justify-content: center;
  max-width: none;
  padding-top: 64px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  align-self: flex-start;
}

.login-card h1 {
  font-size: 16px;
}

.login-alert {
  margin: 16px 16px 0;
}

.btn-block {
  justify-content: center;
  width: 100%;
}

/* "or" with a line on each side, between Google and the developer login. */
.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}

/* ---------- Editor ---------- */

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

.link {
  color: var(--accent);
  text-decoration: none;
}

/* Small square button holding only an icon (its aria-label says what it does). */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  vertical-align: middle;
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.icon-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
  background: transparent;
}

.icon-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.list-rename {
  margin-left: 4px;
}

/* An alert inside a card, under its header (e.g. the import replacing lists). */
.card-alert {
  margin: 12px 16px;
}

.import-removed td:first-child {
  text-decoration: line-through;
  color: var(--text-muted);
}

.replace-names {
  margin: 8px 0 0;
  padding-left: 20px;
}

/* Lists: changing the order. */
.order-cell {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.order-move {
  font-size: 14px;
  line-height: 1;
}

#lists-card.is-reordering :is(th, td):is(:nth-child(6), :nth-child(8)) {
  display: none;
}

#lists-card.is-reordering th:first-child {
  text-align: left;
}

.order-td {
  width: 1%;
  white-space: nowrap;
}

/* The new place, and under it (small) where the list was. */
.order-place {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 44px;
  margin-left: 4px;
  line-height: 1.2;
}

.order-was {
  color: var(--text-muted);
  font-size: 11px;
}

#lists-body > tr.is-reordered > td,
#campaigns-body > tr.is-reordered > td {
  background: var(--accent-soft);
}

/* Export: which lists go in (always the first N). */
.export-pick {
  width: 1%;
  white-space: nowrap;
}

.export-pick-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.export-excluded td:not(.export-pick) {
  opacity: 0.45;
}

.export-selection {
  margin: 0;
  padding: 10px 16px 12px;
  border-top: 1px solid var(--border);
}

.export-index-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 10px;
}

.export-index-key {
  min-width: 120px;
  font-weight: 600;
}

.export-index-value {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 12px;
  overflow-wrap: anywhere;
}

/* ---------- Prompts page ---------- */

.prompts-toolbar {
  flex-wrap: wrap;
  gap: 8px 12px;
}

.prompts-toolbar input[type="search"] {
  flex: 1 1 260px;
  max-width: 360px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.prompts-toolbar select {
  width: auto;
}

.prompts-count {
  flex: 1 1 auto;
}

.prompts-toolbar .actions {
  margin-left: auto;
}

/* id + marks | image | prompt; the same columns in the head and rows. */
.prompts-head,
.prompt-row {
  display: grid;
  grid-template-columns: 120px 64px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 0 16px;
}

.prompts-head {
  padding-top: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
}

.prompts-wrap {
  height: calc(100vh - 320px);
  min-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.prompts-space {
  position: relative;
}

/* height: prompts.js ROW_HEIGHT */
.prompt-row {
  position: absolute;
  left: 0;
  right: 0;
  height: 84px;
  border-bottom: 1px solid var(--border);
}

.prompt-row.is-nolevel {
  background: var(--surface-2);
}

.prompt-row.is-nolevel .prompt-thumb {
  opacity: 0.5;
}

.prompt-row.is-edited {
  background: var(--accent-soft);
}

.prompt-id {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  font-variant-numeric: tabular-nums;
}

.prompt-thumb .thumb {
  width: 48px;
  height: 72px;
}

.prompt-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

input.prompt-input {
  max-width: none;
}

.prompt-meta {
  min-height: 15px;
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.prompt-pill.prompt-nolevel {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.prompt-pill.prompt-unlisted {
  background: var(--accent-soft);
  color: var(--accent);
}

.prompt-pill.prompt-noimage {
  background: var(--warn-soft);
  color: var(--warn);
}

.prompts-ai {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.prompts-ai-text {
  flex: 1 1 260px;
  min-width: 0;
}

.prompts-ai-status {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
}

.prompts-ai-claude {
  margin: 2px 0 0;
}

.prompts-ai-problem {
  color: var(--error);
}

.prompts-ai select {
  width: auto;
}

.prompts-ai .prompts-ai-progress {
  padding: 0;
}

.prompts-ai .progress {
  background: var(--border);
}

.prompts-ai-progress,
.prompts-ai-last,
.prompts-ai-manual {
  flex: 1 1 100%;
  margin: 0;
}

.prompts-ai-manual summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
}

.prompts-ai-manual[open] summary {
  margin-bottom: 6px;
}

.prompts-ai-manual .hint {
  margin: 0 0 8px;
}

.token-steps {
  margin: 0 0 12px;
  padding-left: 20px;
  line-height: 1.7;
}

.token-cmd {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  user-select: all;
  overflow-wrap: anywhere;
}

.token-input {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

.link-btn:hover {
  text-decoration: underline;
}

.prompts-ai-limit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.prompts-ai-limit select {
  width: auto;
}

.prompt-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.prompt-line input {
  flex: 1;
  min-width: 0;
}

.prompt-actions {
  display: inline-flex;
  gap: 2px;
}

.prompt-accept {
  color: var(--success, #1a7f37);
  font-weight: 700;
}

.prompt-reject {
  font-weight: 700;
}

.prompt-row.is-suggested {
  background: color-mix(in srgb, var(--accent-soft) 55%, transparent);
}

.prompt-row.is-suggested input.prompt-input {
  border-style: dashed;
  border-color: var(--accent);
}

.prompt-pill.prompt-suggested,
.prompt-pill.prompt-ai {
  background: var(--accent);
  color: #fff;
}

.prompt-pill.prompt-ai {
  background: var(--accent-soft);
  color: var(--accent);
}

textarea.generic-text {
  max-width: none;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
}

@media (max-width: 700px) {
  .prompts-head,
  .prompt-row {
    grid-template-columns: 84px 48px minmax(0, 1fr);
    gap: 8px;
    padding: 0 10px;
  }

  .prompt-thumb .thumb {
    width: 40px;
    height: 60px;
  }
}

.add-excel {
  margin: 0 0 10px;
}

/* Import: new levels from Excel. */
.excel-lists {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 4px;
}

.excel-overwrite {
  margin-left: 16px;
}

.excel-body {
  padding: 4px 16px 12px;
}

.excel-summary {
  margin-top: 12px;
}

.excel-facts {
  margin: 10px 0;
}

.excel-subtitle {
  margin-top: 16px;
}

.excel-tax .tax-report-counts {
  margin-bottom: 6px;
}

.import-extra {
  padding: 4px 16px 12px;
  border-top: 1px solid var(--border);
}

.import-extra-title {
  margin: 10px 0 6px;
  font-size: 14px;
}

.import-campaigns,
.import-notes {
  margin: 0;
  padding-left: 20px;
}

.import-campaigns .pill {
  margin-left: 6px;
}

.import-notes {
  margin-top: 8px;
  color: var(--text-muted);
}

.list-loop-label {
  margin-top: 10px;
}

input.list-loop-input {
  max-width: 160px;
}

select.campaign-select {
  width: auto;
  min-width: 220px;
}

.campaign-default {
  margin-left: 8px;
}

.list-warnings-option {
  margin-top: 6px;
}

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

.btn-danger {
  border-color: var(--error);
  color: var(--error);
}

.btn-danger:hover {
  background: var(--error-soft);
}

.page-editor .content,
.page-history .content,
.page-collection .content,
.page-ids .content {
  max-width: none;
}

.editor-sticky {
  position: sticky;
  top: 56px;
  z-index: 5;
  margin: -24px -28px 0;
  padding: 16px 28px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.editor-sticky .alert {
  margin: 10px 0 0;
}

.editor-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.editor-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.list-select {
  width: auto;
  font-weight: 600;
}

.editor-save {
  display: flex;
  align-items: center;
  gap: 8px;
}

.change-count {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 13px;
  font-weight: 500;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 12px;
}

.tool-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

input.search {
  width: 220px;
}

.selection-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.move-form {
  display: flex;
  align-items: center;
  gap: 6px;
}

input.move-input {
  width: 80px;
}

.editor-card {
  margin-top: 16px;
}

.level-table {
  table-layout: fixed;
  min-width: 860px;
}

.level-table .w-check,
.level-table .w-handle { width: 34px; }
/* The order column widens when two statistics periods are compared: their
   names and positions sit left of the row number. Sticky offsets follow it.
   --compare-w is all the width comparing adds: that and the period column. */
.level-table { --index-w: 108px; --compare-w: 0px; }
.level-table.show-compare { --index-w: 212px; --compare-w: 184px; }
.level-table .w-index { width: var(--index-w); }
.level-table .w-thumb { width: 84px; }
.level-table .w-asset { width: 14%; }
.level-table .w-size { width: 9%; }
.level-table .w-num { width: 8%; }
.level-table .w-diff { width: 9%; }
.level-table .w-secret { width: 11%; }
.level-table .w-warn { width: 12%; }

.level-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  /* opaque, so cells sliding under the sticky columns do not show through */
  background: var(--surface);
}

/* The table scrolls inside its own box (down and sideways), so the header
   row and the first columns can stay in view while the statistics columns
   make it wider than the screen.
   --editor-sticky-h (the sticky toolbar's height, set by editor.js) lives on
   this box and is not inherited: a custom property changing on an element
   that every cell inherits from restyles the whole table (with all columns
   on, about 140,000 elements and half a second for each selection change). */
@property --editor-sticky-h {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

.level-table-wrap {
  overflow: auto;
  max-height: calc(100vh - 100px - var(--editor-sticky-h, 0px));
  min-height: 320px;
  border-radius: var(--radius);
}

.level-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  box-shadow: inset 0 -1px 0 var(--border);
}

/* Selection, handle, number, image and asset stay at the left. */
.level-table .col-check,
.level-table .col-handle,
.level-table .col-index,
.level-table .col-thumb,
.level-table .col-asset {
  position: sticky;
  z-index: 1;
}

.level-table th.col-check,
.level-table th.col-handle,
.level-table th.col-index,
.level-table th.col-thumb,
.level-table th.col-asset {
  z-index: 3;
}

.level-table .col-check { left: 0; }
.level-table .col-handle { left: 34px; }
.level-table .col-index { left: 68px; }
.level-table .col-thumb { left: calc(68px + var(--index-w)); }
.level-table .col-asset { left: calc(152px + var(--index-w)); }

.level-table.show-stats .col-asset {
  box-shadow: inset -1px 0 0 var(--border);
}

.level-table.show-stats th.col-asset {
  box-shadow: inset -1px -1px 0 var(--border);
}

/* With statistics the other columns get fixed widths and the table its
   full width; the box scrolls sideways when the screen is narrower. */
.level-table.show-stats { min-width: calc(1660px + var(--compare-w)); }
.level-table.show-stats.show-durations { min-width: calc(2180px + var(--compare-w)); }
.level-table.show-stats .w-asset { width: 110px; }
.level-table.show-stats .w-size { width: 76px; }
.level-table.show-stats .w-num { width: 76px; }
.level-table.show-stats .w-diff { width: 104px; }
.level-table.show-stats .w-secret { width: 104px; }
.level-table.show-stats .w-warn { width: 96px; }
/* Periods with the level's card count and duration: room for a period
   name next to them. */
.level-table.show-stats.show-level-periods { min-width: calc(1740px + var(--compare-w)); }
.level-table.show-stats.show-durations.show-level-periods { min-width: calc(2260px + var(--compare-w)); }
.level-table.show-level-periods .w-size,
.level-table.show-level-periods .w-time { width: 116px; }
.level-table .w-stat { width: 94px; }
.level-table .w-period { width: 80px; }
.level-table .w-dur { width: 64px; }

.level-table .stat-col,
.level-table .stat-cell {
  padding-left: 6px;
  padding-right: 10px;
}

.level-table th.stat-col {
  white-space: normal;
  line-height: 1.25;
  font-size: 12px;
  cursor: help;
}

.level-table th.dur-head,
.level-table .dur-cell {
  background: var(--surface-2);
}

.stat-cell {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.stat-cell.stat-block {
  font-weight: 600;
  color: var(--accent);
}

.stat-others {
  display: inline-block;
  padding: 0 4px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11px;
  cursor: help;
}

/* Two periods: one line each, the second coloured by its change, with a
   rule between them. */
.stat-line + .stat-line {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

/* The period column: which line belongs to which period. */
.level-table th.period-head {
  text-align: left;
}

.period-cell .stat-line {
  overflow: hidden;
  color: var(--text-muted);
  text-overflow: ellipsis;
}

.stat-line.is-better {
  color: var(--ok);
  font-weight: 600;
}

.stat-line.is-worse {
  color: var(--error);
  font-weight: 600;
}

/* Where the asset was played in each compared period, left of the number. */
.period-pos {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  margin-right: 6px;
  vertical-align: middle;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  cursor: help;
}

.period-line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.period-line + .period-line {
  padding-top: 3px;
  border-top: 1px solid var(--border);
}

/* Long period names are cut; the cell's tooltip has them whole. */
.period-name {
  max-width: 52px;
  overflow: hidden;
  color: var(--text-muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.period-index {
  min-width: 40px;
  padding: 0 4px;
  border-radius: 4px;
  color: var(--text-muted);
}

.period-index.stat-high {
  background: var(--stat-high);
  color: var(--stat-high-text);
}

.period-index.stat-mid {
  background: var(--stat-mid);
  color: var(--text);
}

.stats-legend {
  color: var(--text-muted);
  font-size: 13px;
  white-space: nowrap;
  cursor: help;
}

/* The sheet's colour on the order cell (stronger than hover/selected). */
.row td.col-index.stat-high {
  background: var(--stat-high);
  color: var(--stat-high-text);
}

.row td.col-index.stat-mid {
  background: var(--stat-mid);
}

/* One line: "Statistics [period] [Durations]", like the other tool groups. */
.stats-tools {
  flex-wrap: nowrap;
  align-items: center;
}

.stats-tools label {
  margin: 0;
  color: var(--text-muted);
  white-space: nowrap;
}

.stats-tools select {
  width: auto;
  max-width: 200px;
}

.level-table th,
.level-table td {
  padding: 6px 12px;
}

.level-table td {
  height: 100px;
  font-size: 15px;
}

.level-table .col-check,
.level-table .col-handle {
  padding-right: 0;
}

.level-table .col-index {
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.thumb {
  display: block;
  width: 58px;
  height: 88px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  background:
    linear-gradient(135deg, transparent 46%, var(--border) 46%, var(--border) 54%, transparent 54%),
    var(--surface-2);
}

.handle {
  display: inline-block;
  padding: 2px 4px;
  color: var(--text-muted);
  letter-spacing: -2px;
  cursor: grab;
  user-select: none;
}

.row:hover td {
  background: var(--surface-2);
}

.row.is-selected td {
  background: var(--accent-soft);
}

.row td:first-child {
  box-shadow: inset 3px 0 0 transparent;
}

.row.is-moved td:first-child {
  box-shadow: inset 3px 0 0 var(--warn);
}

.row.is-edited td:first-child {
  box-shadow: inset 3px 0 0 var(--ok);
}

.row.is-new td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.cell {
  cursor: text;
  white-space: nowrap;
}

.cell.is-changed {
  color: var(--ok);
  font-weight: 600;
}

/* Off the difficulty cycle (one range warning per list; see levels.js). */
.cell.is-off-order {
  box-shadow: inset 0 0 0 2px var(--warn);
}

.cell.is-invalid {
  background: var(--error-soft) !important;
  box-shadow: inset 0 0 0 1px var(--error);
}

.cell.is-editing {
  padding: 2px 4px;
}

.cell-input {
  width: 100%;
  min-width: 0;
  max-width: none;
  padding: 4px 6px;
}

.cell-input[aria-invalid="true"] {
  border-color: var(--error);
  outline-color: var(--error);
}

.tag-new {
  font-size: 11px;
}

/* ▲/▼ places moved since the saved version, left of the row number. */
.row-move {
  margin-right: 6px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.row-move.is-up {
  color: var(--ok);
}

.row-move.is-down {
  color: var(--error);
}

/* On the red churn background the arrow alone tells the direction. */
.row td.col-index.stat-high .row-move {
  color: inherit;
}

.pill-diff-H {
  background: var(--warn-soft);
  color: var(--warn);
}

.pill-diff-SH {
  background: var(--error-soft);
  color: var(--error);
}

.pill-diff-UH {
  background: var(--error);
  color: var(--surface);
}

/* PMs review levels ten at a time: a heavier line after every 10th level
   (10, 20, 30...), the same blocks as the statistics averages. By position
   in the list (editor.js sets the class), so it stays put when levels move. */
#level-rows > tr.block-end > td {
  border-bottom: 3px solid var(--text-muted);
}

/* The list's loop starts at this level (Lists page). */
/* A shadow, not a border: it must also show where a block line (the
   heavier bottom border after level 400) meets it. */
#level-rows > tr.loop-start > td {
  box-shadow: inset 0 3px 0 var(--accent);
}

#level-rows > tr.loop-start > td.col-index::before {
  content: "↻";
  margin-right: 4px;
  color: var(--accent);
  font-weight: 700;
}

/* Stand-ins for the rows that are not in the page; their height is set by
   editor.js. */
.level-table .row-spacer td {
  height: 0;
  padding: 0;
  border: 0;
  background: none;
}

.row.drop-before td {
  box-shadow: inset 0 3px 0 var(--accent);
}

.row.drop-after td {
  box-shadow: inset 0 -3px 0 var(--accent);
}

.row.is-dragging {
  opacity: 0.4;
}

@keyframes flash {
  from {
    background: var(--warn-soft);
  }
}

.row.flash td {
  animation: flash 1.4s ease-out;
}

.editor-hint {
  margin-top: 12px;
}

/* ---------- Dialog & toast ---------- */

.modal {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.modal::backdrop {
  background: rgba(10, 12, 16, 0.45);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 18px 20px;
}

.modal-body h2 {
  font-size: 16px;
}

.modal-body p {
  margin: 0;
}

.modal-label {
  font-weight: 500;
}

/* The first action is the default (Enter); it is shown on the right. */
.modal-actions {
  display: flex;
  flex-direction: row-reverse;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.summary-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.summary-list li {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
}

.summary-list strong {
  color: var(--text);
  font-size: 18px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 32px));
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--text);
  color: var(--bg);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.toast-error {
  background: var(--error);
  color: #fff;
}

/* ---------- Thumbnails & image viewer ---------- */

.thumb-button {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  cursor: zoom-in;
}

.thumb-button:hover .thumb {
  border-color: var(--accent);
}

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

.thumb.thumb-sm {
  flex: none;
  width: 30px;
  height: 46px;
  border-radius: 4px;
}

img.thumb {
  background: var(--surface-2);
}

.thumb.is-missing {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--error);
  background: var(--error-soft);
  color: var(--error);
  font-size: 11px;
}

.image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, transparent 49.6%, var(--border) 49.6%, var(--border) 50.4%, transparent 50.4%),
    var(--surface-2);
  color: var(--text-muted);
  text-align: center;
}

.viewer {
  width: fit-content;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

.viewer::backdrop {
  background: rgba(10, 12, 16, 0.7);
}

.viewer-body {
  display: grid;
  grid-template-columns: auto 280px;
  gap: 20px;
  padding: 20px;
}

.viewer-image {
  display: flex;
  align-items: center;
  justify-content: center;
  height: min(calc(100vh - 112px), 1024px);
  aspect-ratio: 21 / 32; /* 672 x 1024 */
  min-width: 0;
}

.image-full {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 6px;
  background: var(--surface-2);
}

.image-placeholder.is-missing {
  border-color: var(--error);
  background: var(--error-soft);
  color: var(--error);
}

.viewer-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.viewer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.viewer-head h2 {
  font-size: 22px;
}

.viewer-head p {
  margin: 2px 0 0;
}

.viewer-details {
  margin: 0;
}

.viewer-mode {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.viewer-mode .hint {
  margin: 0;
}

/* Shuffled board: drawn at the art's own size, scaled down to fit. */
.image-shuffled {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
}

.viewer-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}

.viewer-row dt {
  color: var(--text-muted);
}

.viewer-row dd {
  margin: 0;
  font-weight: 500;
}

/* Size and seed as controls in the shuffled view. */
.viewer-row-edit {
  align-items: center;
}

.viewer-row-edit dd {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.viewer-row-edit select.viewer-input {
  width: auto;
  padding: 4px 8px;
}

.viewer-stepper {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.viewer-stepper .btn {
  justify-content: center;
  width: 30px;
  padding: 3px 0;
  text-align: center;
}

input.viewer-seed {
  width: 64px;
  padding: 4px 6px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

input.viewer-seed[aria-invalid="true"] {
  border-color: var(--error);
}

.viewer-saved {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
}

.viewer-edit-hint {
  margin: 6px 0 0;
}

.viewer-issue {
  display: block;
  margin: 0 0 6px;
  white-space: normal;
}

.viewer-nav {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

/* ---------- Change panel (diff) ---------- */

.modal-wide {
  width: min(900px, calc(100vw - 32px));
}

.modal-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(62vh, 640px);
  overflow-y: auto;
}

.modal-wide .modal-content {
  padding-right: 4px;
}

.modal-footer {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-footer:empty {
  display: none;
}

.modal-footer input {
  max-width: none;
}

.diff {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.diff-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.diff-group summary {
  padding: 8px 12px;
  font-weight: 500;
  cursor: pointer;
}

.diff-items {
  margin: 0;
  padding: 0 12px 8px;
  list-style: none;
}

.diff-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}

.diff-asset {
  min-width: 56px;
  font-weight: 600;
}

.diff-desc {
  color: var(--text-muted);
}

.diff-desc del {
  color: var(--error);
}

.diff-desc strong {
  color: var(--ok);
}

.diff-pos {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.diff-more {
  padding: 0 12px 10px;
}

/* "Add levels" panel (addlevels.js). */
.add-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.add-subtitle {
  margin: 4px 0 0;
  font-size: 14px;
}

.add-range {
  font-weight: 500;
}

.add-range:empty,
.add-error:empty,
.add-diffs {
  white-space: pre-line;
}

.add-dupes:empty,
.add-diffs:empty {
  display: none;
}

.add-error {
  color: var(--error);
}

.add-grid input[aria-invalid="true"] {
  border-color: var(--error);
}

/* Warnings above the change summary in the save panel (savewarnings.js). */
.save-warnings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--warn);
  border-radius: var(--radius);
  background: var(--warn-soft);
}

.save-warn-title {
  margin: 0;
  color: var(--warn);
  font-size: 15px;
}

.save-warnings .diff-group {
  background: var(--surface);
}

/* A whole row is the button: it closes the panel and goes to the level. */
.warn-item {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--border);
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.warn-item:hover {
  background: var(--surface-2);
}

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

.warn-new {
  flex: none;
  min-width: 40px;
}

.warn-item .diff-pos {
  min-width: 52px;
}

.warn-other {
  justify-content: space-between;
}

.save-warn-cleared {
  color: var(--ok);
  font-weight: 500;
}

.save-warn-quiet {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pill-added {
  background: var(--accent-soft);
  color: var(--accent);
}

.pill-removed {
  background: var(--error-soft);
  color: var(--error);
}

.pill-edited {
  background: var(--ok-soft);
  color: var(--ok);
}

.pill-moved {
  background: var(--warn-soft);
  color: var(--warn);
}

.badges {
  display: inline-flex;
  gap: 4px;
  white-space: nowrap;
}

/* ---------- History ---------- */

.history .editor-head {
  margin-bottom: 4px;
}

.history-table tr.is-latest td {
  background: var(--surface-2);
}

.history-table tr.is-compared td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.latest-tag {
  margin-left: 8px;
}

.author-cell {
  max-width: 220px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.note-cell {
  min-width: 160px;
}

.note-cell .note-text {
  display: block;
  margin-top: 2px;
}

.actions-cell {
  white-space: nowrap;
  text-align: right;
}

.action-slot {
  display: inline-block;
  min-width: 150px;
  text-align: right;
}

.action-slot + .action-slot {
  min-width: 140px;
  margin-left: 6px;
}

.compare-header {
  flex-wrap: wrap;
}

.compare-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.compare-form select {
  width: auto;
}

.compare-body {
  padding: 16px;
}

.compare-title {
  margin: 0 0 12px;
  font-weight: 600;
}

/* ---------- Export page ---------- */

.export-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
}

textarea.export-text {
  max-width: none;
  word-break: break-all;
}

/* ---------- Images page ---------- */

.path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  word-break: break-all;
  text-align: right;
}

.scan-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 0;
}

.progress {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}

.scan-details {
  padding: 0 16px 12px;
}

.scan-details summary {
  cursor: pointer;
  font-weight: 500;
}

.file-list {
  max-height: 240px;
  margin: 8px 0 0;
  padding-left: 18px;
  overflow-y: auto;
  font-size: 13px;
}

/* Drive card on the images page */

.card-hint {
  padding: 12px 16px 0;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
}

.drive-folders td {
  vertical-align: top;
}

.col-actions {
  width: 1%;
  text-align: right;
  white-space: nowrap;
}

.drive-add {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.drive-add input {
  flex: 1;
  min-width: 0;
  max-width: none;
}

.drive-result {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  text-align: right;
}

.drive-result .badges,
.status-row dd > .badges {
  flex-wrap: wrap;
  justify-content: flex-end;
  white-space: normal;
}

.missing-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px;
}

.missing-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}

.chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Art Collection categories and level tags ---------- */

.level-table .w-cat { width: 170px; }
.level-table .w-tags { width: 200px; }
.level-table.show-taxonomy { min-width: 1240px; }
.level-table.show-taxonomy.show-stats { min-width: calc(2030px + var(--compare-w)); }
.level-table.show-taxonomy.show-stats.show-durations { min-width: calc(2550px + var(--compare-w)); }

/* Secret and locked hidden. With statistics every column has a fixed width
   and the minimum width is their sum, 180px less now; without them the
   share they had goes to the other level columns. Extra width spread over
   fixed columns would move them off their sticky offsets. */
.level-table.hide-optional:not(.show-stats) .w-asset { width: 17%; }
.level-table.hide-optional:not(.show-stats) .w-size { width: 11%; }
.level-table.hide-optional:not(.show-stats) .w-num { width: 10%; }
.level-table.hide-optional:not(.show-stats) .w-diff { width: 12%; }
.level-table.hide-optional:not(.show-stats) .w-warn { width: 16%; }
.level-table.hide-optional.show-stats { min-width: calc(1480px + var(--compare-w)); }
.level-table.hide-optional.show-stats.show-durations { min-width: calc(2000px + var(--compare-w)); }
.level-table.hide-optional.show-taxonomy.show-stats { min-width: calc(1850px + var(--compare-w)); }
.level-table.hide-optional.show-taxonomy.show-stats.show-durations { min-width: calc(2370px + var(--compare-w)); }

.level-table.show-taxonomy .col-asset {
  box-shadow: inset -1px 0 0 var(--border);
}

.level-table.show-taxonomy th.col-asset {
  box-shadow: inset -1px -1px 0 var(--border);
}

.level-table .tax-cell {
  padding-left: 8px;
  padding-right: 8px;
  white-space: normal;
  cursor: pointer;
}

.level-table .tax-cell:hover {
  background: var(--surface-2);
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 2px 9px 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13px;
  line-height: 1.4;
  vertical-align: middle;
}

.cat-chip.is-planned {
  border-style: dashed;
  color: var(--text-muted);
}

.cat-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* One dot per Unity colour group (the importer's GroupPanelSuffix). */
.cat-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--pending);
}

.cat-dot.c-blue { background: #4a7bd8; }
.cat-dot.c-blue_2 { background: #23408e; }
.cat-dot.c-green { background: #43a047; }
.cat-dot.c-green_2 { background: #1fa59a; }
.cat-dot.c-objects { background: #d63384; }
.cat-dot.c-orange { background: #f08c2e; }
.cat-dot.c-pattern { background: #2e6b3a; }
.cat-dot.c-pink { background: #8e44ad; }
.cat-dot.c-purple { background: #c2178f; }
.cat-dot.c-red { background: #e05252; }
.cat-dot.c-yellow { background: #e6b800; }

.cat-first {
  margin-top: 4px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Where a category is complete in the list: green, next to the blue
   "opens". */
.cat-last {
  margin-top: 4px;
  color: var(--ok);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag-chip {
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
}

.tax-add {
  color: var(--text-muted);
  opacity: 0.35;
}

.row:hover .tax-add {
  opacity: 1;
}

/* Rows the filter leaves out: faded content, opaque cells (they slide under
   the sticky columns). */
.row.tax-dim td > * {
  opacity: 0.3;
}

.row.tax-dim td {
  color: var(--text-muted);
}

/* Switch buttons (category & tags, durations) show when they are on. */
.btn[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.tax-tools {
  flex-wrap: nowrap;
  align-items: center;
}

.tax-tools select {
  width: auto;
  max-width: 240px;
}

.tax-pop {
  position: fixed;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: 300px;
  max-width: calc(100vw - 16px);
  max-height: 440px; /* lowered to the room next to the cell */
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.tax-pop-head {
  padding: 0 2px 8px;
  font-size: 13px;
  font-weight: 600;
}

input.tax-pop-search {
  width: 100%;
  max-width: none;
}

.tax-pop-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-height: 0;
  margin-top: 6px;
  overflow-y: auto;
}

.tax-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.tax-option:hover,
.tax-option.is-active {
  background: var(--accent-soft);
}

.tax-option.is-current {
  font-weight: 500;
}

.tax-option .cat-chip {
  min-width: 0;
}

.tax-option-trail {
  display: flex;
  flex: none;
  gap: 6px;
  margin-left: auto;
}

.tax-option-count {
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.tax-option-check {
  color: var(--accent);
}

.tax-check input {
  margin: 0;
}

.tax-check.is-changed {
  background: var(--warn-soft);
}

.tax-create {
  color: var(--accent);
}

.tax-pop-empty {
  padding: 6px 8px;
}

.tax-pop-foot,
.tax-pop-actions {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.tax-pop-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tax-pop-actions .hint {
  flex: 1;
  font-size: 12px;
}

.toast-action {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toast-button {
  flex: none;
  padding: 2px 10px;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

/* Import page */

.tax-summary {
  grid-template-columns: repeat(5, 1fr);
  padding: 12px 16px;
}

.tax-report {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
}

.tax-report .scan-details {
  padding: 0;
}

/* Flex items would otherwise grow to their table's width on phones. */
.tax-report > * {
  min-width: 0;
}

.tax-detail-table {
  max-height: 320px;
  margin-top: 8px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.tax-detail-table .table th,
.tax-detail-table .table td {
  padding: 5px 10px;
  font-size: 13px;
}

/* Art Collection page */

.col-cats-head {
  flex-wrap: wrap;
}

.col-head-actions {
  flex-wrap: wrap;
  align-items: center;
}

.col-head-actions select {
  width: auto;
  max-width: 220px;
}

.col-cats td,
.col-tags td {
  vertical-align: top;
}

.col-cats .cat-chip {
  max-width: 260px;
}

/* A category's assets, opened from its asset count. */
.col-assets-toggle {
  padding: 2px 8px;
  font-variant-numeric: tabular-nums;
}

.col-assets-row td {
  padding-top: 0;
  background: var(--surface-2);
}

.col-assets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 0 4px;
}

.col-asset-chip {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto auto;
  column-gap: 8px;
  align-items: center;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}

.col-asset-chip:hover {
  border-color: var(--accent);
}

.col-asset-chip .thumb-sm {
  grid-row: 1 / span 3;
}

.col-asset-id {
  font-weight: 600;
}

.col-asset-pos {
  color: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.col-asset-chip.is-out {
  border-style: dashed;
  opacity: 0.75;
}

.col-asset-chip .cat-first,
.col-asset-chip .cat-last {
  margin-top: 0;
}

.col-empty {
  padding-bottom: 16px;
}

.col-form {
  gap: 12px;
  padding: 0;
}

.col-form .field {
  min-width: 0;
}

.col-form input,
.col-form select {
  max-width: none;
}

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

.ux-steps {
  overflow-wrap: anywhere; /* long Unity paths on phones */
  margin: 0;
  padding-left: 20px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

/* ---------- Narrow screens ---------- */

@media (max-width: 720px) {
  .topbar {
    padding: 0 16px;
  }

  .layout {
    flex-direction: column;
  }

  .sidebar {
    flex-direction: row;
    width: auto;
    padding: 8px 16px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .nav-item {
    flex: none;
    gap: 6px;
  }

  .nav-group {
    display: none;
  }

  .nav-section {
    flex: none;
    flex-direction: row;
  }

  .nav-section + .nav-section {
    margin: 0 0 0 6px;
    padding: 0 0 0 6px;
    border-top: 0;
    border-left: 1px solid var(--border);
  }

  .content {
    padding: 20px 16px;
  }

  .user-email {
    display: none;
  }

  .editor-sticky {
    position: static;
    margin: -20px -16px 0;
    padding: 12px 16px;
  }

  /* Phones: the page scrolls down, the table only sideways. */
  .level-table-wrap {
    overflow-x: auto;
    max-height: none;
    min-height: 0;
  }

  .level-table th {
    position: static;
  }

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

  .tax-tools,
  .stats-tools {
    flex-wrap: wrap;
  }

  .viewer-body {
    grid-template-columns: 1fr;
  }

  .viewer-image {
    height: auto;
    width: 100%;
  }

  .diff-item {
    flex-wrap: wrap;
  }

  .user {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }
}

@media (max-width: 480px) {
  .brand-name,
  .topbar .badge {
    display: none;
  }

  .topbar-controls {
    gap: 6px;
  }

  .switch button {
    padding: 4px 8px;
  }
}

/* ---------- PicDrop ---------- */

.pd-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 -28px 16px;
  padding: 10px 28px 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
}

.tab {
  flex: none;
  padding: 8px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
}

.tab:hover {
  color: var(--text);
}

.tab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--accent);
  font-weight: 500;
}

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

.tab-count {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 400;
}

.pd-savebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 10px 0;
}

.pd-status-error {
  color: var(--error);
}

.pd-levels-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.pd-only-issues,
.pd-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
}

.pd-check {
  font-size: inherit;
}

.pd-check code,
.field label code {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 400;
}

.pd-check-hint {
  margin-top: -10px;
}

.pd-levels {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pd-level {
  margin: 0;
  padding: 12px 16px;
}

.pd-level.has-error {
  border-color: var(--error);
}

.pd-level-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.pd-level-head h3 {
  margin: 0;
  font-size: 15px;
}

.pd-level-tools {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.pd-level-tools .is-hidden {
  visibility: hidden;
}

.icon-btn.pd-danger:hover {
  color: var(--error);
}

.pd-params {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 10px 0;
}

.pd-param {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.pd-param > span:first-child {
  color: var(--text-muted);
}

.pd-size {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

input.pd-num {
  width: 64px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.pd-size input.pd-num {
  width: 48px;
}

.pd-facts {
  flex-basis: 100%;
  font-size: 12px;
}

.pd-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pd-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: grab;
}

.pd-tile.is-cover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.pd-tile.is-warn .thumb {
  outline: 2px solid var(--warn);
  outline-offset: 1px;
}

.pd-tile.is-dragging {
  opacity: 0.4;
}

.pd-tile.is-drop {
  border-color: var(--accent);
  border-style: dashed;
}

.pd-tile-id {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.pd-cover {
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.pd-tile .icon-btn {
  width: 20px;
  height: 20px;
  margin: 0;
  font-size: 11px;
}

.pd-tile-remove {
  position: absolute;
  top: 0;
  right: 0;
  border-radius: 50% !important;
  background: var(--surface) !important;
  opacity: 0;
}

.pd-tile:hover .pd-tile-remove,
.pd-tile:focus-within .pd-tile-remove,
.pd-tile:hover .pd-tile-star,
.pd-tile:focus-within .pd-tile-star {
  opacity: 1;
}

.pd-tile-star {
  opacity: 0.35;
}

.pd-flag-dot {
  position: absolute;
  top: 2px;
  left: 2px;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--warn);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.pd-strip-empty {
  padding: 8px 0;
  font-size: 13px;
}

.pd-add-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.pd-add-row input {
  flex: 1 1 240px;
  max-width: 420px;
}

.pd-issues {
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.pd-issue {
  padding: 4px 8px;
  border-left: 3px solid var(--warn);
  background: var(--warn-soft);
  font-size: 13px;
}

.pd-issue + .pd-issue {
  margin-top: 2px;
}

.pd-issue.is-error {
  border-left-color: var(--error);
  background: var(--error-soft);
}

.pd-add {
  margin: 16px 0 8px;
}

.pd-pool-toolbar {
  flex-wrap: wrap;
  gap: 8px 12px;
}

.pd-pool-toolbar input[type="search"] {
  width: 160px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.pd-pool-toolbar select {
  width: auto;
}

.pd-pool-target {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.pd-pool {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 10px;
  padding: 12px 16px;
}

.pd-pool-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.pd-pool-tile .thumb {
  width: 72px;
  height: 108px;
}

.pd-pool-tile.is-flagged {
  background: var(--warn-soft);
}

.pd-pool-tile.is-used {
  border-color: var(--accent);
}

.pd-pool-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
}

.pd-flags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px;
}

.pd-flag {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.pd-flag.is-on {
  border-color: var(--warn);
  background: var(--warn);
  color: #fff;
}

.pd-pool-add {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 0;
  padding: 0 8px;
  line-height: 24px;
}

.pd-pager {
  justify-content: center;
  gap: 12px;
}

.pd-settings code {
  margin-left: 4px;
}

.pd-numbers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.pd-numbers input {
  width: 100px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

input.is-invalid {
  border-color: var(--error);
}

.pd-unlocks {
  max-height: 120px;
  overflow-y: auto;
}

.pd-unlocks .chip {
  font-variant-numeric: tabular-nums;
}

.chip.is-warn {
  border-color: var(--warn);
  color: var(--warn);
}

.pd-history-actions {
  white-space: nowrap;
  text-align: right;
}

.pd-view-text {
  max-width: none;
  min-height: 240px;
}

.pd-export {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 16px;
}

.pd-export-row {
  display: grid;
  grid-template-columns: 220px 1fr auto;
  align-items: start;
  gap: 8px;
}

.pd-export-key {
  padding-top: 8px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.pd-export-value {
  max-width: none;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

/* A level list: sized to the whole list by the page, broken anywhere since
   the list has no spaces. */
.pd-export-list {
  min-height: 64px;
  resize: vertical;
  overflow-wrap: anywhere;
  word-break: break-all;
}

/* A value the unsaved live settings change. */
.pd-export-row.is-changed .pd-export-value {
  background: var(--warn-soft);
  border-color: var(--warn);
}

.pd-export-row.is-changed .pd-export-key::after {
  content: " ●";
  color: var(--warn);
}

.pd-panel > .card + .card {
  margin-top: 16px;
}

.pd-import-actions {
  flex-wrap: wrap;
}

.pd-preview-list {
  margin: 0 0 12px;
  padding-left: 18px;
}

.pd-preview-list li + li {
  margin-top: 4px;
}

@media (max-width: 720px) {
  .pd-bar {
    margin: 0 -16px 16px;
    padding: 8px 16px 0;
  }

  .pd-export-row {
    grid-template-columns: 1fr;
  }

  .pd-export-key {
    padding-top: 0;
  }
}

/* ---------- Special levels ---------- */

.sp-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 16px;
}

.sp-picker select {
  width: auto;
  min-width: 240px;
}

.sp-picker-label {
  font-weight: 500;
}

#sp-event-body > .card + .card {
  margin-top: 16px;
}

.sp-dates,
.sp-grid2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 16px;
}

.sp-dates input,
input.sp-num,
.pd-panel input[type="date"] {
  width: 100%;
  max-width: 240px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

input.sp-num {
  max-width: 120px;
}

.sp-notes {
  font-family: inherit;
  font-size: inherit;
}

.sp-advanced summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
}

.sp-advanced[open] summary {
  margin-bottom: 8px;
}

.sp-advanced .hint {
  margin-bottom: 10px;
}

.sp-texts {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px 16px;
}

.sp-text-row {
  display: grid;
  grid-template-columns: 150px 1fr 220px;
  align-items: center;
  gap: 8px;
}

.sp-text-row input {
  max-width: none;
}

.sp-text-row.is-warn input:first-of-type {
  border-color: var(--warn);
}

.sp-text-label {
  font-size: 13px;
}

.sp-levels td {
  padding-top: 4px;
  padding-bottom: 4px;
  vertical-align: middle;
}

.sp-levels input[type="text"] {
  padding: 4px 6px;
}

.sp-levels th,
.sp-levels td {
  padding-left: 4px;
  padding-right: 4px;
}

.sp-levels .sp-asset {
  width: 104px;
}

.sp-levels .sp-name {
  width: 100%;
  min-width: 110px;
}

.sp-levels .pd-num {
  width: 50px;
  padding: 4px;
}

.sp-levels .sp-secret {
  width: 56px;
}

.sp-levels .sp-diff {
  width: auto;
  padding: 4px 6px;
}

.sp-levels tr.is-warn td:first-child {
  box-shadow: inset 3px 0 0 var(--warn);
}

.sp-levels tr.is-error td:first-child {
  box-shadow: inset 3px 0 0 var(--error);
}

.sp-row-tools {
  white-space: nowrap;
}

.sp-row-tools .is-hidden {
  visibility: hidden;
}

.sp-level-issues,
.sp-unused {
  margin: 0;
  padding: 10px 16px;
}

.sp-unused .chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.sp-unused .icon-btn {
  width: 18px;
  height: 18px;
  margin: 0;
  font-size: 10px;
}

.sp-milestones {
  display: flex;
  flex-direction: column;
}

.sp-ms {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.sp-ms-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.sp-ms-head select {
  width: auto;
  max-width: 300px;
}

.card-header .actions {
  flex: none;
}

/* Special levels: header buttons move under the title when they don't fit. */
[data-panel] .card-header {
  flex-wrap: wrap;
}

.sp-ms-remove {
  margin-left: auto;
}

.sp-rewards {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  margin-top: 8px;
}

.sp-reward {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px 3px 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.sp-reward select {
  width: auto;
  max-width: 170px;
  padding: 3px 6px;
}

.sp-reward .icon-btn {
  margin: 0;
}

.sp-chest {
  margin-top: 8px;
}

.sp-chest summary {
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}

.sp-chest .sp-short {
  width: 140px;
  padding: 4px 6px;
}

.sp-ms .pd-issues {
  margin-top: 8px;
}

.sp-ms-issues {
  padding: 0 16px 12px;
}

.sp-deadline-text {
  margin-top: -6px;
}

.sp-export-head {
  border-top: 1px solid var(--border);
}

.sp-calendar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 16px 16px;
}

.sp-cal-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  align-items: center;
  gap: 12px;
}

.sp-cal-label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
}

.sp-cal-track {
  position: relative;
  height: 26px;
  border-radius: 6px;
  background: var(--surface-2);
}

.sp-cal-axis .sp-cal-track {
  background: none;
  height: 20px;
}

.sp-cal-month {
  position: absolute;
  top: 2px;
  padding-left: 4px;
  border-left: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  white-space: nowrap;
}

.sp-cal-today {
  position: absolute;
  top: 0;
  bottom: -6px;
  width: 2px;
  background: var(--accent);
}

.sp-cal-bar {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 4px;
  background: var(--accent);
}

.sp-cal-bar.is-planned {
  background: repeating-linear-gradient(45deg, var(--accent-soft), var(--accent-soft) 6px, var(--accent) 6px, var(--accent) 8px);
  border: 1px dashed var(--accent);
}

.sp-cal-deadline {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: var(--error);
}

.sp-cal-issues {
  padding: 0 16px 16px;
}

.sp-steps {
  margin: 0;
  padding-left: 20px;
  line-height: 1.6;
}

.sp-import-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.sp-import-row input {
  margin-top: 4px;
}

@media (max-width: 720px) {
  .sp-text-row {
    grid-template-columns: 1fr;
  }

  .sp-cal-row {
    grid-template-columns: 90px 1fr;
  }
}

/* Special levels: prompts */

.sp-body {
  padding: 12px 16px 16px;
}

.sp-body > :first-child {
  margin-top: 0;
}

.sp-pr-progress {
  margin: 0 0 8px;
}

.sp-prompts {
  display: grid;
}

.sp-pr-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0 8px 10px;
  border-bottom: 1px solid var(--border);
}

.sp-pr-row:last-child {
  border-bottom: 0;
}

.sp-pr-row .thumb {
  flex: none;
}

.sp-pr-row.is-warn {
  box-shadow: inset 3px 0 0 var(--warn);
}

.sp-pr-main {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 6px;
}

.sp-pr-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.sp-pr-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sp-pr-line .sp-pr-input {
  flex: 1;
  min-width: 0;
}

.sp-pr-row.is-empty .sp-pr-input {
  border-style: dashed;
}

.sp-pr-count {
  flex: none;
  min-width: 2.5ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sp-pr-count.is-over {
  color: var(--warn);
}

.sp-pr-ai {
  font-size: 11px;
  padding: 0 6px;
}

/* Special levels: event images from Drive */

.sp-art-folders {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.sp-art-folder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}

.sp-art-folder > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sp-art-folder.is-warn {
  border-color: var(--warn);
  background: var(--warn-soft);
}

.sp-art-add {
  display: flex;
  gap: 8px;
}

.sp-art-add input {
  flex: 1;
  min-width: 0;
}

/* Special levels: AI prompts */

.sp-ai {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.sp-ai .actions {
  flex-wrap: wrap;
}

.sp-ai select {
  width: auto;
}

.sp-ai p {
  margin: 0;
}

.sp-pr-sug {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 6px 8px;
  border-radius: var(--radius);
  background: var(--accent-soft);
}

.sp-pr-sug-text {
  flex: 1 1 200px;
  min-width: 0;
}

.sp-pr-sug-actions {
  display: flex;
  gap: 4px;
}

/* Special levels: AI names (card titles under the level's name, badge names) */
.sp-names-body {
  padding-bottom: 0;
}

.sp-names-body .sp-ai {
  margin-bottom: 0;
}

.sp-name-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.sp-name-sug {
  padding: 3px 6px;
  gap: 4px 6px;
  font-size: 12px;
}

.sp-name-sug .sp-pr-sug-text {
  flex: 1 1 80px;
  font-weight: 600;
}

.sp-name-sug .btn {
  padding: 2px 6px;
  font-size: 12px;
}

.sp-badge-name {
  width: 180px;
}

/* Special levels: to Unity */

.sp-checks {
  list-style: none;
  margin: 8px 0 16px;
  padding: 0;
  display: grid;
  gap: 6px;
}

.sp-check {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.sp-check-mark {
  flex: none;
  width: 1.4em;
  height: 1.4em;
  line-height: 1.4em;
  text-align: center;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
}

.sp-check.is-ok .sp-check-mark {
  background: var(--ok-soft);
  color: var(--ok);
}

.sp-check.is-warn .sp-check-mark {
  background: var(--warn-soft);
  color: var(--warn);
}

.sp-subtitle {
  font-size: 14px;
  margin: 0 0 6px;
}

#sp-unity-steps li {
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.sp-warn-text {
  color: var(--warn);
}

/* ---------- Main menu (journey pictures) ---------- */

.mm-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  justify-content: flex-start;
}

.mm-toolbar input[type="search"] {
  flex: 1 1 220px;
  min-width: 0;
  max-width: 360px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.mm-toolbar select {
  width: auto;
}

.mm-issues {
  margin: 0 16px 12px;
  max-height: 180px;
  overflow: auto;
}

.mm-legend {
  margin: 0 16px 12px;
}

.mm-from-art {
  margin: 0 16px 12px;
}

.mm-legend summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
}

.mm-legend-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.mm-table {
  min-width: 860px;
}

.mm-table td {
  vertical-align: top;
}

.mm-thumb .thumb {
  width: 48px;
  height: 64px;
}

.mm-table .mm-title {
  width: 100%;
  min-width: 160px;
}

.mm-table .mm-key {
  width: 100%;
  min-width: 150px;
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 13px;
}

.mm-levels {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.mm-rewards {
  min-width: 220px;
}

.mm-rewards-input {
  width: 100%;
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 13px;
}

.mm-rewards-input.is-invalid {
  border-color: var(--error);
  background: var(--error-soft);
}

.mm-reward-view {
  margin-top: 4px;
  font-size: 12px;
}

.mm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mm-chip {
  padding: 0 8px;
  font-size: 12px;
  background: var(--surface-2);
}

.mm-chip-coin { border-color: var(--warn); }
.mm-chip-life { border-color: var(--error); }
.mm-chip-multiplier { border-color: var(--accent); }

.mm-bad {
  color: var(--error);
}

.mm-row td:first-child {
  box-shadow: inset 3px 0 0 transparent;
}

.mm-row.is-warn td:first-child {
  box-shadow: inset 3px 0 0 var(--warn);
}

.mm-row.has-error td:first-child {
  box-shadow: inset 3px 0 0 var(--error);
}

.mm-row.is-out td {
  background: var(--surface-2);
}

.mm-row.is-out .mm-thumb,
.mm-row.is-out .mm-id {
  opacity: 0.6;
}

.mm-footer,
.mm-titles-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.mm-titles-file {
  justify-content: space-between;
}

a.btn.is-disabled {
  pointer-events: none;
  opacity: 0.5;
}

@media (max-width: 720px) {
  .mm-issues,
  .mm-from-art,
  .mm-legend {
    margin-left: 12px;
    margin-right: 12px;
  }
}

/* ---------- Görsel ekle (intake) ---------- */

.in-target {
  display: grid;
  gap: 14px;
  padding: 14px 16px 16px;
}

.in-seg {
  display: inline-flex;
  width: fit-content;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.in-seg-item {
  position: relative;
}

.in-seg-item input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.in-seg-item span {
  display: block;
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.in-seg-item input:checked + span {
  background: var(--surface);
  box-shadow: var(--shadow), 0 0 0 1px var(--border);
  color: var(--accent);
  font-weight: 600;
}

.in-seg-item input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.in-seg-item input:disabled + span {
  cursor: not-allowed;
  opacity: 0.6;
}

.in-field {
  display: grid;
  gap: 6px;
}

.in-field > label {
  font-size: 13px;
  font-weight: 500;
}

.in-field .hint {
  margin: 0;
}

.in-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.in-inline select,
.in-inline input[type="text"] {
  flex: 0 1 460px;
  width: auto;
  min-width: 220px;
  max-width: 100%;
}

.in-first {
  flex: 0 0 140px !important;
  width: 140px;
  min-width: 0 !important;
  font-variant-numeric: tabular-nums;
}

.in-warn-text {
  color: var(--warn);
}

.in-drop {
  position: relative;
}

.in-inbox {
  display: grid;
  gap: 8px;
  padding: 12px 16px 0;
}

.in-inbox .hint {
  margin: 0;
}

.in-uploading {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px 0;
}

.in-empty {
  padding: 36px 16px;
  text-align: center;
}

.in-empty p {
  margin: 4px 0;
}

.in-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 12px;
  margin: 0;
  padding: 14px 16px;
  list-style: none;
}

.in-grid:empty {
  display: none;
}

.in-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: grab;
}

.in-tile.is-done {
  cursor: default;
  background: var(--ok-soft);
  border-color: transparent;
}

.in-tile.is-clash,
.in-tile.is-failed {
  border-color: var(--warn);
}

.in-tile.is-dragging {
  opacity: 0.4;
}

.in-tile.is-drop {
  border-color: var(--accent);
  border-style: dashed;
}

.in-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 672 / 1024;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: var(--surface-2);
  overflow: hidden;
  cursor: zoom-in;
}

.in-frame:disabled {
  cursor: default;
}

.in-frame img {
  position: absolute;
  max-width: none;
  height: auto;
  user-select: none;
}

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

.in-id {
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.in-tile.is-clash .in-id {
  color: var(--warn);
}

.in-name {
  overflow: hidden;
  color: var(--text-muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.in-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.in-facts .chip {
  padding: 0 6px;
  font-size: 11px;
}

.chip.is-ok {
  border-color: var(--ok);
  color: var(--ok);
}

.in-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 22px;
  height: 22px;
  border-radius: 50% !important;
  background: var(--surface) !important;
  font-size: 11px;
  opacity: 0;
}

.in-tile:hover .in-remove,
.in-tile:focus-within .in-remove {
  opacity: 1;
}

.in-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface);
}

.in-summary {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.in-footer .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.in-dropmask {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent-soft) 85%, transparent);
  color: var(--accent);
  font-size: 18px;
  font-weight: 600;
  pointer-events: none;
}

.in-job.is-ok {
  border-color: var(--ok);
}

.in-job.is-warn {
  border-color: var(--warn);
}

.in-job .card-header {
  border-bottom: 0;
}

.in-job .card-header h2 {
  margin: 0;
}

.in-job .hint {
  margin: 4px 0 0;
}

.in-job-body:empty {
  display: none;
}

.in-job-body {
  display: grid;
  gap: 10px;
  padding: 0 16px 14px;
}

.in-done {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 2px 16px;
  max-height: 220px;
  margin: 0;
  padding-left: 20px;
  overflow-y: auto;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.in-job-list {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
}

.in-next {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
}

/* The crop editor */

.in-crop {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 16px;
  align-items: start;
}

.in-stage-wrap {
  display: flex;
  justify-content: center;
  min-width: 0;
}

.in-stage {
  position: relative;
  max-width: 100%;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-2);
  cursor: crosshair;
  touch-action: none;
  user-select: none;
}

.in-stage-img {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.in-stage-frame {
  position: absolute;
  box-sizing: border-box;
  border: 2px solid #fff;
  box-shadow: 0 0 0 9999px rgba(10, 12, 16, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.5);
  cursor: move;
}

.in-stage-frame:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.in-crop-side {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.in-zoom {
  width: 100%;
  min-width: 0;
}

.in-crop-side p {
  margin: 0;
}

.in-crop-label {
  font-size: 13px;
  font-weight: 500;
}

.in-result {
  width: 168px;
  height: 256px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
}

.in-zoom-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.in-crop-info {
  font-variant-numeric: tabular-nums;
}

.sp-from-art {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 10px 16px 0;
}

@media (max-width: 720px) {
  .in-crop {
    grid-template-columns: 1fr;
  }

  .in-drop .card-header,
  .in-job .card-header {
    flex-wrap: wrap;
  }

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

/* ---------- IDs ---------- */

.ids-tabs {
  flex-wrap: wrap;
  align-items: center;
  overflow: visible;
}

.ids-sheet-tabs {
  display: contents;
}

.ids-tab-sep {
  flex: none;
  width: 1px;
  height: 18px;
  margin: 0 6px;
  background: var(--border);
}

.ids-tab-add {
  min-width: 32px;
  font-weight: 600;
}

.ids-tab-pill {
  padding: 0 6px;
  font-size: 11px;
}

.ids-toolbar {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.ids-toolbar input[type="search"],
.ids-sheet-head input[type="search"],
.ids-series-numbers input[type="number"] {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.ids-toolbar input[type="search"] {
  flex: 1 1 260px;
  min-width: 0;
  max-width: 420px;
}

.ids-toolbar select {
  width: auto;
}

.ids-series-numbers input[type="number"] {
  width: 100%;
  box-sizing: border-box;
}

.ids-toolbar .hint {
  margin-left: auto;
}

.ids-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px 16px 0;
}

.ids-issues {
  margin: 10px 16px 0;
}

.ids-issue-fix {
  padding: 0 6px;
  font-size: 12px;
}

.ids-all td {
  padding-top: 6px;
  padding-bottom: 6px;
  vertical-align: top;
}

.ids-all tr.is-pending td {
  background: var(--warn-soft);
}

.ids-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.ids-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

.ids-name-cell,
.ids-value-cell {
  display: inline-flex;
  align-items: flex-start;
  gap: 4px;
  max-width: 100%;
}

.ids-value {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12.5px;
}

.ids-copy {
  flex: none;
  padding: 0 5px;
  font-size: 12px;
  line-height: 18px;
  opacity: 0.55;
}

.ids-copy:hover,
.ids-copy:focus-visible {
  opacity: 1;
  color: var(--accent);
}

/* one sheet */

.ids-sheet-head {
  flex-wrap: wrap;
}

.ids-sheet-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 10px;
  min-width: 0;
}

.ids-sheet-title h2 {
  margin: 0;
}

.ids-sheet-head .actions input[type="search"] {
  width: 220px;
  max-width: 100%;
}

.ids-sheet-help {
  margin: 10px 16px 0;
}

.ids-sheet-body {
  padding: 12px 16px 16px;
}

.ids-scroll {
  overflow-x: auto;
}

.ids-grid {
  width: max-content;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.ids-grid th,
.ids-grid td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.ids-grid tr:first-child > * {
  border-top: 1px solid var(--border);
}

.ids-grid tr > :first-child {
  border-left: 1px solid var(--border);
}

.ids-grid thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 3px 8px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

.ids-colhead {
  cursor: pointer;
}

.ids-colhead:hover,
.ids-rowhead:hover {
  color: var(--accent);
}

.ids-colhead.is-event,
.ids-colhead.is-token,
.ids-colhead.is-ios {
  color: var(--accent);
}

.ids-role {
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 11px;
}

.ids-corner {
  width: 36px;
}

.ids-rowhead {
  width: 36px;
  padding: 3px 6px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 400;
  text-align: right;
  cursor: pointer;
  user-select: none;
}

.ids-cell {
  position: relative;
  min-width: 90px;
  max-width: 420px;
  height: 28px;
  padding: 3px 26px 3px 8px;
  background: var(--surface);
  vertical-align: top;
  cursor: text;
}

.ids-cell:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.ids-cell-text {
  display: block;
  max-width: 360px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.ids-cell .ids-copy {
  position: absolute;
  top: 3px;
  right: 2px;
  opacity: 0;
}

.ids-cell:hover .ids-copy,
.ids-cell:focus .ids-copy,
.ids-cell .ids-copy:focus-visible {
  opacity: 0.7;
}

.ids-cell.is-token .ids-cell-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.ids-cell.is-pending {
  background: var(--warn-soft);
}

.ids-cell.is-pending::after {
  content: "…";
  color: var(--warn);
}

.ids-cell.is-over,
.ids-cell.is-spaces {
  box-shadow: inset 3px 0 0 var(--warn);
}

.ids-cell.is-flash {
  animation: ids-flash 1.6s ease-out;
}

@keyframes ids-flash {
  0%,
  40% {
    background: var(--accent-soft);
  }
}

.ids-cell.is-editing {
  padding: 0;
}

.ids-editor {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-width: 180px;
  min-height: 28px;
  margin: 0;
  padding: 3px 8px;
  border: 2px solid var(--accent);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  resize: none;
  overflow: hidden;
}

.ids-grid tr.is-head .ids-cell {
  background: var(--surface-2);
  font-weight: 600;
}

.ids-sheet-footer {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* Adjust event groups, side by side */

.ids-groups {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding-bottom: 8px;
}

.ids-group {
  flex: none;
  min-width: 320px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.ids-group-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

.ids-group-head > div {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ids-group-title {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.ids-group-title:hover {
  color: var(--accent);
}

.ids-group-menu {
  padding: 0 8px;
  font-size: 16px;
  line-height: 22px;
}

.ids-events {
  width: 100%;
  min-width: max-content;
}

.ids-events tr > :first-child {
  border-left: 0;
}

.ids-events td:last-child,
.ids-events th:last-child {
  border-right: 0;
}

.ids-events .ids-cell {
  min-width: 70px;
}

.ids-events .ids-cell[data-f="token"],
.ids-events .ids-cell[data-f="iosToken"] {
  min-width: 96px;
  white-space: nowrap;
}

.ids-all th:nth-child(2),
.ids-all td:nth-child(2) {
  min-width: 220px;
}

.ids-group-foot {
  display: flex;
  gap: 4px;
  padding: 6px 6px;
}

.ids-group-add {
  align-self: stretch;
  min-width: 160px;
  min-height: 120px;
  border-style: dashed;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
}

.ids-group-add:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* floating menu */

.ids-menu {
  position: fixed;
  z-index: 50;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

.ids-menu[hidden] {
  display: none;
}

.ids-menu hr {
  width: 100%;
  margin: 4px 0;
  border: 0;
  border-top: 1px solid var(--border);
}

.ids-menu-item {
  padding: 6px 10px;
  border: 0;
  border-radius: 4px;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.ids-menu-item:hover,
.ids-menu-item:focus-visible {
  background: var(--accent-soft);
  outline: none;
}

.ids-menu-item.is-danger {
  color: var(--error);
}

.ids-series-numbers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

/* export / import */

.ids-exports {
  display: flex;
  flex-direction: column;
}

.ids-export-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.ids-export-row:last-child {
  border-bottom: 0;
}

.ids-export-row .hint {
  margin: 2px 0 0;
}

.ids-import-modes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.ids-import-mode {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ids-import-mode .sp-subtitle {
  margin-top: 0;
}

.ids-preview-list {
  max-height: 180px;
  overflow-y: auto;
}

@media (max-width: 700px) {
  .ids-series-numbers {
    grid-template-columns: 1fr;
  }
  .ids-export-row {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* What the level was in each shown period, under its size / time. */
.period-level {
  margin-top: 4px;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.period-level .period-line {
  justify-content: flex-start;
  white-space: nowrap;
}

.cell.num .period-level .period-line {
  justify-content: flex-end;
}

.period-level .period-line + .period-line {
  margin-top: 2px;
  padding-top: 2px;
}

.period-level .period-value {
  color: var(--text-muted);
}

.period-level .period-line.is-different .period-value {
  color: var(--warn);
  font-weight: 600;
}

.stats-filter-warn {
  color: var(--warn);
}

/* Görsel ekle: pictures on hold, one group per target. */
.in-held-group + .in-held-group {
  border-top: 1px solid var(--border);
}

.in-held-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 14px 16px 0;
}

.in-held-head h3 {
  margin: 0;
  font-size: 15px;
}

.in-held-head .hint {
  margin: 2px 0 0;
}

.in-held-head .actions {
  flex-wrap: wrap;
}

.in-held-reset {
  color: var(--error);
}

.in-held-copybox {
  margin: 10px 16px 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.in-held-copybox .hint {
  margin: 0 0 8px;
}

.in-held-result {
  margin: 10px 16px 0;
  padding: 6px 10px;
  border-left: 3px solid var(--ok);
  background: var(--ok-soft);
  font-size: 13px;
}

.in-held-result.is-warn {
  border-left-color: var(--warn);
  background: var(--warn-soft);
}

.in-held-tile {
  cursor: default;
}

.in-held-tile .in-frame {
  cursor: pointer;
}

.in-held-tile.is-chosen {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  background: var(--accent-soft);
}

.in-held-check {
  position: absolute;
  top: 6px;
  left: 6px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 2px solid #fff;
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.in-held-tile.is-chosen .in-held-check {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}
