:root {
  --teal: #2e8b88;
  --teal-deep: #226e6c;
  --teal-bright: #61c1be;
  --teal-soft: #e7f6f4;
  --yellow: #f8b74a;
  --yellow-soft: #fff4df;
  --pink: #e982aa;
  --pink-soft: #fdeef4;
  --ink: #1f3a3d;
  --muted: #6d8588;
  --line: #e3eceb;
  --bg: #f4f8f7;
  --card: #ffffff;
  --danger: #c9524f;
  --danger-soft: #fbeae9;
  --ok: #2e8b57;
  --ok-soft: #e8f5ee;
  --radius: 16px;
  --shadow: 0 18px 40px -28px rgba(31, 58, 61, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-deep); }
h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--teal-bright); outline-offset: 2px; }

/* ---------------------------------------------------------------- brand mark */
.mark { position: relative; display: inline-block; width: 34px; height: 34px; flex: none; }
.mark i { position: absolute; width: 22px; height: 22px; border-radius: 50%; opacity: .88; }
.mark i:nth-child(1) { left: 0; top: 2px; background: var(--yellow); }
.mark i:nth-child(2) { right: 0; top: 2px; background: var(--teal-bright); }
.mark i:nth-child(3) { left: 6px; bottom: 0; background: var(--pink); opacity: .8; }
.mark.lg { width: 46px; height: 46px; }
.mark.lg i { width: 30px; height: 30px; }
.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-lockup strong { display: block; font-size: 16px; letter-spacing: .04em; line-height: 1.2; }
.brand-lockup span { display: block; font-size: 11px; color: var(--muted); letter-spacing: .22em; }

