:root {
  --bg: #05070f;
  --panel: #121522;
  --panel-hover: #181c2e;
  --border: #1f2333;
  --text: #e6e9f2;
  --muted: #9aa3c7;

  --green: #22c55e;
  --green-soft: #0b3d21;

  --red: #ef4444;
  --red-soft: #3f0b0b;

  --yellow: #f59e0b;

  --accent: #00ff88;

  --brand-gold: #fee57f;
  --brand-orange: #f9a84b;
  --brand-burnt: #f56d17;
}

/* GLOBAL */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 20px;
  font-family: system-ui;
  background: var(--bg);
  background-image: url('/img/bg.png');
  background-size: cover;
  background-position: center top;
  background-attachment: fixed;
  background-repeat: no-repeat;
  color: var(--text);
  min-height: 100vh;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 15, 0.75);
  z-index: 0;
  pointer-events: none;
}

.page-shell {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: auto;
}

/* LOGO */

.page-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 12px;
}

/* LAYOUT */

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.page-header h1 {
  display: inline;
  vertical-align: middle;
  background: linear-gradient(135deg, var(--brand-gold), var(--brand-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.page-last-checked {
  color: var(--muted);
  font-size: 13px;
}

/* GLOBAL STATUS */

.global-status-banner {
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 18px;
  border: 1px solid var(--border);
  transition: background 0.3s, border-color 0.3s;
}

.global-status-banner h2 { margin: 0 0 4px; color: var(--text); -webkit-text-fill-color: var(--text); background: none; }
.global-status-banner p { margin: 0; color: var(--muted); }

.global-status-banner.up {
  background: var(--green-soft);
  border-color: var(--green);
}

.global-status-banner.down {
  background: var(--red-soft);
  border-color: var(--red);
}

.global-status-banner.neutral {
  background: #1a1222;
  border-color: #444;
}

/* FORM */

.monitor-form-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
}

.monitor-form-card h2 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--brand-orange);
}

.monitor-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
}

.monitor-form-card input {
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: white;
  font-size: 14px;
  transition: border-color 0.2s;
}

.monitor-form-card input:focus {
  outline: none;
  border-color: var(--brand-orange);
}

/* Selects inside a form card (e.g. Team → invite role) — match the themed inputs; color-scheme
   keeps the native option dropdown dark instead of the browser's default light background. */
.monitor-form-card select {
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: white;
  font-size: 14px;
  color-scheme: dark;
  transition: border-color 0.2s;
}

.monitor-form-card select:focus {
  outline: none;
  border-color: var(--brand-orange);
}

.monitor-form-card button {
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-burnt));
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  padding: 10px 18px;
  color: #000;
  font-size: 14px;
  transition: opacity 0.2s;
}

.monitor-form-card button:hover {
  opacity: 0.85;
}

.form-status {
  margin-top: 10px;
  font-size: 13px;
}

.form-status.success { color: var(--green); }
.form-status.error { color: var(--red); }
.form-status.pending { color: var(--brand-orange); }

.form-row {
  display: flex;
  gap: 10px;
  grid-column: 1 / -1;
}
.form-row input { flex: 1; }
.form-row select {
  min-width: 160px;
  padding: 10px 12px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}

#monitor-config-fields {
  grid-column: 1 / -1;
}

.config-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.config-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.config-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.config-fields input, .config-fields select, .config-fields textarea {
  padding: 8px 10px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
}
.config-fields input:focus, .config-fields select:focus, .config-fields textarea:focus {
  outline: none;
  border-color: var(--brand-orange);
}
.config-fields textarea { resize: vertical; min-height: 60px; }

.config-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.config-checkbox input[type="checkbox"] {
  width: 16px; height: 16px;
  accent-color: var(--brand-orange);
}

.config-note {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  padding: 6px 0;
}

.type-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(249,168,75,0.15);
  color: var(--brand-orange);
  vertical-align: middle;
  margin-left: 6px;
}

.assertion-list { display: flex; flex-direction: column; gap: 6px; }
.assertion-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.assertion-row input { flex: 1; }
.assertion-row select { min-width: 100px; }

