/* SSFS Dashboard — base */
* {
  box-sizing: border-box;
}

:root {
  --background: #0e120e;
  --foreground: #e2f1e2;
  --muted: #8aa78a;
  --surface: #101710;
  --surface-2: #142014;
  --surface-3: #182518;
  --border: #182418;
  --accent: #7fc27f;
  --accent-2: #a7e6a7;
  --danger: #e08585;
  --danger-2: #f3a9a9;
  --warn: #e0c27f;
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-heading: ui-rounded, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-mono: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--foreground);
  background: var(--background);
  font-family: var(--font-body);
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-2);
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  margin: 0;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px;
}

/* Top bar */
.site-header {
  position: fixed;
  width: 100%;
  top: 0;
  left: 0;
  z-index: 20;
  backdrop-filter: saturate(1.2) blur(6px);
  border-bottom: 1px solid var(--border);
  background: rgba(15, 21, 15, 0.9);
  height: 64px;
  display: flex;
  align-items: center;
}

.site-header .inner {
  display: flex;
  align-items: center;
  gap: 16px;
  justify-content: space-between;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--foreground);
}

.logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  font-family: var(--font-heading);
  color: #0e120e;
  background: var(--accent);
  border: 1px solid #2a392a;
  flex-shrink: 0;
}

.brand-name {
  font-weight: 600;
  letter-spacing: 0.01em;
}

.site-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}

.site-nav a {
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 8px;
}

.site-nav a:hover,
.site-nav a[aria-current='page'] {
  color: var(--foreground);
  background: var(--surface-2);
}

.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.85rem;
}

.header-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(127, 194, 127, 0.18);
}

/* Dashboard shell */
main.dashboard {
  padding-top: 96px;
  padding-bottom: 48px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.page-heading {
  margin-bottom: 4px;
}

.page-heading h1 {
  font-size: clamp(1.5rem, 2.6vw, 1.9rem);
  color: var(--accent-2);
  margin-bottom: 6px;
}

.page-heading .lead {
  color: var(--muted);
  margin: 0;
}

/* Panels */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 22px;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.panel-header h2 {
  font-size: 1.05rem;
  color: var(--accent);
  letter-spacing: 0.01em;
}

.panel-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0;
}

.panel-loading,
.empty-state {
  color: var(--muted);
  font-style: italic;
  text-align: center;
  padding: 28px 12px;
  font-size: 0.9rem;
}

/* Checks grid */
.checks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}

.check-card {
  background: var(--surface-2);
  border: 1px solid #223222;
  border-left: 3px solid var(--muted);
  border-radius: 12px;
  padding: 14px 16px;
  position: relative;
}

.check-card.status-ok {
  border-left-color: var(--accent);
}

.check-card.status-fail {
  border-left-color: var(--danger);
}

.check-card h3 {
  font-size: 0.95rem;
  margin: 0 0 4px;
  color: var(--foreground);
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-card h3::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
}

.check-card.status-ok h3::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(127, 194, 127, 0.16);
}

.check-card.status-fail h3::before {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(224, 133, 133, 0.16);
}

.check-card .category {
  display: inline-block;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 8px;
}

.check-card .detail {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  margin: 0;
  word-break: break-word;
}

.check-card.status-fail .detail {
  color: var(--danger-2);
}

/* Events list */
.events-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

.event-row {
  display: grid;
  grid-template-columns: 110px 150px 1fr;
  gap: 12px;
  align-items: center;
  background: var(--surface-2);
  border: 1px solid #223222;
  border-left: 3px solid var(--muted);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.85rem;
}

.event-row[data-severity='warn'] {
  border-left-color: var(--warn);
}

.event-row[data-severity='critical'] {
  border-left-color: var(--danger);
}

.event-row[data-severity='info'] {
  border-left-color: var(--muted);
}

.event-row .kind {
  font-weight: 600;
  text-transform: capitalize;
  color: var(--foreground);
}

.event-row .ip {
  font-family: var(--font-mono);
  color: var(--accent-2);
  font-size: 0.82rem;
}

.event-row .detail {
  color: var(--muted);
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Uptime grid */
.uptime-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.uptime-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid #223222;
  border-radius: 12px;
  padding: 14px 16px;
  position: relative;
}

.uptime-row::before {
  content: '';
  position: absolute;
  top: 16px;
  right: 16px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

.uptime-row[data-up='1']::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(127, 194, 127, 0.16);
}

.uptime-row[data-up='0']::before {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(224, 133, 133, 0.16);
}

.uptime-row .name {
  font-weight: 600;
  padding-right: 20px;
}

.uptime-row .latency {
  font-family: var(--font-mono);
  color: var(--accent-2);
  font-size: 0.78rem;
}

.uptime-row .checked-at {
  color: var(--muted);
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 22px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--foreground);
  transition: all 0.2s ease;
}

.btn:hover {
  background: var(--surface-3);
  transform: translateY(-1px);
}

.btn.primary {
  background: var(--accent);
  color: var(--background);
  border-color: var(--accent);
}

.btn.primary:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.btn.full {
  width: 100%;
}

/* Auth pages */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-shell {
  width: 100%;
  display: flex;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 30px;
  text-align: center;
}

.auth-brand {
  justify-content: center;
  margin-bottom: 18px;
}

.auth-card h1 {
  font-size: 1.4rem;
  color: var(--accent-2);
  margin-bottom: 8px;
}

.auth-card .lead {
  color: var(--muted);
  margin: 0 0 22px;
  font-size: 0.9rem;
}

.form-group {
  text-align: left;
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.form-group input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--foreground);
  font-size: 0.95rem;
}

.form-group input:focus {
  outline: none;
  border-color: var(--accent);
}

.bootstrap-note {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 16px;
}

.status-message {
  color: var(--muted);
  font-size: 0.85rem;
  min-height: 1.2em;
  margin: 16px 0 0;
}

/* Responsive */
@media (max-width: 760px) {
  .container {
    padding: 16px;
  }

  .panel {
    padding: 16px;
  }

  .event-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .site-nav {
    display: none;
  }
}
