/* 红头生成器 —— 界面样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #f2f4f8;
  --card: #ffffff;
  --line: #e4e8ef;
  --text: #1f2430;
  --muted: #7b8494;
  --accent: #c0392b;
  --accent-2: #e74c3c;
  --blue: #2f6fed;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(24, 32, 51, .07);
}
[v-cloak] { display: none; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: radial-gradient(1200px 600px at 15% -10%, #eaf0ff 0%, var(--bg) 55%) fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.app { min-height: 100vh; padding: 18px 20px 32px; }

/* ===== 顶栏 ===== */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap; margin-bottom: 18px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 42px; height: 42px; border-radius: 12px; flex: 0 0 42px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 20px; font-weight: 700;
  font-family: "方正小标宋简体", "SimSun", serif;
  box-shadow: 0 6px 16px rgba(192, 57, 43, .28);
}
.brand h1 { font-size: 20px; letter-spacing: .5px; }
.brand p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  font-size: 12px; color: #5a6376; background: #fff; border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 12px; box-shadow: var(--shadow);
}
.badge.ghost { color: #1c7c4b; border-color: #c6e8d5; background: #f1fbf5; box-shadow: none; }

/* ===== 主布局 ===== */
.layout {
  display: grid; gap: 20px; align-items: start;
  grid-template-columns: 396px minmax(0, 1fr);
  grid-template-areas: "panel stage" "declare stage";
}
.panel { grid-area: panel; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.stage { grid-area: stage; display: flex; flex-direction: column; align-items: center; min-width: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card-title {
  font-size: 13px; font-weight: 600; color: #454e60; letter-spacing: .3px;
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
}
.card-title .count { font-size: 11px; color: var(--muted); background: #f1f4f9; border-radius: 999px; padding: 2px 8px; }

/* ===== 分段选择 ===== */
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.segmented button {
  border: 1px solid var(--line); background: #fafbfe; border-radius: 10px; padding: 10px 8px;
  font-size: 14px; color: #4b5464; cursor: pointer; transition: .18s; line-height: 1.35;
}
.segmented button small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.segmented button:hover { border-color: #c9d3e6; }
.segmented button.on {
  border-color: var(--accent); background: linear-gradient(180deg, #fff6f4, #ffece9);
  color: var(--accent); box-shadow: 0 2px 8px rgba(192, 57, 43, .12);
}
.segmented button.on small { color: #c0705f; }

/* ===== 机关名称 ===== */
.name-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.name-idx { flex: 0 0 46px; font-size: 12px; color: var(--muted); text-align: right; }
.name-row input { flex: 1; }
.icon-btn {
  flex: 0 0 30px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 8px;
  color: #97a0b0; cursor: pointer; font-size: 12px; transition: .15s;
}
.icon-btn:hover:not(:disabled) { border-color: #f0b6ae; color: var(--accent); background: #fff6f4; }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.add-btn {
  width: 100%; border: 1px dashed #cdd6e6; background: #fbfcff; color: var(--blue);
  border-radius: 10px; padding: 8px; font-size: 13px; cursor: pointer; transition: .15s;
}
.add-btn:hover { background: #f2f6ff; border-color: var(--blue); }

/* ===== 输入控件 ===== */
input[type=text] {
  width: 100%; padding: 8px 10px; border: 1px solid #d7dde8; border-radius: 9px;
  font-size: 14px; background: #fff; color: var(--text); transition: .15s;
}
input[type=text]:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47, 111, 237, .12); }
label { display: block; font-size: 12px; color: #5b6474; }
.fwh-grid { display: grid; grid-template-columns: 1.3fr 1fr .8fr; gap: 8px; transition: .18s; }
.fwh-grid label { display: flex; flex-direction: column; gap: 5px; }
.fwh-grid.off { opacity: .45; pointer-events: none; }
.preview-fwh { font-size: 12px; color: var(--muted); margin-top: 10px; font-family: "仿宋_GB2312", "FangSong", serif; }

.card-note { font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.switch { position: relative; width: 38px; height: 21px; flex: 0 0 38px; }
.switch input { opacity: 0; width: 0; height: 0; }
.track {
  position: absolute; inset: 0; border-radius: 999px; background: #d6dce7; transition: .2s; cursor: pointer;
}
.track::before {
  content: ""; position: absolute; width: 17px; height: 17px; left: 2px; top: 2px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.switch input:checked + .track { background: var(--blue); }
.switch input:checked + .track::before { transform: translateX(17px); }

.opt { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #5b6474; margin-top: 12px; cursor: pointer; }
.opt input { width: 15px; height: 15px; accent-color: var(--blue); }
.opt.dim { opacity: .45; }
.opt.inline { margin-top: 0; }

.note {
  font-size: 11.5px; color: #9a6413; background: #fff8ec; border: 1px solid #f4e0bb;
  border-radius: 9px; padding: 7px 9px; margin-top: 10px; line-height: 1.6;
}

/* ===== 下载 ===== */
.dl {
  border: none; border-radius: 12px; padding: 14px; width: 100%; cursor: pointer;
  font-size: 15px; font-weight: 600; color: #fff; letter-spacing: .5px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px rgba(192, 57, 43, .26); transition: .18s;
}
.dl:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(192, 57, 43, .32); }
.dl:disabled { opacity: .65; cursor: default; box-shadow: none; }

.declare { grid-area: declare; }
.declare ol { padding-left: 18px; }
.declare li { font-size: 11.5px; color: #6b7383; line-height: 1.85; margin-bottom: 4px; }

/* ===== 预览 ===== */
.toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px; font-size: 12.5px; color: #5b6474;
  background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; box-shadow: var(--shadow);
}
.tb-label { color: var(--muted); }
.tb-val { min-width: 38px; color: var(--muted); }
input[type=range] { width: 150px; accent-color: var(--blue); }
.page-outer { position: relative; overflow: hidden; }
.page-wrap { transform-origin: top left; }
.page {
  position: relative; width: 210mm; height: 297mm; background: #fff;
  box-shadow: 0 10px 40px rgba(24, 32, 51, .18); border: 1px solid #e7eaf0;
}
.vbguide { position: absolute; border: 1px dashed #cdd9ea; pointer-events: none; }
.head { position: absolute; }
.head > * { position: relative; z-index: 2; }
.mark { text-align: center; white-space: nowrap; }
.markrow { display: flex; align-items: center; justify-content: center; gap: 5mm; }
.markcol { display: flex; flex-direction: column; }
.fwh { color: #000; }
.sep { height: 0; }
.body-guide { position: absolute; color: #c9ced8; }
.pgnum { position: absolute; color: #000; font-family: '宋体', SimSun, serif; font-size: 14pt; line-height: 1; text-align: right; box-sizing: border-box; }
.dbl-bottom { position: absolute; }

@media (max-width: 1180px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "panel" "stage" "declare"; }
  .panel { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
  .panel .dl { grid-column: 1 / -1; }
  .stage { width: 100%; align-items: center; }
}
@media (max-width: 720px) {
  .app { padding: 12px 12px 28px; }
  .panel { grid-template-columns: minmax(0, 1fr); }
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .brand h1 { font-size: 17px; }
  .brand p { font-size: 11px; }
  .badges .badge { font-size: 11px; padding: 4px 9px; }
  .toolbar { width: 100%; justify-content: flex-start; flex-wrap: wrap; border-radius: 12px; gap: 8px; }
  .card { padding: 13px; border-radius: 12px; }
  .fwh-grid { grid-template-columns: 1fr 1fr; }
  .fwh-grid label:last-child { grid-column: 1 / -1; }
  .segmented button { font-size: 13px; padding: 9px 6px; }
  .dialog { max-width: 100%; }
  .dialog-body { max-height: 42vh; }
}
/* ===== 声明弹窗 ===== */
.mask {
  position: fixed; inset: 0; background: rgba(18, 24, 38, .48); backdrop-filter: blur(2px);
  display: grid; place-items: center; padding: 18px; z-index: 50;
}
.dialog {
  width: min(620px, 100%); max-height: 88vh; overflow: auto; background: #fff;
  border-radius: 16px; padding: 20px 22px; box-shadow: 0 24px 60px rgba(10, 16, 30, .3);
}
.dialog h3 { font-size: 17px; margin-bottom: 6px; }
.dialog-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.dialog-body { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; max-height: 46vh; overflow: auto; background: #fbfcfe; }
.dialog-body ol { padding-left: 18px; }
.dialog-body li { font-size: 12.5px; line-height: 1.85; color: #555e6d; margin-bottom: 5px; }
.agree { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #3f4757; margin: 14px 0 4px; cursor: pointer; }
.agree input { width: 16px; height: 16px; accent-color: var(--accent); }
.dialog-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 12px; }
.dialog-foot button { border-radius: 10px; padding: 10px 18px; font-size: 14px; cursor: pointer; border: 1px solid transparent; }
.dialog-foot .ghost { background: #fff; border-color: var(--line); color: #5b6474; }
.dialog-foot .ghost:hover { background: #f5f7fb; }
.dialog-foot .primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 600; }
.dialog-foot .primary:disabled { opacity: .45; cursor: not-allowed; }
