/*
 * Styles for the pages other than Monitor.
 *
 * Monitor is a fixed, non-scrolling wall layout; everything else is an
 * ordinary scrolling document, so the two need different foundations.
 */

/* Navigation links share the button styling from brand.css. */
.nav a {
  display: inline-block;
  padding: 8px 15px;
  border-radius: 7px;
  text-decoration: none;
  color: inherit;
  opacity: 0.82;
  font-size: 13.5px;
  transition: background 0.15s, opacity 0.15s;
}

.nav a:hover { background: rgb(255 255 255 / 12%); opacity: 1; }

.nav a[aria-current="page"] {
  background: rgb(255 255 255 / 20%);
  opacity: 1;
  font-weight: 600;
}

.brand { text-decoration: none; color: inherit; }

/* ------------------------------------------------------------------ page */

body.doc { overflow: auto; }

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

.page-title {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 4px 0 18px;
}

.page-title h1 { font-size: 21px; margin: 0; font-weight: 700; }
.page-title .hint { color: var(--ink-faint); font-size: 13px; }

.section {
  margin: 26px 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink-dim);
  letter-spacing: 0.2px;
}

/* ------------------------------------------------------------------ cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 17px;
}

.card.pad0 { padding: 0; overflow: hidden; }

.card h3 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-dim);
}

.kpi { font-size: 30px; font-weight: 700; line-height: 1.05; }
.kpi.on { color: var(--live); }
.kpi.off { color: var(--offline); }
.kpi.alert { color: var(--alert); }
.kpi.warn { color: var(--warn); }
.kpi.blue { color: var(--blue-bright); }

.kpi-note { font-size: 12px; color: var(--ink-faint); margin-top: 5px; }

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.card-head h3 { margin: 0; }
.card-head .spacer { margin-inline-start: auto; }

.wide { grid-column: 1 / -1; }

.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

@media (max-width: 1100px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ bars */

.bars { display: flex; flex-direction: column; gap: 9px; }

.bar-row { display: grid; grid-template-columns: 130px 1fr 46px; gap: 10px; align-items: center; }
.bar-row .label { font-size: 12.5px; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; }
.bar-row .value { font-size: 12.5px; text-align: end; color: var(--ink); }

.track { height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; }
.fill { height: 100%; background: var(--blue); border-radius: 4px; }
.fill.alert { background: var(--alert); }
.fill.warn { background: var(--warn); }
.fill.live { background: var(--live); }

/* ------------------------------------------------------------------ table */

.table-wrap { overflow: auto; max-height: 620px; }

table.data { width: 100%; border-collapse: collapse; font-size: 13px; }

table.data thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel-2);
  text-align: start;
  padding: 9px 13px;
  font-weight: 600;
  color: var(--ink-dim);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.data tbody td {
  padding: 9px 13px;
  border-bottom: 1px solid rgb(38 52 74 / 40%);
  white-space: nowrap;
}

table.data tbody tr:hover { background: var(--panel-2); }
table.data td.wrap { white-space: normal; }

/* ------------------------------------------------------------------ matrix */

table.matrix { width: 100%; border-collapse: collapse; font-size: 12.5px; }

table.matrix th, table.matrix td {
  padding: 8px 10px;
  border-bottom: 1px solid rgb(38 52 74 / 45%);
  text-align: center;
}

table.matrix th:first-child, table.matrix td:first-child {
  text-align: start;
  white-space: nowrap;
  color: var(--ink-dim);
}

table.matrix thead th {
  position: sticky;
  top: 0;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.35;
}

table.matrix tbody tr:hover { background: var(--panel-2); }
table.matrix tbody tr.danger td:first-child { color: var(--alert); font-weight: 600; }

.yes { color: var(--live); font-size: 15px; }
.no { color: #384456; font-size: 15px; }

/* ------------------------------------------------------------------ forms */

.toolbar-row {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.field {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
  color: var(--ink);
  font: inherit;
  outline: 0;
}

.field:focus { border-color: var(--blue); }
.field::placeholder { color: var(--ink-faint); }

select.field { min-width: 140px; }

.btn {
  background: var(--blue);
  border: 1px solid var(--blue);
  color: #fff;
  border-radius: 8px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 13px;
  transition: filter 0.15s;
}

.btn:hover { filter: brightness(1.12); }

.btn.ghost { background: transparent; border-color: var(--line); color: var(--ink-dim); }
.btn.ghost:hover { border-color: var(--blue); color: var(--ink); }
.btn.danger { background: var(--alert); border-color: var(--alert); }

.label-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.label-row label { font-size: 12.5px; color: var(--ink-dim); }
.label-row .field { width: 100%; }

/* ------------------------------------------------------------------ modal */

.scrim {
  position: fixed;
  inset: 0;
  background: rgb(4 8 14 / 72%);
  display: grid;
  place-items: center;
  z-index: 90;
  padding: 20px;
}

.scrim[hidden] { display: none; }

.modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  width: min(520px, 100%);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.modal-head {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 9px;
}

.modal-body { padding: 18px; }
.modal-foot {
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.danger-box {
  background: color-mix(in srgb, var(--alert) 11%, transparent);
  border: 1px solid color-mix(in srgb, var(--alert) 38%, transparent);
  border-radius: 9px;
  padding: 13px 15px;
  color: #f3b7b2;
  font-size: 13px;
  line-height: 1.75;
  margin-bottom: 16px;
}

.danger-box strong { color: var(--alert); }

/* ------------------------------------------------------------------ misc */

.tag-sm {
  display: inline-block;
  border-radius: 5px;
  padding: 1px 7px;
  font-size: 11px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--ink-dim);
}

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-faint); }
.legend span { display: flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; }

.empty { padding: 46px; text-align: center; color: var(--ink-faint); font-size: 13px; }

.prototype-note {
  margin: 18px 0 0;
  padding: 11px 14px;
  background: color-mix(in srgb, var(--warn) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent);
  border-radius: 9px;
  font-size: 12.5px;
  color: var(--warn);
  line-height: 1.7;
}
