/* ============================================
   常发集团 · 内部导航 — 浅色简洁企业风
   ============================================ */

:root {
  --bg:       #f3f5f6;
  --bg-card:  #ffffff;
  --bg-hover: #f5f8f9;
  --ink:      #17212b;
  --muted:    #6b7280;
  --dim:      #9ca3af;
  --rule:     #e1e6ea;
  --accent:   #36566b;
  --accent-light: rgba(54, 86, 107, 0.09);
  --accent-glow: rgba(54, 86, 107, 0.16);
  --danger:   #dc2626;
  --danger-light: rgba(220, 38, 38, 0.06);
  --warn:     #d97706;
  --warn-light: rgba(217, 119, 6, 0.06);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow:    0 4px 16px rgba(0,0,0,0.07);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.10);
  --radius:    12px;
  --radius-sm: 8px;
  --card-height: 140px;
  --font:      "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans CJK SC", sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Code", "Consolas", monospace;
  --transition: 0.2s ease;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); overflow-wrap: normal; word-break: normal; }
a:hover { color: #294657; }

img { max-width: 100%; display: block; }

/* ---- layout ---- */
.site-shell {
  width: min(1160px, calc(100% - 40px));
  margin: 0 auto;
  position: relative;
}

/* ---- progress ---- */
.progress {
  position: fixed; top: 0; left: 0; z-index: 100;
  height: 2px; width: 0;
  background: linear-gradient(90deg, #2563eb, #0891b2);
}

/* ---- topbar ---- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 800; font-size: 15px;
  border-radius: var(--radius-sm);
}

.nav {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
}

.nav a {
  padding: 6px 14px;
  font-size: 13px; font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.nav a:hover {
  color: var(--accent);
  background: var(--accent-light);
}

.nav-tag {
  padding: 4px 12px;
  font-size: 11px; font-weight: 600;
  color: #374151;
  background: #d1d5db;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.search-wrap {
  position: relative;
}

.search-input {
  width: 200px;
  height: 34px;
  padding: 0 12px 0 32px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid rgba(225, 230, 234, 0.72);
  border-radius: 6px;
  outline: none;
  transition: all var(--transition);
}

.search-input::placeholder {
  color: var(--dim);
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  width: 240px;
}

.search-wrap::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  pointer-events: none;
}

.search-wrap:has(:focus)::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2336566b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
}

/* ---- search dropdown ---- */
.search-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  min-width: 220px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  box-shadow: none;
  z-index: 200;
}

.search-dropdown-item {
  padding: 8px 14px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px solid var(--rule);
}
.search-dropdown-item:last-child { border-bottom: none; }
.search-dropdown-item:hover {
  background: var(--accent-light);
  color: var(--accent);
}

.snippet-heading {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--dim);
  margin-bottom: 2px;
  line-height: 1.3;
}

.snippet {
  display: block;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.4;
}

.search-dropdown-empty {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--dim);
  text-align: center;
}

/* ---- homepage ---- */
.home-main {
  padding: 48px 0 72px;
}

/* category section */
.cat-section {
  margin-bottom: 44px;
}

.cat-section:first-child {
  margin-top: 0;
}

.cat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.cat-icon {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.cat-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.cat-desc {
  font-size: 13px;
  color: var(--dim);
  margin-left: 4px;
}

/* card grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.nav-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: var(--card-height);
  min-height: var(--card-height);
  padding: 13px 16px;
  background: var(--bg-card);
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: all var(--transition);
  box-shadow: none;
  overflow: hidden;
}

.nav-card:hover {
  border-color: transparent;
  box-shadow: none;
  transform: none;
  background: rgb(231, 234, 237);
}

.card-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.card-body h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  margin: 8px 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-body p {
  margin-top: 5px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.card-foot {
  flex-shrink: 0;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.card-foot-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.company-badge,
.net-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  height: 20px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  border-radius: 3px;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.company-badge {
  color: #374151;
  background: #d1d5db;
}

.card-arrow {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 20px;
  font-size: 11px;
  font-weight: 600;
  color: #4b5563;
}

.chevron-icon,
.back-top-icon {
  display: block;
  flex-shrink: 0;
}

.nav-card:hover .card-arrow {
  color: var(--accent);
  transform: translateX(3px);
  transition: all var(--transition);
}

/* ---- network access badge ---- */
.net-badge {
  margin-right: 6px;
}

.net-public {
  color: #065f46;
  background: #d1fae5;
}

.net-internal {
  color: #92400e;
  background: #fef3c7;
}

/* ---- page layout (sidebar + doc) ---- */
.page-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 24px;
  padding: 32px 0 72px;
}

