:root {
  --orange: #ef8b33;
  --orange-dark: #d97319;
  --orange-soft: #fff1e4;
  --ink: #262321;
  --muted: #746c66;
  --paper: #fbf8f4;
  --cream: #f5eee6;
  --line: #e7ddd3;
  --white: #fff;
  --danger: #b43a2f;
  --success: #28764a;
  --shadow: 0 20px 50px rgba(65, 42, 25, 0.1);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

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

button {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.auth-page {
  min-height: 100vh;
  background: #f7f0e8;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(480px, 1.08fr) minmax(480px, 0.92fr);
}

.auth-visual {
  position: relative;
  min-height: 100vh;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  padding: 42px clamp(44px, 6vw, 94px);
  background: #f4ece3;
}

.auth-visual::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(250, 245, 239, 0.24), rgba(250, 245, 239, 0.72));
  content: "";
}

.auth-brand {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 18px;
  width: max-content;
  color: var(--ink);
  text-decoration: none;
}

.auth-brand img {
  width: 132px;
  height: auto;
}

.auth-brand span {
  padding-left: 18px;
  border-left: 1px solid rgba(40, 35, 31, 0.25);
  font-size: 14px;
  letter-spacing: 0.08em;
}

.auth-visual-copy {
  position: relative;
  z-index: 2;
  max-width: 650px;
  margin-top: auto;
  margin-bottom: 92px;
}

.auth-kicker,
.auth-eyebrow,
.eyebrow {
  margin: 0 0 12px;
  color: var(--orange-dark);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.auth-visual-copy h1 {
  margin: 0;
  font-size: clamp(46px, 4.8vw, 78px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.12;
}

.auth-visual-copy > p:last-child {
  max-width: 560px;
  margin: 26px 0 0;
  color: #5f5751;
  font-size: 17px;
  line-height: 1.8;
}

.auth-visual-image {
  position: absolute;
  inset: 0;
  background: url("/preview/assets/images/hero-silicone.jpg") center / cover no-repeat;
  opacity: 0.34;
}

.auth-panel {
  display: grid;
  padding: 40px;
  background: var(--paper);
  place-items: center;
}

.auth-card {
  width: min(100%, 470px);
}

.auth-card h2 {
  margin: 0;
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.035em;
}

.auth-help {
  margin: 14px 0 30px;
  color: var(--muted);
  line-height: 1.65;
}

.auth-footnote {
  margin: 26px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: #948a83;
  font-size: 12px;
  line-height: 1.6;
}

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

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

.field > span {
  color: #4f4944;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.field small {
  color: #9a918a;
  font-size: 11px;
}

.field input,
.field select,
.field textarea,
.search-input {
  width: 100%;
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: var(--white);
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.search-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(239, 139, 51, 0.13);
}

.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 12px;
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

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

.button:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
}

.button-primary {
  background: var(--orange);
  color: var(--white);
}

.button-primary:hover {
  background: var(--orange-dark);
}

.button-secondary {
  border-color: var(--line);
  background: var(--white);
  color: var(--ink);
}

.button-block {
  width: 100%;
}

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

.admin-page {
  height: 100vh;
  overflow: hidden;
}

.appbar {
  height: 68px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

.appbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  text-decoration: none;
}

.appbar-brand img {
  width: 94px;
}

.appbar-brand span {
  padding-left: 12px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.appbar-nav {
  display: flex;
  align-self: stretch;
  gap: 3px;
}

.nav-tab {
  position: relative;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: #5e5751;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}

.nav-tab::after {
  position: absolute;
  right: 14px;
  bottom: 0;
  left: 14px;
  height: 2px;
  background: var(--orange);
  content: "";
  transform: scaleX(0);
  transition: transform 0.2s ease;
}

.nav-tab:hover,
.nav-tab.is-active {
  color: var(--ink);
}

.nav-tab.is-active::after {
  transform: scaleX(1);
}

.appbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  padding: 5px 10px;
  border-radius: 999px;
  background: #eaf5ee;
  color: var(--success);
  font-size: 11px;
}

.status-pill.is-working {
  background: var(--orange-soft);
  color: var(--orange-dark);
}

.status-pill.is-error,
.status-pill.warn {
  background: #fff0ed;
  color: var(--danger);
}

.icon-action {
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.workspace {
  height: calc(100vh - 68px);
  min-height: 0;
}

.view {
  height: 100%;
  display: none;
  overflow: auto;
}

.view.is-active {
  display: block;
}

[data-view="content"].is-active {
  display: grid;
  grid-template-columns: 274px 352px minmax(0, 1fr);
  overflow: hidden;
}

.module-rail,
.inspector,
.preview-pane {
  min-width: 0;
  min-height: 0;
}

.module-rail {
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--white);
}

.rail-header {
  display: grid;
  gap: 10px;
}

.field.compact {
  gap: 4px;
}

.field.compact select {
  min-height: 38px;
}

.rail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 4px 9px;
  color: #7f756e;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.rail-heading small {
  font-size: 9px;
  font-weight: 400;
}

.module-list {
  display: grid;
  gap: 5px;
  max-height: 265px;
  overflow: auto;
}

.module-item {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 9px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}

.module-item:hover {
  background: #faf6f2;
}

.module-item.is-active {
  border-color: rgba(239, 139, 51, 0.45);
  background: var(--orange-soft);
}

.module-item.is-hidden {
  opacity: 0.45;
}

.module-item__handle {
  color: #b6aca4;
  font-size: 13px;
}

.module-item__copy {
  overflow: hidden;
}

.module-item__copy strong,
.module-item__copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-item__copy strong {
  font-size: 11px;
  font-weight: 600;
}

.module-item__copy small {
  margin-top: 2px;
  color: #938a83;
  font-size: 9px;
}

.module-item__controls {
  display: none;
  gap: 2px;
}

.module-item:hover .module-item__controls,
.module-item.is-active .module-item__controls {
  display: flex;
}

.tiny-button {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--white);
  cursor: pointer;
  font-size: 10px;
}

