:root{
  --bg:#f6f4fb;
  --card:#ffffff;
  --border:#E1DEEC;
  --text:#23262F;
  --muted:#8A8FA3;
  --primary:#6B74CA;      /* 蓝紫按钮 */
  --primary-weak:#E8EAFB;
  --green:#33C27F;        /* 新建/保存 */
  --ring: rgba(107,116,202,.35);
}

*{box-sizing:border-box}
html,body{margin:0;height:100%;font-family:Inter,system-ui,Segoe UI,Roboto,PingFang SC,Microsoft YaHei,Arial}
body{background:var(--bg);color:var(--text)}

.page{max-width:1200px;margin:0 auto;padding:20px}
.page-head{margin-bottom:12px}
.page-head .title{font-weight:700;font-size:20px;margin-bottom:12px;color:#3b3f56}

.tabs{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.tab{
  display:inline-flex;align-items:center;gap:8px;padding:8px 12px;
  background:var(--tab-bg, #fff);border:1px solid var(--border);border-radius:16px;text-decoration:none;
  color:#3b3f56;box-shadow:0 1px 0 rgba(0,0,0,.03);
}
.tab .dot{width:10px;height:10px;border-radius:50%;}
.tab .check-icon{
  flex-shrink:0;
  stroke:var(--green);
}
.tab.active{
  background:var(--tab-bg, #fff);
  border-color:var(--tab-color, var(--primary));
  filter:brightness(0.75) saturate(1.3);
}
.tab.disabled{opacity:.55}
.btn{
  border:1px solid var(--border);
  background:#fff;
  color:#3b3f56;
  padding:8px 12px;
  border-radius:12px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.btn svg{
  flex-shrink:0;
}
.btn:hover{box-shadow:0 0 0 3px var(--ring)}
.btn-ghost{background:#f0f1f8}
.btn-primary{background:var(--primary);border-color:var(--primary);color:#fff}
.btn-new{background:#ECF8F1;border-color:#BDEED4;color:#1E8F5B}
.btn-green{background:var(--green);border-color:var(--green);color:#fff}

.card{
  background:var(--card);border:1px solid var(--border);border-radius:16px;
  padding:16px;margin:14px 0;box-shadow:0 6px 18px rgba(37,44,97,.06);
}
.block{padding:0}
.block .block-head{
  display:flex;align-items:center;gap:12px;padding:14px 16px;border-bottom:1px solid var(--border);
}
.block .actions{margin-left:auto;display:flex;gap:10px}
.muted{color:var(--muted)}

.form-grid{
  display:grid;grid-template-columns:1fr;gap:10px;padding:16px;
}
@media (min-width:900px){ .form-grid{ grid-template-columns: repeat(2, 1fr); } }

.form-item{display:block;margin:12px 16px}
.form-item>label{display:block;margin-bottom:6px;color:#43485c;font-size:13px}
input,textarea{
  width:100%;padding:12px;border-radius:12px;border:1px solid var(--border);
  background:#fff;color:var(--text);outline:none;
}
input:focus,textarea:focus{box-shadow:0 0 0 3px var(--ring);border-color:var(--primary)}
textarea{resize:vertical}

.style-row{
  display:flex;align-items:center;gap:12px;padding:8px 16px 16px 16px;flex-wrap:wrap
}
.style-item{display:flex;align-items:center;gap:10px}
.chk{display:flex;align-items:center;gap:6px;color:#43485c}

/* Switch */
.switch{position:relative;width:52px;height:30px}
.switch input{display:none}
.switch span{
  position:absolute;inset:0;background:#E4E7F0;border-radius:999px;transition:.2s;border:1px solid var(--border)
}
.switch span::after{
  content:"";position:absolute;top:3px;left:3px;width:24px;height:24px;border-radius:50%;
  background:#fff;box-shadow:0 1px 2px rgba(0,0,0,.15);transition:.2s
}
.switch input:checked + span{background:var(--primary)}
.switch input:checked + span::after{transform:translateX(22px)}

.group-title{
  font-weight:700;
  color:#5a5f7e;
  margin:6px 2px 10px 2px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.btn-sm{
  padding:4px 8px;
  font-size:12px;
}

.btn-row{display:flex;gap:10px;align-items:center;margin:8px 16px;flex-wrap:wrap}
.inline{display:inline}

/* 只读输出框样式 */
textarea[readonly]{
  background:#f8f9fa;
  color:#495057;
  cursor:text;
  user-select:all;
}

/* 复制按钮响应式效果 */
.btn:active{
  transform:scale(0.98);
}

/* 容器响应式 */
@media (max-width:600px){
  .btn-row{
    flex-direction:column;
    align-items:stretch;
  }
  .btn-row .btn{
    width:100%;
  }
}

/* 域名输入和标签 */
.domain-input-row{
  display:flex;
  gap:10px;
  margin-bottom:10px;
}
.domain-tags{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-top:10px;
}
.tag{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  background:var(--primary-weak);
  border:1px solid var(--primary);
  border-radius:12px;
  font-size:13px;
  color:var(--primary);
}
.tag-remove{
  background:none;
  border:none;
  color:var(--primary);
  cursor:pointer;
  font-size:18px;
  line-height:1;
  padding:0;
  margin:0;
  width:16px;
  height:16px;
}
.tag-remove:hover{
  color:#c33;
}

/* 删除按钮 */
.btn-danger{
  background:#dc3545;
  border-color:#dc3545;
  color:#fff;
}
.btn-danger:hover{
  box-shadow:0 0 0 3px rgba(220,53,69,.25);
}

/* 模态框 */
.modal{
  display:none;
  position:fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background:rgba(0,0,0,0.5);
  z-index:1000;
  align-items:center;
  justify-content:center;
}
.modal.show{
  display:flex;
}
.modal-content{
  background:#fff;
  border-radius:16px;
  width:90%;
  max-width:800px;
  max-height:80vh;
  display:flex;
  flex-direction:column;
}
.modal-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:16px 20px;
  border-bottom:1px solid var(--border);
}
.modal-header h3{
  margin:0;
  font-size:18px;
}
.modal-close{
  background:none;
  border:none;
  font-size:24px;
  cursor:pointer;
  color:#666;
  padding:0;
  width:30px;
  height:30px;
}
.modal-body{
  padding:20px;
  overflow-y:auto;
  flex:1;
}
.modal-footer{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:16px 20px;
  border-top:1px solid var(--border);
}

/* 历史记录项 */
.history-item{
  padding:12px;
  border:1px solid var(--border);
  border-radius:8px;
  margin-bottom:10px;
}
.history-item:hover{
  background:#f8f9fa;
}
.history-meta{
  display:flex;
  justify-content:space-between;
  margin-bottom:8px;
  font-size:13px;
  color:var(--muted);
}
.history-data{
  font-size:12px;
  color:#666;
  line-height:1.6;
}
.history-actions{
  margin-top:8px;
}

/* 自定义提示框 */
.toast{
  position:fixed;
  top:20px;
  right:20px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:12px;
  padding:16px 20px;
  box-shadow:0 6px 18px rgba(37,44,97,.15);
  z-index:2000;
  display:none;
  min-width:300px;
  animation:slideIn 0.3s ease;
}
.toast.show{
  display:block;
}
.toast.success{
  border-left:4px solid var(--green);
}
.toast.error{
  border-left:4px solid #dc3545;
}
.toast.warning{
  border-left:4px solid #ffc107;
}
@keyframes slideIn{
  from{transform:translateX(400px);opacity:0}
  to{transform:translateX(0);opacity:1}
}

/* 全局Loading */
.global-loading{
  position:fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background:rgba(0,0,0,.5);
  display:none;
  align-items:center;
  justify-content:center;
  z-index:3000;
  flex-direction:column;
  gap:16px;
}
.global-loading.show{
  display:flex;
}
.spinner{
  width:48px;
  height:48px;
  border:4px solid rgba(255,255,255,.3);
  border-top-color:#fff;
  border-radius:50%;
  animation:spin 0.8s linear infinite;
}
.loading-text{
  color:#fff;
  font-size:16px;
  font-weight:500;
}
@keyframes spin{
  to{transform:rotate(360deg)}
}

/* 自定义确认对话框 */
.confirm-dialog{
  display:none;
  position:fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background:rgba(0,0,0,0.5);
  z-index:2001;
  align-items:center;
  justify-content:center;
}
.confirm-dialog.show{
  display:flex;
}
.confirm-dialog-content{
  background:#fff;
  border-radius:16px;
  padding:24px;
  max-width:400px;
  width:90%;
}
.confirm-dialog-title{
  font-size:18px;
  font-weight:700;
  margin-bottom:12px;
  color:#23262F;
}
.confirm-dialog-message{
  margin-bottom:20px;
  color:#666;
  line-height:1.6;
}
.confirm-dialog-input{
  width:100%;
  padding:10px;
  border:1px solid var(--border);
  border-radius:8px;
  margin-bottom:16px;
  outline:none;
}
.confirm-dialog-input:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 3px var(--ring);
}
.confirm-dialog-buttons{
  display:flex;
  gap:10px;
  justify-content:flex-end;
}
.confirm-dialog-buttons .btn{
  min-width:80px;
}

/* 文本历史记录项 */
.text-history-item{
  padding:12px;
  border:1px solid var(--border);
  border-radius:8px;
  margin-bottom:10px;
  transition:all 0.2s;
}
.text-history-item:hover{
  background:#f8f9fa;
  border-color:var(--primary);
}
.text-history-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:6px;
}
.text-history-time{
  font-size:12px;
  color:var(--muted);
}
.btn-delete-history{
  background:none;
  border:none;
  color:#dc3545;
  font-size:20px;
  cursor:pointer;
  padding:0;
  width:24px;
  height:24px;
  line-height:1;
  border-radius:4px;
  transition:all 0.2s;
}
.btn-delete-history:hover{
  background:#dc3545;
  color:#fff;
}
.text-history-content{
  font-size:13px;
  color:#333;
  cursor:pointer;
}
.text-history-preview{
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.text-history-label{
  font-weight:600;
  color:#666;
  margin-right:6px;
}

/* SVG Switch */
.svg-switch { cursor: pointer; }
.svg-switch-icon { color: #ccc; }
.svg-switch-check { display: none; }
.svg-switch[data-checked="true"] .svg-switch-icon { color: var(--green); }
.svg-switch[data-checked="true"] .svg-switch-check { display: block; }
