/* Ops Console Mission Control. */
:root {
  color-scheme: dark;
  --bg: #0b1422;
  --panel: #13263a;
  --text: #edf5fa;
  --muted: #a8bac9;
  --line: #2a4055;
  --accent: #8bc7ef;
  --ok: #76d9ae;
  --warn: #ffc782;
  --crit: #ff9aa3;
  --none: #34485b;
  --ok-bg: #153b34;
  --warn-bg: #47341f;
  --crit-bg: #452932;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0.25rem 0 0.75rem; }
h2 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }
h3 { font-size: 1rem; margin: 0 0 0.5rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.top {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: 0.8rem max(16px, calc((100vw - 1360px) / 2)); background: #101e30; border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; letter-spacing: 0.08em; color: var(--text); }
.top nav { display: flex; gap: 1rem; flex: 1; }
.top nav a { color: var(--muted); }
.top nav a[aria-current] { color: var(--text); font-weight: 600; }
.logout { margin: 0; }
button.link { background: none; border: 0; color: var(--muted); font: inherit; cursor: pointer; padding: 0; }

main { max-width: 1360px; margin: 0 auto; padding: 1.5rem 24px 3rem; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.85rem 1rem; margin-bottom: 0.85rem;
}
.cards { display: grid; gap: 0.85rem; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.cards .card { margin: 0; }
.app-card { color: var(--text); display: block; }
.app-card:hover { text-decoration: none; border-color: var(--accent); }
.app-card-head { display: flex; align-items: center; gap: 0.5rem; }
.app-card h2 { margin: 0; font-size: 1.05rem; }
.unreachable { color: var(--crit); margin: 0.4rem 0 0; font-weight: 600; }
dl.mini { margin: 0.5rem 0 0; display: grid; gap: 0.15rem; }
dl.mini div { display: flex; justify-content: space-between; gap: 1rem; }
dl.mini dt { color: var(--muted); }
dl.mini dd { margin: 0; text-align: right; }

.dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--none); flex: none; }
.dot-up { background: var(--ok); }
.dot-down { background: var(--crit); }
.sev-critical { color: var(--crit); font-weight: 600; }
.sev-warning { color: var(--warn); font-weight: 600; }

.stats { display: grid; gap: 0.6rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.stat { display: flex; flex-direction: column; padding: 0.5rem 0.6rem; border-radius: 6px; background: var(--bg); min-width: 0; }
.stat-label { color: var(--muted); font-size: 0.8rem; }
.stat-value { font-size: 1.05rem; font-weight: 600; overflow-wrap: anywhere; }
.stat-hint { color: var(--muted); font-size: 0.8rem; }
.stat-ok { background: var(--ok-bg); }
.stat-warning { background: var(--warn-bg); }
.stat-critical { background: var(--crit-bg); }

.strip { display: flex; gap: 2px; margin-top: 0.75rem; height: 1.5rem; }
.bar { flex: 1; border-radius: 2px; background: var(--none); }
.bar-up { background: var(--ok); }
.bar-partial { background: var(--warn); }
.bar-down { background: var(--crit); }
.strip-legend { display: flex; justify-content: space-between; margin: 0.25rem 0 0; }

.alerts { list-style: none; padding: 0; margin: 0 0 0.85rem; display: grid; gap: 0.4rem; }
.alert { padding: 0.55rem 0.75rem; border-radius: 6px; border-left: 4px solid var(--warn); background: var(--warn-bg); overflow-wrap: anywhere; }
.alert-critical { border-left-color: var(--crit); background: var(--crit-bg); }

.flash { padding: 0.6rem 0.8rem; border-radius: 6px; margin: 0 0 0.85rem; overflow-wrap: anywhere; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-warn { background: var(--warn-bg); color: var(--warn); }
.flash-error { background: var(--crit-bg); color: var(--crit); }

.count { display: inline-block; min-width: 1.6rem; padding: 0 0.45rem; border-radius: 999px; background: var(--line); font-size: 0.85rem; text-align: center; vertical-align: middle; }

.tabs { display: flex; gap: 0.25rem; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin: 1rem 0 0.85rem; }
.tabs a { padding: 0.45rem 0.8rem; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs a[aria-current] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }

/* position: relative keeps absolutely positioned children (the hidden note
   labels in row actions) inside the scroll box instead of widening the page. */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; position: relative; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
th, td { text-align: left; padding: 0.45rem 0.55rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; }
td { overflow-wrap: anywhere; }
.directory td.row-actions { min-width: 240px; }

.item-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.item-head p { margin: 0; }
.reasons { margin: 0.4rem 0; padding-left: 1.2rem; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 0.35rem 1rem; margin: 0.5rem 0; }
.fields dt { color: var(--muted); font-size: 0.8rem; }
.fields dd { margin: 0; }
.media { max-width: 160px; max-height: 120px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }

form.act { display: grid; gap: 0.45rem; margin-top: 0.5rem; }
textarea, input, select {
  font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 0.45rem 0.55rem; width: 100%;
}
textarea { resize: vertical; min-height: 2.6rem; }
.buttons { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 6px; padding: 0.45rem 0.9rem;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
}
.btn-primary { background: #3b87b6; border-color: #3b87b6; color: #fff; }
.btn-danger { background: #a94753; border-color: #a94753; color: #fff; }

form.search { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
form.search input[type="search"] { flex: 2 1 200px; width: auto; }
form.search select { flex: 1 1 140px; width: auto; }
.pager { display: flex; justify-content: space-between; align-items: baseline; gap: 0.75rem; margin-top: 0.6rem; }

.signin { max-width: 380px; margin: 3rem auto; }
.signin form { display: grid; gap: 0.75rem; }
.signin label { display: grid; gap: 0.25rem; color: var(--muted); font-size: 0.9rem; }

/* Overview: dense operational status with a persistent signal rail. */
.overview-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin: .2rem 0 1.25rem; }
.overview-heading h1 { font-size: 1.8rem; letter-spacing: -.035em; margin: .15rem 0; }
.overview-heading p { margin: 0; }
.eyebrow, .metric-label { font-size: .72rem; font-weight: 750; letter-spacing: .11em; color: var(--muted); }
.live-badge { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; font-size: .75rem; font-weight: 700; padding: .4rem .65rem; border-radius: 999px; color: var(--ok); background: var(--ok-bg); }
.live-pulse { width: .45rem; height: .45rem; border-radius: 50%; background: var(--ok); }
.stale-badge { color: var(--warn); background: var(--warn-bg); }
.stale-badge .live-pulse { background: var(--warn); }
.dashboard { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 1.4rem; }
.dashboard-main { min-width: 0; }
.overview-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.metric-panel { display: flex; flex-direction: column; gap: .1rem; padding: .85rem 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.metric-panel strong { font-size: 1.8rem; line-height: 1.2; letter-spacing: -.045em; }
.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.section-heading h2 { margin: 1.25rem 0 .65rem; font-size: .86rem; letter-spacing: .07em; text-transform: uppercase; }
.dashboard .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .7rem; }
.dashboard .app-card { min-width: 0; padding: .85rem; }
.dashboard .app-card h3 { margin: 0; font-size: .94rem; }
.dashboard .app-card-head { justify-content: space-between; align-items: flex-start; gap: .5rem; }
.app-subline { margin: .5rem 0 0; font-size: .78rem; color: var(--muted); }
.status-badge { display: inline-block; border-radius: 999px; padding: .17rem .46rem; font-size: .66rem; font-weight: 750; white-space: nowrap; }
.status-ok { color: var(--ok); background: var(--ok-bg); }
.status-warn { color: var(--warn); background: var(--warn-bg); }
.status-ack { color: var(--accent); background: #203b52; }
.status-bad { color: var(--crit); background: var(--crit-bg); }
.status-unknown { color: var(--muted); background: var(--none); }
.mini-strip { height: .75rem; margin-top: .7rem; gap: 2px; }
.signal-rail { min-width: 0; padding-left: 1.1rem; border-left: 1px solid var(--line); }
.signal { padding: .65rem .75rem; margin-bottom: .55rem; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: 6px; overflow-wrap: anywhere; }
.signal-critical { border-left-color: var(--crit); }
.signal strong, .activity strong { display: block; font-size: .79rem; }
.signal p { font-size: .75rem; color: var(--muted); margin: .3rem 0 0; }
.warning-form { margin: .4rem 0 0; }
.warning-form button.link, .dismissed-row button.link { color: var(--accent); font-size: .76rem; }
.dismissed-list { margin: .65rem 0; color: var(--muted); font-size: .78rem; }
.dismissed-list summary { cursor: pointer; }
.dismissed-row { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; border-top: 1px solid var(--line); padding: .5rem 0; }
.dismissed-row form { margin: 0; }
.activity-heading { margin-top: 1.2rem; }
.activity { display: flex; flex-direction: column; gap: .1rem; border-bottom: 1px solid var(--line); padding: .55rem 0; }
.app-alerts h2 { font-size: .9rem; letter-spacing: .06em; text-transform: uppercase; }
.app-alerts .alert { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem; }
.app-dismissed { margin: 0 0 1rem; }

@media (max-width: 600px) {
  body { font-size: 14px; }
  .top { gap: 0.6rem; }
  .card { padding: 0.75rem; }
  .directory td.row-actions { min-width: 200px; }
}
@media (max-width: 1060px) {
  .dashboard { grid-template-columns: 1fr; }
  .signal-rail { border-left: 0; border-top: 1px solid var(--line); padding: .6rem 0 0; }
}
@media (max-width: 760px) {
  .dashboard .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric-panel { padding: .6rem; }
  .metric-panel strong { font-size: 1.4rem; }
  .metric-panel .small { display: none; }
}
@media (max-width: 480px) {
  main { padding: 1rem 12px 2rem; }
  .overview-heading { align-items: flex-start; }
  .overview-heading h1 { font-size: 1.4rem; }
  .live-badge { font-size: 0; padding: .48rem; }
  .dashboard .cards { grid-template-columns: 1fr; }
}
