/* ============================================================
   组件：按钮 / 输入 / 卡片 / 表格 / 分页 / 徽标 / 弹窗 / Toast / Tabs
   ============================================================ */

/* ---------- 按钮 ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--text-2); font-weight: 500; font-size: 13.5px; white-space: nowrap; user-select: none; overflow: hidden; transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .15s, border-color .15s, color .15s; }
.btn svg { width: 16px; height: 16px; flex: 0 0 16px; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(17,24,39,.08); border-color: #D1D5DB; color: var(--text); }
.btn:active { transform: translateY(0) scale(.97); box-shadow: none; transition-duration: .06s; }
.btn:disabled, .btn.loading { opacity: .6; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.btn-primary { background: linear-gradient(180deg, var(--primary-2), var(--primary)); border-color: var(--primary); color: #fff; box-shadow: 0 2px 6px rgba(79,70,229,.28); }
.btn-primary:hover { background: linear-gradient(180deg, var(--primary), var(--primary-700)); border-color: var(--primary-700); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,.36); }
.btn-danger { background: #fff; border-color: #FCA5A5; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); border-color: #F87171; }
.btn-danger.solid { background: linear-gradient(180deg, #EF4444, var(--danger)); border-color: var(--danger); color: #fff; box-shadow: 0 2px 6px rgba(220,38,38,.25); }
.btn-danger.solid:hover { background: #B91C1C; color: #fff; }
.btn-success { background: linear-gradient(180deg, #22C55E, var(--success)); border-color: var(--success); color: #fff; }
.btn-success:hover { background: #15803D; color: #fff; }
.btn-warn { background: #fff; border-color: #FCD34D; color: var(--warn); }
.btn-warn:hover { background: var(--warn-soft); color: var(--warn); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); box-shadow: none; }
.btn-soft { background: var(--primary-soft); border-color: transparent; color: var(--primary); }
.btn-soft:hover { background: #E0E7FF; color: var(--primary-700); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.btn-lg { height: 42px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: 7px; }
.btn .spin { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }
.ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .18; transform: scale(0); animation: ripple .55s ease-out forwards; pointer-events: none; }
@keyframes ripple { to { transform: scale(1); opacity: 0 } }
.actions { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.actions.xs .btn { height: 26px; padding: 0 8px; font-size: 12px; gap: 4px; }
.actions.xs .btn svg { width: 13px; height: 13px; }
.link-btn { background: none; border: 0; padding: 0 4px; color: var(--primary); font-size: 13px; cursor: pointer; border-radius: 4px; }
.link-btn:hover { background: var(--primary-soft); }
.link-btn.danger { color: var(--danger); }
.link-btn.danger:hover { background: var(--danger-soft); }

/* ---------- 输入 ---------- */
.inp, input[type=text], input[type=password], input[type=number], input[type=date], input[type=search], select, textarea { width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s; }
textarea { height: auto; min-height: 80px; padding: 8px 12px; resize: vertical; line-height: 1.5; }
.inp:hover, input:hover, select:hover, textarea:hover { border-color: #C7CBD4; }
.inp:focus, input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
input.err, select.err, textarea.err, .inp.err { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(220,38,38,.15) !important; }
input:disabled, select:disabled, textarea:disabled { background: #F9FAFB; color: var(--muted); cursor: not-allowed; }
input[readonly] { background: #F9FAFB; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' stroke='%236B7280' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 32px; }
.inp-group { display: flex; align-items: stretch; }
.inp-group > input, .inp-group > select { border-radius: 8px 0 0 8px; flex: 1; min-width: 0; }
.inp-group > .addon { display: inline-flex; align-items: center; padding: 0 10px; border: 1px solid var(--line); border-left: 0; border-radius: 0 8px 8px 0; background: #F9FAFB; color: var(--text-3); font-size: 12.5px; white-space: nowrap; }
.field { margin-bottom: 14px; min-width: 0; }
.field > label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 500; }
.field > label .req { color: var(--danger); margin-left: 3px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.45; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.field-row.c3 { grid-template-columns: repeat(3, 1fr); }
.field-row.c4 { grid-template-columns: repeat(4, 1fr); }
.form-sep { border: 0; border-top: 1px dashed var(--line); margin: 6px 0 16px; }
.form-note { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: 8px; background: var(--info-soft); color: #075985; font-size: 12.5px; margin-bottom: 14px; line-height: 1.5; }
.form-note.warn { background: var(--warn-soft); color: #92400E; }
.form-note svg { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 1px; }
.section-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 13.5px; margin: 6px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line-2); color: var(--text); }
.section-title::before { content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--primary); }
.switch, .field > label.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; height: 36px; margin: 0; font-weight: 400; color: var(--text); position: relative; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .tk { width: 40px; height: 22px; border-radius: 999px; background: #D1D5DB; position: relative; transition: background .2s; flex: 0 0 40px; }
.switch .tk::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s var(--ease); }
.switch input:checked + .tk { background: var(--primary); }
.switch input:checked + .tk::after { transform: translateX(18px); }
.switch.sm { height: auto; } .switch.sm .tk { width: 32px; height: 18px; flex-basis: 32px; } .switch.sm .tk::after { width: 14px; height: 14px; } .switch.sm input:checked + .tk::after { transform: translateX(14px); }
.check-group { display: flex; flex-wrap: wrap; gap: 8px 14px; min-height: 36px; align-items: center; }
.check-group label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; transition: all .15s; }
.check-group label:hover { border-color: var(--primary); }
.check-group label.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-700); }
.check-group input { width: 14px; height: 14px; margin: 0; accent-color: var(--primary); }
.rule-list { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.rule-list .rl-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--line-2); font-size: 13px; background: #fff; }
.rule-list .rl-row:nth-child(even) { background: #FAFBFC; }
.rule-list .rl-row .idx { width: 20px; height: 20px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.rule-list .rl-row .nm { flex: 1; }
.rule-list .rl-row code { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.rule-list .rl-add { display: flex; gap: 8px; padding: 8px; background: #F9FAFB; }
.rule-list .rl-add select { height: 32px; }
.rule-list .rl-empty { padding: 12px; text-align: center; color: var(--muted); font-size: 12.5px; }
.img-pick { display: flex; gap: 14px; align-items: flex-start; }
.img-pick .thumb { width: 180px; height: 100px; border-radius: 8px; border: 1px dashed #C7CBD4; background: #F9FAFB; display: flex; align-items: center; justify-content: center; overflow: hidden; cursor: pointer; color: var(--muted); position: relative; flex: 0 0 auto; transition: border-color .15s; }
.img-pick .thumb.sq { width: 100px; }
.img-pick .thumb:hover { border-color: var(--primary); }
.img-pick .thumb img { width: 100%; height: 100%; object-fit: cover; }
.img-pick .thumb svg { width: 28px; height: 28px; }
.img-pick .ops { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.img-pick input[type=file] { display: none; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid rgba(17,24,39,.04); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-head .sub { color: var(--muted); font-size: 12.5px; }
.card-head .actions { margin-left: auto; }
.card-body { padding: 18px 20px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ---------- 工具栏 ---------- */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .inp, .toolbar input, .toolbar select { width: auto; height: 34px; }
.toolbar input[type=text], .toolbar input[type=search] { width: 220px; }
.toolbar select { min-width: 120px; }
.toolbar .dim { color: var(--muted); font-size: 13px; }
.toolbar .grow { flex: 1; }
.seg { display: inline-flex; background: #EEF0F4; border-radius: 8px; padding: 3px; gap: 2px; }
.seg-item { position: relative; overflow: hidden; height: 28px; padding: 0 12px; border: 0; background: transparent; border-radius: 6px; color: var(--text-2); font-size: 13px; transition: all .15s; }
.seg-item:hover { color: var(--text); }
.seg-item.on { background: #fff; color: var(--primary); box-shadow: 0 1px 3px rgba(17,24,39,.12); font-weight: 600; }
