/* v3 — profile / settings / help / about + nav extensions. */

/* font-size root scale — uses CSS zoom so the whole app (px-based)
   scales proportionally, not just elements that use rem. */
:root[data-font-size="standard"] { font-size: 100%; }
:root[data-font-size="large"]    { font-size: 112.5%; }
:root[data-font-size="xlarge"]   { font-size: 125%; }

body[data-font-size="standard"] { zoom: 1; }
body[data-font-size="large"]    { zoom: 1.125; }
body[data-font-size="xlarge"]   { zoom: 1.25; }

/* high-contrast mode */
body.high-contrast {
  --ink:   #000;
  --ink-2: #1a1a1a;
  --ink-3: #2a2a2a;
  --ink-4: #404040;
  --line:        #555;
  --line-strong: #222;
  --bg:        #fff;
  --surface:   #fff;
  --surface-2: #f3f3f3;
  --bg-soft:   #ededed;
}

/* save-state pill */
.save-state {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: var(--r-1);
  background: var(--ok-soft);
  color: var(--ok);
  font-weight: 500;
}
.save-state.is-dirty  { background: var(--warn-soft); color: var(--warn); }
.save-state.is-saving { background: var(--accent-soft); color: var(--accent-ink); }
.save-state.is-saved  { background: var(--ok-soft); color: var(--ok); }

/* ============================================================
   PAGE: 公司资料 / Profile
   ============================================================ */
.pf-section + .pf-section { margin-top: var(--s-4); }

.pf-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s-3) var(--s-4);
}
.pf-field { display: flex; flex-direction: column; gap: 4px; }
.pf-field--wide { grid-column: 1 / -1; }
.pf-field__label {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}
.pf-input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2);
  padding: 8px 12px;
  font: inherit;
  font-size: 13.5px;
  background: var(--surface);
  color: var(--ink);
}
.pf-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.pf-input--ta {
  resize: vertical;
  min-height: 64px;
  font-family: inherit;
  line-height: 1.5;
}

.pf-rows { display: flex; flex-direction: column; gap: 10px; }
.pf-row {
  display: flex; gap: var(--s-3); align-items: stretch;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  position: relative;
  flex-wrap: wrap;
}
.pf-row:hover { border-color: var(--line-strong); }
.pf-cell {
  display: flex; flex-direction: column; gap: 4px;
  min-width: 100px;
  flex: 1;
}
.pf-cell__label {
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--ink-3);
  font-weight: 500;
}
.pf-row__del {
  position: absolute;
  right: 6px; top: 6px;
  border: 0; background: transparent;
  width: 22px; height: 22px;
  border-radius: 50%;
  font-size: 16px; line-height: 1;
  color: var(--ink-4);
  cursor: pointer;
}
.pf-row__del:hover { background: var(--err-soft); color: var(--err); }
.pf-add {
  margin-top: 12px;
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--ink-3);
  border-radius: var(--r-2);
  padding: 9px 14px;
  font: inherit; font-size: 13px;
  cursor: pointer;
  transition: all .15s var(--ease);
  width: 100%;
}
.pf-add:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.pf-footer {
  position: sticky;
  bottom: 0;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: var(--s-3) 0;
  margin-top: var(--s-5);
  display: flex; align-items: center; gap: var(--s-3);
  z-index: 4;
}
.pf-footer__btns { margin-left: auto; display: flex; gap: 8px; }

@media (max-width: 700px) {
  .pf-grid { grid-template-columns: 1fr; }
  .pf-row { flex-direction: column; }
}

/* ============================================================
   PAGE: 设置 / Settings
   ============================================================ */
.st-row {
  display: flex; align-items: center; gap: var(--s-4);
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.st-row:last-child { border-bottom: 0; }
.st-row__main { flex: 1; min-width: 0; }
.st-row__label { font-size: 14px; color: var(--ink); font-weight: 500; }
.st-row__sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.5; }
.st-row .tweak-seg { margin-left: auto; }

/* ============================================================
   公司资料 — gallery / list view
   ============================================================ */
/* Gallery head spans the full card grid so 新建资料 aligns to the right edge
   (override v6's readability-oriented 760px cap, which otherwise floats the
   button to mid-page). */