/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 1.05fr) minmax(360px, .95fr); }
.login-brand {
  position: relative; overflow: hidden; color: #fff; padding: 44px 52px;
  display: flex; flex-direction: column; gap: 40px;
  background: linear-gradient(150deg, #1d5b59 0%, #2e8b88 52%, #4aa9a5 100%);
}
.login-brand::before, .login-brand::after {
  content: ""; position: absolute; border-radius: 50%; pointer-events: none;
}
.login-brand::before {
  width: 420px; height: 420px; right: -140px; top: -120px;
  background: radial-gradient(circle at 30% 30%, rgba(97,193,190,.55), transparent 68%);
}
.login-brand::after {
  width: 360px; height: 360px; left: -120px; bottom: -140px;
  background: radial-gradient(circle at 70% 30%, rgba(248,183,74,.32), transparent 66%);
}
.login-brand .brand-lockup { position: relative; z-index: 1; }
.login-brand .brand-lockup strong { font-size: 18px; }
.login-brand .brand-lockup span { color: rgba(255,255,255,.72); }
.login-copy { position: relative; z-index: 1; max-width: 460px; margin-top: auto; }
.login-copy h1 { font-size: 36px; line-height: 1.35; letter-spacing: .02em; font-weight: 600; }
.login-copy p { margin-top: 18px; color: rgba(255,255,255,.82); font-size: 14.5px; }
.login-points { list-style: none; margin: 30px 0 0; padding: 0; display: grid; gap: 14px; }
.login-points li { display: flex; align-items: flex-start; gap: 10px; color: rgba(255,255,255,.88); font-size: 13.5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; }
.dot.teal { background: var(--teal-bright); }
.dot.yellow { background: var(--yellow); }
.dot.pink { background: var(--pink); }
.login-foot { position: relative; z-index: 1; margin-top: auto; color: rgba(255,255,255,.5); font-size: 12px; letter-spacing: .08em; }
.login-panel { display: grid; place-items: center; padding: 40px 28px; background: #fbfdfc; }
.login-card { width: min(380px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 34px 32px 28px; box-shadow: var(--shadow); }
.login-card > .mark { margin-bottom: 18px; }
.login-card h2 { font-size: 22px; font-weight: 600; }
.login-card > .muted { margin: 8px 0 22px; font-size: 13px; }
.login-card .btn.block { justify-content: center; width: 100%; }
.login-error { margin-top: 14px; }
.login-note { margin-top: 18px; }
.divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 16px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }

/* ---------------------------------------------------------------- app shell */
.shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: #fbfdfc; border-right: 1px solid var(--line); padding: 22px 16px 18px; gap: 18px;
}
.side .brand-lockup { padding: 4px 8px 14px; border-bottom: 1px solid var(--line); color: var(--ink); }
.nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-group { margin: 12px 10px 6px; font-size: 11px; color: #8fa5a7; letter-spacing: .18em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px;
  color: #415c5f; border-left: 3px solid transparent; font-size: 13.5px; background: none; border-top: 0; border-right: 0; border-bottom: 0; text-align: left; width: 100%;
}
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: .72; }
.nav-item:hover { background: var(--teal-soft); color: var(--teal-deep); }
.nav-item.active { background: var(--teal-soft); color: var(--teal-deep); border-left-color: var(--teal); font-weight: 600; }
.nav-item.active svg { opacity: 1; }
.nav-count { margin-left: auto; font-size: 11px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 0 7px; }
.side-foot { border-top: 1px solid var(--line); padding: 14px 10px 0; font-size: 11px; color: #8fa5a7; line-height: 1.7; }
.side-env { font-size: 12px; color: var(--teal-deep); background: var(--teal-soft); border-radius: 8px; padding: 6px 10px; margin-bottom: 10px; display: inline-block; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 26px 32px 14px; }
.top h1 { font-size: 22px; font-weight: 600; letter-spacing: .01em; }
.top-title p { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.top-right { display: flex; align-items: center; gap: 10px; }
.who { text-align: right; line-height: 1.35; margin-left: 4px; }
.who b { display: block; font-size: 13px; }
.who small { color: var(--muted); font-size: 11.5px; }
.view { padding: 6px 32px 46px; }
.banner-wrap { padding: 0 32px; }
.banner { display: flex; align-items: center; gap: 10px; border-radius: 12px; padding: 11px 14px; margin-top: 8px; font-size: 12.5px; border: 1px solid var(--line); background: #fff; color: var(--muted); }
.banner.demo { background: var(--yellow-soft); border-color: #f6dfb2; color: #7a5a14; }
.banner.warn { background: var(--danger-soft); border-color: #f2cdcb; color: #8c3b38; }
.banner b { color: inherit; flex: none; white-space: nowrap; }

/* ---------------------------------------------------------------- ui atoms */
.btn {
  display: inline-flex; align-items: center; gap: 7px; border-radius: 10px; border: 1px solid transparent;
  padding: 8px 14px; font-size: 13px; background: var(--teal); color: #fff; transition: .15s;
  white-space: nowrap;
}
.btn:hover { background: var(--teal-deep); color: #fff; }
.btn.primary { background: var(--teal); }
.btn.outline { background: #fff; border-color: var(--teal); color: var(--teal-deep); }
.btn.outline:hover { background: var(--teal-soft); }
.btn.ghost { background: #fff; border-color: var(--line); color: #476366; }
.btn.ghost:hover { border-color: var(--teal); color: var(--teal-deep); background: #fbfefd; }
.btn.danger { background: #fff; border-color: #ecc8c6; color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--muted); font-size: 18px; line-height: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font-size: 11px; border: 1px solid var(--line); background: #fff; color: var(--muted); white-space: nowrap; }
.chip.test { background: var(--yellow-soft); border-color: #f4dfb7; color: #7a5a14; }
.chip.demo { background: var(--pink-soft); border-color: #f4d3e1; color: #8d3f5b; }
.chip.live { background: var(--teal-soft); border-color: #cbe9e6; color: var(--teal-deep); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 6px; font-size: 11.5px; border: 1px solid transparent; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--yellow-soft); color: #8a6415; }
.badge.error { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--teal-soft); color: var(--teal-deep); }
.badge.neutral { background: #f2f6f5; color: var(--muted); }
.hint { color: #8fa5a7; font-size: 11.5px; line-height: 1.6; margin-top: 8px; }
.muted { color: var(--muted); }
.eyebrow { font-size: 11px; letter-spacing: .16em; color: #8fa5a7; }
.alert { border-radius: 10px; padding: 9px 12px; font-size: 12.5px; border: 1px solid var(--line); }
.alert.error { background: var(--danger-soft); border-color: #f2cdcb; color: #8c3b38; }

/* ---------------------------------------------------------------- layout blocks */
.grid { display: grid; gap: 16px; }
.grid.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.k2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.k3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h3 { font-size: 14.5px; font-weight: 600; }
.card-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-body { padding: 18px 20px; }
.kpi { position: relative; padding: 18px 20px; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 3px; background: var(--teal-bright); }
.kpi.yellow::before { background: var(--yellow); }
.kpi.pink::before { background: var(--pink); }
.kpi .label { color: var(--muted); font-size: 12.5px; }
.kpi .num { font-size: 30px; font-weight: 600; letter-spacing: .01em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .foot { color: #8fa5a7; font-size: 11.5px; margin-top: 4px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 26px 0 12px; }
.section-title h2 { font-size: 16px; font-weight: 600; }
.section-title span { font-size: 12px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt { margin-top: 16px; }
.mt-sm { margin-top: 8px; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card > .toolbar { padding: 14px 18px; margin: 0; border-bottom: 1px solid var(--line); }
.search { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 0 11px; height: 36px; min-width: 220px; }
.search input { border: 0; outline: 0; background: none; font: inherit; font-size: 13px; width: 100%; color: var(--ink); }
.search svg { width: 16px; height: 16px; flex: none; color: #9db1b3; }
.view:focus, .view:focus-visible { outline: none; }
select, input[type="text"], input[type="search"], input[type="number"] {
  font: inherit; font-size: 13px; color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; min-height: 36px;
}
select:focus, input:focus { outline: 2px solid #cbe9e6; border-color: var(--teal-bright); }
.search input[type="search"], .search input[type="text"] { border: 0; background: none; padding: 0; min-height: 0; outline: none; }
.login-card #dev-box > .btn { margin-top: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: #4d686b; }
.field + .field { margin-top: 12px; }
.field input, .field select { width: 100%; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #415c5f; }
.check input { accent-color: var(--teal); width: 15px; height: 15px; }
.scope-list {
  max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px;
  padding: 6px; margin-top: 8px; display: grid; gap: 2px; background: #fbfdfc;
}
.scope-item { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border-radius: 8px; font-size: 12.5px; cursor: pointer; }
.scope-item:hover { background: #fff; }
.scope-item input { accent-color: var(--teal); margin-top: 3px; }
.scope-item small { display: block; color: #8fa5a7; font-size: 11px; margin-top: 1px; }
#scope-filter { width: 100%; margin-top: 8px; }

/* ---------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 500; color: #8fa5a7; font-size: 11.5px; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fbfdfc; white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid #eef3f2; vertical-align: middle; }
tbody tr:hover { background: #fafdfc; }
tbody tr:last-child td { border-bottom: 0; }
td strong { font-weight: 600; }
td .small { font-size: 11.5px; color: #8fa5a7; margin-top: 2px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: #5b777a; }
.nowrap { white-space: nowrap; }
.empty { padding: 40px 20px; text-align: center; color: #8fa5a7; font-size: 13px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

/* ---------------------------------------------------------------- org tree */
.tree .node { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: 8px; border-bottom: 1px dashed #eef3f2; }
.tree .node:hover { background: #fafdfc; }
.tree .node .name { font-size: 13px; }
.tree .node .path { font-size: 11px; color: #9db1b3; }
.tree .kind { font-size: 10.5px; padding: 1px 6px; border-radius: 4px; background: #f2f6f5; color: var(--muted); white-space: nowrap; }
.tree .node[data-kind="campus"] .kind { background: var(--teal-soft); color: var(--teal-deep); }
.tree .node[data-kind="business_line"] .kind { background: var(--pink-soft); color: #8d3f5b; }
.tree .node[data-kind="region"] .kind { background: var(--yellow-soft); color: #7a5a14; }
.tree .members { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.d0 { padding-left: 12px; } .d1 { padding-left: 30px; } .d2 { padding-left: 48px; }
.d3 { padding-left: 66px; } .d4 { padding-left: 84px; } .d5 { padding-left: 102px; } .d6 { padding-left: 120px; }

/* ---------------------------------------------------------------- bars */
.bar { height: 7px; border-radius: 999px; background: #edf3f2; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal-bright), var(--teal)); }
.bar.yellow > span { background: linear-gradient(90deg, #fbd08a, var(--yellow)); }
.bar.pink > span { background: linear-gradient(90deg, #f2b3ca, var(--pink)); }
.meter { display: grid; gap: 6px; margin-top: 12px; }
.meter .mline { display: flex; justify-content: space-between; font-size: 12px; color: #4d686b; }

/* ---------------------------------------------------------------- mapping */
.map-row { display: grid; grid-template-columns: minmax(200px, 1.2fr) minmax(200px, 1.6fr) auto; gap: 14px; align-items: center; padding: 14px 18px; border-bottom: 1px solid #eef3f2; }
.map-row:last-child { border-bottom: 0; }
.map-row .who2 b { display: block; font-size: 13.5px; }
.map-row .who2 span { font-size: 11.5px; color: #8fa5a7; }
.map-row select { width: 100%; }
.map-actions { display: flex; gap: 6px; justify-content: flex-end; }
.suggestions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 4px; }
.sug { border: 1px dashed #cbe9e6; background: #f7fcfb; color: var(--teal-deep); border-radius: 8px; padding: 4px 9px; font-size: 11.5px; }
.sug:hover { background: var(--teal-soft); }

/* ---------------------------------------------------------------- drawer */
.drawer { position: fixed; inset: 0; z-index: 40; }
.drawer-mask { position: absolute; inset: 0; background: rgba(22, 45, 47, .32); }
.drawer-panel {
  position: absolute; top: 0; right: 0; height: 100%; width: min(500px, 94vw);
  background: #fff; box-shadow: -24px 0 50px -30px rgba(22,45,47,.5);
  display: flex; flex-direction: column; animation: slidein .18s ease-out;
}
@keyframes slidein { from { transform: translateX(24px); opacity: .4; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 14px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 17px; font-weight: 600; }
.drawer-body { padding: 20px 24px 30px; overflow-y: auto; flex: 1; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 8px 14px; font-size: 12.5px; margin-bottom: 18px; }
.kv dt { color: #8fa5a7; }
.kv dd { margin: 0; color: var(--ink); word-break: break-all; }
.divider-line { height: 1px; background: var(--line); margin: 18px 0; }
.history { display: grid; gap: 8px; }
.history .item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 12px; background: #fbfdfc; }
.history .item time { display: block; color: #8fa5a7; font-size: 11px; margin-bottom: 4px; }

/* ---------------------------------------------------------------- toast */
.toast { position: fixed; right: 26px; bottom: 26px; z-index: 60; background: #1f3a3d; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; box-shadow: 0 12px 30px -12px rgba(0,0,0,.4); }
.toast.err { background: #8c3b38; }

/* ---------------------------------------------------------------- plan page */
.plan-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.plan-list { margin: 0; padding-left: 18px; font-size: 13px; color: #4d686b; line-height: 1.9; }
.plan-list b { color: var(--ink); }
.roadmap { display: grid; gap: 0; }
.step { display: grid; grid-template-columns: 26px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px dashed #eef3f2; }
.step:last-child { border-bottom: 0; }
.step .no { width: 24px; height: 24px; border-radius: 50%; background: var(--teal-soft); color: var(--teal-deep); font-size: 11px; display: grid; place-items: center; font-weight: 600; }
.step b { font-size: 13px; }
.step p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tagline { display: inline-flex; gap: 6px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1180px) {
  .grid.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { min-height: 320px; padding: 36px 32px; }
  .login-copy h1 { font-size: 28px; }
  .login-panel { padding: 32px 20px; }
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; gap: 10px; padding: 12px 16px; overflow-x: auto; }
  .side .brand-lockup { border: 0; padding: 0 10px 0 0; flex: none; }
  .side .brand-lockup div { display: none; }
  .nav { flex-direction: row; overflow: visible; }
  .nav-group { display: none; }
  .nav-item { border-left: 0; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0; white-space: nowrap; }
  .nav-item.active { border-left: 0; border-bottom-color: var(--teal); }
  .side-foot { display: none; }
  .top { padding: 20px 20px 10px; flex-wrap: wrap; }
  .view, .banner-wrap { padding-left: 20px; padding-right: 20px; }
  .grid.k2, .grid.k3, .plan-grid { grid-template-columns: 1fr; }
  .map-row { grid-template-columns: 1fr; }
  .map-actions { justify-content: flex-start; }
}
@media (max-width: 560px) {
  .grid.k4 { grid-template-columns: 1fr; }
  .top-right .who { display: none; }
  .toolbar { align-items: stretch; }
  .toolbar .search { min-width: 0; flex: 1 1 100%; }
  .toolbar .spacer { display: none; }
  .banner { display: block; }
  .banner b { display: block; margin-bottom: 2px; }
}
