:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --bg-glow: #10182a;
  --panel: #14171f;
  --panel-2: #191d27;
  --line: #262b37;
  --grid: #222733;
  --text: #eef1f6;
  --text-2: #9aa3b2;
  --text-3: #6b7383;
  --blue: #338ced;
  --violet: #9887ef;
  --aqua: #00a888;
  --good: #0aac23;
  --warn: #fbb315;
  --serious: #f18a59;
  --bad: #dc3c3d;
  --nodata: #2a2f3b;
  --radius: 14px;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, var(--bg-glow), transparent 60%),
              radial-gradient(900px 500px at 110% 10%, #1a1230, transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
small { color: var(--text-2); }
.muted { color: var(--text-2); }

/* ---------- login */
.login-body { display: grid; place-items: center; padding: 24px; }
.login-card {
  width: 100%; max-width: 360px; padding: 36px 32px; border-radius: 20px;
  background: linear-gradient(180deg, #171b25, #12151c); border: 1px solid var(--line);
  box-shadow: 0 30px 80px rgba(0,0,0,.5), 0 0 0 1px rgba(51,140,237,.06);
  display: flex; flex-direction: column; gap: 10px; text-align: center;
}
.login-card h1 { margin: 8px 0 0; letter-spacing: .02em; font-size: 26px; }
.login-card p { margin: 0 0 14px; }
.login-card label { text-align: left; color: var(--text-2); font-size: 13px; }
.login-card input {
  background: #0d1016; border: 1px solid var(--line); color: var(--text); border-radius: 10px;
  padding: 12px 14px; font-size: 16px; outline: none;
}
.login-card input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(51,140,237,.25); }
.login-card button {
  margin-top: 6px; padding: 12px; border: 0; border-radius: 10px; font-size: 15px; font-weight: 600;
  background: linear-gradient(135deg, #338ced, #6a5ce8); color: #fff; cursor: pointer;
}
.login-card .err { color: #ff8b8b; margin: 6px 0 0; }
.logo-mark {
  width: 44px; height: 44px; border-radius: 12px; margin: 0 auto; position: relative;
  background: conic-gradient(from 200deg, #338ced, #9887ef, #00a888, #338ced);
  box-shadow: 0 0 24px rgba(51,140,237,.45);
}
.logo-mark span { position: absolute; inset: 4px; border-radius: 9px; background: #0d1016; }
.logo-mark span::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; border-radius: 50%;
  transform: translate(-50%,-50%); background: var(--good); box-shadow: 0 0 12px var(--good);
}

/* ---------- top bar */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 18px;
  padding: 14px 28px; background: rgba(11,13,18,.78); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo-mark { width: 36px; height: 36px; margin: 0; }
.brand b { letter-spacing: .04em; font-size: 17px; display: block; }
.brand small { font-size: 12px; }
.overall {
  margin-left: 12px; padding: 7px 14px; border-radius: 999px; font-weight: 600; font-size: 13px;
  background: var(--panel-2); border: 1px solid var(--line); display: flex; gap: 8px; align-items: center;
}
.overall.good { border-color: rgba(10,172,35,.5); box-shadow: 0 0 18px rgba(10,172,35,.18); }
.overall.warn { border-color: rgba(251,179,21,.55); box-shadow: 0 0 18px rgba(251,179,21,.18); }
.overall.bad { border-color: rgba(220,60,61,.6); box-shadow: 0 0 18px rgba(220,60,61,.25); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 20px; }
.clock { text-align: right; }
.clock b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.clock small { font-size: 11px; }
.signout {
  text-decoration: none; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line);
  color: var(--text-2); font-size: 13px;
}
.signout:hover { color: var(--text); border-color: var(--text-3); }

main { padding: 24px 28px 40px; max-width: 1600px; margin: 0 auto; }

/* ---------- hero */
.hero { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1fr 1.2fr; gap: 16px; }
.tile, .panel, .app {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
}
.tile-label { color: var(--text-2); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.hero-num { font-size: 54px; font-weight: 700; line-height: 1.1; margin: 10px 0 12px; font-variant-numeric: tabular-nums; }
.hero-num small { font-size: 22px; font-weight: 500; margin-left: 4px; }
.dots { display: flex; flex-wrap: wrap; gap: 6px; }
.dots i { width: 12px; height: 12px; border-radius: 4px; background: var(--nodata); }
.dots i.up { background: var(--good); box-shadow: 0 0 8px rgba(10,172,35,.6); }
.dots i.slow { background: var(--warn); }
.dots i.down { background: var(--bad); box-shadow: 0 0 8px rgba(220,60,61,.7); }
.gauge-tile { display: flex; flex-direction: column; gap: 4px; }
.gauge-row { display: flex; align-items: center; gap: 14px; }
.gauge { width: 104px; height: 104px; flex: none; }
.gauge-info b { font-size: 13px; color: var(--text-2); font-weight: 500; display: block; }
.gauge-info span { font-size: 12px; color: var(--text-3); }
.spark { width: 100%; height: 34px; display: block; margin-top: 6px; }
.tile-server .kv { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed var(--grid); font-size: 13px; }
.tile-server .kv:last-child { border: 0; }
.tile-server .kv span { color: var(--text-2); }
.tile-server .tile-label { margin-bottom: 6px; }

/* ---------- apps */
.section-title { margin: 30px 0 14px; font-size: 18px; font-weight: 650; }
.section-title small { font-weight: 400; font-size: 13px; margin-left: 8px; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.app { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 12px; }
.app::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--nodata);
}
.app.up::before { background: linear-gradient(90deg, var(--good), transparent); }
.app.slow::before { background: linear-gradient(90deg, var(--warn), transparent); }
.app.down::before { background: linear-gradient(90deg, var(--bad), transparent); }
.app.down { border-color: rgba(220,60,61,.45); }
.app-head { display: flex; align-items: flex-start; gap: 10px; }
.app-head h4 { margin: 0; font-size: 17px; }
.app-head p { margin: 3px 0 0; color: var(--text-2); font-size: 13px; }
.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line);
  color: var(--text-2); margin-left: 6px; vertical-align: 2px; white-space: nowrap;
}
.badge {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: #0f1218;
}
.badge .ic { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; color: #0b0d12; font-weight: 800; }
.badge.up { color: #6be07b; } .badge.up .ic { background: var(--good); box-shadow: 0 0 10px var(--good); }
.badge.slow { color: var(--warn); } .badge.slow .ic { background: var(--warn); }
.badge.down { color: #ff8b8b; } .badge.down .ic { background: var(--bad); box-shadow: 0 0 10px var(--bad); }
.badge.unknown { color: var(--text-2); } .badge.unknown .ic { background: var(--text-3); }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.metric { background: #0f1218; border-radius: 10px; padding: 9px 10px; }
.metric b { display: block; font-size: 19px; font-variant-numeric: tabular-nums; }
.metric small { font-size: 11px; }
.strip { display: flex; gap: 1px; height: 26px; align-items: stretch; }
.strip i { flex: 1; border-radius: 2px; background: var(--nodata); cursor: default; }
.strip i.u { background: var(--good); opacity: .85; }
.strip i.p { background: var(--warn); }
.strip i.d { background: var(--bad); }
.strip i:hover { opacity: 1; outline: 1px solid #fff; }
.strip-label { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-3); margin-top: -6px; }
.lat { width: 100%; height: 44px; display: block; }
.app-foot { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); align-items: center; }
.app-foot .open { margin-left: auto; text-decoration: none; color: var(--blue); font-weight: 600; }
.app-foot .open:hover { text-decoration: underline; }
.lock-warn { color: var(--warn); }

/* ---------- panels */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.panel-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.panel-head h3 { margin: 0; font-size: 15px; }
.panel-head small { font-size: 12px; }
.chart { width: 100%; height: 200px; position: relative; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.axis text { fill: var(--text-3); font-size: 11px; }
.gridline { stroke: var(--grid); stroke-width: 1; }
.mini-stats { display: flex; gap: 28px; margin-bottom: 8px; }
.mini-stats b { font-size: 26px; display: block; font-variant-numeric: tabular-nums; }
.mini-stats small { font-size: 12px; }
.hbars { display: flex; flex-direction: column; gap: 9px; }
.hbar { display: grid; grid-template-columns: 130px 1fr 70px; align-items: center; gap: 10px; font-size: 13px; }
.hbar .track { height: 14px; background: #0f1218; border-radius: 4px; position: relative; }
.hbar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; background: var(--violet); }
.hbar .val { text-align: right; color: var(--text-2); font-variant-numeric: tabular-nums; }
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--grid); }
.row:last-child { border: 0; }
.row .nm b { display: block; font-size: 14px; }
.row .nm small { font-size: 12px; }
.row .rt { margin-left: auto; text-align: right; font-size: 12px; color: var(--text-2); }
.row .rt b { color: var(--text); font-weight: 500; }
.foot { margin-top: 30px; text-align: center; color: var(--text-3); font-size: 12px; }

/* ---------- tooltip */
.tip {
  position: fixed; pointer-events: none; z-index: 50; opacity: 0; transition: opacity .08s;
  background: #0a0c10; border: 1px solid #333a48; border-radius: 8px; padding: 7px 10px;
  font-size: 12px; color: var(--text); box-shadow: 0 8px 24px rgba(0,0,0,.5); white-space: nowrap;
}
.tip.on { opacity: 1; }
.tip small { display: block; color: var(--text-2); }

@media (max-width: 1200px) {
  .hero { grid-template-columns: 1fr 1fr 1fr; }
  .tile-apps { grid-column: span 3; }
  .tile-server { grid-column: span 3; }
}
@media (max-width: 800px) {
  .top { padding: 12px 14px; flex-wrap: wrap; }
  .overall { margin-left: 0; order: 3; width: 100%; justify-content: center; }
  main { padding: 16px 12px 32px; }
  .hero { grid-template-columns: 1fr; }
  .tile-apps, .tile-server { grid-column: auto; }
  .grid-2 { grid-template-columns: 1fr; }
  .apps { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 100px 1fr 62px; }
}
.app-foot .open.off { color: var(--text-3); font-weight: 400; }
.row .badge { margin-left: 0; min-width: 86px; justify-content: flex-start; }
.hero > *, .apps > *, .grid-2 > *, .metric, .app-head > div { min-width: 0; }
.metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
/* quick links */
.quick { display: flex; gap: 8px; }
.ql {
  display: inline-flex; align-items: center; gap: 7px; text-decoration: none; font-size: 13px; font-weight: 600;
  padding: 8px 13px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2);
  transition: border-color .15s, box-shadow .15s;
}
.ql .qi { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 12px; color: #fff; }
.ql-mail .qi { background: #e24d4d; }
.ql-cal .qi { background: var(--blue); }
.ql:hover { border-color: var(--text-3); box-shadow: 0 0 14px rgba(51,140,237,.2); }
@media (max-width: 800px) { .quick { order: 4; width: 100%; } .ql { flex: 1; justify-content: center; } }
/* consulting mail + calendar */
.consult { margin-top: 16px; }
.panel-link { margin-left: auto; font-size: 12px; color: var(--blue); text-decoration: none; font-weight: 600; white-space: nowrap; }
.panel-link:hover { text-decoration: underline; }
.mail-list, .cal-list { display: flex; flex-direction: column; max-height: 420px; overflow-y: auto; }
.empty { color: var(--text-3); padding: 24px 4px; text-align: center; }
.mail {
  display: grid; grid-template-columns: 10px 1fr auto; gap: 4px 12px; padding: 11px 6px; text-decoration: none;
  border-bottom: 1px solid var(--grid); border-radius: 8px;
}
.mail:hover { background: #10141c; }
.mail .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: transparent; }
.mail.unread .dot { background: var(--blue); box-shadow: 0 0 8px var(--blue); }
.mail .from { font-size: 13px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail.unread .from { color: var(--text); font-weight: 600; }
.mail .when { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.mail .subj { grid-column: 2 / 4; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail.unread .subj { font-weight: 650; }
.mail .snip { grid-column: 2 / 4; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail .cnt { color: var(--text-3); font-weight: 400; margin-left: 4px; }
.cal-day { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-2); padding: 12px 4px 6px; }
.cal-day.today { color: var(--blue); }
.ev { display: grid; grid-template-columns: 86px 4px 1fr; gap: 12px; align-items: center; padding: 8px 4px; }
.ev .t { font-size: 13px; color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }
.ev .bar { align-self: stretch; border-radius: 2px; background: var(--violet); }
.ev.now .bar { background: var(--good); box-shadow: 0 0 8px var(--good); }
.ev b { display: block; font-size: 14px; }
.ev small { font-size: 12px; }
.badge-count { background: var(--blue); color: #fff; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; margin-left: 6px; }
