/* ── Melix Status — Discord Status / Statuspage style ───────── */
:root {
  --bg: #ffffff;
  --bg-soft: #f7f8fa;
  --panel: #ffffff;
  --line: #e6e8ec;
  --line-strong: #d0d4dc;
  --text: #1a1d26;
  --text-secondary: #5c6370;
  --text-muted: #8b929e;
  --brand: #F72466;
  --brand-soft: rgba(247, 36, 102, 0.08);
  --green: #2ecc71;
  --green-dark: #1f9d55;
  --green-banner: #3ba55c;
  --yellow: #f0b429;
  --orange: #f59e0b;
  --red: #e74c3c;
  --red-dark: #c0392b;
  --blue: #3498db;
  --cyan: #2dd4e8;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --max: 920px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.hidden { display: none !important; }
button, input, select, textarea { font: inherit; }

.wrap {
  width: min(100% - 40px, var(--max));
  margin: 0 auto;
}

/* ── Top bar ────────────────────────────────────────────────── */
.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.02em;
}
.brand:hover { text-decoration: none; }
.brand-mark, .footer-brand svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.brand-muted { color: var(--text-secondary); font-weight: 600; }
.topnav {
  display: flex;
  align-items: center;
  gap: 18px;
}
.topnav a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.topnav a:hover,
.topnav a.active { color: var(--text); }

