/* Gateway — app.css — BIPPO Advisory Group 视觉语言
   配色/字体/形状取自 www.bippoadvisor.com 的 computed style 实测值。
   对比度均经 WCAG 相对亮度公式验证,见
   docs/superpowers/plans/2026-08-03-bippo-visual-restyle.md */
:root {
  /* ── 主色 ── */
  --red:        #B6262D;   /* 主按钮、section 标题、强调。白字 6.36:1 ✓ */
  --red2:       #A64133;   /* 印章红、hover、理念小标题。白字 6.13:1 ✓ */

  /* ── 辅色 ── */
  --champ:      #DDC399;   /* 次按钮底、active 态、装饰线。切勿配白字(1.70:1 ✗) */
  --champ2:     #C9AC7E;   /* champ hover */

  /* ── 通用强调(承载文字) ── */
  --accent:      #866A42;              /* 白底 5.06:1 / 暖米底 4.56:1 ✓ */
  --accent-dark: #6B5434;              /* accent hover:白字 7.14:1 ✓ */
  --accent-soft: rgba(134,106,66,.12);
  --accent-bg:   rgba(134,106,66,.07);

  /* ── 底色 ── */
  --bg:       #ffffff;
  --bg-warm:  #F5F3F0;                 /* 交替 section */
  --bg-tint:  rgba(255,239,224,.25);   /* 第三层极浅暖调 */
  --footer:   #1B1B1B;
  /* 兼容:旧代码里的 --bg2 / --bg3 指向新的浅底,避免大面积改写 */
  --bg2:      #F5F3F0;
  --bg3:      #E9E5E0;

  /* ── 文字 ── */
  --ink:      #191919;   /* 标题 */
  --ink2:     #353535;   /* 正文,白底 12.27:1 ✓ */
  --muted:    #5A5A5A;   /* 次要,白底 6.90:1 ✓ */
  --faint:    #666666;   /* 最弱,暖米底 5.18:1 ✓(原 #a09890 不达标) */

  /* ── 线 ── */
  --line:     rgba(0,0,0,.08);
  --line2:    rgba(0,0,0,.14);

  /* ── 形状 ── */
  --radius:    3px;
  --radius-lg: 5px;

  /* ── 状态色 ── */
  --ok:       #2f7249;   /* 白底 5.79:1 / 徽章浅绿底(#eff6f2) 5.28:1 ✓ */
  --err:      #b84c3a;

  /* ── 字体 ── */
  --serif:  'Zen Old Mincho', 'Songti TC', 'Songti SC', serif;
  --caslon: 'Libre Caslon Text', 'Songti TC', 'Songti SC', serif;
  --sans:   -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang HK', 'Microsoft JhengHei', sans-serif;
  --mono:   'IBM Plex Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  color: var(--ink2);
  background: var(--bg);
  /* 內容不夠一屏時把頁腳頂到底:min-height 只是把 body 撐到 100vh,頁腳仍然
     貼在內容末尾,底下留一條白 —— 授權、角色這些行數少的後台頁最明顯。
     flex 直排 + 頁腳 margin-top:auto 才是真的把它推下去。 */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  line-height: 1.625;
  overflow-x: hidden;
}

/* ── 顶栏 ── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  height: 72px;
  padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: inherit;
}
.brand--home {
  margin-left: -8px;
  padding: 6px 10px 6px 8px;
  border-radius: var(--radius);
  transition: background .18s ease, transform .18s ease;
}
.brand--home:hover { background: var(--accent-bg); }
.brand--home:active { transform: translateY(1px); }
.brand--home:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.home-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  flex-shrink: 0;
  color: #fff;
  background: var(--red);
  border-radius: var(--radius);
}
.home-mark svg {
  width: 19px; height: 19px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
/* 红色印章 logo */
.seal {
  width: 34px; height: 34px;
  background: var(--red);
  border-radius: var(--radius);
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700; font-size: 17px;
  color: #fff;
  flex-shrink: 0;
}
.brand-name {
  font-family: var(--serif);
  font-size: 15px; font-weight: 500;
  letter-spacing: .12em;
  color: var(--ink);
}
.brand-sub {
  font-family: var(--caslon);
  font-size: 9.5px; letter-spacing: .2em;
  color: var(--faint);
}
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-user {
  font-family: var(--sans);
  font-size: 13px; color: var(--muted);
}
.btn-ghost {
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  padding: 7px 16px;
  cursor: pointer; transition: .2s;
  white-space: nowrap;
}
.btn-ghost:hover { color: var(--ink); border-color: var(--accent); }
.btn-admin {
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: #fff;
  background: var(--red);
  border: 1px solid var(--red);
  border-radius: var(--radius);
  padding: 7px 16px;
  text-decoration: none; transition: .2s;
  white-space: nowrap;
}
.btn-admin:hover { background: var(--red2); border-color: var(--red2); }

/* ── Panel / card ── */
.panel {
  border: 1px solid var(--line2);
  border-radius: var(--radius-lg);
  background: var(--bg);
  overflow: hidden;
  opacity: 0; animation: rise .9s .2s forwards;
}
.panel + .panel { margin-top: 24px; }
.panel-top {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 14px; letter-spacing: .1em;
  color: var(--ink);
  background: var(--bg-warm);
  position: relative;
  padding-left: 23px;
}
/* 左侧红竖条,取代原来的红黄绿窗口点 */
.panel-top::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--red);
}
.panel-body { padding: clamp(22px, 4vw, 36px); }

/* ── 登录页 ── */
.login-body { display: flex; flex-direction: column; min-height: 100vh; }
.hero--login {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  padding: 60px 24px;
}
.login-wrap { position: relative; z-index: 1; width: 100%; display: flex; justify-content: center; }
.login-card {
  width: 100%; max-width: 420px;
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 44px 40px 40px;
  text-align: left;
}
.login-logo {
  display: flex; align-items: center; gap: 13px;
  margin-bottom: 32px;
}
.login-logo .seal { width: 40px; height: 40px; font-size: 20px; }
.login-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 28px;
  letter-spacing: .08em;
  color: var(--ink);
  margin-bottom: 8px;
}
.login-sub {
  font-size: 13px; color: var(--muted);
  margin-bottom: 30px;
}
.form-group { margin-bottom: 18px; }
.form-label {
  display: block;
  font-family: var(--sans);
  font-size: 12px; font-weight: 500; letter-spacing: .1em;
  color: var(--muted);
  margin-bottom: 8px;
}
.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--sans); font-size: 15px;
  padding: 12px 14px;
  transition: .2s; outline: none;
}
.form-input::placeholder { color: var(--faint); }
.form-input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(182,38,45,.15);
}
.error-msg {
  background: rgba(184,76,58,.06);
  border: 1px solid rgba(184,76,58,.28);
  border-radius: var(--radius);
  color: var(--err);
  font-size: 13px;
  padding: 11px 14px;
  margin-bottom: 18px;
  display: flex; align-items: center; gap: 8px;
}
.error-msg::before { content: "⚠"; }

/* ── 主按钮(对齐参考站「更多」按钮:#B6262D / 3px / 12px 24px / 无阴影) ── */
.btn-primary {
  width: 100%;
  font-family: var(--sans); font-weight: 500;
  font-size: 15px;
  color: #fff;
  background: var(--red);
  border: none; border-radius: var(--radius);
  padding: 13px 24px;
  cursor: pointer;
  letter-spacing: .08em;
  transition: .2s;
}
.btn-primary:hover { background: var(--red2); }
.btn-primary:disabled {
  background: #e0e0e0;
  color: var(--muted);
  cursor: not-allowed;
}

/* ── Workflow grid ── */
.wf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 8px;
}
.wf-card {
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  padding: 26px 24px 22px;
  background: var(--bg);
  position: relative;
  overflow: hidden;
  transition: .25s;
  opacity: 0;
  transform: translateY(14px);
  animation: rise .6s forwards;
  text-decoration: none;
  display: block;
}
.wf-card:nth-child(1) { animation-delay: .46s }
.wf-card:nth-child(2) { animation-delay: .54s }
.wf-card:nth-child(3) { animation-delay: .62s }
.wf-card:nth-child(4) { animation-delay: .70s }
.wf-card:nth-child(5) { animation-delay: .78s }
.wf-card:nth-child(6) { animation-delay: .86s }
.wf-card::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--red);
  opacity: 0; transition: .25s;
}
.wf-card:hover {
  border-color: var(--champ);
  transform: translateY(-2px);
}
.wf-card:hover::before { opacity: 1; }
.wf-card-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: var(--red);
  color: #fff;
  display: grid; place-items: center;
  font-size: 18px;
  margin-bottom: 16px;
  transition: .25s;
}
.wf-card:hover .wf-card-icon { background: var(--red2); }
.wf-card-name {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: .06em;
  color: var(--ink);
  margin-bottom: 6px;
}
.wf-card-action {
  font-family: var(--sans);
  font-size: 12px; letter-spacing: .12em;
  color: var(--accent);
  margin-top: 14px;
  display: flex; align-items: center; gap: 6px;
}
.wf-card-action::after { content: "→"; transition: .2s; }
.wf-card:hover .wf-card-action::after { transform: translateX(4px); }

/* Empty state */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 24px;
  color: var(--faint);
}
.empty-state-icon {
  font-size: 40px; margin-bottom: 16px; opacity: .75;
}
.empty-state p { font-size: 14px; line-height: 1.8; }

/* ── Run form (legacy classes kept for compatibility) ── */
.run-header {
  margin-bottom: 28px;
}
.run-wf-name {
  font-family: var(--serif);
  font-weight: 900;
  font-size: clamp(22px, 4vw, 34px);
  color: var(--ink);
  margin-top: 6px;
}

