:root {
  --bg: #0f1720;
  --card-bg: #16212c;
  --text: #e8edf2;
  --muted: #8ea0b3;
  --accent: #2fa86a;
  --error: #d9534f;
  --border: #24333f;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.25rem;
}

.brand.active {
  color: var(--accent);
}

.topnav {
  display: flex;
  gap: 1.25rem;
  flex: 1;
}

.topnav a,
.navlink {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.topnav a.active,
.navlink.active {
  color: var(--text);
  font-weight: 600;
}

.logout {
  color: var(--muted);
  text-decoration: none;
}

.site-switcher {
  margin-bottom: 1rem;
}

.site-switcher select,
select {
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
}

.inline-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.inline-form input[type="text"] {
  width: auto;
  flex: 1;
  min-width: 140px;
}

.btn-small {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.btn-disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
}

.hint {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 0.35rem;
}

.tz-toggle {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.tz-toggle a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.tz-toggle a.active {
  color: var(--text);
  border-color: var(--accent);
  font-weight: 600;
}

.status-ok {
  color: var(--accent);
  font-weight: 600;
}

.status-bad {
  color: var(--error);
  font-weight: 600;
}

.chart-label {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 1rem 0 0.35rem;
  font-weight: 600;
}

.chart-scroll {
  overflow-x: auto;
}

.chart-scroll svg text {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.login-card {
  max-width: 360px;
  margin: 3rem auto;
}

.field {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.6rem;
  border-radius: 6px;
  width: 100%;
}

.btn {
  display: inline-block;
  padding: 0.65rem 1.1rem;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #06210f;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin: 1rem 0;
}

.summary-grid .label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.summary-grid .value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
}

.freshness {
  color: var(--muted);
  font-size: 0.9rem;
}

.error-text {
  color: var(--error);
}

.system-row {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.system-row:last-child {
  border-bottom: none;
}

.table-scroll {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85rem;
}

th, td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.flash-list {
  margin-bottom: 1rem;
}

.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}

.flash-success {
  background: rgba(47, 168, 106, 0.15);
  border: 1px solid var(--accent);
}

.flash-error {
  background: rgba(217, 83, 79, 0.15);
  border: 1px solid var(--error);
}

.flash-info {
  background: rgba(142, 160, 179, 0.15);
  border: 1px solid var(--border);
}

@media (max-width: 480px) {
  .summary-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
  }
  .summary-grid .value {
    font-size: 1.15rem;
  }
}
