/* ============================================================
   interTouch 答案之书 · 公共样式 css/common.css
   原生 CSS3，无框架依赖；Tailwind 仅通过 CDN 提供工具类。
   前缀 ab- (answer book) 避免与 Tailwind 工具类冲突。
   ============================================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --ink:        #342c22;
  --ink-soft:   #5a4a35;
  --gold:       #b08d55;
  --gold-deep:  #8a6a3f;
  --paper:      #fcf9f1;
  --paper-2:    #faf6ec;
  --line:       rgba(120, 95, 55, .22);
  --line-soft:  rgba(120, 95, 55, .14);
  --flip-duration: 700ms;
  --flip-ease: cubic-bezier(.38, .06, .3, 1);
}

html, body { min-height: 100%; }
html { background: #eef1f7; }

body.ab-body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  color: var(--ink);
  position: relative;
}

/* ---------------- 浅色桌面背景 ---------------- */
body.ab-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(920px 580px at 8% -6%, rgba(118, 148, 255, .22), transparent 62%),
    radial-gradient(880px 540px at 94% 106%, rgba(255, 172, 118, .20), transparent 64%),
    radial-gradient(740px 470px at 50% 52%, rgba(108, 214, 194, .13), transparent 68%),
    linear-gradient(160deg, #f6f8fc 0%, #e9edf5 48%, #dde3ef 100%);
}

body.ab-body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(72, 92, 132, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(72, 92, 132, .05) 1px, transparent 1px);
  background-size: 52px 52px;
  -webkit-mask-image: radial-gradient(ellipse 80% 74% at 50% 48%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 80% 74% at 50% 48%, #000 30%, transparent 100%);
}

/* ============================================================
   书本区域
   ============================================================ */
.ab-desk {
  min-height: 100vh;
  display: flex;
  padding: 46px 22px;
  position: relative;
  z-index: 1;
}

.ab-book {
  position: relative;
  margin: auto;
  width: 1280px;
  max-width: 100%;
  height: 720px;
  isolation: isolate;
  perspective: 2200px;
  perspective-origin: 50% 46%;
  animation: abBookIn .95s cubic-bezier(.22, .8, .3, 1) both;
}

@keyframes abBookIn {
  0%   { opacity: 0; transform: translateY(22px) scale(.975); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* 书页厚度叠层 */
.ab-book-edge {
  position: absolute;
  z-index: 0;
  inset: 12px -10px -12px -10px;
  border-radius: 14px;
  background: linear-gradient(180deg, #efe8d7, #ded3bb);
  box-shadow:
    0 1px 0 #f4eee0,
    0 2px 0 #ebe3d1,
    0 3px 0 #e6ddc8,
    0 4px 0 #e0d6bf,
    0 5px 0 #dad0b6,
    0 6px 0 #d4c9ad,
    0 7px 0 #cec2a4,
    0 16px 34px -12px rgba(45, 60, 92, .26),
    0 40px 76px -22px rgba(45, 60, 92, .20);
}

/* ---------------- 视图切换 ---------------- */
.ab-view {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .14s linear, visibility .14s linear;
}

.ab-view.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* ---------------- 页面（纸张纹理） ---------------- */
.ab-page {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(120, 95, 55, .055) 1px, transparent 1.2px),
    radial-gradient(rgba(120, 95, 55, .035) 1px, transparent 1.2px);
  background-size: 8px 8px, 13px 13px;
  background-position: 0 0, 4px 6px;
}

.ab-page-left {
  border-radius: 10px 2px 2px 10px;
  box-shadow: inset -30px 0 34px -30px rgba(70, 58, 40, .42);
}

.ab-page-right {
  border-radius: 2px 10px 10px 2px;
  background-color: var(--paper-2);
  box-shadow: inset 30px 0 34px -30px rgba(70, 58, 40, .42);
}

.ab-page-inner {
  position: relative;
  z-index: 2;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 50px 34px 32px;
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 110, 65, .32) transparent;
}

.ab-page-inner::-webkit-scrollbar { width: 8px; }
.ab-page-inner::-webkit-scrollbar-track { background: transparent; }
.ab-page-inner::-webkit-scrollbar-thumb {
  background: rgba(140, 110, 65, .28);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.ab-page-inner::-webkit-scrollbar-thumb:hover {
  background: rgba(140, 110, 65, .48);
  background-clip: padding-box;
}

/* ---------------- 中缝书脊 ---------------- */
.ab-spine {
  position: absolute;
  z-index: 5;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 96px;
  transform: translateX(-50%);
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(90, 68, 34, 0) 0%,
    rgba(90, 68, 34, .05) 22%,
    rgba(52, 36, 16, .13) 42%,
    rgba(26, 18, 8, .24) 50%,
    rgba(52, 36, 16, .13) 58%,
    rgba(90, 68, 34, .05) 78%,
    rgba(90, 68, 34, 0) 100%
  );
}

.ab-spine::before {
  content: "";
  position: absolute;
  top: 6%;
  bottom: 6%;
  left: 50%;
  width: 1px;
  transform: translateX(-.5px);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, .38) 18%,
    rgba(255, 255, 255, .38) 82%,
    rgba(255, 255, 255, 0) 100%
  );
  opacity: .55;
}

