/*
 * The installed app's look (2026-10-30). Everything here is under html.app,
 * which _pwa_head.html sets only when the site runs as the installed phone app,
 * and only below 900px - in a browser the site is exactly as before.
 * The app's own pieces (header, rows, tab bar, account sheet) are made by
 * static/js/app.js and are all named ab-* / ar-*.
 */
@media (max-width: 900px) {

html.app {
    --ab-navy: #0b1b2e;
    --ab-navy-2: #132a45;
    --ab-navy-3: #1c3658;
    --ab-ink: #0f172a;
    --ab-muted: #64748b;
    --ab-soft: #94a3b8;
    --ab-bg: #eef2f7;
    --ab-card: #ffffff;
    --ab-line: #e5eaf1;
    --ab-green: #16a34a;
    --ab-green-bg: #dcfce7;
    --ab-red: #dc2626;
    --ab-red-bg: #fee2e2;
    --ab-blue: #2563eb;
    --ab-tabbar: 64px;
    -webkit-tap-highlight-color: transparent;
}
html.app body {
    background: var(--ab-bg) !important;
    overscroll-behavior-y: none;
    -webkit-font-smoothing: antialiased;
}
/* 2026-11-03: on a reload the browser drew the plain website for a moment
   before app.js built the app screen - "two different screens". Until it is
   built (html.ab-ready), only a splash shows. app.js and a time limit in
   _pwa_head.html both set ab-ready, so the page can never stay hidden. */
html.app:not(.ab-ready) body > * {
    visibility: hidden !important;
}
html.app:not(.ab-ready) body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    background: #0b1b2e url('../images/app-icon-192.png') center / 88px no-repeat;
}
/* 2026-11-03, Karan: the website keeps IBbotusa; the installed alerts app is
   Investinbulls - its admin menu and its pages' own logos included. */
html.app.ib-alerts .sidebar-header img,
html.app.ib-alerts .logo-section img,
html.app.ib-alerts .login-logo-img,
html.app.ib-alerts .free-logo-img {
    content: url('../images/logo.jpeg');
    height: 65px;
    width: auto;
    border-radius: 8px;
}
html.app.ib-alerts:not(.ab-ready) body::before {
    background: #000 url('../images/investinbulls-icon-192.png') center / 120px no-repeat;
}
html.app button { -webkit-user-select: none; user-select: none; }
/* the website fades its panels in; an app shows its screen at once */
html.app .mode-view-panel, html.app .panel { animation: none !important; }
html.app body.ab-has-tabbar { padding-bottom: calc(var(--ab-tabbar) + env(safe-area-inset-bottom) + 16px) !important; }

