/* components.css — 可复用组件。每个组件一个前缀，不写页面专属样式。
 *
 * 视觉基调：**轻**。分层靠留白和极淡的阴影，不靠粗边框和深色块。
 * 交互基调：**快**。过渡统一 0.15s，只用 background/transform/opacity，
 * 不动 width/height（会触发重排，卡顿就是从那儿来的）。 */

/* ── 卡片 ── */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  padding: var(--sp-4) var(--sp-5) var(--sp-5);
  margin-bottom: var(--sp-4);
  transition: box-shadow .15s ease;
}
.card:hover { box-shadow: var(--shadow-2); }
.card-head {
  display: flex; align-items: center; gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.card-head h2 { font-size: 14.5px; font-weight: 600; }
.card-head .spacer { flex: 1; }
.card-sub { font-size: 12.5px; color: var(--c-text-3); margin-top: 2px; font-weight: 400; }

/* ── 按钮 ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px; font-family: inherit; font-size: 13px; font-weight: 500;
  border: 1px solid var(--c-border-2); border-radius: var(--r-sm);
  background: var(--c-surface); color: var(--c-text); cursor: pointer;
  transition: background .15s ease, border-color .15s ease,
              box-shadow .15s ease, transform .1s ease, opacity .15s ease;
}
.btn:hover:not(:disabled) {
  background: var(--c-surface-2); border-color: var(--c-border-2);
  box-shadow: var(--shadow-1);
}
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: var(--c-primary); border-color: var(--c-primary); color: #fff;
  box-shadow: 0 1px 2px rgba(47, 111, 237, .22);
}
.btn-primary:hover:not(:disabled) {
  background: var(--c-primary-600); border-color: var(--c-primary-600);
  box-shadow: 0 3px 10px rgba(47, 111, 237, .26);
}
.btn-danger { color: var(--c-danger); border-color: #f2d4d4; }
.btn-danger:hover:not(:disabled) { background: var(--c-danger-soft); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--c-text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--c-surface-3); box-shadow: none; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* ── 行展开开关（表格行前面的那个箭头）──
 *
 * **刻意不用 .btn。** .btn 是"操作"的形状 —— 有边框、有文案、点了会发生什么。
 * 这个是个纯图标的状态开关，借 .btn 的皮会让人以为点它会执行动作，
 * 而且在一行里跟「同步 / 重新授权 / 删除」并排时会打架（四个长得一样的按钮，
 * 只有一个不是动作）。
 *
 * 用圆形底 + 旋转的箭头：展开/收起是**同一个东西的两个状态**，
 * 一眼看得出来，不靠读文字。
 */
.row-toggle {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--c-text-3);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .1s ease;
}
.row-toggle:hover { background: var(--c-surface-3); color: var(--c-text); }
.row-toggle:active { transform: scale(.9); }
.row-toggle:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 1px; }
.row-toggle svg {
  width: 15px; height: 15px;
  transition: transform .18s cubic-bezier(.4, 0, .2, 1);
}
/* 展开时：整个按钮染成主色（浅底），箭头转 90° 指向下。
   两个变化同时做 —— 只有一个的话，快速扫一眼容易看错状态。 */