.btn-small {
  padding: 4px 10px;
  font-size: 12px;
  background: rgba(249,168,75,0.2);
  color: var(--brand-orange);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
}
.btn-small:hover { background: rgba(249,168,75,0.3); }
.btn-small.btn-danger {
  background: rgba(239,68,68,0.2);
  color: var(--red);
}
.btn-small.btn-danger:hover { background: rgba(239,68,68,0.3); }

/* GROUPS */

.monitor-group-section {
  margin-top: 24px;
}

.monitor-group-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.monitor-group-header h2 {
  margin: 0;
  font-size: 15px;
  color: var(--brand-orange);
  font-weight: 600;
}

.monitor-group-header span {
  color: var(--muted);
  font-size: 12px;
}

/* GRID */

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}

/* CARD */

.monitor-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  animation: cardFadeIn 0.3s ease-out;
  overflow: hidden;
}

.clickable-card { cursor: pointer; }

.monitor-card:hover {
  border-color: rgba(249, 168, 75, 0.3);
  box-shadow: 0 2px 16px rgba(249, 168, 75, 0.06);
}

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.monitor-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.monitor-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 2px;
}

.monitor-url {
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
  line-height: 1.4;
}

/* ACTIONS */

.monitor-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}

.card-action-btn {
  border-radius: 6px;
  font-size: 11px;
  padding: 5px 10px;
  cursor: pointer;
  transition: opacity 0.15s;
  font-weight: 500;
}

.card-action-btn.secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--muted);
}

.card-action-btn.secondary:hover {
  color: var(--text);
  border-color: var(--brand-orange);
}

.card-action-btn.danger {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red);
}

.card-action-btn.danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* INLINE CARD EDIT (rename / URL without opening the detail view) */
.inline-edit {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.inline-edit-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 9px;
  font-size: 13px;
  font-family: inherit;
  width: 100%;
  box-sizing: border-box;
}
.inline-edit-input:focus {
  outline: none;
  border-color: var(--brand-orange);
}
.inline-edit-actions {
  display: flex;
  gap: 6px;
}

/* STATUS BADGE */

.status-pill {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.status-pill.up {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill.down {
  background: var(--red-soft);
  color: var(--red);
}

.status-pill.slow {
  background: #3d2f0b;
  color: var(--yellow);
}

.status-pill.unknown {
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
}

.status-pill.paused {
  background: rgba(154, 163, 199, 0.12);
  color: var(--muted);
}

.monitor-card.paused { opacity: 0.6; }
.monitor-card.paused:hover { opacity: 0.85; }

/* tags (Phase A4) */
.tag-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.tag-chip {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(249, 168, 75, 0.1);
  color: var(--brand-orange);
  border: 1px solid rgba(249, 168, 75, 0.25);
}

/* toolbar search (Phase A4) */
.toolbar-search-group { flex: 1 1 200px; min-width: 160px; }
.toolbar-search {
  width: 100%;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 13px;
}
.toolbar-search:focus { outline: none; border-color: var(--brand-orange); }
.toolbar-search::placeholder { color: var(--muted); }

/* ── INCIDENTS FEED (Phase B1) ── */
.incidents-filterbar { display: flex; gap: 8px; margin-bottom: 16px; }
.incidents-filter-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.incidents-filter-btn:hover { color: var(--text); }
.incidents-filter-btn.active { color: var(--brand-orange); border-color: var(--brand-orange); background: rgba(249, 168, 75, 0.12); }

.incidents-feed { display: flex; flex-direction: column; gap: 2px; background: rgba(0, 0, 0, 0.2); border-radius: 10px; overflow: hidden; }
.incident-feed-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel); }
.incident-feed-row.open { background: rgba(239, 68, 68, 0.06); }
.incident-feed-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.incident-feed-dot.resolved { background: var(--green); }
.incident-feed-dot.open { background: var(--red); }
.incident-feed-main { flex: 1; min-width: 0; }
.incident-feed-monitor { font-weight: 600; font-size: 14px; color: var(--text); text-decoration: none; }
.incident-feed-monitor:hover { color: var(--brand-orange); }
.incident-feed-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.incident-feed-status { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.incident-feed-status.resolved { color: var(--green); }
.incident-feed-status.open { color: var(--red); }
.incident-feed-dur { font-size: 12px; color: var(--muted); min-width: 72px; text-align: right; }

@media (max-width: 600px) {
  .incident-feed-row { flex-wrap: wrap; gap: 6px 10px; }
  .incident-feed-dur { text-align: left; }
}

/* ── MAINTENANCE (Phase B2) ── */
.maint-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.maint-form-grid > #maint-name { grid-column: 1 / -1; }
.maint-field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; }
.maint-form-grid input, .maint-form-grid select {
  padding: 9px 12px; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 14px; font-family: inherit;
}
.maint-form-grid input:focus, .maint-form-grid select:focus { outline: none; border-color: var(--brand-orange); }
.maint-form-grid .detail-save-btn { grid-column: 1 / -1; width: auto; }
.maint-list-wrap { margin-top: 18px; }
.maint-list { display: flex; flex-direction: column; gap: 8px; }
.maint-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.maint-row.active { border-color: var(--yellow); }
.maint-row-main { flex: 1; min-width: 0; }
.maint-row-name { font-weight: 600; font-size: 14px; }
.maint-row-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Next-maintenance banner on the monitor detail view */
.detail-maint-banner {
  background: #3d2f0b; border: 1px solid var(--yellow); color: var(--yellow);
  border-radius: 10px; padding: 10px 16px; margin-bottom: 16px; font-size: 13px; font-weight: 500;
}

