/* ===== MINIMAL SAAS COLOR SYSTEM ===== */
:root {
  --bg: #FFFFFF; --glass: #FFFFFF; --glass-hover: #F8FAFC; --glass-border: #E5E7EB;
  --primary: #0061FF; --primary-dim: #F0F7FF; --blue: #0061FF; --blue-dim: #F0F7FF;
  --cyan: #0061FF; --green: #10B981; --red: #EF4444; --amber: #F59E0B; --purple: #0061FF; 
  --text: #000000; --text-2: #4B5563; --text-3: #9CA3AF; 
  --radius-lg: 32px; --radius-md: 24px; --radius-sm: 12px;
}

/* ===== RESET & CUSTOM SCROLLBARS ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); }
body { min-height: 100dvh; overflow: hidden; -webkit-font-smoothing: antialiased; position: relative; }
button { font-family: 'Inter', sans-serif; border: none; cursor: pointer; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); outline: none; }
button:active { transform: scale(0.95); }

/* Global Scrollbar Hiding / Slimming */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #E5E7EB; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #D1D5DB; }

/* ===== BOOT SEQUENCE ANIMATION ===== */
#bootScreen { position: fixed; inset: 0; background: #fff; z-index: 10000; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: opacity 0.6s ease; }
.boot-logo { font-weight: 900; font-size: 3rem; letter-spacing: -2px; margin-bottom: 24px; color: var(--text); display:flex; align-items:center; gap:12px; animation: pulse 2s infinite; }
.boot-logo .icon { width: 32px; height: 32px; background: var(--primary); border-radius: 50%; }
.boot-bar-wrap { width: 240px; height: 4px; background: #F3F4F6; border-radius: 4px; overflow: hidden; }
.boot-bar { width: 0%; height: 100%; background: var(--primary); animation: loadBar 1.5s cubic-bezier(0.8, 0, 0.2, 1) forwards; }
@keyframes loadBar { 0% { width: 0%; } 50% { width: 70%; } 100% { width: 100%; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(0.98); } }

/* Typography */
.display-font { font-family: 'Inter', sans-serif; font-weight: 800; letter-spacing: -1px; color: var(--text); }
.mono { font-family: 'JetBrains Mono', monospace; }
.section-title { font-size: 0.75rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--text-3); margin-bottom: 24px; }

/* ===== BACKGROUND ===== */
.hologram-bg { position: fixed; inset: 0; z-index: -1; background: radial-gradient(circle at 50% -20%, #F0F7FF 0%, transparent 60%); background-color: #FFFFFF; transition: background 0.5s; }

/* LOCKDOWN MODE ANIMATION */
.lockdown-active .hologram-bg { background: radial-gradient(circle at 50% -20%, rgba(239, 68, 68, 0.15) 0%, transparent 80%); background-color: #FEF2F2; animation: flashRed 2s infinite alternate; }
@keyframes flashRed { 0% { opacity: 0.8; } 100% { opacity: 1; } }

/* ===== FLOATING HEADER ===== */
.founderz-header { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); width: calc(100% - 64px); max-width: 1400px; height: 64px; background: rgba(255,255,255,0.95); backdrop-filter: blur(12px); border-radius: 999px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 32px; z-index: 1000; border: 1px solid var(--glass-border); }
.fh-left { display: flex; align-items: center; gap: 28px; flex: 1; }
.fh-nav { font-weight: 600; font-size: 0.9rem; color: var(--text-2); cursor: pointer; transition: color 0.2s; position: relative; }
.fh-nav:hover { color: var(--text); }
.fh-nav.active { color: var(--primary); }
.fh-nav.active::after { content: ''; position: absolute; bottom: -20px; left: 0; width: 100%; height: 3px; background: var(--primary); border-radius: 3px; }
.fh-center { font-size: 1.4rem; color: var(--text); position: absolute; left: 50%; transform: translateX(-50%); line-height: 1; display:flex; align-items:center; gap: 8px; }
.fh-center .icon { width: 16px; height: 16px; background: var(--primary); border-radius: 50%; display:inline-block; transition: background 0.5s; }
.lockdown-active .fh-center .icon { background: var(--red); box-shadow: 0 0 15px var(--red); }
.fh-right { display: flex; align-items: center; gap: 12px; flex: 1; justify-content: flex-end; }
.fh-btn-outline { font-size: 0.85rem; font-weight: 600; padding: 10px 24px; border: 1px solid var(--glass-border); border-radius: 999px; color: var(--text); background: transparent; transition: all 0.2s; }
.fh-btn-outline:hover { background: var(--glass-hover); border-color: var(--primary); color: var(--primary); }
.fh-btn-solid { font-size: 0.85rem; font-weight: 600; padding: 10px 28px; border-radius: 999px; background: var(--primary); color: #fff; transition: all 0.2s; }
.fh-btn-solid:hover { background: #004DCC; transform: translateY(-1px); }
.fh-btn-solid.connected { background: var(--text); }
.mobile-tab-bar { display: none; }

/* ===== LAYOUT SYSTEM ===== */
.main-wrapper { display: flex; width: 100%; max-width: 1400px; margin: 0 auto; height: 100dvh; padding-top: 112px; padding-bottom: 24px; gap: 24px; }
.main-content { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; padding-right: 16px; }
.right-panel { width: 340px; flex-shrink: 0; background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); display: flex; flex-direction: column; overflow: hidden; box-shadow: none; }
.tab-pane { display: none; margin-bottom: 32px; animation: fadeIn 0.4s ease forwards; opacity: 0; }
.tab-pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(15px) scale(0.99); } to { opacity: 1; transform: translateY(0) scale(1); } }
.card-box { background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius-lg); padding: 32px; margin-bottom: 24px; transition: border-color 0.3s ease; overflow: hidden; }
.card-box:hover { border-color: var(--primary); }