.side-panel {
  position: sticky;
  top: 78px;
  height: fit-content;
  padding: 18px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.side-panel h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

.toc {
  display: grid; gap: 2px;
}

.toc a {
  display: block;
  padding: 8px 10px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 6px;
  transition: all var(--transition);
}

.toc a:hover {
  color: var(--accent);
  background: var(--accent-light);
}

/* ---- doc ---- */
.doc {
  padding: clamp(24px, 4vw, 40px);
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow-wrap: break-word;
}

.doc-header {
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--rule);
}

.doc-header .eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  background: var(--accent-light);
  padding: 2px 8px;
  border-radius: 4px;
}

.doc-header h1 {
  font-size: clamp(24px, 3.8vw, 36px);
  font-weight: 800;
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.doc-header p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }

.doc h2 {
  margin-top: 36px;
  font-size: clamp(20px, 2vw, 24px);
  font-weight: 700;
  color: var(--ink);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

.doc h3 {
  margin-top: 22px;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink);
}

.doc p, .doc li {
  color: #374151;
  font-size: 14px;
}

.doc p { margin: 10px 0; }

.doc ul, .doc ol {
  padding-left: 1.4rem;
  margin: 10px 0;
  overflow-wrap: anywhere;
}

.doc li + li { margin-top: 6px; }

.doc a {
  color: var(--accent);
  text-underline-offset: 2px;
}

