/* ─── SENTRI HQ — iOS Liquid Glass design system ─────────────────────── */
:root {
  --font: -apple-system, 'SF Pro Display', 'SF Pro Text', Inter, system-ui, sans-serif;
  --mono: 'SF Mono', ui-monospace, 'JetBrains Mono', monospace;
  --bg: #0B0F1A;
  --glass: rgba(255,255,255,.06);
  --glass-2: rgba(255,255,255,.10);
  --stroke: rgba(255,255,255,.12);
  --stroke-2: rgba(255,255,255,.20);
  --text: #FFFFFF;
  --text-2: rgba(255,255,255,.65);
  --text-3: rgba(255,255,255,.42);
  --blue: #0A84FF; --green: #30D158; --yellow: #FFD60A; --red: #FF453A;
  --orange: #FF9F0A; --purple: #BF5AF2; --teal: #64D2FF; --pink: #FF375F;
  --r: 22px; --r-sm: 14px; --r-pill: 999px;
  --shadow: 0 8px 32px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.10);
  --blur: blur(30px) saturate(180%);
  /* iPhone notch / Dynamic Island / home indicator */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--bg); }
body {
  font-family: var(--font); color: var(--text); -webkit-font-smoothing: antialiased; font-size: 14px;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
  background: radial-gradient(1200px 600px at 15% -10%, rgba(10,132,255,.20), transparent 60%),
              radial-gradient(900px 500px at 95% 110%, rgba(191,90,242,.16), transparent 60%),
              radial-gradient(700px 400px at 60% 50%, rgba(100,210,255,.06), transparent 60%), var(--bg);
  background-attachment: fixed;
}
#root { height: 100%; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.18); border-radius: 99px; }
input, select, textarea, button { font-family: var(--font); }
a { color: var(--blue); }
button { -webkit-appearance: none; appearance: none; }

/* glass primitives */
.glass { background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: var(--shadow); }
.pill { padding: 8px 16px; border-radius: var(--r-pill); border: 1px solid var(--stroke); background: var(--glass); color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); transition: all .2s; white-space: nowrap; }
.pill:hover { background: var(--glass-2); color: var(--text); }
.pill.active { background: rgba(10,132,255,.18); border-color: var(--blue); color: var(--blue); }
.pill.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.pill.primary:hover { filter: brightness(1.1); }
.pill:disabled { opacity: .5; cursor: not-allowed; }
.label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }

/* shell */
.app-shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.app-body  { display: flex; flex: 1; overflow: hidden; min-height: 0; }
.main-content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 20px 24px; -webkit-overflow-scrolling: touch; min-width: 0; }

/* topbar */
.topbar { height: calc(60px + var(--sat)); padding: var(--sat) calc(20px + var(--sar)) 0 calc(20px + var(--sal)); display: flex; align-items: center; gap: 14px; flex-shrink: 0; z-index: 50;
  background: rgba(11,15,26,.55); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); border-bottom: 1px solid var(--stroke); }
.topbar-logo { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.topbar-logo-text { font-size: 17px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; }
.topbar-divider { width: 1px; height: 20px; background: var(--stroke); }
.topbar-nav { display: flex; gap: 4px; padding: 4px; background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r-pill); backdrop-filter: blur(20px); }
.topbar-nav a { padding: 6px 16px; border-radius: var(--r-pill); font-size: 13px; font-weight: 600; color: var(--text-2); cursor: pointer; transition: all .2s; }
.topbar-nav a:hover { color: var(--text); }
.topbar-nav a.active { background: rgba(255,255,255,.14); color: var(--text); box-shadow: inset 0 1px 0 rgba(255,255,255,.15); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.icon-btn { width: 38px; height: 38px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r-pill); color: var(--text-2); cursor: pointer; font-size: 16px; transition: all .2s; position: relative; backdrop-filter: blur(20px); }
.icon-btn:hover { background: var(--glass-2); color: var(--text); }
.badge { position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid var(--bg); }
.user-avatar { width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%; background: linear-gradient(135deg, var(--blue), var(--purple)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow); }

