:root {
  color-scheme: dark;
  --canvas: #07100f;
  --surface: #0c1917;
  --surface-raised: #10201d;
  --surface-soft: #132723;
  --line: rgba(180, 207, 194, 0.14);
  --line-strong: rgba(180, 207, 194, 0.24);
  --text: #f3f7f2;
  --muted: #94aaa0;
  --teal: #4dc9b4;
  --green: #78dca7;
  --amber: #f2ba69;
  --red: #ff736c;
  --blue: #81b9da;
  --ivory: #e7eadf;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body {
  margin: 0;
  min-width: 1180px;
  min-height: 680px;
  overflow: hidden;
  color: var(--text);
  background: var(--canvas);
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  text-rendering: geometricPrecision;
}
h1, h2, p, dl, dd { margin: 0; }
a { color: inherit; text-decoration: none; }

.ops-screen {
  width: 100vw;
  height: 100vh;
  display: grid;
  grid-template-rows: 92px minmax(0, 1fr) 76px;
  gap: 14px;
  padding: 0 24px 20px;
  background: linear-gradient(rgba(149, 187, 168, .03) 1px, transparent 1px), linear-gradient(90deg, rgba(149, 187, 168, .03) 1px, transparent 1px), var(--canvas);
  background-size: 64px 64px;
}
.ops-header {
  position: relative;
  display: grid;
  grid-template-columns: minmax(290px, .85fr) minmax(500px, 1.35fr) minmax(520px, 1fr);
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line-strong);
}
.ops-header::after { content: ""; position: absolute; left: 42%; bottom: -1px; width: 16%; height: 2px; background: var(--teal); }
.brand { display: flex; align-items: center; gap: 13px; width: fit-content; }
.brand img { width: 52px; height: 50px; object-fit: contain; border-radius: 4px; background: #fff; }
.brand strong, .brand em { display: block; }
.brand strong { font-size: 22px; font-weight: 700; }
.brand em { margin-top: 4px; color: var(--muted); font-size: 10px; font-style: normal; }
.screen-title { text-align: center; }
.screen-title p { margin-bottom: 5px; color: var(--teal); font-size: 11px; font-weight: 650; }
.screen-title p i { display: inline-block; width: 6px; height: 6px; margin: 0 8px 1px 0; border-radius: 50%; background: var(--teal); }
.screen-title h1 { font-size: 32px; font-weight: 720; }
.header-meta { justify-self: end; display: flex; align-items: center; gap: 20px; min-width: 0; }
.sound-toggle { height: 34px; display: inline-flex; align-items: center; gap: 8px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--muted); background: var(--surface); font: inherit; font-size: 11px; cursor: pointer; white-space: nowrap; }
.sound-toggle i { position: relative; width: 12px; height: 12px; border: 2px solid currentColor; border-radius: 50%; }
.sound-toggle i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 2px; height: 2px; border-radius: 50%; background: currentColor; }
.sound-toggle.enabled { color: var(--green); border-color: rgba(120, 220, 167, .3); }
.sound-toggle.has-urgent, .sound-toggle.needs-action { color: #fff; border-color: var(--red); background: rgba(255, 115, 108, .14); }
.sound-toggle.has-urgent i, .sound-toggle.needs-action i { color: var(--red); }
.sound-toggle:focus-visible { outline: 3px solid rgba(77, 201, 180, .25); outline-offset: 2px; }
.system-status { display: flex; align-items: center; gap: 8px; max-width: 150px; color: var(--green); font-size: 12px; }
.system-status span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.system-status i, .refresh i { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(120, 220, 167, .1); }
.date { padding-left: 19px; border-left: 1px solid var(--line-strong); color: var(--muted); font-size: 12px; line-height: 1.5; }
.date span, .date em { display: block; font-style: normal; white-space: nowrap; }
.header-meta > strong { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 29px; font-weight: 620; }
.weather { display: flex; align-items: baseline; gap: 9px; padding-left: 19px; border-left: 1px solid var(--line-strong); }
.weather > span { color: var(--muted); font-size: 12px; }
.weather strong { font-size: 25px; font-weight: 620; }
.weather sup { margin-left: 2px; color: var(--muted); font-size: 10px; }

.dashboard-grid { min-height: 0; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr); grid-template-rows: minmax(0, 1.14fr) minmax(0, .86fr); gap: 14px; }
.panel { min-width: 0; min-height: 0; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 6px; background: rgba(12, 25, 23, .96); box-shadow: 0 12px 32px rgba(0, 0, 0, .12); }
.panel-head { height: 66px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid var(--line); background: rgba(16, 32, 29, .78); }
.panel-head p { margin-bottom: 4px; color: var(--teal); font-size: 9px; font-weight: 800; }
.panel-head h2 { font-size: 21px; font-weight: 680; }
.panel-head > span { color: var(--muted); font-size: 12px; }

