/* Reset + 通用组件 */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  font-variant-numeric: tabular-nums;
  min-width: 1100px;
}

#app { height: 100%; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }

/* ---- buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 13px;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  white-space: nowrap;
}
.btn:hover { background: var(--panel-2); border-color: var(--border-strong); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn-danger:hover { filter: brightness(0.92); background: var(--crit); }

.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--panel-2); color: var(--text); }

.btn-sm { padding: 2px 8px; font-size: 12px; }

/* ---- inputs ---- */
input, select, textarea {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  font-size: 13px;
  font-family: var(--font);
  background: var(--panel);
  color: var(--text);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { resize: vertical; }
label { color: var(--text-2); font-size: 12px; }

/* ---- card ---- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* ---- badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  height: 18px;
  border-radius: 9px;
  font-size: 11px;
  background: var(--panel-2);
  color: var(--text-2);
}
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-crit { background: var(--crit-soft); color: var(--crit); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-ok { background: var(--ok-soft); color: var(--ok); }

/* ---- dialog ---- */
dialog {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  width: 560px;
  max-width: 92vw;
  box-shadow: var(--shadow-pop);
  color: var(--text);
}
dialog::backdrop { background: rgba(24, 24, 27, 0.4); }
dialog h3 { font-size: 15px; margin-bottom: 14px; }
.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 16px;
}

.form-row { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.form-row input, .form-row select { width: 100%; }
.form-error { color: var(--crit); font-size: 12px; min-height: 16px; }

/* ---- toast ---- */
#toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}
.toast {
  background: var(--text);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
  box-shadow: var(--shadow-pop);
  animation: toast-in var(--t-med) var(--ease);
  max-width: 360px;
}
.toast.error { background: var(--crit); }
.toast.ok { background: var(--ok); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- misc ---- */
.hidden { display: none !important; }
.muted { color: var(--text-3); }
.spin {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 进度条 */
.progress {
  height: 4px;
  border-radius: 2px;
  background: var(--panel-2);
  overflow: hidden;
}
.progress > i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  transition: width var(--t-med) var(--ease);
}