/* office */
.office-floor { max-width: 1200px; margin: 0 auto; }
.maya-card { padding: 18px 20px; margin-bottom: 14px; cursor: pointer; transition: all .2s; }
.maya-card:hover { background: var(--glass-2); transform: translateY(-1px); }
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.agent-card { padding: 18px 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; text-align: center; transition: all .2s; position: relative; }
.agent-card:hover { transform: translateY(-3px); background: var(--glass-2); }

/* chat */
.chat-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.chat-header { padding: 14px 18px; display: flex; align-items: center; gap: 12px; flex-shrink: 0; border-bottom: 1px solid var(--stroke); background: rgba(11,15,26,.4); backdrop-filter: blur(20px); }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; -webkit-overflow-scrolling: touch; }
.chat-bubble { max-width: 78%; }
.chat-bubble.user { align-self: flex-end; }
.chat-bubble.agent { align-self: flex-start; }
.bubble-content { padding: 12px 16px; border-radius: 20px; font-size: 15px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-bubble.user  .bubble-content { background: var(--blue); color: #fff; border-bottom-right-radius: 6px; }
.chat-bubble.agent .bubble-content { background: var(--glass-2); border: 1px solid var(--stroke); backdrop-filter: blur(20px); border-bottom-left-radius: 6px; }
.bubble-ts { font-size: 11px; color: var(--text-3); margin-top: 4px; padding: 0 6px; }
.chat-bubble.user .bubble-ts { text-align: right; }
.chat-input-row { padding: 12px 16px; display: flex; gap: 10px; flex-shrink: 0; border-top: 1px solid var(--stroke); background: rgba(11,15,26,.4); backdrop-filter: blur(20px); align-items: center; }
.chat-input { flex: 1; min-width: 0; background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r-pill); padding: 12px 18px; color: var(--text); font-size: 16px; outline: none; transition: all .2s; }
.chat-input:focus { border-color: var(--blue); background: var(--glass-2); }
.chat-input::placeholder { color: var(--text-3); }
.send-btn { padding: 12px 20px; background: var(--blue); color: #fff; border: none; border-radius: var(--r-pill); font-size: 14px; font-weight: 700; cursor: pointer; transition: all .2s; }
.send-btn:hover { filter: brightness(1.1); }
.send-btn:disabled { opacity: .4; cursor: not-allowed; }

/* login */
.login-wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: calc(20px + var(--sat)) 20px calc(20px + var(--sab)); }
.login-card { width: 100%; max-width: 400px; padding: 36px 32px; }

/* overlays (all feature panels) */
.overlay { position: fixed; inset: 0; z-index: 500; display: flex; flex-direction: column; overflow: hidden; background: rgba(11,15,26,.92); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); }
.overlay-header { padding: calc(18px + var(--sat)) calc(28px + var(--sar)) 18px calc(28px + var(--sal)); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-shrink: 0; border-bottom: 1px solid var(--stroke); background: rgba(11,15,26,.6); }
.overlay-header > * { min-width: 0; }
.overlay-header button { white-space: nowrap; }
.overlay-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--text); }
.overlay-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 24px 28px calc(24px + var(--sab)); -webkit-overflow-scrolling: touch; }
.overlay-close { width: 38px; height: 38px; flex-shrink: 0; border-radius: var(--r-pill); border: 1px solid var(--stroke); background: var(--glass); color: var(--text); font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.card { background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r); padding: 18px; backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: var(--shadow); }

