:root {
  --orange: #ef5128;
  --orange-dark: #c73c1b;
  --ink: #202124;
  --muted: #667085;
  --line: #e5e7eb;
  --bg: #f6f7f9;
  --panel: #ffffff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 220px;
  background: #1f2933;
  color: #ffffff;
  padding: 22px 14px;
}

.brand {
  font-size: 18px;
  font-weight: 700;
  margin: 0 6px 18px;
}

.menu-item {
  width: 100%;
  height: 42px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  text-align: left;
  padding: 0 14px;
}

.menu-item.active {
  background: var(--orange);
}

.main {
  flex: 1;
  min-width: 0;
}

.topbar {
  min-height: 88px;
  padding: 18px 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.35;
}

h2 {
  font-size: 18px;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.token-box {
  display: flex;
  gap: 8px;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 9px 10px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(239, 81, 40, 0.12);
}

.workspace {
  padding: 22px 28px 34px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel-head {
  min-height: 58px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #475467;
  background: #fafafa;
  font-weight: 600;
}

.thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: #f0f2f5;
  border: 1px solid var(--line);
}

.status {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #edf2f7;
  color: #344054;
}

.status.published {
  background: #e9f8ef;
  color: #137333;
}

.status.draft {
  background: #fff3e8;
  color: #b54708;
}

.status.archived,
.status.disabled {
  background: #f2f4f7;
  color: #667085;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 188px;
}

.editor-layout {
  margin-top: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.form-panel {
  padding-bottom: 16px;
}

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

label {
  display: block;
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

label input,
label textarea {
  margin-top: 7px;
  color: var(--ink);
  font-weight: 400;
}

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

.image-field {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.image-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 9px;
}

.image-preview {
  width: 100%;
  height: 138px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: contain;
  background: #fafafa;
}

.image-url {
  margin-top: 8px;
  font-size: 12px;
}

.image-actions,
.form-actions {
  display: flex;
  gap: 8px;
}

.image-actions {
  margin-top: 8px;
}

.form-actions {
  padding: 0 16px;
}

.primary,
.secondary,
.danger,
.mini,
.upload-button {
  min-height: 34px;
  border-radius: 6px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.primary {
  background: var(--orange);
  color: #ffffff;
}

.secondary,
.mini {
  background: #eef1f4;
  color: #344054;
}

.danger {
  background: var(--orange-dark);
  color: #ffffff;
}

.mini {
  min-height: 28px;
  font-size: 12px;
}

.upload-button {
  background: #eef1f4;
  color: #344054;
  font-size: 13px;
}

.upload-button input {
  display: none;
}

.preview-panel {
  position: sticky;
  top: 18px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 8px;
  background: #eef1f4;
}

.segmented button {
  height: 30px;
  border-radius: 6px;
  padding: 0 8px;
  color: #475467;
  background: transparent;
  font-size: 12px;
}

.segmented button.active {
  background: #ffffff;
  color: var(--orange);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.phone-frame {
  width: 300px;
  height: 620px;
  margin: 18px auto 22px;
  padding: 14px;
  border-radius: 36px;
  background: #111827;
}

.phone-screen {
  width: 100%;
  height: 100%;
  border-radius: 24px;
  overflow: hidden;
  background: #ffe3df;
}

.preview-home {
  height: 100%;
  background: linear-gradient(180deg, #ef5128 0%, #ff7840 48%, #ffe3df 48%, #ffe3df 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.preview-home img {
  width: 190px;
  height: 200px;
  object-fit: contain;
  margin-top: 74px;
}

.preview-card {
  width: 246px;
  min-height: 160px;
  margin-top: -10px;
  padding: 24px 16px;
  border-radius: 18px;
  background: #ffffff;
  text-align: center;
}

.preview-title {
  font-size: 20px;
  font-weight: 800;
}

.preview-subtitle {
  margin-top: 9px;
  color: var(--orange);
  font-size: 14px;
  font-weight: 700;
}

.preview-button {
  height: 42px;
  margin: 22px auto 0;
  border-radius: 999px;
  background: var(--orange);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 700;
}

.preview-privacy {
  height: 100%;
  background: rgba(0, 0, 0, 0.44);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

.preview-dialog {
  width: 100%;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
}

.preview-dialog h3 {
  margin: 22px 18px 12px;
  text-align: center;
  font-size: 17px;
}

.preview-dialog p {
  margin: 0 18px 18px;
  color: #4f4f4f;
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
}

.preview-dialog-actions {
  height: 48px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.preview-dialog-actions span {
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid var(--line);
}

.preview-dialog-actions span:first-child {
  border-left: 0;
}

.preview-dialog-actions .agree {
  color: var(--orange);
  font-weight: 700;
}

.preview-coach {
  height: 100%;
  position: relative;
  padding-top: 30px;
  background: linear-gradient(180deg, #ff7b40 0%, #ef5128 100%);
}

.preview-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.16;
}

.preview-coach-title {
  position: relative;
  z-index: 1;
  margin-left: 26px;
  color: #ffffff;
  font-size: 26px;
  font-weight: 900;
  line-height: 1.18;
  white-space: pre-wrap;
}

.preview-hero {
  position: absolute;
  z-index: 1;
  right: 3px;
  top: 56px;
  width: 142px;
  height: 158px;
  object-fit: contain;
}

.preview-qr-card {
  position: relative;
  z-index: 2;
  width: 250px;
  min-height: 320px;
  margin: 80px auto 0;
  padding: 24px 16px;
  border-radius: 18px;
  background: #ffffff;
  text-align: center;
}

.preview-guide {
  font-size: 21px;
  font-weight: 900;
  line-height: 1.28;
  white-space: pre-wrap;
}

.preview-qr-wrap {
  width: 188px;
  height: 188px;
  margin: 22px auto 0;
  border: 6px solid var(--orange);
  border-radius: 16px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-qr {
  width: 164px;
  height: 164px;
  object-fit: contain;
}

.preview-hand {
  position: absolute;
  right: -40px;
  bottom: 8px;
  width: 58px;
  height: 58px;
  object-fit: contain;
}

@media (max-width: 1180px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    position: static;
  }
}
