/* HA Sentinel - visual identity notes
   Subject: HA "heartbeat" links between FortiGate cluster members, so the
   signature element is a literal ECG-style heartbeat trace per unit -
   a moving pulse when the unit is answering SNMP, a flat dead line when it
   isn't. Palette avoids the default warm-cream/serif and default dark+neon
   looks: deep ink-blue base, signal teal for healthy, amber for role/info,
   red for down - closer to an oscilloscope than a marketing site. */

:root {
  --bg: #0a0f16;
  --panel: #101826;
  --panel-2: #141f2f;
  --line: #223046;
  --text: #dce6f2;
  --text-dim: #7f93ac;
  --teal: #35d1a6;
  --amber: #f2ad4e;
  --red: #ef5a6f;
  --blue: #5b8def;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 44px 44px;
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2 { font-family: var(--sans); font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
.muted { color: var(--text-dim); font-size: 13px; margin: 4px 0 0; }

/* ---------------------------------------------------------------- shell */
.shell { display: flex; min-height: 100vh; }

.side {
  width: 232px;
  flex-shrink: 0;
  background: rgba(16, 24, 38, 0.9);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(6px);
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; margin-bottom: 30px; }
.brand-mark { font-size: 22px; color: var(--teal); text-shadow: 0 0 12px rgba(53,209,166,.6); }
.brand-title { font-weight: 600; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--text-dim); }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a {
  color: var(--text-dim); padding: 9px 10px; border-radius: 6px; font-size: 14px;
}
.side nav a:hover { background: var(--panel-2); text-decoration: none; color: var(--text); }
.side nav a.active { background: var(--panel-2); color: var(--teal); }
.side-footer {
  font-size: 12px; color: var(--text-dim); display: flex; justify-content: space-between;
  border-top: 1px solid var(--line); padding-top: 14px;
}

.content { flex: 1; padding: 32px 40px; max-width: 1180px; }

/* ---------------------------------------------------------------- flash */
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.flash-stack-standalone { max-width: 420px; margin: 24px auto 0; }
.flash { padding: 10px 14px; border-radius: 6px; font-size: 13px; }
.flash-success { background: rgba(53,209,166,.12); border: 1px solid rgba(53,209,166,.35); color: var(--teal); }
.flash-error { background: rgba(239,90,111,.12); border: 1px solid rgba(239,90,111,.35); color: var(--red); }

/* --------------------------------------------------------------- page head */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
.section-title { margin-top: 36px; font-size: 16px; }

/* --------------------------------------------------------------- buttons */
.btn-primary, .btn-secondary, .btn-ghost, button[type="submit"] {
  font-family: var(--sans); font-size: 13.5px; font-weight: 600; border-radius: 7px;
  padding: 9px 16px; cursor: pointer; border: 1px solid transparent;
}
input[type="submit"], button.btn-primary, .btn-primary {
  background: var(--teal); color: #062019; border: none;
}
input[type="submit"]:hover, .btn-primary:hover { filter: brightness(1.08); }
.btn-secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
.btn-secondary:hover { border-color: var(--blue); }
.btn-ghost { background: transparent; color: var(--text-dim); border: 1px solid var(--line); }
.btn-block { width: 100%; margin-top: 6px; }
.link-danger { background: none; border: none; color: var(--red); font-size: 13px; cursor: pointer; padding: 0; }

/* ------------------------------------------------------------------ login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 40px 36px; width: 340px; text-align: center;
}
.login-mark { font-size: 30px; color: var(--teal); margin-bottom: 6px; text-shadow: 0 0 16px rgba(53,209,166,.6); }
.login-card h1 { font-size: 20px; }
.login-sub { color: var(--text-dim); font-size: 12.5px; margin-bottom: 22px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.login-card label { font-size: 12.5px; color: var(--text-dim); display: flex; flex-direction: column; gap: 6px; }

/* ---------------------------------------------------------------- forms */
input, select {
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: 6px; padding: 9px 11px; font-family: var(--sans); font-size: 14px;
  width: 100%;
}
input:focus, select:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
.form-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 24px 28px; max-width: 640px; display: flex; flex-direction: column; gap: 18px;
}
fieldset { border: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
legend { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-dim); padding: 0 0 6px; }
label { font-size: 13px; color: var(--text-dim); display: flex; flex-direction: column; gap: 6px; }
.field-row { display: flex; gap: 14px; }
.field-row label { flex: 1; }
.field-narrow { max-width: 160px; }
.field-err { color: var(--red); font-size: 12px; }
.hint { font-size: 12px; color: var(--text-dim); margin: 0; }
.checkbox-row { flex-direction: row; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
.form-actions { display: flex; gap: 10px; align-items: center; }
.test-result { font-size: 13px; margin-top: 6px; font-family: var(--mono); }

/* ---------------------------------------------------------------- empty */
.empty-state {
  border: 1px dashed var(--line); border-radius: 10px; padding: 50px; text-align: center;
  color: var(--text-dim); display: flex; flex-direction: column; gap: 14px; align-items: center;
}

/* ------------------------------------------------------------- pair cards */
.pairs-grid { display: flex; flex-direction: column; gap: 16px; }
.pair-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; }
.pair-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.pair-card-head h2 { font-size: 15px; margin: 0; }
.ha-mode-tag {
  font-family: var(--mono); font-size: 11px; color: var(--blue); background: rgba(91,141,239,.12);
  border: 1px solid rgba(91,141,239,.3); padding: 2px 8px; border-radius: 20px;
}
.pair-card-actions { margin-left: auto; display: flex; gap: 12px; font-size: 12.5px; }