.activity-panel { position: relative; border-color: rgba(200, 221, 211, .26); }
.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.012); }
.activity-slide::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(3, 9, 8, .72) 0%, rgba(3, 9, 8, .12) 52%, transparent 76%), linear-gradient(0deg, rgba(3, 9, 8, .82), transparent 55%); }
.activity-caption { position: absolute; z-index: 2; left: 32px; right: 32px; bottom: 30px; max-width: 72%; }
.activity-meta { display: flex; align-items: center; gap: 9px; margin-bottom: 13px; }
.activity-meta span, .activity-meta em { border-radius: 3px; padding: 6px 9px; font-size: 11px; font-style: normal; font-weight: 700; }
.activity-meta span { color: #051713; background: var(--teal); }
.activity-meta em { color: var(--ivory); background: rgba(7, 16, 15, .7); border: 1px solid rgba(255,255,255,.22); }
.activity-caption h2 { margin-bottom: 9px; font-size: 34px; font-weight: 700; line-height: 1.15; text-shadow: 0 3px 16px rgba(0,0,0,.45); }
.activity-caption p { color: #e1e9e4; font-size: 16px; text-shadow: 0 2px 12px rgba(0,0,0,.5); }
.slide-dots { position: absolute; z-index: 3; right: 28px; bottom: 31px; display: flex; gap: 7px; }
.slide-dots i { width: 22px; height: 3px; background: rgba(255,255,255,.35); transition: width 200ms, background 200ms; }
.slide-dots i.active { width: 38px; background: var(--teal); }

.events-panel { display: grid; grid-template-rows: 66px minmax(0, 1fr); border-top: 2px solid var(--red); }
.event-summary { display: flex; gap: 18px; color: var(--muted); font-size: 12px; }
.event-summary span { display: flex; align-items: center; gap: 7px; }
.event-summary b { color: var(--text); font-size: 15px; }
.event-summary i { width: 7px; height: 7px; border-radius: 50%; }
.danger { background: var(--red); }
.warning { background: var(--amber); }
.notice { background: #e1ca72; }
.event-table { min-height: 0; padding: 0 16px 14px; }
.event-scroll { height: calc(100% - 42px); overflow: hidden; }
.event-scroll-track { animation: event-scroll 24s linear infinite; }
.event-scroll-track:hover { animation-play-state: paused; }
.event-row { min-height: 50px; display: grid; grid-template-columns: 1.7fr .72fr .7fr .82fr .82fr; align-items: center; gap: 10px; border-bottom: 1px solid rgba(180, 207, 194, .1); padding: 0 12px; color: #dbe6e0; font-size: 13px; }
.event-head { min-height: 42px; color: var(--muted); font-size: 11px; border-color: var(--line); }
.event-row > span:first-child { display: flex; align-items: center; min-width: 0; }
.event-row b { overflow: hidden; font-size: 14px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }
.event-row small { margin-left: 8px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.event-dot { flex: 0 0 auto; width: 7px; height: 7px; margin-right: 10px; border-radius: 50%; }
.event-row time { color: var(--muted); }
.event-row em { width: fit-content; border-radius: 3px; padding: 6px 9px; font-size: 11px; font-style: normal; font-weight: 650; white-space: nowrap; }
.event-row .done { color: var(--green); background: rgba(120, 220, 167, .12); }
.event-row .doing { color: var(--amber); background: rgba(242, 186, 105, .12); }
.event-row .closed { color: var(--blue); background: rgba(129, 185, 218, .12); }
.event-row .urgent-state { color: #fff; background: var(--red); }
.event-row.urgent { position: relative; margin-top: -1px; border: 1px solid rgba(255, 115, 108, .72); background: rgba(255, 115, 108, .14); }
.event-row.urgent::before { content: ""; position: absolute; inset: 0 auto 0 -1px; width: 3px; background: var(--red); }
.event-row.urgent b, .event-row.urgent time { color: #fff; }
.event-row.urgent small { color: #ffaaa5; }
.events-panel.has-urgent .panel-head { background: rgba(255, 115, 108, .08); }
.screen-empty { min-height: 180px; display: grid; place-items: center; color: var(--muted); font-size: 16px; }
@keyframes event-scroll {
  0%, 22% { transform: translateY(0); }
  100% { transform: translateY(-350px); }
}

.monitor-panel, .service-panel { display: grid; grid-template-rows: 66px 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: 13px 21px; 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: 9px; color: var(--muted); font-size: 13px; }
.metric strong { color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 34px; font-weight: 650; line-height: 1.12; }
.metric strong em { margin-left: 5px; color: var(--muted); font-family: "PingFang SC", sans-serif; font-size: 11px; font-style: normal; font-weight: 500; }
.metric > span { margin-top: 10px; color: var(--green); font-size: 11px; }
.metric .up small { margin-left: 5px; color: var(--muted); }
.metric::before { content: ""; position: absolute; left: 21px; top: 0; width: 34px; height: 2px; background: var(--teal); }
.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.55fr 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: 9px 12px; padding: 14px 20px; 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: 12px; }
.service-stats strong { grid-row: 2; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 27px; font-weight: 650; line-height: 1.12; }
.service-stats strong em { margin-left: 4px; color: var(--muted); font-family: "PingFang SC", sans-serif; font-size: 10px; font-style: normal; font-weight: 500; }
.service-stats small { grid-row: 2; align-self: end; color: var(--green); font-size: 10px; }
.org-overview { min-height: 0; padding: 16px 18px; background: rgba(19, 39, 35, .7); }
.org-overview > p { margin-bottom: 10px; color: var(--teal); font-size: 11px; font-weight: 650; }
.org-overview dl { display: grid; grid-template-columns: repeat(2, 1fr); height: calc(100% - 24px); }
.org-overview dl div { min-width: 0; display: flex; flex-direction: column; justify-content: center; padding-right: 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.org-overview dl div:nth-child(2n) { padding-right: 0; padding-left: 16px; border-right: 0; }
.org-overview dl div:nth-child(n+3) { border-bottom: 0; }
.org-overview dt { color: var(--muted); font-size: 10px; }
.org-overview dd { overflow: hidden; margin-top: 7px; color: var(--ivory); font-size: 17px; font-weight: 620; text-overflow: ellipsis; white-space: nowrap; }

.alarm-bar { min-height: 0; display: grid; grid-template-columns: 220px minmax(0, 1fr) 140px; align-items: center; border: 1px solid rgba(255, 115, 108, .35); border-radius: 6px; background: #151d1b; box-shadow: inset 4px 0 var(--red); }
.alarm-title { height: 100%; display: flex; align-items: center; gap: 13px; padding: 0 23px; border-right: 1px solid var(--line-strong); }
.alarm-title > i { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 6px rgba(255, 115, 108, .11); }
.alarm-title small, .alarm-title strong { display: block; }
.alarm-title small { margin-bottom: 3px; color: var(--red); font-size: 8px; }
.alarm-title strong { font-size: 21px; font-weight: 680; }
.ticker { min-width: 0; display: grid; grid-template-columns: repeat(3, 1fr); }
.ticker span { min-width: 0; overflow: hidden; padding: 0 26px; color: #e0e8e3; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.ticker span + span { border-left: 1px solid var(--line-strong); }
.ticker span::before { content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 10px 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: 9px; color: var(--muted); font-size: 11px; }
@keyframes ticker-roll { from { opacity: 0; transform: translateY(8px); } }

.screen-pairing { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: var(--canvas); }
.screen-pairing[hidden] { display: none; }
.screen-pairing form { position: relative; width: min(500px, 100%); padding: 46px 48px 42px; border: 1px solid var(--line-strong); border-top: 3px solid var(--teal); border-radius: 6px; background: var(--surface-raised); box-shadow: 0 28px 80px rgba(0,0,0,.38); text-align: center; }
.screen-pairing form::before { content: "SCREEN SETUP"; position: absolute; top: 18px; left: 20px; color: var(--muted); font-size: 8px; font-weight: 800; }
.screen-pairing img { width: 126px; height: 64px; object-fit: contain; }
.screen-pairing p { margin: 22px 0 6px; color: var(--teal); font-size: 13px; font-weight: 700; }
.screen-pairing h1 { margin: 0 0 28px; color: #fff; font-size: 34px; }
.screen-pairing input { width: 100%; height: 58px; margin-bottom: 12px; padding: 0 16px; border: 1px solid var(--line-strong); border-radius: 4px; outline: none; color: #fff; background: #091411; font: inherit; text-align: center; transition: border-color 160ms, box-shadow 160ms; }
.screen-pairing input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(77, 201, 180, .12); }
.screen-pairing input[name="code"] { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 30px; font-weight: 700; letter-spacing: 8px; }
.screen-pairing button { width: 100%; height: 54px; border: 0; border-radius: 4px; color: #04110e; background: var(--teal); font: inherit; font-size: 16px; font-weight: 800; cursor: pointer; }
.screen-pairing button:hover { background: #66d8c4; }
.screen-pairing button:focus-visible { outline: 3px solid rgba(77, 201, 180, .34); outline-offset: 3px; }
.screen-pairing span { display: block; min-height: 20px; margin-top: 16px; color: var(--muted); font-size: 12px; }

@media (max-height: 820px) {
  .ops-screen { grid-template-rows: 74px minmax(0, 1fr) 60px; gap: 10px; padding: 0 16px 12px; }
  .ops-header { grid-template-columns: minmax(240px, .8fr) minmax(420px, 1.25fr) minmax(410px, 1fr); gap: 16px; }
  .brand img { width: 42px; height: 40px; }
  .brand strong { font-size: 18px; }
  .screen-title h1 { font-size: 26px; }
  .header-meta { gap: 13px; }
  .sound-toggle { height: 30px; padding-inline: 9px; font-size: 10px; }
  .header-meta > strong { font-size: 25px; }
  .dashboard-grid { gap: 10px; }
  .panel-head { height: 52px; padding: 0 16px; }
  .panel-head h2 { font-size: 18px; }
  .events-panel, .monitor-panel, .service-panel { grid-template-rows: 52px minmax(0, 1fr); }
  .event-row { min-height: 40px; font-size: 11px; }
  .event-head { min-height: 34px; }
  .event-scroll { height: calc(100% - 34px); }
  .activity-caption { left: 25px; bottom: 22px; }
  .activity-caption h2 { font-size: 27px; }
  .activity-caption p { font-size: 14px; }
  .slide-dots { bottom: 23px; }
  .metric { padding: 9px 16px; }
  .metric strong { font-size: 27px; }
  .metric p { margin-bottom: 6px; font-size: 11px; }
  .metric > span { margin-top: 6px; font-size: 9px; }
  .metric::before { left: 16px; }
  .service-stats article { padding: 8px 14px; }
  .service-stats strong { font-size: 21px; }
  .org-overview { padding: 10px 14px; }
  .org-overview dd { font-size: 14px; }
  .alarm-title strong { font-size: 18px; }
  .ticker span { padding-inline: 18px; font-size: 13px; }
  @keyframes event-scroll {
    0%, 22% { transform: translateY(0); }
    100% { transform: translateY(-280px); }
  }
}

@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; }
  .event-row { grid-template-columns: 1.6fr .66fr .62fr .75fr .76fr; padding-inline: 7px; }
  .metric { padding-inline: 14px; }
  .ticker span { padding-inline: 14px; font-size: 12px; }
}

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