/* ── ALERT CONTACTS (Phase C1) ── */
.contact-form-grid { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 10px; align-items: center; }
.contact-form-grid input, .contact-form-grid select {
  padding: 9px 12px; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-size: 14px; font-family: inherit;
}
.contact-form-grid input:focus, .contact-form-grid select:focus { outline: none; border-color: var(--brand-orange); }
.contact-form-grid .detail-save-btn { width: auto; }
.contact-list-wrap { margin-top: 18px; }
.contact-list { display: flex; flex-direction: column; gap: 8px; }
.contact-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 10px; }
.contact-main { flex: 1; min-width: 0; }
.contact-name { font-weight: 600; font-size: 14px; }
.contact-target { font-size: 12px; color: var(--muted); word-break: break-all; }

/* "To be notified" on the monitor detail view */
.detail-contacts .detail-contacts-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 12px; }
.detail-contact-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.detail-contact-row input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--brand-orange); flex-shrink: 0; }
.detail-contacts .detail-save-btn { width: auto; }

@media (max-width: 600px) { .contact-form-grid { grid-template-columns: 1fr; } }

/* ── STATUS PAGES MANAGER (Phase C2) ── */
.sp-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sp-form-grid > #sp-desc, .sp-form-grid > .detail-save-btn { grid-column: 1 / -1; }
.sp-form-grid input { padding: 9px 12px; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 14px; }
.sp-form-grid input:focus { outline: none; border-color: var(--brand-orange); }
.sp-form-grid .detail-save-btn { width: auto; justify-self: start; }
.sp-list-wrap { margin-top: 18px; display: flex; flex-direction: column; gap: 14px; }
.sp-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.sp-card-actions { display: flex; gap: 8px; align-items: center; }
.sp-members { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.detail-appears-list { display: flex; flex-wrap: wrap; gap: 6px; }
a.tag-chip { text-decoration: none; }
@media (max-width: 600px) { .sp-form-grid { grid-template-columns: 1fr; } }

/* ── MULTI-RANGE UPTIME + RESPONSE STATS (Phase D1/D2) ── */
.uptime-ranges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2px; background: rgba(0, 0, 0, 0.2); border-radius: 10px; overflow: hidden; margin-bottom: 12px; }
.uptime-range-tile { padding: 12px 14px; background: var(--panel); display: flex; flex-direction: column; gap: 3px; }
.uptime-range-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 500; }
.uptime-range-pct { font-size: 18px; font-weight: 700; color: var(--text); }
.uptime-range-sub { font-size: 11px; color: var(--muted); }
.uptime-custom { margin-top: 6px; }
.uptime-custom-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; }
.uptime-custom-row input { padding: 7px 10px; background: rgba(0, 0, 0, 0.4); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 13px; }
.uptime-custom-result { font-size: 13px; color: var(--text); min-height: 18px; }
.detail-section-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.detail-region { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.detail-response-stats { display: flex; gap: 18px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.detail-response-stats strong { color: var(--text); }
@media (max-width: 700px) { .uptime-ranges { grid-template-columns: repeat(2, 1fr); } }

/* ── DOMAIN & SSL (Phase D3) ── */
.domssl-list { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.domssl-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.domssl-label { color: var(--muted); }
.domssl-val { color: var(--text); text-align: right; word-break: break-word; }
.domssl-val.muted { color: var(--muted); }

/* META GRID */

.monitor-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  margin-top: 0;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  overflow: hidden;
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: rgba(18, 21, 34, 0.6);
}

.meta-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
}

.meta-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

/* SECTION LABELS */

.section-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 8px;
  font-weight: 500;
}

