* {
  box-sizing: border-box;
}

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --line: #e5e7eb;
  --text: #171717;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --accent: #ea580c;
  --accent-tint: #fdead9;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  min-height: 100vh;
}

h1, h2, h3 {
  font-family: "Bricolage Grotesque", ui-sans-serif, sans-serif;
  margin: 0;
}

.mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
}

a {
  color: inherit;
}

button {
  font-family: inherit;
}

/* ── Login screen ───────────────────────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  text-align: center;
}

.login-card img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  margin-bottom: 14px;
}

.login-card h1 {
  font-size: 19px;
  margin-bottom: 6px;
}

.login-card p {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13.5px;
}

.field {
  text-align: left;
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
}

.field input,
.field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}

.field input:focus,
.field select:focus {
  outline: 2px solid var(--accent-tint);
  border-color: var(--accent);
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  width: 100%;
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.btn-secondary {
  background: #f3f4f6;
  color: var(--text);
}

.btn-outline {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-sm {
  width: auto;
  padding: 8px 14px;
  font-size: 13px;
}

.error-text {
  color: #c0392b;
  font-size: 13px;
  margin-top: 10px;
}

/* ── App shell ──────────────────────────────────────────────────────── */
.shell {
  min-height: 100vh;
  display: flex;
}

.side {
  width: 224px;
  flex-shrink: 0;
  min-height: 100vh;
  padding: 26px 16px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 6px;
  padding: 0 8px;
}

.side-brand img {
  width: 26px;
  height: 26px;
  border-radius: 7px;
}

.side-brand span {
  font-weight: 700;
  font-size: 14.5px;
}

.side-tag {
  padding: 0 8px;
  margin-bottom: 26px;
  font-size: 11px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

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

.side-nav-item {
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.side-nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.side-nav-item.active {
  background: var(--accent-tint);
  color: var(--accent);
}

.side-nav-item:hover:not(.active) {
  background: #f3f4f6;
  color: var(--text);
}

.side-logout {
  margin-top: auto;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  padding: 9px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
}

.main {
  flex: 1;
  max-width: 1160px;
  padding: 32px 40px;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.live-dot .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #1a8a44;
  display: inline-block;
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-head h2 {
  font-size: 15px;
}

.card-head a {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  cursor: pointer;
}

.metric-sub {
  font-size: 11px;
  color: #1a8a44;
  margin-top: 6px;
  font-weight: 600;
}

.row-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--accent-tint);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  vertical-align: middle;
}

.row-icon svg {
  width: 14px;
  height: 14px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 22px;
}

.page-head h1 {
  font-size: 22px;
  margin-bottom: 4px;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
}

.card + .card {
  margin-top: 16px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

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

.metric-label {
  font-size: 12px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 8px;
}

.metric-value {
  font-family: "IBM Plex Mono", monospace;
  font-size: 24px;
  font-weight: 500;
}

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

.muted {
  color: var(--muted);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-2);
  font-weight: 600;
  padding: 0 10px 10px;
  border-bottom: 1px solid var(--line);
}

td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
}

tr:last-child td {
  border-bottom: 0;
}

.pill {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}

.pill.on {
  background: #e7f6ec;
  color: #1a8a44;
}

.pill.off {
  background: #f3f4f6;
  color: var(--muted);
}

.pill.warn {
  background: var(--accent-tint);
  color: var(--accent);
}

.pill.info {
  background: #dbeafe;
  color: #2563eb;
}

.textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  resize: vertical;
  min-height: 80px;
}

.status-select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
}

.inline-input {
  width: 90px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 13px;
  font-family: "IBM Plex Mono", monospace;
}

.toast {
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
}

.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.search-row input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 14px;
  font-family: inherit;
}

.back-link {
  display: inline-block;
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted-2);
  font-size: 13.5px;
}
