:root {
  /* 品牌主题色：由 utils/brand-loader.js 在运行时覆盖，
     下面的值是捷运通默认值，加载器未执行时也能正常显示 */
  --brand-navy: #0A2E5D;
  --brand-navy-deep: #071E3C;
  --brand-gold: #F7B72C;
  --brand-bg: #F3F0E8;

  color: #1c1917;
  background: var(--brand-bg);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

button, input, textarea {
  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);
}

.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-sub {
  margin: 0;
  line-height: 1;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.88);
}

.layout {
  flex: 1;
  min-height: 0;
  width: 100%;
  margin: 0;
  padding: 10px 14px 12px;
  display: grid;
  grid-template-columns: minmax(420px, 1.05fr) minmax(0, 1.2fr);
  gap: 12px;
  overflow: hidden;
}

.form {
  min-height: 0;
  overflow: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form > * {
  flex: 0 0 auto;
  min-height: auto;
}

.intro h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--brand-navy);
}

.intro p,
.hint,
.footnote,
.status {
  margin: 2px 0 0;
  color: #6b645c;
  font-size: 12px;
  line-height: 1.4;
}

.status:empty { display: none; }
.status.error { color: #8a3b12; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  align-items: start;
  min-height: auto;
}

.form-grid .card {
  overflow: visible;
}

.card {
  background: #fffcf7;
  border: 1px solid #e6e0d6;
  border-radius: 10px;
  padding: 8px 10px 6px;
  margin: 0;
  min-width: 0;
}

.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);
}

.field {
  display: block;
  padding: 3px 0 2px;
  border-bottom: 1px solid #efeae2;
}

.field span,
.label {
  display: block;
  margin-bottom: 0;
  color: #6b645c;
  font-size: 11px;
}

input, textarea {
  width: 100%;
  border: 0;
  padding: 1px 0 2px;
  background: transparent;
  outline: none;
}

textarea {
  resize: none;
  min-height: 1.7em;
}

.form .btn {
  margin-top: 6px;
  padding: 5px 10px;
}

.form .text-btn,
.form .link {
  padding: 4px 0;
  font-size: 12px;
}

.qr-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.qr-row img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #e6e0d6;
}

.btn, .text-btn, .link {
  border: 0;
  background: transparent;
  cursor: pointer;
}

.btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  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 var(--brand-navy);
}
.text-btn, .link {
  color: var(--brand-navy);
  padding: 6px 0;
  font-size: 13px;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preview-col,
.preview-card {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.preview-card { flex: 1; }

.style-picks {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 8px 0 0;
}

.style-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  margin: 0;
  padding: 6px 8px;
  width: 100%;
  text-align: left;
  border: 1px solid #e6e0d6;
  border-radius: 8px;
  background: #fffcf7;
  color: inherit;
  cursor: pointer;
}
.style-opt.is-on {
  border-color: var(--brand-navy);
  box-shadow: inset 0 0 0 1px var(--brand-navy);
  background: #f3f6fd;
}
.style-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-navy);
}
.style-desc {
  font-size: 11px;
  color: #6b645c;
  line-height: 1.3;
}

.preview-sides {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  flex: 1;
  min-height: 0;
  margin-top: 8px;
  align-items: start;
}