.monitor-section {
  margin-top: 14px;
}

/* HISTORY BARS */

.history-bars {
  display: flex;
  gap: 3px;
  align-items: flex-end;
}

.history-bar {
  flex: 1;
  min-width: 4px;
  max-width: 8px;
  height: 28px;
  border-radius: 3px;
  transition: opacity 0.15s;
  cursor: default;
}

.history-bar:hover {
  opacity: 0.7;
}

.history-bar.up { background: var(--green); }
.history-bar.down { background: var(--red); }
.history-bar.slow { background: var(--yellow); }

.history-empty {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  padding: 4px 0;
}

/* INCIDENTS */

.incidents-section {
  margin-top: 14px;
}

.incident-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.incident-item {
  font-size: 12px;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.incident-item strong {
  color: var(--text);
  font-weight: 500;
}

/* HISTORY MODAL */

.history-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999;
  animation: modalFadeIn 0.2s ease-out;
}

.history-modal.hidden {
  display: none;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.history-modal-backdrop {
  position: absolute;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

.history-modal-panel {
  position: relative;
  max-width: 700px;
  margin: 60px auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  z-index: 1000;
  max-height: 80vh;
  overflow-y: auto;
  animation: modalSlideIn 0.25s ease-out;
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

.history-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.history-modal-header h2 {
  margin: 0;
  color: var(--brand-orange);
}

.history-modal-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.history-close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  transition: color 0.15s;
}

.history-close-btn:hover { color: var(--text); }

.history-modal-sections h3 {
  font-size: 13px;
  color: var(--brand-orange);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 20px 0 10px;
}

.history-log-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.history-log-item {
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
}

.history-log-line {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.history-log-status {
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
}

.history-log-status.up { color: var(--green); }
.history-log-status.down { color: var(--red); }

.muted { color: var(--muted); font-size: 12px; }

/* TOOLBAR */

.toolbar {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.toolbar-label {
  font-size: 10px;
  color: var(--brand-orange);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

.toolbar select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.toolbar select:focus {
  outline: none;
  border-color: var(--brand-orange);
}

.layout-toggle {
  display: flex;
  gap: 2px;
}

.layout-btn {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 14px;
  border-radius: 4px;
  transition: all 0.15s;
}

.layout-btn.active {
  background: rgba(249, 168, 75, 0.15);
  border-color: var(--brand-orange);
  color: var(--brand-orange);
}

/* LIST LAYOUT */

.status-grid.list-layout {
  grid-template-columns: 1fr;
}

.list-layout .monitor-card {
  display: block;
}

.list-layout .monitor-card-header {
  flex-wrap: wrap;
}

.list-layout .monitor-meta-grid {
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
}

.list-layout .resize-handle {
  display: none;
}

/* CARD DRAG */

.monitor-card.dragging {
  opacity: 0.4;
  border-style: dashed;
  border-color: var(--brand-orange);
}

.monitor-card.drag-over {
  border-color: var(--brand-orange);
  box-shadow: 0 0 16px rgba(249, 168, 75, 0.15);
}

/* CARD RESIZE */

.monitor-card .resize-handle {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  opacity: 0;
  transition: opacity 0.2s;
}

.monitor-card .resize-handle::after {
  content: '';
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
}

.monitor-card:hover .resize-handle { opacity: 0.5; }
.monitor-card .resize-handle:hover { opacity: 1; }

/* EMPTY STATE */

.empty-state-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 48px 32px;
  text-align: center;
}

.empty-state-card h3 { color: var(--brand-orange); margin: 0 0 8px; }
.empty-state-card p { color: var(--muted); margin: 0; }

/* LOADING SKELETON */

.skeleton {
  animation: shimmer 1.5s infinite;
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-hover) 50%, var(--panel) 75%);
  background-size: 200% 100%;
  border-radius: 8px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  height: 280px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.skeleton-banner-overlay {
  position: relative;
}

/* CHARTS */

.chart-empty {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  padding: 4px 0;
  display: block;
}

/* Sparkline */

.chart-sparkline-wrap {
  position: relative;
}

.chart-sparkline {
  width: 100%;
  height: 48px;
  display: block;
}

.chart-sparkline-stats {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.chart-sparkline-stats strong {
  color: var(--text);
  font-weight: 600;
}

.chart-tooltip {
  position: absolute;
  top: -4px;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--brand-orange);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  color: var(--brand-orange);
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10;
}

/* Uptime Bars */

.chart-uptime-bars {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 40px;
}

.chart-uptime-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  cursor: default;
}

.chart-uptime-bar {
  width: 100%;
  min-width: 4px;
  border-radius: 2px 2px 0 0;
  transition: opacity 0.15s;
}

.chart-uptime-col:hover .chart-uptime-bar {
  opacity: 0.7;
}

.chart-uptime-label {
  font-size: 8px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
}

/* Incident Timeline */

.chart-timeline-track {
  position: relative;
  height: 16px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  overflow: hidden;
}

.chart-timeline-bar {
  position: absolute;
  top: 2px;
  height: 12px;
  background: var(--red);
  border-radius: 3px;
  opacity: 0.8;
  cursor: default;
  transition: opacity 0.15s;
}

.chart-timeline-bar:hover {
  opacity: 1;
}

.chart-timeline-bar.ongoing {
  background: repeating-linear-gradient(
    -45deg,
    var(--red),
    var(--red) 3px,
    rgba(239, 68, 68, 0.4) 3px,
    rgba(239, 68, 68, 0.4) 6px
  );
}

.chart-timeline-axis {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: var(--muted);
  margin-top: 2px;
}

.skeleton-banner-overlay > * {
  visibility: hidden;
}

/* TOAST */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  pointer-events: auto;
  animation: toastIn 0.3s ease-out;
  max-width: 360px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}

.toast.hiding {
  animation: toastOut 0.25s ease-in forwards;
}

.toast-success {
  background: var(--green-soft);
  border: 1px solid var(--green);
  color: var(--green);
}

.toast-error {
  background: var(--red-soft);
  border: 1px solid var(--red);
  color: var(--red);
}

.toast-info {
  background: rgba(249, 168, 75, 0.1);
  border: 1px solid var(--brand-orange);
  color: var(--brand-orange);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(40px); }
}

