:root {
  --ink: #172033;
  --muted: #64748b;
  --line: #dfe6ef;
  --paper: #ffffff;
  --soft: #f4f7fb;
  --navy: #102b4e;
  --blue: #1f67d2;
  --cyan: #0e9f9a;
  --orange: #ef7c2f;
  --red: #d94343;
  --green: #168a62;
  --shadow: 0 14px 42px rgba(20, 42, 75, 0.09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: #eef3f8;
  font: 15px/1.65 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 66px;
  padding: 0 4vw;
  color: white;
  background: rgba(16, 43, 78, 0.97);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; letter-spacing: .02em; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  color: var(--navy);
  background: linear-gradient(135deg, #fff, #9ee8e1);
  font-weight: 900;
}
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 8px 12px; border-radius: 9px; color: #d9e6f5; font-size: 13px; }
.nav a:hover, .nav a.active { color: #fff; background: rgba(255, 255, 255, .12); }

.container { width: min(1180px, calc(100% - 36px)); margin: 0 auto; }
.hero {
  position: relative;
  overflow: hidden;
  margin: 28px auto;
  padding: clamp(34px, 6vw, 72px);
  color: #fff;
  background: linear-gradient(135deg, #0f2a4d 0%, #164b86 58%, #128c8a 100%);
  border-radius: 26px;
  box-shadow: var(--shadow);
}
.hero::after {
  content: "";
  position: absolute;
  width: 340px;
  height: 340px;
  right: -90px;
  top: -120px;
  border: 58px solid rgba(255,255,255,.08);
  border-radius: 50%;
}
.eyebrow { margin: 0 0 12px; color: #9ee8e1; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.hero h1 { position: relative; z-index: 1; max-width: 850px; margin: 0; font-size: clamp(30px, 5vw, 54px); line-height: 1.18; }
.hero p { position: relative; z-index: 1; max-width: 820px; margin: 18px 0 0; color: #e1edf8; font-size: 17px; }
.hero-actions { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 999px; color: #dae9f6; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.16); font-size: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px; border: 0; border-radius: 11px; font-weight: 750; transition: .2s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { color: white; background: var(--blue); box-shadow: 0 8px 20px rgba(31,103,210,.25); }
.btn-light { color: var(--navy); background: #fff; }
.btn-ghost { color: var(--navy); background: #edf3fa; border: 1px solid #d7e2ee; }
.btn-danger { color: white; background: var(--red); }

.section { margin: 24px auto; padding: clamp(22px, 4vw, 38px); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-heading { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 22px; }
.section-heading h2, .section h2 { margin: 0; color: var(--navy); font-size: clamp(22px, 3vw, 30px); line-height: 1.3; }
.section-heading p { max-width: 680px; margin: 5px 0 0; color: var(--muted); }
.section h3 { color: var(--navy); }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.card { padding: 20px; background: #fbfdff; border: 1px solid var(--line); border-radius: 15px; }
.card h3 { margin: 0 0 8px; }
.card p { margin: 0; color: var(--muted); }
.card .number { display: block; margin-bottom: 10px; color: var(--blue); font-size: 30px; font-weight: 900; }
.card-link { transition: transform .2s ease, box-shadow .2s ease; }
.card-link:hover { transform: translateY(-3px); box-shadow: 0 12px 26px rgba(20,42,75,.10); }
.icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 14px; border-radius: 13px; color: #fff; background: linear-gradient(135deg, var(--blue), var(--cyan)); font-size: 22px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.stat { padding: 17px; background: #f7faff; border: 1px solid var(--line); border-radius: 14px; }
.stat .value { color: var(--navy); font-size: 26px; font-weight: 900; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .trend { margin-top: 4px; color: var(--green); font-size: 12px; }

.dashboard { display: grid; grid-template-columns: 250px minmax(0,1fr); min-height: calc(100vh - 66px); }
.sidebar { padding: 24px 16px; color: #dce8f5; background: #102b4e; }
.sidebar h2 { margin: 0 10px 20px; color: white; font-size: 18px; }
.side-nav { display: grid; gap: 5px; }
.side-nav button, .side-nav a { width: 100%; padding: 11px 12px; color: #dce8f5; background: transparent; border: 0; border-radius: 10px; text-align: left; }
.side-nav button:hover, .side-nav button.active, .side-nav a:hover, .side-nav a.active { color: white; background: rgba(255,255,255,.11); }
.main { min-width: 0; padding: 26px; }
.page-title { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 20px; }
.page-title h1 { margin: 0; color: var(--navy); font-size: 27px; }
.page-title p { margin: 4px 0 0; color: var(--muted); }
.panel { padding: 20px; background: white; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 8px 24px rgba(20,42,75,.06); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.field { display: grid; gap: 6px; }
.field label { color: var(--muted); font-size: 12px; font-weight: 700; }
.input, .select, .textarea { width: 100%; padding: 10px 12px; color: var(--ink); background: white; border: 1px solid #ccd7e4; border-radius: 10px; outline: none; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,103,210,.12); }
.textarea { min-height: 116px; resize: vertical; }
.search { min-width: 230px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
table { width: 100%; border-collapse: collapse; background: white; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
th { color: #52647c; background: #f7f9fc; font-size: 12px; letter-spacing: .03em; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: #f5f9ff; }
tbody tr:last-child td { border-bottom: 0; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 750; }
.badge.high, .badge.red { color: #a62727; background: #ffebeb; }
.badge.medium, .badge.orange { color: #9a4a16; background: #fff0e3; }
.badge.low, .badge.green { color: #0f6b4b; background: #e7f8f0; }
.badge.blue { color: #1956a4; background: #e8f1ff; }
.badge.gray { color: #596a7f; background: #edf1f5; }
.platform { font-weight: 800; }

.split { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(320px,.9fr); gap: 18px; }
.conversation { display: grid; gap: 12px; max-height: 430px; overflow-y: auto; padding-right: 6px; }
.message { max-width: 82%; padding: 11px 13px; border-radius: 13px; }
.message.customer { background: #eef3f8; border-bottom-left-radius: 3px; }
.message.agent { margin-left: auto; color: white; background: var(--blue); border-bottom-right-radius: 3px; }
.message small { display: block; margin-top: 5px; opacity: .68; }
.ai-box { padding: 16px; background: #eef8f7; border: 1px solid #bce1de; border-radius: 13px; }
.ai-box h3 { margin: 0 0 8px; color: #0a6966; }
.warning-box { padding: 16px; color: #7a3d16; background: #fff5eb; border: 1px solid #f4d0ad; border-radius: 13px; }
.notice { padding: 12px 14px; color: #4b5e74; background: #f4f7fb; border-left: 4px solid var(--blue); border-radius: 8px; }
.progress { overflow: hidden; height: 8px; background: #e8edf3; border-radius: 99px; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--cyan)); border-radius: inherit; }

.flow { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 10px; align-items: stretch; margin: 18px 0; }
.flow-step { position: relative; padding: 16px 14px; color: var(--navy); background: #f5f9fd; border: 1px solid #d5e1ed; border-radius: 13px; text-align: center; font-weight: 750; }
.flow-step:not(:last-child)::after { content: "→"; position: absolute; right: -11px; top: 50%; z-index: 2; transform: translateY(-50%); color: var(--blue); font-weight: 900; }
.timeline { position: relative; display: grid; gap: 18px; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: #cbd8e6; }
.timeline-item { position: relative; }
.timeline-item::before { content: ""; position: absolute; left: -25px; top: 7px; width: 11px; height: 11px; background: var(--blue); border: 3px solid #dceaff; border-radius: 50%; }
.timeline-item h3 { margin: 0 0 4px; }
.timeline-item p { margin: 0; color: var(--muted); }

.score-ring { display: grid; place-items: center; width: 104px; height: 104px; border-radius: 50%; background: conic-gradient(var(--cyan) calc(var(--score) * 1%), #e7edf3 0); }
.score-ring::before { content: attr(data-score); display: grid; place-items: center; width: 76px; height: 76px; color: var(--navy); background: white; border-radius: 50%; font-size: 24px; font-weight: 900; }
.bar-list { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 100px minmax(0,1fr) 42px; gap: 10px; align-items: center; }
.bar-row span:first-child { color: var(--muted); font-size: 12px; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tab { padding: 8px 12px; color: var(--muted); background: #eff3f7; border: 0; border-radius: 9px; font-weight: 750; }
.tab.active { color: white; background: var(--navy); }
.tab-panel[hidden] { display: none; }

.footer { margin-top: 30px; padding: 34px 0; color: #cbd8e6; background: var(--navy); }
.footer p { margin: 5px 0; }
.small { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.risk-red { color: var(--red); font-weight: 800; }
.risk-green { color: var(--green); font-weight: 800; }
.empty { padding: 34px; color: var(--muted); text-align: center; }
.hidden { display: none !important; }

@media (max-width: 980px) {
  .grid { grid-template-columns: 1fr 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .dashboard { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .split { grid-template-columns: 1fr; }
  .flow { grid-template-columns: 1fr; }
  .flow-step:not(:last-child)::after { content: "↓"; right: 50%; top: auto; bottom: -17px; transform: translateX(50%); }
}
@media (max-width: 680px) {
  .topbar { align-items: flex-start; padding: 14px 18px; }
  .nav { display: none; }
  .container { width: min(100% - 22px, 1180px); }
  .grid, .grid-2, .stat-grid { grid-template-columns: 1fr; }
  .main { padding: 16px; }
  .page-title { align-items: flex-start; flex-direction: column; }
  .hero { margin-top: 14px; border-radius: 18px; }
  .section { padding: 20px; }
}