.profile-list .page-head { max-width: none; }
.page-head__row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--s-4); flex-wrap: wrap;
}
.pf-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.pf-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: 18px 20px 16px;
  display: flex; flex-direction: column; gap: 14px;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.pf-card:hover {
  border-color: var(--line-strong);
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.pf-card.is-active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent), 0 2px 8px rgba(0,0,0,.04);
}
.pf-card__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px;
}
.pf-card__name-wrap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.pf-card__name {
  font-size: 15px; font-weight: 600;
  letter-spacing: -.005em;
  color: var(--ink); margin: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pf-card__active-tag {
  font-size: 10px;
  letter-spacing: .04em;
  background: var(--accent);
  color: #fff;
  padding: 2px 7px;
  border-radius: 3px;
  font-weight: 500;
}
.pf-card__empty-tag {
  font-size: 10px;
  letter-spacing: .04em;
  background: var(--bg-soft);
  color: var(--ink-3);
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--line);
}
.pf-card__company {
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.5;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 12px;
}
.pf-card__company--empty { color: var(--ink-4); font-style: italic; }
.pf-card__stats { display: flex; gap: var(--s-4); }
.pf-card__stat {
  display: flex; flex-direction: column; gap: 2px;
}
.pf-card__stat-num {
  font-size: 18px; font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.pf-card__stat-label {
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: .04em;
}
.pf-card__foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}
.pf-card__foot-hint {
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: .02em;
  margin-left: 8px;
}
.pf-card__kebab-wrap { position: relative; }
.pf-card__kebab {
  border: 0; background: transparent;
  font-size: 18px; line-height: 1;
  color: var(--ink-3); cursor: pointer;
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.pf-card__kebab:hover { background: var(--bg-soft); color: var(--ink); }
.pf-card__menu {
  position: absolute; top: 32px; right: 0;
  z-index: 20;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-2);
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  padding: 4px;
  display: flex; flex-direction: column;
  min-width: 140px;
}
.pf-card__menu-item {
  appearance: none; border: 0; background: transparent;
  font: inherit; font-size: 13px;
  text-align: left;
  padding: 8px 12px;
  border-radius: var(--r-1);
  cursor: pointer;
  color: var(--ink);
}
.pf-card__menu-item:hover { background: var(--bg-soft); }
.pf-card__menu-item.is-danger { color: var(--danger, #b42318); }
.pf-card__menu-item.is-disabled {
  color: var(--ink-4);
  cursor: not-allowed;
  pointer-events: none;
}

.pf-empty {
  text-align: center;
  padding: 60px 16px;
  color: var(--ink-3);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-3);
  background: var(--bg-soft);
  font-size: 14px;
}

/* ============================================================
   公司资料 — form (new + edit)
   ============================================================ */
.pf-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: var(--ink-3);
  text-decoration: none;
  margin-bottom: 8px;
}
.pf-back:hover { color: var(--ink); }

.pf-title-wrap {
  display: flex; align-items: center; gap: 12px;
  margin-top: 4px;
}
.pf-title-input {
  font: inherit;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -.015em;
  color: var(--ink);
  border: 0;
  background: transparent;
  padding: 4px 0;
  border-bottom: 1px dashed transparent;
  outline: none;
  min-width: 320px;
  flex: 1;
}
.pf-title-input:hover { border-bottom-color: var(--line); }
.pf-title-input:focus {
  border-bottom-color: var(--accent);
}
.pf-title-input::placeholder { color: var(--ink-4); font-weight: 500; }
.pf-title-hint {
  font-size: 11px; color: var(--ink-4);
  letter-spacing: .04em;
}

.pf-footer--sticky {
  position: sticky;
  bottom: 16px;
  z-index: 5;
  margin-top: 24px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-3);
  box-shadow: 0 4px 16px rgba(0,0,0,.05);
  padding: 12px 16px;
}
.st-row--block { flex-direction: column; align-items: stretch; gap: 12px; }
.st-row--block .st-row__label { font-weight: 500; }

