:root {
  --bg: #0f1420;
  --bg-card: #171e2e;
  --border: #263047;
  --text: #e6e9f0;
  --text-muted: #8b93a7;
  --accent: #4f8cff;
  --green: #35c17a;
  --amber: #e0a83e;
  --red: #e0553e;
  --gray: #4a5468;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}
.brand { font-weight: 600; }
.tenant { color: var(--text-muted); font-weight: 400; }
.topbar nav { display: flex; gap: 16px; flex: 1; }
.topbar nav a { color: var(--text-muted); text-decoration: none; padding: 6px 4px; border-bottom: 2px solid transparent; }
.topbar nav a.active, .topbar nav a:hover { color: var(--text); border-bottom-color: var(--accent); }

.link-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0; font: inherit;
}
.link-btn:hover { color: var(--text); }
.link-btn.danger:hover { color: var(--red); }
.link-btn.small { font-size: 0.85em; }

.login-wrap { display: flex; justify-content: center; margin-top: 10vh; }
.login-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 32px; width: 320px; display: flex; flex-direction: column; gap: 14px;
}
.login-card h1 { margin: 0; font-size: 1.4em; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9em; color: var(--text-muted); }
.login-card input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px; color: var(--text); font-size: 1em;
}
.login-card button {
  background: var(--accent); color: white; border: none; border-radius: 8px; padding: 10px; font-size: 1em; cursor: pointer; margin-top: 8px;
}
.error { color: var(--red); font-size: 0.9em; margin: 0; }

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

.overall-progress { display: flex; align-items: center; gap: 10px; min-width: 260px; }
.overall-progress span { font-size: 0.85em; color: var(--text-muted); white-space: nowrap; }

.bar { flex: 1; height: 10px; background: var(--border); border-radius: 6px; overflow: hidden; }
.bar.small { height: 6px; }
.bar .fill { height: 100%; background: var(--green); }

.panel {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 18px; margin-bottom: 18px;
}
.panel summary { cursor: pointer; font-weight: 500; }
.panel h2 { margin-top: 0; }

.inline-form { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.inline-form.wrap { align-items: center; }
.inline-form input[type=text], .inline-form input[type=email], .inline-form select {
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; color: var(--text);
}
.inline-form button {
  background: var(--accent); color: white; border: none; border-radius: 6px; padding: 8px 14px; cursor: pointer;
}
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 0.9em; color: var(--text-muted); }

.muted { color: var(--text-muted); }
.small { font-size: 0.85em; }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }

.phase-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px;
  padding: 16px 18px; margin-bottom: 16px;
}
.phase-header { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.phase-header h2 { margin: 0; font-size: 1.1em; flex: 0 0 auto; }
.phase-progress { display: flex; align-items: center; gap: 8px; flex: 1; }
.phase-progress span { font-size: 0.8em; color: var(--text-muted); white-space: nowrap; }

.task-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.task-row { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.task-row:last-child { border-bottom: none; }
.task-row.done .task-title { text-decoration: line-through; color: var(--text-muted); }
.checkbox {
  width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border); background: var(--bg);
  color: var(--green); cursor: pointer; flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
}
.task-body { flex: 1; display: flex; flex-direction: column; }
.task-title { font-size: 0.95em; }
.task-meta { font-size: 0.75em; color: var(--text-muted); }

.incident-banner {
  background: rgba(224, 85, 62, 0.15); border: 1px solid var(--red); color: #ff9d8a;
  padding: 10px 16px; border-radius: 8px; margin-bottom: 18px;
}

.target-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 20px; }
.target-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.target-header { display: flex; align-items: center; gap: 8px; }
.target-header h2 { margin: 0; font-size: 1.05em; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.dot.green { background: var(--green); }
.dot.amber { background: var(--amber); }
.dot.red { background: var(--red); }
.dot.gray { background: var(--gray); }

.badge { font-size: 0.7em; background: var(--border); color: var(--text-muted); padding: 2px 8px; border-radius: 10px; }
.badge.muted { opacity: 0.6; }

.uptime-row { display: flex; gap: 18px; margin: 12px 0; }
.uptime-row div { display: flex; flex-direction: column; }
.uptime-pct { font-size: 1.2em; font-weight: 600; }

.daybar { display: flex; gap: 2px; margin: 10px 0; }
.daycell { width: 8px; height: 20px; border-radius: 2px; }
.daycell.green { background: var(--green); }
.daycell.amber { background: var(--amber); }
.daycell.red { background: var(--red); }
.daycell.gray { background: var(--border); }

.error-text { color: #ff9d8a; }

.target-actions { display: flex; gap: 14px; margin-top: 12px; align-items: center; font-size: 0.85em; }
.target-actions a { color: var(--accent); text-decoration: none; }

.incidents-table { width: 100%; border-collapse: collapse; font-size: 0.9em; }
.incidents-table th, .incidents-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.incidents-table th { color: var(--text-muted); font-weight: 500; }

.log-viewer {
  background: #0a0e17; border: 1px solid var(--border); border-radius: 8px; padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82em;
  max-height: 70vh; overflow-y: auto;
}
.log-line { display: flex; gap: 10px; padding: 2px 4px; border-radius: 3px; white-space: pre-wrap; }
.log-ts { color: var(--text-muted); flex: 0 0 auto; }
.log-level { flex: 0 0 60px; font-weight: 600; }
.log-line.level-info .log-level { color: var(--gray); }
.log-line.level-warn .log-level { color: var(--amber); }
.log-line.level-warn { background: rgba(224, 168, 62, 0.08); }
.log-line.level-error .log-level { color: var(--red); }
.log-line.level-error { background: rgba(224, 85, 62, 0.12); }
.log-line.level-critical .log-level { color: #ff5c5c; }
.log-line.level-critical { background: rgba(255, 0, 0, 0.2); font-weight: 600; }
