:root {
  --bg: #f6eadb;
  --surface: #fffaf3;
  --surface-strong: #fffdf8;
  --ink: #31241b;
  --muted: #876d5b;
  --soft: #f3dfc8;
  --line: rgba(112, 78, 52, 0.18);
  --accent: #bd6438;
  --accent-2: #d39553;
  --green: #2f9277;
  --danger: #b9473d;
  --shadow: 0 18px 42px rgba(80, 52, 31, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Segoe UI", "Microsoft YaHei UI", sans-serif;
  background:
    radial-gradient(circle at 16% 8%, rgba(217, 164, 65, 0.24), transparent 28%),
    radial-gradient(circle at 88% 82%, rgba(47, 146, 119, 0.18), transparent 32%),
    linear-gradient(135deg, #fff7ea, var(--bg));
}

button, input, textarea { font: inherit; }
button { border: 0; cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: 24px; letter-spacing: 0; }
h2 { margin: 0; font-size: 18px; letter-spacing: 0; }
p { color: var(--muted); line-height: 1.65; }
label { display: block; margin: 12px 0 7px; color: var(--muted); font-weight: 700; }

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.shell {
  width: min(1540px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

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

.brand p { margin: 0; font-size: 13px; }

.logo {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  color: #fffaf2;
  background: linear-gradient(145deg, #c9653b, #dfa75d 45%, #2f9277);
  box-shadow: 0 14px 30px rgba(111, 67, 35, 0.18);
}

.logo::after {
  content: "";
  position: absolute;
  right: 8px;
  bottom: 7px;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 250, 242, 0.92);
  border-radius: 5px;
  transform: rotate(-8deg);
  z-index: 2;
}

.logo svg {
  position: absolute;
  left: 12px;
  top: 10px;
  width: 14px;
  height: 14px;
  z-index: 1;
}

.logo > * {
  position: relative;
  z-index: 1;
}

nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 9px;
}

.badge, .nav-link, .soft, .ghost, .icon-soft, .mini-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.78);
}

.soft:hover, .ghost:hover, .icon-soft:hover, .mini-action:hover, .nav-link:hover {
  background: #fffdf8;
  border-color: rgba(189, 100, 56, 0.34);
}

.icon-soft {
  width: 36px;
  padding: 0;
}

.primary, .generate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: 8px;
  color: #fffaf2;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--green));
}

.primary.small, .soft.small {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.primary.full, .generate { width: 100%; }
.generate { min-height: 46px; margin-top: 4px; font-size: 16px; flex: 0 0 auto; }
.generate:disabled, .primary:disabled { opacity: 0.58; cursor: not-allowed; }
.disabled { opacity: 0.52; pointer-events: none; }

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  color: var(--ink);
  background: #fffefb;
}

input { height: 42px; padding: 0 12px; }
textarea {
  padding: 13px;
  resize: none;
  line-height: 1.55;
}

input:focus, textarea:focus {
  border-color: rgba(189, 100, 56, 0.55);
  box-shadow: 0 0 0 3px rgba(189, 100, 56, 0.12);
}

.auth-grid {
  display: grid;
  grid-template-columns: 1fr 390px;
  gap: 18px;
  align-items: stretch;
}

.intro-card {
  min-height: 430px;
  padding: 42px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 250, 242, 0.92), rgba(249, 226, 196, 0.72)),
    url("data:image/svg+xml,%3Csvg width='180' height='180' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23b96a3d' stroke-opacity='.12'%3E%3Cpath d='M0 90h180M90 0v180'/%3E%3Ccircle cx='90' cy='90' r='48'/%3E%3C/g%3E%3C/svg%3E");
  box-shadow: var(--shadow);
}

.eyebrow {
  display: inline-flex;
  margin-bottom: 16px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--accent);
  font-weight: 800;
  background: rgba(255, 253, 248, 0.78);
}

.intro-card h2 {
  max-width: 760px;
  margin-bottom: 18px;
  font-size: 46px;
  line-height: 1.12;
}

