:root {
  color-scheme: dark;
  --bg: #050608;
  --panel: rgba(17, 21, 29, 0.94);
  --panel-2: rgba(23, 28, 38, 0.92);
  --line: rgba(255, 255, 255, 0.13);
  --line-strong: rgba(41, 230, 255, 0.42);
  --text: #f7fbff;
  --muted: #aeb8c7;
  --quiet: #7f8a99;
  --gold: #ffd166;
  --cyan: #29e6ff;
  --danger: #ff5c72;
  --ok: #6cff9e;
  --radius: 8px;
  --max: 1040px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(135deg, rgba(255, 92, 114, 0.14), transparent 30%),
    linear-gradient(160deg, transparent 44%, rgba(41, 230, 255, 0.1) 45%, transparent 58%),
    linear-gradient(180deg, #050608, #090d13 48%, #050608);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.manager-shell {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: calc(22px + env(safe-area-inset-top, 0px)) 16px calc(168px + env(safe-area-inset-bottom, 0px));
}

.manager-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.manager-header strong {
  display: block;
  color: #ffffff;
  font-size: 1.15rem;
  font-weight: 950;
  letter-spacing: 0;
}

.store-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-top: 8px;
  padding: 5px 10px;
  border: 1px solid rgba(82, 230, 255, 0.36);
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(82, 230, 255, 0.08);
  font-size: 0.78rem;
  font-weight: 850;
}

.manager-header h1 {
  margin: 2px 0 0;
  color: #ffffff;
  font-size: clamp(2rem, 8vw, 3.35rem);
  font-weight: 950;
  line-height: 1;
}

.manager-header p {
  max-width: 560px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.35;
}

.preview-button,
button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  text-decoration: none;
  cursor: pointer;
}

.preview-button {
  flex: 0 0 auto;
  padding: 0 14px;
  border-color: rgba(41, 230, 255, 0.42);
  color: var(--cyan);
  font-weight: 900;
}

.store-switcher {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 14px;
  padding: 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
}

.store-switcher a {
  display: flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 3px);
  color: var(--muted);
  text-align: center;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 900;
}

.store-switcher a.is-active {
  border-color: rgba(82, 230, 255, 0.5);
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(82, 230, 255, 0.18), rgba(214, 166, 75, 0.12)),
    rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.status-card {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(12, 16, 22, 0.86);
  line-height: 1.35;
}

.status-card.is-ok {
  color: var(--ok);
  border-color: rgba(108, 255, 158, 0.36);
}

.status-card.is-error {
  color: var(--danger);
  border-color: rgba(255, 92, 114, 0.42);
}

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

.quick-actions button {
  display: grid;
  min-height: 106px;
  align-content: center;
  gap: 6px;
  padding: 12px 8px;
  background:
    linear-gradient(145deg, rgba(41, 230, 255, 0.08), transparent 46%),
    var(--panel);
}

.quick-actions span {
  color: #ffffff;
  font-weight: 950;
  line-height: 1.1;
}

.quick-actions small {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.manager-panel {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.32);
}

.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title h2 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(1.35rem, 5vw, 2rem);
  font-weight: 950;
}

.panel-title p,
.advanced-panel p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

label span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

input,
textarea,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.065);
  outline: none;
}

input,
select {
  padding: 0 12px;
}

textarea {
  min-height: 420px;
  padding: 14px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.84rem;
  line-height: 1.48;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(41, 230, 255, 0.12);
}

.two-column,
.section-fields,
.item-field-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.slushy-list,
.item-list-editor {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.slushy-promo-note {
  padding: 11px 12px;
  border: 1px solid rgba(255, 209, 102, 0.28);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 209, 102, 0.11);
  font-size: 0.9rem;
  font-weight: 760;
  line-height: 1.32;
}

.slushy-promo-note strong {
  color: var(--gold);
}

.worldcup-promo-editor {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 209, 102, 0.28);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 209, 102, 0.12), rgba(41, 230, 255, 0.06)),
    var(--panel-2);
}

.worldcup-promo-editor strong {
  color: var(--gold);
  font-size: 1rem;
}

.worldcup-promo-editor p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.32;
}

.worldcup-promo-editor textarea {
  min-height: 110px;
  font-family: inherit;
  font-size: 0.95rem;
}

.slushy-row,
.item-editor-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.slushy-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.row-number {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(41, 230, 255, 0.34);
  border-radius: var(--radius);
  color: var(--cyan);
  font-weight: 950;
}

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

.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
}

.switch-row input {
  width: 22px;
  height: 22px;
  min-height: 0;
  accent-color: var(--cyan);
}

.switch-row span {
  color: var(--text);
  font-size: 0.9rem;
}

.compact-switch {
  padding-top: 4px;
}

.category-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 4px;
  overflow-x: auto;
}

.category-tabs button {
  display: grid;
  flex: 0 0 auto;
  min-width: 144px;
  gap: 3px;
  padding: 10px 12px;
  text-align: left;
}

.category-tabs button.is-active {
  border-color: var(--line-strong);
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(41, 230, 255, 0.12);
}

