/* ============================================================
   远银AI 管理端 · 设计系统
   现代 · 简洁 · 深色 · 品牌紫
   ============================================================ */
:root {
  --bg: #0d0f17;
  --bg-soft: #12151f;
  --panel: #171b28;
  --panel-2: #1d2233;
  --elev: #212842;
  --border: #2a3350;
  --border-soft: #232b44;
  --text: #eef1fb;
  --text-2: #c3cbe2;
  --muted: #8b95b3;
  --accent: #7c6cff;
  --accent-2: #a99cff;
  --accent-soft: rgba(124,108,255,.14);
  --ok: #34d399;
  --ok-soft: rgba(52,211,153,.14);
  --warn: #fbbf24;
  --warn-soft: rgba(251,191,36,.14);
  --err: #fb7185;
  --err-soft: rgba(251,113,133,.14);
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px -12px rgba(0,0,0,.6);
  --font: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(900px 500px at 92% -8%, rgba(124,108,255,.12) 0%, transparent 55%),
    radial-gradient(700px 400px at -5% 10%, rgba(64,120,255,.08) 0%, transparent 50%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: none; }
::selection { background: rgba(124,108,255,.35); }
.ico { flex: none; }

/* ---------- 布局 ---------- */
.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  border-right: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(20,24,40,.9), rgba(14,17,28,.9));
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 16px;
  position: sticky; top: 0; height: 100vh; z-index: 5;
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 10px; }
.brand-logo {
  width: 46px; height: 46px; border-radius: 15px;
  background: linear-gradient(145deg, #2c3250, #191d2e);
  display: grid; place-items: center; font-size: 24px; font-weight: 800;
  color: #e7e9f5;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 6px 18px -8px rgba(0,0,0,.7);
  position: relative; overflow: hidden;
}
.brand-logo::after { content:""; position:absolute; inset:0; background:radial-gradient(60% 40% at 30% 15%, rgba(124,108,255,.35), transparent 70%); }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16.5px; letter-spacing: .3px; }
.brand-text small { color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 11px; color: var(--muted); font-size: 14px; font-weight: 500;
  transition: background .16s ease, color .16s ease, transform .16s ease;
  position: relative;
}
.nav-item .ico { opacity: .9; }
.nav-item:hover { background: rgba(124,108,255,.08); color: var(--text); }
.nav-item:hover .ico { opacity: 1; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(124,108,255,.22), rgba(124,108,255,.04));
  color: #fff;
}
.nav-item.active::before {
  content:""; position:absolute; left:0; top:9px; bottom:9px; width:3px; border-radius:3px; background:var(--accent);
}
.nav-item.active .ico { color: var(--accent-2); }

