:root {
  /* 品牌主题色：由 utils/brand-loader.js 运行时覆盖。
     badge / mascot / pages 三个子页面都加载本文件，
     所以变量只需在这里定义一次。 */
  --brand-navy: #0A2E5D;
  --brand-navy-deep: #071E3C;
  --brand-gold: #F7B72C;
  --brand-bg: #F3F0E8;
}

@font-face {
  font-family: "FZHei B01S";
  src: url("../assets/fonts/FZHei-B01S.woff2") format("woff2"),
       url("../assets/fonts/FZHei-B01S.ttf") format("truetype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fira Sans Extra Condensed";
  src: url("../assets/fonts/FiraSansExtraCondensed-Regular.woff2") format("woff2"),
       url("../assets/fonts/FiraSansExtraCondensed-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fira Sans Extra Condensed";
  src: url("../assets/fonts/FiraSansExtraCondensed-Black.woff2") format("woff2"),
       url("../assets/fonts/FiraSansExtraCondensed-Black.ttf") format("truetype");
  font-weight: 800 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color: #1c1917;
  background: var(--brand-bg);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", "FZHei B01S", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
}

#app-root[hidden] { display: none !important; }
#app-root {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--brand-bg);
}

.login-gate[hidden] { display: none !important; }
.login-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 20px;
  background: #f5f6f7;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 12px;
  padding: 40px 32px 32px;
  box-shadow: 0 1px 2px rgba(31, 35, 41, 0.08), 0 8px 24px rgba(31, 35, 41, 0.08);
  text-align: center;
}
.login-brand {
  margin: 0 0 20px;
  color: var(--brand-navy);
  font-weight: 600;
  letter-spacing: 0.06em;
}
.login-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
  color: #1f2329;
}
.login-card p {
  margin: 0 0 24px;
  color: #646a73;
  font-size: 14px;
  line-height: 1.6;
}
.login-card .btn,
.login-card a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
  width: auto;
  min-width: 220px;
  max-width: 100%;
  margin: 0 auto;
  padding: 10px 28px;
  border: 0;
  border-radius: 10px;
  background: var(--brand-navy);
  color: #fff;
  cursor: pointer;
}
.login-error { margin: 16px 0 0; color: #d83931; font-size: 13px; }

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: stretch;
  gap: 16px;
  height: 56px;
  padding: 0 20px;
  background: var(--brand-navy);
  color: #fff;
}
.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  height: 100%;
}
.topbar-mark { display: block; height: 32px; width: auto; flex: 0 0 auto; }
.topbar-name {
  margin: 0;
  line-height: 1;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.06em;
  font-size: 16px;
  color: #fff;
}
.topbar-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.4);
  flex: 0 0 auto;
}
.topbar-nav {
  display: flex;
  align-self: stretch;
  align-items: stretch;
  gap: 4px;
  margin: 0 0 0 8px;
  padding-top: 8px;
}
.topbar-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 76px;
  padding: 0 18px;
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  border-radius: 8px 8px 0 0;
  white-space: nowrap;
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 0;
}
.topbar-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}
.topbar-nav a.is-on,
.topbar-nav a[aria-current="page"] {
  color: var(--brand-navy);
  background: var(--brand-bg);
  font-weight: 700;
  box-shadow: inset 0 3px 0 var(--brand-gold);
}
.topbar-logout {
  margin-left: auto;
  align-self: center;
  color: #fff;
  font-size: 13px;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 6px;
}
.topbar-logout:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
}

.topbar-note {
  margin: 0 0 0 auto;
  align-self: center;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.88);
}
.topbar-note[hidden] { display: none; }
.topbar-note:not([hidden]) + .topbar-logout { margin-left: 8px; }

.layout {
  flex: 1;
  min-height: 0;
  width: 100%;
  margin: 0;
  padding: 10px 14px 12px;
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
}