/* ── Page ───────────────────────────────────────────────────── */
.page {
  padding: 40px 0 72px;
  background: linear-gradient(180deg, #fafbfc 0%, #fff 220px);
  min-height: calc(100vh - 140px);
}

/* ── Status banner ──────────────────────────────────────────── */
.status-banner {
  border-radius: 8px;
  padding: 22px 28px;
  margin-bottom: 36px;
  color: #fff;
  background: var(--green-banner);
  box-shadow: var(--shadow);
  transition: background 0.25s ease;
}
.status-banner.is-operational { background: var(--green-banner); }
.status-banner.is-degraded { background: var(--yellow); color: #1a1d26; }
.status-banner.is-partial_outage { background: var(--orange); }
.status-banner.is-major_outage { background: var(--red); }
.status-banner.is-maintenance { background: var(--cyan); color: #0b2430; }
.status-banner.is-unknown { background: #8b929e; }
.status-banner-inner {
  display: flex;
  align-items: center;
  gap: 14px;
}
.status-banner h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.status-banner-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.25);
  flex-shrink: 0;
}
.status-banner.is-degraded .status-banner-icon,
.status-banner.is-maintenance .status-banner-icon {
  background: rgba(0,0,0,0.55);
  box-shadow: 0 0 0 4px rgba(0,0,0,0.12);
}

/* ── Panels ─────────────────────────────────────────────────── */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 28px;
  overflow: hidden;
}
.panel-head {
  padding: 18px 22px 0;
}
.panel-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.panel-head-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 8px;
}
.panel-meta {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Services list + 90-day bars ─────────────────────────────── */
.services-list { padding: 4px 0 8px; }
.service-row {
  padding: 18px 22px 16px;
  border-top: 1px solid var(--line);
}
.service-row:first-child { border-top: none; }
.service-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.service-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.service-desc {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 2px;
}
.service-status {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.service-status.operational { color: var(--green-dark); }
.service-status.degraded { color: #b8860b; }
.service-status.outage { color: var(--red-dark); }
.service-status.maintenance { color: #0e7490; }

.uptime-bars {
  display: flex;
  gap: 1.5px;
  height: 34px;
  align-items: stretch;
  width: 100%;
}
.uptime-bar {
  flex: 1 1 0;
  min-width: 0;
  border-radius: 1px;
  background: var(--green);
  cursor: default;
  transition: transform 0.08s ease, opacity 0.08s ease;
}
.uptime-bar:hover {
  transform: scaleY(1.12);
  opacity: 0.92;
}
.uptime-bar.operational { background: var(--green); }
.uptime-bar.degraded { background: var(--yellow); }
.uptime-bar.outage { background: var(--red); }
.uptime-bar.maintenance { background: var(--orange); }
.uptime-bar.no_data { background: #d5d9e0; }

.uptime-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
  gap: 10px;
}
.uptime-meta .line {
  flex: 1;
  height: 1px;
  background: var(--line);
  position: relative;
}
.uptime-pct {
  white-space: nowrap;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Tooltip */
.tooltip {
  position: fixed;
  z-index: 100;
  background: #1a1d26;
  color: #fff;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 6px;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  max-width: 220px;
  line-height: 1.4;
  transform: translate(-50%, -110%);
}
.tooltip::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #1a1d26;
  border-bottom: 0;
}

/* ── Incidents ──────────────────────────────────────────────── */
.incident-list { padding: 4px 0 8px; }
.incident-day {
  border-top: 1px solid var(--line);
  padding: 16px 22px 18px;
}
.incident-day:first-child { border-top: none; }
.incident-day-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.incident-card {
  padding: 4px 0 12px;
}
.incident-card + .incident-card {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.incident-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
}
.incident-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.incident-impact {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
  margin-right: 6px;
  background: var(--bg-soft);
  color: var(--text-secondary);
}
.incident-impact.minor { background: #fef3c7; color: #92400e; }
.incident-impact.major { background: #ffedd5; color: #9a3412; }
.incident-impact.critical { background: #fee2e2; color: #991b1b; }
.incident-impact.maintenance { background: #e0f2fe; color: #075985; }
.incident-impact.none { background: #ecfdf5; color: #065f46; }

.incident-updates { margin: 0; padding: 0; list-style: none; }
.incident-update {
  position: relative;
  padding: 0 0 12px 14px;
  border-left: 2px solid var(--line);
  margin-left: 4px;
}
.incident-update:last-child { padding-bottom: 0; }
.incident-update::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-strong);
}
.incident-update.resolved::before,
.incident-update.completed::before { background: var(--green); }
.incident-update.investigating::before,
.incident-update.identified::before,
.incident-update.monitoring::before { background: var(--yellow); }
.incident-update.in_progress::before,
.incident-update.scheduled::before { background: var(--blue); }

.update-status {
  font-size: 12px;
  font-weight: 700;
  text-transform: capitalize;
  color: var(--text);
  margin-right: 6px;
}
.update-time {
  font-size: 12px;
  color: var(--text-muted);
}
.update-message {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.empty-state {
  padding: 22px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}
.no-incidents-day {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 36px;
  background: var(--bg);
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
}
.footer-copy {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}
.footer-links {
  display: flex;
  gap: 16px;
  font-size: 13px;
}
.footer-links a { color: var(--text-secondary); text-decoration: none; }
.footer-links a:hover { color: var(--brand); }

/* ── Admin ──────────────────────────────────────────────────── */
.admin-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
  padding: 24px;
}
.login-card {
  width: min(100%, 400px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
}
.login-card .brand { margin-bottom: 18px; }
.login-card h2 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.login-card .subtitle {
  margin: 0 0 22px;
  color: var(--text-muted);
  font-size: 14px;
}
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.form-error {
  display: none;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: #d91b56; }
.btn-secondary {
  background: #fff;
  border-color: var(--line-strong);
  color: var(--text-secondary);
}
.btn-secondary:hover { background: var(--bg-soft); color: var(--text); }
.btn-danger { background: #fee2e2; color: #991b1b; }
.btn-danger:hover { background: #fecaca; }
.btn-cyan { background: #e0f2fe; color: #075985; }
.btn-cyan:hover { background: #bae6fd; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-full { width: 100%; }

.dashboard-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  height: 60px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 30;
  flex-wrap: wrap;
}
.dashboard-nav-left,
.dashboard-nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.nav-tab {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 6px;
  text-decoration: none;
}
.nav-tab:hover { background: var(--bg-soft); text-decoration: none; color: var(--text); }
.nav-tab.active { background: var(--brand-soft); color: var(--brand); }
.panel-help {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}
.panel-help code {
  font-size: 12px;
  background: var(--bg-soft);
  padding: 1px 6px;
  border-radius: 4px;
}
.hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}
.check-row {
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  font-weight: 500 !important;
  color: var(--text) !important;
  cursor: pointer;
}
.check-row input { width: auto !important; }
.status-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot.lg { width: 14px; height: 14px; }
.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--bg-soft);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 2px 7px;
  vertical-align: middle;
}
.badge-green { background: #dcfce7; color: #166534; }
.row-disabled { opacity: 0.55; }
.key-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.key-row code {
  font-size: 12px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  word-break: break-all;
}
.code-block {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 8px;
  padding: 14px 16px;
  overflow: auto;
}
.code-block .code-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  margin-bottom: 8px;
}
.code-block pre {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.service-status.custom { font-weight: 600; }
.uptime-bar.custom { background: #8b929e; }

.user-info {
  font-size: 13px;
  color: var(--text-muted);
}
.user-info span { color: var(--text); font-weight: 600; }

.dashboard-content {
  width: min(100% - 40px, 1100px);
  margin: 28px auto 48px;
}
.dashboard-section { display: none; }
.dashboard-section.active { display: block; }

.panel-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 22px;
}
.panel-card h3 {
  margin: 0 0 16px;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.panel-card h3 .count {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 14px;
}

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}
.table-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.status-select {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 600;
  background: #fff;
}
.status-select.operational { color: var(--green-dark); }
.status-select.degraded { color: #b8860b; }
.status-select.outage { color: var(--red-dark); }
.status-select.maintenance { color: #0e7490; }

.events-list {
  font-size: 13px;
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}
.event-row {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--text-secondary);
}
.event-row:last-child { border-bottom: none; }
.event-row .ts {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  margin-right: 8px;
  font-size: 12px;
}
.tag-mod { color: var(--brand); font-weight: 600; margin-right: 4px; }
.tag-sys { color: #0e7490; font-weight: 600; margin-right: 4px; }

.toast-container {
  position: fixed;
  top: 76px;
  right: 20px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #1a1d26;
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  min-width: 220px;
}
.toast.error { background: var(--red-dark); }
.toast.success { background: #166534; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 28, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  width: min(100%, 440px);
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.2);
}
.modal h3 {
  margin: 0 0 16px;
  font-size: 18px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.incident-admin-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--bg-soft);
}
.incident-admin-card h4 {
  margin: 0 0 6px;
  font-size: 15px;
}
.incident-admin-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.incident-admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .page { padding-top: 24px; }
  .status-banner { padding: 18px 16px; }
  .status-banner h1 { font-size: 18px; }
  .service-row, .incident-day, .panel-head { padding-left: 14px; padding-right: 14px; }
  .uptime-bars { height: 28px; }
  .panel-head-row { flex-direction: column; align-items: flex-start; }
  .dashboard-nav { height: auto; padding: 12px 16px; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}