.doc a:hover { color: #294657; }

/* callout / rule / warning */
.callout, .rule-card, .scenario, .case-card, .warning {
  margin: 14px 0;
  padding: 16px 18px;
  background: #f9fafb;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  overflow-wrap: anywhere;
}

.callout { border-left: 3px solid var(--accent); }
.rule-card { border-left: 3px solid #6f8179; }
.rule-card h3 { margin-top: 0; font-size: 15px; }

.warning {
  border-left: 3px solid var(--danger);
  background: var(--danger-light);
}

.warning strong { color: var(--danger); }

.scenario-grid, .case-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.case-card h3 { margin-top: 0; font-size: 15px; }

/* step list */
.step-list {
  counter-reset: steps;
  display: grid; gap: 8px;
  padding: 0; list-style: none;
}

.step-list li {
  counter-increment: steps;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px; align-items: start;
  padding: 10px 12px;
  background: #f9fafb;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
}

.step-list li::before {
  content: counter(steps);
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 13px;
  border-radius: 6px;
}

/* table */
.table-wrap {
  overflow-x: auto;
  margin: 14px 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
  background: var(--bg-card);
}

th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  background: #f9fafb;
  color: var(--ink);
  font-weight: 600;
}

td { color: #374151; }

/* code */
code {
  padding: 2px 6px;
  background: var(--accent-light);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  border-radius: 4px;
}

/* footer */
.footer {
  padding: 24px 0;
  color: var(--dim);
  font-size: 13px;
  border-top: 1px solid var(--rule);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-icp {
  color: var(--dim);
  font-size: 12px;
}

.footer-icp:hover {
  color: var(--accent);
}

.footer-info {
  margin-left: auto;
}

.version {
  font-size: inherit;
  color: inherit;
  margin-left: 4px;
}

/* quick actions */
.quick-actions {
  position: fixed;
  right: 20px; bottom: 20px;
  z-index: 40;
  display: grid; gap: 8px;
}

.quick-actions a,
.quick-actions button {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  font-size: 16px;
  box-shadow: none;
  transition: all var(--transition);
}

.quick-actions a:hover,
.quick-actions button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}

/* ---- search results ---- */
.no-results {
  text-align: center;
  padding: 32px 16px;
  color: var(--dim);
  font-size: 14px;
}

.hidden-cat {
  display: none;
}

/* ---- animations ---- */
.fade-in {
  opacity: 0;
  transform: translateY(12px);
  animation: rise 0.5s ease forwards;
}

.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.10s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.20s; }

@keyframes rise {
  to { opacity: 1; transform: none; }
}

/* ---- responsive ---- */

/* ===== Tablet (≤900px) ===== */
@media (max-width: 900px) {
  .topbar-inner {
    align-items: stretch;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: flex-start;
    min-height: auto;
    padding: 10px 0;
    gap: 10px;
  }

  .brand {
    width: 100%;
    min-width: 0;
  }

  .brand span:last-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 8px;
  }

  .search-wrap {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    order: 1;
  }

  .search-input,
  .search-input:focus {
    width: 100%;
  }

  .user-wrap {
    grid-column: 1;
    width: 100%;
    min-width: 0;
    max-width: none;
    margin-left: 0;
    order: 2;
  }

  .user-info {
    max-width: 100%;
    padding: 0 8px;
    width: 100%;
    justify-content: center;
  }

  .user-name {
    max-width: none;
  }

  .logout-wrap {
    grid-column: 2;
    width: auto;
    justify-content: flex-end;
    order: 3;
  }

  .btn-login-entry,
  .btn-logout {
    width: 54px;
    margin-left: 0;
  }
  .page-layout,
  .scenario-grid,
  .case-grid { grid-template-columns: 1fr; }

  /* 侧边栏收起为紧凑折叠块 */
  .side-panel {
    position: static;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
  }

  .side-panel h2 {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    font-size: 15px;
    flex-shrink: 0;
  }

  .toc {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .toc a {
    padding: 5px 10px;
    font-size: 12px;
    background: var(--bg);
    border-radius: 4px;
  }

  /* 文档区 */
  .page-layout { gap: 14px; padding: 24px 0 56px; }
  .doc { padding: clamp(20px, 3vw, 30px); }
  .doc-header h1 { font-size: clamp(20px, 4vw, 28px); }
  .doc h2 { font-size: clamp(17px, 2vw, 20px); margin-top: 26px; }
  .doc h3 { font-size: 15px; }

  /* 表格强制横滚 */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  table { min-width: 540px; font-size: 12px; }
  th, td { padding: 8px 10px; }
}

/* ===== Phone (≤640px) ===== */
@media (max-width: 640px) {
  :root { --card-height: 140px; }

  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .site-shell {
    width: calc(100vw - 24px);
    max-width: 100%;
    margin: 0 auto;
    overflow-x: hidden;
  }

  /* 顶栏 */
  .topbar-inner {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    min-height: 50px;
    padding: 8px 0;
    gap: 8px;
  }
  .brand { font-size: 14px; }
  .brand-mark { width: 28px; height: 28px; font-size: 14px; }
  .nav {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 54px;
    align-items: stretch;
    gap: 8px;
  }

  .search-wrap {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    order: 1;
  }

  .user-wrap {
    grid-column: 1;
    width: 100%;
    min-width: 0;
    order: 2;
    max-width: none;
    margin-left: 0;
  }

  .user-info {
    display: grid;
    grid-template-columns: 16px minmax(0, 1fr) auto;
    width: 100%;
    min-width: 0;
    justify-content: center;
    padding: 0 8px;
  }

  .user-name {
    min-width: 0;
    max-width: none;
  }

  .logout-wrap {
    grid-column: 2;
    width: 54px;
    order: 3;
    justify-content: flex-end;
  }

  .btn-login-entry,
  .btn-logout {
    width: 54px;
    min-width: 54px;
    margin-left: 0;
  }

  /* 首页 */
  .home-main { padding: 22px 0 40px; }
  .card-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .cat-section { margin-bottom: 24px; }
  .cat-head { margin-bottom: 14px; }
  .cat-icon { width: 30px; height: 30px; }
  .cat-title { font-size: 16px; }
  .cat-desc { font-size: 12px; }
  .nav-card,
  .auth-locked {
    width: 100%;
    max-width: 100%;
    height: var(--card-height);
    min-height: var(--card-height);
    padding: 13px 14px;
  }
  .card-body h3 { font-size: 14px; }
  .card-body p { font-size: 12px; }
  .card-foot { margin-top: 8px; padding-top: 6px; }
  .card-arrow { font-size: 11px; }

  /* 子页面 - 侧边栏收成极窄横条 */
  .side-panel {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
  }
  .side-panel h2 { font-size: 13px; }
  .toc a {
    padding: 4px 8px;
    font-size: 11px;
  }

  /* 文档体 */
  .page-layout { padding: 18px 0 44px; gap: 10px; }
  .doc { padding: 16px 18px; border-radius: var(--radius-sm); }
  .doc-header { padding-bottom: 14px; margin-bottom: 16px; }
  .doc-header .eyebrow { font-size: 10px; padding: 1px 6px; }
  .doc-header h1 { font-size: 20px; }
  .doc-header p { font-size: 13px; }
  .doc h2 { font-size: 17px; margin-top: 20px; padding-bottom: 6px; }
  .doc h3 { font-size: 14px; margin-top: 16px; }
  .doc p, .doc li { font-size: 13px; }
  .doc ul, .doc ol { padding-left: 1.1rem; }

  /* 卡片内 case / scenario 堆叠 */
  .case-card, .rule-card { padding: 12px; }
  .case-card h3, .rule-card h3 { font-size: 13px; }
  .case-card p, .rule-card p { font-size: 12px; }
  .callout, .warning { padding: 12px; }
  .callout p, .warning p, .warning li { font-size: 13px; }

  /* 步骤列表 */
  .step-list li {
    grid-template-columns: 22px 1fr;
    gap: 6px;
    padding: 8px 8px;
    overflow-wrap: anywhere;
  }
  .step-list li::before {
    width: 22px; height: 22px;
    font-size: 11px;
  }

  /* 表格 */
  table { min-width: 420px; font-size: 11px; }
  th, td { padding: 6px 8px; }
  th { font-size: 10px; }

  /* 页脚 */
  .footer { padding: 16px 0; }
  .footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 6px;
  }
  .footer-info { margin-left: 0; }
  .footer-icp { font-size: 11px; }
  .footer-inner span { font-size: 11px; }

  /* 快捷按钮缩小 */
  .quick-actions { right: 10px; bottom: 10px; }
  .quick-actions a,
  .quick-actions button {
    width: 36px; height: 36px;
    font-size: 14px;
    border-radius: 6px;
  }

  /* 搜索栏全宽 */
  .search-input { width: 100%; }
  .search-input:focus { width: 100%; }
}