/* DETAIL VIEW */

.detail-view {
  animation: cardFadeIn 0.3s ease-out;
}

.detail-back-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 16px;
  transition: color 0.15s, border-color 0.15s;
}

.detail-back-btn:hover {
  color: var(--brand-orange);
  border-color: var(--brand-orange);
}

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.detail-title {
  margin: 0;
  font-size: 24px;
  color: var(--text);
}

.detail-url {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}

.detail-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 24px;
}

.detail-stat-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--panel);
}

.detail-stat-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
}

.detail-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.detail-chart-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.detail-chart-section .chart-sparkline {
  height: 64px;
}

.detail-bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}

/* Incident Log Panel */

.detail-incident-log {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  max-height: 420px;
  overflow-y: auto;
}

.detail-panel-title {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--brand-orange);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}

.detail-incident-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-incident-item {
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
}

.detail-incident-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.detail-incident-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.detail-incident-dot.resolved { background: var(--green); }
.detail-incident-dot.open { background: var(--red); }

.detail-incident-time {
  color: var(--text);
  font-weight: 500;
}

.detail-incident-dur {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.detail-incident-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  padding-left: 16px;
}

/* Config Panel */

.detail-config-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
}

.detail-config-label {
  display: block;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
  margin-bottom: 4px;
}

.detail-config-input {
  width: 100%;
  padding: 9px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}