.sidebar-foot { border-top: 1px solid var(--border-soft); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.me { display: flex; align-items: center; gap: 11px; padding: 4px; }
.avatar {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(145deg, var(--accent), #5b4bd6);
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 15px;
  box-shadow: 0 6px 16px -8px rgba(124,108,255,.8);
}
.me-meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.me-meta strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-meta small { color: var(--muted); font-size: 12px; }

/* ---------- 主区 ---------- */
.main { padding: 26px 30px 70px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 14px; flex-wrap: wrap; }
.page-title { font-size: 23px; margin: 0; font-weight: 800; letter-spacing: .3px; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.env-badge {
  font-size: 12px; color: var(--muted); border: 1px solid var(--border);
  padding: 5px 12px; border-radius: 20px; display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.02);
}
.env-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }

.foot { text-align: center; color: #5b6480; font-size: 12px; padding: 18px; border-top: 1px solid var(--border-soft); }

/* ---------- 卡片 ---------- */
.card {
  background: linear-gradient(180deg, rgba(30,36,58,.55), rgba(23,27,40,.55));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: border-color .18s ease;
}
.card:hover { border-color: var(--border); }
.card h3 { margin: 0 0 14px; font-size: 15.5px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.card h3 .ico { color: var(--accent-2); }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-1-2 { grid-template-columns: 1fr 1.6fr; }

.stat { display: flex; flex-direction: column; gap: 2px; position: relative; overflow: hidden; }
.stat .stat-ico {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent-2); margin-bottom: 14px;
}
.stat .stat-ico.ok { background: var(--ok-soft); color: var(--ok); }
.stat .stat-ico.warn { background: var(--warn-soft); color: var(--warn); }
.stat .num { font-size: 28px; font-weight: 800; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.stat .lbl { color: var(--muted); font-size: 13px; margin-top: 5px; }
.stat::after { content:""; position:absolute; right:-30px; top:-30px; width:110px; height:110px; border-radius:50%; background:radial-gradient(circle, rgba(124,108,255,.10), transparent 70%); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: var(--radius-sm); background: rgba(18,21,33,.5); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--border-soft); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .7px; background: rgba(255,255,255,.015); }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: rgba(124,108,255,.05); }
tbody tr:last-child td { border-bottom: 0; }
td.wrap { white-space: normal; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px !important; }

/* ---------- 表单 ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 7px; font-weight: 500; }
.field { margin-bottom: 16px; }
input, select, textarea {
  width: 100%; background: #10131f; color: var(--text);
  border: 1px solid var(--border-soft); border-radius: 10px; padding: 11px 13px; font-size: 14px;
  font-family: inherit; transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder, textarea::placeholder { color: #5c6480; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(124,108,255,.15); }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b95b3' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }
textarea { resize: vertical; min-height: 90px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .field { margin-bottom: 0; flex: 1; min-width: 140px; }

/* ---------- 按钮 ---------- */
.btn, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  border-radius: 10px; padding: 10px 16px; font-size: 14px; font-weight: 600; font-family: inherit;
  border: 1px solid transparent; transition: all .16s ease; text-decoration: none; line-height: 1;
}
.btn {
  background: linear-gradient(135deg, var(--accent), #5b4bd6); color: #fff;
  box-shadow: 0 8px 20px -10px rgba(124,108,255,.9);
}
.btn:hover { filter: brightness(1.09); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border-soft); }
.btn-ghost:hover { color: var(--text); background: rgba(124,108,255,.08); border-color: var(--border); }
.btn-danger { background: rgba(251,113,133,.12); color: #ffb4c0; border-color: rgba(251,113,133,.35); }
.btn-danger:hover { background: rgba(251,113,133,.2); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 11px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.btn:disabled, .btn-ghost:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- 提示 ---------- */
.alert { padding: 13px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.alert .ico { margin-top: 1px; }
.alert-success { background: var(--ok-soft); border-color: rgba(52,211,153,.4); color: #b7f4dc; }
.alert-error { background: var(--err-soft); border-color: rgba(251,113,133,.4); color: #ffd0d7; }
.alert-info { background: var(--accent-soft); border-color: rgba(124,108,255,.4); color: #cdc6ff; }

/* ---------- 徽章 ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-soft); color: #6ee7b7; }
.badge-warn { background: var(--warn-soft); color: #fcd34d; }
.badge-err { background: var(--err-soft); color: #fda4af; }
.badge-mut { background: rgba(120,130,160,.14); color: var(--muted); }
.badge-acc { background: var(--accent-soft); color: var(--accent-2); }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-variant-numeric: tabular-nums; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-title { font-size: 15.5px; font-weight: 700; margin: 4px 0 14px; display: flex; align-items: center; gap: 9px; }
.section-title .ico { color: var(--accent-2); }

/* ---------- 图表 ---------- */
.chart-wrap { position: relative; }
.barchart { width: 100%; height: 180px; display: block; }
.barchart rect { transition: opacity .15s ease; }
.barchart rect:hover { opacity: 1; }
.chart-x { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 11px; }
.chart-x span { flex: 1; text-align: center; }
.chart-empty { height: 180px; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.legend { display: flex; gap: 16px; margin-top: 12px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend .k { display: inline-flex; align-items: center; gap: 7px; }
.legend .sw { width: 11px; height: 11px; border-radius: 3px; }

/* ---------- 登录 / 安装 ---------- */
.center-stage { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card {
  width: 100%; max-width: 430px;
  background: linear-gradient(180deg, rgba(30,36,58,.7), rgba(20,24,38,.7));
  border: 1px solid var(--border); border-radius: 22px; padding: 34px;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.8); backdrop-filter: blur(10px);
}
.auth-card .brand { justify-content: center; margin-bottom: 8px; }
.auth-card h1 { text-align: center; font-size: 21px; margin: 8px 0 4px; }
.auth-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin: 0 0 24px; }
.install-steps { display: flex; gap: 8px; margin-bottom: 22px; }
.step { flex: 1; height: 5px; border-radius: 4px; background: #232a40; transition: background .3s; }
.step.on { background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ---------- 代码块 ---------- */
.code { background: #0e111b; border: 1px solid var(--border-soft); border-radius: 10px; padding: 12px 14px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: #cdd4ec; overflow-x: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.code code { white-space: nowrap; }

/* ---------- 进度环 ---------- */
.ring { position: relative; width: 120px; height: 120px; margin: 0 auto; }
.ring svg { transform: rotate(-90deg); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; font-size: 20px; font-weight: 800; }

/* ---------- Toast ---------- */
.toasts { position: fixed; top: 20px; right: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 999; }
.toast {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px;
  display: flex; align-items: center; gap: 10px; min-width: 240px;
  animation: toastIn .25s ease;
}
.toast.ok { border-color: rgba(52,211,153,.4); }
.toast.err { border-color: rgba(251,113,133,.4); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ---------- 模态框 ---------- */
.yy-bd {
  position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(6,8,15,.62); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .16s ease;
  pointer-events: none;
}
.yy-bd[hidden] { display: none !important; }
.yy-bd.show { opacity: 1; pointer-events: auto; }
.yy-modal {
  width: 100%; max-width: 440px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border); border-radius: 18px; padding: 22px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.7);
  transform: translateY(12px) scale(.98); transition: transform .2s cubic-bezier(.2,.85,.25,1);
  max-height: 90vh; overflow-y: auto;
}
.yy-bd.show .yy-modal { transform: none; }
.yy-modal h3 { margin: 0 0 4px; font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.yy-modal h3 .ico { color: var(--accent-2); }
.yy-modal-sub { color: var(--muted); font-size: 13px; margin: 0 0 16px; line-height: 1.5; }
.yy-modal .field:last-of-type { margin-bottom: 0; }
.yy-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.yy-hint { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; display: flex; gap: 7px; align-items: flex-start; line-height: 1.5; }

/* ---------- 响应式 ---------- */
@media (max-width: 1080px) { .grid-4 { grid-template-columns: 1fr 1fr; } .grid-1-2 { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-item.active::before { display: none; }
  .grid-3, .grid-2 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .grid-4, .grid-3, .grid-2, .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .main { padding: 18px; }
  .topbar { flex-direction: column; align-items: flex-start; }
}
