/* ==========================================================================
   统一 UI 视觉层（参考 motion-prompt 规范）
   - 只改视觉：按钮 / 表单 / 卡片 / 排版 / 状态
   - 不动结构、接口、交互
   - 颜色沿用站点现有变量（胡萝卜主题）
   - 特异性说明：排除条件用 :where()，避免把通用规则的优先级抬高
   ========================================================================== */

:root{
  --ui-radius:8px;
  --ui-radius-card:10px;
  --ui-btn-h:40px;
  --ui-btn-px:16px;
  --ui-btn-font:14px;
  --ui-btn-gap:8px;
}

/* --------------------------------------------------------------------------
   1. 按钮基座：8px 圆角、14/600、9×16、1px 描边、150ms
   -------------------------------------------------------------------------- */
html:not([data-theme="mono"]) :is(
  .btn,
  a.btn,
  .big-btn,
  .tb-btn,
  .mf-btn,
  button:where(:not(.tab):not(.tabbtn):not(.chip):not(.fchip):not(.flt button)
    :not(.cac-navbtn):not(.icon-only):not(.pw-toggle):not(.close)
    :not(.modal-close):not(.no-ui):not(.sl-b))
){
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:var(--ui-btn-gap) !important;
  height:auto !important;
  min-height:var(--ui-btn-h) !important;
  padding:9px var(--ui-btn-px) !important;
  border-radius:var(--ui-radius) !important;
  border:1px solid var(--line-strong, #d9d4ca) !important;
  background-color:var(--card, #fff) !important;
  background-image:none !important;
  color:var(--ink, #1c1b19) !important;
  font-size:var(--ui-btn-font) !important;
  font-weight:600 !important;
  line-height:1.4 !important;
  letter-spacing:0 !important;
  white-space:nowrap !important;
  text-decoration:none !important;
  box-shadow:none !important;
  transition:background-color .15s ease, border-color .15s ease, color .15s ease, filter .15s ease !important;
}
html:not([data-theme="mono"]) :is(.btn, a.btn, .big-btn, .tb-btn, .mf-btn):hover{
  border-color:var(--ink, #1c1b19) !important;
}
html:not([data-theme="mono"]) :is(.btn, a.btn, .big-btn, .tb-btn, .mf-btn):focus-visible{
  outline:2px solid var(--accent, #e2701f) !important;
  outline-offset:3px !important;
}
html:not([data-theme="mono"]) :is(.btn, .big-btn, .tb-btn, .mf-btn):disabled{
  opacity:.35 !important;
  cursor:not-allowed !important;
  filter:none !important;
}

/* 主操作：主题橙 + 近黑字 */
html:not([data-theme="mono"]) :is(
  .btn:not(.ghost):not(.danger):not(.green):not(.add):not(.ok):not(.reg):not(.brick):not(.mini):not(.copybtn):not(.hr-mini),
  .btn.pri,
  .go,
  .refresh-btn,
  button.primary,
  button[type="submit"]
){
  background-color:var(--accent, #e2701f) !important;
  background-image:none !important;
  border-color:var(--accent, #e2701f) !important;
  color:var(--accent-ink, #1c1b19) !important;
}
html:not([data-theme="mono"]) :is(
  .btn:not(.ghost):not(.danger):not(.green):not(.add):not(.ok):not(.reg):not(.brick):not(.mini):not(.copybtn):not(.hr-mini),
  .btn.pri,
  .go,
  .refresh-btn,
  button.primary,
  button[type="submit"]
):hover{
  filter:brightness(1.06) !important;
  border-color:var(--accent, #e2701f) !important;
}

/* 次操作 */
html:not([data-theme="mono"]) :is(.btn.ghost, .btn-ghost, .mini, .copybtn, .hr-mini){
  background-color:transparent !important;
  border-color:var(--line-strong, #d9d4ca) !important;
  color:var(--ink, #1c1b19) !important;
}
html:not([data-theme="mono"]) :is(.btn.ghost, .btn-ghost, .mini, .copybtn, .hr-mini):hover{
  border-color:var(--ink, #1c1b19) !important;
  color:var(--ink, #1c1b19) !important;
}

/* 成功 / 危险 / 注册 */
html:not([data-theme="mono"]) :is(.btn.green, .btn.add, .btn.ok){
  background-color:var(--ok, #7dc242) !important;
  border-color:var(--ok, #7dc242) !important;
  color:var(--accent-ink, #1c1b19) !important;
}
html:not([data-theme="mono"]) :is(.btn.danger, .btn.brick, button.danger, button.brick, .mini.danger, .hr-mini.danger){
  background-color:var(--danger, #c0392b) !important;
  border-color:var(--danger, #c0392b) !important;
  color:#fff !important;
}
html:not([data-theme="mono"]) .btn.reg{
  background-color:transparent !important;
  border-color:var(--accent, #e2701f) !important;
  color:var(--accent-text, #b9540f) !important;
}

/* 返回 / 跳转类链接：按小号次按钮处理，不再用胶囊 */
html:not([data-theme="mono"]) :is(.backlink, .cac-backhome){
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:6px !important;
  min-height:32px !important;
  padding:6px 12px !important;
  border-radius:var(--ui-radius) !important;
  border:1px solid var(--line-strong, #d9d4ca) !important;
  background-color:transparent !important;
  color:var(--ink, #1c1b19) !important;
  font-size:13px !important;
  font-weight:600 !important;
  text-decoration:none !important;
}
html:not([data-theme="mono"]) :is(.backlink, .cac-backhome):hover{
  border-color:var(--ink, #1c1b19) !important;
  color:var(--ink, #1c1b19) !important;
}

/* 小号 */
html:not([data-theme="mono"]) :is(.btn.sm, .btn.small, .mini, .copybtn, .hr-mini){
  min-height:32px !important;
  padding:6px 12px !important;
  font-size:13px !important;
}
html:not([data-theme="mono"]) .tb-btn{
  min-height:44px !important;
  font-size:13.5px !important;
  padding:9px 14px !important;
}

/* 分段 / 标签式按钮 */
html:not([data-theme="mono"]) :is(.cac-segbtn, .cfg-tab, .sbtn, .abtn, .mm-btn, .tab, .tabbtn){
  min-height:34px !important;
  padding:6px 12px !important;
  border-radius:var(--ui-radius) !important;
  border:1px solid var(--line-strong, #d9d4ca) !important;
  background-color:transparent !important;
  color:var(--ink-soft, #4a4742) !important;
  font-size:13px !important;
  font-weight:600 !important;
  box-shadow:none !important;
}
html:not([data-theme="mono"]) :is(.cac-segbtn.on, .cfg-tab.on, .sbtn.on, .abtn.on, .mm-btn.on, .tab.on, .tabbtn.active, .tabbtn.on){
  background-color:var(--accent, #e2701f) !important;
  border-color:var(--accent, #e2701f) !important;
  color:var(--accent-ink, #1c1b19) !important;
}
html:not([data-theme="mono"]) :is(.cac-segbtn, .cfg-tab, .sbtn, .abtn, .mm-btn, .tab, .tabbtn):hover{
  border-color:var(--ink, #1c1b19) !important;
}

/* 筛选 chip：保留胶囊 */
html:not([data-theme="mono"]) :is(.chip, .fchip, .flt button){
  border-radius:999px !important;
  min-height:32px !important;
  padding:5px 13px !important;
  font-size:13px !important;
  font-weight:500 !important;
  border:1px solid var(--line-strong, #d9d4ca) !important;
  background-color:transparent !important;
  color:var(--ink, #1c1b19) !important;
  box-shadow:none !important;
}
html:not([data-theme="mono"]) :is(.chip.on, .fchip.on, .flt button.on){
  background-color:var(--accent, #e2701f) !important;
  border-color:var(--accent, #e2701f) !important;
  color:var(--accent-ink, #1c1b19) !important;
}

/* 图标按钮 */
html:not([data-theme="mono"]) :is(.icon-only, .pw-toggle){
  min-height:34px !important;
  width:34px !important;
  padding:0 !important;
  border-radius:var(--ui-radius) !important;
  border:1px solid transparent !important;
  background-color:transparent !important;
}

/* --------------------------------------------------------------------------
   2. 表单
   -------------------------------------------------------------------------- */
html:not([data-theme="mono"]) :is(
  input:not([type=checkbox]):not([type=radio]):not([type=file]),
  select,
  textarea
){
  height:auto !important;
  min-height:40px !important;
  padding:8px 12px !important;
  border-radius:var(--ui-radius) !important;
  border:1px solid var(--line-strong, #d9d4ca) !important;
  background-color:var(--card, #fff) !important;
  color:var(--ink, #1c1b19) !important;
  font-size:14px !important;
  box-shadow:none !important;
}
html:not([data-theme="mono"]) textarea{min-height:96px !important}
html:not([data-theme="mono"]) :is(input, select, textarea):focus{
  outline:2px solid var(--accent, #e2701f) !important;
  outline-offset:2px !important;
  box-shadow:none !important;
}

/* --------------------------------------------------------------------------
   3. 卡片 / 表格 / 排版：边框代替阴影
   -------------------------------------------------------------------------- */
html:not([data-theme="mono"]) :is(.card, .mbox){
  border-radius:var(--ui-radius-card) !important;
  border:1px solid var(--line, #e9e6df) !important;
  box-shadow:none !important;
}
html:not([data-theme="mono"]) .card-title::before{display:none !important}
html:not([data-theme="mono"]) .card-title{
  font-size:16.5px !important;
  font-weight:700 !important;
  letter-spacing:-.015em !important;
}
html:not([data-theme="mono"]) :is(h1, .h1){
  font-size:clamp(24px, 2.2vw, 32px) !important;
  font-weight:700 !important;
  letter-spacing:-.025em !important;
  line-height:1.25 !important;
}
html:not([data-theme="mono"]) :is(h2, .h2){
  font-size:clamp(19px, 1.8vw, 24px) !important;
  font-weight:700 !important;
  letter-spacing:-.02em !important;
  line-height:1.3 !important;
}
html:not([data-theme="mono"]) :is(h3, .h3){
  font-size:16.5px !important;
  font-weight:700 !important;
  letter-spacing:-.015em !important;
}
html:not([data-theme="mono"]) body{
  font-size:14.5px !important;
  line-height:1.65 !important;
  letter-spacing:0 !important;
}
html:not([data-theme="mono"]) thead th{
  font-size:12px !important;
  font-weight:600 !important;
  color:var(--muted, #7d786f) !important;
  letter-spacing:.03em !important;
  text-transform:none !important;
  border-bottom:1px solid var(--line, #e9e6df) !important;
}
html:not([data-theme="mono"]) tbody td{
  border-bottom:1px solid var(--line, #e9e6df) !important;
}
html:not([data-theme="mono"]) .modal-panel{
  border-radius:12px !important;
  border:1px solid var(--line, #e9e6df) !important;
  box-shadow:0 18px 48px rgba(28,27,25,.14) !important;
}

/* --------------------------------------------------------------------------
   4. 触屏：按钮不低于 44，保持 8px 圆角
   -------------------------------------------------------------------------- */
@media (max-width:640px){
  /* 进度页头部：按钮整行下移，避免把标题挤成多行 */
  html:not([data-theme="mono"]) header.hd{flex-wrap:wrap !important; row-gap:8px !important}
}

@media (max-width:768px){
  html:not([data-theme="mono"]) :is(
    .btn, a.btn, .big-btn, .tb-btn, .mf-btn,
    button:where(:not(.tab):not(.tabbtn):not(.chip):not(.fchip):not(.flt button)
      :not(.cac-navbtn):not(.icon-only):not(.pw-toggle):not(.close)
      :not(.modal-close):not(.no-ui):not(.sl-b))
  ){
    min-height:44px !important;
    padding:10px 14px !important;
  }
  html:not([data-theme="mono"]) :is(.btn.sm, .mini, .copybtn, .hr-mini){min-height:40px !important}
  html:not([data-theme="mono"]) :is(input:not([type=checkbox]):not([type=radio]):not([type=file]), select){
    min-height:44px !important;
  }
}