.detail-config-input:focus {
  outline: none;
  border-color: var(--brand-orange);
}

.detail-config-type {
  font-size: 13px;
  color: var(--brand-orange);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 12px;
}

.detail-heartbeat-info {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
  margin-bottom: 12px;
}

.detail-heartbeat-url {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.detail-heartbeat-url code {
  flex: 1;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  color: var(--brand-gold);
  word-break: break-all;
}

.detail-heartbeat-last-ping {
  font-size: 13px;
  color: var(--text);
  margin-bottom: 12px;
}

.detail-config-type-fields {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: 4px;
  margin-bottom: 12px;
}

.detail-config-type-fields .config-fields {
  margin-top: 8px;
}

.detail-config-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.detail-save-btn {
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-burnt));
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  padding: 10px 20px;
  color: #000;
  font-size: 14px;
  width: 100%;
  transition: opacity 0.2s;
}

.detail-save-btn:hover {
  opacity: 0.85;
}

.detail-config-status {
  margin-top: 8px;
  font-size: 13px;
}

.detail-config-status.pending { color: var(--brand-orange); }
.detail-config-status.error { color: var(--red); }

.detail-loading {
  border: 1px solid var(--border);
}

/* RESPONSIVE */

@media (max-width: 700px) {
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .toolbar-group {
    justify-content: space-between;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }

  .monitor-form-grid {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    gap: 8px;
  }

  .list-layout .monitor-meta-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .monitor-meta-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }

  .toast { max-width: 100%; }

  .detail-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .detail-bottom-grid {
    grid-template-columns: 1fr;
  }

  .detail-stat-value {
    font-size: 15px;
  }
}

/* ── SERVICE GROUPS (Phase 2) ── */

.groups-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.group-actionbar {
  display: flex;
  justify-content: flex-end;
}

.group-new-btn {
  width: auto;
  padding: 8px 16px;
  font-size: 13px;
}

.group-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.group-section:hover { border-color: #2a2f45; }

.group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  border-left: 3px solid var(--group-color, var(--brand-orange));
  background: rgba(255, 255, 255, 0.015);
  flex-wrap: wrap;
}

.group-collapse-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 4px;
}
.group-collapse-btn:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }

.group-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--group-color, var(--brand-orange));
  flex-shrink: 0;
}

.group-name { font-weight: 700; font-size: 15px; color: var(--text); }

.group-tally { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.group-tally .tally {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.group-tally .tally.up { color: var(--green); background: rgba(34, 197, 94, 0.12); border-color: rgba(34, 197, 94, 0.3); }
.group-tally .tally.slow { color: var(--yellow); background: rgba(245, 158, 11, 0.12); border-color: rgba(245, 158, 11, 0.3); }
.group-tally .tally.down { color: var(--red); background: rgba(239, 68, 68, 0.12); border-color: rgba(239, 68, 68, 0.3); }
.group-tally .tally.unknown { color: var(--muted); background: rgba(154, 163, 199, 0.1); border-color: rgba(154, 163, 199, 0.25); }

.group-meta { font-size: 12px; color: var(--muted); }

.group-header-spacer { flex: 1 1 auto; }

.group-open-btn { white-space: nowrap; }

.group-body {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border);
}

.group-section.collapsed .group-body { display: none; }

/* Collapsible Monitor Configuration section (detail view, Phase 4) — relocated to the top. */
.detail-config-head { cursor: pointer; justify-content: flex-start; }
.detail-config-section.collapsed .detail-config-body { display: none; }

/* Account → "Last checked" timezone preference row (Phase 4) */
.account-pref-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 14px; }
.account-pref-row .toolbar-label { margin: 0; }

