:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --ink: #26323d;
  --strong: #34424f;
  --body: #4f5d6a;
  --muted: #7b8794;
  --faint: #9aa5b1;
  --line: #dfe6ed;
  --blue: #3a73d9;
  --green: #2f9d72;
  --amber: #b98222;
  --red: #c85858;
  --purple: #7567cf;
  --shadow: 0 8px 26px rgba(30, 42, 55, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--body);
  background: var(--bg);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  color: #c9d5df;
  background: #1f2a34;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  font-size: 20px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 3px;
  color: #a7b4c0;
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: inherit;
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  color: #f4f8fb;
  background: #2d3a45;
}

.side-status {
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.side-status span,
.side-status small {
  display: block;
  color: #a7b4c0;
  font-size: 12px;
}

.side-status strong {
  display: block;
  margin: 5px 0;
  color: #9eddbc;
}

.main {
  min-width: 0;
  padding: 20px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  background: rgba(244, 246, 248, 0.94);
  backdrop-filter: blur(10px);
}

.eyebrow {
  margin: 0 0 5px;
  color: #217a83;
  font-size: 12px;
  font-weight: 700;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-size: 24px;
  font-weight: 600;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

select,
.ghost,
.primary,
.video-actions button,
.task-list button,
.lead-cards button,
.action-pair button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.primary {
  border-color: var(--blue);
  color: #fff;
  background: var(--blue);
}

.live-context {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1.2fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.live-context article {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.live-context span,
.live-context strong {
  display: block;
}

.live-context span {
  color: var(--muted);
  font-size: 12px;
}

.live-context strong {
  margin-top: 4px;
  overflow: hidden;
  color: var(--strong);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.view {
  display: grid;
  gap: 14px;
}

.command {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #d7e2ea;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.command-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.command-head span,
.command-head small {
  color: var(--muted);
}

.command-head strong {
  display: block;
  margin: 5px 0;
  color: var(--strong);
  font-size: 22px;
  font-weight: 600;
}

.score {
  min-width: 100px;
  padding: 10px;
  border-radius: 8px;
  background: #ecf8f2;
  text-align: center;
}

.score strong {
  color: var(--green);
  font-size: 30px;
  font-weight: 600;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.kpi-row article {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.kpi-row span,
.kpi-row strong,
.kpi-row small {
  display: block;
}

.kpi-row span,
.kpi-row small {
  color: var(--muted);
  font-size: 12px;
}

.kpi-row strong {
  margin: 6px 0;
  overflow: hidden;
  color: var(--strong);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.12;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-grid {
  display: grid;
  grid-template-columns: 1.05fr 1.2fr 340px;
  gap: 12px;
  align-items: stretch;
}

.area-video,
.area-chart,
.area-task,
.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.area-chart,
.area-task,
.panel {
  padding: 14px;
}

.panel header,
.area-chart .panel header {
  margin-bottom: 12px;
}

.panel h2 {
  margin: 0;
  color: var(--strong);
  font-size: 16px;
  font-weight: 600;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.span-6 {
  grid-column: span 6;
}

.span-7 {
  grid-column: span 7;
}

.span-8 {
  grid-column: span 8;
}

.span-12 {
  grid-column: span 12;
}

.video-card {
  height: 100%;
  padding: 12px;
}

.video-livebar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
}

.video-surface {
  position: relative;
  min-height: 292px;
  overflow: hidden;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(150deg, #2d3b45, #101820 58%, #23323c);
}

.video-card.compact .video-surface {
  min-height: 278px;
}

.video-surface::before {
  content: "";
  position: absolute;
  inset: 24% 15% 28%;
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-radius: 48% 52% 18% 18%;
}

.video-surface > div {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
}

.video-surface span,
.video-surface small {
  display: block;
  color: #b9c8d2;
}

.video-surface strong {
  display: block;
  margin: 7px 0;
  font-size: 19px;
  font-weight: 600;
}

.video-surface footer {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.58);
}

.video-actions,
.action-pair {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.chart {
  width: 100%;
  height: 292px;
  display: block;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  border-radius: 999px;
  padding: 0 8px;
  color: var(--muted);
  background: #edf2f6;
  font-size: 12px;
  white-space: nowrap;
}

.pill.good {
  color: var(--green);
  background: #e8f7ef;
}

.pill.warn {
  color: var(--amber);
  background: #fff3db;
}

.pill.danger {
  color: var(--red);
  background: #fdeceb;
}

.pill.info {
  color: var(--blue);
  background: #eaf1ff;
}

.task-list,
.rank-list,
.lead-cards,
.summary-cards {
  display: grid;
  gap: 8px;
}

.task-list article {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.task-list strong,
.task-list small {
  display: block;
}

.task-list small {
  margin-top: 3px;
  color: var(--muted);
}

.task-list strong,
.rank-list strong,
.lead-cards strong,
.summary-cards strong,
td {
  color: var(--body);
  font-weight: 500;
}

.task-list button {
  min-height: 32px;
}

.rank-list div {
  display: grid;
  grid-template-columns: 104px 1fr 42px;
  gap: 8px;
  align-items: center;
}

.rank-list strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-list span {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f6;
}

.rank-list i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.rank-list em {
  color: var(--muted);
  font-style: normal;
  text-align: right;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  color: var(--body);
  font-size: 13px;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.lead-cards article,
.summary-cards article {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.lead-cards article {
  display: grid;
  gap: 8px;
}

.lead-cards strong,
.lead-cards span,
.summary-cards strong,
.summary-cards span {
  display: block;
}

.lead-cards span,
.summary-cards span {
  margin-top: 4px;
  color: var(--muted);
}

.lead-cards article > div:nth-child(2) {
  display: flex;
  gap: 6px;
}

.wall {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.wall article {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.wall div {
  min-height: 92px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: linear-gradient(150deg, #2d3b45, #101820);
}

.wall strong,
.wall span {
  display: block;
}

.wall span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.mobile-brief,
.mobile-tabs {
  display: none;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 40;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #26323d;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(16px);
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1160px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .sidebar .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .sidebar .nav-item {
    flex: 0 0 auto;
    text-align: center;
    white-space: nowrap;
  }

  .side-status {
    display: none;
  }

  .command-grid {
    grid-template-columns: 1fr;
  }

  .content-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .span-4,
  .span-5,
  .span-6,
  .span-7,
  .span-8,
  .span-12 {
    grid-column: span 1;
  }

  .wall {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body {
    padding-bottom: 70px;
  }

  .main {
    padding: 10px;
  }

  .sidebar .nav {
    display: none;
  }

  .topbar,
  .top-actions {
    display: grid;
    gap: 8px;
  }

  h1 {
    font-size: 20px;
  }

  select,
  .ghost,
  .primary {
    width: 100%;
  }

  .live-context {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 10px;
  }

  .live-context article {
    padding: 8px;
  }

  .command {
    display: none;
  }

  .mobile-brief {
    display: grid;
    gap: 8px;
  }

  .health {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
  }

  .health span,
  .health strong,
  .health small {
    display: block;
  }

  .health strong {
    margin: 4px 0;
    color: var(--green);
    font-size: 28px;
    font-weight: 600;
    line-height: 1;
  }

  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .kpi-row article {
    padding: 9px;
  }

  .kpi-row strong {
    font-size: 16px;
  }

  .content-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .span-4,
  .span-5,
  .span-6,
  .span-7,
  .span-8,
  .span-12 {
    grid-column: auto;
  }

  .panel,
  .area-chart,
  .area-task {
    padding: 10px;
  }

  .chart {
    height: 190px;
  }

  .video-surface,
  .video-card.compact .video-surface {
    min-height: 210px;
  }

  .video-surface strong {
    font-size: 16px;
  }

  .panel h2 {
    font-size: 15px;
  }

  table {
    font-size: 12px;
  }

  .video-surface footer {
    display: grid;
    padding: 8px;
    font-size: 12px;
  }

  .video-actions,
  .action-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .task-list article {
    grid-template-columns: 38px 1fr;
  }

  .task-list button {
    grid-column: 2;
  }

  .rank-list div {
    grid-template-columns: 84px 1fr 34px;
  }

  .wall {
    grid-template-columns: 1fr;
  }

  .mobile-tabs {
    position: fixed;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
  }

  .mobile-tabs .nav-item {
    min-width: 0;
    padding: 0 4px;
    font-size: 12px;
    text-align: center;
  }

  .toast {
    right: 12px;
    bottom: 78px;
    left: 12px;
    max-width: none;
  }
}
