:root {
  --bg: #f4f6f3;
  --panel: #ffffff;
  --ink: #18221d;
  --muted: #66736c;
  --line: #dce3dc;
  --accent: #0f766e;
  --accent-2: #a16207;
  --danger: #b42318;
  --ok: #15803d;
  --warn: #b45309;
  --shadow: 0 12px 30px rgba(31, 41, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.12), transparent 34%),
    linear-gradient(280deg, rgba(161, 98, 7, 0.12), transparent 30%),
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Trebuchet MS", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card,
.panel,
.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card {
  width: min(420px, 100%);
  padding: 28px;
}

.brand {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 8px;
}

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

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.input,
.select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}

.button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
}

.button.secondary {
  color: var(--accent);
  background: #e3f3ef;
}

.button.ghost {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
}

.shell {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 22px;
  background: #17211d;
  color: #eaf3ee;
}

.sidebar h1 {
  font-size: 22px;
  margin: 0 0 4px;
}

.nav {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

.nav button {
  text-align: left;
  border: 0;
  border-radius: 6px;
  padding: 11px 12px;
  color: #d7e2dc;
  background: transparent;
  cursor: pointer;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.main {
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.controls {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.controls .field {
  margin: 0;
}

.grid {
  display: grid;
  row-gap: 40px;
  column-gap: 16px;
}


.metrics {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.two {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}


.metric,
.panel {
  padding: 20px;
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  font-weight: 800;
}

.metric-value {
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.1;
  font-weight: 900;
  margin-top: 8px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}

.section-title h2 {
  font-size: 18px;
  margin: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}


th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.right {
  text-align: right;
}

.bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ece8;
}

.bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  background: #eef3ef;
}

.status.ok {
  color: var(--ok);
}

.status.error,
.status.exceeded {
  color: var(--danger);
}

.status.warning,
.status.mock,
.status.not_configured {
  color: var(--warn);
}

.alert {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  background: #fff;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
}

.alert.warning { border-left-color: var(--warn); }
.alert.danger { border-left-color: var(--danger); }
.alert.success { border-left-color: var(--ok); }

.alert-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.alert-time {
  font-size: 11px;
  color: var(--muted);
}

.alert-body {
  font-size: 14px;
  line-height: 1.5;
  flex-grow: 1;
}

.alert-details {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.alert-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.text-warn { color: var(--warn); font-weight: 700; }
.text-danger { color: var(--danger); font-weight: 700; }
.text-ok { color: var(--ok); font-weight: 700; }



.error {
  color: var(--danger);
  margin-top: 12px;
}

.spark {
  display: flex;
  align-items: end;
  gap: 6px;
  height: 150px;
  padding: 10px 0;
  border-bottom: 2px solid var(--line);
}

.spark-bar {
  flex: 1;
  min-width: 8px;
  background: linear-gradient(180deg, var(--accent), #65a30d);
  border-radius: 4px 4px 0 0;
  transition: opacity 0.2s, transform 0.2s;
  cursor: pointer;
}

.spark-bar:hover {
  opacity: 0.8;
  transform: scaleX(1.1);
}


/* History Timeline Styles */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.timeline-event {
  display: flex;
  gap: 16px;
  position: relative;
}

.timeline-event::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 24px;
  bottom: -16px;
  width: 2px;
  background: var(--line);
}

.timeline-event:last-child::before {
  display: none;
}

.timeline-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 4px;
  flex-shrink: 0;
  z-index: 1;
}

.timeline-content {
  padding-bottom: 8px;
}

.timeline-date {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.timeline-message {
  font-weight: 500;
}

.timeline-type-addition { color: var(--ok); }
.timeline-type-deletion { color: var(--danger); }
.timeline-type-modification { color: var(--warn); }

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .nav {
    grid-template-columns: repeat(3, 1fr);
    margin-top: 16px;
  }

  .nav button {
    text-align: center;
  }

  .metrics,
  .two {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
  }
}

@media (max-width: 620px) {
  .main {
    padding: 18px;
  }

  .nav {
    grid-template-columns: 1fr 1fr;
  }

  .controls {
    display: grid;
  }

  table {
    font-size: 14px;
  }
}