.field-group { margin-bottom: 22px; }
.field-label {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px; letter-spacing: .24em;
  color: var(--muted); text-transform: uppercase;
  margin-bottom: 9px;
}
.field-input {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--sans); font-size: 14px;
  padding: 12px 16px;
  transition: .25s; outline: none;
}
.field-input::placeholder { color: var(--faint); }
.field-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* File input */
.file-drop {
  width: 100%;
  border: 1.5px dashed var(--line2);
  border-radius: var(--radius);
  background: var(--bg2);
  padding: 20px 20px;
  cursor: pointer;
  transition: .25s;
  text-align: center;
  position: relative;
}
.file-drop:hover,
.file-drop:focus-within {
  border-color: rgba(134,106,66,.4);
  background: var(--accent-bg);
}
.file-drop input[type="file"] {
  position: absolute; inset: 0;
  opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.file-drop-label {
  font-family: var(--mono);
  font-size: 12px; letter-spacing: .14em;
  color: var(--faint);
}
.file-drop-label b { color: var(--accent); font-weight: 500; }
.file-drop-name {
  font-size: 13px; color: var(--ink);
  margin-top: 4px; display: none;
}

.run-btn {
  margin-top: 28px;
  font-family: var(--sans); font-weight: 500;
  font-size: 15px;
  color: #fff;
  background: var(--accent);
  border: none; border-radius: var(--radius);
  padding: 14px 36px;
  cursor: pointer;
  letter-spacing: .04em;
  transition: .25s;
  display: inline-flex; align-items: center; gap: 8px;
}
.run-btn:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
}
.run-btn:disabled {
  filter: grayscale(.6) brightness(.9);
  cursor: not-allowed; transform: none;
}

/* ── Progress pipeline (legacy) ── */
.progress-section {
  margin-top: 32px;
  padding-top: 28px;
  border-top: 1px solid var(--line2);
  display: none;
}
.progress-section.show { display: block; }
.progress-label {
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .28em; color: var(--muted);
  text-transform: uppercase; margin-bottom: 20px;
}
.pipe {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
}
.pipe-node {
  position: relative;
  text-align: center;
  padding: 0 6px;
}
.pipe-node-ic {
  width: 48px; height: 48px;
  margin: 0 auto 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line2);
  display: grid; place-items: center;
  background: var(--bg2);
  color: var(--muted);
  font-size: 20px;
  transition: .4s;
}
.pipe-node-nm {
  font-size: 12px; color: var(--muted);
  transition: .3s; line-height: 1.3;
}
.pipe-node::after {
  content: "";
  position: absolute;
  top: 24px;
  left: calc(50% + 30px);
  right: calc(-50% + 30px);
  height: 1px;
  background: var(--line2);
}
.pipe-node:last-child::after { display: none; }

.pipe-node.active .pipe-node-ic {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
  animation: bob 1.1s infinite;
}
.pipe-node.active .pipe-node-nm { color: var(--ink); }
.pipe-node.done .pipe-node-ic {
  border-color: var(--ok);
  color: var(--ok);
  background: rgba(58,140,92,.06);
}
.pipe-node.done .pipe-node-nm { color: var(--ink); }

/* ── Result (legacy) ── */
.result-section {
  margin-top: 28px;
  display: none;
}
.result-section.show { display: block; }
.result-title {
  font-family: var(--mono); font-size: 10.5px;
  letter-spacing: .28em; color: var(--accent);
  text-transform: uppercase; margin-bottom: 14px;
}
.dl-list { display: flex; flex-direction: column; gap: 10px; }
.dl-item {
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  padding: 14px 18px;
  background: var(--accent-bg);
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.dl-item-name {
  font-family: var(--mono); font-size: 13px;
  color: var(--ink); word-break: break-all;
}
.dl-item-name small {
  display: block; font-size: 10.5px;
  color: var(--faint); letter-spacing: .14em;
  margin-bottom: 3px; text-transform: uppercase;
}
.dl-link {
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: #fff;
  background: var(--accent);
  border-radius: var(--radius);
  padding: 9px 18px;
  text-decoration: none;
  transition: .2s; white-space: nowrap;
}
.dl-link:hover { background: var(--accent-dark); transform: translateY(-1px); }

/* ── Error box (legacy) ── */
.run-error {
  margin-top: 20px;
  border: 1px solid rgba(184,76,58,.28);
  border-radius: var(--radius);
  padding: 14px 18px;
  color: var(--err);
  font-family: var(--mono); font-size: 13px;
  background: rgba(184,76,58,.05);
  display: none;
}
.run-error.show { display: block; }

/* Spinner (legacy) */
.spin {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(134,106,66,.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -2px;
}

/* ── Animations ── */
@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}

/* ── Responsive ── */
@media (max-width: 600px) {
  .pipe { grid-template-columns: repeat(2, 1fr); }
  .pipe-node::after { display: none; }
  nav .brand-sub { display: none; }
  .nav-user { display: none; }
}

/* ═══════════════════════════════════════════
   RUN PAGE — workflow redesign
   ═══════════════════════════════════════════ */

/* Two-column layout */
.run-workspace {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 28px;
  align-items: start;
}

.run-col-form {
  opacity: 0; animation: rise .8s .18s forwards;
}

/* Form fields wrapper */
.run-form { display: flex; flex-direction: column; gap: 12px; }
.run-field {}

/* ── Dropzone ── */
.dropzone {
  border: 1.5px dashed var(--line2);
  border-radius: var(--radius);
  background: #fff;
  position: relative;
  cursor: pointer;
  transition: border-color .25s, background .25s, box-shadow .25s;
  overflow: hidden;
}
.dropzone::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--accent-soft), transparent 60%);
  opacity: 0; transition: opacity .3s;
  pointer-events: none;
}
.dropzone:hover, .dropzone.dz-over {
  border-color: rgba(134,106,66,.5);
}
.dropzone:hover::before, .dropzone.dz-over::before { opacity: 1; }
.dropzone.dz-over {
  border-style: solid;
  border-color: var(--accent);
}
.dropzone.dz-chosen {
  border-color: rgba(58,140,92,.4);
  border-style: solid;
  background: rgba(58,140,92,.03);
}

/* sr-only — visually hidden but in DOM (required for test + form submission) */
.sr-only {
  position: absolute;
  width: 100%; height: 100%;
  top: 0; left: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
}

.dz-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
  position: relative; z-index: 6;
  /* Keep the transparent file input clickable across the card while letting
     the remove button above it receive its own click. */
  pointer-events: none;
}

.dz-icon-wrap {
  flex-shrink: 0;
}
.dz-icon {
  width: 52px; height: 52px;
  border-radius: var(--radius);
  border: 1px solid var(--line2);
  background: var(--bg2);
  display: grid; place-items: center;
  color: var(--muted);
  transition: .3s;
}
.dropzone:hover .dz-icon,
.dropzone.dz-over .dz-icon {
  border-color: var(--accent);
  color: var(--accent);
}
.dropzone.dz-chosen .dz-icon {
  border-color: var(--ok);
  color: var(--ok);
}