.row-toggle[aria-expanded="true"] {
  background: var(--c-primary-soft); color: var(--c-primary);
}
.row-toggle[aria-expanded="true"]:hover { background: #dfe9fd; }
.row-toggle[aria-expanded="true"] svg { transform: rotate(90deg); }

/* 展开出来的那一块。给它一条左侧的细线，把"这是上面那行的下级内容"
   画出来 —— 光靠缩进在宽表格里看不出来是从哪儿分出来的。 */
.sub-panel {
  background: var(--c-surface-2);
  box-shadow: inset 3px 0 0 var(--c-border-2);
}

/* ── 表单 ── */
.field { margin-bottom: var(--sp-4); }
.field label {
  display: block; font-size: 12.5px; font-weight: 500;
  color: var(--c-text-2); margin-bottom: 6px;
}
.input {
  width: 100%; padding: 9px 11px; font-family: inherit; font-size: 14px;
  color: var(--c-text); background: var(--c-surface);
  border: 1px solid var(--c-border-2); border-radius: var(--r-sm);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.input:hover:not(:focus) { border-color: #c8cfdc; }
.input:focus {
  outline: none; border-color: var(--c-primary); background: #fff;
  box-shadow: 0 0 0 3px var(--c-primary-soft);
}
.input::placeholder { color: var(--c-text-3); }
select.input { cursor: pointer; padding-right: 6px; }
.field-hint { font-size: 11.5px; color: var(--c-text-3); margin-top: 5px; }

/* ── 徽章 ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 500; padding: 2px 9px;
  border-radius: var(--r-pill); white-space: nowrap;
}
.badge-primary { background: var(--c-primary-soft); color: var(--c-primary-700); }
.badge-ok      { background: var(--c-ok-soft);      color: var(--c-ok); }
.badge-warn    { background: var(--c-warn-soft);    color: var(--c-warn); }
.badge-danger  { background: var(--c-danger-soft);  color: var(--c-danger); }
.badge-muted   { background: var(--c-surface-3);    color: var(--c-text-3); }

/* 状态点：比整块徽章轻，列表里用它代替满屏色块 */
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%;
       margin-right: 6px; vertical-align: 1px; }
.dot-ok     { background: var(--c-ok); }
.dot-danger { background: var(--c-danger); }
.dot-warn   { background: var(--c-warn); }
.dot-muted  { background: var(--c-border-2); }

/* ── 提示条 ── */
.alert {
  font-size: 12.5px; line-height: 1.65; padding: 10px 13px;
  border-radius: var(--r-sm); border-left: 3px solid transparent;
  margin-top: var(--sp-3);
}
.alert:first-child { margin-top: 0; }
.alert-error { background: var(--c-danger-soft); border-color: var(--c-danger); color: #8f2b2b; }
.alert-warn  { background: var(--c-warn-soft);   border-color: var(--c-warn);   color: #8a5a00; }
.alert-info  { background: var(--c-info-soft);   border-color: var(--c-info);   color: #1d5c96; }
.alert-ok    { background: var(--c-ok-soft);     border-color: var(--c-ok);     color: #0a6b52; }

/* ── 表格 ── */
.table-wrap { border: 1px solid var(--c-border); border-radius: var(--r-sm); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 9px 13px; font-size: 11.5px; font-weight: 600;
  color: var(--c-text-2); background: var(--c-surface-2);
  border-bottom: 1px solid var(--c-border); white-space: nowrap;
}
.table td { padding: 10px 13px; border-bottom: 1px solid var(--c-border); }
.table tbody tr { transition: background .12s ease; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--c-surface-2); }

/* ── 统计块 ── */
.stats { display: flex; gap: var(--sp-6); flex-wrap: wrap; }
.stat-k { font-size: 11.5px; color: var(--c-text-3); margin-bottom: 3px; }
.stat-v { font-size: 15px; font-weight: 600; }

/* ── 空态 / 加载 ── */
.empty {
  padding: var(--sp-6) var(--sp-4); text-align: center; color: var(--c-text-3);
  font-size: 13px;
}
.spinner {
  width: 14px; height: 14px; border: 2px solid var(--c-border-2);
  border-top-color: var(--c-primary); border-radius: 50%;
  animation: spin .6s linear infinite; display: inline-block;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 面板切换时内容轻轻浮上来 —— 这就是"灵动"的那一下，
   幅度要小（6px / 0.18s），大了会烦。 */
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.rise { animation: rise .18s ease-out; }

/* ── 进度条 / 席位条 ── */
/* 席位用一小段横条表示，不用数字堆 —— 一眼能看出"还剩几个位子"。
   条本身不标数字，数字在旁边，颜色只分三档：够用 / 紧张 / 满。 */
.seatbar {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  white-space: nowrap;
}
.seatbar-track {
  width: 46px; height: 5px; border-radius: 3px;
  background: var(--c-surface-3); overflow: hidden; flex: none;
}
.seatbar-fill {
  height: 100%; border-radius: 3px;
  background: var(--c-primary);
  transition: width .2s ease, background .2s ease;
}
.seatbar-fill.is-tight { background: var(--c-warn); }
.seatbar-fill.is-full  { background: var(--c-danger); }
.seatbar-num {
  font-size: 12.5px; font-variant-numeric: tabular-nums;
  color: var(--c-text-2);
}
.seatbar-num b { color: var(--c-text); font-weight: 600; }

/* ── 键值表（详情页用）── */
.kv { display: grid; grid-template-columns: 96px 1fr; gap: 7px var(--sp-4); }
.kv dt { font-size: 12px; color: var(--c-text-3); }
.kv dd {
  font-size: 12.5px; color: var(--c-text); margin: 0;
  word-break: break-all;
}

/* ── 代码块（原始响应用）── */
.codepane {
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.6;
  background: var(--c-surface-2); border: 1px solid var(--c-border);
  border-radius: var(--r-sm); padding: var(--sp-3);
  max-height: 320px; overflow: auto; white-space: pre;
  color: var(--c-text-2);
}

/* ── 抽屉 ── */
/* 详情用抽屉而不是新页面：路由不用改，回来时列表的滚动位置和筛选都还在。
   只动 transform/opacity，0.2s —— 快了显得糙，慢了显得重。 */
.drawer-mask {
  position: fixed; inset: 0; background: rgba(29, 37, 49, .28);
  opacity: 0; transition: opacity .2s ease; z-index: 800;
}
.drawer-mask.show { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(680px, 92vw); background: var(--c-surface);
  box-shadow: var(--shadow-3); z-index: 801;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .2s cubic-bezier(.2, .8, .3, 1);
}
.drawer.show { transform: translateX(0); }
.drawer-head {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--c-border);
  flex: none;
}
.drawer-head h2 { font-size: 15px; font-weight: 600; }
.drawer-head .card-sub { margin-top: 3px; }
.drawer-body { padding: var(--sp-5); overflow: auto; flex: 1; }
.drawer-close {
  margin-left: auto; flex: none;
  border: none; background: transparent; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--c-text-3);
  padding: 2px 6px; border-radius: var(--r-sm);
  transition: background .15s ease, color .15s ease;
}
.drawer-close:hover { background: var(--c-surface-3); color: var(--c-text); }

/* ── 复制行（令牌之类）── */
.copyline {
  display: flex; align-items: center; gap: var(--sp-2);
  background: var(--c-surface-2); border: 1px solid var(--c-border);
  border-radius: var(--r-sm); padding: 6px 8px 6px 10px;
}
.copyline code {
  font-family: var(--font-mono); font-size: 11.5px; color: var(--c-text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}

/* ── 可点击的行 ── */
.table tbody tr.rowlink { cursor: pointer; }
.table tbody tr.rowlink:hover { background: var(--c-primary-soft); }
.table tbody tr.rowlink td:first-child { position: relative; }
/* 悬停时左侧浮一条细线，比整行变色轻 */
.table tbody tr.rowlink td:first-child::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 2px; border-radius: 2px; background: var(--c-primary);
  opacity: 0; transition: opacity .15s ease;
}
.table tbody tr.rowlink:hover td:first-child::before { opacity: 1; }

/* ── 分栏（表单里并排几个字段）── */
.form-grid {
  display: grid; gap: var(--sp-3) var(--sp-4);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.form-grid .field { margin-bottom: 0; }
textarea.input { resize: vertical; min-height: 64px; line-height: 1.5; }

/* ── Toast ── */
#toast-host {
  position: fixed; bottom: var(--sp-5); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: var(--sp-2);
  z-index: 999; pointer-events: none;
}
.toast {
  background: #2b3342; color: #fff; font-size: 13px;
  padding: 9px 18px; border-radius: var(--r-pill); box-shadow: var(--shadow-2);
  opacity: 0; transform: translateY(10px);
  transition: opacity .18s ease, transform .18s cubic-bezier(.2,.9,.3,1.2);
  max-width: 70vw;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok    { background: #0f7d61; }
.toast.error { background: #b93c3c; }

/* ── 「这个页面是旧的」提示条（web/js/build.js） ──
 * 放顶部居中：toast 占了底部，两个撞一起会互相盖。
 * 用 warn 色 —— 它不是错误，是"你看的不是最新的"，红色会吓人。 */
#build-stale {
  position: fixed; top: var(--sp-4); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 6px 6px 6px 16px; border-radius: var(--r-pill);
  background: var(--c-warn-soft); color: var(--c-warn);
  border: 1px solid #f0dcb8; font-size: 13px;
  box-shadow: var(--shadow-2); z-index: 1000;
  animation: build-stale-in .18s cubic-bezier(.2, .9, .3, 1.2) both;
}
@keyframes build-stale-in {
  from { opacity: 0; transform: translate(-50%, -8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
#build-stale .btn { background: #fff; border-color: #f0dcb8; color: var(--c-warn); }

/* ── 分段切换（一个表单里"两种做法"）──
 *
 * 用在这里：添加母号有两种方式（粘令牌 / 让浏览器去登）。
 * **刻意不做成两个页面或两个按钮** —— 它们是同一个动作的两种输入，
 * 分成两处会让人以为功能是分开的。
 *
 * 视觉上是一颗药丸里两个可选项：外层浅灰底、选中那个浮起来变白。
 * 不用下划线 tab —— 那种更像"页面级"的切换，而这里只是表单内部的选择。
 */
.seg {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--c-surface-3); border-radius: var(--r-sm);
}
.seg-btn {
  padding: 5px 13px; font-family: inherit; font-size: 12.5px; font-weight: 500;
  border: 0; border-radius: calc(var(--r-sm) - 3px);
  background: transparent; color: var(--c-text-2); cursor: pointer;
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.seg-btn:hover:not(.active) { color: var(--c-text); }
.seg-btn.active {
  background: var(--c-surface); color: var(--c-primary);
  box-shadow: var(--shadow-1);
}
/* 禁用态：比如"重新授权"时只有粘令牌那一种做法 */
.seg-btn:disabled { opacity: .45; cursor: not-allowed; }

/* 登录进度的日志窗。**等宽 + 深一点的底** —— 它是给"盯着看进展"用的，
 * 跟正文不是一回事。行高放宽一点，人在紧张的时候看得清。 */
.runlog {
  font-family: var(--font-mono); font-size: 11.5px; line-height: 1.7;
  background: var(--c-surface-3); border-radius: var(--r-sm);
  padding: 10px 12px; max-height: 260px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-all; color: var(--c-text-2);
}