/* 字号 visual picker */
.fs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.fs-card {
  appearance: none;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .15s var(--ease), background .15s var(--ease);
  display: flex; flex-direction: column; gap: 12px;
  font: inherit;
  color: var(--ink);
}
.fs-card:hover { border-color: var(--line-strong); background: var(--surface-2); }
.fs-card.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.fs-card__head {
  display: flex; align-items: center; gap: 12px;
}
.fs-card__glyph {
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--ink);
  line-height: 1;
  font-feature-settings: "tnum" off;
  flex: 0 0 auto;
  min-width: 36px;
}
.fs-card__meta {
  display: flex; flex-direction: column; gap: 1px;
  flex: 1; min-width: 0;
}
.fs-card__name { font-size: 14px; font-weight: 500; color: var(--ink); }
.fs-card__pct {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: .04em;
}
.fs-card__check {
  flex: 0 0 auto;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  position: relative;
}
.fs-card.is-active .fs-card__check {
  border-color: var(--accent);
  background: var(--accent);
}
.fs-card.is-active .fs-card__check::after {
  content: "";
  position: absolute;
  left: 5px; top: 2px;
  width: 5px; height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.fs-card__sample {
  color: var(--ink-2);
  line-height: 1.45;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  text-wrap: pretty;
}

@media (max-width: 640px) {
  .fs-grid { grid-template-columns: 1fr; }
}

/* toggle switch */
.st-toggle {
  width: 38px; height: 22px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: var(--bg-soft);
  position: relative;
  padding: 0;
  cursor: pointer;
  transition: background .2s var(--ease), border-color .2s var(--ease);
  flex: 0 0 auto;
}
.st-toggle__knob {
  position: absolute;
  top: 1px; left: 1px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
  transition: transform .2s var(--ease);
}
.st-toggle.is-on { background: var(--accent); border-color: var(--accent); }
.st-toggle.is-on .st-toggle__knob { transform: translateX(16px); }

.st-action {
  display: flex; align-items: center; gap: var(--s-3);
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.st-action:last-child { border-bottom: 0; }
.st-action__main { flex: 1; min-width: 0; }
.st-action__title { font-size: 14px; color: var(--ink); font-weight: 500; }
.st-action__sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.5; }
.st-action--danger .st-action__title { color: var(--err); }

/* ============================================================
   PAGE: 帮助 / Help
   ============================================================ */
.help-steps {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.help-step {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-2);
}
.help-step__num {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  width: 32px; height: 32px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.help-step__title { font-size: 14.5px; color: var(--ink); line-height: 1.6; padding-top: 5px; }

.help-faq { display: flex; flex-direction: column; }
.help-faq__item {
  border-bottom: 1px solid var(--line);
  padding: 0;
}
.help-faq__item:last-child { border-bottom: 0; }
.help-faq__q {
  list-style: none;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.help-faq__q::-webkit-details-marker { display: none; }
.help-faq__chev {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px;
  color: var(--ink-3);
  transform: rotate(0deg);
  transition: transform .15s var(--ease);
  font-weight: 600;
}
.help-faq__item[open] .help-faq__chev { transform: rotate(90deg); color: var(--accent); }
.help-faq__a {
  padding: 0 0 14px 28px;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.75;
  max-width: 760px;
}

.help-gloss__searchbar {
  position: relative;
  margin-bottom: var(--s-4);
}
.help-gloss__searchbar .h-search__icon {
  left: 12px; top: 50%; transform: translateY(-50%);
  position: absolute; color: var(--ink-4); pointer-events: none;
  display: inline-flex;
}
.help-gloss__searchbar .chk-search {
  padding-left: 36px;
}
.help-gloss { display: flex; flex-direction: column; }
.help-gloss__row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: var(--s-4);
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.help-gloss__row:last-child { border-bottom: 0; }
.help-gloss__term {
  font-weight: 600;
  color: var(--ink);
  font-size: 14px;
}
.help-gloss__def {
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.7;
}
.help-gloss mark {
  background: #fff1c2;
  color: var(--ink);
  padding: 0 2px;
  border-radius: 2px;
}

@media (max-width: 600px) {
  .help-gloss__row { grid-template-columns: 1fr; gap: 4px; }
}

/* ============================================================
   PAGE: 关于 / About
   ============================================================ */
.about-grid {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  padding: 4px var(--s-5);
  margin-bottom: var(--s-4);
}
.about-row {
  display: flex; align-items: baseline; gap: var(--s-4);
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.about-row:last-child { border-bottom: 0; }
.about-row__label {
  font-size: 11px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); font-weight: 500;
  flex: 0 0 100px;
}
.about-row__val { font-size: 14px; color: var(--ink); }
.about-version {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--bg-soft);
  padding: 2px 10px;
  border-radius: var(--r-1);
  letter-spacing: .04em;
}
.about-prose {
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.85;
  margin: 0;
  text-wrap: pretty;
  max-width: 760px;
}
.about-icp {
  text-align: center;
  font-size: 12px;
  color: var(--ink-4);
  margin-top: var(--s-5);
  padding-top: var(--s-3);
  border-top: 1px solid var(--line);
}

/* ============================================================
   Editor 从公司资料填入 panel
   ============================================================ */
.bi-insert-wrap { position: relative; display: inline-block; }
.bi-insert-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-3);
  box-shadow: 0 14px 40px rgba(0,0,0,.14);
  width: 280px;
  max-height: 380px;
  overflow: auto;
  padding: 8px;
}
.bi-insert-panel__head {
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  padding: 6px 8px;
}
.bi-insert-item {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px;
  padding: 8px;
  border-radius: var(--r-2);
  cursor: pointer;
  align-items: baseline;
}
.bi-insert-item:hover { background: var(--accent-soft); }
.bi-insert-item__key {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 500;
}
.bi-insert-item__val {
  font-size: 13px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bi-insert-item__val--empty { color: var(--ink-4); font-style: italic; }
.bi-insert-empty {
  padding: 16px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
}
.bi-insert-empty a { color: var(--accent); }

/* editor view modes from settings */
.split.split--source .split__pane:nth-child(2) { display: none; }
.split.split--source .split__pane:nth-child(1) { flex: 1 1 100%; }
.split.split--preview .split__pane:nth-child(1) { display: none; }
.split.split--preview .split__pane:nth-child(2) { flex: 1 1 100%; }


/* ============================================================
   重新生成 — danger gate modal
   ============================================================ */
.modal--danger {
  width: min(520px, calc(100vw - 32px));
  border-color: var(--err, #862a1a);
  border-top: 4px solid var(--err, #862a1a);
}
.regen-gate__head {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px;
}
.regen-gate__icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--err, #862a1a);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; line-height: 1;
  flex-shrink: 0;
}
.regen-gate .modal__title {
  margin: 0;
  font-size: 17px;
  letter-spacing: -.005em;
}
.regen-gate__lead {
  margin: 0 0 12px;
  color: var(--ink-1, var(--ink));
  font-size: 13.5px;
  line-height: 1.65;
  font-weight: 500;
}
.regen-gate__list {
  list-style: none;
  margin: 0 0 16px;
  padding: 12px 14px;
  background: var(--err-soft, #fdf3f0);
  border: 1px solid var(--err-soft-border, rgba(134,42,26,.18));
  border-radius: var(--r-2);
  display: flex; flex-direction: column; gap: 8px;
}
.regen-gate__list li {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.6;
}
.regen-gate__list li strong {
  color: var(--err, #862a1a);
  font-weight: 600;
}
.regen-gate__bullet {
  color: var(--err, #862a1a);
  font-weight: 700;
  margin-top: 1px;
  flex-shrink: 0;
}
.regen-gate__hint {
  color: var(--ink-3);
  font-size: 12px;
}
.regen-gate__cost {
  font-weight: 600;
  color: var(--err, #862a1a);
  font-variant-numeric: tabular-nums;
}
.regen-gate__ack {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  margin-bottom: 16px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--ink-1, var(--ink));
  line-height: 1.55;
  transition: border-color .12s var(--ease), background .12s var(--ease);
}
.regen-gate__ack:hover { border-color: var(--line-strong); background: var(--bg-soft); }
.regen-gate__ack:has(.regen-gate__check:checked) {
  border-color: var(--err, #862a1a);
  background: var(--err-soft, #fdf3f0);
}
.regen-gate__check {
  margin-top: 2px;
  width: 14px; height: 14px;
  accent-color: var(--err, #862a1a);
  flex-shrink: 0;
}
.btn.is-disabled,
.btn[disabled] {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}