/* ---------------- 书签丝带 ---------------- */
.ab-ribbon {
  position: absolute;
  z-index: 32;
  top: 0;
  left: 50%;
  width: 16px;
  height: 62px;
  margin-left: -8px;
  background: linear-gradient(180deg, #a83c34 0%, #8a2e28 62%, #6f2420 100%);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%);
  box-shadow: 0 6px 14px rgba(45, 60, 92, .22);
  pointer-events: none;
}

/* ---------------- 目录按钮 ---------------- */
.ab-catalog-btn {
  position: absolute;
  z-index: 40;
  top: 14px;
  left: 20px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 15px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  color: #4a3c2a;
  cursor: pointer;
  border: 1px solid rgba(120, 95, 55, .35);
  border-radius: 999px;
  background: rgba(255, 253, 246, .82);
  box-shadow:
    0 4px 12px -8px rgba(45, 60, 92, .45),
    inset 0 1px 0 rgba(255, 255, 255, .9);
  backdrop-filter: blur(3px);
  transition: all .22s ease;
}

.ab-catalog-btn:hover {
  color: #2e2418;
  background: #fffdf7;
  border-color: rgba(150, 115, 60, .6);
  transform: translateY(-1px);
  box-shadow:
    0 8px 18px -10px rgba(45, 60, 92, .5),
    inset 0 1px 0 rgba(255, 255, 255, .95);
}

.ab-catalog-btn:active { transform: translateY(0); }

.ab-catalog-btn.is-home {
  opacity: .42;
  cursor: default;
  transform: none;
}

/* ---------------- 标题 ---------------- */
.ab-book-title {
  position: relative;
  padding-bottom: 18px;
  margin: 2px 0 12px;
  text-align: center;
  font-family: Georgia, "Songti SC", "STSong", "SimSun", serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 5px;
  text-indent: 5px;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .75);
}

.ab-book-title::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 6px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(140, 110, 65, .50) 18%,
    rgba(140, 110, 65, .50) 82%,
    transparent 100%
  );
}

.ab-book-title::after {
  content: "❖";
  position: absolute;
  left: 50%;
  bottom: -3px;
  transform: translateX(-50%);
  padding: 0 10px;
  font-size: 10px;
  line-height: 18px;
  color: var(--gold);
  background: var(--paper);
}

.ab-catalog-subtitle {
  margin-bottom: 26px;
  text-align: center;
  font-size: 11.5px;
  letter-spacing: 3px;
  text-indent: 3px;
  color: rgba(120, 95, 55, .62);
}

/* ---------------- 目录列表 ---------------- */
.ab-catalog-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ab-catalog-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 15px 18px;
  font-family: inherit;
  font-size: 14.5px;
  text-align: left;
  color: #3d3428;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .55);
  transition: background .22s, border-color .22s, transform .22s, box-shadow .22s;
}

.ab-catalog-item:hover {
  background: #fff;
  border-color: rgba(150, 115, 60, .5);
  transform: translateX(4px);
  box-shadow: 0 10px 20px -16px rgba(45, 60, 92, .55);
}

.ab-tool-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  font-size: 21px;
  line-height: 1;
  border-radius: 11px;
  background: rgba(176, 141, 85, .12);
  border: 1px solid rgba(176, 141, 85, .28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}

.ab-tool-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ab-tool-name {
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .8px;
  color: #342c22;
}

.ab-tool-desc {
  font-size: 12px;
  line-height: 1.58;
  letter-spacing: .2px;
  color: rgba(90, 70, 40, .68);
}

.ab-catalog-arrow {
  font-size: 14px;
  color: var(--gold-deep);
  opacity: .45;
  transition: transform .22s, opacity .22s;
  flex-shrink: 0;
}

.ab-catalog-item:hover .ab-catalog-arrow {
  transform: translateX(3px);
  opacity: 1;
}

