:root {
  color-scheme: light;
  --ink: #10243f;
  --muted: #6d7b8f;
  --line: #dfe7f1;
  --panel: rgba(255, 255, 255, .92);
  --blue: #1468f3;
  --blue-dark: #0a45b8;
  --cyan: #1ab7c8;
  --green: #18a874;
  --amber: #e79518;
  --red: #db3d55;
  --sidebar: #0a1d35;
  --shadow: 0 18px 48px rgba(22, 54, 92, .09);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #f3f7fb; }
body { margin: 0; color: var(--ink); font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; background: radial-gradient(circle at 85% 0%, #e5f3ff 0, transparent 28rem), #f3f7fb; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }

.app-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 18px 20px; color: #d6e4f4; background: linear-gradient(180deg, #0c2340 0%, #07182c 100%); z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 28px; }
.brand-mark { display: inline-grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; color: white; font-size: 21px; font-weight: 900; border-radius: 14px; background: linear-gradient(135deg, var(--blue), var(--cyan)); box-shadow: 0 10px 24px rgba(20, 104, 243, .32); }
.brand strong, .brand small { display: block; }
.brand strong { color: white; font-size: 17px; letter-spacing: .04em; }
.brand small { margin-top: 4px; color: #8ea7c3; font-size: 11px; }
.nav-list { display: grid; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 13px; color: #9eb3ca; border-radius: 12px; font-size: 14px; transition: .18s ease; }
.nav-item:hover { color: white; background: rgba(255, 255, 255, .06); }
.nav-item.is-active { color: white; background: linear-gradient(90deg, rgba(20, 104, 243, .9), rgba(20, 104, 243, .55)); box-shadow: 0 10px 22px rgba(0, 70, 180, .18); }
.nav-icon { display: grid; place-items: center; width: 25px; height: 25px; color: #c8dcf2; font-size: 10px; font-weight: 800; border: 1px solid rgba(255,255,255,.14); border-radius: 8px; }
.sidebar-footer { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 16px 8px 0; border-top: 1px solid rgba(255,255,255,.1); }
.avatar { display: grid; place-items: center; width: 35px; height: 35px; color: white; font-weight: 800; border-radius: 50%; background: #245b94; }
.user-copy { min-width: 0; flex: 1; }
.user-copy strong, .user-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { color: white; font-size: 13px; }
.user-copy small { margin-top: 2px; color: #8199b3; font-size: 10px; }
.text-button { padding: 4px; color: #9fb4ca; border: 0; background: transparent; font-size: 12px; }
.text-button:hover { color: white; }

.main { min-width: 0; padding: 34px clamp(22px, 4vw, 58px) 60px; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: 10px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
.page-header h1 { margin: 0; font-size: clamp(27px, 3vw, 38px); letter-spacing: -.04em; }
.header-status { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px solid #dbe7f2; border-radius: 14px; background: rgba(255,255,255,.75); }
.header-status strong, .header-status small { display: block; }
.header-status strong { font-size: 12px; }
.header-status small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.status-pulse, .live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(24,168,116,.12); }
.status-pulse.warn { background: var(--amber); box-shadow: 0 0 0 5px rgba(231,149,24,.12); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.metric-card, .panel, .knowledge-card { border: 1px solid rgba(213,225,238,.92); border-radius: 20px; background: var(--panel); box-shadow: var(--shadow); }
.metric-card { position: relative; overflow: hidden; min-height: 150px; padding: 23px; }
.metric-card::after { content: ""; position: absolute; right: -28px; bottom: -48px; width: 130px; height: 130px; border-radius: 50%; background: radial-gradient(circle, rgba(20,104,243,.12), transparent 68%); }
.metric-card p { margin-bottom: 20px; color: var(--muted); font-size: 13px; }
.metric-card strong { display: block; margin-bottom: 10px; font-size: 35px; letter-spacing: -.05em; }
.metric-card span { color: var(--muted); font-size: 11px; }
.healthy-text { color: var(--green); }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .85fr); gap: 18px; }
.panel { padding: 24px; }
.panel-wide { min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 22px; }
.panel-head h2 { margin: 0; font-size: 18px; }
.panel-head > a { color: var(--blue); font-size: 12px; font-weight: 800; }
.subtle { color: var(--muted); font-size: 11px; }

.stage-list { display: grid; gap: 13px; }
.stage-row { display: grid; grid-template-columns: 35px 48px minmax(80px, 1fr) 30px; align-items: center; gap: 10px; font-size: 12px; }
.stage-row b { text-align: right; }
.stage-bar { overflow: hidden; height: 7px; border-radius: 10px; background: #edf2f7; }
.stage-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--cyan)); }
.line-badge { display: inline-grid; place-items: center; min-width: 28px; height: 24px; padding: 0 7px; color: #0d5ec8; font-size: 10px; font-weight: 900; border-radius: 8px; background: #e5f1ff; }
.line-a { color: #8a4e00; background: #fff0d8; }
.line-unknown { color: #5e6b7a; background: #edf1f5; }
.compact-list { display: grid; gap: 9px; }
.compact-list > div { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px solid #edf1f5; }
.compact-list > div:last-child { border: 0; }
.compact-list p { margin: 0; min-width: 0; }
.compact-list strong, .compact-list small { display: block; }
.compact-list strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compact-list small { margin-top: 3px; color: var(--muted); font-size: 10px; }

.severity { display: inline-flex; align-items: center; justify-content: center; min-width: 54px; min-height: 24px; padding: 0 8px; color: #536274; font-size: 9px; font-weight: 900; border-radius: 8px; background: #eef2f6; }
.severity-high, .severity-critical { color: #b21f36; background: #ffe5e9; }
.severity-medium { color: #a05c00; background: #fff0d6; }
.severity-low { color: #126b9d; background: #e2f3ff; }
.severity-info { color: #507568; background: #e4f7ef; }
.status-chip { display: inline-block; padding: 5px 8px; color: #35516e; font-size: 9px; font-weight: 800; border: 1px solid #d9e5ef; border-radius: 8px; background: #f7fafd; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { padding: 11px 13px; color: #7a899a; text-align: left; font-size: 10px; letter-spacing: .06em; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 14px 13px; border-bottom: 1px solid #edf1f5; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fbff; }
td strong, td small { display: block; }
td small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.table-link { color: var(--blue-dark); font-weight: 900; }
.summary-cell { min-width: 220px; max-width: 420px; color: #48596c; }
.empty-state { padding: 35px 16px; color: var(--muted); text-align: center; font-size: 12px; }

.detail-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; overflow: hidden; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--line); box-shadow: var(--shadow); }
.detail-strip > div { padding: 17px 19px; background: white; }
.detail-strip span, .detail-strip strong { display: block; }
.detail-strip span { margin-bottom: 7px; color: var(--muted); font-size: 10px; }
.detail-strip strong { font-size: 14px; }
.detail-list { margin: 0; }
.detail-list > div { display: grid; grid-template-columns: 90px 1fr; padding: 12px 0; border-bottom: 1px solid #edf1f5; }
.detail-list > div:last-child { border: 0; }
.detail-list dt { color: var(--muted); font-size: 11px; }
.detail-list dd { margin: 0; font-size: 12px; font-weight: 700; }
.message-list { display: grid; gap: 10px; max-height: 480px; overflow-y: auto; }
.message-row { display: grid; grid-template-columns: 78px 1fr 80px; align-items: start; gap: 12px; padding: 12px; border-radius: 12px; background: #f5f8fb; }
.message-row.outbound { background: #eef6ff; }
.message-row > span { color: var(--blue); font-size: 9px; font-weight: 900; }
.message-row p { margin: 0; color: #405166; font-size: 12px; line-height: 1.65; }
.message-row time { color: var(--muted); font-size: 9px; text-align: right; }

.action-group { display: flex; flex-wrap: wrap; gap: 5px; min-width: 170px; }
.action-group button { padding: 5px 8px; color: #1f5fa5; font-size: 9px; font-weight: 800; border: 1px solid #cee0f5; border-radius: 7px; background: #f1f7ff; }
.action-group button.success { color: #08764d; border-color: #bde6d7; background: #eaf9f3; }
.action-group button:disabled { opacity: .55; cursor: wait; }

.knowledge-grid, .price-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.knowledge-card { padding: 22px; }
.knowledge-card > div { display: flex; gap: 7px; margin-bottom: 18px; }
.knowledge-card h2 { margin-bottom: 10px; font-size: 16px; line-height: 1.45; }
.knowledge-card p { min-height: 70px; color: #536477; font-size: 12px; line-height: 1.75; }
.knowledge-card footer { display: flex; justify-content: space-between; padding-top: 14px; color: var(--muted); font-size: 10px; border-top: 1px solid #edf1f5; }
.price-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.price-card { display: flex; flex-direction: column; align-items: flex-start; min-height: 260px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: #fbfdff; }
.price-card h2 { margin: 18px 0 6px; font-size: 15px; line-height: 1.45; }
.price-card p { margin-bottom: 20px; color: var(--muted); font-size: 9px; word-break: break-all; }
.price-card > strong { margin-top: auto; color: var(--blue-dark); font-size: 28px; letter-spacing: -.04em; }
.price-card > small { margin: 7px 0 16px; color: var(--muted); font-size: 9px; }
.primary-button, .secondary-button { min-height: 42px; padding: 0 18px; font-weight: 800; border-radius: 11px; }
.primary-button { color: white; border: 0; background: linear-gradient(120deg, var(--blue), #0d56d5); box-shadow: 0 10px 22px rgba(20,104,243,.2); }
.secondary-button { color: var(--blue-dark); border: 1px solid #ccdef2; background: white; }
.wide { width: 100%; }

.price-dialog { width: min(440px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 20px; box-shadow: 0 35px 90px rgba(4,25,50,.28); }
.price-dialog::backdrop { background: rgba(7,24,44,.48); backdrop-filter: blur(4px); }
.price-dialog form { position: relative; padding: 30px; }
.price-dialog h2 { margin-bottom: 22px; }
.price-dialog label, #login-form label { display: grid; gap: 8px; margin-bottom: 17px; color: #344b65; font-size: 12px; font-weight: 800; }
.price-dialog input, #login-form input { width: 100%; min-height: 48px; padding: 0 13px; color: var(--ink); border: 1px solid #cfdbe8; border-radius: 11px; background: #f9fbfd; outline: none; }
.price-dialog input:focus, #login-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(20,104,243,.1); }
.price-dialog p:not(.eyebrow) { color: var(--muted); font-size: 11px; line-height: 1.6; }
.dialog-close { position: absolute; top: 15px; right: 15px; width: 32px; height: 32px; color: var(--muted); border: 0; border-radius: 50%; background: #eef3f7; }

.provider-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.provider-grid > div { display: flex; align-items: center; gap: 13px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: #fbfdff; }
.provider-grid p { margin: 0; }
.provider-grid strong, .provider-grid small { display: block; }
.provider-grid strong { font-size: 12px; }
.provider-grid small { margin-top: 3px; color: var(--muted); font-size: 9px; }

.mobile-bar { display: none; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: min(360px, calc(100vw - 44px)); padding: 12px 17px; color: white; font-size: 12px; border-radius: 11px; background: #132a43; box-shadow: 0 18px 48px rgba(0,0,0,.2); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s ease; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast.is-error { background: #a72b40; }

.login-body { min-height: 100vh; background: radial-gradient(circle at 12% 12%, rgba(30,139,255,.28), transparent 32rem), linear-gradient(125deg, #06172c 0%, #0b2b4e 52%, #eaf4fc 52.2%, #f8fbfe 100%); }
.login-shell { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(360px, .8fr); align-items: center; gap: clamp(40px, 8vw, 120px); min-height: 100vh; max-width: 1260px; margin: 0 auto; padding: 50px; }
.login-intro { color: white; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: clamp(55px, 10vh, 100px); font-size: 18px; }
.login-intro .eyebrow { color: #68cde0; }
.login-intro h1 { max-width: 690px; margin-bottom: 22px; font-size: clamp(38px, 5.3vw, 70px); line-height: 1.08; letter-spacing: -.055em; }
.login-lead { max-width: 610px; color: #afc5dc; font-size: 15px; line-height: 1.8; }
.login-feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 38px; }
.login-feature-grid > div { padding: 15px; border: 1px solid rgba(255,255,255,.12); border-radius: 13px; background: rgba(255,255,255,.045); }
.login-feature-grid strong, .login-feature-grid span { display: block; }
.login-feature-grid strong { margin-bottom: 7px; font-size: 12px; }
.login-feature-grid span { color: #91aac3; font-size: 9px; line-height: 1.5; }
.login-card { padding: clamp(28px, 4vw, 48px); border: 1px solid rgba(255,255,255,.9); border-radius: 24px; background: rgba(255,255,255,.92); box-shadow: 0 35px 80px rgba(4,29,57,.18); backdrop-filter: blur(20px); }
.secure-badge { display: inline-block; margin-bottom: 24px; padding: 6px 9px; color: #08764d; font-size: 9px; font-weight: 900; border-radius: 7px; background: #e4f7ef; }
.login-card h2 { margin-bottom: 9px; font-size: 25px; letter-spacing: -.035em; }
.login-card-head p { margin-bottom: 30px; color: var(--muted); font-size: 12px; }
.form-error { min-height: 18px; margin: -3px 0 10px; color: var(--red); font-size: 11px; }
.login-help { margin: 19px 0 0; color: var(--muted); text-align: center; font-size: 9px; }

@media (max-width: 1120px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .knowledge-grid, .price-grid { grid-template-columns: repeat(2, 1fr); }
  .login-feature-grid { grid-template-columns: 1fr; }
}

@media (max-width: 780px) {
  .mobile-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 0 16px; color: white; background: #0a1d35; }
  .icon-button { width: 34px; height: 34px; color: white; border: 1px solid rgba(255,255,255,.18); border-radius: 9px; background: transparent; }
  .mobile-brand { flex: 1; font-weight: 900; }
  .live-dot { width: auto; height: auto; padding: 5px 8px; font-size: 9px; border-radius: 8px; box-shadow: none; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; top: 58px; width: min(286px, 84vw); height: calc(100vh - 58px); transform: translateX(-105%); transition: .2s ease; }
  .sidebar.is-open { transform: translateX(0); box-shadow: 20px 0 60px rgba(0,0,0,.25); }
  .main { padding: 24px 14px 42px; }
  .page-header { align-items: flex-start; }
  .header-status { display: none; }
  .metric-grid, .content-grid, .knowledge-grid, .price-grid, .provider-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 125px; }
  .panel { padding: 17px; border-radius: 16px; }
  .detail-strip { grid-template-columns: repeat(2, 1fr); }
  .message-row { grid-template-columns: 65px 1fr; }
  .message-row time { grid-column: 2; text-align: left; }
  .login-body { background: linear-gradient(180deg, #071a31 0, #0b2b4e 38%, #edf5fb 38.2%); }
  .login-shell { grid-template-columns: 1fr; gap: 25px; padding: 26px 16px 45px; }
  .login-brand { margin-bottom: 40px; }
  .login-intro h1 { font-size: 38px; }
  .login-feature-grid { display: none; }
  .login-card { padding: 28px 21px; }
}