.intro-card p { max-width: 710px; font-size: 16px; }

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.pill-row span {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.78);
}

.auth-card { padding: 18px; }

.email-login-box {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.email-login-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.email-login-head::-webkit-details-marker {
  display: none;
}

.email-login-head small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.email-login-box[open] .email-login-head small::before {
  content: "收起";
}

.email-login-box[open] .email-login-head small {
  font-size: 0;
}

.email-login-box[open] .email-login-head small::before {
  font-size: 12px;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
}

.tabs button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.72);
}

.tabs button.active {
  color: #fffaf2;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #c88645);
}

.auth-card .primary { width: 100%; margin-top: 16px; }
.hint, .privacy-note { margin: 12px 0 0; font-size: 12px; color: var(--muted); }
.wechat-login-note {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid rgba(47, 146, 119, 0.22);
  border-radius: 8px;
  color: #315f53;
  background: rgba(226, 246, 238, 0.66);
  font-size: 12px;
  line-height: 1.55;
}

.wechat-login-note strong {
  color: #21483f;
  font-size: 13px;
}

.wechat-login-button {
  width: 100%;
  min-height: 38px;
  margin-top: 6px;
  border: 1px solid rgba(47, 146, 119, 0.28);
  border-radius: 8px;
  color: #25584d;
  background: rgba(255, 250, 242, 0.86);
  font-weight: 800;
}

.wechat-login-button:disabled {
  opacity: 0.72;
  cursor: wait;
}

.web-login-qr {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 12px;
  border: 1px solid rgba(47, 146, 119, 0.18);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.72);
  text-align: center;
}

.web-login-qr img {
  width: min(190px, 100%);
  aspect-ratio: 1;
  border-radius: 8px;
  background: #fff;
}

.web-login-qr span {
  color: #315f53;
}
code {
  padding: 2px 5px;
  border-radius: 6px;
  background: rgba(111, 77, 50, 0.08);
}

.home-panel {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.home-section {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 242, 0.72);
  box-shadow: 0 14px 34px rgba(80, 52, 31, 0.1);
}

.home-head {
  display: grid;
  gap: 10px;
  max-width: 760px;
  margin-bottom: 18px;
}

.home-head .eyebrow {
  width: fit-content;
  margin: 0;
}

.home-head h2 {
  font-size: 28px;
  line-height: 1.2;
}

.home-head p {
  margin: 0;
}

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

.showcase-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.showcase-card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.showcase-card div {
  display: grid;
  gap: 6px;
  padding: 12px;
}

.showcase-card strong,
.scenario-grid strong,
.steps-grid strong {
  font-size: 16px;
}

.showcase-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.scenario-grid,
.steps-grid {
  display: grid;
  gap: 12px;
}

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

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

.scenario-grid article,
.steps-grid article {
  min-height: 132px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.scenario-grid p,
.steps-grid p {
  margin: 8px 0 0;
  font-size: 13px;
}

.steps-grid span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 30px;
  margin-bottom: 12px;
  border-radius: 8px;
  color: #fffaf2;
  font-weight: 900;
  background: linear-gradient(135deg, var(--accent), var(--green));
}

.workspace {
  display: grid;
  grid-template-columns: minmax(310px, 360px) minmax(520px, 1fr) minmax(300px, 380px);
  grid-template-rows: minmax(640px, calc(100vh - 128px)) auto;
  gap: 14px;
  align-items: stretch;
}

.composer, .viewer, .library, .history {
  min-width: 0;
  padding: 14px;
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow: auto;
  padding-bottom: 18px;
}

.panel-head, .section-head, .viewer-toolbar, .modal-head, .section-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.prompt-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-head span, .section-head span, .viewer-toolbar span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

#promptInput {
  min-height: 180px;
  flex: 1 1 180px;
}

.section-line {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.section-line > span:first-child { margin-right: auto; }
.mini-action { min-height: 32px; padding: 0 10px; font-size: 12px; }
.optional-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.72);
  font-size: 12px;
}
.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.72);
}

