:root {
  --ink: #191919;
  --muted: #6d6a64;
  --line: #dedbd4;
  --line-strong: #c9c4ba;
  --paper: #f5f3ee;
  --surface: #ffffff;
  --surface-soft: #faf9f6;
  --gold: #a77a2d;
  --gold-dark: #80591d;
  --gold-soft: #f2e8d4;
  --success: #26724a;
  --danger: #a63c34;
  --danger-soft: #fff0ee;
  --shadow: 0 18px 50px rgba(42, 35, 24, 0.1);
  --radius-lg: 24px;
  --radius-md: 15px;
  --radius-sm: 10px;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 0%, rgba(167, 122, 45, 0.1), transparent 30rem),
    var(--paper);
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--gold-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  line-height: 1.3;
}

.brand-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  margin-bottom: 30px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 18px;
  background: linear-gradient(145deg, #c39443, #7b5118);
  box-shadow: 0 12px 26px rgba(91, 57, 13, 0.28);
  color: #fff;
  font-family: Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-mark-small {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  margin: 0;
  border-radius: 13px;
  font-size: 14px;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(110deg, rgba(15, 15, 14, 0.94), rgba(29, 26, 21, 0.82)),
    repeating-linear-gradient(45deg, transparent 0 18px, rgba(255, 255, 255, 0.025) 18px 19px);
}

.login-card {
  width: min(100%, 460px);
  padding: 46px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
}

.login-card .brand-mark {
  border-color: transparent;
}

.login-card h1 {
  margin: 0;
  font-size: clamp(29px, 5vw, 40px);
  letter-spacing: -0.04em;
}

.login-intro {
  margin: 13px 0 30px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

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

.field {
  display: grid;
  gap: 8px;
}

.field > span,
.copy-field > span {
  color: #504d47;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.copy-field input,
.copy-field textarea,
.contact-field input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface);
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field input,
.contact-field input,
.copy-field input {
  height: 46px;
  padding: 0 13px;
}

.copy-field textarea {
  min-height: 104px;
  padding: 12px 13px;
  line-height: 1.65;
  resize: vertical;
}

.copy-field textarea.is-compact {
  min-height: 76px;
}

.field input:focus,
.copy-field input:focus,
.copy-field textarea:focus,
.contact-field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(167, 122, 45, 0.13);
}

.button,
.icon-button {
  border: 0;
  cursor: pointer;
  transition: transform 120ms ease, background 160ms ease, border-color 160ms ease, opacity 160ms ease;
}

.button:active,
.icon-button:active {
  transform: translateY(1px);
}

.button:disabled,
.icon-button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.button {
  min-height: 42px;
  padding: 0 17px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
}

.button-block {
  width: 100%;
  min-height: 48px;
}

.button-primary {
  background: var(--ink);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.13);
  color: #fff;
}

.button-primary:hover {
  background: #34312d;
}

.button-quiet {
  border: 1px solid var(--line);
  background: var(--surface);
}

.button-quiet:hover {
  border-color: var(--line-strong);
  background: var(--surface-soft);
}

.button-danger {
  border: 1px solid #ebc6c1;
  background: var(--danger-soft);
  color: var(--danger);
}

.button-small {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.form-error {
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: 58px;
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 74px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 249, 246, 0.92);
  backdrop-filter: blur(14px);
}

.topbar-brand,
.topbar-actions {
  display: flex;
  align-items: center;
}

.topbar-brand {
  gap: 13px;
}

.topbar-brand h1 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.02em;
}

.topbar-brand .eyebrow {
  margin-bottom: 2px;
  font-size: 9px;
}

.topbar-actions {
  gap: 9px;
}

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

.workspace {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: calc(100vh - 132px);
}

.sidebar {
  position: sticky;
  top: 74px;
  align-self: start;
  height: calc(100vh - 74px);
  padding: 28px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
}

.sidebar-title {
  margin: 0 10px 12px;
  color: #8a867e;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.section-tabs {
  display: grid;
  gap: 5px;
}

.section-tab {
  width: 100%;
  min-height: 42px;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #595650;
  cursor: pointer;
  font-weight: 700;
  text-align: left;
}

.section-tab:hover {
  background: rgba(167, 122, 45, 0.08);
}

