:root {
  --bg: #f4f5f2;
  --card: #ffffff;
  --text: #171717;
  --muted: #747b87;
  --line: #e5e7eb;
  --soft: #f0f1ee;
  --dark: #171717;
  --green: #16a36b;
  --red: #dc2626;
  --shadow: 0 18px 48px rgba(15, 23, 42, .14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: #e9e8e3;
}

button, input, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

.phone-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.phone {
  width: min(430px, calc(100vw - 32px));
  height: min(920px, calc(100dvh - 32px));
  background: var(--bg);
  border: 12px solid #111827;
  border-radius: 42px;
  overflow: hidden;
  box-shadow: var(--shadow);
  position: relative;
}

.statusbar {
  height: 28px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,.92);
  font-size: 11px;
  font-weight: 800;
  color: #303645;
}

#app {
  height: calc(100% - 94px);
  overflow: auto;
  padding: 14px 16px calc(86px + env(safe-area-inset-bottom));
  overscroll-behavior: contain;
}

.workflow-switch {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.workflow-switch button {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: #273247;
  font-size: 12px;
  font-weight: 800;
}

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

.brand h1 {
  font-size: 25px;
  line-height: 1.1;
  margin: 0 0 5px;
  letter-spacing: 0;
}

.brand p, .hint {
  color: var(--muted);
  margin: 0;
  font-size: 12px;
}

.user-pill {
  max-width: 142px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
}

.user-pill img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-dot, .profile-avatar {
  display: inline-block;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d9d6ce, #171717);
}

.notice {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  font-size: 12px;
  font-weight: 800;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 12px;
}

.card.compact { padding: 7px; }

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

.card h2 {
  font-size: 16px;
  margin: 0;
}

.image-drop {
  height: 202px;
  border-radius: 16px;
  overflow: hidden;
  background: #eef0ec;
  position: relative;
  margin-bottom: 12px;
}

.image-drop img, .asset-img, .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.image-drop img, .asset-img.fit { object-fit: contain; background: #f9fafb; }

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.soft-btn, .ghost-link {
  min-height: 40px;
  border-radius: 13px;
  background: var(--soft);
  color: #273247;
  font-weight: 800;
  text-align: center;
}

.soft-btn.full { width: 100%; }

.ghost-link {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: transparent;
  color: var(--muted);
}

.primary {
  width: 100%;
  min-height: 52px;
  border-radius: 16px;
  background: var(--dark);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .16);
}

.seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 0;
}

.seg button {
  min-height: 36px;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
}

.seg button.active {
  color: var(--text);
  background: #fff;
  box-shadow: 0 4px 14px rgba(32, 45, 70, .08);
}

textarea {
  width: 100%;
  min-height: 78px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  outline: none;
  color: var(--text);
  background: #fbfcfe;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip {
  border-radius: 999px;
  padding: 7px 10px;
  background: #f2f3f0;
  color: #4d596d;
  font-size: 12px;
  font-weight: 800;
}

.filters {
  display: flex;
  overflow: auto;
  gap: 8px;
  margin: 4px 0 12px;
  padding-bottom: 2px;
}

.filters button {
  flex: 0 0 auto;
  border-radius: 999px;
  min-height: 34px;
  padding: 0 14px;
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
}

.filters button.active {
  background: var(--dark);
  color: #fff;
  border-color: var(--dark);
}

.asset-grid, .history-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.asset-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}

.asset-img { height: 142px; }
.asset-meta { padding: 10px; }
.asset-meta strong { display: block; font-size: 13px; margin-bottom: 6px; }
.asset-meta span { color: var(--muted); font-size: 12px; line-height: 1.35; }

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

.mini-preview {
  height: 176px;
  border-radius: 16px;
  overflow: hidden;
  background: #f8fafc;
}

.mini-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: #eceff3;
  overflow: hidden;
  margin: 16px 0;
}

.progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--dark);
  transition: width .25s ease;
}

.steps {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #d8dde6;
  border: 5px solid #fff;
  box-shadow: 0 0 0 1px var(--line);
}

.step.done { color: var(--text); font-weight: 800; }
.step.done .dot { background: var(--green); }

.result-main {
  height: 430px;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  margin-bottom: 12px;
  border: 1px solid var(--line);
}

.result-main img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.thumb {
  height: 82px;
  border-radius: 13px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
}

.video-card {
  width: 100%;
  height: 240px;
  border-radius: 16px;
  overflow: hidden;
  background: #101827;
  display: block;
  margin-bottom: 12px;
}

.image-video-preview {
  position: relative;
  color: #fff;
}

.image-video-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: .86;
  display: block;
}

.image-video-preview span {
  position: absolute;
  left: 14px;
  bottom: 14px;
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, .52);
  font-size: 12px;
  font-weight: 900;
}

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

.order-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}

.order-card strong, .order-side b {
  display: block;
  font-size: 15px;
}

.order-card span, .order-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}

.order-side {
  text-align: right;
  flex: 0 0 auto;
}

.order-side em {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #047857;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.profile-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-row img, .profile-avatar {
  width: 58px;
  height: 58px;
  border-radius: 18px;
  object-fit: cover;
}

.profile-row h2 { margin: 0 0 5px; }

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.stat {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
}

.stat strong { display: block; font-size: 20px; }
.stat span { color: var(--muted); font-size: 12px; }

.menu-list {
  display: grid;
  gap: 9px;
}

.menu-list button {
  min-height: 44px;
  border-radius: 13px;
  background: #f3f4f6;
  color: var(--text);
  font-weight: 800;
  text-align: left;
  padding: 0 14px;
}

.empty {
  grid-column: 1 / -1;
  color: var(--muted);
  text-align: center;
  padding: 30px 0;
}

.loading {
  min-height: 70vh;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 800;
}

.loading span {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid #d8dde6;
  border-top-color: var(--dark);
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 66px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: rgba(255,255,255,.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.tabbar button {
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.tabbar button.active { color: var(--text); }

@media (max-width: 460px) {
  .phone-shell { padding: 0; }
  .phone {
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }
}
