:root {
  --bg-main: #eaf1fb;
  --bg-card: #ffffff;
  --text-main: #1f2d3d;
  --text-muted: #637387;
  --brand-1: #1e3a8a;
  --brand-2: #2563eb;
  --brand-3: #3b82f6;
  --ok: #1d8348;
  --warn: #f39c12;
  --danger: #c0392b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg-main); color: var(--text-main); }
a { text-decoration: none; color: inherit; }

.page-wrapper { min-height: 100vh; display: flex; flex-direction: column; }

.Nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
  height: 70px;
  min-height: 70px;
  max-height: 70px;
  padding: 0 30px;
  background: var(--bg-card);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.logo-div { display: flex; align-items: center; gap: 10px; height: 70px; cursor: pointer; }
.logo-badge {
  width: 34px; height: 34px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700;
  background: linear-gradient(135deg, var(--brand-2), var(--brand-1));
}
.logo-text { font-weight: 700; color: var(--brand-1); }

.burger-menu { display: none; background: none; border: none; font-size: 28px; cursor: pointer; color: var(--brand-1); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-grow: 1;
  justify-content: space-around;
  height: 70px;
}

.nav-links a, .nav-item {
  display: flex;
  align-items: center;
  height: 70px;
  font-size: 16px;
  font-weight: 600;
  color: var(--brand-1);
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0 8px;
}
.nav-links a:hover, .nav-item:hover { color: var(--brand-3); }

.menuderoulant { position: relative; display: flex; align-items: center; height: 70px; }
.menuderoulantcontent {
  position: absolute;
  top: 100%;
  left: 0;
  width: 240px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
  padding: 8px 0;
}
.menuderoulantcontent a { height: auto; padding: 10px 14px; display: block; color: var(--text-main); }
.menuderoulantcontent a:hover { background: #ecf4ff; color: var(--brand-2); }
.hidden { display: none; }

.audio-controls {
  padding: 10px 12px;
  display: grid;
  gap: 8px;
}

.audio-row {
  display: flex;
  gap: 8px;
}

.audio-btn {
  border: 1px solid #bfd7ff;
  background: #fff;
  color: var(--brand-1);
  font-weight: 700;
  border-radius: 8px;
  padding: 7px 10px;
  cursor: pointer;
}

.audio-btn:hover {
  border-color: var(--brand-2);
  color: var(--brand-2);
}

.audio-range {
  width: 100%;
}

.profil-div { display: flex; align-items: center; gap: 12px; }
.profil { display: flex; align-items: center; gap: 10px; }
.profil-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: #dbeafe; color: var(--brand-1); font-weight: 700;
}
.input-role {
  height: 35px; min-width: 150px; max-width: 220px;
  border: 2px solid var(--brand-1); border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-2), var(--brand-1));
  color: #fff; text-align: center; font-weight: 600;
}
.logout-btn {
  border: none; border-radius: 8px; padding: 8px 12px; cursor: pointer;
  background: var(--brand-1); color: #fff; font-weight: 600;
}