/* Incident notes (Phase 5) — authed incidents feed + detail incident log */
.incident-notes { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.incident-note { display: flex; gap: 6px; align-items: flex-start; font-size: 12px; color: var(--text); line-height: 1.4; }
.incident-note-tag { flex-shrink: 0; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; padding: 1px 6px; border-radius: 999px; }
.incident-note.public .incident-note-tag { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
.incident-note.internal .incident-note-tag { background: rgba(255, 255, 255, 0.08); color: var(--muted); }
.incident-notes-form textarea { width: 100%; resize: vertical; margin-bottom: 6px; }

/* Public status page — published incident updates (Phase 5) */
.status-incidents .status-incident-item { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; margin-bottom: 10px; }
.status-incident-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.status-incident-monitor { font-weight: 600; font-size: 14px; }
.status-incident-time { color: var(--muted); font-size: 12px; }
.status-incident-note { font-size: 13px; color: var(--text); line-height: 1.5; white-space: pre-wrap; }

/* Alert-contact channel config fields (Phase 6) */
.contact-config-fields { display: flex; flex-direction: column; gap: 2px; }
.contact-config-fields:not(:empty) { margin-top: 8px; }
.contact-cfg-input { width: 100%; margin-bottom: 8px; }

/* Custom domains on status pages (Phase 2) */
.sp-cd-row { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 8px; }
.sp-cd-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sp-cd-detail { margin-top: 8px; }
.sp-cd-rec { font-size: 12px; margin: 3px 0; word-break: break-all; }
.sp-cd-rec code { background: rgba(255, 255, 255, 0.06); padding: 1px 5px; border-radius: 4px; }

.group-empty {
  color: var(--muted);
  font-size: 13px;
  padding: 10px 2px;
  grid-column: 1 / -1;
}

/* per-card group assignment select */
.monitor-assign {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 11px;
  padding: 4px 6px;
  max-width: 132px;
  cursor: pointer;
}
.monitor-assign:focus { outline: none; border-color: var(--brand-orange); }

/* ── Group modal ── */
.bb-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 12, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(2px);
  animation: modalFadeIn 0.2s ease-out;
}

.bb-modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.25s ease-out;
}

.bb-modal-title { margin: 0 0 16px; font-size: 17px; color: var(--brand-orange); }

.bb-modal-body { display: flex; flex-direction: column; gap: 6px; }
.bb-modal-body .config-label { margin-top: 8px; }

.bb-modal-input {
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 14px;
}
.bb-modal-input:focus { outline: none; border-color: var(--brand-orange); }

.bb-color-swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.bb-color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
  transition: transform 0.1s;
}
.bb-color-swatch:hover { transform: scale(1.12); }
.bb-color-swatch.active { border-color: var(--text); transform: scale(1.12); }

.bb-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}
.bb-modal-actions .detail-save-btn { width: auto; padding: 9px 18px; }

/* ── SERVICE GROUPS — Phase 2b (drag-reorder, bulk-assign) ── */

.group-drag-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 15px;
  line-height: 1;
  padding: 0 2px;
  user-select: none;
}
.group-drag-handle:hover { color: var(--text); }
.group-drag-handle:active { cursor: grabbing; }

.group-section.group-dragging { opacity: 0.5; }

.group-section.group-drop-target {
  outline: 2px dashed var(--brand-orange);
  outline-offset: -2px;
}

.group-section.group-reorder-target {
  border-color: var(--brand-orange);
  box-shadow: 0 0 0 2px rgba(249, 168, 75, 0.25);
}

.monitor-select-checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--brand-orange);
  cursor: pointer;
  margin-right: 2px;
}

.monitor-card.selected {
  border-color: var(--brand-orange);
  box-shadow: inset 0 0 0 1px var(--brand-orange);
}

.bulk-bar {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(249, 168, 75, 0.08);
  border: 1px solid var(--brand-orange);
  border-radius: 8px;
  margin-right: auto;
}

.bulk-count { font-size: 12px; font-weight: 600; color: var(--brand-orange); white-space: nowrap; }

.bulk-group-select {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 12px;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
}
.bulk-group-select:focus { outline: none; border-color: var(--brand-orange); }

/* ── GROUP DETAIL VIEW (Phase 3) ── */

.group-detail-view .detail-title .group-color-dot {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}

.member-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.member-row {
  display: grid;
  grid-template-columns: 96px minmax(120px, 1.4fr) minmax(120px, 2fr) 84px 84px 56px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
}
.member-row:hover { background: rgba(249, 168, 75, 0.08); }

.member-name { font-weight: 600; font-size: 14px; }
.member-url { font-size: 12px; color: var(--muted); word-break: break-all; }
.member-stat { font-size: 13px; font-weight: 600; text-align: right; }
.member-open { font-size: 12px; color: var(--brand-orange); text-align: right; white-space: nowrap; }

