/* Uptime dashboard — uptime.dntmedia.com
 *
 * SELF-CONTAINED. v1's page extended Command's command.css, which does not
 * exist on this box: the hub is its own host now and the dashboard has to stand
 * up alone. Everything the old page borrowed from that shell (header, table,
 * status dots, badges, drawer) is folded in below.
 *
 * The status palette is deliberately identical to hub/emails.py. A page in the
 * inbox and the same page in a browser are one product, and having "down" be a
 * different red in each would be a small, constant lie. The shell around them
 * is its own — this is no longer a page inside Command.
 */

:root {
  /* Sampled from the logo, not guessed. The wordmark is #001838; the swoosh
     runs from a lime highlight (#60D018) through vivid green (#08A840) into
     teal (#007060). */
  --navy:      #001838;
  --navy-soft: #33445f;
  --muted:     #6b7789;
  --line:      #dfe5ee;
  --line-soft: #eaeef4;
  --panel:     #ffffff;
  --bg:        #edf1f6;

  /* Brand green is bright — great as a FILL, too light for text on white
     (~2.9:1). So there are two: --green for dots, chips and rules, --green-ink
     for anything you have to read. Using the bright one for text would look
     right in the logo and fail anyone reading the uptime column. */
  --green:     #0baa3e;
  --green-ink: #0a7d34;
  --teal:      #007060;

  --warn:      #c17b00;
  --bad:       #ce2b22;
  --unknown:   #8a93a5;

  font-family: Inter, -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
  color: var(--navy);
  background: var(--bg);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }

/* ---- header ------------------------------------------------------------- */
/* Light, not dark. The logo is deep navy on transparency, so it needs a pale
   field — on the navy bar this page used to have, the wordmark disappeared. */
.site-header {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 14px 26px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.site-header img {
  display: block;
  height: 56px;      /* the lockup is 440x157; below this the tagline is a smear */
  width: auto;
}

/* The hub's own vitals, in the header because they gate everything below: if
   the evaluator has stopped, every green tile on this page is stale. */
/* Five items now — the hub's three vitals plus a prober each — so it wraps
   rather than crushing the wordmark on a narrow window. */
.hubstrip {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 22px;
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

.hubstrip b[title] { cursor: help; }

.hubstrip div { display: flex; flex-direction: column; gap: 2px; }
.hubstrip b { font-size: 13px; font-weight: 600; color: var(--navy); }
.hubstrip b.alarm { color: var(--bad); }
.hubstrip b.warn  { color: var(--warn); }

.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 26px 22px 60px;
}

/* ---- summary tiles ------------------------------------------------------ */
.tiles {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.tile {
  padding: 16px;
  border: 1px solid #dde2ea;
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 2px 7px rgba(20, 31, 48, .04);
}

.tile-value { font-size: 28px; font-weight: 700; line-height: 1.1; }

.tile-label {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.tile.ok   .tile-value { color: var(--green-ink); }
.tile.bad  .tile-value { color: var(--bad); }
.tile.warn .tile-value { color: var(--warn); }
.tile.unk  .tile-value { color: var(--muted); }

/* ---- status vocabulary -------------------------------------------------- */
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--unknown);
  flex: none;
}

.status.online   .dot { background: var(--green); }
.status.warning  .dot { background: var(--warn); }
.status.danger   .dot { background: var(--bad); }
.status.checking .dot { background: var(--unknown); }

.badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  background: #eef1f5;
  color: var(--navy-soft);
}

