/* AT6 Statusboard - s/w base, semantic colors for status (green/yellow/red) */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: #fff; color: #111; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: 56px; /* space for fixed legal bar */
  -webkit-font-smoothing: antialiased;
}
a { color: #111; text-decoration: underline; text-underline-offset: 2px; }
a:hover { opacity: 0.7; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: #111; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.95em; background: #f3f3f3; padding: 0 4px; border-radius: 3px; }

/* Status colors (semantic) */
:root {
  --c-ok: #16a34a;
  --c-ok-bg: rgba(22, 163, 74, 0.08);
  --c-warn: #ca8a04;
  --c-warn-bg: rgba(202, 138, 4, 0.10);
  --c-mid: #ea580c;
  --c-mid-bg: rgba(234, 88, 12, 0.10);
  --c-down: #dc2626;
  --c-down-bg: rgba(220, 38, 38, 0.10);
}

/* Topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid #111;
  position: sticky; top: 0; background: #fff; z-index: 10;
}
.brand { font-weight: 700; font-size: 1.05rem; text-decoration: none; letter-spacing: -0.01em; }
.topnav { display: flex; gap: 8px; align-items: center; }
.topbtn {
  background: #111; color: #fff; border: 1px solid #111;
  padding: 0 14px; height: 36px; line-height: 34px;
  border-radius: 6px; text-decoration: none; display: inline-block;
  font-size: 0.9rem;
}
.topbtn.secondary { background: #fff; color: #111; }
.role-pill { background: #111; color: #fff; padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; font-weight: 600; }

/* Main */
.main { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }
.card { background: #fff; border: 1px solid #111; border-radius: 8px; padding: 20px; margin-bottom: 16px; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.card.site:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.card.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
h1 { font-size: 1.375rem; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; margin: 0 0 6px; }
h3 { font-size: 0.85rem; margin: 0 0 6px; text-transform: uppercase; letter-spacing: 0.05em; color: #555; font-weight: 600; }
.muted { color: #555; font-size: 0.9rem; margin: 4px 0 0; }
.muted.small { font-size: 0.8rem; }
.err { color: var(--c-down); font-size: 0.9rem; margin-top: 8px; }

/* Forms */
form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
label { font-size: 0.85rem; font-weight: 600; margin-top: 8px; }
input[type="text"], input[type="password"], input[type="url"], input[type="number"], select {
  width: 100%; height: 44px; padding: 0 12px;
  border: 1px solid #111; border-radius: 6px; background: #fff;
  min-height: 44px;
  transition: border-color 0.15s ease;
}
input:focus, select:focus { outline: 2px solid #111; outline-offset: 1px; }
button[type="submit"], button.primary {
  background: #111; color: #fff; border: 1px solid #111; border-radius: 6px;
  height: 44px; padding: 0 16px; font-weight: 600;
  min-height: 44px;
  transition: background 0.15s ease, transform 0.1s ease;
}
button[type="submit"]:hover, button.primary:hover { background: #333; }
button[type="submit"]:active, button.primary:active { transform: scale(0.98); }
button.danger { background: #fff; color: var(--c-down); border-color: var(--c-down); }
button.danger:hover { background: var(--c-down-bg); }
button.small { height: 32px; padding: 0 10px; font-size: 0.85rem; min-height: 32px; }
button:disabled { opacity: 0.35; cursor: not-allowed; }

/* Overview banner */
.overview {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 16px 20px;
}
.overview-stat { display: flex; align-items: baseline; gap: 6px; }
.overview-stat .num { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.overview-stat .label { font-size: 0.85rem; color: #555; }
.overview-stat .num.ok { color: var(--c-ok); }
.overview-stat .num.down { color: var(--c-down); }
.overview-bar { flex: 1; height: 8px; background: #f3f3f3; border-radius: 999px; overflow: hidden; min-width: 120px; }
.overview-bar-fill { height: 100%; background: var(--c-ok); transition: width 0.4s ease, background 0.4s ease; border-radius: 999px; }

/* Site card */
.sites { display: grid; grid-template-columns: 1fr; gap: 16px; }
.site-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.site-name { margin: 0; font-size: 1.1rem; }
.site-url { font-size: 0.85rem; color: #555; word-break: break-all; }
.site-status { display: flex; align-items: center; gap: 8px; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; position: relative; }
.dot.ok { background: var(--c-ok); box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.6); animation: pulse-ok 2s infinite; }
.dot.down { background: var(--c-down); animation: pulse-down 1.5s infinite; }
.dot.unknown { background: #ccc; }
@keyframes pulse-ok {
  0% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(22, 163, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(22, 163, 74, 0); }
}
@keyframes pulse-down {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
.status-text { font-weight: 600; font-size: 0.95rem; padding: 3px 10px; border-radius: 999px; }
.status-text.ok { background: var(--c-ok-bg); color: var(--c-ok); }
.status-text.down { background: var(--c-down-bg); color: var(--c-down); }

.meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 16px; margin: 16px 0 12px; padding: 0; }
.meta > div { display: flex; flex-direction: column; }
.meta dt { font-size: 0.75rem; color: #555; text-transform: uppercase; letter-spacing: 0.05em; }
.meta dd { margin: 0; font-size: 1rem; font-weight: 600; }
.meta dd.lat-good { color: var(--c-ok); }
.meta dd.lat-warn { color: var(--c-warn); }
.meta dd.lat-mid { color: var(--c-mid); }
.meta dd.lat-bad { color: var(--c-down); }
.meta dd.up-ok { color: var(--c-ok); }
.meta dd.up-warn { color: var(--c-warn); }
.meta dd.up-mid { color: var(--c-mid); }
.meta dd.up-bad { color: var(--c-down); }
.meta dd.uptime-muted { color: #999 !important; font-style: italic; font-weight: 500; }
.info-icon {
  display: inline-block;
  width: 16px; height: 16px;
  border: 1px solid #999;
  border-radius: 50%;
  font-size: 0.65rem;
  line-height: 14px;
  text-align: center;
  font-style: normal;
  color: #777;
  cursor: help;
  margin-left: 2px;
  vertical-align: 2px;
  font-weight: 600;
}
.info-icon:hover { color: #111; border-color: #111; }

.charts { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 12px; }
.chart-block { background: #fafafa; border: 1px solid #ddd; border-radius: 6px; padding: 12px; }
.chart-block canvas { width: 100% !important; height: 120px !important; display: block; }

/* Table */
.tbl { width: 100%; border-collapse: collapse; margin-top: 12px; }
.tbl th, .tbl td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #ddd; font-size: 0.9rem; vertical-align: top; }
.tbl th { background: #f3f3f3; font-weight: 600; }
.tbl a { word-break: break-all; }
.row-actions { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.row-actions form, .row-actions a { margin: 0; }

/* Legal bar */
.legalbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  text-align: center; font-size: 0.75rem; color: #777;
  padding: 8px 12px; background: #fff; border-top: 1px solid #ddd;
  z-index: 5;
}
.legalbar a { color: #777; text-decoration: none; margin: 0 6px; }
.legalbar a:hover { color: #111; }

/* Desktop */
@media (min-width: 720px) {
  .meta.meta-6 { grid-template-columns: repeat(6, 1fr); }
  .charts.charts-4 { grid-template-columns: repeat(2, 1fr); }
  .sites { grid-template-columns: 1fr; }
}
@media (min-width: 1100px) {
  .charts.charts-4 { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 480px) {
  .topbar { padding: 10px 12px; }
  .main { padding: 16px 12px; }
  .card { padding: 16px; }
  h1 { font-size: 1.2rem; }
  .topbtn { padding: 0 10px; height: 36px; line-height: 34px; font-size: 0.85rem; }
  .overview { padding: 12px 16px; }
  .overview-stat .num { font-size: 1.3rem; }
}