.dz-meta { flex: 1; min-width: 0; }
.dz-field-label {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.dz-friendly-label {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.dz-required {
  font-family: var(--mono);
  font-size: 9.5px; letter-spacing: .18em;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid rgba(134,106,66,.25);
  border-radius: var(--radius);
  padding: 1px 6px;
  text-transform: uppercase;
}
.dz-hint {
  font-size: 12px; color: var(--faint);
  font-family: var(--sans);
}
.dz-browse { color: var(--accent); }

.dz-chosen-info {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px;
}
.dz-chosen-name {
  font-family: var(--mono);
  font-size: 12px; color: var(--ok);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 260px;
}
.dz-chosen-size {
  font-family: var(--mono);
  font-size: 11px; color: var(--faint);
  white-space: nowrap;
}

/* The id="dz-chosen-*" container becomes visible on file pick */
.dz-chosen-display { display: none; }
.dz-chosen-display.show { display: flex; }

.dz-clear {
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  color: var(--faint);
  font-size: 12px;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  cursor: pointer;
  transition: .2s;
  z-index: 6; position: relative;
  pointer-events: auto;
}
.dz-clear:hover {
  border-color: var(--err);
  color: var(--err);
}

/* ── Text field (run form) ── */
.run-text-field {
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  background: #fff;
  padding: 13px 18px 11px;
  transition: border-color .25s, box-shadow .25s;
}
.run-text-field:focus-within {
  border-color: rgba(134,106,66,.45);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.run-text-label {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px; cursor: text;
}
.run-text-friendly {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}
.rtf-required {
  font-family: var(--mono);
  font-size: 9.5px; letter-spacing: .18em;
  color: var(--accent);
  background: var(--accent-bg);
  border: 1px solid rgba(134,106,66,.25);
  border-radius: var(--radius);
  padding: 1px 6px;
  text-transform: uppercase;
}
.run-text-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--ink);
  font-family: var(--sans); font-size: 14px;
  padding: 0;
  caret-color: var(--accent);
}
.run-text-input::placeholder { color: var(--faint); }

/* ── Unified select / dropdown ──
   Native select stays in the DOM for form submission; app.js layers this
   consistent trigger + listbox over it. The first rule is also the no-JS
   fallback, so the control never drops back to the browser's dated arrow. */
.run-select-input,
.admin-select,
.admin-kb-access-select {
  appearance: none;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath fill='none' stroke='%23866A42' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='m2 2 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 42px;
  cursor: pointer;
}
.pretty-select {
  position: relative;
  display: inline-block;
  min-width: 0;
  max-width: 100%;
  vertical-align: middle;
}
.pretty-select--run { width: 100%; }
.pretty-select--admin { width: 100%; }
.pretty-select--permission { width: min(100%, 190px); }
.pretty-select-native {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
}
.pretty-select-trigger {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px 8px 13px;
  color: var(--ink2);
  background: linear-gradient(180deg, #fff 0%, #fbfaf8 100%);
  border: 1px solid var(--line2);
  border-radius: 7px;
  box-shadow: 0 1px 2px rgba(45,35,24,.04);
  font-family: var(--sans);
  font-size: 13.5px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.pretty-select-trigger:hover {
  border-color: rgba(134,106,66,.55);
  background: #fff;
  box-shadow: 0 4px 14px rgba(64,45,23,.08);
}
.pretty-select-trigger:focus-visible,
.pretty-select.is-open .pretty-select-trigger {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft), 0 5px 16px rgba(64,45,23,.09);
}
.pretty-select-trigger:disabled { opacity: .55; cursor: not-allowed; }
.pretty-select-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pretty-select-chevron {
  position: relative;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-bg);
  transition: background .18s ease, transform .2s ease;
}
.pretty-select-chevron::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 7px;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
  transform: rotate(45deg);
}
.pretty-select.is-open .pretty-select-chevron {
  background: var(--accent-soft);
  transform: rotate(180deg);
}
.pretty-select-menu {
  position: fixed;
  z-index: 110;
  display: grid;
  gap: 3px;
  max-height: min(320px, calc(100vh - 20px));
  overflow-y: auto;
  padding: 6px;
  background: rgba(255,255,255,.98);
  border: 1px solid rgba(134,106,66,.24);
  border-radius: 10px;
  box-shadow: 0 18px 46px rgba(47,34,19,.18), 0 3px 10px rgba(47,34,19,.08);
  backdrop-filter: blur(10px);
  transform-origin: top center;
  animation: dropdown-in .14s ease-out both;
}
.pretty-select-menu[hidden] { display: none; }
.pretty-select-menu--above { transform-origin: bottom center; }
@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-4px) scale(.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.pretty-select-option {
  position: relative;
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 34px 8px 11px;
  color: var(--ink2);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
  cursor: pointer;
  transition: color .14s ease, background .14s ease;
}
.pretty-select-option:hover,
.pretty-select-option:focus-visible {
  outline: none;
  color: var(--accent-dark);
  background: var(--accent-bg);
}
.pretty-select-option.is-selected {
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 600;
}
.pretty-select-option.is-selected::after {
  content: '';
  position: absolute;
  right: 13px;
  top: 50%;
  width: 7px;
  height: 4px;
  border-left: 1.8px solid var(--accent);
  border-bottom: 1.8px solid var(--accent);
  transform: translateY(-65%) rotate(-45deg);
}
.pretty-select-option:disabled { opacity: .45; cursor: not-allowed; }
.pretty-select-menu::-webkit-scrollbar { width: 8px; }
.pretty-select-menu::-webkit-scrollbar-thumb { background: var(--line2); border: 2px solid #fff; border-radius: 8px; }

/* Permission selects use a small status light instead of relying on text
   colour alone. */
.pretty-select--permission .pretty-select-trigger::before,
.pretty-select-menu--permission .pretty-select-option::before {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 3px rgba(102,102,102,.09);
}
.pretty-select--permission[data-value='none'] .pretty-select-trigger::before,
.pretty-select-menu--permission .pretty-select-option[data-value='none']::before {
  background: var(--err); box-shadow: 0 0 0 3px rgba(184,76,58,.10);
}
.pretty-select--permission[data-value='view'] .pretty-select-trigger::before,
.pretty-select-menu--permission .pretty-select-option[data-value='view']::before {
  background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.pretty-select--permission[data-value='edit'] .pretty-select-trigger::before,
.pretty-select-menu--permission .pretty-select-option[data-value='edit']::before {
  background: var(--ok); box-shadow: 0 0 0 3px rgba(47,114,73,.10);
}
.pretty-select--compact { width: auto; min-width: 132px; }
.pretty-select--compact .pretty-select-trigger {
  min-height: 36px;
  padding: 5px 7px 5px 11px;
  font-size: 12.5px;
}
.pretty-select--compact .pretty-select-chevron { width: 22px; height: 22px; }
.pretty-select--compact .pretty-select-chevron::before { left: 7px; top: 6px; }

@media (prefers-reduced-motion: reduce) {
  .pretty-select-menu { animation: none; }
  .pretty-select-chevron { transition: none; }
}

.preview-skeleton {
  display: grid;
  gap: 11px;
  width: min(680px, 100%);
  padding: 26px 18px;
}
.preview-skeleton i {
  display: block;
  height: 15px;
  border-radius: 4px;
  background: linear-gradient(100deg, #e9e5df 25%, #f8f6f2 42%, #e9e5df 60%);
  background-size: 300% 100%;
  animation: ui-shimmer 1.35s ease-in-out infinite;
}
.preview-skeleton i:nth-child(1) { width: 44%; height: 22px; }
.preview-skeleton i:nth-child(2) { width: 96%; }
.preview-skeleton i:nth-child(3) { width: 88%; }
.preview-skeleton i:nth-child(4) { width: 72%; }
@keyframes ui-shimmer { to { background-position-x: -150%; } }
.rtf-hint {
  font-family: var(--mono);
  font-size: 10px; color: var(--faint);
  letter-spacing: .12em;
  margin-top: 6px;
  /* 曾經有 opacity:.6 讓字更淡——但探針早期不合成 opacity,把它算成
     --faint 原色的 5.74:1,真實合成後只剩 ~2.52:1,不達 AA。--faint
     本身在白底已經是最弱的可用灰,不需要再疊透明度。 */
}

/* ── Execute button ── */
.run-actions { margin-top: 10px; }
.run-execute-btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--sans); font-weight: 600;
  font-size: 15px;
  color: #fff;
  background: var(--accent);
  border: none; border-radius: var(--radius);
  padding: 15px 32px 15px 26px;
  cursor: pointer;
  letter-spacing: .04em;
  transition: transform .22s, box-shadow .22s, filter .22s, background .22s;
  position: relative; overflow: hidden;
}
.run-execute-btn:hover {
  background: var(--accent-dark);
  transform: translateY(-2px);
}
.run-execute-btn:active { transform: translateY(0); }
.run-execute-btn:disabled {
  filter: grayscale(.65) brightness(.85);
  cursor: not-allowed; transform: none;
}
.run-execute-icon { flex-shrink: 0; display: flex; }
.run-execute-text {}
.run-execute-spinner { flex-shrink: 0; display: flex; align-items: center; }

/* Spin ring(用于浅底按钮 —— 深色描边压在浅色按钮底上)*/
.spin-ring {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: rgba(255,255,255,.9);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* ── Right column: stage + output ── */
.run-col-status {
  display: flex; flex-direction: column; gap: 16px;
  opacity: 0; animation: rise .8s .3s forwards;
  position: sticky; top: 24px;
}

/* Stage panel (always visible, states change) */
.stage-panel {
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}
.stage-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.stage-panel-label {
  font-family: var(--mono);
  font-size: 10px; letter-spacing: .3em;
  color: var(--muted); text-transform: uppercase;
}
.stage-status-badge {
  font-family: var(--mono);
  font-size: 10px; letter-spacing: .14em;
  color: var(--faint);
  background: var(--bg2);
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  padding: 3px 10px;
  transition: .3s;
}
.stage-status-badge.running {
  color: var(--accent);
  border-color: rgba(134,106,66,.3);
  background: var(--accent-bg);
  animation: pulse 1.6s infinite;
}
.stage-status-badge.done {
  color: var(--ok);
  border-color: rgba(58,140,92,.3);
  background: rgba(58,140,92,.06);
  animation: none;
}
.stage-status-badge.error {
  color: var(--err);
  border-color: rgba(184,76,58,.3);
  background: rgba(184,76,58,.06);
  animation: none;
}

.stage-track {
  padding: 8px 0;
}

.stage-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 18px;
  position: relative;
  transition: background .2s;
}
.stage-step:hover { background: rgba(0,0,0,.015); }

.stage-step-icon {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--line2);
  background: var(--bg2);
  display: grid; place-items: center;
  color: var(--faint);
  transition: .35s;
  margin-top: 1px;
}
.stage-step-body { flex: 1; min-width: 0; padding-top: 1px; }
.stage-step-name {
  font-size: 13px; font-weight: 500; color: var(--muted);
  transition: color .3s;
  line-height: 1.3;
}
.stage-step-desc {
  font-size: 11px; color: var(--faint);
  font-family: var(--mono); letter-spacing: .06em;
  margin-top: 2px;
  transition: color .3s;
}
.stage-check {
  flex-shrink: 0;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--line2);
  background: var(--bg2);
  display: grid; place-items: center;
  color: transparent;
  margin-top: 6px;
  transition: .35s;
}
.stage-line {
  position: absolute;
  left: 34px; top: 56px; bottom: 0;
  width: 1px;
  background: var(--line2);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .4s ease;
}
.stage-step.s-done .stage-line { transform: scaleY(1); }

/* Active state */
.stage-step.s-active .stage-step-icon {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
  animation: bob 1.2s infinite;
}
.stage-step.s-active .stage-step-name { color: var(--ink); }
.stage-step.s-active .stage-step-desc { color: var(--muted); }
.stage-step.s-active .stage-check {
  border-color: rgba(134,106,66,.3);
  background: var(--accent-bg);
}

/* Done state */
.stage-step.s-done .stage-step-icon {
  border-color: rgba(58,140,92,.4);
  color: var(--ok);
  background: rgba(58,140,92,.05);
  animation: none;
}
.stage-step.s-done .stage-step-name { color: var(--ink); }
.stage-step.s-done .stage-step-desc { color: var(--muted); }
.stage-step.s-done .stage-check {
  border-color: var(--ok);
  background: rgba(58,140,92,.08);
  color: var(--ok);
}

/* ── Error card ── */
.run-error-card {
  display: none;
  border: 1px solid rgba(184,76,58,.28);
  border-radius: var(--radius);
  background: rgba(184,76,58,.04);
  padding: 16px 18px;
  gap: 12px;
  align-items: flex-start;
}
.run-error-card.show { display: flex; }
.run-error-card--wide {
  width: 100%;
  margin-top: 18px;
  max-height: min(56vh, 620px);
  overflow: auto;
}
.rec-body { flex: 1 1 auto; min-width: 0; }
.rec-icon {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: var(--radius);
  background: rgba(184,76,58,.08);
  border: 1px solid rgba(184,76,58,.22);
  display: grid; place-items: center;
  color: var(--err);
}
.rec-title {
  font-family: var(--serif);
  font-size: 13px; font-weight: 700;
  color: var(--err);
  margin-bottom: 4px;
}
.rec-msg {
  font-family: var(--mono);
  font-size: 12px; color: rgba(184,76,58,.85);
  line-height: 1.6;
  word-break: break-word;
  white-space: pre-wrap;
}

/* ── Output panel ── */
.output-panel {
  display: none;
  border: 1px solid rgba(58,140,92,.2);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}