/* Elements */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
.stat-card { background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius-md); padding: 28px; transition: all 0.2s; }
.stat-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.stat-label { font-size: 0.8rem; font-weight: 600; color: var(--text-2); margin-bottom: 12px; }
.stat-value { font-size: 3rem; margin-bottom: 12px; color: var(--text); transition: color 0.3s; line-height: 1;}
.stat-trend { font-size: 0.8rem; font-weight: 700; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; }
.stat-c-cyan .stat-trend, .stat-c-purple .stat-trend { color: var(--primary); background: var(--primary-dim); }
.stat-c-green .stat-trend { color: var(--green); background: rgba(16,185,129,0.1); }
.stat-c-amber .stat-trend { color: var(--amber); background: rgba(245,158,11,0.1); }
.lockdown-active .stat-c-cyan .stat-value { color: var(--red); }

/* TOAST NOTIFICATION FOR AGENT ACTION */
#toastWrap { position: fixed; top: 100px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.agent-toast { background: var(--text); color: #fff; padding: 20px 24px; border-radius: 16px; font-weight: 600; font-size: 0.9rem; display: flex; align-items: center; gap: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); animation: toastIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.agent-toast .toast-icon { width: 32px; height: 32px; background: rgba(255,255,255,0.2); border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.agent-toast.red { background: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateX(50px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(50px); } }