.member-chart-block {
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.member-chart-block:first-of-type { border-top: none; padding-top: 4px; }
.member-chart-title { font-size: 13px; font-weight: 600; margin-bottom: 8px; }

@media (max-width: 700px) {
  .member-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
  }
  .member-url { width: 100%; }
  .member-stat, .member-open { text-align: left; }
}

/* ── MODERNIZATION (Phase 5) ── */

/* sticky toolbar so sort/filter/group controls stay reachable while scrolling */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 10;
}

/* degraded (slow, but nothing down) global banner */
.global-status-banner.degraded {
  background: #3d2f0b;
  border-color: var(--yellow);
}

/* keyboard focus visibility (a11y) */
a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible,
.bb-color-swatch:focus-visible {
  outline: 2px solid var(--brand-orange);
  outline-offset: 2px;
}
.monitor-card:focus-visible,
.member-row:focus-visible,
.group-header:focus-visible {
  outline: 2px solid var(--brand-orange);
  outline-offset: -2px;
}

/* ── APP SHELL / LEFT-NAV IA (Phase A) ── */

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto;
  align-items: flex-start;
}

.app-sidebar {
  position: sticky;
  top: 20px;
  flex: 0 0 220px;
  width: 220px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: calc(100vh - 40px);
}

.app-main {
  flex: 1 1 auto;
  min-width: 0; /* let the card grid shrink instead of overflowing the flex row */
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  padding: 4px 8px;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: cover;
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-weight: 700;
  font-size: 15px;
  background: linear-gradient(135deg, var(--brand-gold), var(--brand-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover { background: var(--panel-hover); color: var(--text); }

.nav-item.active {
  background: rgba(249, 168, 75, 0.12);
  color: var(--brand-orange);
}

.nav-ico { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 8px 4px;
  border-top: 1px solid var(--border);
}

.sidebar-lock { font-size: 12px; color: var(--muted); text-decoration: none; }
.sidebar-lock.unlocked { color: var(--green); }
.sidebar-statuslink { font-size: 12px; color: var(--muted); text-decoration: none; }
.sidebar-statuslink:hover { color: var(--brand-orange); }
.sidebar-version { font-size: 11px; color: var(--muted); opacity: 0.7; }

/* section visibility is driven by the [hidden] attribute from the router */
.app-section[hidden] { display: none; }

.page-subtitle { color: var(--muted); font-size: 13px; margin: 4px 0 0; }

/* Monitoring "＋ New monitor" action bar */
.monitoring-actionbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 14px;
}

/* Bulk CSV import (Phase D4) */
#bulk-csv {
  width: 100%;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
  margin-bottom: 10px;
}
#bulk-csv:focus { outline: none; border-color: var(--brand-orange); }

.primary-btn {
  background: linear-gradient(135deg, var(--brand-orange), var(--brand-burnt));
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  padding: 9px 16px;
  color: #000;
  font-size: 13px;
  transition: opacity 0.2s;
}
.primary-btn:hover { opacity: 0.88; }
.primary-btn.active {
  background: var(--panel-hover);
  color: var(--text);
  border: 1px solid var(--brand-orange);
}

/* stub / settings sections */
.section-stub p { max-width: 64ch; margin: 8px auto 0; line-height: 1.6; }
.section-stub a, .settings-hint a { color: var(--brand-orange); }
.settings-hint { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0 0 10px; }
.settings-about { margin-top: 16px; }

/* Responsive: collapse the sidebar to a top bar on narrow screens */
@media (max-width: 900px) {
  .app-shell { flex-direction: column; gap: 16px; }
  .app-sidebar {
    position: static;
    width: auto;
    flex-basis: auto;
    max-height: none;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
  }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; flex: 1 1 100%; }
  .sidebar-footer {
    margin-top: 0;
    border-top: none;
    flex-direction: row;
    flex: 1 1 100%;
    justify-content: space-between;
    align-items: center;
    padding: 4px 8px;
  }
}

@media (max-width: 560px) {
  .nav-text { display: none; }     /* icon-only nav on very small screens */
  .nav-item { padding: 8px 10px; }
}