.output-panel.show { display: block; animation: rise .5s forwards; }
.output-panel-head {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 18px;
  border-bottom: 1px solid rgba(58,140,92,.1);
  background: rgba(58,140,92,.03);
}
.output-panel-icon {
  width: 26px; height: 26px;
  border-radius: var(--radius);
  background: rgba(58,140,92,.08);
  border: 1px solid rgba(58,140,92,.22);
  display: grid; place-items: center;
  color: var(--ok);
}
.output-panel-label {
  font-family: var(--mono);
  font-size: 10px; letter-spacing: .28em;
  color: var(--ok); text-transform: uppercase;
}

/* Download list */
.dl-list { display: flex; flex-direction: column; gap: 1px; }
.dl-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  transition: background .2s;
}
.dl-item:last-child { border-bottom: none; }
.dl-item:hover { background: var(--bg); }
.dl-item-icon {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: var(--radius);
  background: var(--bg2);
  border: 1px solid var(--line2);
  display: grid; place-items: center;
  color: var(--muted); font-size: 15px;
}
.dl-item-meta { flex: 1; min-width: 0; }
.dl-item-tag {
  font-family: var(--mono);
  font-size: 9.5px; letter-spacing: .2em;
  color: var(--faint); text-transform: uppercase;
  margin-bottom: 2px;
}
.dl-item-name {
  font-family: var(--mono);
  font-size: 12.5px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dl-link {
  flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  letter-spacing: .04em;
  color: #fff;
  background: var(--accent);
  border: none; border-radius: var(--radius);
  padding: 8px 14px;
  text-decoration: none;
  transition: .2s;
  white-space: nowrap;
}
.dl-link:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}
.dl-link--secondary {
  color: var(--accent-dark);
  background: var(--accent-bg);
  border: 1px solid var(--accent);
}
.dl-link--secondary:hover {
  color: #fff;
  background: var(--accent-dark);
}

/* ── Responsive: stack on mobile ── */
@media (max-width: 780px) {
  .run-workspace {
    grid-template-columns: 1fr;
  }
  .run-col-status { position: static; }
}
@media (max-width: 500px) {
  .dz-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
  .dz-icon-wrap { display: none; }
}

/* ── Workflow node list ── */
#node-list-container {
  display: none;
  margin-top: 12px;
  padding: 0 0 4px;
}

.node-list-label {
  font-family: var(--mono);
  font-size: 9.5px; letter-spacing: .28em;
  color: var(--muted); text-transform: uppercase;
  margin-bottom: 8px;
  padding: 0 2px;
}

.node-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.node-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line2);
  background: var(--bg);
  transition: background .2s, border-color .2s;
  font-size: 13px;
  font-family: var(--sans);
  color: var(--ink2);
}

.node-item.running {
  border-color: rgba(134,106,66,.3);
  background: var(--accent-bg);
  color: var(--ink);
}

.node-item.succeeded {
  border-color: rgba(58,140,92,.3);
  background: rgba(58,140,92,.04);
  color: var(--ink);
}

.node-item.failed {
  border-color: rgba(184,76,58,.28);
  background: rgba(184,76,58,.04);
  color: var(--err);
}

.node-item-icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  border-radius: 50%;
}

.node-item.running .node-item-icon { color: var(--accent); }
.node-item.succeeded .node-item-icon { color: var(--ok); }
.node-item.failed .node-item-icon { color: var(--err); }

.node-item-title {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: 13px;
}

/* CSS spinner for running nodes */
.node-spin {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid rgba(134,106,66,.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -1px;
}

/* 返回全部工作流 */
.run-back {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 18px;
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: var(--muted); text-decoration: none;
  padding: 7px 14px; border: 1px solid var(--line2); border-radius: var(--radius);
  background: #fff; transition: all .15s ease;
}
.run-back:hover { color: var(--accent); border-color: var(--accent); }

/* ═══════════════════════════════════════════
   ADMIN UI
   ═══════════════════════════════════════════ */

/* ── Admin sub-nav ── */
.admin-subnav {
  display: flex;
  gap: 4px;
  margin-bottom: 36px;
  border-bottom: 1px solid var(--line2);
  flex-wrap: wrap;
  opacity: 0; animation: rise .7s .1s forwards;
}
.admin-subnav-item {
  display: flex; align-items: center; gap: 6px;
  padding: 11px 18px;
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: .2s;
  letter-spacing: .04em;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.admin-subnav-item:hover { color: var(--ink); }
.admin-subnav-item.active {
  color: var(--red);
  border-bottom-color: var(--red);
}
.admin-subnav-icon { font-size: 12px; color: inherit; }

/* ── Admin page header row ── */
.admin-list-header {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  opacity: 0; animation: rise .8s .18s forwards;
}

/* ── Admin filter bar (授權頁的「全部 / 工作流 / 知識庫」)──────────────────
   原本是幾個帶 inline style 的連結,靠 font-weight + 底線區分選中,
   在一頁全是描邊方塊的後台裡像沒排過版的純文字。改成同一族的方塊 chip:
   選中=香檳底(此色配白字只有 1.70:1,所以字用 --ink)。 */
.admin-filter {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 8px;
  margin: -8px 0 22px;
  opacity: 0; animation: rise .8s .22s forwards;
}
.admin-filter-label {
  font-family: var(--mono);
  font-size: 10px; letter-spacing: .24em; text-transform: uppercase;
  color: var(--faint);
  margin-right: 4px;
}
.admin-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--sans); font-size: 12.5px; font-weight: 500;
  letter-spacing: .03em;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  padding: 6px 14px;
  text-decoration: none;
  transition: .18s;
}
.admin-chip:hover { color: var(--accent); border-color: var(--accent); }
.admin-chip.is-on {
  color: var(--ink);
  background: var(--champ);
  border-color: var(--champ2);
  font-weight: 500;
}
.admin-chip.is-on:hover { color: var(--ink); border-color: var(--champ2); }
/* chip 裡的計數。選中態壓在香檳底上,必須改用正文墨色:半透明墨(.62)在
   #DDC399 上只有 4.00:1,10px 小字不達 AA —— ui_shots 的對比度探針會抓。
   層級靠字號/字體(10.5px 等寬 vs 12.5px 無襯線)拉開,不靠壓低對比。 */
.admin-chip-n {
  font-family: var(--mono); font-size: 10.5px;
  color: var(--faint);                        /* 白底 5.18:1 ✓ */
}
.admin-chip.is-on .admin-chip-n { color: var(--ink2); }   /* 香檳底 7.22:1 ✓ */

/* ── Knowledge-base access control ── */
.admin-list-header--between { justify-content: space-between; align-items: center; }
.admin-kb-context {
  display: flex; align-items: baseline; gap: 10px;
  margin: 0 0 14px; padding: 13px 16px;
  border: 1px solid rgba(169,67,45,.2); border-left: 3px solid var(--red);
  border-radius: var(--radius); background: var(--accent-bg);
}
.admin-kb-context span { font: 10px var(--mono); letter-spacing: .08em; color: var(--faint); }
.admin-kb-context strong { font-family: var(--serif); font-size: 17px; color: var(--ink); }
.admin-kb-context small { margin-left: auto; font: 10px var(--mono); color: var(--faint); }
.admin-td-sub {
  display: block;
  margin-top: 2px;
  font-family: var(--mono); font-size: 10px;
  color: var(--faint);
}
.admin-kb-notice {
  display: flex; align-items: flex-start; gap: 12px;
  margin: -8px 0 22px;
  padding: 14px 16px;
  border: 1px solid var(--line2); border-radius: var(--radius-lg);
  background: var(--accent-bg);
  color: var(--ink2);
  opacity: 0; animation: rise .7s .18s forwards;
}
.admin-kb-notice-mark {
  flex: none; display: grid; place-items: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent); color: #fff;
  font-family: var(--serif); font-size: 13px; font-weight: 700;
}
.admin-kb-notice strong { display: block; color: var(--ink); font-size: 13.5px; }
.admin-kb-notice p { margin-top: 3px; font-size: 12.5px; line-height: 1.65; color: var(--muted); }
.admin-save-ok {
  font-family: var(--mono); font-size: 11px;
  color: var(--ok); letter-spacing: .04em;
}
.admin-kb-access-select {
  width: min(100%, 190px);
  padding: 8px 34px 8px 11px;
  border: 1px solid var(--line2); border-radius: var(--radius);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237a7568' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 11px center;
  appearance: none; cursor: pointer;
  font-family: var(--sans); font-size: 13px; color: var(--ink2);
}
.admin-kb-access-select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.admin-kb-access-select--none { color: var(--err); background-color: rgba(184,76,58,.04); }
.admin-kb-access-select--view { color: var(--muted); }
.admin-kb-access-select--edit { color: var(--ok); background-color: rgba(58,140,92,.04); }
.admin-kb-savebar { justify-content: flex-end; }
.admin-kb-savebar span { font-size: 11.5px; color: var(--faint); }

.admin-wf-users { min-width: 220px; }
.admin-wf-user-count {
  margin-bottom: 6px;
  font: 10px var(--mono); letter-spacing: .05em;
  color: var(--faint);
}
.admin-wf-user-list {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
}
.admin-wf-user-chip {
  display: inline-flex; align-items: baseline; gap: 4px;
  max-width: 190px; padding: 4px 8px;
  border: 1px solid var(--line2); border-radius: 999px;
  background: var(--bg); color: var(--ink2);
  font-size: 11.5px; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.admin-wf-user-chip small {
  color: var(--faint); font: 9.5px var(--mono);
  overflow: hidden; text-overflow: ellipsis;
}
.admin-wf-user-more { position: relative; }
.admin-wf-user-more summary {
  color: var(--accent); font-size: 11px; cursor: pointer;
  list-style: none;
}
.admin-wf-user-more summary::-webkit-details-marker { display: none; }
.admin-wf-user-more-list {
  position: absolute; z-index: 8; top: calc(100% + 6px); right: 0;
  display: flex; flex-direction: column; align-items: stretch; gap: 5px;
  width: max-content; max-width: 260px; max-height: 240px; overflow-y: auto;
  padding: 9px; border: 1px solid var(--line2); border-radius: var(--radius);
  background: #fff; box-shadow: 0 12px 30px rgba(25,25,25,.14);
}
.admin-wf-user-more:not([open]) .admin-wf-user-more-list { display: none; }

@media (max-width: 640px) {
  .admin-list-header--between { align-items: flex-start; gap: 12px; }
  .admin-kb-context { align-items: flex-start; flex-direction: column; gap: 4px; }
  .admin-kb-context small { margin-left: 0; }
  .admin-kb-access-select { min-width: 160px; }
  .admin-kb-savebar { align-items: flex-start; flex-direction: column; }
  .admin-wf-users { min-width: 0; }
  .admin-wf-user-more-list { left: 0; right: auto; }
}

/* ── Dashboard stat cards ── */
.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 36px;
  opacity: 0; animation: rise .8s .26s forwards;
}
.admin-stat-card {
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 26px 22px 20px;
  text-decoration: none;
  transition: .2s;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
}
.admin-stat-card:hover {
  border-color: var(--champ);
  transform: translateY(-2px);
}
.admin-stat-icon { font-size: 20px; color: var(--red); margin-bottom: 4px; }
.admin-stat-value {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 36px;
  line-height: 1;
  color: var(--ink);
}
.admin-stat-label {
  font-family: var(--sans);
  font-size: 12px; letter-spacing: .1em;
  color: var(--muted); text-transform: none;
}

