:root {
  --bg: #f4f6f3;
  --ink: #10231c;
  --ink-2: #213a30;
  --muted: #6d7c74;
  --line: #e1e7df;
  --card: #ffffff;
  --soft: #f7f9f6;
  --sidebar: #0d211a;
  --sidebar-2: #14362a;
  --green: #149b68;
  --green-2: #08734d;
  --lime: #d8f36b;
  --gold: #f4a62a;
  --red: #dd5b5b;
  --blue: #3b82f6;
  --purple: #7c6cf2;
  --shadow: 0 18px 48px rgba(16, 35, 28, 0.08);
  --shadow-sm: 0 8px 24px rgba(16, 35, 28, 0.06);
  --radius: 22px;
  --radius-sm: 14px;
  --sidebar-w: 252px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(216, 243, 107, 0.18), transparent 28%),
    radial-gradient(circle at 92% 10%, rgba(20, 155, 104, 0.10), transparent 30%),
    var(--bg);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.app-shell { display: flex; min-height: 100vh; }

/* Boot */
.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: radial-gradient(circle at 50% 30%, #1b4a38, #0d211a 70%);
  color: #fff;
}
.boot-logo {
  width: 74px;
  height: 74px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--lime), var(--green));
  color: #0d211a;
  font-size: 34px;
  font-weight: 900;
  box-shadow: 0 18px 50px rgba(216, 243, 107, 0.25);
  animation: float 2.8s ease-in-out infinite;
}
.boot-title { font-size: 26px; font-weight: 800; letter-spacing: 2px; }
.boot-sub { color: rgba(255,255,255,.62); font-size: 13px; }
.boot-bar { width: 180px; height: 4px; border-radius: 99px; background: rgba(255,255,255,.12); overflow: hidden; margin-top: 10px; }
.boot-bar span { display: block; height: 100%; width: 60%; border-radius: 99px; background: var(--lime); animation: bootbar 1.4s ease-in-out infinite; }

/* Sidebar */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  padding: 22px 18px;
  background:
    radial-gradient(circle at 10% 0%, rgba(216,243,107,.10), transparent 25%),
    linear-gradient(180deg, var(--sidebar), #091a14 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  z-index: 40;
  border-right: 1px solid rgba(255,255,255,.05);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 6px 22px; }