/* ---------------- 提示框 ---------------- */
.ab-tips-box {
  margin-top: 6px;
  padding: 20px 22px 22px;
  border: 1px dashed rgba(120, 95, 55, .32);
  border-radius: 14px;
  background: rgba(255, 255, 255, .4);
}

.ab-tip-title {
  margin-bottom: 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--gold-deep);
}

.ab-tips {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.ab-tips li {
  position: relative;
  padding-left: 24px;
  font-size: 13px;
  line-height: 1.8;
  color: #3d3428;
}

.ab-tips li::before {
  content: "✦";
  position: absolute;
  left: 3px;
  top: 0;
  font-size: 10px;
  color: var(--gold);
}

.ab-tips code {
  padding: 1px 6px;
  font-size: 12px;
  color: var(--gold-deep);
  background: rgba(176, 141, 85, .14);
  border-radius: 4px;
}

/* ---------------- 搜索区 ---------------- */
.ab-search-area {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.ab-search-input {
  flex: 1;
  min-width: 0;
  padding: 12px 18px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  border: 1px solid rgba(120, 95, 55, .35);
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  outline: none;
  transition: border-color .22s, box-shadow .22s, background .22s;
}

.ab-search-input::placeholder { color: rgba(90, 70, 40, .42); }

.ab-search-input:focus {
  background: #fff;
  border-color: rgba(150, 115, 60, .72);
  box-shadow: 0 0 0 4px rgba(180, 145, 85, .15);
}

.ab-search-btn {
  padding: 12px 26px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 3px;
  text-indent: 3px;
  color: #f4ead6;
  cursor: pointer;
  border: 1px solid #3a3026;
  border-radius: 999px;
  background: linear-gradient(180deg, #4c3f30 0%, #322920 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .14),
    0 6px 14px -8px rgba(45, 60, 92, .55);
  transition: transform .18s, box-shadow .18s, background .18s;
}

.ab-search-btn:hover {
  background: linear-gradient(180deg, #5d4c39 0%, #3d3226 100%);
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .18),
    0 10px 18px -8px rgba(45, 60, 92, .6);
}

.ab-search-btn:active { transform: translateY(0); }

.ab-search-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ---------------- 搜索历史 chips ---------------- */
.ab-history-chips {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.ab-history-chips.is-visible { display: flex; }

.ab-history-chip {
  padding: 5px 13px;
  font-family: inherit;
  font-size: 12px;
  color: #4a3c2a;
  cursor: pointer;
  border: 1px solid rgba(120, 95, 55, .35);
  border-radius: 999px;
  background: rgba(255, 253, 246, .9);
  transition: all .18s ease;
}

.ab-history-chip:hover {
  background: #fff;
  border-color: rgba(150, 115, 60, .65);
  transform: translateY(-1px);
}

/* ---------------- summary 卡片 ---------------- */
.ab-summary-card {
  position: relative;
  padding: 20px 22px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .88) 0%, rgba(253, 250, 242, .62) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .95),
    0 12px 26px -20px rgba(45, 60, 92, .5);
}

.ab-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.ab-summary-head h3 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--gold-deep);
}

.ab-summary-head h3::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 14px;
  margin-right: 9px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--gold) 0%, var(--gold-deep) 100%);
  vertical-align: -2px;
}

.ab-copy-btn {
  padding: 5px 14px;
  font-family: inherit;
  font-size: 12px;
  color: #4a3c2a;
  cursor: pointer;
  border: 1px solid rgba(120, 95, 55, .38);
  border-radius: 999px;
  background: rgba(255, 255, 255, .75);
  transition: all .18s ease;
}

.ab-copy-btn:hover {
  background: #fff;
  border-color: rgba(150, 115, 60, .6);
  transform: translateY(-1px);
}

.ab-copy-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.ab-summary-content {
  font-size: 13px;
  line-height: 1.95;
  letter-spacing: .2px;
  color: #3d3428;
  white-space: pre-line;
  word-break: break-word;
}

/* ---------------- 空结果提示 ---------------- */
.ab-empty-tip {
  margin-top: 18px;
  padding: 14px 18px;
  font-size: 13px;
  color: #8a5a2a;
  border: 1px dashed rgba(180, 120, 50, .5);
  border-radius: 12px;
  background: rgba(255, 248, 235, .75);
}

/* ---------------- 横线纸占位 ---------------- */
.ab-note-card {
  margin-top: 26px;
  min-height: 120px;
  border: 1px dashed rgba(120, 95, 55, .34);
  border-radius: 14px;
  background-image: repeating-linear-gradient(
    180deg,
    transparent 0 33px,
    rgba(120, 95, 55, .13) 33px 34px
  );
  background-position: 0 10px;
}