.thumb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 48px;
}

.thumb {
  position: relative;
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fffdf8;
}

.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb button {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 19px;
  height: 19px;
  border-radius: 6px;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
}

.custom-size {
  width: 118px;
  height: 34px;
  font-size: 13px;
}

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

.ratio-card {
  min-height: 50px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  background: rgba(255, 255, 251, 0.76);
}

.ratio-card.active {
  border-color: rgba(47, 146, 119, 0.45);
  background: rgba(226, 246, 238, 0.9);
}

.ratio-card strong { display: block; font-size: 12px; }
.ratio-card span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }

.viewer {
  display: flex;
  min-height: 640px;
  flex-direction: column;
}

.viewer-toolbar {
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.zoom-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

#zoomRange { width: 150px; accent-color: var(--accent); }
#zoomText {
  min-width: 46px;
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.image-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(45deg, rgba(122, 94, 70, 0.055) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(122, 94, 70, 0.055) 25%, transparent 25%),
    #fffaf2;
  background-size: 22px 22px;
  touch-action: none;
}

.image-stage.dragging { cursor: grabbing; }

.image-stage img {
  position: absolute;
  top: 0;
  left: 0;
  display: none;
  max-width: none;
  max-height: none;
  transform-origin: top left;
  user-select: none;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 44px;
  height: 44px;
  color: rgba(189, 100, 56, 0.72);
}

.empty-state strong {
  color: var(--ink);
  font-size: 17px;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.model-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.library {
  display: flex;
  min-height: 640px;
  flex-direction: column;
  gap: 12px;
}

.search-box {
  position: relative;
}

.search-box svg {
  position: absolute;
  top: 12px;
  left: 12px;
  color: var(--muted);
}

.search-box input { padding-left: 38px; }

.drawer-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.drawer-tabs button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.78);
  font-size: 13px;
}

.drawer-tabs button.active {
  color: #fffaf2;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.case-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  overflow: auto;
  padding-right: 2px;
}

.case-card {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.84);
}

.case-cover {
  display: grid;
  place-items: center;
  width: 96px;
  height: 112px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #f5eadc;
}

.case-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.18s ease;
}

.case-cover:hover img { transform: scale(1.06); }

.case-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.case-body strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 14px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.case-body p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  font-size: 12px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.case-body small { color: var(--muted); font-size: 11px; }
.case-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.history {
  grid-column: 1 / 4;
}

.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.history-item {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefb;
}

.history-item.running {
  border-color: rgba(47, 146, 119, 0.35);
  background: rgba(226, 246, 238, 0.55);
}

.history-item.failed {
  border-color: rgba(185, 71, 61, 0.22);
  background: rgba(255, 246, 240, 0.86);
}

.history-image {
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #f5eadc;
}

.history-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  color: var(--muted);
  background: #fffdf8;
}

.status-badge.running {
  color: var(--green);
  background: rgba(226, 246, 238, 0.9);
}

.status-badge.failed {
  color: var(--danger);
  background: rgba(185, 71, 61, 0.08);
}

.danger-action {
  color: var(--danger);
}

.history-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-body p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.history-body small { color: var(--muted); font-size: 12px; }
.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(62, 43, 30, 0.28);
}

.modal-card {
  width: min(760px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-head {
  margin-bottom: 14px;
}

.access-card { width: min(560px, calc(100vw - 36px)); }

.access-box {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefb;
}

.access-row {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 8px;
}

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

.hint-row .hint {
  margin: 0;
}

.plan {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefb;
}

.plan strong { display: block; font-size: 18px; }
.plan span { display: block; margin: 8px 0 12px; color: var(--muted); }

.detail-card, .preview-modal-card {
  width: min(1180px, calc(100vw - 36px));
}

.case-edit-card {
  width: min(760px, calc(100vw - 36px));
}

.case-edit-form {
  display: grid;
  gap: 10px;
}

.case-edit-form label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

#caseEditPrompt {
  min-height: 280px;
}

#caseEditNote {
  min-height: 110px;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
  gap: 14px;
}