.section-tab.is-active {
  background: var(--ink);
  color: #fff;
}

.sidebar-note {
  display: grid;
  gap: 6px;
  margin-top: 26px;
  padding: 15px;
  border: 1px solid #e5d7bb;
  border-radius: 12px;
  background: var(--gold-soft);
  color: #654818;
  font-size: 12px;
  line-height: 1.55;
}

.content-area {
  width: min(100%, 1260px);
  margin: 0 auto;
  padding: 38px 42px 72px;
}

.content-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 26px;
}

.content-heading h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  letter-spacing: -0.035em;
}

.section-description {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.editor-root {
  display: grid;
  gap: 18px;
}

.editor-card,
.array-card,
.contact-card,
.feature-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 7px 24px rgba(48, 42, 32, 0.045);
}

.editor-card {
  padding: 22px;
}

.feature-card {
  overflow: hidden;
}

.feature-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 34px;
  padding: 32px;
}

.feature-copy {
  max-width: 700px;
}

.feature-kicker {
  margin: 0 0 8px;
  color: var(--gold-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.feature-copy h3 {
  margin: 0;
  font-size: clamp(22px, 3vw, 30px);
  letter-spacing: -0.03em;
}

.feature-description {
  margin: 10px 0 16px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.feature-status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feature-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.feature-status.is-enabled {
  background: #e7f4ec;
  color: var(--success);
}

.feature-status.is-disabled {
  background: #eceae5;
  color: #5e5a52;
}

.feature-status.is-pending {
  background: #fff2d7;
  color: #8a5b0e;
}

.feature-switch {
  display: grid;
  flex: 0 0 auto;
  gap: 10px;
  place-items: center;
  cursor: pointer;
}

.feature-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.feature-switch-track {
  position: relative;
  width: 78px;
  height: 42px;
  border: 1px solid #bbb6ac;
  border-radius: 999px;
  background: #d8d5cf;
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.08);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.feature-switch-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.22);
  transition: transform 160ms ease;
}

.feature-switch input:checked + .feature-switch-track {
  border-color: #21663f;
  background: var(--success);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1), 0 0 0 4px rgba(38, 114, 74, 0.09);
}

.feature-switch input:checked + .feature-switch-track .feature-switch-thumb {
  transform: translateX(36px);
}

.feature-switch input:focus-visible + .feature-switch-track {
  outline: 3px solid rgba(167, 122, 45, 0.32);
  outline-offset: 3px;
}

.feature-switch-label {
  font-size: 13px;
  font-weight: 800;
}