.panel {
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stage-col {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card {
  background: #fffcf7;
  border: 1px solid #e6e0d6;
  border-radius: 10px;
  padding: 8px 10px 10px;
  margin: 0;
  min-width: 0;
  flex: 0 0 auto;
}
.card-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-head h2 {
  margin: 0;
  font-size: 14px;
  color: var(--brand-navy);
}
.mark {
  width: 4px;
  height: 12px;
  background: var(--brand-gold);
}

.hint, .status, .footnote {
  margin: 4px 0 0;
  color: #6b645c;
  font-size: 12px;
  line-height: 1.4;
}
.status:empty { display: none; }
.status.error { color: #8a3b12; }
.status.ok { color: #1b5e3b; }

.field {
  display: block;
  padding: 3px 0 2px;
  border-bottom: 1px solid #efeae2;
}
.field span, .label {
  display: block;
  margin: 8px 0 4px;
  color: #6b645c;
  font-size: 11px;
}
.field span { margin: 0; }
input, textarea, select {
  width: 100%;
  border: 0;
  padding: 1px 0 2px;
  background: transparent;
  outline: none;
}
textarea { resize: vertical; min-height: 4.2em; }
select {
  background: #fffcf7;
  border: 1px solid #e6e0d6;
  border-radius: 6px;
  padding: 4px 8px;
}

.btn, .text-btn, .link {
  border: 0;
  background: transparent;
  cursor: pointer;
}
.btn {
  display: block;
  width: 100%;
  margin-top: 0;
  border-radius: 8px;
  text-align: center;
  padding: 8px 12px;
}
.btn-primary { background: var(--brand-navy); color: #fff; }
.btn-ghost {
  background: #fffcf7;
  color: var(--brand-navy);
  border: 1px solid #d9d2c6;
}
.btn-primary:hover { background: #082346; }
.btn-ghost:hover { background: #f3efe6; }
.btn:disabled, .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-inline {
  width: auto;
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 12px;
}
.text-btn {
  padding: 6px 0 2px;
  font-size: 12px;
  color: var(--brand-navy);
  text-align: left;
}
.btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 6px;
}
.btn-row .btn { margin: 0; }

.mode-picks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.mode-opt, .chip, .style-opt {
  border: 1px solid #d9d2c6;
  background: #fffcf7;
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--brand-navy);
  cursor: pointer;
}
.mode-opt.is-on, .chip.is-on {
  background: var(--brand-navy);
  color: #fff;
  border-color: var(--brand-navy);
}

.template-list, .page-thumbs, .file-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.page-thumbs { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); }
.tpl-card, .page-thumb, .file-item {
  border: 1px solid #e6e0d6;
  border-radius: 8px;
  background: #fff;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  color: inherit;
  width: 100%;
}
.tpl-card.is-on, .page-thumb.is-on, .file-item.is-on {
  border-color: var(--brand-navy);
  box-shadow: 0 0 0 2px rgba(19, 63, 153, 0.25);
}
.tpl-card img, .page-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 210 / 297;
  object-fit: cover;
  background: var(--brand-bg);
}
.tpl-card span, .page-thumb span, .file-item span {
  display: block;
  padding: 6px 8px 7px;
  font-size: 11px;
  color: #3f3a36;
  line-height: 1.3;
}
.file-item { padding: 8px 10px; }
.file-item strong { display: block; font-size: 13px; color: var(--brand-navy); }
.file-item em { display: block; font-style: normal; font-size: 11px; color: #6b645c; margin-top: 2px; }
.file-item .file-actions { display: flex; gap: 8px; margin-top: 6px; }
.file-item .file-actions button { font-size: 12px; color: #8a3b12; }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip { padding: 5px 8px; font-size: 12px; }

.color-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  margin-top: 6px;
}
.color-field { display: flex; align-items: center; gap: 8px; border-bottom: 0; }
.color-field span { flex: 1; }
.color-field input[type="color"] {
  width: 36px;
  height: 24px;
  padding: 0;
  border: 1px solid #d9d2c6;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
}

.asset-slider {
  display: grid;
  grid-template-columns: 52px 1fr 40px;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: #6b645c;
}
.asset-slider input[type="range"] { width: 100%; padding: 0; }
.asset-slider em { font-style: normal; text-align: right; color: #3f3a36; }

.stage-toolbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px 8px;
}
.stage-spacer { flex: 1; }
#page-label { font-size: 13px; color: var(--brand-navy); }

.stage {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e8e2d6;
  border: 1px solid #d9d2c6;
  border-radius: 10px;
}
.stage-inner {
  position: relative;
  transform-origin: center center;
}

.sheet {
  background: #fff;
  box-shadow: 0 8px 28px rgba(28, 25, 23, 0.18);
  position: relative;
}
.sheet [data-slot] { cursor: pointer; }
.sheet [data-slot].is-selected {
  outline: 2px solid var(--brand-navy);
  outline-offset: 1px;
  position: relative;
  z-index: 2;
}
.sheet.is-exporting [data-slot].is-selected { outline: none; }

.logo-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  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%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.modal[hidden] { display: none !important; }
.modal {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 24px;
}
.modal-card {
  width: min(520px, 100%);
  max-height: 80vh;
  overflow: auto;
  background: #fffcf7;
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 16px 40px rgba(28, 25, 23, 0.2);
}
.file-list { grid-template-columns: 1fr; }

.logo-line {
  border-top: 1px solid #efeae2;
  padding-top: 6px;
  margin-top: 8px;
}

#logo-extra-actions[hidden] { display: none !important; }
.logo-canvas {
  box-shadow: 0 8px 28px rgba(28, 25, 23, 0.18);
}
.logo-line-text { cursor: text; }

.logo-stage {
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo-canvas { box-shadow: 0 8px 28px rgba(28, 25, 23, 0.18); }
.logo-mark { display: block; flex: 0 0 auto; }
.logo-texts { min-width: 0; }
.logo-line-text { cursor: pointer; }
