/* 弘速运工作台 + Bootstrap 桥接 */
:root {
  --navy: #243340;
  --navy-2: #3a5164;
  --blue: #527fa3;
  --blue-strong: #3f6786;
  --teal: #1f8f78;
  --bg: #eef3f6;
  --card: #ffffff;
  --line: #dce6ee;
  --ink: #163044;
  --muted: #6b8194;
  --red: #c45454;
  --orange: #c47a22;
  --shadow: 0 10px 28px rgba(18, 42, 64, .06);
  --radius: 14px;
  --side: 248px;
  --bs-primary: var(--blue);
  --bs-primary-rgb: 82, 127, 163;
  --bs-success: var(--teal);
  --bs-success-rgb: 31, 143, 120;
  --bs-danger: var(--red);
  --bs-danger-rgb: 196, 84, 84;
  --bs-secondary: #6b8194;
  --bs-secondary-rgb: 107, 129, 148;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--line);
  --bs-border-radius: .5rem;
  --bs-link-color: var(--blue);
  --bs-link-hover-color: var(--blue-strong);
  --bs-focus-ring-color: color-mix(in srgb, var(--blue) 25%, transparent);
}
/* ACTIVE_THEME */
:root{--navy:#243340;--navy-2:#3a5164;--blue:#527fa3;--blue-strong:#3f6786;--teal:#3f9d8c;--bs-primary:#527fa3;--bs-primary-rgb:82,127,163;--bs-success:#3f9d8c;--bs-success-rgb:63,157,140;--bs-link-color:#527fa3;--bs-link-hover-color:#3f6786}
/* ACTIVE_THEME */

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background:
    radial-gradient(900px 280px at 100% -10%, rgba(82, 127, 163, .08), transparent 50%),
    var(--bg);
  color: var(--ink);
  font: 14px/1.5 "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
::selection { background: #d5e7f3; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
a { color: var(--blue); }

.app { display: flex; min-height: 100vh; }
.side {
  width: var(--side);
  flex: none;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  background: var(--navy);
  color: #c5d3df;
  z-index: 20;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 4px 8px 18px;
  color: #fff;
  text-decoration: none;
}
.brand strong { display: block; font-size: 15px; letter-spacing: .2px; }
.brand small { display: block; margin-top: 2px; color: #93a9bb; font-size: 12px; }
.logo {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-weight: 700;
  flex: none;
}
.nav { flex: 1; overflow: auto; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 9px;
  color: #c5d3df;
  text-decoration: none;
}
.nav a.sub { padding: 7px 12px 7px 40px; font-size: 13px; color: #93a8ba; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active {
  background: var(--navy-2);
  color: #fff;
  box-shadow: inset 3px 0 0 rgba(255,255,255,.88);
}
.nav a.open { color: #fff; }
.ico { width: 18px; height: 18px; flex: none; }
.side-foot {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
  padding: 14px 8px 4px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-weight: 700;
  flex: none;
}
.who { min-width: 0; display: flex; flex-direction: column; }
.who b { color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who a { color: #9eb4c6; font-size: 12px; text-decoration: none; }
.who a:hover { color: #fff; }

.main { flex: 1; min-width: 0; }
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 74px;
  padding: 14px 28px;
  background: rgba(255,255,255,.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.top h1 { margin: 0; font-size: 22px; font-weight: 700; }
.crumb { margin: 0 0 2px; color: var(--muted); font-size: 12px; }
.top-meta { margin-left: auto; color: var(--muted); font-size: 12px; }
.menu-btn, .scrim { display: none; }
.content { padding: 22px 28px 56px; }

.content > .alert { margin-bottom: 14px; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.metric {
  position: relative;
  display: block;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px 15px;
  text-decoration: none;
  color: inherit;
}
a.metric:hover { border-color: #c5d6e3; }
.kicker { color: var(--muted); font-size: 13px; }
.metric strong { display: block; margin-top: 8px; font-size: 28px; letter-spacing: -.03em; color: #12283a; font-variant-numeric: tabular-nums; }
.delta { margin-top: 6px; font-size: 12px; color: var(--teal); }
.delta.neg, .money.neg, b.neg { color: var(--red); }
.money.pos, b.pos { color: var(--teal); }
.metric .mark {
  position: absolute;
  right: 14px;
  top: 14px;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: #eef5f8;
  color: var(--blue);
}

.callout {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff7ee;
  border: 1px solid #f3dfc4;
}
.callout.calm { background: #eef8f5; border-color: #cfe8e0; }
.callout strong { display: block; }
.callout p { margin: 4px 0 0; color: #7d6244; }
.callout.calm p { color: #3e6d62; }
.callout .btn, .callout .toolbar { margin-left: auto; flex: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chips a {
  text-decoration: none;
  background: #fff;
  border: 1px solid #f0d8b8;
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--ink);
  font-size: 12px;
}
.chips a:hover { border-color: var(--orange); }

.split { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; }
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  overflow: hidden;
}
.panel-head, .block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2, .block-head h2 { margin: 0; font-size: 16px; }
.panel-body { padding: 16px 18px; }
.muted, .hint { color: var(--muted); }
.hint { font-size: 12px; margin: 6px 0 0; }

.day-row, .hbar-top { font-variant-numeric: tabular-nums; }
.day-row {
  display: grid;
  grid-template-columns: 112px 1fr 32px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
}
.day-list .day-row:first-child { border-top: 0; }
.day-date { font-size: 13px; font-weight: 650; }
.day-date em { display: block; font-style: normal; font-weight: 500; color: var(--muted); font-size: 12px; }
.day-row.hot .day-date em { color: var(--orange); }
.day-row:hover .day-date { color: var(--blue); }
.track { height: 8px; background: #e7eef3; border-radius: 99px; overflow: hidden; }
.track > span { display: block; height: 100%; border-radius: 99px; background: var(--blue); }
.track > span.hot { background: var(--orange); }
.day-row b { text-align: right; }

.hbar { padding: 11px 0; border-top: 1px solid var(--line); }
.hbars .hbar:first-child { border-top: 0; }
.hbar-top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.hbar-top a { color: inherit; font-weight: 700; text-decoration: none; }
.hbar-top a:hover { color: var(--blue); }
.hbar-sub { margin-top: 5px; color: var(--muted); font-size: 12px; }
.track.lg { height: 9px; margin-top: 8px; }
.track > span.profit { background: var(--teal); }

.chart-box { padding: 8px 18px 18px; }
.bars { height: 210px; display: flex; align-items: stretch; gap: 8px; }
.bar-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.bar-pair { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.bar { width: 42%; border-radius: 5px 5px 2px 2px; min-height: 4px; }
.bar.cost { background: #b7c9d6; }
.bar.revenue { background: var(--teal); }
.bar-label { height: 22px; text-align: center; color: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 12px; margin-top: 6px; }
.dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: 1px; }
.dot.cost { background: #b7c9d6; }
.dot.revenue { background: var(--teal); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 14px 18px;
  background: #f8fbfc;
  border-bottom: 1px solid var(--line);
}
.filters .form-control,
.filters .form-select { width: auto; min-width: 140px; }
.filters .grow { flex: 1; min-width: 220px; width: auto; }
.form-label { color: var(--muted); font-size: 12px; margin-bottom: .35rem; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; padding-top: 4px; }
.calc {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
  background: #f6faf8;
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--muted);
}
.calc b { font-size: 18px; }

.toolbar, .actions-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions-inline form { margin: 0; }

.summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 12px 18px;
  color: var(--muted);
  background: #f7fbfa;
  border-bottom: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.summary b { color: var(--ink); font-weight: 650; }
.table-scroll { overflow: auto; }
.table-scroll.tall { max-height: calc(100vh - 300px); }
.table.wide { min-width: 920px; }
.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.table tfoot th { background: #f8fafb; }
.table td { font-variant-numeric: tabular-nums; font-size: 13px; }
.table tbody tr.soon > * { --bs-table-bg: #fffaf3; --bs-table-hover-bg: #fff3e0; }
.table tbody tr.expired > * { --bs-table-bg: #fff7f7; --bs-table-hover-bg: #ffecec; }
.table .sub { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 400; }
a.ip { color: var(--blue); font-weight: 700; text-decoration: none; }
a.ip:hover { text-decoration: underline; }
.tag {
  display: inline-block;
  margin: 4px 4px 0 0;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e7f4f1;
  color: #17786d;
  font-size: 11px;
}
.pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}
.pill.ok { background: #e7f6f1; color: #0f7d68; }
.pill.warn { background: #fff1dc; color: #a86412; }
.pill.danger { background: #fde8e8; color: #b42323; }
.pill.muted { background: #eef2f5; color: #6b8194; }
.pill.soon { background: #e7f1f8; color: #1d6396; }
.empty { padding: 36px 16px; text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: 6px; color: var(--ink); font-size: 16px; }

.master { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }
.cust-list { display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 250px); overflow: auto; }
.cust {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  border: 1px solid transparent;
}
.cust small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.cust em { font-style: normal; font-weight: 700; font-variant-numeric: tabular-nums; }
.cust.current, .cust:hover { background: #f4f8fb; border-color: var(--line); }
.rename { display: flex; gap: 10px; align-items: end; margin-top: 14px; }
.rename .flex-grow-1 { flex: 1; }

.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.choice {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}
.choice:hover { border-color: var(--blue); transform: translateY(-2px); }
.choice .mark {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: #eef5f8;
  color: var(--blue);
}
.choice h2 { margin: 12px 0 6px; font-size: 18px; }
.choice p { margin: 0; color: var(--muted); }

.fillbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin: 16px 0;
  padding: 14px;
  background: #f7fafb;
  border: 1px dashed #d5e2ea;
  border-radius: 12px;
}
.fillbar .fill-item { width: 160px; }
.table .profit-cell { font-weight: 700; white-space: nowrap; }
.form-check-input { accent-color: var(--blue); }

.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 4px; margin-right: 8px; vertical-align: -1px; }
.color-input { width: 56px; padding: 4px; height: 38px; }

.templates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 8px; }
.template { display: block; border: 2px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; }
.template:has(input:checked), .template.active { border-color: var(--blue); }
.preview { height: 84px; border-radius: 8px; margin-bottom: 10px; }
.preview.ocean { background: linear-gradient(135deg, #102b43, #1b7890); }
.preview.forest { background: linear-gradient(135deg, #14362f, #3b8c68); }
.preview.slate { background: linear-gradient(135deg, #243340, #6d8294); }
.template input { margin-right: 6px; }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(800px 360px at 0% -10%, rgba(82, 127, 163, .28), transparent 55%),
    radial-gradient(640px 320px at 100% 0%, rgba(63, 157, 140, .18), transparent 50%),
    var(--bg);
}
.auth-card {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 28px 28px 24px;
}
.auth-brand { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
.auth-brand .logo { background: var(--navy); color: #fff; }
.day-list { max-height: 440px; overflow: auto; padding-right: 4px; }
.auth-brand strong { display: block; }
.auth-brand small { color: var(--muted); }
.auth-card h1 { margin: 0 0 6px; font-size: 24px; }
.stack { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.auth-card .btn { width: 100%; }

@media (max-width: 1100px) {
  .metrics, .templates { grid-template-columns: 1fr 1fr; }
  .split, .master, .choice-grid { grid-template-columns: 1fr; }
  .cust-list { max-height: none; }
}
@media (max-width: 900px) {
  .side { position: fixed; left: 0; transform: translateX(-105%); transition: transform .2s ease; }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; }
  .menu-btn {
    display: inline-flex;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  .content, .top { padding-left: 16px; padding-right: 16px; }
  .callout { flex-direction: column; }
  .callout .btn, .callout .toolbar { margin-left: 0; }
}
@media (max-width: 700px) {
  .metrics, .templates { grid-template-columns: 1fr; }
  .top h1 { font-size: 20px; }
  .filters .grow, .filters .form-control, .filters .form-select { width: 100%; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
