/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.hamburger-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  color: var(--text);
  width: 38px; height: 38px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .15s ease;
  flex-shrink: 0;
}
.hamburger-btn:hover {
  border-color: var(--amber);
  color: var(--amber);
}
.hamburger-btn svg { width: 20px; height: 20px; }

.brand-mark {
  width: 38px; height: 38px; border-radius: 8px;
  background: linear-gradient(155deg, var(--amber), #c9791a);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(245,166,35,0.35), 0 4px 14px rgba(245,166,35,0.18);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-text h1 {
  font-family: var(--font-display); font-weight: 700; font-size: 21px;
  margin: 0; letter-spacing: 0.2px; line-height: 1;
}
.brand-text p { margin: 3px 0 0; font-size: 12px; color: var(--text-muted); }

.user-greeting-chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600;
  color: var(--amber); background: var(--amber-soft); border: 1px solid rgba(245,166,35,0.3);
  padding: 6px 14px; border-radius: 20px; cursor: pointer; transition: all .15s ease;
}
.user-greeting-chip:hover {
  background: rgba(245,166,35,0.25);
  border-color: var(--amber);
}

.status-chip {
  display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-muted);
  font-family: var(--font-mono);
  border: 1px solid var(--border); padding: 6px 11px; border-radius: 20px;
  background: var(--bg-elevated);
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 8px var(--green); animation: blink 2.4s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0.35;} }

/* Sidebar Drawer */
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(13,21,29,0.75);
  backdrop-filter: blur(4px); z-index: 1000;
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.sidebar-overlay.open { opacity: 1; pointer-events: auto; }

.sidebar-drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 280px;
  background: var(--bg-elevated); border-right: 1px solid var(--border-bright);
  z-index: 1001; transform: translateX(-100%); transition: transform .25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex; flex-direction: column; padding: 20px;
  box-shadow: 10px 0 30px rgba(0,0,0,0.5);
}
.sidebar-drawer.open { transform: translateX(0); }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 16px; border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.sidebar-close-btn {
  background: none; border: none; color: var(--text-muted); padding: 4px;
  cursor: pointer; transition: color .15s;
}
.sidebar-close-btn:hover { color: var(--amber); }

.sidebar-nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.sidebar-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 6px; color: var(--text-muted); font-size: 14px; font-weight: 600;
  background: transparent; border: none; width: 100%; text-align: left;
  transition: all .15s ease; cursor: pointer;
}
.sidebar-item svg { width: 18px; height: 18px; opacity: 0.75; flex-shrink: 0; }
.sidebar-item:hover { background: var(--bg-card-hover); color: var(--text); }
.sidebar-item.active { background: var(--amber-soft); color: var(--amber); }
.sidebar-item.active svg { opacity: 1; }

.sidebar-footer {
  padding-top: 16px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-dim); text-align: center;
}

