/* Centinela console — no external resources */
:root {
  /* Quiet neutrals and one accent; colour is kept for what needs attention. */
  --bg: #f5f5f3;
  --surface: #ffffff;
  --surface-2: #f7f7f5;
  --border: #e3e3df;
  --border-strong: #cdcdc7;
  --text: #1c1c1a;
  --text-2: #5a5a54;
  --text-3: #76766f;
  --primary: #2f5fc4;
  --primary-hover: #264fa7;
  --primary-soft: #e8eefb;
  --danger: #c0392b;
  --danger-soft: #fbeae8;
  --warning: #9a5b00;
  --warning-soft: #fbf0dc;
  --success: #2f7a4b;
  --success-soft: #e6f2ea;
  /* Status bar (0.2.23): lighter than --success so that it stays apart from
     --danger in lightness (1,77:1 instead of 1,04:1) and under deuteranopia. */
  --status-up: #58a275;
  --muted-soft: #ececE8;
  --side-bg: #1d1e21;
  --side-text: #c9c9c4;
  --side-text-2: #8a8a84;
  --side-active: #2e2f34;
  --radius: 6px;
  --radius-sm: 5px;
  --shadow: none;
  --shadow-lg: 0 8px 24px rgba(20, 20, 18, .16);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --mod-ssh: #6366f1;
  --mod-mail: #0ea5e9;
  --mod-ftp: #14b8a6;
  --mod-panel: #a855f7;
  --mod-web: #f59e0b;
  --mod-waf: #ef4444;
  --mod-captcha: #22c55e;
  --mod-honeypot: #d946ef;
  --mod-dos: #f97316;
  --mod-other: #64748b;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.005em; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
.hidden { display: none !important; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.grow { flex: 1; }
.break { word-break: break-all; }

/* ------------------------------------------------------------ layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px;
  flex: 0 0 236px;
  background: var(--side-bg);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 18px 16px;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.brand:hover { text-decoration: none; }
.logo { width: 30px; height: 30px; flex: 0 0 auto; }
.nav { display: flex; flex-direction: column; padding: 10px 10px; gap: 2px; overflow-y: auto; flex: 1; }
.nav-section {
  font-size: 12px;
  color: var(--side-text-2);
  padding: 16px 10px 5px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--side-text);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.nav a:hover { background: rgba(255, 255, 255, .05); text-decoration: none; color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; }
.nav svg { width: 18px; height: 18px; flex: 0 0 auto; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .9; }
.sidebar-foot { padding: 12px 18px; font-size: 11px; color: var(--side-text-2); border-top: 1px solid rgba(255, 255, 255, .06); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.page-title { font-size: 18px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.tenant-switch { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.tenant-switch select { min-width: 180px; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  padding: 3px 10px 3px 3px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
}
.user-chip:hover { text-decoration: none; border-color: var(--border-strong); }
.avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: #4a4a45; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px; text-transform: uppercase;
}
.tenant-banner {
  background: var(--warning-soft);
  color: #6f4300;
  border-bottom: 1px solid #ecd3a3;
  padding: 8px 28px;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
/* «Todos los clientes»: the colours of .notice.info */
.tenant-banner.all { background: #f2f5fc; color: #23427f; border-bottom-color: #d4def4; }
/* «Elige un cliente»: one button per customer */
.tenant-pick { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.tenant-pick .btn { white-space: normal; text-align: left; }
.view { padding: 24px 28px 48px; outline: none; max-width: 1500px; width: 100%; }

/* ------------------------------------------------------------ cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.card-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 10px 18px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

.grid { display: grid; gap: 20px; margin-bottom: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 20px; }

/* Key figures: one strip split by hairlines instead of a box per figure.
   Each cell draws the line on its left and top; the strip clips the ones
   on its outer edge, so rows that wrap stay divided too. */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.stat {
  padding: 14px 16px 13px;
  min-width: 0;
  box-shadow: -1px 0 0 var(--border), 0 -1px 0 var(--border);
}
.stat-label { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-size: 26px; font-weight: 600; line-height: 1.25; margin-top: 4px; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 14px; color: var(--text-3); font-weight: 500; }
.stat-hint { font-size: 12px; color: var(--text-3); margin-top: 2px; }
/* Colour only when a figure needs attention. */
.stat.attn-warn .stat-hint { color: var(--warning); font-weight: 500; }
.stat.attn-danger .stat-value { color: var(--danger); }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { font-size: 12.5px; color: var(--text-2); background: var(--surface); font-weight: 600; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table td.actions { white-space: nowrap; text-align: right; }
/* DynDNS names (white list): the entries of a name have a note instead of «Quitar». */
.table td.actions .dyn-note { display: inline-block; max-width: 76px; white-space: normal; line-height: 1.3; }
.table td.dyn-status { min-width: 160px; max-width: 280px; word-break: break-word; }
.table td.actions.dyn-actions { white-space: normal; min-width: 150px; }
.table td.dyn-actions .btn { margin: 0 0 4px 4px; }
.table .empty { text-align: center; color: var(--text-3); padding: 28px 14px; }
.detail-cell { max-width: 520px; color: var(--text-2); word-break: break-word; }
.detail-cell .expand { margin-left: 6px; font-size: 12px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; }
.kv dt { color: var(--text-2); font-size: 13px; }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }

/* ------------------------------------------------------------ badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
  background: var(--muted-soft);
  color: var(--text-2);
}
.b-success { background: var(--success-soft); color: #256b3f; }
.b-danger { background: var(--danger-soft); color: #a3322a; }
.b-warning { background: var(--warning-soft); color: #7f4c00; }
.b-info { background: var(--primary-soft); color: #2a54ad; }
.b-muted { background: var(--muted-soft); color: var(--text-2); }
.b-black { background: var(--danger-soft); color: #a3322a; }
.b-grey { background: var(--warning-soft); color: #7f4c00; }
.b-white { background: var(--success-soft); color: #256b3f; }
.badges { display: flex; flex-wrap: wrap; gap: 4px; }

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--mod-other); flex: 0 0 auto; }
.mod-ssh { background: var(--mod-ssh); }
.mod-mail { background: var(--mod-mail); }
.mod-ftp { background: var(--mod-ftp); }
.mod-panel { background: var(--mod-panel); }
.mod-web { background: var(--mod-web); }
.mod-waf { background: var(--mod-waf); }
.mod-captcha { background: var(--mod-captcha); }
.mod-honeypot { background: var(--mod-honeypot); }
.mod-dos { background: var(--mod-dos); }
.mod-tag { display: inline-flex; align-items: center; gap: 6px; font-weight: 550; }

/* ------------------------------------------------------------ chart */
.chart { width: 100%; height: 220px; display: block; }
.chart .axis { stroke: var(--border); stroke-width: 1; }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 3; }
.chart text { fill: var(--text-3); font-size: 10px; font-family: var(--font); }
.chart rect.bar:hover { opacity: .8; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-2); margin-top: 10px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar-row { display: grid; grid-template-columns: 90px 1fr 50px; align-items: center; gap: 10px; font-size: 13px; }
.hbar-track { height: 8px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 2px; background: var(--mod-other); }

/* ------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > span, .field-label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--text-3); font-weight: 400; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=search], select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  min-height: 34px;
  width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
textarea { min-height: 90px; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; }
textarea.tall { min-height: 260px; }
textarea.prose { font-family: var(--font); font-size: 14px; min-height: 70px; }
.offscreen { position: fixed; left: -9999px; top: 0; opacity: 0; }
details summary { cursor: pointer; margin-bottom: 8px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47, 95, 196, .16); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-2); }
input[type=number] { max-width: 140px; }
.check { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 12px; cursor: pointer; }
.check input { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--primary); flex: 0 0 auto; }
.check b { font-weight: 600; }
.check .hint { display: block; font-size: 12px; color: var(--text-3); }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row > .field { flex: 1 1 180px; margin-bottom: 0; }
.form-row > .field.narrow { flex: 0 0 160px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 18px; }
.form-error { background: var(--danger-soft); color: #8e2a21; border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; margin-bottom: 12px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.filters .field { margin-bottom: 0; min-width: 150px; }
.filters .field.wide { min-width: 220px; }
.section-title { font-size: 14px; color: var(--text); margin: 18px 0 10px; font-weight: 600; }
.section-title:first-child { margin-top: 0; }
.rule-input { max-width: 100px !important; }

/* ------------------------------------------------------------ buttons */
.btn {
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  min-height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--surface); border-color: #fca5a5; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn-sm { padding: 4px 10px; min-height: 28px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-link { border: 0; background: none; color: var(--primary); cursor: pointer; padding: 0; font: inherit; font-size: inherit; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a {
  padding: 9px 14px;
  color: var(--text-2);
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--primary); border-bottom-color: var(--primary); }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.segmented a { padding: 5px 12px; font-size: 12.5px; font-weight: 600; color: var(--text-2); background: var(--surface); }
.segmented a + a { border-left: 1px solid var(--border-strong); }
.segmented a.active { background: var(--primary); color: #fff; }
.segmented a:hover { text-decoration: none; }

.pager { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }

.copy-box {
  display: flex;
  align-items: stretch;
  gap: 8px;
  background: #1d1e21;
  color: #e6e6e1;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--mono);
  font-size: 12.5px;
  word-break: break-all;
}
.copy-box code { flex: 1; color: inherit; align-self: center; }
.copy-box .btn { background: #2e2f34; color: #e6e6e1; border-color: #3d3e44; }
.copy-box .btn:hover { background: #3d3e44; }

pre.json {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  overflow: auto;
  max-height: 360px;
  font-family: var(--mono);
  font-size: 12px;
  margin: 0;
}

.notice { border-radius: var(--radius-sm); padding: 10px 14px; font-size: 13px; margin-bottom: 16px; border: 1px solid; }
.notice.info { background: #f2f5fc; border-color: #d4def4; color: #23427f; }
.notice.warn { background: var(--warning-soft); border-color: #ecd3a3; color: #6f4300; }

.loading { padding: 40px; text-align: center; color: var(--text-3); }
.spinner {
  width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ login */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px 28px 24px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand .logo { width: 40px; height: 40px; }
.login-title { font-size: 21px; font-weight: 600; letter-spacing: -.01em; }
.login-sub { color: var(--text-2); font-size: 13px; }

/* ------------------------------------------------------------ toasts & modal */
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast {
  min-width: 260px;
  max-width: 420px;
  padding: 11px 14px;
  border-radius: var(--radius);
  background: #1d1e21;
  color: #f1f1ee;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  animation: toast-in .18s ease-out;
}
.toast.success { background: #1e3a29; }
.toast.error { background: #6e2019; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 90;
}
.modal {
  background: var(--surface); border-radius: 8px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 460px; max-height: 90vh; overflow: auto;
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 16px 20px; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ------------------------------------------------------------ IP page */
.ip-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ip-head .ip { font-family: var(--mono); font-size: 22px; font-weight: 700; overflow-wrap: anywhere; }
.ip-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ip-facts { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.ip-facts-list { display: flex; flex-wrap: wrap; gap: 10px 36px; margin: 0; }
.ip-facts-list > div { min-width: 0; }
.ip-facts-list dt { font-size: 12px; color: var(--text-3); }
.ip-facts-list dd { margin: 3px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.ip-facts-src { margin-top: 8px; }
.stat-value.stat-text { font-size: 20px; line-height: 1.6; }
.verdict { font-size: 13px; font-weight: 600; padding: 3px 10px; border-radius: 4px; }
.verdict.v-black { background: var(--danger-soft); color: #a3322a; }
.verdict.v-grey { background: var(--warning-soft); color: #7f4c00; }
.verdict.v-white { background: var(--success-soft); color: #256b3f; }
.verdict.v-clean { background: var(--muted-soft); color: var(--text-2); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .grid-2-1, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.menu-btn, .nav-backdrop { display: none; }

/* Phones and narrow windows: the sidebar becomes a drawer opened with the
   ☰ button, with every option and section, like on the desktop. */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 60;
    width: min(280px, 86vw);
    height: 100vh;
    height: 100dvh;
    transform: translateX(-105%);
    transition: transform .2s ease, visibility .2s;
    visibility: hidden;
  }
  body.nav-open .sidebar { transform: none; visibility: visible; box-shadow: 0 0 40px rgba(0, 0, 0, .35); }
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 55;
    background: rgba(15, 23, 42, .5);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  body.nav-open .nav-backdrop { opacity: 1; pointer-events: auto; }
  body.nav-open { overflow: hidden; }
  .nav a { padding: 10px 10px; }
  .menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    margin-left: -6px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text);
    cursor: pointer;
  }
  .menu-btn:hover, .menu-btn:focus-visible { background: var(--surface-2); }
  .menu-btn svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
  .topbar { padding: 8px 12px; flex-wrap: wrap; gap: 6px 12px; }
  .page-title { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-right { gap: 8px; margin-left: auto; }
  .tenant-switch > span { display: none; }
  .tenant-switch select { min-width: 0; max-width: 44vw; }
  .user-chip > span:not(.avatar) { display: none; }
  .view { padding: 16px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .tenant-banner { padding: 8px 16px; }
}
@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
  .sidebar, .nav-backdrop { transition: none; }
}

/* Phase 2 */
a.stat { display: block; color: inherit; text-decoration: none; }
a.stat:hover { background: var(--surface-2); text-decoration: none; }
.card-head .field.inline { flex-direction: row; align-items: center; gap: 8px; margin-bottom: 0; }
td.path-cell { min-width: 340px; max-width: 560px; overflow-wrap: anywhere; }

/* Server activity: one small chart per measure */
.act-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.act-tile { position: relative; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px 10px; background: var(--surface); }
.act-label { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.act-swatch { width: 10px; height: 10px; flex: 0 0 auto; }
.act-value { font-size: 22px; font-weight: 600; letter-spacing: -.01em; margin-top: 4px; color: var(--text); font-variant-numeric: tabular-nums; }
.act-hint { font-size: 11.5px; color: var(--text-3); min-height: 16px; }
.act-plot { margin-top: 8px; cursor: crosshair; }
.act-chart { display: block; width: 100%; height: 64px; overflow: visible; }
.act-chart .gridline { stroke: var(--border); stroke-dasharray: 3 3; }
.act-chart .baseline { stroke: var(--border-strong); }
.act-chart .hover-band { fill: var(--text); opacity: .07; }
.act-axis { display: flex; justify-content: space-between; margin-top: 3px; font-size: 10.5px; color: var(--text-3); }
.act-tip { position: absolute; z-index: 5; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap;
  background: var(--text); color: #fff; font-size: 11.5px; padding: 4px 8px; border-radius: 5px; box-shadow: var(--shadow-lg); }
.act-tip.tip-left { transform: translate(-100%, -100%); }
.act-tip.tip-right { transform: translate(0, -100%); }
.act-note { margin: 12px 0 6px; }
#activity details .act-table { margin-top: 10px; max-height: 360px; overflow: auto; }

/* Status page: one history bar per server */
.status-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 14px; }
.st-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; font-size: 12px; color: var(--text-2); }
.st-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.st-key { display: inline-block; flex: 0 0 auto; width: 14px; height: 8px; border-radius: 2px; }
.st-key.k-up { background: var(--status-up); }
.st-key.k-down { width: 4px; height: 14px; background: var(--danger); }
.st-key.k-gap { background: var(--border-strong); }
.st-key.k-none { background: var(--surface-2); border: 1px solid var(--border); }
.st-wrap { position: relative; }
.st-table td { vertical-align: middle; }
.st-table th.st-hist, .st-table td.st-hist { width: 46%; min-width: 220px; }
.st-host { max-width: 280px; overflow-wrap: anywhere; }
/* «anywhere» lets the hostname shrink to one letter: without a floor, the
   column would take the width of its header. Hostnames wrap after their dots
   (<wbr>), and Estado and Disponibilidad wrap their lines below the badge. */
.st-table td.st-host { min-width: 9rem; }
.st-twin { display: block; margin-top: 2px; font-size: 12px; color: var(--text-3); }
.st-pct { white-space: normal; font-variant-numeric: tabular-nums; }
.st-pct b { white-space: nowrap; }
.st-note { margin: 0 0 10px; }
.sbar { position: relative; height: 24px; cursor: crosshair; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.sbar-track { position: absolute; left: 0; right: 0; top: 8px; height: 8px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 2px; }
.sbar-run { position: absolute; top: 8px; height: 8px; }
.sbar-run.k-up { background: var(--status-up); }
.sbar-run.k-gap, .sbar-run.k-wait { background: var(--border-strong); }
.sbar-run.k-down { top: 4px; height: 16px; min-width: 3px; background: var(--danger); border-radius: 1px; }
.sbar-ends { display: flex; justify-content: space-between; margin-top: 2px; font-size: 10.5px; font-weight: 400; color: var(--text-3); }
.st-table td .sbar-ends { display: none; }
/* max-content: positioned near the right edge, the box would otherwise shrink
   to the little width left of it and wrap the text word by word. */
.st-tip { white-space: normal; width: max-content; max-width: min(320px, 85vw); }
/* Placed by statusShowTip, which measures the box and keeps it inside the
   wrapper: only the vertical shift is left (two classes, over .act-tip). */
.act-tip.st-tip { transform: translateY(-100%); }
.st-table.is-loading .sbar, .st-table.is-loading .st-pct, .stats.is-loading .stat-value { opacity: .5; }
@media (forced-colors: active) { .sbar-track, .sbar-run, .st-key { forced-color-adjust: none; } }
@media (max-width: 700px) {
  .stack-sm .st-table tbody td.st-hist { display: block; width: 100%; min-width: 0; padding-top: 8px; }
  .stack-sm .st-table td .sbar-ends { display: flex; }
  .st-host { max-width: none; }
  .st-table td.st-host { min-width: 0; }
  .status-tools .segmented a { padding: 8px 12px; }
}

/* Outgoing mail settings */
.actions-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; }

/* Server count in the side menu */
.nav-count { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 4px; background: rgba(255, 255, 255, .1); color: var(--side-text); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; display: inline-flex; align-items: center; justify-content: center; }
/* Sortable table headers */
/* Tables that turn into one card per row on phones, so the action buttons
   stay on screen instead of past the right edge. */
@media (max-width: 700px) {
  .stack-sm .table thead { display: none; }
  .stack-sm .table, .stack-sm .table tbody, .stack-sm .table tr { display: block; width: 100%; }
  .stack-sm .table tbody tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .stack-sm .table tbody tr:last-child { border-bottom: 0; }
  .stack-sm .table tbody td { display: block; padding: 2px 0; border: 0; text-align: left; white-space: normal; }
  .stack-sm .table tbody td.inline-sm { display: inline-block; margin-right: 18px; vertical-align: middle; }
  .stack-sm .table tbody td.beside-sm { display: inline-block; width: calc(100% - 40px); vertical-align: top; }
  .stack-sm .table tbody td[data-label]::before { content: attr(data-label) " "; color: var(--text-3); font-size: 12px; }
  .stack-sm .table tbody td.actions,
  .stack-sm .table tbody td.act-sm { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; }
  .stack-sm .table tbody td.actions:empty { display: none; }
  .stack-sm .table tbody td.path-cell { min-width: 0; max-width: none; }
  .stack-sm .table tbody td.empty { text-align: center; }
  .stack-sm .table tbody tr:hover td { background: transparent; }
  /* Tables sorted by the console keep their column names as sort buttons. */
  .stack-sm.sort-chips .table thead { display: block; }
  .stack-sm.sort-chips .table thead tr { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
  .stack-sm.sort-chips .table thead th { padding: 3px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
  .stack-sm.sort-chips .table thead th:empty,
  .stack-sm.sort-chips .table thead th:not(.sortable) { display: none; }
}
.table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.table th.sortable a { color: inherit; text-decoration: none; }
.table th.sortable:hover { color: var(--text); }
.table th.sorted-asc::after { content: " ▲"; font-size: 9px; color: var(--primary); }
.table th.sorted-desc::after { content: " ▼"; font-size: 9px; color: var(--primary); }

/* ------------------------------------------------------------ detected file viewer */
.notice.error { background: var(--danger-soft); border-color: #efc2bd; color: #8e2a21; }
.modal.modal-wide { max-width: min(1200px, 96vw); }
.src-meta { display: grid; gap: 4px; margin-bottom: 12px; word-break: break-all; }
.src-state { display: flex; align-items: center; gap: 8px; }
.spinner-inline {
  flex: 0 0 auto; width: 14px; height: 14px; border: 2px solid #d4def4; border-top-color: var(--primary);
  border-radius: 50%; animation: spin .8s linear infinite;
}
.src-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.src-tools label { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }
.src-view { max-height: 62vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.src-code { margin: 0; font-family: var(--mono); font-size: 12px; line-height: 1.5; min-width: max-content; }
.src-view:not(.nowrap) .src-code { min-width: 0; }
.src-line { display: flex; }
.src-ln {
  flex: 0 0 auto; min-width: 4.5em; padding: 0 10px 0 6px; text-align: right; color: var(--text-3);
  user-select: none; border-right: 1px solid var(--border); background: #efefec; position: sticky; left: 0;
}
.src-txt { flex: 1; padding: 0 10px; white-space: pre-wrap; word-break: break-all; }
.src-view.nowrap .src-txt { white-space: pre; word-break: normal; }
.src-line.hit { background: var(--danger-soft); }
.src-line.hit .src-ln { background: #fecaca; color: #991b1b; font-weight: 600; }
.src-code mark { background: #fde047; color: inherit; border-radius: 2px; }

/* Services per server */
.svc-cell { display: flex; flex-wrap: wrap; gap: 6px; }
.svc-sel { min-width: 200px; }
tr.svc-own td { background: #f3f6fd; }
tr.svc-own .svc-sel:not([name=svc_waf_mode]) { border-color: var(--primary); }

/* Brand line at the bottom of the menu */
.powered-by { margin-top: 6px; font-size: 11.5px; color: var(--side-text-2); }
.powered-by a { color: var(--side-text); font-weight: 600; }
.powered-by a:hover { color: #fff; }

/* ------------------------------------------------------------ public unblock page (desbloquear.html) */
.login-alt { margin: 16px 0 0; text-align: center; font-size: 13px; color: var(--text-2); }
.ub-text { margin: 0 0 12px; color: var(--text-2); font-size: 13px; }
.ub-page input[type=text] { font-size: 16px; }
/* Two classes: «input[type=text]» sets «font: inherit» and would win over one. */
.ub-page .ub-mono { font-family: var(--mono); }
.ub-cap-img { display: block; width: 100%; max-width: 360px; height: auto; aspect-ratio: 3 / 1;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.ub-cap-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.ub-result h2 { font-size: 16px; margin: 0 0 8px; }
.ub-result p { margin: 0 0 8px; font-size: 13.5px; }
.ub-ref { font-family: var(--mono); font-weight: 600; font-size: 14px; }
.ub-help { margin: 12px 0 0; font-size: 12.5px; color: var(--text-3); }
.notice.ok { background: var(--success-soft); border-color: #c5e0cf; color: #1f5a37; }
@media (max-width: 700px) { .login.ub-page { padding: 16px; align-items: flex-start; } }