.search-input {
  min-height: 34px;
  margin-bottom: 8px;
  font-size: 11px;
}

.field-list {
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 3px;
  overflow: auto;
}

.field-item {
  width: 100%;
  padding: 7px 9px;
  overflow: hidden;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #5f5751;
  cursor: pointer;
  font-size: 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-item:hover,
.field-item.is-active {
  background: var(--orange-soft);
  color: var(--ink);
}

.inspector {
  display: flex;
  flex-direction: column;
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--paper);
}

.inspector-head {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 248, 244, 0.96);
  backdrop-filter: blur(10px);
}

.inspector-head h2 {
  max-width: 240px;
  margin: 0;
  overflow: hidden;
  font-size: 17px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector-body {
  padding: 18px;
}

.empty-panel {
  padding: 34px 20px;
  border: 1px dashed #d9cfc6;
  border-radius: 10px;
  color: #8d837c;
  text-align: center;
}

.empty-mark {
  display: block;
  color: var(--orange);
  font-size: 30px;
  line-height: 1;
}

.inspector-group {
  display: grid;
  gap: 14px;
  margin-bottom: 22px;
}

.inspector-group h3 {
  margin: 0;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 700;
}

.style-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.inspector-body textarea {
  width: 100%;
  min-height: 110px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  resize: vertical;
}

.inspector-body textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(239, 139, 51, 0.13);
}

.global-type-panel {
  margin: 12px 18px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--white);
}

.global-type-panel summary {
  padding: 13px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}

.global-type-panel .form-grid {
  padding: 0 14px 14px;
}

.preview-pane {
  display: flex;
  flex-direction: column;
  background: #e9e3dd;
}

.preview-toolbar {
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid rgba(83, 73, 65, 0.13);
  background: #f3efeb;
}

.device-switcher {
  display: flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid #d8d0c8;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.device-switcher button {
  padding: 5px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #766e68;
  cursor: pointer;
  font-size: 10px;
}

.device-switcher button.is-active {
  background: var(--ink);
  color: var(--white);
}

.preview-note {
  color: #8d837c;
  font-size: 10px;
}

.preview-stage {
  min-height: 0;
  display: flex;
  flex: 1;
  justify-content: center;
  padding: 18px;
  overflow: auto;
}

#site-preview {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 18px 45px rgba(61, 47, 36, 0.12);
  transition: width 0.25s ease;
}

.view-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 40px 34px 28px;
}