/* Ticker & Analytics */
.chart-container-wrap { width: 100%; height: 280px; position: relative; margin-top: 10px; }
.ticker-wrap { width: 100%; background: var(--primary-dim); border: 1px solid var(--primary-dim); border-radius: 999px; margin-bottom: 24px; padding: 14px 24px; overflow: hidden; display: flex; align-items: center; transition: background 0.3s; }
.lockdown-active .ticker-wrap { background: #FEF2F2; border-color: #FECACA; }
.lockdown-active .ticker-scroll { color: var(--red); }
.ticker-scroll { white-space: nowrap; animation: marquee 30s linear infinite; font-size: 0.85rem; font-weight: 600; color: var(--primary); letter-spacing: 0.5px; }
.ticker-scroll span { margin-right: 60px; }
@keyframes marquee { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* Perimeter Components */
.gate-row { display: flex; align-items: center; margin-bottom: 16px; padding: 16px 20px; border-radius: var(--radius-sm); border: 1px solid var(--glass-border); transition: all 0.2s; }
.gate-row:hover { border-color: var(--primary); background: var(--primary-dim); }
.gate-info { width: 160px; flex-shrink: 0; }
.gate-name { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.gate-bar-container { flex: 1; margin: 0 24px; position: relative; }
.gate-bar-bg { width: 100%; height: 8px; background: var(--glass-border); border-radius: 999px; overflow: hidden; }
.gate-bar-fill { height: 100%; border-radius: 999px; background: var(--primary); transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.lockdown-active .gate-bar-fill { background: var(--red); }
.gate-pct { width: 70px; text-align: right; font-size: 1.6rem; color: var(--text); }

/* CHAT AREA */
.chat-wrapper { display: flex; flex-direction: column; height: calc(100dvh - 150px); }
.chat-history { flex: 1; overflow-y: auto; padding: 0 10px 20px; display: flex; flex-direction: column; gap: 24px; }
.bubble { max-width: 80%; padding: 20px 28px; font-size: 0.95rem; line-height: 1.6; animation: slideUp 0.3s ease-out forwards; opacity: 0; }
@keyframes slideUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.bubble.user { align-self: flex-end; background: var(--primary); color: #fff; border-radius: 28px 28px 4px 28px; font-weight: 500; }
.bubble.ai { align-self: flex-start; background: #fff; border: 1px solid var(--glass-border); border-radius: 4px 28px 28px 28px; color: var(--text-2); }
.ai-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.ai-name { font-size: 0.8rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.ai-name .icon { width: 12px; height: 12px; background: var(--primary); border-radius: 50%; display: inline-block; }
.ai-tag { font-family: 'JetBrains Mono', monospace; font-size: 0.65rem; padding: 4px 12px; background: var(--primary-dim); border-radius: 999px; color: var(--primary); font-weight: 700; }
.chat-input-area { padding-top: 20px; }
.quick-pills { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 20px; margin-bottom: 4px; }
.pill-btn { flex-shrink: 0; background: #fff; border: 1px solid var(--glass-border); color: var(--text-2); padding: 12px 24px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; transition: all 0.2s; }
.pill-btn:hover { background: var(--primary-dim); color: var(--primary); border-color: var(--primary); }
.input-box { display: flex; gap: 12px; background: #fff; border-radius: 999px; padding: 8px 8px 8px 32px; align-items: center; border: 1px solid var(--glass-border); }
.input-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-dim); }
.input-field { flex: 1; background: transparent; border: none; color: var(--text); font-size: 1rem; outline: none; }
.send-action { width: 48px; height: 48px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; }

/* MAP & RESTROOMS */
.heatmap-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 40px; }
.hm-cell { aspect-ratio: 1/1; border-radius: var(--radius-md); display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; border: 1px solid var(--glass-border); }
.hm-name { font-size: 1rem; font-weight: 700; position: absolute; top: 20px; color: var(--text-2); }
.hm-pct { font-size: 2.8rem; line-height: 1; color: var(--text); }
.restroom-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.rr-card { background: #fff; border: 1px solid var(--glass-border); border-radius: var(--radius-md); padding: 28px; }
.rr-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.rr-name { font-size: 0.95rem; font-weight: 700; color: var(--text); }
.rr-badge { font-size: 0.75rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; }
.rr-info { font-size: 0.8rem; color: var(--text-2); font-weight: 600; margin-bottom: 12px; display: flex; justify-content: space-between; }
.rr-bar-bg { width: 100%; height: 6px; background: var(--glass-border); border-radius: 999px; overflow: hidden;}
.rr-bar-fill { height: 100%; background: var(--primary); border-radius: 999px; transition: width 0.5s; }

/* OPS TAB */
.action-btn { width: 100%; padding: 20px; background: var(--text); border: none; border-radius: 999px; color: #fff; font-weight: 700; font-size: 0.95rem; display: flex; justify-content: center; align-items: center; gap: 12px; margin-bottom: 32px; transition: all 0.2s; cursor: pointer; }
.action-btn:hover { background: #111; transform: translateY(-1px); }
.pred-card { background: #fff; border: 1px solid var(--glass-border); border-radius: var(--radius-md); padding: 28px; margin-bottom: 20px; border-left: 6px solid var(--glass-border); }
.pred-card:hover { border-left-color: var(--primary); }
.pred-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.pred-z { font-size: 1.25rem; font-weight: 800; color: var(--text); }
.pred-badge { font-size: 0.75rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; }
.pred-text { font-size: 0.95rem; color: var(--text-2); margin-bottom: 20px; line-height: 1.6; }
.pred-bot { display: flex; justify-content: space-between; align-items: center; }
.pred-act { font-size: 0.9rem; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; cursor: pointer; }
.pred-time { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; font-weight: 700; background: var(--primary-dim); color: var(--primary); padding: 8px 16px; border-radius: 999px; }

/* PROMPT LAB */
.terminal-card { background: #F9FAFB; border: 1px solid var(--glass-border); border-radius: var(--radius-md); padding: 32px; margin-bottom: 24px; transition: border 0.3s; }
.terminal-header { display: flex; justify-content: space-between; margin-bottom: 20px; align-items: center; }
.term-badge { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: #fff; background: var(--primary); padding: 6px 12px; border-radius: 999px; font-weight: 700; }
.term-area { width: 100%; min-height: 160px; background: transparent; color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 0.9rem; padding: 0; border: none; resize: vertical; outline: none; line-height: 1.6; }
.term-preview { background: transparent; color: var(--text-2); font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; padding: 0; white-space: pre-wrap; line-height: 1.6; }

/* RIGHT PANEL */
.panel-section { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: 28px; border-bottom: 1px solid var(--glass-border); }
.panel-section:last-child { border-bottom: none; }
.alerts-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding-right: 8px; }
.alert-item { background: #fff; border: 1px solid var(--glass-border); border-radius: 16px; padding: 16px; transition: border 0.2s; display: flex; flex-direction: column; gap: 8px; }
.alert-item:hover { border-color: var(--primary); }
.alert-title { font-size: 0.85rem; font-weight: 700; display: flex; gap: 10px; align-items: center; color: var(--text); }
.alert-desc { font-size: 0.85rem; color: var(--text-2); line-height: 1.5; }
.alert-time { font-family: 'JetBrains Mono', monospace; font-size: 0.7rem; color: var(--text-3); }
.quick-chat-history { flex: 1; overflow-y: auto; margin-bottom: 20px; display: flex; flex-direction: column; gap: 16px; padding-right: 8px;}
.qc-bubble { font-size: 0.85rem; padding: 14px 20px; border-radius: 20px; max-width: 90%; line-height: 1.5; }
.qc-user { align-self: flex-end; background: var(--text); color: #fff; border-bottom-right-radius: 4px; font-weight: 500; }
.qc-ai { align-self: flex-start; background: var(--primary-dim); border: 1px solid var(--glass-border); color: var(--text); border-bottom-left-radius: 4px; }
.qc-input-wrap { display: flex; background: #fff; border-radius: 999px; padding: 8px 8px 8px 24px; border: 1px solid var(--glass-border); }
.qc-input-wrap:focus-within { border-color: var(--primary); }
.qc-input { flex:1; background:transparent; border:none; color:var(--text); font-size:0.85rem; outline:none; }
.qc-send { width: 36px; height: 36px; background: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1rem; cursor: pointer; }
.qc-brand { font-family: 'JetBrains Mono', monospace; font-size: 0.65rem; color: var(--text-3); text-align: center; margin-top: 16px; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(255,255,255,0.9); backdrop-filter: blur(5px); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.modal-content { background: #fff; border: 1px solid var(--glass-border); padding: 48px; border-radius: var(--radius-lg); width: 440px; text-align: center; }
.modal-title { font-size: 2.2rem; font-weight: 800; letter-spacing: -1px; margin-bottom: 12px; color: var(--text); }
.modal-desc { font-size: 0.95rem; color: var(--text-2); margin-bottom: 32px; line-height: 1.6; }
.modal-input { width: 100%; border: 1px solid var(--glass-border); padding: 16px; border-radius: 999px; text-align:center; font-family: 'JetBrains Mono', monospace; margin-bottom: 24px; outline:none; font-size: 0.95rem; }
.modal-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-dim); }
.modal-btn { width: 100%; background: var(--primary); color: #fff; font-weight: 700; padding: 16px; border-radius: 999px; margin-bottom: 16px; font-size: 1rem; cursor: pointer; border: none; }
.modal-btn-skip { width: 100%; background: transparent; color: var(--text-2); font-weight: 600; border: none; font-size: 0.9rem; cursor: pointer; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* RESPONSIVE */
@media (max-width: 1023px) {
  .founderz-header { width: calc(100% - 32px); padding: 0 10px 0 24px; }
  .right-panel { display: none; }
}
@media (max-width: 767px) {
  .founderz-header { display: none; }
  .main-wrapper { padding-top: 24px; flex-direction: column; height: calc(100dvh - 70px); }
  .main-content { padding-right: 0; }
  .mobile-tab-bar { display: flex; width: 100%; height: 75px; background: #fff; border-top: 1px solid var(--glass-border); z-index: 100; flex-shrink: 0; padding-bottom: env(safe-area-inset-bottom); position: fixed; bottom: 0; left: 0; }
  .mob-tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--text-3); font-size: 0.7rem; font-weight: 600; }
  .mob-tab.active { color: var(--primary); }
  .mob-tab .icon { font-size: 1.2rem; margin-bottom: 2px;}
  .stats-grid, .restroom-grid { grid-template-columns: 1fr 1fr; gap: 16px; }
  .chat-wrapper { height: calc(100dvh - 140px); }
}

.streaming-cursor { display: inline-block; width: 8px; height: 1em; background: var(--primary); margin-left: 4px; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
