/* ============================================================
   小智AI 客户端 —— 控制台样式
   ============================================================ */
:root {
  --brand:        #10a37f;
  --brand-dark:   #0b8a6b;
  --brand-light:  #e6f7f2;
  --brand-ring:   rgba(16,163,127,.18);

  --bg:           #f4f7f6;
  --surface:      #ffffff;
  --surface-2:    #fafcfb;
  --border:       #e5ebe8;
  --border-strong:#d3ddd8;

  --text:         #17211d;
  --text-2:       #5b6b64;
  --text-3:       #8a9a93;

  --danger:       #e5484d;
  --danger-bg:    #fdf0f0;
  --warn:         #d97706;
  --warn-bg:      #fef7ec;
  --info:         #2563eb;
  --info-bg:      #eff4ff;

  --sidebar-bg:   #10201b;
  --sidebar-bg-2: #0b1815;
  --sidebar-text: #9db3ab;
  --sidebar-active: #10a37f;

  --radius:   12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16,32,27,.05);
  --shadow:    0 2px 8px rgba(16,32,27,.06), 0 1px 2px rgba(16,32,27,.04);
  --shadow-lg: 0 12px 32px rgba(16,32,27,.12);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }
h1,h2,h3,h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
p { margin: 0 0 10px; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }

/* ---------------- 布局 ---------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px; flex: 0 0 232px;
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 20px 18px 18px;
  color: #fff; font-weight: 650; font-size: 15.5px;
  letter-spacing: .2px;
}
.sidebar__logo {
  width: 32px; height: 32px; border-radius: 9px; flex: 0 0 32px;
  background: linear-gradient(135deg, #16c79a, #0b8a6b);
  display: grid; place-items: center;
  box-shadow: 0 2px 10px rgba(16,163,127,.4);
}
.sidebar__logo svg { width: 18px; height: 18px; }
.sidebar__sub { font-size: 11px; color: var(--sidebar-text); font-weight: 400; }

.nav { padding: 6px 10px; overflow-y: auto; flex: 1; }
.nav__group { font-size: 11px; color: #5d726a; padding: 14px 10px 6px; letter-spacing: .06em; }
.nav__item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-size: 13.5px;
  transition: background .15s, color .15s;
}
.nav__item:hover { background: rgba(255,255,255,.05); color: #e6f2ee; }
.nav__item.is-active { background: rgba(16,163,127,.16); color: #fff; font-weight: 550; }
.nav__item.is-active .nav__icon { color: var(--sidebar-active); }
.nav__icon { width: 17px; height: 17px; flex: 0 0 17px; opacity: .95; }

.sidebar__foot { padding: 12px 14px 16px; border-top: 1px solid rgba(255,255,255,.07); }
.sidebar__user { display: flex; align-items: center; gap: 9px; color: #cfe0da; font-size: 13px; }
.sidebar__avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: 0 0 28px;
  background: rgba(16,163,127,.25); color: #6fe3c0;
  display: grid; place-items: center; font-size: 12px; font-weight: 600;
}
.sidebar__logout { margin-left: auto; color: #7b9089; font-size: 12px; }
.sidebar__logout:hover { color: #ff8a8a; }
.sidebar__links { display: flex; gap: 14px; margin-top: 11px; padding-left: 2px; }
.sidebar__links a { font-size: 12px; color: #7b9089; }
.sidebar__links a:hover { color: #6fe3c0; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; display: flex; align-items: center; gap: 14px;
  padding: 0 26px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar__title { font-size: 16px; font-weight: 650; }
.topbar__desc { font-size: 12.5px; color: var(--text-3); }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.content { padding: 24px 26px 60px; flex: 1; }
.content--wide { max-width: 1400px; }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  margin-bottom: 18px; overflow: hidden;
}
.card__head {
  padding: 15px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
}
.card__title { font-size: 14.5px; font-weight: 640; }
.card__desc { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.card__actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card__body { padding: 18px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 13.5px; font-family: inherit; font-weight: 520;
  cursor: pointer; transition: all .15s; white-space: nowrap; line-height: 1.4;
}
.btn:hover { border-color: #b9c7c1; background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 1px 2px rgba(16,163,127,.3);
}
.btn--primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn--danger { color: var(--danger); border-color: #f0c9c9; background: #fff; }
.btn--danger:hover { background: var(--danger-bg); border-color: #e8a8a8; }
.btn--ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn--sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn--lg { padding: 11px 22px; font-size: 14.5px; }
.btn--block { width: 100%; }
.btn--icon { padding: 6px 8px; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 16px; }
.field__label {
  display: block; font-size: 13px; font-weight: 560;
  margin-bottom: 6px; color: var(--text);
}
.field__label .req { color: var(--danger); margin-left: 2px; }
.field__hint { font-size: 12px; color: var(--text-3); margin-top: 5px; line-height: 1.5; }
.input, .select, .textarea {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: inherit; color: var(--text);
  background: var(--surface); transition: border-color .15s, box-shadow .15s;
  line-height: 1.5;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.input::placeholder, .textarea::placeholder { color: #a9b6b1; }
.textarea { resize: vertical; min-height: 96px; line-height: 1.65; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a9a93' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  padding-right: 34px;
}
.input--sm { padding: 6px 10px; font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
@media (max-width: 900px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch__track {
  width: 38px; height: 22px; border-radius: 11px; background: #cfdad5;
  position: relative; transition: background .2s; flex: 0 0 38px;
}
.switch__track::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + .switch__track { background: var(--brand); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch__text { font-size: 13.5px; }

/* ---------------- 表格 ---------------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 580; font-size: 12.5px; color: var(--text-2);
  padding: 11px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fbfdfc; }
.table__main { font-weight: 550; color: var(--text); }
.table__sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.table__actions { display: flex; gap: 6px; justify-content: flex-end; }
.table-wrap { overflow-x: auto; }

/* ---------------- 徽章 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 540; line-height: 1.7; white-space: nowrap;
}
.badge--success { background: var(--brand-light); color: #0a7a5f; }
.badge--muted   { background: #eff3f1; color: var(--text-3); }
.badge--danger  { background: var(--danger-bg); color: #b3383c; }
.badge--warn    { background: var(--warn-bg); color: #a35c05; }
.badge--info    { background: var(--info-bg); color: #1d4ed8; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---------------- 提示条 ---------------- */
.alert {
  display: flex; gap: 10px; padding: 12px 15px; border-radius: var(--radius-sm);
  font-size: 13.5px; margin-bottom: 16px; align-items: flex-start; line-height: 1.6;
}
.alert--success { background: var(--brand-light); color: #0a6b53; }
.alert--error   { background: var(--danger-bg); color: #a13038; }
.alert--warn    { background: var(--warn-bg); color: #92520a; }
.alert--info    { background: var(--info-bg); color: #1e40af; }
.alert__icon { flex: 0 0 16px; margin-top: 2px; }

/* ---------------- 统计卡 ---------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-sm);
}
.stat__label { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.stat__value { font-size: 26px; font-weight: 660; margin-top: 6px; letter-spacing: -.02em; }
.stat__unit { font-size: 13px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.stat__foot { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* ---------------- 空状态 ---------------- */
.empty { text-align: center; padding: 52px 20px; color: var(--text-3); }
.empty__icon {
  width: 52px; height: 52px; margin: 0 auto 14px; border-radius: 50%;
  background: var(--surface-2); display: grid; place-items: center; color: var(--border-strong);
}
.empty__title { font-size: 14.5px; color: var(--text-2); font-weight: 550; margin-bottom: 5px; }
.empty__desc { font-size: 13px; margin-bottom: 16px; }

/* ---------------- 模态框 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,28,24,.42);
  display: none; align-items: flex-start; justify-content: center;
  padding: 60px 20px; z-index: 100; overflow-y: auto;
  backdrop-filter: blur(2px);
}
.modal-mask.is-open { display: flex; }
.modal {
  background: var(--surface); border-radius: var(--radius-lg);
  width: 100%; max-width: 560px; box-shadow: var(--shadow-lg);
  animation: modalIn .18s ease-out;
}
.modal--lg { max-width: 720px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(-8px) scale(.99); } }
.modal__head {
  padding: 18px 22px 14px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
}
.modal__title { font-size: 16px; font-weight: 650; }
.modal__close {
  margin-left: auto; background: none; border: none; cursor: pointer;
  color: var(--text-3); padding: 4px; border-radius: 6px; line-height: 1;
}
.modal__close:hover { background: var(--surface-2); color: var(--text); }
.modal__body { padding: 20px 22px; max-height: calc(100vh - 260px); overflow-y: auto; }
.modal__foot {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; gap: 9px; justify-content: flex-end; background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ---------------- 分页 ---------------- */
.pager { display: flex; gap: 5px; justify-content: center; padding: 18px; align-items: center; }
.pager a, .pager span {
  min-width: 33px; height: 33px; padding: 0 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text-2);
}
.pager a:hover { border-color: var(--brand); color: var(--brand); }
.pager .is-current { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 560; }
.pager .is-disabled { opacity: .45; }

/* ---------------- 代码块 ---------------- */
.code {
  background: #10201b; color: #cfe6dd; border-radius: var(--radius-sm);
  padding: 14px 16px; font-family: var(--mono); font-size: 12.5px;
  line-height: 1.75; overflow-x: auto; white-space: pre;
}
.code--light { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }

/* ---------------- 工具类 ---------------- */
.row { display: flex; align-items: center; gap: 10px; }
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}
.text-2{color:var(--text-2)}.text-3{color:var(--text-3)}
.text-sm{font-size:12.5px}.text-xs{font-size:11.5px}
.text-center{text-align:center}.text-right{text-align:right}
.fw-600{font-weight:600}
.hidden{display:none !important}
.mono-sm{font-family:var(--mono);font-size:12px;color:var(--text-2)}
.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ---------------- 登录页 ---------------- */
.auth-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 30px 20px;
  background: linear-gradient(160deg, #0e1f1a 0%, #123328 55%, #0d2a22 100%);
  position: relative; overflow: hidden;
}
.auth-wrap::before {
  content: ''; position: absolute; width: 620px; height: 620px; border-radius: 50%;
  background: radial-gradient(circle, rgba(16,163,127,.28), transparent 65%);
  top: -220px; right: -180px;
}
.auth-wrap::after {
  content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(16,163,127,.16), transparent 65%);
  bottom: -220px; left: -160px;
}
.auth-card {
  position: relative; width: 100%; max-width: 400px;
  background: rgba(255,255,255,.985); border-radius: 18px;
  padding: 34px 32px 28px; box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.auth-card--wide { max-width: 440px; }
.auth__logo {
  width: 50px; height: 50px; border-radius: 14px; margin: 0 auto 14px;
  background: linear-gradient(135deg, #16c79a, #0b8a6b);
  display: grid; place-items: center; box-shadow: 0 6px 20px rgba(16,163,127,.4);
}
.auth__logo svg { width: 26px; height: 26px; }
.auth__title { text-align: center; font-size: 21px; font-weight: 660; margin-bottom: 4px; }
.auth__sub { text-align: center; font-size: 13px; color: var(--text-3); margin-bottom: 26px; }
.auth__foot { text-align: center; font-size: 13px; color: var(--text-2); margin-top: 18px; }
.auth__sep { color: var(--text-3); margin: 0 6px; }
.auth__tips {
  margin-top: 20px; padding: 12px 14px; background: var(--brand-light);
  border-radius: var(--radius-sm); font-size: 12.5px; color: #0a6b53; line-height: 1.7;
}

/* ---------------- 安装页 ---------------- */
.install-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 40px 20px; background: var(--bg);
}
.install-card {
  width: 100%; max-width: 660px; background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.install-card__head {
  padding: 26px 30px; background: linear-gradient(135deg, #10201b, #17453a); color: #fff;
}
.install-card__head h1 { font-size: 19px; }
.install-card__head p { font-size: 13px; color: #a9c8bd; margin: 5px 0 0; }
.install-steps { padding: 22px 30px; }
.install-step {
  display: flex; gap: 11px; padding: 10px 0; align-items: flex-start;
  border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.install-step:last-child { border-bottom: none; }
.install-step__icon { flex: 0 0 18px; margin-top: 1px; }
.install-step--ok .install-step__icon { color: var(--brand); }
.install-step--err .install-step__icon { color: var(--danger); }
.install-card__foot { padding: 18px 30px 26px; }
