
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --navy: #0D2340;
  --blue: #0878E8;
  --blue-dark: #0755B4;
  --background: #F3F7FC;
  --white: #FFFFFF;
  --text: #1B2D43;
  --muted: #6B7C91;
  --border: #E1E9F2;
  --green: #15965C;
  --amber: #D98B12;
  --red: #D83E49;
  --purple: #7651CC;
  --radius: 18px;
  --shadow: 0 5px 22px rgba(13,35,64,.07);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', Arial, sans-serif;
  background: var(--background);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input {
  font: inherit;
}

button:focus-visible, a:focus-visible,
input:focus-visible {
  outline: 3px solid #65AEFF;
  outline-offset: 3px;
}

.topbar {
  background: var(--navy);
  color: white;
  min-height: 78px;
  padding: 12px max(5%, calc((100% - 1180px)/2));
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.brand-icon {
  background: var(--blue);
  width: 43px;
  height: 43px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 27px;
}

.brand small {
  display: block;
  color: #BDD5F0;
  font-size: 11px;
}

.nav {
  display: flex;
  gap: 8px;
}

.nav a {
  padding: 10px 15px;
  border-radius: 10px;
  color: #D9E7F8;
  font-size: 13px;
  font-weight: 600;
}

.nav a:hover, .nav a.active {
  background: var(--blue);
  color: white;
}

.menu-btn {
  display: none;
  border: 0;
  background: transparent;
  color: white;
  font-size: 26px;
  cursor: pointer;
}

.container {
  max-width: 1180px;
  width: 90%;
  margin: 35px auto;
}

.welcome {
  background: linear-gradient(115deg, #0D2340, #075BB8);
  border-radius: 24px;
  padding: 45px;
  color: white;
  min-height: 290px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 25px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(7,85,180,.18);
}

.welcome-content {
  max-width: 600px;
}

.eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.6px;
  color: var(--blue);
}

.welcome .eyebrow {
  color: #7BC5FF;
}

.welcome h1 {
  font-size: clamp(29px, 4vw, 43px);
  line-height: 1.15;
  margin: 12px 0;
}

.welcome p {
  color: #D7E7F7;
  font-size: 14px;
  max-width: 440px;
  margin-bottom: 23px;
}

.welcome-art {
  width: 230px;
  height: 190px;
  flex-shrink: 0;
  border: 1px solid #76B9F8;
  background: rgba(255,255,255,.08);
  border-radius: 40% 60% 50% 50%;
  display: grid;
  place-items: center;
  color: #C9E8FF;
}

.glasses {
  font-size: 85px;
}

.welcome-art span {
  font-size: 10px;
  letter-spacing: 3px;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  border: 0;
  padding: 13px 20px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: .2s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--blue);
  color: white;
}

.btn-primary:hover {
  background: var(--blue-dark);
}

.btn-outline {
  background: white;
  color: var(--blue);
  border: 1px solid var(--border);
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 15px;
  margin: 32px 0 18px;
}

.section-heading h2, .settings-card h2 {
  font-size: 19px;
  margin-top: 4px;
}

.live-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}

.live-label i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px #D9F5E7;
}

.stats-grid, .monitor-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.monitor-grid {
  grid-template-columns: repeat(3, 1fr);
  margin: 20px 0;
}

.stat-card, .settings-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 24px;
  margin-bottom: 17px;
}

