:root {
  --deep: #0a3d40;
  --deep2: #062c2e;
  --accent: #c9a227;
  --accent-light: #e6c35c;
  --danger: #c0392b;
  --danger-glow: #e74c3c;
  --safe: #1e8449;
  --cream: #f8f4ec;
  --ink: #1a2e30;
  --muted: #5a6e70;
  --card: #ffffff;
  --glass: rgba(255, 250, 241, 0.92);
  --shadow: 0 20px 50px rgba(10, 61, 64, 0.12);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: linear-gradient(160deg, #f8f4ec 0%, #eef6f4 100%);
  color: var(--ink);
  font-family: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  min-height: 100vh;
  line-height: 1.7;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
a { color: var(--deep); text-decoration: none; }
img { max-width: 100%; height: auto; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }

.shell { width: min(1100px, calc(100% - 32px)); margin-inline: auto; }
.skip-link { position: absolute; right: -9999px; top: 8px; background: white; padding: 12px 16px; z-index: 100; border-radius: 8px; }
.skip-link:focus { right: 16px; }

.site-header {
  position: sticky; top: 0; z-index: 30;
  background: rgba(10, 61, 64, 0.96);
  backdrop-filter: blur(16px);
  color: white;
  border-bottom: 2px solid var(--accent);
}
.header-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-thumb { width: 52px; height: 52px; border-radius: 14px; overflow: hidden; border: 2px solid var(--accent); flex-shrink: 0; }
.brand-thumb img { width: 100%; height: 100%; object-fit: cover; }
.brand-copy strong { display: block; font-size: 1.25rem; font-weight: 800; color: var(--accent-light); }
.brand-copy span { font-size: 0.75rem; opacity: 0.85; }
.header-status { font-size: 0.8rem; padding: 4px 10px; border-radius: 20px; background: rgba(255,255,255,0.12); }
.header-status.online { background: rgba(30, 132, 73, 0.3); }
.header-status.alarm { background: var(--danger); animation: pulse 1s infinite; }
.install-btn { background: var(--accent); color: var(--deep); border: none; padding: 8px 16px; border-radius: 12px; font-weight: 700; }

.official-logos { background: white; border-bottom: 1px solid #e8e4dc; padding: 12px 0; }
.logos-inner { display: flex; justify-content: center; align-items: center; gap: 28px; flex-wrap: wrap; }
.logos-inner img { height: 52px; width: auto; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0,0,0,0.08)); }

.main-content { min-height: 60vh; padding: 28px 0 60px; }
.loading-panel { text-align: center; padding: 60px 20px; color: var(--muted); }

.hero {
  background: linear-gradient(135deg, var(--deep) 0%, #0d4f54 100%);
  color: white;
  border-radius: var(--radius);
  padding: 36px 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -40px; left: -40px;
  width: 180px; height: 180px;
  background: radial-gradient(circle, rgba(201,162,39,0.25) 0%, transparent 70%);
  border-radius: 50%;
}
.hero h1 { margin: 0 0 8px; font-size: 1.8rem; font-weight: 800; color: var(--accent-light); }
.hero p { margin: 0; opacity: 0.9; max-width: 640px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin: 20px 0; }
.info-card {
  background: var(--card);
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(10,61,64,0.06);
  border: 1px solid #e8ecea;
}
.info-card h3 { margin: 0 0 8px; color: var(--deep); font-size: 1.1rem; }
.info-card p { margin: 0; color: var(--muted); font-size: 0.92rem; }

.alarm-panel {
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  margin: 20px 0;
  border: 2px solid #e8ecea;
  box-shadow: var(--shadow);
}
.alarm-panel.alert-active {
  border-color: var(--danger);
  background: linear-gradient(180deg, #fff8f8 0%, white 40%);
  animation: glow 2s ease-in-out infinite;
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192,57,43,0.2); }
  50% { box-shadow: 0 0 30px 8px rgba(192,57,43,0.25); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 14px 24px;
  font-weight: 700;
  font-size: 1rem;
  transition: transform 0.1s, box-shadow 0.2s;
}
.btn:active { transform: scale(0.98); }
.btn-main { background: var(--deep); color: white; }
.btn-danger { background: var(--danger); color: white; font-size: 1.15rem; padding: 18px 32px; box-shadow: 0 8px 20px rgba(192,57,43,0.3); }
.btn-danger:hover { background: #a93226; }
.btn-safe { background: var(--safe); color: white; }
.btn-outline { background: transparent; border: 2px solid var(--deep); color: var(--deep); }
.btn-gold { background: var(--accent); color: var(--deep); }

.role-selector { display: flex; gap: 12px; margin: 16px 0; flex-wrap: wrap; }
.role-btn { flex: 1; min-width: 140px; padding: 16px; border-radius: 14px; border: 2px solid #ddd; background: white; font-weight: 700; }
.role-btn.active { border-color: var(--deep); background: var(--deep); color: white; }

.pin-input { font-size: 1.4rem; letter-spacing: 0.4em; text-align: center; padding: 12px; border-radius: 12px; border: 2px solid #ccc; width: 100%; max-width: 220px; }

.status-badge { display: inline-block; padding: 6px 14px; border-radius: 20px; font-weight: 700; font-size: 0.85rem; }
.status-safe { background: #e8f6ef; color: var(--safe); }
.status-alarm { background: #fdeaea; color: var(--danger); animation: pulse 1.2s infinite; }

.assembly-box {
  background: linear-gradient(135deg, #fef9e7 0%, #fdebd0 100%);
  border: 2px solid var(--accent);
  border-radius: 16px;
  padding: 20px;
  margin: 16px 0;
}
.assembly-box h3 { margin: 0 0 8px; color: #7d6608; }
.checklist { list-style: none; padding: 0; margin: 12px 0; }
.checklist li { padding: 8px 0; border-bottom: 1px solid #eee; display: flex; align-items: flex-start; gap: 10px; }
.checklist li::before { content: '☐'; font-size: 1.2rem; color: var(--deep); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--deep); color: white; padding: 12px 24px; border-radius: 30px;
  opacity: 0; pointer-events: none; transition: opacity 0.3s; z-index: 100;
  max-width: 90%; text-align: center;
}
.toast.visible { opacity: 1; }

dialog { border: none; border-radius: 20px; padding: 0; max-width: 480px; width: 90%; box-shadow: 0 30px 80px rgba(0,0,0,0.25); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid #eee; }
.dialog-head h2 { margin: 0; font-size: 1.2rem; }
.close-btn { background: none; border: none; font-size: 1.6rem; cursor: pointer; }
.dialog-body { padding: 20px; }
.dialog-footer { padding: 12px 20px; border-top: 1px solid #eee; text-align: left; }

.site-footer { background: var(--deep2); color: #ccc; padding: 28px 0; margin-top: 40px; font-size: 0.85rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-credits p { margin: 4px 0; }
.credit-label { color: var(--accent); }
.footer-legal a { color: var(--accent-light); }

@media (max-width: 690px) {
  .hero { padding: 24px 20px; }
  .hero h1 { font-size: 1.45rem; }
  .header-inner { flex-wrap: wrap; }
  .brand-copy strong { font-size: 1.05rem; }
  .btn-danger { width: 100%; }
  .role-selector { flex-direction: column; }
}