.admin-usage-header { align-items: center; }
.admin-usage-tabs {
  display: inline-flex; gap: 4px; margin-bottom: 16px; padding: 4px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
}
.admin-usage-tabs a {
  padding: 8px 18px; border-radius: 7px; color: var(--muted);
  font-size: 13px; font-weight: 700; text-decoration: none;
}
.admin-usage-tabs a.active { color: #fff; background: var(--ink); }
.admin-usage-note { margin: -20px 0 28px; font-size: 13px; line-height: 1.6; color: var(--ink2); }
.admin-usage-note-inline { color: var(--ink2); white-space: nowrap; }
.admin-usage-source-url { color: var(--ink2); word-break: break-all; font-weight: 400; }
.admin-usage-periods { display: flex; gap: 8px; flex-wrap: wrap; }
.admin-filter-chip {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; color: var(--muted);
  background: var(--white); font-size: 12px; font-weight: 700; text-decoration: none;
}
.admin-filter-chip:hover, .admin-filter-chip.active {
  border-color: var(--red); color: var(--red); background: var(--red-soft);
}
.admin-usage-sync { color: var(--muted); font-size: 12px; }
.admin-usage-refresh { display: flex; align-items: center; gap: 10px; }
.admin-usage-warning {
  margin-bottom: 14px; padding: 11px 14px; border: 1px solid #efc3bf;
  border-radius: 10px; background: #fff4f2; color: #9c2f26; font-size: 13px;
}
.admin-usage-stats .admin-stat-value {
  min-height: 36px;
  display: flex;
  align-items: flex-end;
  white-space: nowrap;
  font-size: clamp(26px, 2.6vw, 36px);
  font-variant-numeric: tabular-nums;
}
.admin-usage-note { margin: 0 0 18px; }
.admin-usage-panel { margin-top: 18px; }
.admin-usage-rate { font-weight: 800; color: var(--ink); }

/* Quick links */
.admin-quick-links {
  opacity: 0; animation: rise .8s .34s forwards;
}
.admin-quick-title {
  font-family: var(--mono);
  font-size: 10.5px; letter-spacing: .26em;
  color: var(--faint); text-transform: uppercase;
  margin-bottom: 14px;
}
.admin-quick-grid {
  display: flex; flex-wrap: wrap; gap: 10px;
}
.admin-quick-btn {
  display: inline-flex; align-items: center;
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  padding: 10px 18px;
  text-decoration: none;
  transition: .2s;
  letter-spacing: .03em;
}
.admin-quick-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.admin-quick-btn--muted {
  color: var(--muted);
}
.admin-quick-btn--muted:hover {
  color: var(--muted);
  border-color: var(--line2);
  background: var(--bg2);
}

/* ── Admin table ── */
.admin-table-wrap {
  overflow-x: auto;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.admin-table thead tr {
  border-bottom: 1px solid var(--line2);
}
.admin-table th {
  font-family: var(--serif);
  font-size: 12.5px; letter-spacing: .08em;
  color: var(--ink);
  text-transform: none;
  padding: 13px 16px;
  text-align: left;
  font-weight: 500;
  background: var(--bg-warm);
  white-space: nowrap;
}
.admin-table th:first-child { border-radius: 0; }
.admin-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--ink2);
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: var(--bg-tint); }
.admin-td-mono {
  font-family: var(--mono); font-size: 12.5px;
}
.admin-td-primary {
  font-weight: 500; color: var(--ink);
}
.admin-td-muted {
  color: var(--faint); font-size: 13px;
}
.admin-td-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--faint);
  font-size: 13px;
}
.admin-td-actions {
  white-space: nowrap;
}

/* ── Badges ── */
.admin-badge {
  display: inline-flex; align-items: center;
  font-family: var(--sans);
  font-size: 11.5px; letter-spacing: .06em;
  border-radius: var(--radius);
  padding: 3px 9px;
  font-weight: 500;
  white-space: nowrap;
}
.admin-badge--green {
  color: var(--ok);
  background: rgba(58,140,92,.08);
  border: 1px solid rgba(58,140,92,.22);
}
.admin-badge--red {
  color: var(--err);
  background: rgba(184,76,58,.07);
  border: 1px solid rgba(184,76,58,.22);
}
/* 品牌色徽章(必填 / 管理員)*/
.admin-badge--brand {
  color: var(--red);
  background: rgba(182,38,45,.06);
  border: 1px solid rgba(182,38,45,.2);
}
.admin-badge--role {
  color: var(--muted);
  background: var(--bg-warm);
  border: 1px solid var(--line2);
}

/* ── Action buttons (in table rows) ── */
.admin-action-btn {
  display: inline-flex; align-items: center;
  font-family: var(--sans); font-size: 12px; font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  padding: 5px 12px;
  text-decoration: none;
  cursor: pointer;
  transition: .15s;
  margin-right: 6px;
}
.admin-action-btn:hover {
  color: var(--red);
  border-color: rgba(182,38,45,.4);
  background: rgba(182,38,45,.05);
}
.admin-action-btn--danger:hover {
  color: var(--err);
  border-color: rgba(184,76,58,.35);
  background: rgba(184,76,58,.05);
}
.admin-action-btn--enable {
  color: var(--ok);
  border-color: rgba(47,114,73,.28);
  background: rgba(47,114,73,.04);
}
.admin-action-btn--enable:hover {
  color: var(--ok);
  border-color: rgba(47,114,73,.55);
  background: rgba(47,114,73,.09);
}

/* ── Add/back buttons (page header) ── */
.admin-btn-add {
  display: inline-flex; align-items: center;
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: #fff;
  background: var(--red);
  border: none; border-radius: var(--radius);
  padding: 10px 20px;
  text-decoration: none;
  transition: .2s;
}
.admin-btn-add:hover { background: var(--red2); }
.admin-btn-back {
  display: inline-flex; align-items: center;
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  padding: 10px 18px;
  text-decoration: none;
  transition: .2s;
  white-space: nowrap;
}
.admin-btn-back:hover {
  color: var(--ink); border-color: var(--accent);
}

/* ── Admin form ── */
.admin-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0 24px;
}
.admin-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237a7568' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}

.admin-checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}
.admin-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.admin-checkbox input {
  width: 15px;
  height: 15px;
  cursor: pointer;
}
.admin-label-hint {
  font-weight: 400;
  color: var(--faint);
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: none;
}

/* ── Checkbox row ── */
.admin-checks-row {
  display: flex; flex-wrap: wrap; gap: 20px;
  margin: 6px 0 28px;
}
.admin-check-label {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
  user-select: none;
}
.admin-check-label input[type="checkbox"] {
  width: 17px; height: 17px;
  accent-color: var(--accent);
  cursor: pointer;
  border-radius: var(--radius);
}
.admin-check-text {
  font-size: 14px; color: var(--ink2);
}

/* ── Form save/cancel buttons ── */
.admin-form-actions {
  display: flex; align-items: center; gap: 12px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line2);
}
.admin-btn-save {
  font-family: var(--sans); font-weight: 600;
  font-size: 14px;
  color: #fff;
  background: var(--accent);
  border: none; border-radius: var(--radius);
  padding: 12px 28px;
  cursor: pointer;
  letter-spacing: .04em;
  transition: .2s;
}
.admin-btn-save:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}
.admin-btn-cancel {
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  padding: 12px 22px;
  text-decoration: none;
  transition: .2s;
}
.admin-btn-cancel:hover {
  color: var(--ink); border-color: var(--accent);
}

/* ── Workflow checkbox list ── */
.admin-wf-check-section {
  margin-bottom: 28px;
}
.admin-wf-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.admin-wf-check-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  transition: .2s;
  user-select: none;
}
.admin-wf-check-item:hover {
  border-color: rgba(134,106,66,.3);
  background: var(--accent-bg);
}
.admin-wf-check-item.checked {
  border-color: rgba(134,106,66,.35);
  background: var(--accent-bg);
}
.admin-wf-check-item input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.admin-wf-check-name {
  font-size: 13px; font-weight: 500;
  color: var(--ink2); flex: 1;
}

/* ── 3-way override control ── */
.admin-overrides-section {
  margin-bottom: 28px;
  padding: 20px;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  background: var(--bg);
}
.admin-overrides-title {
  font-family: var(--mono);
  font-size: 10.5px; letter-spacing: .22em;
  color: var(--accent); text-transform: uppercase;
  margin-bottom: 8px;
}
.admin-overrides-hint {
  font-size: 12.5px; color: var(--faint); line-height: 1.6;
  margin-bottom: 16px;
}
.admin-overrides-grid {
  display: flex; flex-direction: column; gap: 8px;
}
.admin-override-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  background: #fff;
  flex-wrap: wrap;
}
.admin-override-name {
  font-size: 13px; font-weight: 500;
  color: var(--ink); flex: 1;
  min-width: 120px;
}
.admin-override-radios {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.admin-radio-label {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--muted);
  transition: .15s;
  user-select: none;
  background: var(--bg);
}
.admin-radio-label:hover {
  border-color: rgba(134,106,66,.3);
  color: var(--ink);
}
.admin-radio-label input[type="radio"] {
  accent-color: var(--accent);
}
.admin-radio-label:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--ink);
}