.blue { background: #E2F0FF; color: var(--blue); }
.purple { background: #EEE8FF; color: var(--purple); }
.green { background: #E1F6EA; color: var(--green); }

.stat-label, .stat-note {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.stat-card > strong {
  display: block;
  font-size: 27px;
  margin: 7px 0;
  color: var(--navy);
}

.stat-card strong small {
  font-size: 13px;
  color: var(--muted);
}

.status-text {
  font-size: 17px !important;
}

.progress-track {
  height: 7px;
  background: #E8EEF5;
  border-radius: 20px;
  overflow: hidden;
  margin-top: 12px;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: var(--green);
  border-radius: 20px;
  transition: width .3s;
}

.quick-section {
  margin-top: 36px;
}

.quick-section h2 {
  font-size: 20px;
  margin: 5px 0 16px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.quick-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.quick-card:hover {
  border-color: var(--blue);
}

.quick-card > span:nth-child(2) {
  flex: 1;
}

.quick-card small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.quick-card > b {
  color: var(--blue);
}

.quick-icon, .large-icon {
  width: 47px;
  height: 47px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: #E7F2FF;
  color: var(--blue);
  font-size: 25px;
}

.connection-message, .feedback {
  margin-top: 18px;
  font-size: 12px;
  color: var(--muted);
}

.page-content {
  max-width: 950px;
}

.page-heading {
  margin-bottom: 25px;
}

.page-heading h1 {
  font-size: 31px;
  color: var(--navy);
  margin: 5px 0;
}

.page-heading p {
  color: var(--muted);
  font-size: 13px;
}

.settings-card {
  margin-bottom: 19px;
}

.card-heading {
  display: flex;
  gap: 15px;
  align-items: center;
  margin-bottom: 22px;
}

.card-heading p {
  font-size: 12px;
  color: var(--muted);
}

.sensitivity-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.sensitivity {
  border: 1px solid var(--border);
  background: #F8FAFD;
  border-radius: 13px;
  padding: 15px 8px;
  color: var(--text);
  display: grid;
  gap: 4px;
  justify-items: center;
  cursor: pointer;
}

.sensitivity span {
  color: var(--blue);
  font-size: 24px;
}

.sensitivity small {
  color: var(--muted);
  font-size: 10px;
}

.sensitivity.selected {
  background: #E8F2FF;
  border: 2px solid var(--blue);
  color: var(--blue-dark);
}

.help-text {
  font-size: 11px;
  color: var(--muted);
  margin-top: 15px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.setting-row small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.switch {
  position: relative;
  display: inline-block;
  width: 55px;
  height: 30px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: #B8C5D3;
  border-radius: 30px;
  cursor: pointer;
  transition: .2s;
}

.switch-slider::before {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 4px;
  bottom: 4px;
  background: white;
  border-radius: 50%;
  transition: .2s;
}

.switch input:checked + .switch-slider {
  background: var(--blue);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(25px);
}

.field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

input[type="tel"] {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #FAFCFF;
  color: var(--text);
}

.save-btn {
  width: 100%;
}

.feedback {
  min-height: 20px;
}

.feedback.error { color: var(--red); }
.feedback.success { color: var(--green); }

.monitor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}

.status-panel {
  display: flex;
  align-items: center;
  gap: 18px;
  background: #E4F7EB;
  border: 1px solid #C5EBD4;
  padding: 23px;
  border-radius: var(--radius);
  margin: 18px 0;
  color: #126A40;
}

.status-panel.attention {
  background: #FFF4DA;
  border-color: #F1D99C;
  color: #855600;
}

.status-panel.critical {
  background: #FCE6E8;
  border-color: #F0C1C5;
  color: #A52231;
}

.status-symbol {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: white;
  font-size: 23px;
  flex-shrink: 0;
}

.status-panel h2 {
  font-size: 20px;
}

.status-panel p {
  font-size: 12px;
}

.chart-wrap {
  width: 100%;
  height: 250px;
  margin-top: 20px;
}

#historyChart {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 25px;
  font-size: 11px;
  color: var(--muted);
}

.chart-legend span {
  display: flex;
  align-items: center;
  gap: 7px;
}

.chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.legend-blue { background: var(--blue); }
.legend-purple { background: var(--purple); }

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.detail-row:last-child {
  border: 0;
}

.detail-row span { color: var(--muted); }

footer {
  margin-top: 55px;
  padding: 25px 5%;
  text-align: center;
  background: var(--navy);
  color: white;
  font-size: 12px;
}

footer span {
  display: block;
  color: #BBD0E8;
  font-size: 11px;
}

@media (max-width: 850px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .monitor-grid { grid-template-columns: repeat(2, 1fr); }
  .welcome-art { width: 150px; height: 150px; }
}

@media (max-width: 600px) {
  .topbar { padding: 12px 5%; flex-wrap: wrap; }
  .menu-btn { display: block; }
  .nav {
    display: none;
    width: 100%;
    flex-direction: column;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px; }
  .container { width: 92%; margin: 22px auto; }
  .welcome { padding: 27px 22px; min-height: auto; }
  .welcome-art { display: none; }
  .welcome h1 { font-size: 30px; }
  .stats-grid, .monitor-grid, .quick-grid {
    grid-template-columns: 1fr;
  }
  .section-heading { align-items: start; flex-direction: column; }
  .sensitivity-options { gap: 6px; }
  .sensitivity { padding: 12px 3px; font-size: 12px; }
  .page-heading h1 { font-size: 27px; }
  .settings-card { padding: 17px; }
  .monitor-toolbar { flex-wrap: wrap; }
  .chart-wrap { height: 210px; }
}
