:root {
  color-scheme: dark;
  --bg: #07131f;
  --surface: #0b1c2b;
  --surface-soft: #102638;
  --line: rgba(145, 184, 207, 0.18);
  --line-strong: rgba(145, 184, 207, 0.3);
  --text: #edf6fa;
  --muted: #8eabbc;
  --cyan: #49c6d0;
  --green: #67d6a3;
  --amber: #f2b55d;
  --red: #ff6b62;
  --blue: #72aee6;
}

* { box-sizing: border-box; }
.screen-pairing { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: #07131f; }
.screen-pairing[hidden] { display: none; }
.screen-pairing form { width: min(460px, 100%); padding: 38px; border: 1px solid rgba(91, 212, 188, .28); border-radius: 6px; background: #101d29; box-shadow: 0 24px 70px rgba(0, 0, 0, .4); text-align: center; }
.screen-pairing img { width: 150px; height: 58px; object-fit: contain; }
.screen-pairing p { margin: 22px 0 4px; color: var(--cyan); font-size: 13px; font-weight: 700; }
.screen-pairing h1 { margin: 0 0 24px; color: #fff; font-size: 30px; }
.screen-pairing input { width: 100%; height: 54px; margin-bottom: 12px; padding: 0 14px; border: 1px solid var(--line); border-radius: 4px; color: #fff; background: #0a1824; font: inherit; text-align: center; }
.screen-pairing input[name="code"] { font-size: 27px; font-weight: 800; letter-spacing: 8px; }
.screen-pairing button { width: 100%; height: 50px; border: 0; border-radius: 4px; color: #04110f; background: var(--cyan); font: inherit; font-weight: 800; cursor: pointer; }
.screen-pairing span { display: block; min-height: 20px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.screen-empty { min-height: 180px; display: grid; place-items: center; color: var(--muted); font-size: 16px; }

html, body { width: 100%; height: 100%; }

body {
  margin: 0;
  min-width: 1180px;
  min-height: 680px;
  overflow: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}

h1, h2, p, dl, dd { margin: 0; }
a { color: inherit; text-decoration: none; }

.ops-screen {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: 82px minmax(0, 1fr) 70px;
  gap: 12px;
  padding: 0 20px 16px;
  background:
    linear-gradient(rgba(116, 166, 190, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(116, 166, 190, 0.035) 1px, transparent 1px),
    #07131f;
  background-size: 52px 52px;
}

.ops-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(480px, 1.4fr) minmax(410px, 1fr);
  align-items: center;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.ops-header::after {
  content: "";
  position: absolute;
  left: 36%;
  right: 36%;
  bottom: -1px;
  height: 2px;
  background: var(--cyan);
}

.brand { display: flex; align-items: center; gap: 11px; width: fit-content; }
.brand img { width: 44px; height: 42px; object-fit: contain; border-radius: 4px; background: #fff; }
.brand strong, .brand em { display: block; }
.brand strong { font-size: 20px; font-weight: 700; }
.brand em { margin-top: 2px; color: var(--muted); font-size: 9px; font-style: normal; }

.screen-title { text-align: center; }
.screen-title p { margin-bottom: 4px; color: var(--cyan); font-size: 11px; }
.screen-title p i { display: inline-block; width: 5px; height: 5px; margin: 0 8px 1px 0; border-radius: 50%; background: var(--cyan); }
.screen-title h1 { font-size: 30px; font-weight: 700; letter-spacing: 0; }

.header-meta { justify-self: end; display: flex; align-items: center; gap: 18px; }
.system-status { display: flex; align-items: center; gap: 7px; color: var(--green); font-size: 12px; }
.system-status i, .refresh i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(103, 214, 163, 0.1); }
.date { padding-left: 17px; border-left: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.45; }
.date span, .date em { display: block; font-style: normal; }
.header-meta > strong { font-size: 25px; font-weight: 650; }
.weather { display: flex; align-items: baseline; gap: 8px; padding-left: 17px; border-left: 1px solid var(--line); }
.weather > span { color: var(--muted); font-size: 12px; }
.weather strong { font-size: 22px; }
.weather sup { margin-left: 2px; color: var(--muted); font-size: 10px; }

.dashboard-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  grid-template-rows: minmax(0, 1.12fr) minmax(0, 0.88fr);
  gap: 12px;
}

.panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(11, 28, 43, 0.92);
}

.panel-head {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}
.panel-head p { margin-bottom: 3px; color: var(--cyan); font-size: 9px; font-weight: 700; }
.panel-head h2 { font-size: 18px; font-weight: 650; }
.panel-head > span { color: var(--muted); font-size: 11px; }

.activity-panel { position: relative; }
.activity-carousel, .activity-slide, .activity-photo { position: absolute; inset: 0; }
.activity-slide { opacity: 0; transition: opacity 700ms ease; }
.activity-slide.active { opacity: 1; }
.activity-photo { background-position: center; background-size: cover; transform: scale(1.015); }
.activity-slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(3, 10, 17, 0.04) 30%, rgba(3, 10, 17, 0.88) 100%);
}
.activity-caption { position: absolute; z-index: 2; left: 26px; right: 26px; bottom: 24px; }
.activity-meta { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.activity-meta span, .activity-meta em { border-radius: 3px; padding: 5px 8px; font-size: 10px; font-style: normal; font-weight: 700; }
.activity-meta span { color: #062126; background: var(--cyan); }
.activity-meta em { color: #d9e8ef; background: rgba(7, 19, 31, 0.7); border: 1px solid rgba(255,255,255,0.18); }
.activity-caption h2 { margin-bottom: 7px; font-size: 27px; font-weight: 650; }
.activity-caption p { color: #d2e0e7; font-size: 14px; }
.slide-dots { position: absolute; z-index: 3; right: 24px; bottom: 27px; display: flex; gap: 7px; }
.slide-dots i { width: 18px; height: 3px; background: rgba(255,255,255,0.35); transition: width 200ms, background 200ms; }
.slide-dots i.active { width: 30px; background: var(--cyan); }

.events-panel { display: grid; grid-template-rows: 58px minmax(0, 1fr); }
.event-summary { display: flex; gap: 13px; color: var(--muted); font-size: 11px; }
.event-summary span { display: flex; align-items: center; gap: 6px; }
.event-summary i { width: 6px; height: 6px; border-radius: 50%; }
.danger { background: var(--red); }
.warning { background: var(--amber); }
.notice { background: #e8cf70; }
.event-table { min-height: 0; padding: 0 14px 12px; }
.event-scroll { height: calc(100% - 36px); overflow: hidden; }
.event-scroll-track { animation: event-scroll 20s linear infinite; }
.event-scroll-track:hover { animation-play-state: paused; }
.event-row {
  min-height: 43px;
  display: grid;
  grid-template-columns: 1.6fr 0.7fr 0.65fr 0.8fr 0.75fr;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid rgba(145, 184, 207, 0.1);
  padding: 0 9px;
  color: #d7e5ec;
  font-size: 12px;
}
.event-head { min-height: 36px; color: var(--muted); font-size: 10px; border-color: var(--line); }
.event-row > span:first-child { display: flex; align-items: center; min-width: 0; }
.event-row b { font-weight: 600; }
.event-row small { margin-left: 7px; color: var(--muted); font-size: 9px; }
.event-dot { flex: 0 0 auto; width: 6px; height: 6px; margin-right: 9px; border-radius: 50%; }
.event-row time { color: var(--muted); }
.event-row em { width: fit-content; border-radius: 3px; padding: 4px 7px; font-size: 10px; font-style: normal; font-weight: 600; }
.event-row .done { color: var(--green); background: rgba(103, 214, 163, 0.1); }
.event-row .doing { color: var(--amber); background: rgba(242, 181, 93, 0.1); }
.event-row .closed { color: var(--blue); background: rgba(114, 174, 230, 0.1); }
.event-row.urgent { margin-top: -1px; border: 1px solid rgba(255, 107, 98, 0.35); background: rgba(255, 107, 98, 0.045); }

@keyframes event-scroll { to { transform: translateY(-301px); } }

.monitor-panel, .service-panel { display: grid; grid-template-rows: 58px minmax(0, 1fr); }
.metric-grid { min-height: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); }
.metric { position: relative; display: flex; flex-direction: column; justify-content: center; padding: 10px 17px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric:nth-child(3n) { border-right: 0; }
.metric:nth-child(n+4) { border-bottom: 0; }
.metric p { margin-bottom: 7px; color: var(--muted); font-size: 11px; }
.metric strong { color: var(--text); font-size: 27px; font-weight: 650; line-height: 1; }
.metric strong em { margin-left: 4px; color: var(--muted); font-size: 10px; font-style: normal; font-weight: 500; }
.metric > span { margin-top: 8px; font-size: 10px; }
.metric .up { color: var(--green); }
.metric .up small { margin-left: 5px; color: var(--muted); }
.metric::before { content: ""; position: absolute; left: 17px; top: 0; width: 24px; height: 2px; background: var(--cyan); }
.metric:nth-child(2)::before, .metric:nth-child(5)::before { background: var(--amber); }
.metric:nth-child(3)::before, .metric:nth-child(6)::before { background: var(--green); }

.service-layout { min-height: 0; display: grid; grid-template-columns: 1.65fr 1fr; }
.service-stats { min-height: 0; display: grid; grid-template-columns: repeat(2, 1fr); }
.service-stats article { display: grid; grid-template-columns: 1fr auto; align-content: center; gap: 8px 12px; padding: 12px 17px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.service-stats article:nth-child(n+3) { border-bottom: 0; }
.service-stats span { color: var(--muted); font-size: 11px; }
.service-stats strong { grid-row: 2; font-size: 22px; font-weight: 650; }
.service-stats strong em { margin-left: 4px; color: var(--muted); font-size: 9px; font-style: normal; font-weight: 500; }
.service-stats small { grid-row: 2; align-self: end; color: var(--green); font-size: 9px; }
.org-overview { min-height: 0; padding: 14px 16px; background: rgba(16, 38, 56, 0.55); }
.org-overview > p { margin-bottom: 9px; color: var(--muted); font-size: 10px; }
.org-overview dl { display: grid; grid-template-columns: repeat(2, 1fr); height: calc(100% - 20px); }
.org-overview dl div { display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.org-overview dl div:nth-child(2n) { padding-left: 14px; border-right: 0; }
.org-overview dl div:nth-child(n+3) { border-bottom: 0; }
.org-overview dt { color: var(--muted); font-size: 9px; }
.org-overview dd { margin-top: 5px; font-size: 19px; font-weight: 650; }
.org-overview dd small { margin-left: 3px; color: var(--muted); font-size: 9px; font-weight: 500; }

.alarm-bar { min-height: 0; display: grid; grid-template-columns: 190px minmax(0, 1fr) 120px; align-items: center; border: 1px solid rgba(255, 107, 98, 0.24); border-radius: 6px; background: #101d29; }
.alarm-title { height: 100%; display: flex; align-items: center; gap: 11px; padding: 0 18px; border-right: 1px solid var(--line); }
.alarm-title > i { width: 9px; height: 9px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 5px rgba(255, 107, 98, 0.1); }
.alarm-title small, .alarm-title strong { display: block; }
.alarm-title small { margin-bottom: 2px; color: var(--red); font-size: 8px; }
.alarm-title strong { font-size: 18px; font-weight: 650; }
.ticker { min-width: 0; display: grid; grid-template-columns: repeat(3, 1fr); }
.ticker span { position: relative; min-width: 0; overflow: hidden; padding: 0 24px; color: #dce8ed; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.ticker span + span { border-left: 1px solid var(--line); }
.ticker span::before { content: ""; display: inline-block; width: 4px; height: 4px; margin: 0 9px 3px 0; border-radius: 50%; background: var(--red); }
.ticker.rolling { animation: ticker-roll 380ms ease both; }
.refresh { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--muted); font-size: 10px; }

@keyframes ticker-roll { from { opacity: 0; transform: translateY(8px); } }

@media (max-height: 820px) {
  .ops-screen { grid-template-rows: 70px minmax(0, 1fr) 58px; gap: 9px; padding: 0 14px 11px; }
  .ops-header { grid-template-columns: minmax(230px, .8fr) minmax(400px, 1.4fr) minmax(380px, 1fr); }
  .screen-title h1 { font-size: 25px; }
  .header-meta { gap: 12px; }
  .dashboard-grid { gap: 9px; }
  .panel-head { height: 48px; padding: 0 14px; }
  .events-panel, .monitor-panel, .service-panel { grid-template-rows: 48px minmax(0, 1fr); }
  .event-row { min-height: 37px; }
  .event-head { min-height: 31px; }
  .event-scroll { height: calc(100% - 31px); }
  .activity-caption { bottom: 18px; }
  .activity-caption h2 { font-size: 22px; }
  .slide-dots { bottom: 21px; }
  .metric strong { font-size: 23px; }
  .metric > span { margin-top: 5px; }
  .service-stats article { padding: 7px 13px; }
  .service-stats strong { font-size: 19px; }
  .org-overview { padding: 9px 13px; }
  @keyframes event-scroll { to { transform: translateY(-259px); } }
}

@media (max-width: 1360px) {
  body { min-width: 1100px; }
  .ops-header { grid-template-columns: 235px minmax(390px, 1fr) 390px; }
  .system-status { display: none; }
  .screen-title h1 { font-size: 24px; }
  .brand strong { font-size: 17px; }
  .activity-caption h2 { font-size: 22px; }
  .event-row { grid-template-columns: 1.55fr .65fr .6fr .75fr .72fr; padding-inline: 6px; }
  .metric { padding-inline: 13px; }
  .ticker span { padding-inline: 15px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .event-scroll-track, .ticker.rolling { animation: none; }
  .activity-slide { transition: none; }
}
