:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --surface-soft: #eef2ef;
  --text: #17201b;
  --muted: #63716a;
  --line: #d9e2dd;
  --primary: #245b4d;
  --accent: #d6a738;
  --radius: 8px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar strong,
.topbar span {
  display: block;
}

.topbar span,
p,
textarea {
  color: var(--muted);
}

.topbar a,
button {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font: inherit;
  font-weight: 800;
}

button {
  color: white;
  background: var(--primary);
  cursor: pointer;
}

main {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.hero,
.panel {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.hero h1 {
  max-width: 840px;
  margin: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-weight: 900;
  text-transform: uppercase;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions button:first-child {
  color: var(--primary);
  background: var(--surface);
}

.tenant-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.metric-grid,
.analytics-columns {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.analytics-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.tenant-analytics-detail {
  display: grid;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.compact-heading {
  margin-bottom: 0;
}

.compact-heading select {
  width: min(100%, 280px);
}

.metric-card,
.analytics-row {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.metric-card span,
.metric-card strong {
  display: block;
}

.metric-card strong {
  margin-top: 4px;
  font-size: 1.6rem;
}

.analytics-list {
  display: grid;
  gap: 8px;
}

.analytics-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.analytics-row strong,
.analytics-row span {
  display: block;
}

.analytics-row span {
  color: var(--muted);
  font-size: 0.88rem;
}

.tenant-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.tenant-card-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.tenant-card h3,
.tenant-card p,
.tenant-card small {
  margin: 0;
}

.tenant-card a {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--primary);
  background: var(--surface);
  font-weight: 900;
}

.toggle-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-weight: 900;
}

.switch {
  position: relative;
  display: inline-flex;
  width: 58px;
  height: 32px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch i {
  width: 100%;
  border-radius: 999px;
  background: #b7c3bd;
  cursor: pointer;
}

.switch i::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: white;
  transition: transform 0.16s ease;
}

.switch input:checked + i {
  background: var(--primary);
}

.switch input:checked + i::before {
  transform: translateX(26px);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 800;
}

input,
select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 9px;
  font: inherit;
}

input[type="color"] {
  width: 100%;
  min-height: 42px;
  padding: 4px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

textarea {
  width: 100%;
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  resize: vertical;
}

#saveStatus {
  color: var(--primary);
  font-weight: 900;
}

@media (max-width: 700px) {
  .topbar,
  .panel-heading,
  .tenant-card-heading {
    display: grid;
  }

  .tenant-grid,
  .metric-grid,
  .analytics-columns,
  .field-grid,
  .toggle-list {
    grid-template-columns: 1fr;
  }
}