/* ── Schema display (workflow form) ── */
.admin-schema-section {
  margin-bottom: 28px;
  padding: 20px;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  background: var(--bg);
}
.admin-schema-grid {
  display: flex; flex-direction: column; gap: 6px;
  margin-top: 12px;
}
.admin-schema-row {
  display: grid;
  grid-template-columns: 180px 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  background: #fff;
  font-size: 13px;
}
.admin-schema-var {
  font-family: var(--mono); font-size: 12px;
  color: var(--accent);
}
.admin-schema-label {
  color: var(--ink); font-weight: 500;
}

/* ── Responsive admin ── */
@media (max-width: 700px) {
  .admin-override-row { flex-direction: column; align-items: flex-start; }
  .admin-schema-row { grid-template-columns: 1fr 1fr; }
  .admin-schema-var { grid-column: 1 / -1; }
  .admin-stat-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-subnav { gap: 2px; }
  .admin-list-header { flex-direction: column; align-items: flex-start; }
}

/* 執行中提示:任務在伺服器跑,關頁不中斷 */
.run-detach-hint {
  margin-bottom: 12px; padding: 10px 14px;
  font-family: var(--sans); font-size: 12.5px; line-height: 1.7;
  color: var(--muted);
  border: 1px solid var(--line2); border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-bg);
}
.run-detach-hint[hidden] { display: none; }
#run-multi-hint { display: block; margin-top: 4px; font-weight: 600; }
#run-multi-hint[hidden] { display: none; }

.run-live-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 10px;
  margin-bottom: 12px; padding: 11px 14px;
  font-family: var(--sans); font-size: 12.5px;
  color: var(--ink2);
  border: 1px solid rgba(134,106,66,.24);
  border-radius: var(--radius);
  background: #fffdf8;
}
.run-live-status[hidden] { display: none; }
.run-live-pulse {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgba(134,106,66,.35);
  animation: live-status-pulse 1.8s ease-out infinite;
}
.run-live-message { min-width: 0; line-height: 1.5; }
.run-live-elapsed {
  font-family: var(--mono); font-size: 10.5px;
  color: var(--muted); white-space: nowrap;
}
@keyframes live-status-pulse {
  0% { box-shadow: 0 0 0 0 rgba(134,106,66,.35); }
  70%, 100% { box-shadow: 0 0 0 7px rgba(134,106,66,0); }
}
@media (max-width: 560px) {
  .run-live-status { grid-template-columns: auto minmax(0, 1fr); }
  .run-live-elapsed { grid-column: 2; }
}

/* 执行进度占位(执行前 / 启动中) */
.run-placeholder {
  display: flex; align-items: center; justify-content: center;
  min-height: 120px; padding: 24px 18px;
  font-family: var(--sans); font-size: 13.5px; color: var(--muted);
  text-align: center; line-height: 1.7;
  border: 1px dashed var(--line2); border-radius: var(--radius);
  background: var(--accent-bg);
}


/* ══════════ Run result — full-width output, paper document view ══════════ */
.output-panel {
  margin-top: 26px;
  opacity: 0;
}
.output-panel.show { animation: rise .5s forwards; }

/* Download / result rows */
.dl-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }

/* Text-only result (add / list / config) — a warm note card, not a terminal */
.dl-preview {
  white-space: pre-wrap; word-break: break-word;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.85;
  color: var(--ink2);
  background: var(--accent-bg);
  border: 1px solid var(--line2);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  margin: 14px 20px 18px;
  padding: 18px 22px;
  max-height: 420px; overflow: auto;
}

/* Inline Word document — rendered like a sheet of paper, full width */
.doc-view {
  background: #fffdf8;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  margin: 18px 20px 22px;
  padding: 44px clamp(32px, 6vw, 72px);
  line-height: 1.9;
  color: var(--ink);
  font-family: var(--serif);
  max-height: 78vh; overflow: auto;
}
.doc-view h1 {
  font-family: var(--serif); font-weight: 900;
  font-size: clamp(20px, 2.4vw, 27px); letter-spacing: -.01em;
  color: var(--ink); margin: 0 0 6px; line-height: 1.25;
}
.doc-view h1:first-child { text-align: center; margin-bottom: 20px; }
.doc-view h2, .doc-view h3 {
  font-family: var(--sans); font-weight: 700;
  font-size: 15.5px; color: var(--accent);
  margin: 26px 0 8px; padding-bottom: 5px;
  border-bottom: 1px solid var(--line2);
}
.doc-view p { margin: 8px 0; font-size: 15px; }
.doc-view strong { color: var(--ink); font-weight: 700; }
.doc-view ul, .doc-view ol { margin: 8px 0 8px 22px; }
.doc-view li { margin: 5px 0; }
.doc-view a { color: var(--accent); word-break: break-all; }
.doc-view table { border-collapse: collapse; margin: 14px 0; width: 100%; font-family: var(--sans); font-size: 13.5px; }
.doc-view td, .doc-view th { border: 1px solid var(--line2); padding: 8px 14px; text-align: left; }
.doc-view th { background: var(--accent-bg); color: var(--accent); font-weight: 700; }
.doc-view::-webkit-scrollbar { width: 10px; }
.doc-view::-webkit-scrollbar-thumb { background: var(--line2); border-radius: var(--radius); }

@media (max-width: 720px) {
  .doc-view { padding: 28px 20px; margin: 14px 4px 18px; }
  .dl-preview { margin: 12px 4px; }
}