.preview-side {
  margin: 0;
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.side {
  margin: 0 0 4px;
  color: #6b645c;
  font-size: 12px;
  flex: 0 0 auto;
}

canvas {
  width: 100%;
  height: auto;
  display: block;
  background: #fff;
  border: 1px solid #e4ddd2;
  border-radius: 2px;
}

.preview-side canvas {
  flex: 0 1 auto;
  width: 100%;
  height: auto;
  max-width: 100%;
  max-height: calc(100% - 18px);
  aspect-ratio: 1063 / 638;
  object-fit: contain;
  object-position: top center;
}

.actions {
  flex: 0 0 auto;
  margin-top: 8px;
}
.actions .btn { margin-top: 0; }
.actions .action-row + .action-row { margin-top: 8px; }

.exports {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-top: 8px;
  flex: 0 0 auto;
}

.exports img {
  width: auto;
  height: 56px;
  max-width: 160px;
  object-fit: contain;
  background: #fff;
  border: 1px solid #e6e0d6;
}

.exports img.export-wide { max-width: 200px; height: 48px; }
.exports img.export-tall { height: 72px; width: auto; }

.exports[hidden], .qr-row[hidden] { display: none; }

.footnote { margin: 6px 0 0; flex: 0 0 auto; }



@media (max-width: 959px) {
  #app-root {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }
  .layout {
    display: block;
    height: auto;
    overflow: visible;
    padding: 12px;
  }
  .form { overflow: visible; }
  .form-grid,
  .preview-sides { grid-template-columns: 1fr; }
  .preview-col,
  .preview-card { overflow: visible; }
}


.editor-tools { flex: 0 0 auto; }
.tool-label {
  margin: 8px 0 4px;
  color: #6b645c;
  font-size: 12px;
}
.tool-label:first-child { margin-top: 6px; }
.template-picks {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.template-opt {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  margin: 0;
  padding: 6px;
  width: 100%;
  text-align: left;
  border: 1px solid #e6e0d6;
  border-radius: 8px;
  background: #fff;
  color: inherit;
  cursor: pointer;
}
.template-opt.is-on {
  border-color: var(--brand-navy);
  box-shadow: inset 0 0 0 1px var(--brand-navy);
  background: #f3f6fd;
}
.template-thumb {
  width: 100%;
  height: auto;
  display: block;
  background: #fff;
  border: 1px solid #efeae2;
  border-radius: 3px;
}
.type-tools {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 0 0 4px;
}
.type-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.type-row > span {
  color: #6b645c;
  font-size: 12px;
}
.seg {
  display: flex;
  border: 1px solid #e6e0d6;
  border-radius: 8px;
  overflow: hidden;
  background: #fffcf7;
}
.seg .type-opt {
  flex: 1;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 6px 4px;
  font-size: 12px;
  color: inherit;
  cursor: pointer;
}
.seg .type-opt + .type-opt { border-left: 1px solid #e6e0d6; }
.seg .type-opt.is-on {
  background: var(--brand-navy);
  color: #fff;
}

@media (max-width: 1100px) {
  .template-picks { grid-template-columns: 1fr 1fr; }
  .type-tools { grid-template-columns: 1fr; }
}

.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,
.login-card .btn.btn-primary {
  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;
}
.login-card .btn:disabled {
  opacity: 0.7;
  cursor: default;
}
.login-note {
  margin: 16px 0 0 !important;
  font-size: 12px !important;
  color: #8f959e !important;
}

.login-error {
  margin: 16px 0 0 !important;
  color: #d83931 !important;
  font-size: 13px !important;
}

.stock-tools { flex: 0 0 auto; margin-top: 8px; }
.stock-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  min-width: 0;
}
.stock-row > span {
  flex: 0 0 32px;
  color: #6b645c;
  font-size: 12px;
}
.stock-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.stock-opt {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 3px 8px 3px 4px;
  width: auto;
  border: 1px solid #e6e0d6;
  border-radius: 8px;
  background: #fffcf7;
  color: inherit;
  font-size: 12px;
  cursor: pointer;
}
.stock-opt.is-on {
  border-color: var(--brand-navy);
  box-shadow: inset 0 0 0 1px var(--brand-navy);
  background: #f3f6fd;
}
.stock-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(28, 25, 23, 0.14);
  flex: 0 0 auto;
}
.swatch-white { background: #fff; }
.swatch-ivory { background: #f6f0e3; }
.swatch-cream { background: #f3e6c4; }
.swatch-vellum { background: #eceae6; }
.swatch-pearl {
  background: linear-gradient(135deg, #ffffff 0%, #e8eef4 48%, #f7fbff 100%);
}
.swatch-kraft { background: #e3c49a; }
.tex-none { background: #f7f4ee; }
.tex-linen {
  background-color: #f3eee4;
  background-image: repeating-linear-gradient(0deg, rgba(80,60,40,0.18) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, rgba(80,60,40,0.12) 0 1px, transparent 1px 4px);
}
.tex-laid {
  background-color: #f3eee4;
  background-image: repeating-linear-gradient(0deg, rgba(80,60,40,0.2) 0 1px, transparent 1px 3px);
}
.tex-cotton {
  background-color: #f3eee4;
  background-image: radial-gradient(circle at 30% 40%, rgba(80,60,40,0.28) 0 0.8px, transparent 1.1px),
    radial-gradient(circle at 70% 65%, rgba(80,60,40,0.2) 0 0.7px, transparent 1px);
  background-size: 6px 6px, 7px 5px;
}
.tex-canvas {
  background-color: #f3eee4;
  background-image: repeating-linear-gradient(45deg, rgba(80,60,40,0.16) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(-45deg, rgba(80,60,40,0.12) 0 1px, transparent 1px 4px);
}
.tex-stipple {
  background-color: #f3eee4;
  background-image: radial-gradient(rgba(80,60,40,0.28) 0.55px, transparent 0.7px);
  background-size: 3px 3px;
}

.asset-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.asset-opt,
.asset-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 4px 2px 3px;
  border: 1px solid #e6e0d6;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  color: inherit;
  flex: 0 0 calc((100% - 16px) / 5);
  width: calc((100% - 16px) / 5);
  min-width: 0;
  box-sizing: border-box;
}

.asset-add {
  border-style: dashed;
  border-color: var(--brand-navy);
  color: var(--brand-navy);
  background: #f7f9ff;
}

.asset-add-plus {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 32px;
  font-size: 22px;
  line-height: 1;
  font-weight: 400;
  color: var(--brand-navy);
}

.asset-opt.is-on {
  border-color: var(--brand-navy);
  box-shadow: 0 0 0 1px var(--brand-navy);
}

.asset-opt.is-custom {
  background: #f7f9ff;
}

.asset-opt img {
  width: 100%;
  height: 32px;
  object-fit: contain;
  background: #fff;
}

.asset-opt .asset-name {
  margin: 0;
  font-size: 11px;
  line-height: 1.2;
  color: #3f3a35;
  text-align: center;
}

.asset-adjust {
  margin-top: 6px;
}

.asset-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0 6px;
}

.asset-slider {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 8px;
  margin: 0 0 2px;
  color: #6b645c;
  font-size: 12px;
}

.asset-slider span,
.asset-slider em {
  margin: 0;
  font-style: normal;
  font-size: 12px;
}

.asset-slider em {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.asset-slider input[type="range"] {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: var(--brand-navy);
}

.asset-extra {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0 0 8px;
}

.asset-extra[hidden] { display: none !important; }

.asset-side-picks {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.asset-side,
.asset-rename {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 12px;
  color: #3f3a35;
  cursor: pointer;
}

.asset-side input {
  width: auto;
  margin: 0;
  padding: 0;
  accent-color: var(--brand-navy);
}

.asset-rename span {
  margin: 0;
  color: #6b645c;
}

.asset-rename input {
  width: 88px;
  padding: 2px 6px;
  border: 1px solid #e6e0d6;
  border-radius: 4px;
  background: #fff;
  font-size: 12px;
}

.asset-delete {
  margin-left: auto;
  color: #8a3b12;
}

.asset-actions {
  flex-wrap: wrap;
}

/* Keep asset actions compact and deletion visible in Feishu webviews. */
.asset-opt[hidden], .asset-actions [hidden] { display: none !important; }
.asset-actions .btn { width: auto; margin: 0; padding: 4px 8px; }
.asset-actions .asset-delete { margin-left: 0; }
.asset-actions { gap: 4px 10px; }
.asset-actions button { white-space: nowrap; }
.asset-actions button:disabled, .asset-slider input:disabled { opacity: .45; cursor: default; }
