/* 通用组件: 卡片 / 统计卡 / 表格 / 按钮 / 表单 / 徽章 / 标签页 / 弹窗 / toast / 分页 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }

.stat { padding: 18px 20px; position: relative; }
.stat__label { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.stat__value { font-family: var(--display); font-size: 30px; font-weight: 700; letter-spacing: -.03em; line-height: 1.2; margin-top: 10px; font-variant-numeric: tabular-nums; }
.stat__icon { position: absolute; top: 16px; right: 16px; width: 30px; height: 30px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface-2); color: var(--primary); display: grid; place-items: center; }
.stat--danger .stat__value { color: var(--danger); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { background: var(--surface-2); color: var(--dim); font-weight: 600; font-size: 11px; letter-spacing: .04em; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table__empty { text-align: center !important; color: var(--muted); padding: 32px !important; }
.table .ops { white-space: nowrap; text-align: right; }
.row-link { cursor: pointer; }

/* 圆角规范: 卡片 / 输入框 / 对话框 / 常规按钮统一用 --radius; 有特殊需求的按钮加修饰类单独覆盖(如登录页 .auth__submit) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); border-color: var(--primary); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn:focus-visible, .icon-btn:focus-visible, .tab:focus-visible, .nav__item:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.btn--primary { background: var(--grad); border-color: transparent; color: var(--on-primary); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), var(--shadow); }
.btn--primary:hover { background: var(--grad); border-color: transparent; filter: brightness(1.07); box-shadow: 0 0 0 3px var(--focus); }
.btn--danger { color: var(--danger); }
.btn--danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn--danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn--danger-solid:hover { background: var(--danger); border-color: var(--danger); filter: brightness(1.08); }

/* 主操作按钮(卡片上的「进入控制台」): 金色渐变 + 内侧高光 + 悬停时一道扫光和箭头位移 */
.btn--console { position: relative; overflow: hidden; border: 0; padding-right: 10px; font-weight: 600; color: var(--on-primary); background: var(--grad);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 6px 16px -9px color-mix(in srgb, var(--primary) 75%, transparent); }
.btn--console .icon { width: 15px; height: 15px; transition: transform .18s; }
.btn--console:hover, .btn--console:active, .btn--console:focus-visible { background: var(--grad); filter: brightness(1.06); }
.btn--console:hover { color: var(--on-primary); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .34), 0 8px 20px -9px color-mix(in srgb, var(--primary) 85%, transparent); }
.btn--console:hover .icon { transform: translateX(3px); }
/* 扫光: 窄一道、淡一点, 扫过时文字仍然看得清 */
.btn--console::after { content: ""; position: absolute; inset: 0; transform: translateX(-140%); pointer-events: none;
  background: linear-gradient(112deg, transparent 46%, rgba(255, 255, 255, .22) 50%, transparent 54%); }
.btn--console:hover::after { animation: btn-sheen .55s ease-out; }
.btn--console:active { transform: translateY(1px); }
@keyframes btn-sheen { to { transform: translateX(120%); } }
.btn--sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn--link { border: 0; background: none; color: var(--primary); padding: 0 4px; height: auto; }
.btn--link:hover { background: none; color: var(--primary-strong); text-decoration: underline; }

.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--muted); cursor: pointer; }
.icon-btn:hover { color: var(--primary-strong); border-color: var(--line-strong); background: var(--surface-2); }
/* 顶栏下拉(主题选择) */
.dropdown { position: relative; }
.dropdown__menu { display: none; position: absolute; top: calc(100% + 8px); right: 0; min-width: 170px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 200; overflow: hidden; }
.dropdown--open .dropdown__menu { display: block; }
.dropdown--open > .icon-btn { color: var(--primary-strong); background: var(--primary-soft); border-color: var(--line-strong); }
.dropdown__head { padding: 10px 14px 7px; font-size: 10px; font-weight: 700; letter-spacing: .16em; color: var(--dim); border-bottom: 1px solid var(--line); }
.dropdown__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 14px; border: 0; background: none; font: inherit; font-size: 13px; color: var(--muted); cursor: pointer; text-align: left; }
.dropdown__item:hover { background: var(--surface-2); color: var(--text); }
.dropdown__item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.dropdown__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px var(--line-strong); }
.dropdown__sub { margin-left: auto; font-size: 11px; color: var(--dim); }
/* 当前主题高亮: 直接看 <html data-theme>, 不用 JS 同步 */
:root:not([data-theme="dark"]) [data-set-theme="light"], [data-theme="dark"] [data-set-theme="dark"] { color: var(--primary-strong); background: var(--primary-soft); font-weight: 600; }

.input, .select, .textarea { height: 34px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); font: inherit; font-size: 13px; color: var(--text); }
.input::placeholder, .textarea::placeholder { color: var(--dim); }
.textarea { height: auto; padding: 8px 10px; resize: vertical; width: 100%; }
.textarea.code { tab-size: 4; white-space: pre; line-height: 1.55; }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.form { display: grid; gap: 14px; }
.form__row { display: grid; gap: 5px; }
fieldset.form__row { border: 0; padding: 0; margin: 0; min-width: 0; }
.form__row > span { font-size: 12px; font-weight: 500; color: var(--muted); }
.form__row .input, .form__row .select { width: 100%; }
.form__inline { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check input { accent-color: var(--primary); }
/* 带说明的单选卡片(模板与规则): 标题一行, 说明换行 */
.check--block { display: block; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.check--block:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.check--block .small { margin: 2px 0 0 22px; line-height: 1.5; }

/* 状态徽章: 淡底 + 同色细边 + 小圆点 */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.chip--ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }
.chip--warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.chip--danger { background: var(--danger-soft); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.chip--info { background: var(--primary-soft); color: var(--primary-strong); border-color: var(--line-strong); }

/* 标签页: 分段控件 */
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--radius-lg); background: var(--surface-2); border: 1px solid var(--line); }
.tab { padding: 4px 12px; border-radius: var(--radius); cursor: pointer; color: var(--muted); border: 1px solid transparent; background: none; font: inherit; font-size: 12.5px; }
.tab:hover { color: var(--text); }
.tab--active { background: var(--surface); color: var(--primary-strong); font-weight: 600; border-color: var(--line-strong); box-shadow: var(--shadow); }