.detail-image-wrap {
  display: grid;
  place-items: center;
  min-height: 480px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.progressive-image {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 480px;
}

.progressive-image img {
  grid-area: 1 / 1;
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}

.progressive-thumb {
  filter: saturate(0.92);
  opacity: 0.92;
}

.progressive-full {
  opacity: 0;
  transition: opacity 180ms ease;
}

.progressive-full.is-loaded {
  opacity: 1;
}

.image-loading {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 7px 12px;
  border: 1px solid rgba(169, 119, 73, 0.22);
  border-radius: 999px;
  background: rgba(255, 250, 242, 0.92);
  color: var(--muted);
  font-size: 12px;
  box-shadow: 0 8px 22px rgba(84, 54, 28, 0.08);
}

.detail-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

.detail-meta span {
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fffefb;
  font-size: 12px;
}

.detail-meta strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

#detailPrompt {
  min-height: 300px;
  flex: 1 1 auto;
}

.preview-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.8fr) minmax(360px, 1.2fr);
  gap: 14px;
}

#previewImage {
  width: 100%;
  max-height: 64vh;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

#previewPrompt {
  min-height: 430px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.link-button { padding: 0 14px; }
.confirm-card { width: min(520px, calc(100vw - 36px)); }
.progress-card {
  width: min(360px, calc(100vw - 36px));
  text-align: center;
}

.spinner {
  width: 42px;
  height: 42px;
  margin: 8px auto 12px;
  border: 4px solid rgba(189, 100, 56, 0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

.progress-line {
  height: 8px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(111, 77, 50, 0.1);
}

.progress-line span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--accent), var(--green));
  animation: progress 1.4s ease-in-out infinite alternate;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes progress { from { transform: translateX(0); } to { transform: translateX(140%); } }

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  display: none;
  max-width: 380px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toast.show { display: block; }
.toast strong { display: block; margin-bottom: 3px; }
.toast p { margin: 0; font-size: 13px; }
.empty-list {
  display: grid;
  place-items: center;
  min-height: 120px;
  padding: 14px;
  color: var(--muted);
  text-align: center;
}

.hidden { display: none !important; }

.admin-shell .card { padding: 16px; margin-bottom: 14px; }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.stat span { color: var(--muted); }
.stat strong { display: block; margin-top: 8px; font-size: 32px; }

.admin-search-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 110px;
  gap: 10px;
  margin-top: 12px;
}

.toggle-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  white-space: nowrap;
}

.toggle-line input {
  width: 18px;
  height: 18px;
}

.notice-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.notice-form label {
  margin: 0;
  font-size: 12px;
}

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

.notice-upload-panel {
  display: grid;
  grid-template-columns: 112px minmax(160px, 1fr);
  align-items: center;
  gap: 12px;
}

.notice-upload-panel img {
  width: 112px;
  height: 112px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  object-fit: cover;
}

.notice-file-label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-weight: 800;
}

.notice-file-label input {
  height: auto;
  padding: 8px;
  background: #fffefb;
}

.notice-save-btn {
  min-height: 42px;
  align-self: end;
}

.user-detail-panel {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.user-search-results {
  margin-top: 12px;
}

.match-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
}

.match-card {
  display: grid;
  gap: 5px;
  min-height: 72px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefb;
  text-align: left;
}

.match-card strong {
  color: var(--ink);
  font-size: 16px;
}

.match-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.match-card em {
  width: fit-content;
  padding: 4px 8px;
  border: 1px solid rgba(47, 146, 119, 0.22);
  border-radius: 8px;
  color: #25584d;
  background: rgba(226, 246, 238, 0.68);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.detail-summary > div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefb;
}

.detail-summary span,
.detail-summary small {
  display: block;
  color: var(--muted);
}

