/* ============================================================
   AuraKernel 网页授权工具 · 样式
   ============================================================ */
:root {
  --bg: #f3f5f9;
  --card: #ffffff;
  --border: #e5e9f2;
  --text: #1f2937;
  --muted: #8a93a6;
  --primary: #4f6ef7;
  --primary-dark: #3d5ae0;
  --green: #16a34a;
  --green-bg: #e8f7ee;
  --orange: #d97706;
  --orange-bg: #fdf3e3;
  --red: #dc2626;
  --red-bg: #fdecec;
  --gray-bg: #eef0f4;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
code {
  background: #f1f3f8;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: Consolas, Menlo, monospace;
  font-size: 12.5px;
  word-break: break-all;
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { color: var(--red); border-color: #f3c1c1; }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--border); }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 输入 ---------- */
.input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,110,247,.12); }
.input-search { max-width: 260px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 13px; color: #4b5563; }
.form-group label em { color: var(--red); font-style: normal; }
.form-row { display: grid; grid-template-columns: 1.2fr 1.1fr 1.1fr auto; gap: 14px; align-items: end; }
.form-group-btn { margin-bottom: 14px; }
.checkbox { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #4b5563; cursor: pointer; white-space: nowrap; padding-left: 10px; }
.expire-row { display: flex; align-items: center; gap: 4px; }

/* ---------- 布局 ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.brand { font-size: 17px; font-weight: 700; }
.brand span { color: var(--muted); font-weight: 400; font-size: 13px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.chip {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--gray-bg); color: #4b5563; white-space: nowrap;
}
.chip-ok { background: var(--green-bg); color: var(--green); }
.chip-warn { background: var(--orange-bg); color: var(--orange); }
.chip-bad { background: var(--red-bg); color: var(--red); }
.chip-muted { background: var(--gray-bg); color: var(--muted); }
.logout-form { margin: 0; }

.container { max-width: 1100px; margin: 24px auto 60px; padding: 0 20px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; }
.hint { font-size: 12px; color: var(--muted); }

/* ---------- 提示 ---------- */
.alert {
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13.5px;
  border: 1px solid transparent;
}
.alert-success { background: var(--green-bg); color: var(--green); border-color: #b9e7c9; }
.alert-error { background: var(--red-bg); color: var(--red); border-color: #f3c1c1; }
.alert-warn { background: var(--orange-bg); color: var(--orange); border-color: #f0d5a8; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 500; font-size: 12.5px; white-space: nowrap; }
.table tbody tr:hover { background: #f8faff; }
.table .ip { font-family: Consolas, Menlo, monospace; }
.table .empty { text-align: center; color: var(--muted); padding: 28px 0; }
.cell-date { white-space: nowrap; }
.cell-note { max-width: 180px; }
.sub { font-size: 11.5px; }
.sub.warn { color: var(--orange); }
.ops { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ops form { margin: 0; }
.th-ops { min-width: 300px; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; white-space: nowrap;
}
.badge-active { background: var(--green-bg); color: var(--green); }
.badge-expiring { background: var(--orange-bg); color: var(--orange); }
.badge-expired { background: var(--red-bg); color: var(--red); }
.badge-revoked { background: var(--gray-bg); color: var(--muted); }

/* ---------- 弹窗 ---------- */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15,23,42,.5);
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal.open { display: flex; }
.modal-box {
  background: #fff; border-radius: 14px; width: 100%; max-width: 620px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
  animation: pop .18s ease;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 15px; }
.modal-close { background: none; border: none; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.modal-tip { font-size: 13px; color: #4b5563; margin-bottom: 12px; }
.lic-text {
  width: 100%; height: 150px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  font-family: Consolas, Menlo, monospace; font-size: 11.5px;
  background: #f8fafc; color: #111; resize: none; outline: none; word-break: break-all;
}

/* ---------- 登录页 ---------- */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.login-card {
  width: 100%; max-width: 380px; background: #fff;
  border: 1px solid var(--border); border-radius: 16px;
  box-shadow: var(--shadow); padding: 36px 32px; text-align: center;
}
.login-logo { font-size: 42px; margin-bottom: 6px; }
.login-title { font-size: 20px; margin-bottom: 4px; }
.login-sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login-card .alert { text-align: left; }
.login-card form { text-align: left; }

/* ---------- 其他 ---------- */
.footer { text-align: center; color: var(--muted); font-size: 12px; margin-top: 30px; }
#toast {
  position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%) translateY(20px);
  background: #111827; color: #fff; padding: 9px 18px; border-radius: 8px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 999;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 响应式 ---------- */
@media (max-width: 820px) {
  .form-row { grid-template-columns: 1fr; }
  .chips { margin-left: 0; }
  .card-head { flex-direction: column; align-items: flex-start; }
  .input-search { max-width: 100%; }
}
