/* 祺航 License 管理后台 —— 浅色主题 */
:root {
  --brand: #3370ff;
  --brand-dark: #245bdb;
  --brand-bg: #eef4ff;
  --bg: #f5f6fa;
  --card: #ffffff;
  --ink: #1f2329;
  --ink-2: #4e5561;
  --ink-3: #8a919e;
  --line: #e5e7ee;
  --green: #00b96b;
  --green-bg: #e6f9f0;
  --red: #e34d59;
  --red-bg: #fdecee;
  --orange: #ff8800;
  --orange-bg: #fff5e6;
  --gray-bg: #f0f1f5;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(31, 35, 41, 0.06);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
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(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
.mono { font-family: "SF Mono", Menlo, Consolas, "Courier New", monospace; }

.boot { padding: 80px; text-align: center; color: var(--ink-3); }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #eef4ff 0%, #f5f6fa 55%, #e6f9f0 100%);
}
.login-card {
  width: 380px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(31, 35, 41, 0.1);
  padding: 44px 40px 36px;
}
.login-logo {
  width: 60px; height: 60px; border-radius: 16px;
  background: linear-gradient(135deg, #3370ff, #00b96b);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  color: #fff; font-size: 28px; font-weight: 700;
}
.login-title { text-align: center; font-size: 20px; font-weight: 600; }
.login-sub { text-align: center; color: var(--ink-3); font-size: 13px; margin: 6px 0 28px; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  padding: 20px 20px 16px;
  font-size: 17px; font-weight: 700;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-brand .dot {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, #3370ff, #00b96b);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 15px;
}
.nav { padding: 12px 10px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--ink-2); cursor: pointer;
  margin-bottom: 2px; font-size: 14px;
}
.nav-item:hover { background: var(--gray-bg); }
.nav-item.active { background: var(--brand-bg); color: var(--brand-dark); font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 12px; }

.main { flex: 1; min-width: 0; }
.topbar {
  height: 56px; background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 10;
}
.topbar-title { font-size: 16px; font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: 13px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 13px;
}
.content { padding: 24px; max-width: 1200px; }

/* ---------- 卡片与统计 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 20px;
}
.card-title { font-size: 15px; font-weight: 600; margin-bottom: 14px; display: flex; justify-content: space-between; align-items: center; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.stat-num { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat-label { color: var(--ink-3); font-size: 13px; }
.stat-card.green .stat-num { color: var(--green); }
.stat-card.red .stat-num { color: var(--red); }
.stat-card.orange .stat-num { color: var(--orange); }
.stat-card.blue .stat-num { color: var(--brand); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; color: var(--ink-3); font-weight: 500;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: #fafbfc;
}
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:hover td { background: #fafbfc; }
.tbl tr:last-child td { border-bottom: none; }
.empty { text-align: center; color: var(--ink-3); padding: 40px 0; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 20px;
  font-size: 12px; line-height: 20px; white-space: nowrap;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red { background: var(--red-bg); color: var(--red); }
.badge-orange { background: var(--orange-bg); color: var(--orange); }
.badge-gray { background: var(--gray-bg); color: var(--ink-2); }
.badge-blue { background: var(--brand-bg); color: var(--brand-dark); }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; cursor: pointer; border-radius: 8px;
  padding: 8px 16px; font-size: 13px; font-weight: 500;
  background: var(--gray-bg); color: var(--ink-2);
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }
.btn-sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; padding: 11px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field-label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.field-label .req { color: var(--red); margin-right: 2px; }
.input, .select {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; background: #fff; color: var(--ink);
  outline: none; transition: border-color .15s;
}
.input:focus, .select:focus { border-color: var(--brand); }
.input:disabled { background: var(--gray-bg); color: var(--ink-3); }
.radio-row { display: flex; gap: 18px; }
.radio-row label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 14px; }
.form-tip { font-size: 12px; color: var(--ink-3); margin-top: 5px; line-height: 1.6; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filter-bar .field { margin-bottom: 0; }
.filter-bar .input, .filter-bar .select { width: 170px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(31, 35, 41, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal {
  background: var(--card); border-radius: 14px;
  width: 560px; max-width: 100%; max-height: 88vh;
  display: flex; flex-direction: column;
  box-shadow: 0 12px 48px rgba(31, 35, 41, 0.18);
}
.modal-head { padding: 18px 24px 0; font-size: 16px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.modal-body { padding: 18px 24px; overflow-y: auto; }
.modal-foot { padding: 14px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; }
.modal-close { cursor: pointer; color: var(--ink-3); font-size: 20px; line-height: 1; border: none; background: none; }
.modal-close:hover { color: var(--ink); }

/* ---------- Toast ---------- */
#toast-root { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200; }
.toast {
  background: var(--ink); color: #fff;
  padding: 10px 20px; border-radius: 8px; font-size: 13px;
  box-shadow: 0 6px 24px rgba(0,0,0,.2);
  animation: toast-in .2s ease;
  max-width: 70vw;
}
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* ---------- 其他 ---------- */
.pager { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin-top: 14px; color: var(--ink-3); font-size: 13px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 24px; }
.kv { display: flex; padding: 10px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv .k { width: 110px; flex-shrink: 0; color: var(--ink-3); }
.kv .v { flex: 1; word-break: break-all; }
.code-box {
  background: #f7f8fa; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 12px; font-size: 13px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  word-break: break-all; position: relative;
}
pre.pre-box {
  background: #f7f8fa; border: 1px solid var(--line); border-radius: 8px;
  padding: 12px; font-size: 12px; line-height: 1.7;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  white-space: pre-wrap; word-break: break-all; max-height: 180px; overflow-y: auto;
}
.result-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px;
}
.result-item .code { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 14px; letter-spacing: 1px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.linklike { color: var(--brand); cursor: pointer; }
.linklike:hover { text-decoration: underline; }
.text-muted { color: var(--ink-3); font-size: 12px; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; }
.flex { display: flex; align-items: center; gap: 8px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .sidebar { width: 64px; }
  .sidebar-brand span:last-child, .nav-item span:last-child, .sidebar-foot { display: none; }
  .content { padding: 14px; }
}
