:root {
  --accent: #E8541E;
  --accent-dark: #C7431A;
  --accent-light: #FFF1EC;
  --ink: #1E2530;
  --ink-soft: #5B6472;
  --line: #E7E7EA;
  --bg: #F7F7F8;
  --card: #FFFFFF;
  --green: #1A9E5C;
  --red: #D6392E;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
}

a { text-decoration: none; color: inherit; }

/* ===== Layout shell ===== */
.shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 22px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 15px;
}

.brand-name {
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}

.nav-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-soft);
  letter-spacing: .03em;
  padding: 14px 8px 6px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--ink-soft);
  font-weight: 500;
  margin-bottom: 2px;
}

.nav-item:hover { background: var(--accent-light); color: var(--accent); }
.nav-item.active { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; }

.main {
  flex: 1;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.crumb {
  font-size: 12px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}
.crumb b { color: var(--ink); }

.page-title {
  font-size: 20px;
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.chip {
  background: var(--accent-light);
  color: var(--accent-dark);
  padding: 5px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 13px;
}
.logout-btn:hover { color: var(--red); }

.content {
  padding: 28px;
}

/* ===== Cards ===== */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.grid {
  display: grid;
  gap: 18px;
}
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 900px) {
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}

/* ===== Banner ===== */
.banner {
  background: linear-gradient(120deg, var(--accent), var(--accent-dark));
  color: #fff;
  border-radius: var(--radius);
  padding: 26px 28px;
  margin-bottom: 22px;
}
.banner h1 { margin: 0 0 6px 0; font-size: 24px; }
.banner p { margin: 0; opacity: .92; }

/* ===== Alert ===== */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #FDECEC;
  border: 1px solid #F5B8B4;
  color: #8A241C;
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-weight: 500;
}
.alert b { display: block; margin-bottom: 2px; }

/* ===== Data card (metric) ===== */
.metric-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.metric-card-head h3 { margin: 0; font-size: 16px; }

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
}
.status-dot span.dot {
  width: 8px; height: 8px; border-radius: 50%;
}
.dot.online { background: var(--green); }
.dot.offline { background: var(--ink-soft); }
.status-dot.online { color: var(--green); }
.status-dot.offline { color: var(--ink-soft); }

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.metric {
  background: var(--bg);
  border-radius: 8px;
  padding: 12px 14px;
}
.metric-label { font-size: 12px; color: var(--ink-soft); margin-bottom: 4px; }
.metric-value { font-size: 18px; font-weight: 700; }
.metric-value .unit { font-size: 12px; font-weight: 500; color: var(--ink-soft); margin-left: 3px; }

/* ===== Forms ===== */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field input, .field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn.secondary:hover { border-color: var(--accent); color: var(--accent); }

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-bar .field { margin-bottom: 0; min-width: 160px; }

/* ===== Table ===== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
th {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 12px;
  text-transform: none;
}
tr:hover td { background: var(--bg); }

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

/* ===== Login page ===== */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #FFF1EC 0%, #F7F7F8 60%);
}
.login-card {
  width: 360px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  padding: 32px;
  box-shadow: 0 20px 40px rgba(30,37,48,.06);
}
.login-card .brand-mark { margin: 0 auto 14px auto; width: 44px; height: 44px; font-size: 18px; border-radius: 10px; }
.login-card h1 { text-align: center; font-size: 18px; margin: 0 0 4px 0; }
.login-card p.sub { text-align: center; color: var(--ink-soft); font-size: 13px; margin: 0 0 22px 0; }
.login-error {
  background: #FDECEC;
  color: #8A241C;
  border: 1px solid #F5B8B4;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.btn.block { width: 100%; justify-content: center; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge.up { background: #FDECEC; color: #8A241C; }
