:root {
  --navy: #0f1a2a;
  --navy-2: #16263c;
  --navy-3: #20324d;
  --olive: #7d8f4d;
  --olive-dark: #63743b;
  --bg: #f3f5f7;
  --panel: #ffffff;
  --text: #172033;
  --muted: #6b7280;
  --line: #dce2ea;
  --danger: #b42318;
  --warning: #b7791f;
  --ok: #2f7d46;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
}

.hidden {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    radial-gradient(circle at 78% 18%, rgba(125, 143, 77, 0.20), transparent 30%),
    linear-gradient(135deg, rgba(15, 26, 42, 0.98), rgba(18, 33, 52, 0.95)),
    repeating-linear-gradient(90deg, #162338 0, #162338 1px, #1d2e47 1px, #1d2e47 72px);
}

.login-panel {
  width: min(100%, 420px);
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 36px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
  position: relative;
}

.login-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  border-radius: 8px 8px 0 0;
  background: var(--olive);
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--olive);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 10px 24px rgba(125, 143, 77, 0.28);
}

.eyebrow {
  margin: 20px 0 6px;
  color: var(--olive-dark);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 28px;
  font-size: 28px;
}

.login-form {
  display: grid;
  gap: 16px;
}

label span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

input:focus {
  outline: 3px solid rgba(117, 136, 74, 0.22);
  border-color: var(--olive);
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 120ms ease, background 150ms ease, box-shadow 150ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.login-form button,
.primary-button {
  background: var(--olive);
  color: #fff;
  box-shadow: 0 10px 22px rgba(125, 143, 77, 0.22);
}

.login-form button:hover,
.primary-button:hover {
  background: var(--olive-dark);
}

.secondary-button {
  background: #eef2f6;
  color: var(--text);
}

.form-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 14px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
}

.sidebar {
  background: var(--navy);
  color: #fff;
  padding: 22px 18px;
  box-shadow: 8px 0 30px rgba(15, 26, 42, 0.10);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.sidebar-brand span {
  display: block;
  margin-top: 3px;
  color: #aab5c5;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-item {
  width: 100%;
  justify-content: flex-start;
  text-align: left;
  background: transparent;
  color: #cbd5e1;
  border-radius: 6px;
}

.nav-item.active,
.nav-item:hover {
  background: var(--navy-2);
  color: #fff;
  box-shadow: inset 4px 0 0 var(--olive);
}

.workspace {
  min-width: 0;
}

.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 18px;
  justify-content: space-between;
  padding: 16px 28px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar .eyebrow {
  margin: 0 0 4px;
}

.topbar h2 {
  margin: 0;
  font-size: 22px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.icon-button {
  display: none;
  width: 42px;
  padding: 0;
  background: #eef2f6;
  color: var(--text);
}

.content {
  padding: 26px 28px 40px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

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

.metric-card {
  min-height: 126px;
  padding: 18px;
  box-shadow: 0 10px 28px rgba(15, 26, 42, 0.05);
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 14px;
  font-size: 30px;
}

.panel {
  padding: 18px;
  box-shadow: 0 10px 28px rgba(15, 26, 42, 0.04);
}

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

.panel-header h3 {
  margin: 0;
  font-size: 18px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th,
td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
}

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

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 800;
  background: #eef2f6;
}

.status.online,
.status.active {
  color: var(--ok);
  background: #e8f4ec;
}

.status.offline,
.status.passive {
  color: var(--danger);
  background: #fdecec;
}

.status.alarm,
.status.warning {
  color: var(--warning);
  background: #fff7e6;
}

.empty-state {
  padding: 28px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fafbfc;
}

@media (max-width: 1100px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 270px;
    transform: translateX(-100%);
    transition: transform 180ms ease;
    z-index: 10;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .icon-button {
    display: inline-grid;
    place-items: center;
  }

  .topbar {
    align-items: flex-start;
    padding: 14px 16px;
  }

  .topbar-actions {
    flex-direction: column;
    align-items: flex-end;
  }

  .content {
    padding: 18px 16px 28px;
  }

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

  .login-panel {
    padding: 28px 22px;
  }

  h1 {
    font-size: 24px;
  }

  .topbar h2 {
    font-size: 19px;
  }

  .metric-card strong {
    font-size: 26px;
  }
}