.container { width: min(1320px, 96%); margin: 22px auto 30px; display: grid; gap: 18px; }
.hero, .panel, .kpi-card {
  background: var(--bg-card);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(20, 30, 50, 0.08);
}
.hero { padding: 20px; }
.hero h1 { color: var(--brand-1); margin-bottom: 8px; }
.hero p { color: var(--text-muted); }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.kpi-card { padding: 16px; }
.kpi-card h3 { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 8px; }
.kpi-value { font-size: 1.35rem; font-weight: 700; }
.kpi-delta { margin-top: 6px; font-weight: 700; }
.pos { color: var(--danger); }
.neg { color: var(--ok); }
.neu { color: var(--text-muted); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.panel { padding: 16px; }
.panel h2 { margin-bottom: 12px; color: var(--brand-1); font-size: 1.05rem; }
.panel p { color: var(--text-muted); }
canvas { width: 100%; min-height: 290px; }

.quick-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.quick-link {
  background: linear-gradient(160deg, #eff6ff, #dbeafe);
  border: 1px solid #bfd7ff;
  border-radius: 12px;
  padding: 14px;
  display: block;
}
.quick-link b { color: var(--brand-1); display: block; margin-bottom: 4px; }
.quick-link span { color: var(--text-muted); font-size: 0.92rem; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { text-align: left; border-bottom: 1px solid #e8edf4; padding: 10px; font-size: 0.92rem; }
th { color: var(--text-muted); }
.status-ok { color: var(--ok); font-weight: 700; }
.status-warn { color: var(--warn); font-weight: 700; }
.status-danger { color: var(--danger); font-weight: 700; }

.raw-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 10px; }
.raw-btn {
  border: 1px solid #bfd7ff;
  background: #fff;
  color: var(--brand-1);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}
.raw-btn:hover { border-color: var(--brand-2); color: var(--brand-2); }
pre {
  border-radius: 10px;
  background: #0f172a;
  color: #dbeafe;
  padding: 14px;
  overflow: auto;
  max-height: 320px;
  font-size: 0.84rem;
}

.foot {
  margin-top: auto;
  min-height: 70px;
  padding: 20px 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--text-muted);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.alerts-list {
  display: grid;
  gap: 10px;
}

.alert-item {
  border: 1px solid #dbe7fb;
  background: #f8fbff;
  border-radius: 10px;
  padding: 10px 12px;
}

.alert-item b {
  color: var(--brand-1);
}

.pill {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 999px;
  margin-left: 8px;
}

.pill-danger {
  background: #fdecec;
  color: var(--danger);
}

.pill-warn {
  background: #fff4de;
  color: #a46300;
}

@media (max-width: 980px) {
  .Nav { justify-content: space-between; padding: 10px 20px; }
  .burger-menu { display: flex; }
  .nav-links {
    display: none;
    position: absolute;
    top: 70px; left: 0;
    width: 100%;
    flex-direction: column;
    align-items: center;
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    height: auto;
    padding-bottom: 15px;
  }
  .nav-links.open { display: flex; }
  .nav-links a, .nav-item { width: 100%; height: auto; justify-content: center; padding: 14px 0; border-bottom: 1px solid #edf2f7; }
  .menuderoulant { height: auto; width: 100%; display: flex; flex-direction: column; }
  .menuderoulantcontent { position: static; width: 100%; box-shadow: none; background: #eff6ff; }
  .profil-div { flex-direction: column; padding-top: 10px; }
}

@media (max-width: 640px) {
  .Nav {
    height: 62px;
    min-height: 62px;
    max-height: 62px;
    padding: 8px 12px;
  }

  .logo-div {
    height: 62px;
    gap: 8px;
  }

  .logo-badge {
    width: 30px;
    height: 30px;
  }

  .logo-text {
    font-size: 0.95rem;
  }

  .nav-links {
    top: 62px;
  }

  .nav-links a,
  .nav-item {
    font-size: 0.95rem;
    padding: 12px 0;
  }

  .container {
    width: min(1320px, 94%);
    margin: 14px auto 20px;
    gap: 12px;
  }

  .hero,
  .panel,
  .kpi-card {
    border-radius: 12px;
  }

  .hero {
    padding: 14px;
  }

  .hero h1 {
    font-size: 1.2rem;
    line-height: 1.3;
  }

  .hero p {
    font-size: 0.92rem;
  }

  .kpi-grid,
  .grid-2,
  .grid-3,
  .quick-links {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .kpi-card {
    padding: 14px;
  }

  .kpi-value {
    font-size: 1.2rem;
  }

  .panel {
    padding: 12px;
  }

  .panel h2 {
    font-size: 1rem;
    margin-bottom: 10px;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  th,
  td {
    padding: 8px;
    font-size: 0.86rem;
    white-space: nowrap;
  }

  pre {
    font-size: 0.78rem;
    max-height: 260px;
  }

  canvas {
    min-height: 230px;
  }

  .foot {
    min-height: 58px;
    padding: 14px 10px;
    text-align: center;
    font-size: 0.9rem;
  }
}