/* ---------------- 右页面板 ---------------- */
.ab-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  align-items: start;
}

.ab-panel { display: flex; flex-direction: column; }

.ab-panel-title {
  position: relative;
  padding-bottom: 14px;
  margin-bottom: 20px;
  text-align: center;
  font-family: Georgia, "Songti SC", "STSong", "SimSun", serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 4px;
  text-indent: 4px;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .75);
}

.ab-panel-title::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 52px;
  height: 2px;
  border-radius: 2px;
  transform: translateX(-50%);
  background: linear-gradient(
    90deg,
    rgba(176, 141, 85, 0) 0%,
    var(--gold) 50%,
    rgba(176, 141, 85, 0) 100%
  );
}

/* ---------------- 选项列表 ---------------- */
.ab-option-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ab-form-group {
  padding: 12px 15px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .50);
}

.ab-form-label {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--gold-deep);
}

.ab-form-line {
  min-height: 22px;
  padding-bottom: 4px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #3d3428;
  word-break: break-word;
  border-bottom: 1px dashed rgba(120, 95, 55, .32);
}

.ab-option-item {
  padding: 13px 15px 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .52);
  transition: background .2s, border-color .2s, transform .2s, box-shadow .2s;
}

.ab-option-item:hover {
  background: rgba(255, 255, 255, .92);
  border-color: rgba(150, 115, 60, .48);
  transform: translateX(3px);
  box-shadow: 0 10px 20px -16px rgba(45, 60, 92, .55);
}

.ab-option-title {
  margin-bottom: 7px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--gold-deep);
}

.ab-option-answer {
  font-size: 13.5px;
  line-height: 1.68;
  color: #3d3428;
  word-break: break-word;
}

.ab-option-item.is-empty .ab-option-answer {
  color: rgba(90, 70, 40, .4);
  font-style: italic;
}

/* ---------------- 匹配规则步骤 ---------------- */
.ab-match-steps {
  list-style: none;
  counter-reset: ab-step;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ab-match-steps li {
  counter-increment: ab-step;
  position: relative;
  padding: 14px 16px 14px 52px;
  font-size: 13.5px;
  line-height: 1.75;
  color: #3d3428;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .55);
}

.ab-match-steps li::before {
  content: "L" counter(ab-step);
  position: absolute;
  left: 14px;
  top: 14px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-deep);
  border: 1px solid rgba(176, 141, 85, .42);
  border-radius: 999px;
  background: rgba(255, 255, 255, .6);
}

.ab-match-steps li b {
  color: var(--gold-deep);
}

/* ---------------- 搜索历史页 ---------------- */
.ab-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ab-history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  font-size: 13.5px;
  color: #3d3428;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, .52);
  transition: all .2s ease;
}

.ab-history-item:hover {
  background: #fff;
  border-color: rgba(150, 115, 60, .48);
  transform: translateX(3px);
}

.ab-history-item time {
  font-size: 11.5px;
  color: rgba(90, 70, 40, .55);
  white-space: nowrap;
}

.ab-history-empty {
  padding: 24px 0;
  font-size: 13px;
  color: rgba(90, 70, 40, .45);
  text-align: center;
  font-style: italic;
}

.ab-history-clear {
  margin-top: 22px;
  padding: 9px 22px;
  font-family: inherit;
  font-size: 12.5px;
  color: #8a2e28;
  cursor: pointer;
  border: 1px solid rgba(170, 70, 60, .4);
  border-radius: 999px;
  background: rgba(255, 245, 240, .8);
  transition: all .18s ease;
}

.ab-history-clear:hover {
  background: #fff;
  border-color: rgba(170, 70, 60, .65);
  transform: translateY(-1px);
}

/* ---------------- 翻页纸片（双面） ---------------- */
.ab-flip-sheet {
  position: absolute;
  z-index: 30;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 50%;
  pointer-events: none;
  visibility: hidden;
  transform-origin: 0% 50%;
  transform-style: preserve-3d;
  backface-visibility: visible;
}