/* 弹窗整体限高: 标题和底部按钮固定, 只有中间内容滚动 */
dialog.dlg { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0; width: min(520px, 94vw); max-height: 90vh; background: var(--surface); box-shadow: var(--shadow-lg); color: var(--text); }
dialog.dlg > form { display: flex; flex-direction: column; max-height: inherit; min-height: 0; }
dialog.dlg--wide { width: min(980px, 96vw); }
dialog.dlg--xwide { width: min(1320px, 96vw); }
/* 左表单 + 右预览(服务器安装 / HTTPS): 预览自己滚, 表单再长也看得到 */
.deploy-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.deploy-preview { position: sticky; top: 0; display: flex; flex-direction: column; gap: 10px; max-height: 66vh; }
/* 上: 标题 + 目录信息; 下: 配置正文。两块各自独立的卡片 */
.deploy-card { background: var(--code-bg); border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; }
.deploy-card:first-child { flex: none; } /* 上面的信息卡按内容高度, 剩下的高度都给正文滚动 */
.deploy-preview__head { display: flex; align-items: center; gap: 8px; padding: 9px 14px; background: var(--code-head); border-bottom: 1px solid var(--line); }
.deploy-preview__title { font: 600 12px var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--code-key); }
.deploy-preview__title::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--grad); vertical-align: 1px; }
.deploy-meta { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; margin: 0; padding: 10px 14px; font-size: 12px; }
.deploy-meta dt { color: var(--muted); }
.deploy-meta dd { margin: 0; font-family: var(--mono); color: var(--text); overflow-wrap: anywhere; }
.deploy-empty { padding: 14px; color: var(--muted); font-size: 12px; }
/* 配置正文: 不显示滚动条, 上下还有内容时边缘出现阴影(滚到头就消失):
   前两层是跟着内容走的底色遮罩(local), 后两层是固定在边缘的阴影(scroll); 内容顶到边时遮罩盖住阴影 */
.deploy-code { flex: 1; min-height: 0; margin: 0; padding: 14px 16px 16px; overflow: auto; scrollbar-width: none;
  font: 12px/1.65 var(--mono); color: var(--text); white-space: pre-wrap; word-break: normal; overflow-wrap: break-word; tab-size: 4;
  background:
    linear-gradient(var(--code-bg) 35%, transparent) center top / 100% 40px no-repeat local,
    linear-gradient(transparent, var(--code-bg) 65%) center bottom / 100% 40px no-repeat local,
    radial-gradient(farthest-side at 50% 0, var(--code-shade), transparent) center top / 100% 16px no-repeat scroll,
    radial-gradient(farthest-side at 50% 100%, var(--code-shade), transparent) center bottom / 100% 16px no-repeat scroll,
    var(--code-bg); }
.deploy-code::-webkit-scrollbar { display: none; }
.deploy-code .c { color: var(--code-comment); font-style: italic; }
.deploy-code .k { color: var(--code-key); font-weight: 600; }
@media (max-width: 900px) { .deploy-grid { grid-template-columns: 1fr; } .deploy-preview { position: static; max-height: 60vh; } }
dialog.dlg::backdrop { background: var(--backdrop); }
.dlg__x { position: absolute; top: 50%; right: 10px; transform: translateY(-50%); display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: var(--radius); background: none; color: var(--muted); cursor: pointer; }
.dlg__x:hover { background: var(--surface-3); color: var(--text); }
.dlg__head { position: relative; z-index: 1; padding: 16px 46px 16px 20px; border-bottom: 1px solid var(--line-strong); box-shadow: 0 10px 16px -14px var(--code-shade); font-family: var(--display); font-weight: 700; font-size: 15px; }
.dlg__body { flex: 1; min-height: 0; padding: 18px 20px; overflow: auto; }
/* 内容自己管滚动的弹窗(控制台): 内容区给一个确定高度并且自己不滚, 里面上半部滚、下半部固定 */
.dlg--flush .dlg__body { flex: none; display: flex; overflow: hidden; height: min(72vh, 720px); }
.dlg__foot { padding: 12px 20px; border-top: 1px solid var(--line-strong); box-shadow: 0 -10px 16px -14px var(--code-shade); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); display: flex; justify-content: flex-end; gap: 8px; }
.dlg__warn { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: var(--radius); margin-bottom: 12px; }

.toast { position: fixed; top: 16px; left: 50%; transform: translate(-50%, -90px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); transition: transform .25s; z-index: 1000; max-width: 80vw; }
.toast--show { transform: translate(-50%, 0); }
.toast--error { background: var(--danger); color: #fff; }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pager:empty { display: none; }

.site-picker { border: 1px solid var(--line-strong); border-radius: var(--radius); max-height: 240px; overflow: auto; padding: 8px 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; }
.site-picker__group { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin-top: 4px; }

.json { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; max-height: 360px; overflow: auto; }
.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--ok); }
.bar--warn > i { background: var(--warn); }
.bar--danger > i { background: var(--danger); }
