@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700&family=Inter:wght@300;400;500;600&display=swap');

/* ── Reset & Variables ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --navy:   #0D1B2A;
  --navy2:  #162436;
  --navy3:  #1E3A50;
  --orange: #FF6B35;
  --teal:   #028090;
  --green:  #02C39A;
  --amber:  #F6AD55;
  --red:    #E53E3E;
  --blue:   #3B8BD4;
  --muted:  #8FA3B1;
  --white:  #FFFFFF;
  --off:    #F5F7FA;
  --card:   #FFFFFF;
  --border: #E5EBF0;
  --text:   #1A2A3A;
  --sub:    #64748B;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--off);
  color: var(--text);
  min-height: 100vh;
}

/* ── Layout ── */
.shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: 220px;
  background: var(--navy);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.main {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ── Sidebar ── */
.sb-brand {
  padding: 22px 18px 16px;
  border-bottom: 1px solid var(--navy3);
}

.sb-logo {
  font-family: 'Sora', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
}

.sb-logo span {
  color: var(--orange);
}

.sb-sub {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.04em;
}

.sb-nav {
  padding: 12px 10px;
  flex: 1;
}

.sb-section {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--navy3);
  padding: 8px 8px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--white);
}

.nav-item.active {
  background: rgba(255, 107, 53, 0.15);
  color: var(--orange);
}

.nav-item .ni {
  font-size: 15px;
  width: 18px;
  text-align: center;
}

.sb-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--navy3);
}

.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sb-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--white);
  flex-shrink: 0;
}

.sb-uname {
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
}

.sb-urole {
  font-size: 10px;
  color: var(--muted);
  margin-top: 1px;
}

/* ── Topbar ── */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.topbar-title {
  font-family: 'Sora', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 20px;
  background: #E8F8F4;
  color: #02C39A;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #02C39A;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.trigger-alert {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 20px;
  background: #FFF1EB;
  color: var(--orange);
  cursor: pointer;
  transition: all 0.2s;
}

.trigger-alert:hover {
  background: #FFE4D5;
}

/* ── Content ── */
.content {
  padding: 24px 28px;
  flex: 1;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
}

.card-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sub);
  margin-bottom: 14px;
}

/* ── Grid helpers ── */
.g4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.g3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.g2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* ── Metric cards ── */
.metric {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}

.metric-label {
  font-size: 11px;
  color: var(--sub);
  margin-bottom: 6px;
  font-weight: 500;
}

.metric-val {
  font-family: 'Sora', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.metric-sub {
  font-size: 11px;
  margin-top: 4px;
}

.metric-up   { color: var(--green); }
.metric-down { color: var(--red);   }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}

.b-green  { background: #E6F9F4; color: #027A5B; }
.b-orange { background: #FFF1EB; color: #C94F1A; }
.b-blue   { background: #EBF4FD; color: #0E5A9A; }
.b-red    { background: #FDECEC; color: #B91C1C; }
.b-amber  { background: #FEF6E6; color: #92580A; }
.b-gray   { background: #F1F1F0; color: #555555; }

/* ── Table ── */
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.tbl th {
  text-align: left;
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--sub);
  border-bottom: 1px solid var(--border);
}

.tbl td {
  padding: 10px 12px;
  border-bottom: 1px solid #F5F7FA;
  color: var(--text);
}

.tbl tr:hover td         { background: #FAFBFC; }
.tbl tr:last-child td    { border: none;         }

/* ── Progress bar ── */
.prog-wrap {
  background: #F0F4F8;
  border-radius: 6px;
  height: 7px;
  overflow: hidden;
}

.prog-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 1s ease;
}

/* ── Trigger panel ── */
.trig-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--white);
}

.trig-card:hover {
  border-color: var(--orange);
  background: #FFFBF9;
}

.trig-card.firing {
  border-color: var(--orange);
  background: #FFF1EB;
  animation: firepulse 1s ease infinite;
}

@keyframes firepulse {
  0%, 100% { background: #FFF1EB; }
  50%       { background: #FFE4D5; }
}

.trig-icon  { font-size: 22px; width: 36px; text-align: center; flex-shrink: 0; }
.trig-info  { flex: 1; }
.trig-name  { font-size: 13px; font-weight: 600; color: var(--text); }
.trig-thresh{ font-size: 11px; color: var(--sub); margin-top: 2px; }

/* ── Buttons ── */
.btn {
  padding: 9px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
}

.btn-primary { background: var(--orange); color: var(--white); }
.btn-primary:hover { background: #E55A27; }

.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--off); }

.btn-green { background: var(--green); color: var(--white); }
.btn-green:hover { opacity: 0.9; }

/* ── Alert boxes ── */
.alert-box {
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.alert-orange { background: #FFF1EB; border: 1px solid #FFCFB8; }
.alert-green  { background: #E6F9F4; border: 1px solid #9FE1CB; }
.alert-blue   { background: #EBF4FD; border: 1px solid #B5D4F4; }

.alert-icon  { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.alert-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.alert-text  { font-size: 12px; color: var(--sub); line-height: 1.5; }

/* ── Map placeholder ── */
.map-ph {
  background: linear-gradient(135deg, #E8F4FD, #EDF9F5);
  border-radius: 12px;
  height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

.map-pulse {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: rgba(255, 107, 53, 0.2);
  animation: mapPulse 2s ease infinite;
}

@keyframes mapPulse {
  0%   { transform: scale(1);   opacity: 0.8; }
  100% { transform: scale(2.5); opacity: 0;   }
}

.map-center {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--orange);
  position: absolute;
  border: 3px solid white;
  box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
}

/* ── Toast notification ── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--navy);
  color: white;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s;
  pointer-events: none;
  max-width: 320px;
  z-index: 999;
  border-left: 4px solid var(--green);
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ── Payout simulator steps ── */
.sim-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #F8FAFC;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  transition: all 0.3s;
}

.sim-step.done        { background: #E6F9F4; border-color: #9FE1CB; }
.sim-step.active-step { background: #FFF1EB; border-color: #FFCFB8; }

.sim-step-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #E0E8EE;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  transition: background 0.3s;
}

.sim-step.done .sim-step-icon        { background: var(--green); color: white; }
.sim-step.active-step .sim-step-icon { background: var(--orange); color: white; }

.sim-step-text { font-size: 12px; color: var(--sub); flex: 1; }
.sim-step.done .sim-step-text { color: #027A5B; font-weight: 500; }

.sim-step-time {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
  opacity: 0;
  transition: opacity 0.3s;
}

.sim-step.done .sim-step-time { opacity: 1; }