.feature-notice {
  display: grid;
  gap: 4px;
  padding: 18px 32px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.feature-notice strong {
  color: var(--ink);
}

.feature-notice.is-pending {
  border-top-color: #ecd39d;
  background: #fff8e8;
  color: #745520;
}

.editor-card-heading,
.array-heading,
.contact-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.editor-card-heading h3,
.array-heading h3,
.contact-heading h3 {
  margin: 0;
  font-size: 16px;
}

.field-path {
  color: #98938a;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
}

.pair-grid,
.contact-names {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.language-column {
  display: grid;
  gap: 9px;
}

.language-badge {
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f1efea;
  color: #68645e;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.array-card {
  overflow: hidden;
}

.array-heading {
  margin: 0;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.array-items {
  display: grid;
}

.array-item {
  position: relative;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.array-item:last-child {
  border-bottom: 0;
}

.array-item-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.array-item-label strong {
  font-size: 13px;
}

.nested-object {
  display: grid;
  gap: 15px;
}

.nested-field {
  padding: 15px;
  border: 1px solid #ece9e3;
  border-radius: 12px;
  background: #fcfbf8;
}

.nested-field-title {
  margin: 0 0 11px;
  color: #605c55;
  font-size: 12px;
  font-weight: 800;
}

.empty-state {
  padding: 38px 22px;
  color: var(--muted);
  text-align: center;
}

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

.media-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.media-preview-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%),
    #f8f8f8;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.media-preview-wrap.is-share {
  aspect-ratio: 5 / 4;
}

.media-preview {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-preview.is-qr {
  object-fit: contain;
  padding: 12px;
  background: #fff;
}

.media-uploading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(20, 20, 19, 0.68);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}

.media-card-body {
  display: grid;
  gap: 12px;
  padding: 15px;
}

.media-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.media-title {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
}

.media-path {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: #918c83;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-hint {
  margin: 0;
  color: #746f67;
  font-size: 12px;
  line-height: 1.65;
}

.upload-label {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface-soft);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.upload-label:hover {
  border-color: var(--gold);
  color: var(--gold-dark);
}

.upload-label.is-disabled {
  pointer-events: none;
  opacity: 0.55;
}

.upload-label input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.contact-card {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 22px;
  padding: 20px;
}

.contact-qr {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.contact-qr img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.contact-body {
  min-width: 0;
}

.contact-heading {
  margin-bottom: 14px;
}

.contact-fields {
  display: grid;
  gap: 14px;
}

.contact-field {
  display: grid;
  gap: 7px;
}

.contact-field > span {
  color: #504d47;
  font-size: 12px;
  font-weight: 700;
}

.contact-upload {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-fixed-section,
.block-manager {
  display: grid;
  gap: 18px;
}

.page-fixed-section {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.page-editor-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.page-editor-heading h3,
.block-catalog-heading h3 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.page-editor-help,
.block-catalog-heading p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.fixed-title-fields {
  display: grid;
  gap: 14px;
}

.fixed-title-fields .editor-card {
  box-shadow: none;
}

.block-count {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid #e3d2b1;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #6b4a15;
  font-size: 12px;
  font-weight: 800;
}

.block-list {
  display: grid;
  gap: 12px;
}

.block-empty {
  display: grid;
  gap: 6px;
  padding: 38px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  text-align: center;
}

.block-empty strong {
  color: var(--ink);
}

.block-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 7px 24px rgba(48, 42, 32, 0.045);
}

.block-card.is-disabled {
  border-style: dashed;
  background: #f7f6f3;
}

.block-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 88px;
  padding: 16px 18px;
}

.block-identity {
  display: flex;
  min-width: 220px;
  align-items: center;
  gap: 13px;
}

.block-index {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  font-weight: 800;
}

.is-disabled .block-index {
  background: #8f8b83;
}

.block-type-label {
  display: block;
  margin-bottom: 3px;
  color: var(--gold-dark);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.block-display-title {
  display: block;
  max-width: 420px;
  margin-bottom: 4px;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.block-controls,
.item-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.block-controls .button {
  min-height: 32px;
  padding: 0 10px;
}

.block-hidden-note {
  margin: 0;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  background: #edebe6;
  color: #625e57;
  font-size: 12px;
}

.block-card-body {
  display: grid;
  gap: 18px;
  padding: 22px;
  border-top: 1px solid var(--line);
  background: #fcfbf9;
}

.block-editor-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 11px;
  background: var(--gold-soft);
  color: #72501a;
  font-size: 12px;
}

.block-editor-intro strong {
  color: #4f3610;
}

.block-copy-fields {
  display: grid;
  gap: 14px;
}

.block-field-group,
.asset-field,
.subitem-section {
  border: 1px solid #e7e3dc;
  border-radius: 13px;
  background: var(--surface);
}

.block-field-group {
  padding: 17px;
}

.block-field-heading,
.asset-field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.block-field-heading strong,
.asset-field-heading strong {
  font-size: 13px;
}

.required-badge,
.optional-badge {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
}

.required-badge {
  background: #fff0db;
  color: #865409;
}

.optional-badge {
  background: #efeee9;
  color: #6a665e;
}

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

.settings-field {
  display: grid;
  gap: 8px;
  align-content: start;
}

.settings-field > span {
  color: #504d47;
  font-size: 12px;
  font-weight: 700;
}

.settings-field input,
.settings-field select {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  outline: none;
  background: var(--surface);
  color: var(--ink);
}

.settings-field input:focus,
.settings-field select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(167, 122, 45, 0.13);
}

.asset-field {
  overflow: hidden;
}

.asset-field-heading {
  margin: 0;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.asset-field-content {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 17px;
  padding: 15px;
}

.asset-preview {
  position: relative;
  display: grid;
  min-height: 150px;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 11px;
  background:
    linear-gradient(45deg, #eee 25%, transparent 25%),
    linear-gradient(-45deg, #eee 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eee 75%),
    linear-gradient(-45deg, transparent 75%, #eee 75%),
    #f8f8f8;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.asset-preview.is-image {
  aspect-ratio: 4 / 3;
}

.asset-preview.is-video {
  aspect-ratio: 16 / 9;
  background: #181818;
}

.asset-preview img,
.asset-preview video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.asset-placeholder {
  padding: 18px;
  color: #8a867e;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.asset-actions {
  display: grid;
  min-width: 0;
  gap: 12px;
  align-content: center;
}

.asset-url {
  display: block;
  max-width: 100%;
  overflow: hidden;
  padding: 9px 10px;
  border-radius: 8px;
  background: #f2f0eb;
  color: #6d6961;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-note {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.asset-upload-label {
  width: fit-content;
  min-width: 130px;
}

.upload-progress-list {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.upload-progress-item {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 8px 9px;
  border-radius: 8px;
  background: #f2f0eb;
}

.upload-progress-copy {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 10px;
}

.upload-progress-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-progress-copy strong {
  flex: 0 0 auto;
}

.upload-progress-track,
.upload-progress-bar {
  display: block;
  height: 4px;
  border-radius: 999px;
}

.upload-progress-track {
  overflow: hidden;
  background: #d8d4cc;
}

.upload-progress-bar {
  width: 0;
  background: #3273b8;
  transition: width 120ms ease;
}

.upload-progress-item.is-complete .upload-progress-bar {
  background: var(--success);
}

.upload-progress-item.is-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.upload-progress-item.is-error .upload-progress-bar {
  background: var(--danger);
}

.subitem-section {
  overflow: hidden;
}

.subitem-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.subitem-heading > div:first-child {
  display: grid;
  gap: 4px;
}

.subitem-heading strong {
  font-size: 14px;
}

.subitem-heading span {
  color: var(--muted);
  font-size: 11px;
}

.subitem-upload-area {
  display: grid;
  justify-items: end;
  gap: 7px;
}

.subitem-empty {
  margin: 0;
  padding: 30px 20px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.gallery-editor-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
}

.gallery-editor-item {
  min-width: 0;
  background: var(--surface);
}

.gallery-editor-item > img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.gallery-item-footer {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.gallery-item-footer > strong {
  font-size: 11px;
}

.gallery-item-footer .item-controls {
  justify-content: flex-start;
}

.item-controls .button {
  min-height: 29px;
  padding: 0 8px;
  font-size: 10px;
}

.editable-subitems {
  display: grid;
  gap: 12px;
  padding: 15px;
  background: #f6f4ef;
}

.editable-subitem {
  display: grid;
  gap: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

.editable-subitem-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.editable-subitem-heading > strong,
.button-slot-title {
  font-size: 13px;
}

.horizontal-card-editor .asset-field-content {
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
}

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

.block-catalog {
  overflow: hidden;
  margin-top: 4px;
  border: 1px solid #ddcfb3;
  border-radius: var(--radius-md);
  background: #fbf7ef;
}

.block-catalog-heading {
  padding: 19px 20px;
  border-bottom: 1px solid #e4d7bd;
}

.block-template-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  background: #e5dac4;
}

.block-template {
  display: grid;
  min-height: 138px;
  gap: 7px;
  align-content: start;
  padding: 16px;
  border: 0;
  background: #fffdf9;
  cursor: pointer;
  text-align: left;
  transition: background 150ms ease, color 150ms ease;
}

.block-template:hover {
  background: var(--gold-soft);
}

.block-template strong {
  font-size: 13px;
}

.block-template span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.block-template em {
  margin-top: auto;
  color: var(--gold-dark);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.is-invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 3px rgba(166, 60, 52, 0.1) !important;
}

.alert {
  margin-bottom: 18px;
  padding: 13px 15px;
  border-radius: 11px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-line;
}

.alert-error {
  border: 1px solid #efc8c4;
  background: var(--danger-soft);
  color: var(--danger);
}

.savebar {
  position: fixed;
  z-index: 30;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 -8px 24px rgba(25, 22, 17, 0.055);
  color: var(--muted);
  font-size: 12px;
  backdrop-filter: blur(12px);
}

.save-state-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
}

.save-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9a968e;
}

.save-dot.is-dirty {
  background: var(--gold);
}

.save-dot.is-saving {
  background: #3273b8;
  animation: pulse 900ms infinite alternate;
}

.save-dot.is-saved {
  background: var(--success);
}

.save-dot.is-error {
  background: var(--danger);
}

.version-label {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.toast {
  position: fixed;
  z-index: 80;
  top: 20px;
  left: 50%;
  max-width: min(90vw, 520px);
  padding: 12px 16px;
  transform: translateX(-50%);
  border-radius: 11px;
  background: #20201f;
  box-shadow: var(--shadow);
  color: #fff;
  font-size: 13px;
  line-height: 1.45;
}

.toast.is-error {
  background: var(--danger);
}

.modal {
  width: min(92vw, 500px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(19, 18, 16, 0.58);
  backdrop-filter: blur(3px);
}

.modal-card {
  padding: 27px;
  border-radius: 18px;
  background: var(--surface);
}

.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 3px;
}

.modal-heading h2 {
  margin: 0;
  font-size: 22px;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 9px;
  background: #f0eee9;
  font-size: 22px;
  line-height: 1;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 4px;
}

@keyframes pulse {
  from { opacity: 0.35; }
  to { opacity: 1; }
}

@media (max-width: 1040px) {
  .media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .gallery-editor-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .block-card-heading {
    align-items: flex-start;
  }

  .content-area {
    padding-right: 28px;
    padding-left: 28px;
  }
}

@media (max-width: 800px) {
  .topbar {
    position: static;
    align-items: flex-start;
    padding: 14px 18px;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .session-user {
    display: none;
  }

  .workspace {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }

  .sidebar-title,
  .sidebar-note {
    display: none;
  }

  .section-tabs {
    display: flex;
    width: max-content;
  }

  .section-tab {
    width: auto;
    min-width: 72px;
    text-align: center;
  }

  .content-area {
    padding: 28px 18px 70px;
  }

  .content-heading {
    align-items: flex-end;
  }

  .pair-grid,
  .contact-names {
    grid-template-columns: 1fr;
  }

  .block-card-heading {
    display: grid;
  }

  .block-controls {
    justify-content: flex-start;
  }

  .asset-field-content,
  .horizontal-card-editor .asset-field-content {
    grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
  }

  .contact-card {
    grid-template-columns: 150px minmax(0, 1fr);
  }
}

@media (max-width: 580px) {
  .login-shell {
    padding: 14px;
  }

  .login-card {
    padding: 30px 24px;
  }

  .topbar-brand .eyebrow,
  .topbar-brand h1 {
    display: none;
  }

  .topbar-actions .button {
    min-height: 38px;
    padding: 0 11px;
  }

  .content-heading {
    display: grid;
  }

  .content-heading .button {
    width: 100%;
  }

  .editor-card,
  .array-item {
    padding: 17px;
  }

  .feature-summary {
    display: grid;
    justify-items: stretch;
    padding: 22px;
  }

  .feature-switch {
    grid-template-columns: auto 1fr;
    justify-items: start;
  }

  .feature-notice {
    padding: 16px 22px;
  }

  .page-fixed-section,
  .block-card-body {
    padding: 17px;
  }

  .page-editor-heading,
  .block-editor-intro,
  .subitem-heading {
    display: grid;
  }

  .block-count,
  .subitem-upload-area {
    justify-self: start;
  }

  .subitem-upload-area {
    justify-items: start;
  }

  .settings-grid,
  .two-column-subitems,
  .asset-field-content,
  .horizontal-card-editor .asset-field-content {
    grid-template-columns: 1fr;
  }

  .asset-preview {
    width: min(100%, 420px);
  }

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

  .media-grid {
    grid-template-columns: 1fr;
  }

  .block-template-grid,
  .gallery-editor-grid {
    grid-template-columns: 1fr;
  }

  .block-template {
    min-height: 112px;
  }

  .block-identity {
    min-width: 0;
  }

  .block-display-title {
    max-width: 220px;
  }

  .block-controls .button {
    flex: 1 1 auto;
  }

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

  .contact-qr {
    width: min(100%, 230px);
    justify-self: center;
  }

  .savebar {
    padding: 0 16px;
  }

  .version-label {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