.category-tabs strong {
  color: #ffffff;
  font-size: 0.96rem;
}

.category-tabs span {
  color: var(--quiet);
  font-size: 0.74rem;
  font-weight: 850;
}

.section-toolbar {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-bottom: 10px;
}

.item-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.item-row-header strong {
  min-width: 0;
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.row-actions {
  display: flex;
  gap: 6px;
}

.row-actions button {
  min-height: 34px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.wide-field {
  grid-column: 1 / -1;
}

.item-hidden-toggle {
  width: fit-content;
  padding: 8px 10px;
  border: 1px solid rgba(108, 255, 158, 0.24);
  border-radius: var(--radius);
  background: rgba(108, 255, 158, 0.06);
}

.item-editor-row.is-hidden {
  border-color: rgba(255, 92, 114, 0.35);
  opacity: 0.7;
}

.item-editor-row.is-hidden .item-hidden-toggle {
  border-color: rgba(255, 92, 114, 0.5);
  background: rgba(255, 92, 114, 0.11);
}

.add-row-button {
  width: 100%;
  margin-top: 12px;
  border-style: dashed;
  border-color: rgba(41, 230, 255, 0.45);
  color: var(--cyan);
  font-weight: 950;
  background: rgba(41, 230, 255, 0.06);
}

.secondary-button,
.primary-button {
  padding: 0 14px;
  font-weight: 950;
}

.secondary-button {
  color: var(--cyan);
}

.primary-button {
  border-color: rgba(255, 209, 102, 0.62);
  color: #100d05;
  background: linear-gradient(180deg, #ffe8a3, var(--gold));
}

button:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.empty-list {
  padding: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.audit-list {
  display: grid;
  gap: 10px;
}

.audit-entry {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: var(--radius);
  background: var(--panel-2);
}

.audit-entry-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.audit-entry strong {
  color: #ffffff;
  font-size: 1rem;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.audit-entry time {
  flex: 0 0 auto;
  color: var(--quiet);
  font-size: 0.76rem;
  font-weight: 850;
}

.audit-entry p {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.35;
}

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

.audit-meta span {
  padding: 5px 7px;
  border: 1px solid rgba(41, 230, 255, 0.22);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(41, 230, 255, 0.06);
  font-size: 0.74rem;
  font-weight: 850;
}

.advanced-panel summary {
  cursor: pointer;
  color: var(--cyan);
  font-weight: 950;
}

.slushy-color-editor {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  grid-column: 1 / -1;
  gap: 14px;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.slushy-color-preview { min-width: 0; }
.slushy-color-controls { min-width: 0; }
.slushy-color-label { display: flex; align-items: center; gap: 12px; }
.slushy-color-label span { margin: 0; font-size: 0.875rem; }

.slushy-color-label input[type="color"] {
  width: 56px;
  height: 44px;
  min-height: 44px;
  flex: 0 0 56px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}

.slushy-color-swatches { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }

.slushy-color-swatches button {
  position: relative;
  width: 44px;
  height: 44px;
  min-height: 44px;
  flex: 0 0 44px;
  border: 2px solid transparent;
  border-radius: 50%;
  padding: 5px;
  background: transparent;
}

.slushy-color-swatches button::before {
  content: "";
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--swatch);
}

.slushy-color-swatches button[aria-pressed="true"] { border-color: #fff; }
.slushy-color-swatches button:focus-visible, .slushy-color-label input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }

@media (max-width: 380px) {
  .slushy-color-editor { grid-template-columns: 80px minmax(0, 1fr); gap: 8px; }
  .slushy-color-label { gap: 6px; }
}

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

.save-dock {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(150px, 0.8fr) minmax(180px, 1.2fr) auto auto;
  gap: 10px;
  padding:
    12px max(16px, calc((100vw - var(--max)) / 2 + 16px))
    calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(255, 255, 255, 0.13);
  background: rgba(5, 6, 8, 0.96);
  backdrop-filter: blur(18px);
}

#editorField,
#pinField {
  max-width: 280px;
}

.save-help {
  align-self: center;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

@media (max-width: 760px) {
  .manager-shell {
    padding:
      calc(20px + env(safe-area-inset-top, 0px))
      12px
      calc(214px + env(safe-area-inset-bottom, 0px));
  }

  .manager-header {
    align-items: stretch;
  }

  .preview-button {
    min-width: 96px;
  }

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

  .quick-actions button {
    min-height: 94px;
  }

  .two-column,
  .section-fields,
  .item-field-grid,
  .row-fields,
  .slushy-row,
  .section-toolbar {
    grid-template-columns: 1fr;
  }

  .slushy-row {
    align-items: stretch;
  }

  .save-dock {
    grid-template-columns: 1fr 1fr;
    padding:
      10px 12px
      calc(10px + env(safe-area-inset-bottom, 0px));
  }

  #editorField,
  #pinField,
  .save-help {
    grid-column: 1 / -1;
  }

  #editorField,
  #pinField {
    max-width: none;
  }

  .audit-entry-header {
    display: grid;
  }
}
