:root {
  --bg: #070b0d;
  --ink: #edf4ee;
  --muted: #94a39b;
  --panel: rgba(12, 17, 17, 0.86);
  --line: rgba(163, 184, 172, 0.22);
  --field: rgba(23, 34, 31, 0.78);
  --accent: #72f39a;
  --accent-2: #ff7043;
  --gold: #d7b957;
  --blue: #55d8ff;
  --danger: #ff5b5b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --radius: 8px;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  content: "";
  pointer-events: none;
}

body::before {
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(7, 11, 13, 0.96) 0%, rgba(7, 11, 13, 0.7) 42%, rgba(7, 11, 13, 0.92) 100%),
    linear-gradient(180deg, rgba(7, 11, 13, 0.35), rgba(7, 11, 13, 0.98)),
    url("/assets/delta-operator-bg.jpg") center top / cover no-repeat;
}

body::after {
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(114, 243, 154, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(85, 216, 255, 0.04) 1px, transparent 1px),
    radial-gradient(circle at 20% 0%, rgba(114, 243, 154, 0.14), transparent 34%),
    radial-gradient(circle at 84% 16%, rgba(215, 185, 87, 0.12), transparent 28%);
  background-size: 34px 34px, 34px 34px, auto, auto;
  mix-blend-mode: screen;
  opacity: 0.78;
}

button,
select {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 11, 13, 0.82);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
}

.topbar h1,
.panel h2 {
  margin: 0;
}

.topbar h1 {
  font-size: 24px;
  letter-spacing: 0;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  object-fit: contain;
  padding: 6px;
  border: 1px solid rgba(114, 243, 154, 0.35);
  border-radius: 8px;
  background: rgba(238, 245, 236, 0.95);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05), 0 0 26px rgba(114, 243, 154, 0.16);
}

.eyebrow,
.section-kicker {
  display: block;
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.timestamp,
.subtle,
.panel p {
  color: var(--muted);
}

.icon-button,
.account-tab,
.category-select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(12, 17, 17, 0.72);
  color: var(--ink);
}

.icon-button {
  padding: 0 12px;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(114, 243, 154, 0.06);
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.icon-button:hover,
.account-tab:hover {
  border-color: rgba(114, 243, 154, 0.72);
  background: rgba(114, 243, 154, 0.12);
}

main {
  position: relative;
  z-index: 1;
  width: min(1480px, calc(100% - 32px));
  margin: 18px auto 48px;
}

main::before,
main::after {
  position: fixed;
  top: 112px;
  bottom: 24px;
  width: clamp(120px, 13vw, 230px);
  content: "";
  opacity: 0.22;
  pointer-events: none;
  filter: saturate(0.9) contrast(1.05);
}

main::before {
  left: 0;
  background:
    linear-gradient(90deg, rgba(12, 18, 19, 0), rgba(12, 18, 19, 0.72)),
    url("/assets/delta-operator-mask.jpg") left center / auto 88% no-repeat;
}

main::after {
  right: 0;
  background:
    linear-gradient(270deg, rgba(12, 18, 19, 0), rgba(12, 18, 19, 0.72)),
    url("/assets/delta-operator-bg.jpg") right center / auto 88% no-repeat;
}

.panel {
  min-width: 0;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.command-strip {
  position: relative;
  overflow: hidden;
  min-height: 132px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  border-left: 6px solid var(--accent);
  background:
    linear-gradient(92deg, rgba(12, 17, 17, 0.98) 0%, rgba(12, 17, 17, 0.83) 50%, rgba(12, 17, 17, 0.62) 100%),
    url("/assets/delta-operator-mask.jpg") right 22% center / auto 180% no-repeat;
}

.command-strip::before {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(114, 243, 154, 0.18), transparent 28%),
    linear-gradient(270deg, rgba(215, 185, 87, 0.16), transparent 38%);
  content: "";
  pointer-events: none;
}

.command-strip > * {
  position: relative;
  z-index: 1;
}

.command-strip p {
  margin: 0;
  max-width: 540px;
  color: #c7d2cd;
}

.brief-right {
  display: grid;
  justify-items: end;
  gap: 14px;
  max-width: 680px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  margin-bottom: 14px;
}

.section-head p {
  margin: 0;
  max-width: 420px;
  text-align: right;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

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

.automation-grid.compact {
  grid-template-columns: repeat(4, minmax(104px, auto));
  gap: 8px;
  width: 100%;
  justify-content: end;
}

.automation-pill {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(190, 212, 199, 0.2);
  border-radius: 6px;
  background: rgba(10, 16, 16, 0.48);
}

.automation-pill span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.automation-pill strong {
  display: block;
  overflow: hidden;
  max-width: 170px;
  color: #f4fff7;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-stat strong {
  display: block;
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.range-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(19, 28, 26, 0.92), rgba(11, 16, 16, 0.9));
  box-shadow: var(--shadow);
}

.range-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 12px;
}