/* Modal Popup */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(13,21,29,0.85);
  backdrop-filter: blur(6px); z-index: 2000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity .25s ease;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-card {
  background: var(--bg-card); border: 1px solid var(--border-bright);
  border-radius: 8px; width: 100%; max-width: 480px; padding: 26px;
  position: relative; box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  transform: scale(0.95); transition: transform .25s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-overlay.open .modal-card { transform: scale(1); }
.modal-close-btn {
  position: absolute; top: 16px; right: 16px; background: none; border: none;
  color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px;
}
.modal-close-btn:hover { color: var(--amber); }

/* Horizontal Tabs Header */
.tabs {
  display: flex; gap: 4px; margin: 18px 0 26px; overflow-x: auto;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-btn {
  background: none; border: none; color: var(--text-muted);
  font-size: 14px; font-weight: 600; padding: 11px 15px;
  border-bottom: 2px solid transparent; white-space: nowrap;
  transition: color .15s ease, border-color .15s ease;
  display: flex; align-items: center; gap: 7px;
}
.tab-btn svg { width: 15px; height: 15px; opacity: 0.75; flex-shrink: 0; }
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: var(--amber); border-bottom-color: var(--amber); }
.tab-btn.active svg { opacity: 1; }

/* Cards & Layout */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
}
.card + .card { margin-top: 14px; }
.corner { position: absolute; width: 9px; height: 9px; border: 1.5px solid var(--amber); opacity: 0.55; }
.corner.tl { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.corner.br { bottom: -1px; right: -1px; border-left: none; border-top: none; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* How It Works Steps */
.step-card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 6px; padding: 18px; position: relative;
}
.step-num {
  font-family: var(--font-mono); font-weight: 700; font-size: 14px;
  color: var(--amber); background: var(--amber-soft); width: 28px; height: 28px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px; border: 1px solid rgba(245,166,35,0.3);
}
.step-card h4 { font-family: var(--font-display); font-size: 16px; margin: 0 0 6px; font-weight: 700; }
.step-card p { font-size: 13px; color: var(--text-muted); margin: 0; line-height: 1.5; }

/* Toast */
#toast-container {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 3000; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
  background: var(--bg-elevated); border: 1px solid var(--border-bright); color: var(--text);
  padding: 11px 18px; border-radius: 6px; font-size: 13.5px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: toast-in .25s ease; display: flex; align-items: center; gap: 9px;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Home Hero */
.hero {
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 34px; align-items: center;
  padding: 38px 0 30px;
}
@media(max-width: 820px) { .hero { grid-template-columns: 1fr; } }
.hero h1 {
  font-family: var(--font-display); font-size: 44px; line-height: 1.08; font-weight: 700;
  margin: 0 0 16px; letter-spacing: -0.5px;
}
.hero h1 .hl { color: var(--amber); }
.hero p.lede { font-size: 16px; color: var(--text-muted); line-height: 1.6; margin: 0 0 24px; max-width: 480px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.stat-row { display: flex; gap: 0; margin-top: 30px; border-top: 1px solid var(--border); padding-top: 20px; }
.stat { flex: 1; padding-right: 16px; }
.stat b { font-family: var(--font-mono); font-size: 22px; display: block; color: var(--amber); }
.stat span { font-size: 12px; color: var(--text-muted); }
.hero-visual {
  position: relative; aspect-ratio: 1/1; border-radius: 8px; border: 1px solid var(--border);
  background: radial-gradient(circle at 50% 50%, rgba(245,166,35,0.07), transparent 65%), var(--bg-card);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.pulse-ring {
  position: absolute; border: 2px solid var(--red); border-radius: 50%;
  animation: pulse-grow 2.6s ease-out infinite;
}
.pulse-ring.r2 { animation-delay: 0.9s; }
.pulse-ring.r3 { animation-delay: 1.8s; }
@keyframes pulse-grow {
  0% { width: 40px; height: 40px; opacity: 0.9; }
  100% { width: 280px; height: 280px; opacity: 0; }
}
.hero-visual-inner { position: relative; z-index: 2; text-align: center; }
.hero-visual-tag {
  font-family: var(--font-mono); font-size: 11px; color: var(--red); letter-spacing: 1px;
  margin-top: 14px; border: 1px solid var(--red); padding: 5px 12px; border-radius: 20px;
  background: rgba(232,73,93,0.08);
}
.feature-grid { margin-top: 6px; }
.feature-card h3 { font-family: var(--font-display); font-size: 17px; margin: 12px 0 6px; font-weight: 700; }
.feature-card p { font-size: 13.5px; color: var(--text-muted); line-height: 1.55; margin: 0; }
.feature-icon {
  width: 34px; height: 34px; border-radius: 7px; display: flex; align-items: center; justify-content: center;
}
.feature-icon svg { width: 17px; height: 17px; }

/* Camera Capture & AR Overlay */
.capture-zone {
  border: 1px dashed var(--border-bright); border-radius: 6px;
  background: var(--bg-elevated);
  min-height: 340px; display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden; cursor: pointer;
}
.capture-zone.has-image { cursor: default; border-style: solid; }
.capture-zone img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.capture-empty { text-align: center; color: var(--text-muted); padding: 20px; position: relative; z-index: 2; }
.capture-empty svg { width: 38px; height: 38px; margin-bottom: 10px; opacity: 0.55; }
.capture-empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

.ar-overlay { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.ar-corner-frame { position: absolute; width: 26px; height: 26px; opacity: 0.85; }
.ar-corner-frame.c1 { top: 14px; left: 14px; border-top: 2px solid var(--teal); border-left: 2px solid var(--teal); }
.ar-corner-frame.c2 { top: 14px; right: 14px; border-top: 2px solid var(--teal); border-right: 2px solid var(--teal); }
.ar-corner-frame.c3 { bottom: 14px; left: 14px; border-bottom: 2px solid var(--teal); border-left: 2px solid var(--teal); }
.ar-corner-frame.c4 { bottom: 14px; right: 14px; border-bottom: 2px solid var(--teal); border-right: 2px solid var(--teal); }
.ar-danger-ring {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 150px; height: 150px; border-radius: 50%;
  border: 3px solid var(--red);
  box-shadow: 0 0 0 0 rgba(232,73,93,0.55);
  animation: ar-pulse 1.8s ease-out infinite;
}
@keyframes ar-pulse {
  0% { box-shadow: 0 0 0 0 rgba(232,73,93,0.5); }
  70% { box-shadow: 0 0 0 26px rgba(232,73,93,0); }
  100% { box-shadow: 0 0 0 0 rgba(232,73,93,0); }
}
.ar-danger-label {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  font-family: var(--font-mono); font-weight: 700; font-size: 12px; letter-spacing: 1px;
  color: #fff; background: var(--red); padding: 6px 12px; border-radius: 3px;
  box-shadow: 0 4px 14px rgba(232,73,93,0.4);
}
.ar-readout {
  position: absolute; top: 14px; left: 50%; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 11px; color: var(--teal);
  background: rgba(13,21,29,0.7); padding: 4px 10px; border-radius: 3px; border: 1px solid rgba(45,212,191,0.4);
}
.capture-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.kv-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; gap: 16px; }
.kv-row:last-child { border-bottom: none; }
.kv-row .k { color: var(--text-muted); flex-shrink: 0; }
.kv-row .v { text-align: right; font-weight: 600; }
.advisory-box {
  margin-top: 14px; border-left: 3px solid var(--red); background: var(--red-soft);
  padding: 12px 14px; border-radius: 0 4px 4px 0; font-size: 13.5px; line-height: 1.5;
}
.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.25); border-top-color: currentColor;
  border-radius: 50%; animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Indoor Assistant */
.diy-step { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.diy-step:last-child { border-bottom: none; }
.diy-step .num {
  font-family: var(--font-mono); font-weight: 700; color: var(--green); flex-shrink: 0;
  width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--green);
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.diy-step p { margin: 0; font-size: 14px; line-height: 1.5; padding-top: 3px; }
.electrician-card {
  display: flex; justify-content: space-between; align-items: center;
  padding: 13px 0; border-bottom: 1px solid var(--border); gap: 12px;
}
.electrician-card:last-child { border-bottom: none; }
.electrician-name { font-weight: 700; font-size: 14.5px; }
.electrician-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.emergency-banner {
  background: var(--red); color: #fff; padding: 16px 18px; border-radius: 4px;
  display: flex; gap: 14px; align-items: flex-start; margin-bottom: 16px;
}
.emergency-banner svg { width: 26px; height: 26px; flex-shrink: 0; }
.emergency-banner b { font-family: var(--font-display); font-size: 17px; display: block; margin-bottom: 3px; }
.emergency-banner p { margin: 0; font-size: 13.5px; opacity: 0.92; line-height: 1.5; }

/* Predictor */
.risk-meter {
  height: 14px; border-radius: 20px; background: var(--bg-elevated); border: 1px solid var(--border);
  overflow: hidden; margin: 10px 0 6px;
}
.risk-meter-fill { height: 100%; border-radius: 20px; transition: width .4s ease, background .4s ease; }
.sector-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
@media(max-width: 600px) { .sector-grid { grid-template-columns: repeat(2, 1fr); } }
.sector-tile {
  border: 1px solid var(--border); border-radius: 4px; padding: 12px; text-align: center; cursor: pointer;
  transition: border-color .15s;
}
.sector-tile.selected { border-color: var(--amber); }
.sector-tile b { display: block; font-family: var(--font-mono); font-size: 20px; }
.sector-tile span { font-size: 11px; color: var(--text-muted); }
.briefing-box {
  margin-top: 16px; background: var(--bg-elevated); border: 1px solid var(--teal); border-radius: 4px;
  padding: 14px 16px; font-size: 14px; line-height: 1.6;
}
.briefing-box .tag { font-family: var(--font-mono); font-size: 11px; color: var(--teal); letter-spacing: 1px; display: block; margin-bottom: 6px; }

/* Rewards */
.points-hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.points-value { font-family: var(--font-display); font-size: 48px; font-weight: 700; color: var(--amber); line-height: 1; }
.points-value span { font-size: 16px; color: var(--text-muted); font-family: var(--font-body); font-weight: 600; }
.leaderboard-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.leaderboard-row:last-child { border-bottom: none; }
.lb-rank { font-family: var(--font-mono); color: var(--text-muted); width: 22px; }
.lb-name { flex: 1; font-weight: 600; font-size: 14px; }
.lb-points { font-family: var(--font-mono); color: var(--amber); font-weight: 700; }
.report-row { padding: 12px 0; border-bottom: 1px solid var(--border); }
.report-row:last-child { border-bottom: none; }
.report-row-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.report-row-top b { font-size: 14px; }
.report-row .meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* Ops Dashboard Table */
table.ops-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.ops-table th {
  text-align: left; color: var(--text-muted); font-weight: 600; font-size: 11.5px;
  padding: 8px 10px; border-bottom: 1px solid var(--border-bright); white-space: nowrap;
}
table.ops-table td { padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.ops-table tr:last-child td { border-bottom: none; }
.filter-row { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.filter-row select { width: auto; }
.table-scroll { overflow-x: auto; }

@media(max-width: 600px) {
  .hero h1 { font-size: 32px; }
  .points-value { font-size: 36px; }
}