.detail-summary strong {
  display: block;
  margin: 6px 0;
  font-size: 22px;
}

.admin-credit-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.72);
}

.admin-credit-copy strong,
.admin-credit-copy small,
.admin-inline-adjust label span {
  display: block;
}

.admin-credit-copy strong {
  margin-bottom: 4px;
  font-size: 15px;
}

.admin-credit-copy small,
.admin-inline-adjust label span {
  color: var(--muted);
}

.admin-inline-adjust {
  display: grid;
  grid-template-columns: 120px minmax(220px, 1fr) 118px;
  align-items: end;
  gap: 10px;
}

.admin-inline-adjust label {
  display: grid;
  gap: 6px;
}

.admin-inline-adjust label span {
  font-size: 12px;
}

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

.detail-columns h3 {
  margin: 0 0 8px;
}

.mini-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.mini-list article {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffefb;
}

.mini-list p {
  margin: 5px 0;
  color: var(--muted);
}

.mini-list small {
  color: var(--muted);
}

.table-wrap { overflow-x: auto; }
.table-scroll {
  max-height: 420px;
  overflow: auto;
  border: 1px solid rgba(112, 78, 52, 0.1);
  border-radius: 8px;
}

.compact-scroll { max-height: 300px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  font-weight: 800;
  background: #fffaf3;
}

.muted-row {
  color: var(--muted);
  background: rgba(120, 100, 80, 0.04);
}

.muted-row strong {
  color: inherit;
}

.empty-cell {
  padding: 24px 12px;
  color: var(--muted);
  text-align: center;
}

.adjust {
  display: flex;
  gap: 6px;
  min-width: 220px;
}

.adjust input { width: 76px; height: 34px; }
.adjust button { min-height: 34px; padding: 0 9px; }

.admin-action-btn {
  min-width: 0;
  width: fit-content;
  white-space: nowrap;
}

.danger-soft {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid rgba(185, 71, 61, 0.24);
  border-radius: 8px;
  color: var(--danger);
  background: rgba(185, 71, 61, 0.07);
}

.danger-soft:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.delta-plus { color: var(--green); }
.delta-minus { color: var(--danger); }

.code-form {
  display: grid;
  grid-template-columns: 160px 130px minmax(220px, 1fr) 128px;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}

.code-form label {
  margin: 0;
  font-size: 12px;
}

.new-codes {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(47, 146, 119, 0.28);
  border-radius: 8px;
  background: rgba(226, 246, 238, 0.74);
}

.code-line {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) 70px 72px;
  gap: 8px;
  align-items: center;
}

.code-line code {
  overflow-wrap: anywhere;
  font-weight: 800;
  letter-spacing: 0.04em;
}

@media (max-width: 1180px) {
  .auth-grid, .workspace, .detail-layout, .preview-layout, .stats-grid, .code-form, .detail-summary, .detail-columns, .admin-inline-adjust, .notice-form {
    grid-template-columns: 1fr;
  }

  .showcase-grid, .scenario-grid, .steps-grid {
    grid-template-columns: 1fr 1fr;
  }

  .workspace {
    grid-template-rows: auto;
  }

  .history { grid-column: auto; }
  .library, .viewer { min-height: auto; }
  .image-stage { min-height: 460px; }
}

@media (max-width: 680px) {
  .shell { width: min(100vw - 16px, 1540px); padding-top: 10px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  nav { justify-content: flex-start; }
  .intro-card { padding: 24px; }
  .intro-card h2 { font-size: 32px; }
  .home-section { padding: 18px; }
  .home-head h2 { font-size: 23px; }
  .showcase-grid, .scenario-grid, .steps-grid { grid-template-columns: 1fr; }
  .ratio-grid, .detail-meta, .access-row { grid-template-columns: 1fr; }
  .case-card, .history-item { grid-template-columns: 88px 1fr; }
  .case-cover, .history-image { width: 88px; height: 96px; }
  #zoomRange { width: 96px; }
}