/* ===== Small phone (≤400px) ===== */
@media (max-width: 400px) {
  .site-shell {
    width: calc(100% - 16px);
    max-width: 100%;
    overflow-x: hidden;
  }

  .brand { font-size: 13px; gap: 6px; }
  .brand-mark { width: 24px; height: 24px; font-size: 12px; }
  .nav { gap: 6px; }
  .user-wrap { max-width: none; }
  .provider-badge { display: none; }
  .user-name { max-width: none; }

  /* 侧边栏 TOC 横向滚动 */
  .toc { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .toc a { white-space: nowrap; flex-shrink: 0; }

  .doc { padding: 14px; }
  .doc-header h1 { font-size: 18px; }
  .doc h2 { font-size: 16px; }
  .doc p, .doc li { font-size: 12px; }
  .doc code { font-size: 11px; padding: 1px 4px; }

  table { min-width: 360px; font-size: 10px; }
  th, td { padding: 5px 6px; }
}

/* ---- auth: locked cards ---- */
.auth-locked {
  cursor: pointer;
  position: relative;
  overflow: hidden;
  height: var(--card-height);
  min-height: var(--card-height);
  padding: 13px 16px;
  background:
    radial-gradient(circle at 18% 15%, rgba(54, 86, 107, 0.12), transparent 30%),
    linear-gradient(135deg, rgba(255,255,255,0.74), rgba(247,249,250,0.48));
  border: 1px solid transparent;
  border-radius: var(--radius);
  box-shadow: none;
}
.auth-locked:hover {
  border-color: transparent;
  box-shadow: none;
  transform: none;
  background: rgb(231, 234, 237);
}
.locked-glass-bg {
  position: absolute;
  inset: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  filter: blur(6px);
  opacity: 0.46;
  transform: scale(1.03);
  user-select: none;
  pointer-events: none;
}

.locked-line,
.locked-pill {
  display: block;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.58), rgba(203, 213, 225, 0.72));
}

.locked-line-short { width: 38%; height: 10px; }
.locked-line-long { width: 76%; height: 16px; }
.locked-line-mid { width: 62%; height: 9px; }
.locked-pill {
  width: 54px;
  height: 14px;
  margin-top: auto;
}

.auth-locked-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: rgba(255, 255, 255, 0.34);
  backdrop-filter: blur(11px) saturate(1.18);
  -webkit-backdrop-filter: blur(11px) saturate(1.18);
  z-index: 2;
  pointer-events: none;
}

.auth-locked:hover .auth-locked-overlay {
  background: rgb(231, 234, 237);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.lock-icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
  opacity: 1;
}

.locked-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.lock-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.08em;
}

.locked-company {
  position: absolute;
  left: 16px;
  top: 14px;
  z-index: 3;
}

.user-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
}

.user-wrap::after {
  content: "";
  position: absolute;
  right: 0;
  top: 100%;
  width: 100%;
  height: 12px;
}