.badge.warning { background: #fdf7ec; color: #8a5800; }
.badge.danger  { background: #fdf2f2; color: #8f1d1d; }

.muted { color: var(--muted); }
.warn-text { color: var(--warn); font-weight: 600; }
.bad-text  { color: var(--bad);  font-weight: 600; }

/* ---- table -------------------------------------------------------------- */
.table-wrap {
  background: var(--panel);
  border: 1px solid #dde2ea;
  border-radius: 10px;
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }

th, td { padding: 12px 16px; text-align: left; }

th {
  background: #f7f9fb;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

td { border-bottom: 1px solid var(--line-soft); font-size: 14px; }

tbody tr:last-child td { border-bottom: 0; }
tbody tr[data-host] { cursor: pointer; }
tbody tr[data-host]:hover { background: #f7f9fb; }

/* Display-only: capitalizes the first letter as rendered. The underlying
   host name (dataset.host, API calls, hub records) is untouched. */
.server-name, #drawer-host { text-transform: capitalize; }

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

.updated { margin-top: 16px; color: var(--muted); font-size: 13px; }

/* ---- buttons ------------------------------------------------------------ */
button {
  padding: 9px 15px;
  border: 0;
  border-radius: 7px;
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

button:hover:not(:disabled) { background: #0a2b57; }
button:disabled { opacity: .5; cursor: default; }
button.secondary { background: #eef1f5; color: var(--navy); }
button.secondary:hover:not(:disabled) { background: #e2e7ef; }

/* ---- drawer ------------------------------------------------------------- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 32, 51, .38);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
  z-index: 40;
}

.drawer-backdrop.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(460px, 100%);
  height: 100%;
  background: var(--panel);
  box-shadow: -14px 0 40px rgba(20, 31, 48, .17);
  transform: translateX(100%);
  transition: transform .2s ease;
  overflow-y: auto;
  z-index: 50;
}

.drawer.open { transform: none; }

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.drawer-header h2 { margin: 0; font-size: 20px; }
.drawer-subtitle { margin: 5px 0 0; font-size: 13px; color: var(--muted); }

.drawer-close {
  padding: 0;
  width: 30px;
  height: 30px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
}

.drawer-close:hover:not(:disabled) { background: #eef1f5; color: var(--navy); }

.drawer-section { padding: 20px 24px; border-bottom: 1px solid var(--line); }
.drawer-section:last-child { border-bottom: 0; }

.drawer-section h3 {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

#drawer-body .note { margin: 0 0 14px; font-size: 13px; }

/* ---- per-monitor blocks in the drawer ----------------------------------- */
.mon { padding: 14px 0; border-bottom: 1px solid var(--line-soft); }
.mon:first-child { padding-top: 0; }
.mon:last-child { padding-bottom: 0; border-bottom: 0; }

.mon-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mon-left { display: flex; align-items: center; gap: 10px; }
.mon-stats { display: flex; gap: 22px; margin-top: 12px; }

.stat { display: flex; flex-direction: column; gap: 3px; }
.stat b { font-size: 19px; font-weight: 700; line-height: 1; }
.stat > span { font-size: 12px; }

.mon-detail {
  margin-top: 10px;
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-word;
}

/* Checks reported by a `health` push — the state no external probe can see. */
.checks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }

.chip {
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  background: #e9f7ee;
  color: var(--green-ink);
}

.chip.bad  { background: #fdf2f2; color: #8f1d1d; }
.chip.info { background: #eef1f5; color: var(--navy-soft); }

/* ---- forms -------------------------------------------------------------- */
.drawer-form, .param-fields { display: flex; flex-direction: column; gap: 15px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--muted); }

.field input, .field select {
  width: 100%;
  min-width: 0;               /* let flex fields shrink instead of overflowing */
  padding: 9px 11px;
  border: 1px solid #ced4df;
  border-radius: 7px;
  background: #fff;
}

.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; min-width: 0; }
.token-row { display: flex; gap: 8px; }
.token-row input { flex: 1; }
.form-actions { display: flex; gap: 8px; margin-top: 2px; }

/* ---- the checks editor --------------------------------------------------- */
/* One card per check, because a host's override IS its whole monitor set. The
   editor that showed a single type made the commonest production setup —
   http + health on one box — impossible to express, and saving dropped the
   checks it wasn't showing. */
.mon-editors { display: flex; flex-direction: column; gap: 14px; }

.mon-editor {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.mon-editor-head { display: flex; align-items: flex-end; gap: 10px; }
.mon-editor-head .field { flex: 1; min-width: 0; }
.mon-editor-head button { flex: 0 0 auto; }

/* ---- add host ----------------------------------------------------------- */
.addhost { padding: 7px 13px; font-size: 13px; }

/* ---- maintenance + incidents -------------------------------------------- */
.win-list { margin-bottom: 16px; }

.win-row, .inc-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.win-row { justify-content: space-between; padding: 11px 0; font-size: 14px; }
.inc-row { padding: 9px 0; font-size: 13px; }
.win-row:last-child, .inc-row:last-child { border-bottom: 0; }
.inc-row .status { min-width: 84px; text-transform: capitalize; }
.inc-dur { margin-left: auto; }

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 900px) {
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .site-header { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
  .site-header img { height: 42px; }
  .hubstrip { margin-left: 0; width: 100%; gap: 16px; }
  .table-wrap { overflow-x: auto; }
  table { min-width: 620px; }
}

/* ---- sign-in ------------------------------------------------------------ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 34px 32px 30px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 6px 28px rgba(0, 24, 56, .07);
}

.login-card img {
  display: block;
  width: 200px;
  max-width: 70%;
  height: auto;
  margin: 0 auto 26px;
}

.login-card form { display: flex; flex-direction: column; gap: 16px; }
.login-card button { width: 100%; padding: 11px; font-size: 14px; }

.login-msg {
  margin: 0;
  min-height: 18px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.login-msg.bad { color: var(--bad); }

/* ---- header sign-out ---------------------------------------------------- */
.signout {
  padding: 6px 12px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.signout:hover:not(:disabled) { background: var(--line-soft); color: var(--navy); }