.unit-row {
  display: grid;
  grid-template-columns: 90px 190px 90px 70px 70px 110px 64px;
  align-items: center; gap: 10px;
  padding: 9px 4px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 13px;
}
.unit-row:first-of-type { border-top: none; }
.unit-label { font-family: var(--sans); font-weight: 600; font-size: 13.5px; }
.unit-ip { color: var(--text-dim); font-size: 12px; }
.unit-role { color: var(--text-dim); text-transform: capitalize; }
.metric-label { color: var(--text-dim); font-size: 10px; display: block; letter-spacing: .06em; }
.unit-status-tag { text-align: right; font-weight: 700; letter-spacing: .04em; }
.is-up .unit-status-tag { color: var(--teal); }
.is-down .unit-status-tag { color: var(--red); }
.is-unknown .unit-status-tag { color: var(--text-dim); }

.unit-pulse { width: 90px; height: 24px; }
.pulse-svg { width: 100%; height: 100%; }
.pulse-svg path {
  fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.pulse-alive path {
  stroke: var(--teal);
  stroke-dasharray: 6 4;
  animation: pulse-move 1.1s linear infinite;
  filter: drop-shadow(0 0 3px rgba(53,209,166,.7));
}
.pulse-dead path {
  stroke: var(--red);
  opacity: .55;
}
@keyframes pulse-move { to { stroke-dashoffset: -20; } }
@media (prefers-reduced-motion: reduce) {
  .pulse-alive path { animation: none; }
}

.pair-card-foot { margin-top: 10px; font-size: 11.5px; color: var(--text-dim); }
.err-note { color: var(--red); }

.unit-subrow {
  display: flex; gap: 22px; padding: 0 4px 10px; margin-top: -4px;
  font-family: var(--mono); font-size: 11.5px; color: var(--text-dim);
  flex-wrap: wrap;
}
.ha-member {
  display: flex; align-items: center; gap: 10px; padding: 3px 10px;
  border-radius: 6px; border: 1px solid var(--line);
}
.ha-member-active { border-color: rgba(53,209,166,.35); background: rgba(53,209,166,.06); }
.ha-member-label { font-family: var(--sans); font-weight: 600; color: var(--text); font-size: 11.5px; }
.ha-member-active .ha-member-label { color: var(--teal); }
.unit-subitem .metric-label { display: inline; margin-right: 5px; }
.wan-subitem.wan-up { color: var(--teal); }
.wan-subitem.wan-down { color: var(--red); font-weight: 600; }
.hw-subitem.hw-ok { color: var(--teal); }
.hw-subitem.hw-alarm { color: var(--red); font-weight: 600; cursor: help; }

.pair-alert {
  font-size: 12.5px; font-weight: 600; padding: 8px 12px; border-radius: 6px; margin-bottom: 10px;
}
.pair-alert-critical {
  background: rgba(239,90,111,.14); color: var(--red); border: 1px solid rgba(239,90,111,.4);
}

/* --------------------------------------------------------------- events */
.event-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 10px; }
.event-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-dim); border-bottom: 1px solid var(--line); padding: 8px 10px;
}
.event-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.event-tag { font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 20px; text-transform: capitalize; }
.event-tag-critical { background: rgba(239,90,111,.14); color: var(--red); border: 1px solid rgba(239,90,111,.35); }
.event-tag-warning { background: rgba(242,173,78,.14); color: var(--amber); border: 1px solid rgba(242,173,78,.35); }
.event-tag-good { background: rgba(53,209,166,.14); color: var(--teal); border: 1px solid rgba(53,209,166,.35); }

/* ------------------------------------------------------------ recipients */
.mono-cell { font-family: var(--mono); font-size: 12.5px; color: var(--text-dim); }
.inline-form { display: inline; }
.row-actions { display: flex; gap: 12px; font-size: 12.5px; }
.status-toggle {
  font-family: var(--sans); font-size: 12px; font-weight: 600; border-radius: 20px;
  padding: 4px 12px; cursor: pointer; border: 1px solid transparent; background: none;
}
.status-toggle.is-on { color: var(--teal); background: rgba(53,209,166,.12); border-color: rgba(53,209,166,.3); }
.status-toggle.is-off { color: var(--text-dim); background: var(--panel-2); border-color: var(--line); }
.status-toggle:hover { filter: brightness(1.15); }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; padding: 14px 18px; }
  .side nav { flex-direction: row; }
  .side-footer { display: none; }
  .content { padding: 20px; }
  .unit-row { grid-template-columns: 60px 1fr 60px; row-gap: 4px; }
  .unit-role, .unit-metric.unit-uptime { display: none; }
}

/* Devices list (vendor-neutral asset view) */
.asset-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}
.asset-table th, .asset-table td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}
.asset-table th {
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}
.asset-table tr:last-child td { border-bottom: none; }
.component-chip {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 2px 10px;
  margin: 2px 4px 2px 0;
  font-family: var(--mono);
  font-size: 0.78rem;
}
.btn-link-danger {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  padding: 0;
  font: inherit;
  text-decoration: underline;
  margin-left: 8px;
}