/* ------------------------------------------------------------ header ------ */
html.app .ab-top {
    background: var(--ab-navy);
    color: #fff;
    padding: env(safe-area-inset-top) 0 0;
    border-radius: 0 0 22px 22px;
    box-shadow: 0 8px 24px rgba(11, 27, 46, .18);
    margin-bottom: 14px;
}
html.app .ab-bar {
    position: sticky; top: 0; z-index: 850;
    height: 56px; padding: 0 16px;
    display: flex; align-items: center; justify-content: space-between;
    background: var(--ab-navy);
}
html.app .ab-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: .2px; }
html.app .ab-brand img { width: 30px; height: 30px; border-radius: 8px; }
html.app .ab-actions { display: flex; align-items: center; gap: 8px; }
html.app .ab-icon {
    width: 38px; height: 38px; border-radius: 12px; border: 0;
    background: var(--ab-navy-2); color: #cbd5e1; font-size: 15px;
    display: grid; place-items: center;
}
html.app .ab-icon svg, html.app .ab-filter-btn svg { width: 19px; height: 19px; }
html.app .ab-search-box svg { width: 18px; height: 18px; flex: 0 0 18px; }
html.app .ab-sheet-btn svg { width: 18px; height: 18px; }
html.app .ab-icon:active { background: var(--ab-navy-3); }
html.app .ab-avatar {
    width: 38px; height: 38px; border-radius: 50%; border: 0;
    background: linear-gradient(135deg, #22c55e, #15803d); color: #fff;
    font: 700 14px/38px inherit; text-align: center; padding: 0;
}
html.app .ab-hero { padding: 4px 18px 18px; }
html.app .ab-greet { color: var(--ab-soft); font-size: 13px; font-weight: 500; }
html.app .ab-title { font-size: 24px; font-weight: 700; margin-top: 2px; letter-spacing: -.2px; }
html.app .ab-chips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
html.app .ab-chip {
    background: var(--ab-navy-2); border: 1px solid rgba(255, 255, 255, .06);
    border-radius: 14px; padding: 10px 12px;
}
html.app .ab-chip b { display: block; font-size: 18px; font-weight: 700; color: #fff; white-space: nowrap; }
html.app .ab-chip b.pos { color: #4ade80; }
html.app .ab-chip b.neg { color: #f87171; }
html.app .ab-chip span { font-size: 11px; color: var(--ab-soft); font-weight: 500; }
html.app .ab-hero-pill { margin-top: 10px; }

html.app .ab-search { display: flex; gap: 8px; padding: 0 16px 16px; }
html.app .ab-search-box {
    flex: 1; display: flex; align-items: center; gap: 10px;
    height: 44px; padding: 0 14px; border-radius: 14px;
    background: var(--ab-navy-2); color: var(--ab-soft);
}
html.app .ab-search-box input {
    flex: 1; min-width: 0; border: 0; outline: 0; background: none;
    color: #fff; font: 500 15px inherit;
}
html.app .ab-search-box input::placeholder { color: var(--ab-soft); }
html.app .ab-filter-btn {
    width: 44px; height: 44px; border: 0; border-radius: 14px;
    background: var(--ab-navy-2); color: #cbd5e1; font-size: 16px;
}
html.app body.ab-filters-open .ab-filter-btn { background: var(--ab-blue); color: #fff; }

/* the website's own header, counters and tab column are replaced */
html.app body.ab-alerts .container > header,
html.app body.ab-bot .container > header,
html.app body.ab-alerts .stats-grid,
html.app body.ab-bot .stats-grid,
html.app body.ab-alerts #alerts-mode-view .sidebar,
html.app body.ab-alerts .section-header > h2,
html.app body.ab-alerts #search-input,
html.app body.ab-alerts .dashboard-disclaimer-title { display: none !important; }
html.app body.ab-alerts .container,
html.app body.ab-bot .container { padding: 0 !important; max-width: none !important; margin: 0 !important; }

/* ------------------------------------------------------- bottom tab bar ---- */
html.app .ab-tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    height: calc(var(--ab-tabbar) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: flex; background: var(--ab-navy);
    box-shadow: 0 -6px 20px rgba(11, 27, 46, .18);
}
html.app .ab-tab {
    flex: 1; position: relative; border: 0; background: none; padding: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    color: #7c8ea6; font: 600 11px/1 inherit;
}
html.app .ab-tab svg { width: 21px; height: 21px; }
html.app .ab-tab.active { color: #fff; }
html.app .ab-tab.active svg { color: #4ade80; }
html.app .ab-tab.active::before {
    content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: #4ade80;
}

/* ------------------------------------------------------- alerts screen ---- */
html.app body.ab-alerts #alerts-mode-view .layout-container { display: block !important; padding: 0 !important; margin: 0 !important; }
html.app body.ab-alerts .main-content,
html.app body.ab-alerts .dashboard-content {
    padding: 0 !important; margin: 0 !important; background: none !important;
    border: 0 !important; box-shadow: none !important;
}
html.app body.ab-alerts .section-header { display: block !important; margin: 0 !important; padding: 0 !important; }
/* the date filter: the page's own controls, opened from the filter button */
html.app body.ab-alerts .filter-controls-group { display: none !important; }
html.app body.ab-alerts.ab-filters-open .filter-controls-group {
    display: grid !important; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px !important;
    width: auto !important; max-width: none !important; box-sizing: border-box;
    margin: 0 14px 12px; padding: 12px; background: var(--ab-card);
    border-radius: 16px; box-shadow: 0 2px 10px rgba(15, 23, 42, .05);
}
html.app body.ab-alerts .filter-controls-group #strategy-filter { grid-column: 1 / -1; }
html.app body.ab-alerts .filter-controls-group .filter-to-label { align-self: center; color: var(--ab-muted); font-size: 12px; }
html.app body.ab-alerts .filter-controls-group input,
html.app body.ab-alerts .filter-controls-group select,
html.app body.ab-alerts .filter-controls-group button {
    height: 42px !important; min-width: 0; width: 100% !important; box-sizing: border-box; font-size: 14px !important; border-radius: 12px !important;
}
html.app body.ab-alerts .filter-controls-group .btn-refresh { grid-column: span 1; }
html.app body.ab-alerts .filter-controls-group .btn-refresh.btn-neutral { grid-column: 3; }

/* our rows replace the website's cards once they have data */
html.app body.ab-alerts.ab-list-on #alerts-grid,
html.app body.ab-alerts.ab-list-on #alerts-footer { display: none !important; }
html.app body.ab-alerts #alerts-grid { padding: 0 14px; }
html.app .ab-list { padding: 0 14px; }
html.app .ar-day {
    margin: 14px 4px 8px; font-size: 12px; font-weight: 700; color: var(--ab-muted);
    text-transform: uppercase; letter-spacing: .06em;
}
html.app .ar {
    background: var(--ab-card); border-radius: 16px; margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .06); overflow: hidden;
}
html.app .ar-main {
    width: 100%; display: flex; align-items: center; gap: 12px;
    padding: 14px; border: 0; background: none; text-align: left; font: inherit; color: var(--ab-ink);
}
html.app .ar-main:active { background: #f8fafc; }
html.app .ar-mark {
    flex: 0 0 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 14px;
}
html.app .ar-mark.buy { background: var(--ab-green-bg); color: var(--ab-green); }
html.app .ar-mark.sell { background: var(--ab-red-bg); color: var(--ab-red); }
html.app .ar-left { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
html.app .ar-sym { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
html.app .ar-side {
    font-style: normal; font-size: 10px; font-weight: 700; letter-spacing: .04em;
    padding: 3px 7px; border-radius: 6px;
}
html.app .ar-side.buy { background: var(--ab-green-bg); color: var(--ab-green); }
html.app .ar-side.sell { background: var(--ab-red-bg); color: var(--ab-red); }
html.app .ar-sub { font-size: 12px; color: var(--ab-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html.app .ar-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
html.app .ar-price { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
html.app .ar-pnl { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; font-variant-numeric: tabular-nums; }
html.app .ar-pnl.pos { color: var(--ab-green); background: var(--ab-green-bg); }
html.app .ar-pnl.neg { color: var(--ab-red); background: var(--ab-red-bg); }
html.app .ar-state { font-size: 12px; font-weight: 600; color: var(--ab-muted); display: flex; align-items: center; gap: 5px; }
html.app .ar-state.live { color: var(--ab-blue); }
html.app .ar-state.live span {
    width: 7px; height: 7px; border-radius: 50%; background: var(--ab-blue);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, .5); animation: ab-pulse 1.6s infinite;
}
@keyframes ab-pulse { 70% { box-shadow: 0 0 0 7px rgba(37, 99, 235, 0); } 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); } }
html.app .ar-more {
    display: none; grid-template-columns: 1fr 1fr; gap: 10px 14px;
    padding: 12px 14px 14px 66px; border-top: 1px solid var(--ab-line);
}
html.app .ar.open .ar-more { display: grid; }
html.app .ar-more span { display: block; font-size: 11px; color: var(--ab-muted); }
html.app .ar-more b { font-size: 13px; font-weight: 600; color: var(--ab-ink); }
html.app .ar-empty { text-align: center; padding: 48px 20px; color: var(--ab-muted); }
html.app .ar-empty svg { width: 34px; height: 34px; color: var(--ab-soft); margin: 0 auto 10px; display: block; }
html.app .ar-empty div { font-weight: 700; color: var(--ab-ink); margin-bottom: 4px; }
html.app .ar-empty span { font-size: 13px; }

html.app body.ab-alerts .dashboard-disclaimer {
    margin: 18px 14px 0 !important; padding: 0 !important; background: none !important; border: 0 !important;
    font-size: 11px !important; line-height: 1.5 !important; color: var(--ab-soft) !important; text-align: center;
}
html.app body.ab-alerts #subscription-banner { margin: 0 14px 12px !important; border-radius: 14px !important; }

/* --------------------------------------------------------------- bot ------ */
html.app body.ab-bot .bot-hero { display: none !important; }
html.app body.ab-bot #autotrade-mode-view { padding: 0 14px !important; }
html.app body.ab-bot .bot-shell { padding: 0 !important; margin: 0 !important; gap: 12px !important; }
html.app body.ab-bot .bot-shell > *,
html.app body.ab-bot [class*="bot-card"],
html.app body.ab-bot .bot-stop,
html.app body.ab-bot .bot-notice { border-radius: 16px !important; }
html.app body.ab-bot .bot-pill { background: var(--ab-navy-2) !important; color: #e2e8f0 !important; border-color: transparent !important; }
html.app .bot-size-note { display: block !important; }
html.app .bot-size-note i { margin-right: 6px; }

/* -------------------------------------------------------------- admin ----- */
html.app body.ab-admin .ab-top-admin { margin: 0 -12px 14px; }
html.app body.ab-admin .content { padding: 0 12px calc(var(--ab-tabbar) + env(safe-area-inset-bottom) + 16px) !important; }
html.app body.ab-admin .content-header {
    margin: 0 0 12px !important; padding: 0 !important; min-height: 0 !important;
    display: flex !important; flex-wrap: wrap !important; align-items: center !important;
    justify-content: flex-start !important; gap: 8px !important;
    background: none !important; border: 0 !important; box-shadow: none !important; position: static !important;
}
html.app body.ab-admin .content-header .page-title-group { display: none !important; }
html.app body.ab-admin .content-header > :not(.page-title-group) {
    display: flex; flex-wrap: wrap; gap: 6px; max-width: 100%;
}
html.app body.ab-admin .content-header > :not(.page-title-group) > * { max-width: 100%; }
html.app body.ab-admin .header-action-pill { font-size: 12px !important; padding: 6px 12px !important; }
html.app body.ab-admin .metrics-row { display: grid !important; grid-template-columns: 1fr 1fr !important; gap: 10px !important; }
html.app body.ab-admin .metric-card {
    padding: 14px !important; border-radius: 16px !important; border: 0 !important;
    box-shadow: 0 1px 3px rgba(15, 23, 42, .06) !important;
}
html.app body.ab-admin .metric-card .metric-title { font-size: 11px !important; }
html.app body.ab-admin .metric-icon-box { width: 30px !important; height: 30px !important; }
html.app body.ab-admin .metric-icon-box svg { width: 16px; height: 16px; }
html.app body.ab-admin .card, html.app body.ab-admin [class*="-card"]:not(.metric-card) { border-radius: 16px; }
html.app body.ab-admin .sidebar.show-sidebar { z-index: 1000 !important; }
html.app body.ab-admin .sidebar-overlay.show { z-index: 950 !important; }
html.app body.ab-admin:has(.sidebar.show-sidebar) .ab-tabbar { z-index: 940; filter: brightness(.55); }

/* ------------------------------------------------------- sign-in ---------- */
html.app body:has(.login-footer) { background: var(--ab-navy) !important; }
html.app .login-footer { display: none !important; }
html.app body:has(.login-footer) .login-card,
html.app body:has(.login-footer) [class*="login-container"] {
    border-radius: 24px !important; box-shadow: 0 24px 60px rgba(0, 0, 0, .4) !important;
}
html.app body > footer { display: none !important; }

/* ----------------------------------------------------- account sheet ------ */
html.app .ab-sheet-wrap { position: fixed; inset: 0; z-index: 2000; pointer-events: none; }
html.app .ab-sheet-backdrop {
    position: absolute; inset: 0; background: rgba(2, 6, 23, .5);
    opacity: 0; transition: opacity .2s;
}
html.app .ab-sheet {
    position: absolute; left: 0; right: 0; bottom: 0;
    background: #fff; border-radius: 22px 22px 0 0;
    padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
    transform: translateY(100%); transition: transform .25s ease;
}
html.app .ab-sheet-wrap.open { pointer-events: auto; }
html.app .ab-sheet-wrap.open .ab-sheet-backdrop { opacity: 1; }
html.app .ab-sheet-wrap.open .ab-sheet { transform: none; }
html.app .ab-sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: #cbd5e1; margin: 0 auto 16px; }
html.app .ab-sheet-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
html.app .ab-avatar-lg { width: 52px; height: 52px; font-size: 18px; line-height: 52px; }
html.app .ab-sheet-name { font-size: 17px; font-weight: 700; color: var(--ab-ink); }
html.app .ab-sheet-mail { font-size: 13px; color: var(--ab-muted); word-break: break-all; }
html.app .ab-sheet-row {
    display: flex; align-items: center; gap: 12px; padding: 12px 4px;
    border-top: 1px solid var(--ab-line); font-size: 14px; color: var(--ab-ink);
}
html.app .ab-sheet-row svg { width: 18px; height: 18px; color: var(--ab-muted); flex: 0 0 18px; }
html.app .ab-sheet-btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; height: 50px; margin-top: 10px; border-radius: 14px;
    border: 1px solid var(--ab-line); background: #f8fafc; color: var(--ab-ink);
    font: 600 15px inherit; text-decoration: none;
}
html.app .ab-sheet-logout { background: var(--ab-red-bg); border-color: transparent; color: var(--ab-red); }

/* --------------------------------------------- confirm / logout pop-ups ---- */
/* Complete on their own: on a phone (2026-11-02) modal.css did not apply and
   the logout and confirm boxes showed as plain text in the page. */
html.app .modal-overlay {
    position: fixed !important; inset: 0 !important; z-index: 3000 !important;
    display: flex !important; align-items: flex-end !important; justify-content: center !important;
    background: rgba(2, 6, 23, .55) !important;
    opacity: 0 !important; visibility: hidden !important; pointer-events: none !important;
    transition: opacity .2s, visibility .2s !important;
}
html.app .modal-overlay.active { opacity: 1 !important; visibility: visible !important; pointer-events: auto !important; }
html.app .modal-overlay .modal-content {
    width: 100% !important; max-width: 520px !important; margin: 0 !important; box-sizing: border-box;
    background: #fff !important; border: 0 !important; border-radius: 22px 22px 0 0 !important;
    padding: 22px 20px calc(20px + env(safe-area-inset-bottom)) !important;
    box-shadow: 0 -10px 30px rgba(2, 6, 23, .25) !important;
    transform: translateY(100%) !important; transition: transform .25s ease !important;
}
html.app .modal-overlay.active .modal-content { transform: none !important; }
html.app .modal-overlay .modal-header { display: flex !important; align-items: center !important; gap: 12px !important; margin: 0 0 8px !important; }
html.app .modal-overlay .modal-header svg { color: var(--ab-red) !important; }
html.app .modal-overlay .modal-title { margin: 0 !important; font-size: 18px !important; font-weight: 700 !important; color: var(--ab-ink) !important; }
html.app .modal-overlay .modal-body { margin: 0 0 18px !important; font-size: 14px !important; line-height: 1.5 !important; color: var(--ab-muted) !important; }
html.app .modal-overlay .modal-footer { display: flex !important; gap: 10px !important; justify-content: stretch !important; }
html.app .modal-overlay .btn-cancel,
html.app .modal-overlay .btn-confirm {
    flex: 1 !important; height: 50px !important; border: 0 !important; border-radius: 14px !important;
    font: 600 15px inherit !important; cursor: pointer;
}
html.app .modal-overlay .btn-cancel { background: #f1f5f9 !important; color: var(--ab-ink) !important; }
html.app .modal-overlay .btn-confirm { background: var(--ab-red) !important; color: #fff !important; }

}
