/* ============================================================
 * Endpoint Check — Swiss enterprise console styling
 * Light, editorial, restrained. No gradients, no shadows-as-decoration.
 * ============================================================ */

:root {
  --bg: #F7F5F0;            /* page background */
  --surface: #FFFFFF;       /* main surface */
  --surface-2: #F1F0EC;     /* secondary surface */
  --text: #111111;          /* primary text */
  --text-2: #525252;        /* secondary text */
  --text-muted: #737373;    /* muted text */
  --border: #D8D6D0;        /* component borders */
  --rule: #E5E2DA;          /* dividers / rules */

  --action: #111111;        /* primary action bg */
  --action-text: #FFFFFF;   /* primary action text */
  --action-border: #C9C6BD; /* secondary action border */

  --danger: #B42318;
  --success: #067647;
  --warning: #B54708;

  --font-sans: Inter, "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system,
               BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

/* display: grid/table перебивает UA-правило для [hidden] */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ------------------------------------------------------------
 * Console shell
 * ------------------------------------------------------------ */
.console {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 24px 48px;
}

/* Network status — quiet meta text on the right */
.net-indicator {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}
.net-indicator::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
}
.net-indicator.online { color: var(--success); }
.net-indicator.online::before { background: var(--success); }
.net-indicator.offline { color: var(--danger); }
.net-indicator.offline::before { background: var(--danger); }

/* ------------------------------------------------------------
 * Main panel
 * ------------------------------------------------------------ */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 22px 22px 26px;
}

/* ------------------------------------------------------------
 * Action bar
 * ------------------------------------------------------------ */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}

button {
  appearance: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  padding: 0;
  border-radius: 0;
  cursor: pointer;
  color: var(--text);
  background: transparent;
  border: 0;
  transition: color 0.12s ease;
}
button:hover { color: var(--text-2); }
button:active { color: var(--text-muted); }

button.primary {
  color: var(--text);
  font-weight: 700;
}
button.primary:hover { color: var(--text-2); }
button.primary:active { color: var(--text-muted); }

button.danger {
  color: var(--danger);
}
button.danger:hover { color: #8E1C13; }

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Keyboard focus — visible, accessible */
button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

/* ------------------------------------------------------------
 * Summary strip — compact operational report
 * ------------------------------------------------------------ */
.summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin-bottom: 6px;
  font-size: 12.5px;
  color: var(--text-2);
}
.summary-item {
  display: inline;
  white-space: nowrap;
}
.summary-item.wide {
  margin-left: auto;
  color: var(--text-muted);
}

.summary-label {
  font-size: inherit;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--text-muted);
}
.summary-item > span:last-child {
  font-size: inherit;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.summary .ok { color: var(--success); }
.summary .fail { color: var(--danger); }

/* ------------------------------------------------------------
 * Operational notes / status lines
 * ------------------------------------------------------------ */
.notes:not(:empty) { margin-bottom: 10px; }

.reports-info,
.status-line {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-2);
}
.reports-info:empty,
.status-line:empty { display: none; }
.status-line { color: var(--text); }

/* ------------------------------------------------------------
 * Results table — the visual center
 * ------------------------------------------------------------ */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow-x: auto;
}

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

thead th {
  position: sticky;
  top: 0;
  text-align: left;
  padding: 10px 14px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
/* HTTP / ms — compact right-aligned numeric columns */
thead th:nth-child(2),
thead th:nth-child(3) { text-align: right; }

tbody td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--rule);
  color: var(--text);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #FBFAF7; }

.cell-url {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  width: 100%; /* короткое имя занимает свободную ширину, прижимая статусы вправо */
}

/* Заголовок группы (BK / PB) */
.group-row td {
  background: var(--surface-2);
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
}
.group-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}

.cell-status { white-space: nowrap; font-weight: 500; }
.status-reachable { color: var(--success); }
.status-timeout { color: var(--warning); }
.status-unreachable { color: var(--danger); }
.status-redirect { color: var(--warning); }

.cell-http {
  text-align: right;
  white-space: nowrap;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}
.http-ok { color: var(--success); }
.http-warn { color: var(--text-muted); }
.http-err { color: var(--danger); }
.cell-http.status-reachable { color: var(--success); }
.cell-http.status-timeout,
.cell-http.status-redirect,
.cell-http.status-client-fetch-failed,
.cell-http.status-fetch-error { color: var(--warning); }
.cell-http.status-tls-error { color: var(--danger); }
.cell-http.status-unreachable { color: var(--danger); }

.cell-duration {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}

.dns-note {
  display: inline-block;
  margin-top: 3px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

/* ------------------------------------------------------------
 * Disclaimer — quiet footnote
 * ------------------------------------------------------------ */
.disclaimer {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------ */
@media (max-width: 600px) {
  .console { padding: 10px 8px 28px; }
  .panel {
    padding: 8px 6px 16px;
    border: 0;
    border-radius: 0;
  }
  .controls {
    gap: 5px 12px;
    padding: 0 2px 8px;
    margin-bottom: 8px;
  }
  .controls button { flex: none; }
  .net-indicator {
    margin-left: auto;
    gap: 0;
    font-size: 0;
  }
  .summary {
    gap: 3px 10px;
    padding: 0 2px;
    font-size: 11.5px;
  }
  .summary-item.wide { margin-left: 0; }
  .notes { padding: 0 2px; }
  .reports-info { display: none; }
  .status-line {
    font-size: 11.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .table-wrap { border-radius: 6px; }
  thead th { padding: 7px 10px; }
  tbody td { padding: 7px 10px; }
  .group-row td { padding: 5px 10px; }
  .disclaimer { display: none; }
}