.ab-flip-sheet::before,
.ab-flip-sheet::after {
  content: "";
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.ab-flip-sheet::before {
  border-radius: 2px 10px 10px 2px;
  background:
    radial-gradient(rgba(120, 95, 55, .06) 1px, transparent 1.2px) 0 0 / 8px 8px,
    linear-gradient(100deg, #efe7d5 0%, #f8f3e6 42%, #fdfbf4 78%, #f5eedd 100%);
  box-shadow:
    inset 0 0 46px rgba(120, 95, 55, .11),
    inset 16px 0 22px -16px rgba(90, 68, 34, .38),
    inset -1px 0 0 rgba(120, 95, 55, .10);
}

.ab-flip-sheet::after {
  transform: rotateY(180deg);
  border-radius: 10px 2px 2px 10px;
  background:
    radial-gradient(rgba(120, 95, 55, .06) 1px, transparent 1.2px) 0 0 / 8px 8px,
    linear-gradient(260deg, #e8dec7 0%, #f2ebd8 42%, #f8f4e7 78%, #ede3cd 100%);
  box-shadow:
    inset 0 0 46px rgba(120, 95, 55, .18),
    inset -16px 0 22px -16px rgba(90, 68, 34, .44),
    inset 1px 0 0 rgba(120, 95, 55, .12);
}

.ab-flip-sheet.is-flipping-forward {
  visibility: visible;
  animation: abFlipForward var(--flip-duration) var(--flip-ease) both;
}

.ab-flip-sheet.is-flipping-backward {
  visibility: visible;
  animation: abFlipBackward var(--flip-duration) var(--flip-ease) both;
}

@keyframes abFlipForward {
  0%   { transform: rotateY(0deg); }
  100% { transform: rotateY(-180deg); }
}

@keyframes abFlipBackward {
  0%   { transform: rotateY(-180deg); }
  100% { transform: rotateY(0deg); }
}

/* ---------------- 更新动画 ---------------- */
@keyframes abFadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.is-updated { animation: abFadeUp .45s cubic-bezier(.22, .8, .3, 1) both; }

/* ============================================================
   Toast 全局提示
   ============================================================ */
.ab-toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: min(480px, 86vw);
  padding: 12px 20px;
  font-size: 13.5px;
  line-height: 1.6;
  color: #2e2418;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(12px);
  transition: opacity .25s ease, transform .25s ease;
  border: 1px solid rgba(120, 95, 55, .35);
  border-radius: 999px;
  background: rgba(255, 253, 246, .96);
  box-shadow: 0 12px 30px -12px rgba(45, 60, 92, .45);
}

.ab-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.ab-toast.is-error {
  color: #8a2e28;
  border-color: rgba(170, 70, 60, .45);
  background: rgba(255, 245, 240, .97);
}

.ab-toast.is-success {
  color: #2f5d3a;
  border-color: rgba(70, 130, 90, .4);
  background: rgba(240, 250, 244, .97);
}

.ab-toast::before {
  content: "✦";
  font-size: 12px;
  color: var(--gold);
}

.ab-toast.is-error::before { content: "✕"; color: #a83c34; }
.ab-toast.is-success::before { content: "✓"; color: #4a8a5a; }

/* ============================================================
   响应式：<1000px 关闭 3D，纵向堆叠
   ============================================================ */
@media (max-width: 1000px) {
  .ab-book {
    display: block;
    height: auto;
    perspective: none;
  }

  .ab-book-edge { inset: 10px -6px -10px -6px; }
  .ab-spine, .ab-ribbon, .ab-flip-sheet { display: none; }

  .ab-view {
    position: relative;
    inset: auto;
    display: none;
    opacity: 1;
    visibility: visible;
    grid-template-columns: 1fr;
    transition: none;
  }

  .ab-view.is-active { display: grid; }

  .ab-page-left {
    border-radius: 10px 10px 0 0;
    box-shadow: inset 0 -26px 30px -30px rgba(70, 58, 40, .38);
  }

  .ab-page-right {
    border-radius: 0 0 10px 10px;
    box-shadow: inset 0 26px 30px -30px rgba(70, 58, 40, .38);
  }

  .ab-page { overflow: visible; }
  .ab-page-inner { overflow: visible; padding: 30px 24px; }

  .ab-panels { grid-template-columns: 1fr; gap: 34px; }

  .ab-book-title { font-size: 19px; letter-spacing: 3px; }

  .ab-catalog-btn { top: 14px; left: 14px; }
}

@media (max-width: 560px) {
  .ab-desk { padding: 24px 12px; }
  .ab-search-area { flex-direction: column; }
  .ab-search-btn { width: 100%; }
}

/* ============================================================
   管理端 admin.html 专用样式（与公共部分共用本文件）
   ============================================================ */
body.ab-admin-body {
  min-height: 100vh;
  background: #f4f6fa;
}

body.ab-admin-body::before,
body.ab-admin-body::after { display: none; }

.ab-admin-shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: 64px 1fr;
  min-height: 100vh;
}

/* ---------------- 顶部导航 ---------------- */
.ab-admin-topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid #e5e8f0;
  box-shadow: 0 2px 8px rgba(45, 60, 92, .06);
  position: sticky;
  top: 0;
  z-index: 20;
}

.ab-admin-logo {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  border-radius: 10px;
  background: linear-gradient(135deg, #b08d55, #8a6a3f);
  color: #fff;
  box-shadow: 0 4px 10px -4px rgba(138, 106, 63, .6);
}

.ab-admin-brand {
  font-size: 16px;
  font-weight: 700;
  color: #2e2418;
  letter-spacing: .5px;
}

.ab-admin-brand-sub {
  font-size: 11.5px;
  color: #8a94a8;
  margin-left: 2px;
}

.ab-admin-topbar .ab-admin-home-link {
  margin-left: auto;
  font-size: 13px;
  color: #4a6fa5;
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid #d5deec;
  border-radius: 999px;
  background: #f5f8fc;
  transition: all .18s ease;
}

.ab-admin-topbar .ab-admin-home-link:hover {
  background: #fff;
  border-color: #b08d55;
  color: #8a6a3f;
}

/* ---------------- 左侧菜单 ---------------- */
.ab-admin-side {
  background: #fbfcfe;
  border-right: 1px solid #e5e8f0;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ab-admin-side-title {
  font-size: 11px;
  letter-spacing: 2px;
  color: #9aa3b5;
  padding: 6px 12px 10px;
}

.ab-admin-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  font-size: 14px;
  color: #4a5568;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-family: inherit;
  transition: all .18s ease;
}

.ab-admin-menu-item:hover {
  background: #f0f3f9;
  color: #2e2418;
}

.ab-admin-menu-item.is-active {
  background: linear-gradient(90deg, rgba(176, 141, 85, .16), rgba(176, 141, 85, .05));
  color: #8a6a3f;
  font-weight: 600;
}

.ab-admin-menu-item span.ab-admin-menu-icon {
  font-size: 16px;
}

/* ---------------- 内容区 ---------------- */
.ab-admin-main {
  padding: 24px 26px 48px;
  overflow-y: auto;
}

.ab-admin-page { display: none; }
.ab-admin-page.is-active { display: block; }

.ab-admin-page-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.ab-admin-page-title {
  font-size: 19px;
  font-weight: 700;
  color: #2e2418;
  letter-spacing: .5px;
}

.ab-admin-page-desc {
  font-size: 12.5px;
  color: #8a94a8;
}

.ab-admin-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid #e5e8f0;
  border-radius: 12px;
  margin-bottom: 14px;
}

.ab-admin-toolbar .ab-admin-filter-input {
  flex: 1;
  min-width: 200px;
  padding: 9px 14px;
  font-size: 13px;
  font-family: inherit;
  color: #3d3428;
  border: 1px solid #d9deea;
  border-radius: 8px;
  background: #f8fafc;
  outline: none;
  transition: all .18s ease;
}

.ab-admin-toolbar .ab-admin-filter-input:focus {
  border-color: #b08d55;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(176, 141, 85, .15);
}

/* ---------------- 通用按钮 ---------------- */
.ab-btn {
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: #4a3c2a;
  cursor: pointer;
  border: 1px solid rgba(120, 95, 55, .38);
  border-radius: 8px;
  background: rgba(255, 255, 255, .95);
  transition: all .16s ease;
  white-space: nowrap;
}

.ab-btn:hover {
  background: #fff;
  border-color: rgba(150, 115, 60, .6);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -10px rgba(45, 60, 92, .5);
}

.ab-btn:active { transform: translateY(0); }

.ab-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.ab-btn.primary {
  color: #f4ead6;
  border: 1px solid #3a3026;
  background: linear-gradient(180deg, #4c3f30 0%, #322920 100%);
}

.ab-btn.primary:hover {
  background: linear-gradient(180deg, #5d4c39 0%, #3d3226 100%);
  color: #fff;
}

.ab-btn.danger {
  color: #a83c34;
  border-color: rgba(170, 70, 60, .4);
  background: rgba(255, 245, 240, .95);
}

.ab-btn.danger:hover {
  background: #fff;
  border-color: rgba(170, 70, 60, .65);
}

.ab-btn.small {
  padding: 6px 13px;
  font-size: 12px;
  border-radius: 7px;
}

/* ---------------- 表格 ---------------- */
.ab-table-wrap {
  overflow-x: auto;
  background: #fff;
  border: 1px solid #e5e8f0;
  border-radius: 12px;
}

.ab-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  color: #3d3428;
  min-width: 760px;
}

.ab-table thead th {
  position: sticky;
  top: 0;
  padding: 12px 14px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #8a94a8;
  background: #f7f8fb;
  border-bottom: 1px solid #e5e8f0;
  white-space: nowrap;
}

.ab-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #eef0f6;
  vertical-align: top;
  max-width: 300px;
}

.ab-table tbody tr:hover { background: #fafbfd; }

.ab-table .ab-cell-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ab-table tbody tr.is-selected { background: #fdf6ea; }

.ab-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #8a6a3f;
  cursor: pointer;
}

.ab-table .ab-cell-id {
  font-family: Consolas, monospace;
  font-size: 12px;
  color: #8a94a8;
  white-space: nowrap;
}

.ab-table .ab-cell-actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.ab-table .ab-tag {
  display: inline-block;
  padding: 2px 9px;
  font-size: 11px;
  color: var(--gold-deep);
  border: 1px solid rgba(176, 141, 85, .4);
  border-radius: 999px;
  background: rgba(255, 255, 255, .6);
  margin-right: 4px;
  white-space: nowrap;
}

/* ---------------- 分页 ---------------- */
.ab-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 0 4px;
  font-size: 13px;
  color: #4a5568;
}

.ab-pager button {
  min-width: 36px;
  padding: 7px 12px;
  font-size: 13px;
  font-family: inherit;
  color: #4a3c2a;
  cursor: pointer;
  border: 1px solid #d9deea;
  border-radius: 8px;
  background: #fff;
  transition: all .16s ease;
}

.ab-pager button:hover:not(:disabled) {
  border-color: #b08d55;
  color: #8a6a3f;
  background: #fffdf7;
}

.ab-pager button:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.ab-pager .ab-pager-info { color: #8a94a8; font-size: 12px; }

/* ---------------- 弹窗 ---------------- */
.ab-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 6vh 16px;
  background: rgba(30, 38, 60, .42);
  backdrop-filter: blur(2px);
}

.ab-modal-mask.is-open { display: flex; }

.ab-modal {
  width: 100%;
  max-width: 760px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 60px -18px rgba(30, 38, 60, .45);
  overflow: hidden;
  animation: abModalIn .28s cubic-bezier(.22, .8, .3, 1) both;
}

@keyframes abModalIn {
  from { opacity: 0; transform: translateY(16px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.ab-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid #eef0f6;
  background: #fafbfd;
}

.ab-modal-title {
  font-size: 15px;
  font-weight: 700;
  color: #2e2418;
  letter-spacing: .5px;
}

.ab-modal-close {
  width: 30px;
  height: 30px;
  font-size: 16px;
  color: #8a94a8;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  background: transparent;
  transition: all .16s ease;
}

.ab-modal-close:hover {
  background: #f0f3f9;
  color: #3d3428;
}

.ab-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 22px;
}

.ab-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid #eef0f6;
  background: #fafbfd;
}

/* ---------------- 确认弹窗（confirm 变体） ---------------- */
.ab-confirm-mask {
  position: fixed;
  inset: 0;
  z-index: 96;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(30, 38, 60, .45);
  backdrop-filter: blur(2px);
}

.ab-confirm-mask.is-open { display: flex; }

.ab-confirm-modal {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 60px -18px rgba(30, 38, 60, .45);
  overflow: hidden;
  animation: abModalIn .28s cubic-bezier(.22, .8, .3, 1) both;
}

.ab-confirm-body {
  padding: 22px 24px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ab-confirm-title {
  font-size: 15px;
  font-weight: 700;
  color: #2e2418;
  letter-spacing: .5px;
}

.ab-confirm-title.is-danger { color: #8a2e28; }

.ab-confirm-message {
  font-size: 13.5px;
  line-height: 1.7;
  color: #4a5568;
  word-break: break-word;
}

.ab-confirm-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px 20px;
}

.ab-confirm-foot .ab-btn { min-width: 88px; justify-content: center; }
.ab-confirm-foot .ab-btn.danger {
  color: #f4ead6;
  border: 1px solid #6f2420;
  background: linear-gradient(180deg, #a83c34 0%, #8a2e28 100%);
}

.ab-confirm-foot .ab-btn.danger:hover {
  background: linear-gradient(180deg, #b8453c 0%, #9a3830 100%);
  color: #fff;
}

/* ---------------- 按钮 loading 态 ---------------- */
.ab-btn.is-loading {
  position: relative;
  pointer-events: none;
  opacity: .82;
}

.ab-btn.is-loading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -3px;
  border-radius: 50%;
  border: 2px solid rgba(120, 95, 55, .35);
  border-top-color: currentColor;
  animation: abSpin .8s linear infinite;
}

.ab-btn.primary.is-loading::before,
.ab-btn.danger.is-loading::before {
  border-color: rgba(255, 255, 255, .35);
  border-top-color: #fff;
}

.ab-btn.is-loading .ab-btn-label { margin-left: 0; }

@keyframes abSpin {
  to { transform: rotate(360deg); }
}

/* ---------------- 全局 loading 遮罩 ---------------- */
.ab-loading-mask {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(30, 38, 60, .32);
  backdrop-filter: blur(1px);
}

.ab-loading-mask.is-open { display: flex; }

.ab-loading-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 26px;
  min-width: 220px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(120, 95, 55, .3);
  box-shadow: 0 18px 44px -16px rgba(30, 38, 60, .35);
}

.ab-loading-box.is-large {
  min-width: 280px;
  padding: 22px 30px;
}

.ab-loading-spinner {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 3px solid rgba(176, 141, 85, .25);
  border-top-color: #8a6a3f;
  animation: abSpin .8s linear infinite;
}

.ab-loading-text {
  font-size: 13.5px;
  color: #4a3c2a;
  letter-spacing: .5px;
  white-space: nowrap;
}

.ab-loading-text.is-nowrap { white-space: normal; max-width: 360px; }

/* ---------------- 表单 ---------------- */
.ab-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.ab-form-grid .ab-form-field-full { grid-column: 1 / -1; }

/* 工单弹窗：FX/CA 选项左右分栏（外层 .ab-form-grid 1fr 1fr，子列内部纵向堆叠） */
.ab-form-grid .ab-title-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ab-form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ab-form-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  color: #8a6a3f;
}

.ab-form-label small {
  font-weight: 400;
  color: #9aa3b5;
  letter-spacing: 0;
  margin-left: 4px;
}

.ab-form-input,
.ab-form-textarea,
.ab-form-select {
  width: 100%;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: #3d3428;
  border: 1px solid #d9deea;
  border-radius: 8px;
  background: #f8fafc;
  outline: none;
  transition: all .18s ease;
  resize: vertical;
}

.ab-form-input:focus,
.ab-form-textarea:focus,
.ab-form-select:focus {
  border-color: #b08d55;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(176, 141, 85, .15);
}

.ab-form-textarea { min-height: 96px; }

.ab-form-hint {
  font-size: 11.5px;
  color: #9aa3b5;
}

/* ---------------- 导入区 ---------------- */
.ab-import-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px 18px;
  text-align: center;
  cursor: pointer;
  border: 1.5px dashed #c9b48a;
  border-radius: 12px;
  background: rgba(255, 253, 246, .8);
  transition: all .2s ease;
}

