:root {
  --ink: #10251f;
  --muted: #687b74;
  --line: #dfe7e3;
  --soft: #f4f7f5;
  --paper: #ffffff;
  --pine: #0b6b4f;
  --pine-dark: #084d3b;
  --mint: #dff5ec;
  --amber: #a85c00;
  --amber-bg: #fff1d6;
  --red: #b33a3a;
  --red-bg: #fee9e7;
  --blue: #315f9c;
  --blue-bg: #eaf1fb;
  --shadow: 0 16px 44px rgba(16, 37, 31, .08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #eef3f0; color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.boot-screen, .login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.boot-screen { align-content: center; gap: 16px; color: var(--muted); }
.brand-mark {
  width: 46px;
  height: 46px;
  display: inline-grid;
  place-items: center;
  color: white;
  background: var(--pine);
  border-radius: 14px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgba(11, 107, 79, .25);
}

.login-page {
  grid-template-columns: minmax(360px, .9fr) minmax(460px, 1.1fr);
  background: var(--paper);
}

.login-aside {
  height: 100%;
  padding: clamp(40px, 7vw, 100px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: white;
  background:
    radial-gradient(circle at 80% 15%, rgba(84, 202, 157, .35), transparent 32%),
    linear-gradient(145deg, #071d17 0%, #0a503d 100%);
}

.login-aside h1 { font-size: clamp(36px, 4vw, 62px); line-height: 1.08; margin: 32px 0 18px; letter-spacing: -.04em; }
.login-aside p { max-width: 520px; color: rgba(255,255,255,.72); font-size: 17px; line-height: 1.8; }
.login-points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 42px; }
.login-point { padding: 18px 16px; border: 1px solid rgba(255,255,255,.14); border-radius: 16px; background: rgba(255,255,255,.06); }
.login-point strong { display: block; font-size: 23px; margin-bottom: 6px; }
.login-point span { font-size: 12px; color: rgba(255,255,255,.62); }
.login-foot { font-size: 12px; color: rgba(255,255,255,.48); letter-spacing: .08em; }

.login-main { padding: 48px; display: grid; place-items: center; }
.login-card { width: min(420px, 100%); }
.login-card .eyebrow { color: var(--pine); font-weight: 750; }
.login-card h2 { font-size: 31px; margin: 10px 0 8px; letter-spacing: -.03em; }
.login-card > p { color: var(--muted); margin: 0 0 30px; }

.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field label { font-size: 13px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid #cfdbd6;
  border-radius: 10px;
  background: white;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--pine); box-shadow: 0 0 0 3px rgba(11,107,79,.10); }
textarea { resize: vertical; min-height: 90px; }

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 15px;
  font-weight: 750;
  color: var(--ink);
  background: #e8efeb;
}
.btn:hover { filter: brightness(.98); }
.btn-primary { color: white; background: var(--pine); }
.btn-primary:hover { background: var(--pine-dark); }
.btn-danger { color: var(--red); background: var(--red-bg); }
.btn-wide { width: 100%; padding: 13px 16px; }
.btn-sm { padding: 7px 10px; font-size: 12px; }
.btn-link { background: none; color: var(--pine); padding: 0; }
.btn:disabled { opacity: .52; cursor: not-allowed; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px 1fr; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 244px;
  padding: 22px 16px;
  color: rgba(255,255,255,.78);
  background: #0b1f19;
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 26px; color: white; }
.brand .brand-mark { box-shadow: none; }
.brand strong { display: block; font-size: 16px; }
.brand small { color: rgba(255,255,255,.46); font-size: 11px; }
.nav-label { margin: 10px 11px 8px; color: rgba(255,255,255,.33); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.nav { display: grid; gap: 4px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  font-size: 14px;
}
.nav a:hover { color: white; background: rgba(255,255,255,.06); }
.nav a.active { color: white; background: rgba(74, 201, 151, .16); }
.nav-icon { width: 21px; text-align: center; font-size: 16px; opacity: .92; }
.sidebar-user { margin-top: auto; padding: 14px 11px 4px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user strong { display: block; color: white; font-size: 13px; }
.sidebar-user small { color: rgba(255,255,255,.45); }
.sidebar-user button { float: right; margin-top: -30px; color: rgba(255,255,255,.62); }

.main { grid-column: 2; min-width: 0; }
.topbar {
  height: 68px;
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.topbar-meta { color: var(--muted); font-size: 12px; }
.content { padding: 28px 30px 46px; max-width: 1600px; margin: auto; }

.password-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 16px;
  margin-bottom: 20px;
  color: #664400;
  background: var(--amber-bg);
  border: 1px solid #f0d8aa;
  border-radius: 12px;
}

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 22px; }
.page-head h2 { font-size: 25px; margin: 0 0 6px; letter-spacing: -.035em; }
.page-head p { margin: 0; color: var(--muted); font-size: 13px; }
.head-actions { display: flex; align-items: center; gap: 10px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 19px;
  box-shadow: 0 1px 0 rgba(16,37,31,.02);
}
.stat-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-value { margin-top: 8px; font-size: 30px; font-weight: 800; letter-spacing: -.04em; }
.stat-note { margin-top: 7px; font-size: 11px; color: #8a9a94; }
.stat-card.warn .stat-value { color: var(--amber); }
.stat-card.danger .stat-value { color: var(--red); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(340px, .7fr); gap: 18px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 1px 0 rgba(16,37,31,.02); overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 14px; }
.card-head span { color: var(--muted); font-size: 11px; }
.card-body { padding: 18px 19px; }

.status-bars { display: grid; gap: 13px; }
.status-row { display: grid; grid-template-columns: 70px 1fr 36px; gap: 10px; align-items: center; font-size: 12px; }
.bar { height: 8px; background: #edf2ef; border-radius: 10px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--pine); border-radius: inherit; }

.data-card { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); background: #fbfcfb; }
.toolbar input { width: min(320px, 100%); }
.toolbar select { width: auto; min-width: 140px; }
.toolbar .spacer { flex: 1; }
.result-count { align-self: center; color: var(--muted); font-size: 12px; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 14px; text-align: left; color: #6d7e78; background: #f7f9f8; font-size: 11px; white-space: nowrap; }
td { padding: 12px 14px; border-top: 1px solid #edf1ef; vertical-align: middle; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #f8fbf9; }
.click-row { cursor: pointer; }
.main-cell strong { display: block; font-size: 13px; }
.main-cell small { display: block; color: var(--muted); margin-top: 3px; }
.subtle { color: var(--muted); }
.empty { padding: 52px 20px; text-align: center; color: var(--muted); }
.nowrap { white-space: nowrap; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; font-size: 10px; font-weight: 800; white-space: nowrap; }
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-green { color: var(--pine); background: var(--mint); }
.badge-amber { color: var(--amber); background: var(--amber-bg); }
.badge-red { color: var(--red); background: var(--red-bg); }
.badge-blue { color: var(--blue); background: var(--blue-bg); }
.badge-gray { color: #66736e; background: #edf1ef; }

.list { display: grid; gap: 0; }
.list-item { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 12px 0; border-bottom: 1px solid #edf1ef; }
.list-item:last-child { border-bottom: 0; }
.list-item strong { display: block; font-size: 12px; }
.list-item small { display: block; color: var(--muted); margin-top: 3px; }

.drawer-backdrop { position: fixed; inset: 0; background: rgba(6, 20, 16, .34); z-index: 40; animation: fade .15s; }
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(660px, 96vw);
  background: white;
  box-shadow: -20px 0 60px rgba(5,22,17,.18);
  z-index: 41;
  overflow: auto;
  animation: slide .18s ease-out;
}
.drawer-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; padding: 24px 26px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.drawer-head h2 { margin: 0 0 6px; font-size: 22px; }
.drawer-head p { margin: 0; color: var(--muted); font-size: 12px; }
.icon-btn { border: 0; border-radius: 9px; padding: 8px 10px; color: var(--muted); background: var(--soft); }
.drawer-body { padding: 23px 26px 40px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 26px; }
.detail-item { min-height: 72px; padding: 13px; background: var(--soft); border-radius: 11px; }
.detail-item span { display: block; color: var(--muted); font-size: 10px; font-weight: 700; margin-bottom: 7px; }
.detail-item strong { font-size: 13px; }
.section-title { margin: 26px 0 13px; font-size: 14px; }
.timeline { border-left: 2px solid #dbe6e1; margin-left: 8px; }
.timeline-item { position: relative; padding: 0 0 24px 21px; }
.timeline-item::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--pine); box-shadow: 0 0 0 4px white; }
.timeline-item strong { font-size: 12px; }
.timeline-item p { margin: 6px 0 0; color: var(--muted); line-height: 1.55; font-size: 11px; }

.modal-backdrop { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(6,20,16,.42); z-index: 60; }
.modal { width: min(480px, 100%); background: white; border-radius: 16px; box-shadow: var(--shadow); padding: 24px; }
.modal h2 { margin: 0 0 8px; font-size: 20px; }
.modal > p { margin: 0 0 22px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }

.toast { position: fixed; right: 24px; bottom: 24px; max-width: 360px; padding: 12px 15px; border-radius: 10px; color: white; background: #16372e; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; z-index: 100; font-size: 12px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #8f2929; }
.loading { min-height: 280px; display: grid; place-items: center; color: var(--muted); }

@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(25px); opacity: .4; } }

@media (max-width: 1050px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-aside { display: none; }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; width: auto; height: auto; padding: 13px; }
  .brand { padding-bottom: 10px; }
  .nav-label, .sidebar-user { display: none; }
  .nav { grid-template-columns: repeat(4, 1fr); overflow: auto; }
  .nav a { justify-content: center; padding: 9px; font-size: 11px; }
  .nav-icon { display: none; }
  .main { grid-column: 1; }
  .topbar { height: 58px; padding: 0 16px; }
  .content { padding: 18px 14px 36px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 9px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 24px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .toolbar input, .toolbar select { width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
}
