:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --ink: #172033;
  --muted: #647086;
  --line: #dbe2ea;
  --brand: #1f5fbf;
  --brand-weak: #e8f0ff;
  --ok: #16845b;
  --ok-weak: #e7f6ef;
  --warn: #c66a12;
  --warn-weak: #fff3e2;
  --danger: #c73535;
  --danger-weak: #ffeded;
  --info: #42607f;
  --shadow: 0 10px 28px rgba(23, 32, 51, .08);
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.small-text { color: var(--muted); font-size: 12px; line-height: 1.7; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 99; padding: 12px 14px; border-radius: var(--radius); background: #172033; color: #fff; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.1fr) minmax(380px, 440px); gap: 56px; align-items: center; padding: 64px 8vw; background: radial-gradient(circle at 18% 24%, rgba(31, 95, 191, .12), transparent 30%), linear-gradient(135deg, #f8fafc, #eef3f8); }
.login-copy h1 { margin: 24px 0 16px; font-size: clamp(36px, 5vw, 72px); letter-spacing: 0; line-height: 1.05; }
.login-copy p { max-width: 680px; color: var(--muted); font-size: 20px; line-height: 1.8; }
.brand-mark { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--brand); background: var(--surface); font-weight: 700; }
.status-strip { display: flex; flex-wrap: wrap; gap: 14px; margin: 34px 0; color: var(--muted); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--muted); }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.danger { background: var(--danger); }
.login-proof { display: grid; grid-template-columns: repeat(3, minmax(128px, 150px)); gap: 12px; }
.login-proof div { background: rgba(255,255,255,.72); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.login-proof strong { display: block; font-size: 24px; }
.login-proof span { color: var(--muted); font-size: 13px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 28px; box-shadow: var(--shadow); }
.login-card h2 { margin: 0 0 22px; }
label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 16px; }
input, select, textarea { width: 100%; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink); padding: 10px 12px; outline: none; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-weak); }
.inline-input { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }

.primary, .ghost, .danger-ghost, .link-button, .success-ghost { min-height: 38px; border-radius: var(--radius); border: 1px solid transparent; padding: 0 14px; }
.primary { width: 100%; background: var(--brand); color: white; font-weight: 700; }
.ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.success-ghost { background: var(--ok-weak); color: var(--ok); border-color: #bde7d5; }
.danger-ghost { background: var(--danger-weak); color: var(--danger); border-color: #ffc7c7; }
.link-button { background: transparent; color: var(--brand); padding: 0; border: 0; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; overflow: auto; background: #111827; color: #d6deec; padding: 18px 12px; }
.side-brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 18px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 12px; }
.logo { display: grid; place-items: center; width: 42px; height: 42px; border-radius: var(--radius); background: #2f6ed3; color: #fff; font-weight: 800; }
.side-brand strong, .side-brand span { display: block; }
.side-brand span { color: #94a3b8; font-size: 12px; margin-top: 3px; }
.nav-group-title { margin: 16px 10px 6px; color: #7d8ca3; font-size: 12px; }
.nav-item { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 36px; padding: 0 10px; border: 0; border-radius: var(--radius); background: transparent; color: #d6deec; text-align: left; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.1); color: #fff; }
.badge { min-width: 22px; height: 20px; display: inline-grid; place-items: center; border-radius: 999px; background: var(--danger); color: #fff; font-size: 12px; padding: 0 7px; }

.workspace, .content, .grid, .panel { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; background: rgba(244,246,248,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 4px 0 0; font-size: 22px; }
.crumb { color: var(--muted); font-size: 12px; }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.top-actions select { width: 140px; margin: 0; }
.mock-banner { margin: 16px 24px 0; padding: 11px 14px; border: 1px solid #ffd8a3; background: var(--warn-weak); color: #6b420c; border-radius: var(--radius); font-size: 13px; }
.content { padding: 18px 24px 48px; }

.filters { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 8px; margin-bottom: 16px; }
.filters input, .filters select { margin: 0; background: var(--surface); }
.grid { display: grid; gap: 16px; }
.grid.metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dashboard-priority { display: grid; grid-template-columns: minmax(420px, 1.15fr) minmax(420px, .85fr); gap: 16px; align-items: start; margin-bottom: 16px; }
.dashboard-priority .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel, .metric, .card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(23,32,51,.03); }
.panel { padding: 16px; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 16px; }
.panel-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.metric { padding: 14px; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { display: block; font-size: 24px; margin: 8px 0; }
.delta { color: var(--ok); font-size: 12px; }
.delta.bad { color: var(--danger); }

.action-list { display: grid; gap: 10px; }
.action-item { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-soft); }
.severity { width: 8px; align-self: stretch; border-radius: 999px; background: var(--warn); }
.severity.high { background: var(--danger); }
.severity.low { background: var(--ok); }
.action-item strong, .action-item span { display: block; }
.action-item span { color: var(--muted); font-size: 13px; margin-top: 3px; }

.chart-line { height: 220px; display: flex; align-items: end; gap: 8px; padding: 14px 8px 0; border-bottom: 1px solid var(--line); }
.bar { flex: 1; min-width: 12px; border-radius: 4px 4px 0 0; background: linear-gradient(#2f6ed3, #91b7f2); position: relative; }
.bar.alt { background: linear-gradient(#16845b, #8bd7b5); }
.funnel { display: grid; gap: 8px; }
.funnel-row { display: grid; grid-template-columns: 94px 1fr 64px; gap: 10px; align-items: center; }
.funnel-track { height: 14px; background: #edf1f5; border-radius: 999px; overflow: hidden; }
.funnel-fill { height: 100%; background: var(--brand); border-radius: inherit; }

.table-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.table-tools input { max-width: 260px; margin: 0; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; min-width: 860px; border-collapse: collapse; background: var(--surface); }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 13px; }
th { position: sticky; top: 0; background: #f8fafc; z-index: 2; color: var(--muted); font-weight: 700; cursor: pointer; }
tbody tr:hover { background: #f9fbfe; }
td:first-child, th:first-child { position: sticky; left: 0; background: inherit; z-index: 1; }
.tag { display: inline-flex; align-items: center; min-height: 22px; padding: 0 8px; border-radius: 999px; background: #edf1f7; color: #43536a; font-size: 12px; margin: 2px 4px 2px 0; }
.tag.ok { background: var(--ok-weak); color: var(--ok); }
.tag.warn { background: var(--warn-weak); color: var(--warn); }
.tag.danger { background: var(--danger-weak); color: var(--danger); }
.tag.brand { background: var(--brand-weak); color: var(--brand); }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow: auto; }
.tab { min-height: 38px; padding: 0 12px; border: 0; background: transparent; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--brand); border-color: var(--brand); font-weight: 700; }
.wizard { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 16px; }
.steps { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; align-self: start; }
.step { width: 100%; display: grid; grid-template-columns: 26px 1fr; gap: 8px; align-items: center; min-height: 42px; border: 0; border-radius: var(--radius); background: transparent; color: var(--muted); text-align: left; padding: 0 8px; }
.step i { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #edf1f7; font-style: normal; font-size: 12px; }
.step.active { background: var(--brand-weak); color: var(--brand); font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .wide { grid-column: 1 / -1; }

.map { min-height: 390px; position: relative; overflow: hidden; border-radius: var(--radius); background: #e8eef3; border: 1px solid var(--line); }
.map::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(66,96,127,.13) 1px, transparent 1px), linear-gradient(90deg, rgba(66,96,127,.13) 1px, transparent 1px); background-size: 42px 42px; }
.map.real-map::before { content: none; }
.map-status { position: absolute; left: 12px; top: 12px; z-index: 5; max-width: calc(100% - 24px); padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.92); color: var(--info); font-size: 12px; box-shadow: 0 4px 14px rgba(23,32,51,.08); }
.map-status.live { border-color: #bde7d5; color: var(--ok); pointer-events: none; }
.road { position: absolute; height: 14px; border-radius: 999px; background: rgba(255,255,255,.92); border: 1px solid #c8d2df; transform-origin: left center; }
.pin { position: absolute; width: 14px; height: 14px; border: 3px solid #fff; border-radius: 50%; background: var(--brand); box-shadow: 0 2px 8px rgba(0,0,0,.2); }
.pin.ok { background: var(--ok); }
.pin.warn { background: var(--warn); }
.pin.danger { background: var(--danger); }
.radius-ring { position: absolute; border: 1px dashed rgba(31,95,191,.55); border-radius: 50%; transform: translate(-50%, -50%); }
.poi-label { position: absolute; padding: 4px 7px; border-radius: 999px; background: rgba(255,255,255,.9); border: 1px solid var(--line); font-size: 12px; color: var(--info); }

.kanban { display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); gap: 12px; overflow: auto; }
.lane { background: #eef2f6; border-radius: var(--radius); padding: 10px; min-height: 240px; }
.lane h3 { margin: 0 0 10px; font-size: 14px; }
.lead-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; margin-bottom: 8px; }
.lead-card strong, .lead-card span { display: block; }
.lead-card span { color: var(--muted); font-size: 12px; margin-top: 3px; }

.doc { line-height: 1.75; }
.doc h2 { margin-top: 18px; font-size: 18px; }
.doc ul { padding-left: 18px; }
.state-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.state-box { padding: 12px; border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface-soft); color: var(--muted); }

@media (min-width: 721px) and (max-width: 1180px) {
  .login-page { grid-template-columns: 1fr; gap: 28px; align-items: start; padding: 40px 8vw; }
  .login-copy h1 { max-width: 720px; font-size: clamp(38px, 7vw, 58px); }
  .login-copy p { max-width: 680px; }
  .login-card { max-width: 560px; width: 100%; }
  .login-proof { grid-template-columns: repeat(3, minmax(128px, 1fr)); max-width: 560px; }
}
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 220px minmax(0, 1fr); }
  .sidebar { padding: 14px 10px; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.metrics, .grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-priority { grid-template-columns: minmax(0, 1fr); }
  .dashboard-priority .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.two, .wizard { grid-template-columns: minmax(0, 1fr); }
  table { min-width: 720px; }
}
@media (max-width: 860px) and (min-width: 721px) {
  .app-shell { grid-template-columns: 200px minmax(0, 1fr); }
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { justify-content: flex-start; width: 100%; }
  .top-actions select { flex: 1 1 160px; }
  table { min-width: 640px; }
}
@media (max-width: 720px) {
  .login-page { grid-template-columns: 1fr; padding: 28px 16px; }
  .login-copy h1 { font-size: 40px; }
  .login-proof { grid-template-columns: 1fr; }
  .app-shell { display: block; }
  .sidebar { position: static; height: auto; display: flex; overflow: auto; padding: 10px; }
  .side-brand { border: 0; margin: 0; padding: 0 8px 0 0; }
  #nav { display: flex; gap: 4px; }
  .nav-group-title, .badge { display: none; }
  .topbar { height: auto; align-items: flex-start; flex-direction: column; padding: 12px 16px; }
  .top-actions { width: 100%; overflow: auto; }
  .content, .mock-banner { margin-left: 12px; margin-right: 12px; padding-left: 0; padding-right: 0; }
  .filters, .grid.metrics, .grid.three, .grid.four, .form-grid, .state-grid { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(5, 240px); }
}
.integration-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.integration-grid .state-box{display:flex;flex-direction:column;align-items:flex-start;gap:7px;min-height:140px}.integration-grid .state-box strong{font-size:15px}.integration-grid .state-box span{font-weight:700}.integration-grid .state-box small{color:var(--muted);word-break:break-all}.integration-grid .state-box button{margin-top:auto}@media(max-width:900px){.integration-grid{grid-template-columns:1fr}}
