:root {
  --primary: #409eff;
  --primary2: #66b1ff;
  --grad: linear-gradient(135deg, #409eff 0%, #66b1ff 100%);
  --danger: #f56c6c;
  --success: #67c23a;
  --warning: #e6a23c;
  --text: #2c3e50;
  --text-sub: #8896ab;
  --bg: #eef1f8;
  --card: rgba(255, 255, 255, 0.65);
  --card-solid: rgba(255, 255, 255, 0.85);
  --border: rgba(255, 255, 255, 0.6);
  --radius: 20px;
  --shadow: 0 8px 32px rgba(31, 38, 135, 0.07);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #4a5568;
  background: linear-gradient(135deg, #f0f4f8 0%, #e8eef5 50%, #f5f0fa 100%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: var(--primary); text-decoration: none; }

.glass {
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card { padding: 20px; margin-bottom: 20px; border-radius: 20px; transition: all .3s ease; }
.card:hover { box-shadow: 0 12px 40px rgba(31, 38, 135, .12); transform: translateY(-2px); }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 18px;
  border: none; border-radius: 10px;
  font-size: 14px; cursor: pointer;
  transition: all .2s; white-space: nowrap;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(91, 127, 255, .35); }
.btn-plain { background: rgba(91, 127, 255, .08); color: var(--primary); border: 1px solid rgba(91, 127, 255, .25); }
.btn-danger { background: rgba(255, 91, 106, .10); color: var(--danger); border: 1px solid rgba(255, 91, 106, .3); }
.btn-success { background: rgba(47, 191, 143, .12); color: var(--success); border: 1px solid rgba(47, 191, 143, .3); }
.btn-sm { height: auto; padding: 6px 16px; font-size: 13px; border-radius: 10px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 14px;
  background: rgba(255, 255, 255, .8);
  border: 1px solid #e3e8f2; border-radius: 10px;
  font-size: 14px; color: var(--text); outline: none;
  transition: border .2s, box-shadow .2s;
}
.textarea { height: auto; min-height: 90px; padding: 10px 14px; resize: vertical; font-family: inherit; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91, 127, 255, .12); }
.form-item { margin-bottom: 14px; }
.form-label { font-size: 13px; color: var(--text-sub); margin-bottom: 6px; display: block; }
.form-err { font-size: 12px; color: var(--danger); margin-top: 4px; }

.switch { position: relative; width: 44px; height: 24px; display: inline-block; }
.switch input { display: none; }
.switch .track { position: absolute; inset: 0; background: #d5dbe8; border-radius: 24px; transition: .25s; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: .25s; box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.switch input:checked + .track { background: var(--grad); }
.switch input:checked + .track::after { left: 23px; }

.table-wrap { overflow-x: auto; border-radius: 12px; }
table.ktable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.ktable th { text-align: left; padding: 14px 16px; color: var(--text); font-weight: 600; font-size: 13px; background: rgba(255,255,255,.5); border-bottom: 1px solid var(--border); white-space: nowrap; }
.ktable td { padding: 14px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; max-width: 240px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.ktable tr:hover td { background: rgba(64,158,255,.04); }
.ktable .ops { display: flex; gap: 8px; max-width: none; overflow: visible; }
.ktable .ops .btn { flex: none; }
.ktable td.wrap { white-space: normal; word-break: break-all; }

.tag { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; }
.tag::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag-green { background: rgba(47,191,143,.12); color: var(--success); }
.tag-orange { background: rgba(245,166,35,.14); color: var(--warning); }
.tag-gray { background: rgba(138,147,168,.14); color: var(--text-sub); }
.tag-red { background: rgba(255,91,106,.12); color: var(--danger); }
.tag-blue { background: rgba(64,158,255,.12); color: var(--primary); }

.pager { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
.pager .pg-btn { min-width: 34px; height: auto; padding: 6px 12px; border-radius: 10px; border: none; background: rgba(255,255,255,.6); font-size: 13px; font-weight: 500; cursor: pointer; color: #606266; transition: all .2s ease; }
.pager .pg-btn:hover { background: rgba(64,158,255,.1); color: var(--primary); }
.pager .pg-btn.on { background: var(--grad); color: #fff; box-shadow: 0 4px 12px rgba(64,158,255,.3); }
.pager .pg-btn:disabled { opacity: .4; cursor: not-allowed; }
.pager .pg-jump { width: 48px; padding: 5px 8px; text-align: center; border: 1px solid rgba(0,0,0,.08); border-radius: 8px; font-size: 13px; outline: none; background: rgba(255,255,255,.6); color: #4a5568; }
.pager .pg-jump:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(64,158,255,.1); }
.pager .pg-info { font-size: 13px; color: var(--text-sub); margin: 0 4px; }

.toast-box { position: fixed; top: 84px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px;
  min-width: 180px; max-width: 300px; padding: 12px 16px;
  background: var(--card-solid); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-radius: 16px; box-shadow: 0 12px 40px rgba(31,38,135,.12);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  font-size: 14px; animation: toastIn .4s cubic-bezier(.175, .885, .32, 1.275);
  pointer-events: auto;
}
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warning); }
.toast .ticon { width: 20px; height: 20px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; }
.toast.ok .ticon { background: var(--success); }
.toast.err .ticon { background: var(--danger); }
.toast.warn .ticon { background: var(--warning); }
@keyframes toastIn { from { opacity: 0; transform: translateX(120%); } to { opacity: 1; transform: none; } }
.toast.out { animation: toastOut .3s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }

.modal-mask {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(43, 50, 69, .35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fadeIn .2s ease;
}
.modal {
  width: 520px; max-width: 100%; max-height: 85vh; margin-top: 4vh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--card-solid); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  border-radius: 24px; border: 1px solid var(--border);
  box-shadow: 0 20px 60px rgba(31,38,135,.15), 0 0 0 1px rgba(255,255,255,.3) inset;
  animation: modalIn .35s cubic-bezier(.34, 1.56, .64, 1);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 22px 28px 0; flex: none; }
.modal-body { padding: 16px 28px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 28px 20px; flex: none; border-top: 1px solid var(--border); }
.modal-head h3 { font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 10px; color: var(--text); }
.modal-close { width: 36px; height: 36px; border: none; background: rgba(144,147,153,.12); border-radius: 12px; cursor: pointer; font-size: 16px; color: var(--text-sub); transition: all .25s ease; display: flex; align-items: center; justify-content: center; flex: none; }
.modal-close:hover { background: rgba(245,108,108,.15); color: var(--danger); transform: rotate(90deg); }
.modal-body::-webkit-scrollbar { width: 6px; }
.modal-body::-webkit-scrollbar-track { background: transparent; }
.modal-body::-webkit-scrollbar-thumb { background: rgba(144,147,153,.3); border-radius: 3px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: scale(.9) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } }

.empty { text-align: center; padding: 40px 0; color: var(--text-sub); font-size: 14px; }
.empty .eicon { width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 16px; background: rgba(64,158,255,.08); position: relative; }
.empty .eicon::before, .empty .eicon::after { content: ''; position: absolute; background: rgba(64,158,255,.35); border-radius: 4px; }
.empty .eicon::before { width: 28px; height: 4px; left: 14px; top: 20px; }
.empty .eicon::after { width: 20px; height: 4px; left: 18px; top: 30px; }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filter-bar .input, .filter-bar .select { width: auto; min-width: 140px; flex: 0 1 auto; }
.filter-bar .btn { flex: none; }

.grid-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-card { padding: 16px 18px; }
.stat-card .s-label { font-size: 13px; color: var(--text-sub); }
.stat-card .s-value { font-size: 26px; font-weight: 700; margin-top: 6px; }
.stat-card .s-sub { font-size: 12px; color: var(--text-sub); margin-top: 4px; }
.stat-card .s-value.warn { color: var(--warning); }

.rich-content { line-height: 1.8; font-size: 14px; word-break: break-all; }
.rich-content img { max-width: 100%; border-radius: 10px; }
.rich-content p { margin-bottom: 8px; }

@media (max-width: 900px) {
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .toast-box { top: 88px; right: 12px; left: auto; transform: none; width: auto; max-width: 78vw; align-items: flex-end; }
  .toast { min-width: 0; max-width: 80vw; width: auto; padding: 10px 14px; border-radius: 12px; font-size: 13px; }
  .modal-mask { padding: 16px; }
  .modal { width: 100%; max-height: 85vh; border-radius: 20px; }
  .modal-head { padding: 18px 20px 0; }
  .modal-body { padding: 14px 20px; }
  .modal-foot { padding: 10px 20px 16px; }
  .filter-bar .input, .filter-bar .select { min-width: 0; flex: 1 1 45%; }
  .card { padding: 16px 14px; }
  .grid-stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
