* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Segoe UI", Arial, sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  min-height: 100vh;
}

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

.page-main {
  flex: 1;
}

.accent { color: #f5a623; }
.muted { color: #888; font-size: 0.9rem; }
.hidden { display: none !important; }

.top-header {
  flex: 0 0 auto;
  background: #000;
  border-bottom: 1px solid #222;
  height: 120px;
  padding: 0 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo-left-container,
.logo-center-container,
.header-right {
  flex: 1;
  display: flex;
  align-items: center;
}

.logo-left-container { justify-content: flex-start; }
.logo-center-container { justify-content: center; }
.header-right { justify-content: flex-end; gap: 10px; font-size: 13px; color: #9ca3af; }

#dealer-logo {
  height: 90px;
  max-width: 240px;
  width: auto;
  object-fit: contain;
}

#security-logo {
  height: 100px;
  width: auto;
  object-fit: contain;
}

.login-logo {
  display: block;
  height: 100px;
  width: auto;
  margin: 0 auto 16px;
}

.login-screen {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.login-box {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 32px;
  width: 100%;
  max-width: 380px;
}
.login-box h2 { margin-bottom: 6px; }
.login-subtitle { color: #888; margin-bottom: 20px; font-size: 0.9rem; }
.login-box input[type="email"],
.login-box input[type="password"],
.select,
.code-row input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #111;
  color: #eee;
  font-size: 15px;
}
.password-wrap { position: relative; }
.password-wrap input { padding-right: 64px; margin-bottom: 12px; }
.toggle-pass {
  position: absolute;
  right: 8px;
  top: 8px;
  background: none;
  border: none;
  color: #f5a623;
  cursor: pointer;
  font-size: 12px;
}
.remember-me { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: #aaa; margin-bottom: 16px; }

.btn {
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-full { width: 100%; }
.btn-primary { background: #f5a623; color: #111; }
.btn-secondary { background: #333; color: #eee; border: 1px solid #555; }
.btn-small { padding: 6px 12px; font-size: 12px; }
.btn-danger { background: #ef4444; color: #fff; }
.whoami { color: #fff; font-weight: 500; text-align: right; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.error-msg { color: #ef4444; margin-top: 12px; font-size: 0.9rem; min-height: 1.2em; }

.container { max-width: 720px; margin: 0 auto; padding: 20px; }

.sub-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
  background: #1f2937;
  border-bottom: 1px solid #374151;
}

.menu-btn {
  background: none;
  border: 1px solid #374151;
  color: #fff;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.1rem;
}

.sub-nav-title {
  font-weight: 700;
  color: #fff;
}

.workspace {
  display: flex;
  min-height: calc(100vh - 176px);
  position: relative;
}

.sidebar {
  width: 220px;
  background: #111827;
  border-right: 1px solid #374151;
  padding: 12px 0;
  flex-shrink: 0;
}

.sidebar .nav-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: #9ca3af;
  padding: 12px 20px;
  cursor: pointer;
  font-size: 0.95rem;
}

.sidebar .nav-item:hover,
.sidebar .nav-item.active {
  background: rgba(245, 166, 35, 0.15);
  color: #f5a623;
  border-left: 3px solid #f5a623;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 40;
}

.sidebar-backdrop.active {
  display: block;
}

.workspace-main {
  flex: 1;
  overflow-y: auto;
}

.view-panel.hidden { display: none !important; }

.input {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 12px;
  border: 1px solid #444;
  border-radius: 6px;
  background: #111;
  color: #eee;
  font-size: 15px;
}

.remember-code {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.85rem;
  color: #aaa;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 0.9rem;
}

.sms-disclosure {
  font-size: 0.75rem;
  color: #aaa;
  line-height: 1.5;
  margin: 8px 0;
  padding: 8px;
  border: 1px solid rgba(245, 166, 35, 0.35);
  border-radius: 6px;
  background: rgba(245, 166, 35, 0.08);
}

.sec-users-list { display: flex; flex-direction: column; gap: 8px; }
.sec-user-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: 100%;
  text-align: left;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #333;
  background: #111;
  color: #eee;
  cursor: pointer;
}
.sec-user-name { font-weight: 700; }
.sec-user-meta { font-size: 0.85rem; color: #888; }
.sec-user-form { display: flex; flex-direction: column; gap: 4px; }
.row-actions {
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.field-label { display: block; font-size: 0.75rem; color: #888; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.select { flex: 1; min-width: 200px; margin-bottom: 0; }

.card {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 16px;
}
.card h2 { font-size: 1rem; margin-bottom: 12px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-header h2 { margin-bottom: 0; }

.banner {
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  border: 1px solid #444;
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
}
.banner.ok { background: rgba(16, 185, 129, 0.1); border-color: #10b981; color: #6ee7b7; }
.banner.err { background: rgba(239, 68, 68, 0.1); border-color: #ef4444; color: #fca5a5; }

.arm-status {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 6px;
  text-transform: capitalize;
}
.arm-meta { color: #888; font-size: 0.85rem; margin-bottom: 16px; }
.arm-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.arm-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 92px;
  padding: 12px 10px;
  border-radius: 10px;
  border: 1px solid #444;
  background: #222;
  color: #eee;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.arm-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.arm-btn:not(:disabled):active { transform: scale(0.98); }

.arm-btn-away {
  background: rgba(245, 166, 35, 0.14);
  border-color: #f5a623;
  color: #f5a623;
}

.arm-btn-stay {
  background: rgba(148, 163, 184, 0.12);
  border-color: #64748b;
  color: #cbd5e1;
}

.arm-btn-disarm {
  background: rgba(239, 68, 68, 0.14);
  border-color: #ef4444;
  color: #fca5a5;
}

.arm-icon {
  width: 34px;
  height: 34px;
}

.arm-label {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.code-row { max-width: 220px; }
.status-msg { margin-top: 10px; font-size: 0.85rem; padding: 8px 10px; border-radius: 6px; }
.status-msg.ok { background: rgba(16, 185, 129, 0.15); color: #6ee7b7; }
.status-msg.err { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #333;
  font-size: 0.8rem;
  color: #ccc;
}

.zones-list { display: flex; flex-direction: column; gap: 8px; }
.zone-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #111;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
}
.zone-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.zone-bypass-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #cbd5e1;
  white-space: nowrap;
}
.zone-name { font-weight: 600; }
.zone-status { font-size: 0.85rem; color: #aaa; text-transform: capitalize; }
.zone-status.open, .zone-status.alarm { color: #ef4444; }

.site-footer {
  flex: 0 0 auto;
  margin-top: auto;
  padding: 1.5rem 20px 1.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.site-footer-powered {
  color: #fff;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.site-footer-version {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.75rem;
  opacity: 0.6;
  font-family: monospace;
}

.site-footer-copy {
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.7rem;
  margin-top: 0.5rem;
}

@media (max-width: 520px) {
  .top-header {
    height: 80px;
    padding: 0 15px;
  }

  #dealer-logo {
    height: 60px;
    max-width: 140px;
  }

  #security-logo {
    height: 70px;
  }

  .header-right {
    font-size: 11px;
  }

  .header-right .btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 50;
    margin-left: -220px;
    transition: margin-left 0.25s ease;
  }

  .sidebar.open {
    margin-left: 0;
  }

  .arm-actions {
    gap: 8px;
  }

  .arm-btn {
    min-height: 84px;
    padding: 10px 6px;
  }

  .arm-icon {
    width: 30px;
    height: 30px;
  }
}