.brand-mark {
  width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--lime), #35c98b);
  color: #0d211a; font-size: 22px; font-weight: 900;
  box-shadow: 0 12px 30px rgba(216,243,107,.18);
}
.brand-name { font-size: 17px; font-weight: 800; letter-spacing: 1px; }
.brand-sub { font-size: 10px; letter-spacing: 1.2px; color: rgba(255,255,255,.45); text-transform: uppercase; }
.nav-label { padding: 12px 12px 8px; color: rgba(255,255,255,.35); font-size: 10px; letter-spacing: 1.6px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 13px;
  color: rgba(255,255,255,.68); transition: .2s ease; font-weight: 600; font-size: 13px;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #0d211a; background: var(--lime); box-shadow: 0 10px 28px rgba(216,243,107,.18); }
.nav-item .icon { width: 18px; height: 18px; flex: none; }
.nav-item .nav-badge { margin-left: auto; font-size: 10px; padding: 1px 7px; border-radius: 99px; background: rgba(255,255,255,.12); }
.nav-item.active .nav-badge { background: rgba(13,33,26,.12); color: #0d211a; }

.side-ai {
  margin-top: 20px; padding: 14px; border-radius: 18px;
  background: rgba(255,255,255,.055); border: 1px solid rgba(255,255,255,.07);
}
.side-ai-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.side-ai-title { font-size: 12px; font-weight: 700; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(216,243,107,.12); animation: pulse 1.8s infinite; }
.mini-model { display: flex; align-items: center; gap: 8px; padding: 5px 0; color: rgba(255,255,255,.62); font-size: 11px; }
.mini-model .dot { width: 6px; height: 6px; border-radius: 50%; background: #5ee0a4; }
.mini-model .dot.degraded { background: var(--gold); }
.mini-model .dot.down { background: var(--red); }
.mini-model .pill { margin-left: auto; font-size: 9px; padding: 1px 6px; border-radius: 99px; background: rgba(255,255,255,.08); }

.side-user {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 8px 2px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.side-user .avatar { width: 38px; height: 38px; border-radius: 13px; }
.side-user-name { font-size: 13px; font-weight: 700; }
.side-user-meta { font-size: 10px; color: rgba(255,255,255,.45); }

/* Main */
.main { margin-left: var(--sidebar-w); width: calc(100% - var(--sidebar-w)); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  padding: 16px 32px;
  background: rgba(244,246,243,.86);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(225,231,223,.75);
}
.page-title { font-size: 22px; font-weight: 850; letter-spacing: -.3px; line-height: 1.2; }
.page-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.topbar-spacer { flex: 1; }
.search {
  display: flex; align-items: center; gap: 8px; width: 260px; padding: 9px 12px;
  border: 1px solid var(--line); background: rgba(255,255,255,.72); border-radius: 12px; color: var(--muted);
}
.search input { border: 0; background: transparent; outline: 0; width: 100%; color: var(--ink); font-size: 12px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255,255,255,.75); display: grid; place-items: center; color: var(--ink-2);
  position: relative; transition: .2s ease;
}
.icon-btn:hover { background: #fff; transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.icon-btn .icon { width: 18px; height: 18px; }
.notify-dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); border: 2px solid #fff; }
.top-user { display: flex; align-items: center; gap: 9px; padding: 4px 4px 4px 8px; border-radius: 14px; }
.top-user:hover { background: rgba(255,255,255,.65); }
.top-user-name { font-size: 12px; font-weight: 700; }
.top-user-level { font-size: 10px; color: var(--muted); }

.content { max-width: 1480px; margin: 0 auto; padding: 24px 32px 100px; }

/* Cards & common */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 6px 0 14px; }
.section-title { font-size: 17px; font-weight: 800; letter-spacing: -.2px; }
.section-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.tiny { font-size: 10px; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: 12px; padding: 9px 14px;
  font-size: 12px; font-weight: 700; transition: .18s ease; white-space: nowrap;
}
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(135deg, var(--green), var(--green-2)); color: #fff; box-shadow: 0 10px 24px rgba(20,155,104,.20); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 14px 30px rgba(20,155,104,.28); }
.btn-lime { background: var(--lime); color: #0d211a; box-shadow: 0 10px 24px rgba(216,243,107,.18); }
.btn-lime:hover { transform: translateY(-1px); }
.btn-soft { background: #eef6f1; color: var(--green-2); border-color: #dceee4; }
.btn-soft:hover { background: #e5f2ea; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: var(--soft); }
.btn-danger { background: #fdecec; color: #b83c3c; border-color: #f6dada; }
.btn-sm { padding: 6px 10px; border-radius: 9px; font-size: 11px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none !important; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.badge-green { background: #e7f6ee; color: #08734d; }
.badge-gold { background: #fdf3df; color: #a56308; }
.badge-red { background: #fdecec; color: #b83c3c; }
.badge-blue { background: #eaf2ff; color: #2563c9; }
.badge-purple { background: #f0eeff; color: #5b4bd6; }
.badge-gray { background: #f0f3f1; color: #65746c; }
.badge-dark { background: #10231c; color: var(--lime); }

.avatar { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; background: linear-gradient(135deg, #d9f7e7, #a8e9c8); color: #0d5c3d; flex: none; }
.avatar.lg { width: 62px; height: 62px; border-radius: 20px; font-size: 24px; }
.avatar.gold { background: linear-gradient(135deg, #fef3c7, #f6c45c); color: #7a4b05; }
.avatar.blue { background: linear-gradient(135deg, #dbeafe, #93c5fd); color: #1d4ed8; }

.divider { height: 1px; background: var(--line); margin: 14px 0; }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: #b7c2bb; display: inline-block; vertical-align: middle; }
.empty { padding: 34px 18px; text-align: center; color: var(--muted); font-size: 12px; }

/* Progress, score */
.progress { height: 7px; border-radius: 99px; background: #edf1ec; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--green), #58c78f); }
.score-ring {
  --score: 80;
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--green) calc(var(--score) * 1%), #e9eee9 0);
  position: relative;
}
.score-ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: #fff; }
.score-ring > span { position: relative; z-index: 1; font-size: 11px; font-weight: 850; color: var(--green-2); }
.score-ring.gold { background: conic-gradient(var(--gold) calc(var(--score) * 1%), #f3eadb 0); }
.score-ring.gold > span { color: #a56308; }

/* Tabs */
.pill-tabs { display: flex; gap: 6px; padding: 4px; background: #eef2ed; border-radius: 13px; overflow-x: auto; }
.pill-tab { border: 0; background: transparent; color: var(--muted); padding: 7px 13px; border-radius: 10px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.pill-tab.active { background: #fff; color: var(--ink); box-shadow: 0 4px 12px rgba(16,35,28,.07); }

/* Forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 11px; font-weight: 700; color: var(--ink-2); }
.field input, .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); background: #fbfcfa; border-radius: 11px; padding: 10px 12px;
  outline: 0; color: var(--ink); font-size: 12px; transition: .18s ease;
}
.field textarea { min-height: 86px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 4px rgba(20,155,104,.08); }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); }
.check-row input { width: 16px; height: 16px; accent-color: var(--green); }

/* Table */
.table-wrap { overflow-x: auto; border-radius: 16px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; min-width: 640px; background: #fff; }
th { text-align: left; font-size: 10px; color: var(--muted); font-weight: 700; letter-spacing: .4px; padding: 11px 14px; background: #f7f9f6; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid #edf1ec; font-size: 12px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fbfcfa; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(8,20,15,.48); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 18px; overflow-y: auto; overscroll-behavior: contain; animation: fadeIn .18s ease; }
.modal { width: min(640px, 100%); max-height: 88vh; overflow: auto; overscroll-behavior: contain; outline: none; background: #fff; border-radius: 24px; box-shadow: 0 30px 80px rgba(8,20,15,.28); animation: modalIn .22s ease; }
.modal.wide { width: min(900px, 100%); }
.modal-head { padding: 20px 22px 12px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-title { font-size: 18px; font-weight: 850; }
.modal-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.modal-body { padding: 8px 22px 20px; }
.modal-foot { padding: 14px 22px 20px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.modal-x { width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; color: var(--muted); cursor: pointer; flex: 0 0 auto; }
.modal-x:hover, .modal-x:focus-visible { background: #f3f7f4; color: var(--ink); border-color: #c8d8cf; outline: none; }

@media (max-width: 640px) {
  .modal-backdrop { padding: 10px; place-items: end center; }
  .modal { max-height: 92vh; border-radius: 20px; }
  .modal-head { padding: 16px 16px 10px; }
  .modal-body { padding: 6px 16px 16px; }
  .modal-foot { padding: 12px 16px 16px; flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; }
}

/* Toast */
.toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: flex; flex-direction: column; gap: 8px; }
.toast { min-width: 220px; max-width: 360px; padding: 11px 14px; border-radius: 13px; background: #10231c; color: #fff; font-size: 12px; box-shadow: 0 18px 40px rgba(8,20,15,.22); animation: toastIn .22s ease; display: flex; gap: 8px; align-items: flex-start; }
.toast.success { background: #0f3b2b; }
.toast.error { background: #5a2020; }
.toast.warn { background: #5c4210; }
.toast .icon { width: 16px; height: 16px; flex: none; margin-top: 1px; }

/* Mobile bottom */
.mobile-bottom { display: none; }

@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes bootbar { 0% { transform: translateX(-70%); } 100% { transform: translateX(220%); } }

@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search { width: 190px; }
}

@media (max-width: 860px) {
  :root { --sidebar-w: 0px; }
  .sidebar { display: none; }
  .main { margin-left: 0; width: 100%; }
  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar > div:first-child { min-width: 0; flex: 1 1 auto; }
  .page-title { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .page-sub { display: none; }
  .search { display: none; }
  .top-user-name, .top-user-level { display: none; }
  .console-entry { padding: 9px 10px; font-size: 11px; flex: none; }
  .console-entry-text { display: none; }
  .top-user { display: none; }
  .content { padding: 16px 14px 96px; }
  .grid-2, .grid-3, .grid-4, .form-grid { grid-template-columns: 1fr; }
  .mobile-bottom {
    position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50;
    display: flex; justify-content: space-around; align-items: center;
    padding: 7px 8px; border-radius: 20px; background: rgba(13,33,26,.94);
    box-shadow: 0 20px 50px rgba(8,20,15,.28); backdrop-filter: blur(16px);
  }
  .mobile-nav { color: rgba(255,255,255,.58); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 9px; padding: 5px 10px; border-radius: 12px; }
  .mobile-nav .icon { width: 18px; height: 18px; }
  .mobile-nav.active { color: var(--lime); background: rgba(255,255,255,.07); }
  .mobile-ai { width: 46px; height: 46px; border-radius: 50%; background: var(--lime); color: #0d211a; display: grid; place-items: center; margin-top: -22px; box-shadow: 0 10px 24px rgba(216,243,107,.3); }
  .mobile-ai .icon { width: 22px; height: 22px; }
  .toast-root { left: 14px; right: 14px; bottom: 84px; align-items: stretch; }
  .toast { max-width: none; }
}