/* schedule modal — iOS bottom sheet on phone, centered card on desktop */
.modal-overlay { position: fixed; inset: 0; z-index: 600; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(0,0,0,.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: fade-in .2s ease; }
.modal-box { width: 100%; max-width: 440px; max-height: calc(100dvh - 40px); overflow-y: auto; padding: 20px; border-radius: 26px; background: rgba(28,32,46,.96); border: 1px solid var(--stroke-2); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.modal-handle { display: none; width: 38px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.25); margin: -6px auto 12px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-title { font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.modal-label { display: block; font-size: 12px; font-weight: 600; color: var(--text-3); margin: 0 0 6px 4px; }
.modal-input { display: block; width: 100%; min-width: 0; margin-bottom: 14px; padding: 12px 14px; border-radius: var(--r-sm); border: 1px solid var(--stroke); background: rgba(255,255,255,.07); color: var(--text); font-size: 16px; outline: none; -webkit-appearance: none; appearance: none; color-scheme: dark; min-height: 46px; }
.modal-input:focus { border-color: var(--blue); background: rgba(255,255,255,.10); }
.modal-input::placeholder { color: var(--text-3); }
.modal-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 4px; }
.modal-actions .pill { padding: 13px; font-size: 15px; }

/* launcher */
.launcher-menu { position: fixed; top: calc(66px + var(--sat)); right: 16px; z-index: 400; min-width: 260px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 160px); overflow-y: auto; padding: 8px; background: rgba(20,25,40,.92); border: 1px solid var(--stroke-2); border-radius: var(--r); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.launcher-label { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 8px 12px 6px; }
.launcher-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 12px; background: none; border: none; border-radius: var(--r-sm); cursor: pointer; text-align: left; color: var(--text); font-size: 14px; font-weight: 500; transition: background .15s; }
.launcher-item:hover { background: rgba(255,255,255,.10); }

/* dashboard */
.dash-wrap { max-width: 1100px; margin: 0 auto; }
.dash-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.dash-title { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.dash-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 14px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.dash-tabs::-webkit-scrollbar { display: none; }
.dash-tabs .pill { flex-shrink: 0; }
.dash-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 12px; }
.dash-metric { background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.dash-metric-val { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-metric-sub { font-size: 12px; color: var(--text-3); }
.dash-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dash-card-title { font-size: 16px; font-weight: 700; }
.dash-card-sub { font-size: 12px; color: var(--text-3); margin: 2px 0 12px; }
.dash-bars { display: flex; flex-direction: column; gap: 9px; }
.dash-bar-row { display: grid; grid-template-columns: minmax(70px, 34%) 1fr auto; align-items: center; gap: 10px; font-size: 12px; }
.dash-bar-label { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-bar-track { height: 8px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; }
.dash-bar-fill { height: 100%; border-radius: 99px; }
.dash-bar-val { color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 44px; text-align: right; }
.dash-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-list { display: flex; flex-direction: column; gap: 10px; }
.dash-row { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; }
.dash-row-title { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.dash-row-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.dash-tag { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 99px; }
.dash-line-item { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 14px; color: var(--text-2); }
.dash-line-item:last-child { border-bottom: none; }
.dash-plat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.dash-plat { text-align: left; color: var(--text); cursor: pointer; font: inherit; transition: all .2s; }
.dash-plat:hover { background: var(--glass-2); transform: translateY(-2px); }

/* error fallback */
.crash-card { max-width: 420px; margin: 40px auto; text-align: center; }

/* footer */
.app-footer { padding: 10px 24px calc(10px + var(--sab)); display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-3); flex-shrink: 0; border-top: 1px solid var(--stroke); background: rgba(11,15,26,.4); backdrop-filter: blur(20px); }
.footer-right { display: flex; gap: 8px; align-items: center; }

/* animations */
@keyframes routeFlash { 0%,100%{box-shadow:0 0 0 0 rgba(255,159,10,0)} 50%{box-shadow:0 0 0 4px rgba(255,159,10,.35)} }
@keyframes fade-in { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }
@keyframes sheet-up { from{transform:translateY(100%)} to{transform:translateY(0)} }
.fade-in { animation: fade-in .25s ease; }

/* mobile */
.bottom-nav { display: none; }
@media (max-width: 700px) {
  .app-footer, .topbar-nav, .topbar-divider, .hide-mobile { display: none !important; }
  .topbar { height: calc(56px + var(--sat)); padding-left: calc(14px + var(--sal)); padding-right: calc(14px + var(--sar)); gap: 8px; }
  .topbar-logo-text { font-size: 16px; }
  .topbar-right { gap: 6px; }
  .icon-btn, .user-avatar { width: 36px; height: 36px; font-size: 15px; }
  .main-content { padding: 14px 14px calc(96px + var(--sab)); }
  .bottom-nav { display: flex; position: fixed; bottom: calc(10px + var(--sab)); left: 12px; right: 12px; height: 64px; padding: 6px; gap: 4px; z-index: 60;
    background: rgba(20,25,40,.88); border: 1px solid var(--stroke-2); border-radius: var(--r); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); box-shadow: 0 10px 40px rgba(0,0,0,.5); }
  .bottom-nav-item { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: none; background: none; color: var(--text-3); cursor: pointer; font-size: 10px; font-weight: 600; border-radius: var(--r-sm); position: relative; }
  .bottom-nav-item.active { color: var(--blue); background: rgba(10,132,255,.14); }
  .bottom-nav-item .badge { top: 6px; right: 18px; }

  /* feature panels: header clears the Dynamic Island, wraps instead of squishing */
  .overlay-header { padding: calc(10px + var(--sat)) 16px 12px; flex-wrap: wrap; row-gap: 10px; }
  .overlay-header > :first-child { flex: 1 1 60%; }
  .overlay-header button:not(.overlay-close) { padding: 8px 14px; font-size: 13px; border-radius: 999px; width: auto; height: auto; }
  .overlay-body { padding: 14px 16px calc(24px + var(--sab)); }
  .overlay-title { font-size: 20px; }

  /* schedule modal becomes a bottom sheet */
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-box { max-width: none; border-radius: 26px 26px 0 0; padding: 14px 18px calc(18px + var(--sab)); max-height: calc(100dvh - var(--sat) - 20px); animation: sheet-up .28s cubic-bezier(.2,.8,.2,1); }
  .modal-handle { display: block; }

  .dash-title { font-size: 26px; }
  .dash-metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dash-metric { padding: 14px; }
  .dash-metric-val { font-size: 22px; }
  .dash-grid2 { grid-template-columns: 1fr; }
  .dash-plat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .card { padding: 16px; }
  .chat-bubble { max-width: 90%; }
  .launcher-menu { right: 12px; left: 12px; min-width: 0; }
}

/* ── Oct 9b: Vault / Alerts sheets + Opportunities phone layout ── */
.sheet-tall { display: flex; flex-direction: column; height: min(640px, calc(100dvh - 40px)); }
.sheet-scroll { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; margin: 0 -4px; padding: 0 4px 6px; }
.notif-row { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 14px; margin-bottom: 10px; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.notif-row:hover { background: var(--glass-2); }
.opps-head { padding-top: calc(18px + var(--sat)) !important; }
@media (max-width: 700px) {
  .sheet-tall { height: calc(100dvh - var(--sat) - 16px); }
  /* Opportunities: one scroll for the whole page, header clears the Dynamic Island */
  .opps-root { overflow-y: auto !important; overflow-x: hidden !important; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
  .opps-head { padding: calc(10px + var(--sat)) 16px 12px !important; flex-wrap: wrap; row-gap: 12px; }
  .opps-head > div:first-child { flex: 1 1 100%; }
  .opps-head > div:first-child > div:last-child { font-size: 12px !important; }
  .opps-actions { flex: 1 1 100%; }
  .opps-actions button { white-space: nowrap; padding: 9px 14px !important; font-size: 14px !important; }
  .opps-actions button:last-child { margin-left: auto; flex-shrink: 0; }
  .opps-row { flex: none !important; overflow: visible !important; padding-bottom: calc(28px + var(--sab)) !important; }
  .opps-list, .opps-detail { flex: none !important; overflow: visible !important; }
  .opps-group { top: var(--sat) !important; }
  .opps-root::before { content: ''; position: fixed; top: 0; left: 0; right: 0; height: var(--sat); background: #0B0F1A; z-index: 20; pointer-events: none; }
}