.view-head h1 {
  margin: 0;
  font-size: 36px;
  font-weight: 500;
  letter-spacing: -0.035em;
}

.view-head p:last-child {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.split-panel {
  max-width: 1500px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 0.72fr);
  gap: 22px;
  margin: 0 auto;
  padding: 0 34px 40px;
}

.table-card,
.form-card,
.info-panel,
.invite-result {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  box-shadow: 0 12px 36px rgba(72, 53, 38, 0.04);
}

.table-card {
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f0e9e2;
  font-size: 12px;
  vertical-align: middle;
}

.data-table th {
  color: #847a73;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.table-product {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-product img {
  width: 42px;
  height: 42px;
  border-radius: 7px;
  background: var(--cream);
  object-fit: cover;
}

.form-card {
  padding: 20px;
}

.form-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
}

.form-card-head h2,
.section-title-row h2,
.info-panel h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 22px;
  font-size: 12px;
}

.media-section {
  max-width: 1500px;
  margin: 0 auto;
  padding: 0 34px 40px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}

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

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

.media-card__preview img,
.media-card__preview video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.media-card__body {
  padding: 10px 12px 12px;
}

.media-card__body strong {
  display: block;
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-card__body small {
  display: block;
  margin: 4px 0 9px;
  color: var(--muted);
  font-size: 9px;
}

.info-panel,
.invite-result {
  max-width: 1432px;
  margin: 0 auto 22px;
  padding: 22px;
}

.info-panel p {
  margin: 9px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.invite-result {
  border-color: rgba(239, 139, 51, 0.4);
  background: var(--orange-soft);
}

.invite-result code {
  display: block;
  margin-top: 8px;
  padding: 10px;
  overflow-wrap: anywhere;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.75);
  font-size: 11px;
}

.publish-checks {
  max-width: 1432px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  margin: 0 auto 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.publish-checks > div {
  padding: 18px;
  background: var(--white);
}

.publish-checks strong,
.publish-checks span {
  display: block;
}

.publish-checks strong {
  margin-bottom: 6px;
  font-size: 13px;
}

.publish-checks span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.modal {
  width: min(620px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgba(33, 27, 23, 0.38);
  backdrop-filter: blur(3px);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
}

.modal-body {
  padding: 20px;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 9px;
  background: #24201d;
  color: var(--white);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

@media (max-width: 1150px) {
  .appbar-brand span {
    display: none;
  }

  .appbar-nav {
    overflow-x: auto;
  }

  [data-view="content"].is-active {
    grid-template-columns: 235px 320px minmax(520px, 1fr);
    overflow: auto;
  }

  .split-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .admin-page {
    height: auto;
    overflow: auto;
  }

  .appbar {
    height: auto;
    min-height: 62px;
    flex-wrap: wrap;
    padding: 10px 14px;
  }

  .appbar-nav {
    order: 3;
    width: 100%;
  }

  .appbar-user {
    margin-left: auto;
  }

  #current-user {
    display: none;
  }

  .workspace {
    height: auto;
  }

  [data-view="content"].is-active {
    display: block;
    height: auto;
    overflow: visible;
  }

  .module-rail,
  .inspector,
  .preview-pane {
    min-height: auto;
  }

  .module-rail {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .module-list {
    max-height: 230px;
  }

  .inspector {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .preview-stage {
    min-height: 720px;
    padding: 10px;
  }

  .preview-note {
    display: none;
  }

  .view-head,
  .media-section,
  .split-panel {
    padding-right: 16px;
    padding-left: 16px;
  }

  .view-head {
    align-items: flex-start;
    flex-direction: column;
    padding-top: 28px;
  }

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

  .publish-checks {
    grid-template-columns: 1fr 1fr;
    margin-right: 16px;
    margin-left: 16px;
  }

  .auth-shell {
    display: block;
  }

  .auth-visual {
    min-height: 380px;
    padding: 28px;
  }

  .auth-brand img {
    width: 104px;
  }

  .auth-visual-copy {
    margin-top: auto;
    margin-bottom: 36px;
  }

  .auth-visual-copy h1 {
    font-size: 42px;
  }

  .auth-visual-copy > p:last-child {
    font-size: 14px;
  }

  .auth-panel {
    padding: 42px 22px;
  }
}
