:root {
  --bg: #030a18;
  --panel: rgba(8, 26, 54, .62);
  --line: rgba(64, 160, 255, .22);
  --line-strong: rgba(0, 229, 255, .55);
  --text: #d8e9ff;
  --muted: #7f9cc4;
  --cyan: #00e5ff;
  --blue: #3d8bff;
  --green: #1fe0a0;
  --amber: #ffb547;
  --red: #ff4d6d;
  --num: "DIN Alternate", "Bahnschrift", "Roboto Mono", "Consolas", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(0, 120, 255, .22), transparent 60%),
    radial-gradient(800px 500px at 100% 100%, rgba(0, 229, 255, .08), transparent 60%),
    linear-gradient(rgba(64, 160, 255, .05) 1px, transparent 1px) 0 0 / 40px 40px,
    linear-gradient(90deg, rgba(64, 160, 255, .05) 1px, transparent 1px) 0 0 / 40px 40px,
    var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.screen {
  height: 100vh;
  min-height: 760px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 14px;
  padding: 0 18px 18px;
}

/* ---------------------------------------------------------------- header */
.head {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: 72px;
}
.head::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong) 30%, var(--line-strong) 70%, transparent);
}
.head-title { text-align: center; padding: 0 60px; position: relative; }
.head-title::before, .head-title::after {
  content: ""; position: absolute; top: 50%; width: 46px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan));
}
.head-title::before { left: 0; }
.head-title::after { right: 0; transform: scaleX(-1); }
.head-title h1 {
  margin: 0;
  font-size: 28px; letter-spacing: 6px; font-weight: 700;
  background: linear-gradient(180deg, #ffffff 20%, #7fdcff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 24px rgba(0, 229, 255, .25);
}
.head-title p { margin: 2px 0 0; font-size: 11px; letter-spacing: 5px; color: var(--muted); }
.head-side { display: flex; align-items: center; gap: 16px; font-size: 13px; color: var(--muted); }
.head-side.right { justify-content: flex-end; }
.clock { font-family: var(--num); font-size: 26px; color: var(--cyan); letter-spacing: 2px; text-shadow: 0 0 12px rgba(0, 229, 255, .5); }
.sync b { color: var(--text); font-weight: 500; font-family: var(--num); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--muted); vertical-align: 1px; }
.dot.ok { background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
.dot.warn { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.dot.err { background: var(--red); box-shadow: 0 0 8px var(--red); }
@keyframes pulse { 50% { opacity: .35; } }
.health {
  padding: 4px 14px; border-radius: 3px; font-weight: 600; letter-spacing: 1px;
  border: 1px solid var(--line); color: var(--text);
}
.health.red { color: var(--red); border-color: rgba(255, 77, 109, .6); background: rgba(255, 77, 109, .1); box-shadow: 0 0 14px rgba(255, 77, 109, .25) inset; }
.health.amber { color: var(--amber); border-color: rgba(255, 181, 71, .6); background: rgba(255, 181, 71, .1); }
.health.green { color: var(--green); border-color: rgba(31, 224, 160, .6); background: rgba(31, 224, 160, .1); }
.refresh {
  width: 32px; height: 32px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--cyan); font-size: 17px;
}
.refresh:hover { border-color: var(--cyan); box-shadow: 0 0 10px rgba(0, 229, 255, .35); }
.refresh:disabled { opacity: .4; cursor: wait; }

/* ---------------------------------------------------------------- KPI */
.kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.kpi {
  position: relative; overflow: hidden;
  padding: 12px 16px 14px;
  background: linear-gradient(160deg, rgba(14, 44, 88, .75), rgba(6, 20, 44, .75));
  border: 1px solid var(--line);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  --tone: var(--cyan);
}
.kpi::before {
  content: ""; position: absolute; left: 0; top: 0; width: 3px; height: 100%;
  background: var(--tone); box-shadow: 0 0 12px var(--tone);
}
.kpi.green { --tone: var(--green); }
.kpi.amber { --tone: var(--amber); }
.kpi.red { --tone: var(--red); }
.kpi .label { font-size: 13px; color: var(--muted); letter-spacing: 1px; }
.kpi .value {
  font-family: var(--num); font-size: 34px; line-height: 1.15; font-weight: 700;
  color: #fff; text-shadow: 0 0 16px color-mix(in srgb, var(--tone) 70%, transparent);
  white-space: nowrap;
}
.kpi .value small { font-size: 15px; color: var(--muted); margin-left: 3px; font-weight: 400; text-shadow: none; }
.kpi .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .sub b { color: var(--tone); font-weight: 600; }
.kpi .bar { margin-top: 8px; height: 3px; background: rgba(127, 156, 196, .18); }
.kpi .bar i { display: block; height: 100%; background: var(--tone); box-shadow: 0 0 8px var(--tone); transition: width .8s; }

/* ---------------------------------------------------------------- panels */
.panels {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1.55fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 14px;
}
.panel {
  position: relative; min-height: 0;
  display: flex; flex-direction: column;
  padding: 10px 14px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(4px);
}
.panel::before, .panel::after {
  content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid var(--cyan); pointer-events: none;
}
.panel::before { left: -1px; top: -1px; border-right: 0; border-bottom: 0; }
.panel::after { right: -1px; bottom: -1px; border-left: 0; border-top: 0; }
.panel > header {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding-bottom: 8px; margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.panel h2 {
  margin: 0; font-size: 16px; font-weight: 600; letter-spacing: 2px;
  padding-left: 12px; position: relative; white-space: nowrap;
}
.panel h2::before {
  content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 4px;
  background: linear-gradient(var(--cyan), var(--blue)); box-shadow: 0 0 8px var(--cyan);
}
.tip { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tip b { color: var(--cyan); font-family: var(--num); font-size: 14px; }
.tip b.red { color: var(--red); }
.tip b.amber { color: var(--amber); }
.chart { flex: 1; min-height: 0; width: 100%; }

.progress-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.progress-body .chart { flex: 1; }
.task-strip { padding-top: 6px; }
.task-strip .track { display: flex; height: 10px; background: rgba(127, 156, 196, .15); overflow: hidden; }
.task-strip .track i { display: block; height: 100%; }
.task-strip .legend { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); }
.task-strip .legend span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 5px; background: var(--c); }
.task-strip .legend b { color: var(--text); font-family: var(--num); font-size: 15px; margin-left: 4px; }

.exec-body { flex: 1; min-height: 0; display: grid; grid-template-rows: 1.15fr 1fr; }

.budget-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 150px 1fr; gap: 10px; }
.budget-stats { display: flex; flex-direction: column; justify-content: space-around; padding: 4px 0; }
.budget-stats div { border-left: 2px solid var(--line-strong); padding-left: 10px; }
.budget-stats span { display: block; font-size: 12px; color: var(--muted); }
.budget-stats b { font-family: var(--num); font-size: 20px; color: #fff; font-weight: 600; }
.budget-stats b.red { color: var(--red); text-shadow: 0 0 10px rgba(255, 77, 109, .5); }
.budget-stats b.green { color: var(--green); }

/* ---------------------------------------------------------------- alerts */
.alerts { list-style: none; margin: 0; padding: 0 2px 0 0; flex: 1; min-height: 0; overflow-y: auto; }
.alerts::-webkit-scrollbar { width: 4px; }
.alerts::-webkit-scrollbar-thumb { background: var(--line); }
.alerts li {
  display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start;
  padding: 9px 10px; margin-bottom: 8px;
  background: linear-gradient(90deg, rgba(64, 160, 255, .08), transparent);
  border-left: 2px solid var(--c, var(--blue));
  font-size: 13px; line-height: 1.55;
}
.alerts li.red { --c: var(--red); background: linear-gradient(90deg, rgba(255, 77, 109, .14), transparent); }
.alerts li.amber { --c: var(--amber); background: linear-gradient(90deg, rgba(255, 181, 71, .12), transparent); }
.alerts li.green { --c: var(--green); background: linear-gradient(90deg, rgba(31, 224, 160, .1), transparent); }
.alerts .lv {
  min-width: 34px; padding: 1px 0; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: 1px;
  color: var(--c, var(--blue)); border: 1px solid var(--c, var(--blue));
}
.alerts li.red .lv { animation: blink 1.6s infinite; }
@keyframes blink { 50% { box-shadow: 0 0 10px var(--red); background: rgba(255, 77, 109, .25); } }
.alerts b { color: #fff; }

/* ---------------------------------------------------------------- overlay */
.overlay {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  background: rgba(3, 10, 24, .88); backdrop-filter: blur(6px);
}
.overlay[hidden] { display: none; }
.box {
  min-width: 320px; max-width: 420px; padding: 28px 30px; text-align: center;
  background: rgba(8, 26, 54, .95); border: 1px solid var(--line-strong);
  box-shadow: 0 0 40px rgba(0, 229, 255, .15);
}
.box h3 { margin: 10px 0 8px; font-weight: 600; letter-spacing: 1px; }
.box p { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.box input {
  width: 100%; padding: 10px 12px; margin-bottom: 12px;
  background: rgba(3, 10, 24, .8); border: 1px solid var(--line); color: var(--text); font-size: 15px; outline: none;
}
.box input:focus { border-color: var(--cyan); }
.box button {
  width: 100%; padding: 10px; cursor: pointer; font-size: 15px; letter-spacing: 4px;
  background: linear-gradient(90deg, #0066ff, #00c2ff); color: #fff; border: 0;
}
.spinner {
  width: 40px; height: 40px; margin: 0 auto; border-radius: 50%;
  border: 3px solid rgba(0, 229, 255, .15); border-top-color: var(--cyan); animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1280px) {
  .screen { height: auto; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .panels { grid-template-columns: 1fr 1fr; grid-template-rows: none; grid-auto-rows: 380px; }
  .panels .panel:nth-child(2) { grid-column: span 2; order: -1; }
}
@media (max-width: 760px) {
  .screen { padding: 0 10px 14px; gap: 10px; }
  .head { grid-template-columns: 1fr; height: auto; padding: 12px 0 10px; gap: 6px; text-align: center; }
  .head-title { padding: 0; }
  .head-title::before, .head-title::after { display: none; }
  .head-title h1 { font-size: 20px; letter-spacing: 3px; }
  .head-side, .head-side.right { justify-content: center; flex-wrap: wrap; gap: 10px; }
  .head-side.left { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi .value { font-size: 26px; }
  .panels { grid-template-columns: 1fr; grid-auto-rows: 340px; gap: 10px; }
  .panels .panel:nth-child(2) { grid-column: auto; }
  .panels .panel:nth-child(3) { height: auto; min-height: 340px; }
  .budget-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .budget-stats { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .budget-stats div { flex: 1 1 40%; }
}