.ab-import-zone:hover,
.ab-import-zone.is-dragover {
  border-color: #8a6a3f;
  background: #fff;
  box-shadow: 0 10px 24px -18px rgba(45, 60, 92, .4);
}

.ab-import-zone .ab-import-icon { font-size: 26px; }
.ab-import-zone .ab-import-title { font-size: 13.5px; font-weight: 600; color: #3d3428; }
.ab-import-zone .ab-import-hint { font-size: 12px; color: #8a94a8; }

.ab-import-result {
  margin-top: 14px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.7;
  color: #3d3428;
  border: 1px solid #e5e8f0;
  border-radius: 10px;
  background: #f8fafc;
  white-space: pre-wrap;
}

.ab-import-result.is-success { border-color: rgba(70, 130, 90, .4); background: #f0f9f4; color: #2f5d3a; }
.ab-import-result.is-error { border-color: rgba(170, 70, 60, .4); background: #fff5f2; color: #8a2e28; }

/* ---------------- 空态 ---------------- */
.ab-empty {
  padding: 44px 20px;
  text-align: center;
  color: #8a94a8;
  font-size: 13.5px;
}

.ab-empty .ab-empty-icon {
  font-size: 34px;
  display: block;
  margin-bottom: 10px;
  filter: saturate(.6);
}

/* ---------------- 管理端响应式 ---------------- */
@media (max-width: 900px) {
  .ab-admin-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 64px auto 1fr;
  }

  .ab-admin-side {
    grid-row: 2;
    flex-direction: row;
    overflow-x: auto;
    padding: 10px 14px;
    border-right: none;
    border-bottom: 1px solid #e5e8f0;
  }

  .ab-admin-side-title { display: none; }

  .ab-admin-menu-item {
    flex-shrink: 0;
    padding: 9px 13px;
    border: 1px solid #e5e8f0;
    border-radius: 999px;
    background: #fff;
  }

  .ab-admin-menu-item.is-active { background: #fffdf7; border-color: #b08d55; }

  .ab-admin-main { grid-row: 3; padding: 18px 14px 40px; }

  .ab-form-grid { grid-template-columns: 1fr; }
}