.range-head h2,
.range-head h3 {
  margin: 0;
}

.range-head.compact {
  margin-bottom: 10px;
}

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

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

.account-range-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
}

.account-range-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric-card,
.work-card,
.category-card,
.account-health,
.account-row,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.metric-card {
  min-height: 118px;
  padding: 14px;
  background:
    linear-gradient(180deg, rgba(21, 31, 28, 0.94), rgba(9, 14, 14, 0.92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.metric-card strong {
  display: block;
  margin-top: 16px;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
  color: #f5fff8;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.75fr);
  gap: 16px;
}

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

.wide {
  min-width: 0;
}

.trend-list {
  display: grid;
  gap: 12px;
}

.trend-row {
  display: grid;
  grid-template-columns: 120px 1fr 90px;
  gap: 14px;
  align-items: center;
  min-height: 42px;
}

.market-trend-row {
  display: grid;
  grid-template-columns: 70px minmax(140px, 1fr) repeat(3, minmax(86px, auto)) 70px;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.market-trend-row:last-child {
  border-bottom: 0;
}

.market-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.market-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--blue), var(--gold));
}

.sparkline {
  display: flex;
  align-items: end;
  gap: 4px;
  height: 42px;
  padding: 6px 0;
}

.sparkline i {
  display: block;
  width: 100%;
  max-width: 28px;
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--accent), rgba(85, 216, 255, 0.7));
}

.focus-list,
.work-list,
.alert-list,
.diagnostics-list,
.review-list {
  display: grid;
  gap: 10px;
}

.alert-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.alert-card,
.review-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 20, 19, 0.88);
}

.alert-card {
  padding: 12px;
  border-left: 5px solid var(--blue);
}

.alert-card.warning {
  border-left-color: var(--gold);
}

.alert-card.danger {
  border-left-color: var(--danger);
}

.alert-card p {
  margin: 6px 0 0;
}

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

.diagnostic-card {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(220px, 0.9fr);
  gap: 14px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: var(--radius);
  background: rgba(13, 20, 19, 0.9);
}

.diagnostic-card.success {
  border-left-color: var(--accent);
}

.diagnostic-card.warning {
  border-left-color: var(--gold);
}

.diagnostic-card.action {
  border-left-color: var(--accent-2);
}

.diagnostic-card p,
.diagnostic-action p {
  margin: 6px 0 0;
}

.diagnostic-action {
  padding: 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.diagnostic-action span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

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

.review-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  gap: 12px;
  align-items: center;
  padding: 12px;
}

.work-card {
  padding: 12px;
  cursor: grab;
}

.work-card:active,
.account-row:active {
  cursor: grabbing;
}

.work-title {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 10px;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-weight: 700;
  line-height: 1.35;
}

.work-meta,
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.work-actions,
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.table-actions {
  margin-top: 0;
}

.video-button,
.video-link,
.video-open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(114, 243, 154, 0.34);
  border-radius: 6px;
  background: rgba(114, 243, 154, 0.1);
  color: #eaffef;
  font: inherit;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}

.video-link {
  border-color: rgba(85, 216, 255, 0.3);
  background: rgba(85, 216, 255, 0.08);
  color: #d9f7ff;
}

.video-button:hover,
.video-link:hover,
.video-open-link:hover {
  border-color: var(--accent);
  background: rgba(114, 243, 154, 0.18);
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  font-size: 12px;
}

.chip.hot {
  background: rgba(255, 112, 67, 0.16);
  color: #ffb197;
}

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