/* Historical reports — expandable cards */
.hist-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.hist-card {
  border: 1px solid var(--line2); border-radius: var(--radius); background: #fff;
  overflow: hidden; transition: box-shadow .18s ease, border-color .18s ease;
}
.hist-card-expandable:hover {
  border-color: var(--accent);
}
.hist-card.open { border-color: var(--accent); }
.hist-card-active { border-color: rgba(166, 119, 49, .38); background: var(--accent-bg); }
.hist-card-failed { border-color: rgba(184,76,58,.28); background: rgba(184,76,58,.035); }
.hist-task-error {
  border-top: 1px solid rgba(184,76,58,.18);
  padding: 14px 18px 16px 52px;
  background: rgba(184,76,58,.025);
}
.hist-task-error-title {
  margin-bottom: 6px;
  color: var(--err);
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 700;
}
.hist-task-error-detail {
  color: rgba(145,55,42,.92);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.hist-error-toggle {
  color: var(--err);
  background: rgba(184,76,58,.06);
  border: 1px solid rgba(184,76,58,.24);
  border-radius: var(--radius);
  padding: 5px 13px;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.hist-error-toggle:hover { background: rgba(184,76,58,.12); }
.hist-card-head {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 18px;
}
.hist-card-expandable .hist-card-head { cursor: pointer; }
.hist-card-icon { font-size: 20px; line-height: 1; flex-shrink: 0; }
.hist-card-meta { flex: 1 1 auto; min-width: 0; }
.hist-card-name {
  font-family: var(--serif); font-weight: 700; font-size: 15px;
  color: var(--ink); word-break: break-all;
}
.hist-card-sub {
  font-family: var(--mono); font-size: 11px; color: var(--faint);
  margin-top: 3px; letter-spacing: .04em;
}
.hist-card-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.hist-status {
  font-family: var(--sans); font-size: 12.5px; font-weight: 600; color: var(--accent-dark);
  border: 1px solid rgba(166, 119, 49, .28); border-radius: var(--radius);
  background: #fff; padding: 5px 13px; white-space: nowrap;
}
.hist-card-spinner {
  width: 18px; height: 18px; border: 2px solid rgba(166, 119, 49, .25);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite;
}
.hist-toggle {
  font-family: var(--sans); font-size: 12.5px; font-weight: 600; color: var(--accent);
  background: var(--accent-bg); border: 1px solid var(--line2); border-radius: var(--radius);
  padding: 5px 13px; white-space: nowrap; user-select: none;
}
.hist-del {
  font-family: var(--sans); font-size: 12.5px; font-weight: 600; color: var(--err);
  background: rgba(184,76,58,.06); border: 1px solid rgba(184,76,58,.25); border-radius: var(--radius);
  padding: 5px 13px; white-space: nowrap; cursor: pointer; transition: all .15s ease;
}
.hist-del:hover { background: rgba(184,76,58,.12); border-color: var(--err); }
/* The inline document panel reuses .doc-view typography but sits flush in the card */
.hist-card-body.doc-view {
  margin: 0; border: none; border-top: 1px solid var(--line2);
  border-radius: 0; max-height: 72vh;
  padding: 40px clamp(28px, 5vw, 60px);
}
@media (max-width: 720px) {
  .hist-card-head { flex-wrap: wrap; }
  .hist-card-actions { width: 100%; justify-content: flex-end; }
  .hist-task-error { padding-left: 18px; }
}

/* Spreadsheet (.xlsx) inline view — reuses the .doc-view panel but drops the
   paper padding and lets a wide table scroll in both directions. */
.doc-view.is-sheet {
  padding: 0;
  font-family: var(--sans);
  background: #fff;
  max-height: 78vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
/* display:flex above would otherwise beat the [hidden] attribute's UA
   display:none, so a collapsed sheet card couldn't hide — force it. */
.doc-view.is-sheet[hidden] { display: none !important; }
.hist-card-body.doc-view.is-sheet { max-height: 72vh; }
.xlsx-wrap { display: flex; flex-direction: column; min-height: 0; }
.xlsx-tabs {
  display: flex; gap: 4px; flex-wrap: wrap; flex-shrink: 0;
  padding: 10px 12px 0; border-bottom: 1px solid var(--line2);
}
.xlsx-tab {
  font-family: var(--sans); font-size: 12.5px; color: var(--muted);
  background: transparent; border: 1px solid var(--line2); border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0; padding: 6px 14px; cursor: pointer;
  transition: color .15s, background .15s;
}
.xlsx-tab:hover { color: var(--accent); }
.xlsx-tab.active { color: var(--accent); background: var(--accent-bg); font-weight: 700; }
.xlsx-scroll { overflow: auto; min-height: 0; }
.xlsx-scroll table {
  border-collapse: collapse; font-family: var(--sans); font-size: 13px;
  width: max-content; min-width: 100%;
}
.xlsx-scroll td, .xlsx-scroll th {
  border: 1px solid var(--line2); padding: 6px 12px;
  color: var(--ink); text-align: left; white-space: nowrap;
  max-width: 320px; overflow: hidden; text-overflow: ellipsis;
}
.xlsx-scroll tr:first-child td {
  background: var(--accent-bg); color: var(--accent); font-weight: 700;
  position: sticky; top: 0; z-index: 1;
}
.xlsx-scroll::-webkit-scrollbar { height: 11px; width: 11px; }
.xlsx-scroll::-webkit-scrollbar-thumb { background: var(--line2); border-radius: var(--radius); }
.xlsx-scroll::-webkit-scrollbar-track { background: transparent; }

/* Small inline spinner for buttons mid-request — ring is white-ish on a
   半透明轨道,压在 .run-execute-btn 的 accent 实心底上仍可见。*/
.btn-spin {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: middle;
  animation: btnspin .7s linear infinite;
}
@keyframes btnspin { to { transform: rotate(360deg); } }
/* Gold spinner variant for light-background buttons + the checking panel */
.btn-spin-accent { border-color: var(--accent-soft); border-top-color: var(--accent); }
/* ── Styled confirm modal (replaces window.confirm) ──────────────────────────
   結構:頂緣一道印章紅 → 紅印方塊「！」+ 等寬 eyebrow + 明朝體標題
        → 對象名(等寬 chip,長郵箱自動斷行)→ 後果說明 → 細則
        → 右下「取消 / 確定刪除」。
   危險鍵是唯一的紅色實心塊,取消是描邊的 —— 視線先落在紅字上,手卻落在取消上。 */
.confirm-overlay {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(25,23,20,.46);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .14s ease;
  z-index: 1000;
  padding: 24px;
}
.confirm-overlay.show { opacity: 1; }
.confirm-box {
  position: relative;
  width: 100%; max-width: 452px;
  background: #FCFAF7;
  border: 1px solid var(--line2);
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 64px -18px rgba(28,26,22,.42);
  overflow: hidden;
  transform: translateY(10px) scale(.985);
  transition: transform .2s cubic-bezier(.2,.8,.3,1);
}
.confirm-overlay.show .confirm-box { transform: none; }
/* 頂緣細線:危險=印章紅,一般=香檳色 */
.confirm-box::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--champ);
}
.confirm-box--danger::before { background: var(--red); }

.confirm-head { display: flex; gap: 14px; padding: 26px 26px 0; }
.confirm-seal {
  width: 30px; height: 30px; flex: none;
  background: var(--accent); color: #fff;
  border-radius: var(--radius);
  display: grid; place-items: center;
  font-family: var(--serif); font-size: 16px; font-weight: 700; line-height: 1;
}
.confirm-box--danger .confirm-seal { background: var(--red); }
.confirm-headtext { min-width: 0; padding-top: 1px; }
.confirm-eyebrow {
  font-family: var(--mono);
  font-size: 9.5px; letter-spacing: .24em;
  color: var(--faint);
  margin-bottom: 6px;
}
.confirm-title {
  font-family: var(--serif); font-weight: 700;
  font-size: 18.5px; line-height: 1.4;
  color: var(--ink);
}
/* 正文左緣對齊標題(26 padding + 30 印章 + 14 gap) */
.confirm-body { padding: 15px 26px 0 70px; }
.confirm-name {
  display: inline-block; max-width: 100%;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.5;
  color: var(--accent-dark);
  background: var(--accent-bg);
  border: 1px solid var(--accent-soft);
  border-radius: var(--radius);
  padding: 5px 11px;
  word-break: break-all;
}
.confirm-name + .confirm-text { margin-top: 13px; }
.confirm-text {
  font-family: var(--sans); font-size: 13.5px; line-height: 1.75;
  color: var(--ink2);
}
.confirm-note {
  margin-top: 12px; padding-top: 11px;
  border-top: 1px solid var(--line);
  font-family: var(--sans); font-size: 11.5px; line-height: 1.7;
  color: var(--faint);
}
.confirm-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 24px 26px 24px;
}
.confirm-btn {
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  letter-spacing: .04em;
  border: 1px solid transparent; border-radius: var(--radius);
  padding: 9px 20px;
  cursor: pointer;
  transition: all .15s ease;
}
.confirm-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.confirm-cancel {
  background: #fff;
  border-color: var(--line2);
  color: var(--muted);
}
.confirm-cancel:hover { color: var(--ink); border-color: var(--accent); }
.confirm-ok {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}
.confirm-ok:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.confirm-danger {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}
.confirm-danger:hover { background: var(--red2); border-color: var(--red2); }
.confirm-danger:focus-visible { outline-color: var(--red2); }

@media (max-width: 520px) {
  .confirm-head { padding: 22px 20px 0; }
  .confirm-body { padding: 14px 20px 0 20px; }
  .confirm-actions { padding: 20px; }
  .confirm-actions .confirm-btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .confirm-overlay, .confirm-box { transition: none; }
  .confirm-box { transform: none; }
}

/* ══════ BIPPO 版式骨架 ══════ */

/* ── Hero ── */
.hero {
  position: relative;
  overflow: hidden;
  background:
    repeating-linear-gradient(90deg, transparent 0 7px, rgba(255,255,255,.045) 7px 8px),
    linear-gradient(135deg, #5b4931 0%, #665238 55%, #735d41 100%);
  text-align: center;
}
/* 天际线剔影(自绘,非参考站素材) */
.hero::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 46%;
  pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 300' preserveAspectRatio='none'%3E%3Cpath d='M0 300V180h40v-60h30v60h40v90h60V150h34v-40h30v40h34v150h70V120h28V80h26v40h28v180h80V210h56v90h74V140h30v-50h26v50h30v210h86V190h60v110h70V100h24V60h24v40h24v200h96V170h50v130h80V120h30V70h28v50h30v180h120V210h60v90h40' fill='none' stroke='%23ffffff' stroke-width='1.2' opacity='.45'/%3E%3C/svg%3E") bottom center / 100% 100% no-repeat;
}
.hero-inner {
  position: relative; z-index: 1;
  max-width: 820px; margin: 0 auto; padding-left: 24px; padding-right: 24px;
}
.hero--tall  { padding: 100px 0 80px; }
.hero--short { padding: 56px 0 48px; }
.hero-eyebrow {
  font-family: var(--caslon);
  font-size: 12px; letter-spacing: .34em;
  color: rgba(255,255,255,.92);
  text-transform: uppercase;
  margin-bottom: 16px;
}
.hero-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(26px, 4.4vw, 42px);
  letter-spacing: .08em;
  line-height: 1.3;
  color: #fff;
  margin: 0;
}
.hero-title:empty { display: none; }
.hero-sub {
  font-size: 14px;
  color: rgba(255,255,255,.92);
  letter-spacing: .06em;
  margin: 14px 0 0;
}
.hero-sub:empty { display: none; }

/* ── 分区容器 ── */
.sec { background: var(--bg); padding: 100px 0; }
.sec.alt { background: var(--bg-warm); }
.sec--tight { padding: 60px 0; }   /* 数据密集页(kb / admin) */
.sec-inner {
  max-width: 1180px; margin: 0 auto; padding: 0 24px;
}
.sec-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(22px, 3vw, 28px);
  letter-spacing: .1em;
  color: var(--red);
  text-align: center;
  margin: 0 0 14px;
}
.sec-sub {
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  max-width: 640px;
  margin: 0 auto 44px;
  line-height: 1.9;
}

/* ── 炭黑页脚 ── */
.site-footer {
  background: var(--footer);
  color: rgba(255,255,255,.7);
  margin-top: auto;   /* 見 body 的 flex 直排:短頁面時把頁腳頂到視窗底 */
}
.footer-inner {
  max-width: 1180px; margin: 0 auto;
  padding: 60px 24px 40px;
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
}
.footer-brand .brand-name { color: #fff; }
.footer-brand .brand-sub  { color: rgba(255,255,255,.5); }
.footer-title {
  font-family: var(--serif);
  font-size: 14px; letter-spacing: .14em;
  color: var(--champ);
  margin-bottom: 16px;
}
.footer-col a {
  display: block;
  font-size: 13px;
  color: rgba(255,255,255,.7);
  text-decoration: none;
  padding: 5px 0;
  transition: .2s;
}
.footer-col a:hover { color: var(--champ); }
.footer-note { font-size: 13px; color: rgba(255,255,255,.7); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.1);
  padding: 20px 24px;
  text-align: center;
  font-family: var(--caslon);
  font-size: 11px; letter-spacing: .18em;
  color: rgba(255,255,255,.55);
}

/* ── 骨架响应式 ── */
@media (max-width: 860px) {
  .footer-inner { grid-template-columns: 1fr; gap: 28px; }
  .sec { padding: 56px 0; }
  .sec--tight { padding: 40px 0; }
  .hero--tall { padding: 64px 0 52px; }
  .topbar-inner { height: 64px; padding: 0 16px; }
  .sec-inner { padding: 0 16px; }
  .nav-user { display: none; }
  /* 窄屏頂欄放不下三個動作。「修改密碼」在頁腳「帳戶」欄裡還有一個入口,
     所以這裡收起它,保留最高頻的「管理後台 / 登出」。不收的話 登出 會被切掉
     (實測橫向溢出 33px)。 */
  .nav-right .btn-ghost[href="/password"] { display: none; }
  /* 品牌名在窄屏會被擠成三行。副標本來就是裝飾,窄屏直接不顯示。 */
  .brand-sub { display: none; }
  .brand-name { white-space: nowrap; }
}

/* ── 修改密碼頁 ── */
/* .sec-inner--narrow 曾因無人使用被當死代碼刪掉;改密頁是它的正當消費者,
   窄欄表單本來就不該撐到 1180px。 */
