/* Consola del operador (ADR 0015). Pensada primero para el celular. */

:root {
  --navy: #003f5c;
  --teal: #008c9e;
  --teal-strong: #00758a;
  --amber: #b86a00;
  --amber-bg: #fff3e0;
  --danger: #b42318;
  --danger-bg: #fdecec;
  --good: #1f7a4d;
  --ink: #0b2a38;
  --muted: #4b6371;
  --line: #d9e3e8;
  --paper: #f4f7f9;
  --surface: #ffffff;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  -webkit-text-size-adjust: 100%;
}

a { color: var(--teal-strong); }
h1 { margin: 4px 0 10px; font-size: 1.6rem; line-height: 1.2; }
h2 { margin: 26px 0 10px; font-size: 1.1rem; display: flex; align-items: center; gap: 8px; }
p { margin: 0 0 12px; }
code { font: 0.85em ui-monospace, Consolas, monospace; background: var(--paper); padding: 1px 4px; border-radius: 4px; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.break { overflow-wrap: anywhere; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* --- Barra ------------------------------------------------------------------- */
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px));
  background: var(--navy);
  color: #ffffff;
}
.bar__brand { color: #ffffff; font-weight: 800; text-decoration: none; font-size: 1.1rem; }
.bar__brand span { font-weight: 500; opacity: 0.75; }
.bar__nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.bar__nav a {
  color: #ffffff; text-decoration: none; padding: 8px 10px; border-radius: 8px; white-space: nowrap; min-height: 40px;
  display: inline-flex; align-items: center;
}
.bar__nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.16); font-weight: 700; }
.bar form { margin: 0; }
.bar__out {
  background: none; border: 1px solid rgba(255, 255, 255, 0.4); color: #ffffff; border-radius: 8px;
  padding: 6px 12px; font: inherit; cursor: pointer; min-height: 40px;
}

.main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px max(16px, env(safe-area-inset-right, 0px)) 48px max(16px, env(safe-area-inset-left, 0px));
}

/* --- Formularios -------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.card--narrow { max-width: 420px; margin: 24px auto; }
.form { display: grid; gap: 8px; }
.form label { font-weight: 600; }
.form input, .filters input, .filters select {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; min-height: 44px;
  background: var(--surface); color: var(--ink); width: 100%;
}
.button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 18px;
  border: 0; border-radius: 10px; background: var(--teal-strong); color: #ffffff; font: inherit; font-weight: 700;
  cursor: pointer; text-decoration: none; margin-top: 6px;
}
.button--small { min-height: 44px; margin-top: 0; }
.button--soft { background: var(--paper); color: var(--ink); border: 1px solid var(--line); }
.alert { background: var(--danger-bg); color: var(--danger); border-radius: 10px; padding: 10px 12px; font-weight: 600; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters input { flex: 1 1 200px; width: auto; }
.filters select { flex: 0 1 180px; width: auto; }

/* --- Inicio ------------------------------------------------------------------- */
.count {
  font-size: 0.8rem; background: var(--line); color: var(--ink); border-radius: 999px; padding: 1px 8px; font-weight: 700;
}
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.alert-row {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; align-items: center;
  padding: 10px 12px; border-radius: 10px; border-left: 4px solid var(--muted); background: var(--surface);
}
.alert-row--warning { border-left-color: var(--amber); background: var(--amber-bg); }
.alert-row a { font-weight: 700; white-space: nowrap; }
details summary { cursor: pointer; min-height: 40px; padding: 8px 0; font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tiles--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px;
  display: grid; gap: 2px; min-width: 0;
}
.tile__label { font-size: 0.8rem; color: var(--muted); }
.tile__value { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tile__note { font-size: 0.78rem; color: var(--muted); overflow-wrap: anywhere; }
.good { color: var(--good); }
.warn { color: var(--amber); }
.bad { color: var(--danger); }

.chart { display: block; width: 100%; height: 110px; margin: 12px 0 4px; }
.chart__bar { fill: var(--teal-strong); }

/* --- Tablas y listas ---------------------------------------------------------- */
.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.table { border-collapse: collapse; width: 100%; min-width: 620px; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: 0.8rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }

.pill {
  display: inline-block; font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: #e3f3f5; color: var(--teal-strong); white-space: nowrap;
}
.pill--warn { background: var(--amber-bg); color: var(--amber); }
.pill--bad { background: var(--danger-bg); color: var(--danger); }
.pill--muted { background: var(--paper); color: var(--muted); }

.buttons, .plain, .log { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.buttons li, .plain li, .log li {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.buttons li.is-hidden { opacity: 0.65; }

@media (max-width: 520px) {
  .tiles--three { grid-template-columns: 1fr 1fr 1fr; }
  .tile__value { font-size: 1.15rem; }
  .bar__nav { order: 3; flex-basis: 100%; }
}

/* --- Fichas de clientes y servidor (ADR 0016) ---------------------------------------------- */
.title-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.server-strip {
  display: block; margin-bottom: 14px; padding: 10px 12px; border-radius: 10px;
  background: var(--danger-bg); color: var(--danger); text-decoration: none; font-size: 0.9rem;
}
.client-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.client-card {
  display: grid; gap: 4px; padding: 12px 14px; border-radius: 12px; background: var(--surface);
  border: 1px solid var(--line); color: var(--ink); text-decoration: none;
}
.client-card:hover { border-color: var(--teal); }
.client-card__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.notice { background: #e3f3f5; color: var(--teal-strong); border-radius: 10px; padding: 10px 12px; font-weight: 600; }
h3 { margin: 18px 0 8px; font-size: 1rem; }
.form textarea, .form select {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); width: 100%;
}
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 12px; }
.field-box { display: grid; gap: 6px; min-width: 0; }
.field-box label { font-weight: 600; }
details.card { margin-top: 10px; }
details.card summary { font-weight: 700; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; min-height: 40px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 6px; }
.row-actions form { margin: 0; }
.link-button {
  background: none; border: 0; padding: 6px 0; color: var(--teal-strong); font: inherit; font-size: 0.85rem;
  font-weight: 600; cursor: pointer; text-decoration: underline; min-height: 44px;
  display: inline-flex; align-items: center;
}
.link-button--danger { color: var(--danger); }
.confirm-delete summary { list-style: none; }
.confirm-delete summary::-webkit-details-marker { display: none; }
.confirm-delete[open] { flex-basis: 100%; }
.plain li.is-hidden { opacity: 0.65; }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.check-row {
  display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: 2px 10px; align-items: baseline;
  padding: 10px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--good);
}
.check-row--warn { border-left-color: var(--amber); }
.check-row--bad { border-left-color: var(--danger); background: var(--danger-bg); }
.check-row--unknown { border-left-color: var(--line); }
.check-row__state { font-size: 0.8rem; font-weight: 800; }
.check-row__name { font-weight: 600; }
.check-row__value { font-variant-numeric: tabular-nums; text-align: right; }
.check-row__note { grid-column: 2 / -1; }
@media (max-width: 520px) {
  .check-row { grid-template-columns: 1fr; }
  .check-row__value { text-align: left; }
  .check-row__note { grid-column: auto; }
}