.category-card {
  min-height: 172px;
  padding: 12px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.category-card.drag-over {
  border-color: var(--accent);
  background: rgba(114, 243, 154, 0.12);
}

.category-card h3 {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 16px;
}

.category-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}

.mini-stat {
  padding: 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
}

.mini-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.mini-stat strong {
  font-size: 16px;
}

.drop-hint {
  min-height: 34px;
  padding: 8px;
  border: 1px dashed var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
}

.account-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.account-tab {
  padding: 0 12px;
  cursor: pointer;
}

.account-tab.active {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(114, 243, 154, 0.26), rgba(114, 243, 154, 0.14));
  color: #edfff3;
}

.account-detail {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.account-health {
  display: grid;
  grid-template-columns: 1.2fr repeat(4, 1fr);
  gap: 10px;
  padding: 14px;
}

.health-title h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.account-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
  padding: 8px;
  cursor: grab;
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 14px;
  min-width: 0;
}

.detail-grid > *,
.dashboard-grid > * {
  min-width: 0;
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(9, 14, 14, 0.78);
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  background: rgba(9, 14, 14, 0.78);
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

th {
  position: sticky;
  top: 0;
  background: rgba(17, 27, 25, 0.98);
  color: var(--muted);
  font-weight: 800;
}

tbody tr:hover {
  background: rgba(114, 243, 154, 0.05);
}

tr:last-child td {
  border-bottom: 0;
}

.category-select {
  width: 140px;
  padding: 0 8px;
}

.official-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.empty-state {
  padding: 18px;
  color: var(--muted);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid rgba(114, 243, 154, 0.32);
  background: rgba(6, 11, 12, 0.96);
  color: var(--ink);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

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

.video-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  justify-content: end;
  background: rgba(3, 7, 8, 0.54);
  backdrop-filter: blur(6px);
}

.video-modal.show {
  display: flex;
}

.video-drawer {
  width: min(560px, 100%);
  height: 100%;
  padding: 18px;
  border-left: 1px solid rgba(190, 212, 199, 0.26);
  background:
    linear-gradient(180deg, rgba(24, 35, 33, 0.98), rgba(10, 16, 16, 0.98)),
    url("/assets/delta-operator-mask.jpg") right bottom / 70% auto no-repeat;
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.34);
}

.video-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 14px;
}

.video-head h2 {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: 18px;
  line-height: 1.35;
}

.video-frame-wrap {
  position: relative;
  overflow: hidden;
  min-height: 70vh;
  border: 1px solid rgba(190, 212, 199, 0.22);
  border-radius: var(--radius);
  background: rgba(3, 7, 8, 0.78);
}

.video-frame-wrap iframe {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 70vh;
  border: 0;
  background: #050708;
}

.video-fallback {
  position: relative;
  z-index: 2;
  display: grid;
  gap: 4px;
  margin: 12px;
  padding: 12px;
  border: 1px solid rgba(215, 185, 87, 0.26);
  border-radius: 6px;
  background: rgba(12, 18, 19, 0.82);
  color: var(--muted);
  font-size: 13px;
}

.video-open-link {
  width: 100%;
  margin-top: 12px;
}

@media (max-width: 1100px) {
  .metric-grid,
  .category-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .detail-grid,
  .automation-grid,
  .alert-list,
  .diagnostics-list,
  .review-list,
  .account-range-grid,
  .account-health {
    grid-template-columns: 1fr;
  }

  main::before,
  main::after {
    opacity: 0.12;
  }
}

@media (max-width: 720px) {
  .topbar,
  .command-strip,
  .section-head {
    display: block;
  }

  .top-actions {
    margin-top: 12px;
  }

  .brief-right {
    justify-items: start;
    margin-top: 14px;
  }

  .metric-grid,
  .category-board,
  .official-summary,
  .range-grid,
  .review-card,
  .diagnostic-card,
  .account-range-metrics,
  .automation-grid.compact {
    grid-template-columns: 1fr;
  }

  main::before,
  main::after {
    display: none;
  }

  .market-trend-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  main {
    width: min(100% - 20px, 1480px);
  }

  .video-drawer {
    padding: 14px;
  }

  .video-frame-wrap,
  .video-frame-wrap iframe {
    min-height: 62vh;
    height: 62vh;
  }
}