.sec-inner--narrow { max-width: 560px; }
.pw-notice {
  background: var(--bg-warm);
  border-left: 3px solid var(--red);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink2);
  margin-bottom: 26px;
}
.pw-form { margin-top: 4px; }
.pw-form .btn-primary { margin-top: 10px; }

/* 後台子導航右端的常駐返回鍵。原先只有總覽頁正文裡有一個返回連結,其餘 5 個
   後台頁完全沒有 —— 只剩頂欄那個不像按鈕的 logo 和頁腳深處一條連結,
   進了後台就出不來。放進 admin/base.html 的子導航,9 個後台頁一次全覆蓋。 */
.admin-subnav-back {
  /* 跟 .admin-subnav-item 同一族:同字號/字重/字距/內距、無邊框無圓角。
     先前做成帶邊框的圓角方塊,擺在一排無邊框下劃線 tab 中間,像硬貼上去的。 */
  margin-left: auto;
  display: flex; align-items: center; gap: 6px;
  padding: 11px 18px;
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  color: var(--faint);
  text-decoration: none;
  transition: .2s;
  letter-spacing: .04em;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.admin-subnav-back:hover { color: var(--red); }
/* 控制台入口和「返回工作流」一起靠右：第二個不再 auto，緊挨著第一個。 */
.admin-subnav-back--next { margin-left: 0; }

/* ══════ 2026-08 mobile usability + interaction polish ══════ */

/* Account actions stay inline on desktop and collapse into one predictable
   menu on narrow screens. This keeps all actions available instead of hiding
   "change password" just because the header ran out of room. */
.nav-account-menu {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-menu-toggle { display: none; }

/* Shared keyboard focus: icon-only and custom controls previously relied on
   hover styling, which disappears for keyboard and touch users. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Shared transient feedback for AJAX actions across KB list/workspace. */
.ui-toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 1200;
  width: max-content;
  max-width: min(520px, calc(100vw - 32px));
  transform: translate(-50%, 12px);
  opacity: 0;
  padding: 10px 16px;
  border: 1px solid var(--line2);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 12px 34px rgba(30,24,18,.2);
  color: var(--ink2);
  font-size: 13px;
  line-height: 1.55;
  transition: opacity .18s ease, transform .18s ease;
}
.ui-toast.show { opacity: 1; transform: translate(-50%, 0); }
.ui-toast.ok { border-color: rgba(47,114,73,.32); background: #eff6f2; color: var(--ok); }
.ui-toast.err { border-color: rgba(184,76,58,.32); background: #fbf1ef; color: var(--err); }

.admin-table-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.admin-table-search {
  width: min(320px, 100%);
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  background: var(--bg-warm);
  color: var(--ink2);
  font: 13px var(--sans);
}
.admin-table-search:focus { background: #fff; border-color: var(--accent); }
.admin-table-filters { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line2); border-radius: var(--radius); background: var(--bg-warm); }
.admin-table-filter { min-height: 32px; padding: 5px 11px; border: 0; border-radius: var(--radius); background: transparent; color: var(--muted); font: 12px var(--sans); cursor: pointer; }
.admin-table-filter.active { background: #fff; color: var(--red); box-shadow: 0 1px 4px rgba(40,30,20,.08); }
.admin-table-count { margin-left: auto; white-space: nowrap; color: var(--faint); font: 10.5px var(--mono); }
.admin-table-pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }
.admin-table-pager[hidden] { display: none; }
.admin-page-btn { min-height: 36px; padding: 6px 12px; border: 1px solid var(--line2); border-radius: var(--radius); background: #fff; color: var(--muted); font: 12px var(--sans); cursor: pointer; }
.admin-page-btn:disabled { opacity: 1; color: var(--faint); background: var(--bg-warm); cursor: default; }
.admin-page-info { min-width: 50px; text-align: center; color: var(--faint); font: 11px var(--mono); }
.admin-table tr.is-filtered-out { display: none !important; }

.admin-usage-date-filter {
  display: flex;
  align-items: end;
  gap: 12px;
  margin: 18px 0 22px;
  padding: 16px;
  border: 1px solid var(--line2);
  border-radius: var(--radius-lg);
  background: var(--bg-warm);
}
.admin-usage-date-copy { display: grid; gap: 2px; margin-right: auto; }
.admin-usage-date-copy strong { color: var(--ink); font-size: 14px; }
.admin-usage-date-copy span { color: var(--muted); font-size: 12px; }
.admin-usage-date-filter label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.admin-usage-date-filter input {
  min-height: 36px;
  padding: 6px 9px;
  border: 1px solid var(--line2);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink2);
  font: 13px var(--sans);
}
.admin-usage-panel > .admin-usage-date-filter {
  margin: 0;
  border-width: 0 0 1px;
  border-radius: 0;
}
.admin-usage-detail-panel { margin-top: 18px; }
.admin-usage-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.admin-usage-detail-grid > div { min-width: 0; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.admin-usage-detail-grid > div:nth-child(odd):not(.admin-usage-detail-wide) { border-right: 1px solid var(--line); }
.admin-usage-detail-grid dt { margin-bottom: 5px; color: var(--faint); font: 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; }
.admin-usage-detail-grid dd { overflow-wrap: anywhere; color: var(--ink); font-size: 14px; }
.admin-usage-detail-wide { grid-column: 1 / -1; }
@media (max-width: 760px) {
  .admin-usage-date-filter { align-items: stretch; flex-direction: column; }
  .admin-usage-date-copy { margin-right: 0; }
  .admin-usage-detail-grid { grid-template-columns: 1fr; }
  .admin-usage-detail-grid > div:nth-child(odd):not(.admin-usage-detail-wide) { border-right: 0; }
}

.is-submitting { cursor: wait !important; }
.is-submitting::after {
  content: "";
  display: inline-block;
  flex: 0 0 auto;
  width: 13px;
  height: 13px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

/* Mobile admin tables are readable cards. The operation row is always visible,
   so destructive/permission controls never sit outside the viewport. */
@media (max-width: 700px) {
  .admin-table-tools { align-items: stretch; flex-wrap: wrap; padding: 12px 14px; }
  .admin-table-search { width: 100%; }
  .admin-table-count { margin-left: 0; align-self: center; }
  .admin-table-pager { justify-content: space-between; }
  .admin-table-wrap { overflow: visible; }
  .admin-table,
  .admin-table tbody { display: block; width: 100%; }
  .admin-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .admin-table tbody tr {
    display: block;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line2);
    background: #fff;
  }
  .admin-table tbody tr:last-child { border-bottom: 0; }
  .admin-table tbody tr:hover td { background: transparent; }
  .admin-table td {
    display: grid;
    grid-template-columns: minmax(78px, 30%) 1fr;
    gap: 12px;
    align-items: start;
    padding: 7px 0;
    border: 0;
    min-width: 0;
  }
  .admin-table td::before {
    content: attr(data-label);
    font-family: var(--serif);
    font-size: 12px;
    letter-spacing: .06em;
    color: var(--faint);
    font-weight: 500;
  }
  .admin-table td.admin-td-empty {
    display: block;
    padding: 30px 12px;
    text-align: center;
  }
  .admin-table td.admin-td-empty::before { content: none; }
  .admin-td-actions {
    margin-top: 5px;
    padding-top: 12px !important;
    border-top: 1px solid var(--line) !important;
    white-space: normal;
  }
  .admin-td-actions > :not(:last-child) { margin-bottom: 6px; }
  .admin-action-btn {
    min-height: 40px;
    justify-content: center;
    padding: 8px 13px;
    margin-right: 5px;
  }
  .admin-td-actions form { display: inline-block !important; }
}

@media (max-width: 860px) {
  .nav-right { position: relative; }
  .nav-user { display: none; }
  .nav-menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    max-width: 150px;
    padding: 7px 12px;
    border: 1px solid var(--line2);
    border-radius: var(--radius);
    background: #fff;
    color: var(--ink2);
    font-family: var(--sans);
    font-size: 13px;
    cursor: pointer;
  }
  .nav-menu-toggle span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .nav-account-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    z-index: 70;
    display: grid;
    width: min(220px, calc(100vw - 32px));
    gap: 5px;
    padding: 7px;
    border: 1px solid var(--line2);
    border-radius: 8px;
    background: rgba(255,255,255,.98);
    box-shadow: 0 16px 38px rgba(30,24,18,.18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-5px);
    transition: opacity .15s ease, transform .15s ease, visibility .15s;
  }
  .nav-right.is-open .nav-account-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
  }
  .nav-account-menu .btn-admin,
  .nav-account-menu .btn-ghost {
    display: flex !important;
    width: 100%;
    min-height: 42px;
    align-items: center;
    justify-content: flex-start;
    padding: 9px 12px;
    border: 0;
    background: transparent;
    color: var(--ink2);
    text-decoration: none;
  }
  .nav-account-menu .btn-admin:hover,
  .nav-account-menu .btn-ghost:hover { background: var(--accent-bg); color: var(--red); }

  .hero--tall { padding: 44px 0 38px; }
  .hero--short { padding: 34px 0 30px; }
  .hero-eyebrow { margin-bottom: 10px; font-size: 10.5px; }
  .hero-sub { margin-top: 9px; line-height: 1.65; }

  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 22px 28px;
    padding: 34px 24px 26px;
  }
  .footer-inner .footer-col:first-child { grid-column: 1 / -1; }
  .footer-title { margin-bottom: 8px; }
  .footer-bottom { padding: 14px 18px; }
}

@media (max-width: 480px) {
  .brand { gap: 9px; }
  .brand-name { font-size: 14px; letter-spacing: .08em; }
  .seal { width: 34px; height: 34px; }
  .nav-menu-toggle { max-width: 128px; }
  .footer-inner { padding: 28px 24px 22px; gap: 18px 24px; }
  .footer-brand { margin-bottom: 2px; }
  .footer-col a { padding: 3px 0; }
  .footer-bottom { font-size: 9.5px; letter-spacing: .12em; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

.admin-audit-value { overflow-wrap: anywhere; min-width: 120px; }
.admin-audit-long summary { cursor: pointer; }
.admin-audit-pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }
.admin-account-fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.admin-account-note { margin-bottom: 24px; padding: 12px 16px; border: 1px solid #e5e0d8; background: #faf8f4; font-size: 14px; }