.user-info {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  padding: 0 10px;
  background: #f3f6fb;
  border: 1px solid rgba(226, 232, 240, 0.72);
  border-radius: 6px;
  cursor: default;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.user-info:hover,
.user-info:focus {
  outline: none;
  background: #fff;
  border-color: rgba(54, 86, 107, 0.30);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.user-info-icon {
  color: var(--accent);
  flex-shrink: 0;
}

.user-name {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.provider-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(54, 86, 107, 0.16);
  border: none;
  border-radius: 5px;
}

.user-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 255;
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-4px);
  width: 300px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  box-shadow: none;
  transition:
    opacity 0.16s ease 0.25s,
    transform 0.16s ease 0.25s,
    visibility 0s linear 0.25s;
}

.user-wrap:hover .user-popover,
.user-wrap:focus-within .user-popover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition-delay: 0s;
}

.user-popover::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 22px;
  width: 10px;
  height: 10px;
  background: var(--bg-card);
  border-left: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
  transform: rotate(45deg);
}

.user-popover-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 8px;
}

.user-popover-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 8px;
  padding: 5px 0;
  font-size: 12px;
}

.user-popover-row span {
  color: var(--dim);
}

.user-popover-row strong {
  min-width: 0;
  color: #374151;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.btn-logout {
  margin-left: 6px;
  width: 54px;
  height: 34px;
  padding: 0;
  font-size: 13px;
  font-family: var(--font);
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: none;
}
.btn-logout:hover {
  color: #fff;
  background: #294657;
  box-shadow: none;
}

.logout-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.logout-menu {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 260;
  width: 340px;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--rule);
  border-radius: 14px;
  box-shadow: none;
}

.logout-menu.open {
  display: block;
}

.logout-menu::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 18px;
  width: 10px;
  height: 10px;
  background: var(--bg-card);
  border-left: 1px solid var(--rule);
  border-top: 1px solid var(--rule);
  transform: rotate(45deg);
}

.logout-option {
  display: block;
  width: 100%;
  padding: 12px 13px;
  text-align: left;
  font-family: var(--font);
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.logout-option:hover {
  background: var(--accent-light);
  border-color: rgba(54, 86, 107, 0.18);
}

.logout-option strong {
  display: block;
  font-size: 14px;
  margin-bottom: 3px;
}

.logout-option small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.logout-option.danger strong {
  color: #b42318;
}

.logout-option.danger:hover {
  background: #fff1f0;
  border-color: rgba(180, 35, 24, 0.16);
}

.btn-login-entry {
  margin-left: 8px;
  width: 54px;
  height: 34px;
  padding: 0;
  font-size: 13px;
  font-family: var(--font);
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-login-entry:hover {
  background: #294657;
}

/* ---- auth: login modal ---- */
.auth-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.4);
  align-items: center;
  justify-content: center;
}

.auth-modal {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 32px 28px 24px;
  max-width: 380px;
  width: 90%;
  border: 1px solid var(--rule);
  box-shadow: none;
}

.auth-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  margin-bottom: 4px;
}

.auth-modal-desc {
  font-size: 13px;
  color: var(--dim);
  text-align: center;
  margin-bottom: 20px;
}

.auth-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 10px;
  font-family: var(--font);
  font-size: 14px;
  text-align: left;
  border: none;
  border-radius: 8px;
  background: #f7f9fa;
  cursor: pointer;
  transition: all var(--transition);
}
.auth-btn:hover {
  background: rgba(54, 86, 107, 0.12);
}
.auth-btn small {
  color: var(--dim);
  font-weight: 400;
}
.auth-btn-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: contain;
}

.auth-btn-cancel {
  display: block;
  width: 100%;
  padding: 10px;
  font-family: var(--font);
  font-size: 13px;
  color: var(--dim);
  background: none;
  border: none;
  cursor: pointer;
  margin-top: 4px;
}
.auth-btn-cancel:hover {
  color: var(--ink);
}

@media (max-width: 640px) {
  .user-wrap {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .logout-wrap {
    width: 54px;
    justify-content: flex-end;
  }

  .user-popover {
    left: 0;
    right: auto;
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
  }

  .user-popover::before {
    left: 22px;
    right: auto;
  }

  .logout-menu {
    position: fixed;
    left: 12px;
    right: 12px;
    top: 112px;
    width: auto;
    max-width: none;
  }

  .logout-menu::before {
    display: none;
  }

  .user-info {
    width: 100%;
    max-width: 100%;
  }
}
