/* Smart BSE Alerts - Custom styles */

/* ──────────────────────────────────────────────────────────────────────
 *  Global typography — pack more info per screen, refined density
 * ────────────────────────────────────────────────────────────────────── */

:root {
    /* Override Pico v2 sizing scale. Pico's default is ~16/18px which
       feels like a consumer blog; financial dashboards read better at
       13-14px with tighter line-height. */
    --pico-font-size: 14px;
    --pico-line-height: 1.5;
    --pico-typography-spacing-vertical: 0.75rem;
    --pico-spacing: 0.85rem;
    --pico-form-element-spacing-vertical: 0.45rem;
    --pico-form-element-spacing-horizontal: 0.7rem;
    --pico-border-radius: 0.4rem;
    --pico-block-spacing-vertical: 1rem;
    --pico-block-spacing-horizontal: 1rem;

    /* System font stack: native UI fonts on each OS for an immediately
       'premium' feel, falling back to Inter (Pico ships it as default).
       Numbers use tabular figures wherever they appear in tables. */
    --pico-font-family-sans-serif:
        -apple-system, BlinkMacSystemFont,
        "Segoe UI Variable", "Segoe UI",
        Inter, Roboto, "Helvetica Neue", Helvetica,
        Arial, "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
    --pico-font-family: var(--pico-font-family-sans-serif);
    --pico-font-family-monospace:
        ui-monospace, "SF Mono", Menlo, Monaco, Consolas,
        "Cascadia Code", "Roboto Mono", monospace;
    --pico-font-weight: 400;
}

html { font-size: 14px; }

body {
    font-feature-settings: "ss01", "cv11", "kern";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1 { font-size: 1.5rem;  margin: 0.6rem 0 0.5rem; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h2 { font-size: 1.2rem;  margin: 0.6rem 0 0.4rem; line-height: 1.3;  font-weight: 600; letter-spacing: -0.005em; }
h3 { font-size: 1.02rem; margin: 0.55rem 0 0.35rem; line-height: 1.35; font-weight: 600; }
h4 { font-size: 0.92rem; margin: 0.5rem 0 0.3rem; line-height: 1.35; font-weight: 600; }
h5 { font-size: 0.85rem; margin: 0.4rem 0 0.25rem; font-weight: 600; }
h6 { font-size: 0.8rem;  margin: 0.4rem 0 0.25rem; font-weight: 600; }

p, li { line-height: 1.5; }
small { font-size: 0.82rem; }
code, kbd, pre, samp { font-size: 0.85em; }

/* Tables inherit a denser default everywhere - alerts table, deals
   table, IPO table, IPO financials table all benefit. Per-table CSS
   below can still override. */
table { font-size: 0.85rem; }
table th { font-weight: 600; }
table th, table td { padding: 0.4rem 0.65rem; }

/* Pico's <article> has a chunky 1.25rem-ish padding by default; tighten
   it across the board. Specific .alert-card / .ipo-table-wrap classes
   tune themselves further. */
article {
    padding: 0.7rem 0.85rem;
    margin-bottom: 0.6rem;
}

/* Container width slightly larger so dense tables don't feel squeezed. */
@media (min-width: 992px) {
    body > main.container,
    body > header.container,
    body > footer.container {
        max-width: 1100px;
    }
}

/* Form inputs feel premium when sized to match the body text exactly. */
input:not([type="checkbox"]):not([type="radio"]),
select, textarea, button[type="submit"], .button, [role="button"] {
    font-size: 0.9rem;
}

/* ──────────────────────────────────────────────────────────────────────
 *  Brand tokens — used by the navbar, active states, CTAs, etc.
 *  Stay close to Pico defaults so existing pages don't shift colour.
 * ────────────────────────────────────────────────────────────────────── */
:root {
    --brand-primary: #2563eb;        /* indigo-blue, same as theme-color meta */
    --brand-primary-hover: #1d4ed8;
    --brand-primary-tint: #eff6ff;   /* light hover/active background */
    --brand-accent: #10b981;         /* emerald — active-nav underline, "live"  */
    --brand-warning: #f59e0b;        /* amber — upgrade nudges  */
    --brand-danger: #dc2626;         /* red — logout, destructive  */
    --appnav-height: 56px;
    --appnav-border: #e5e7eb;
}

footer.container small {
    font-size: 0.78rem;
    color: var(--muted-color, #6b7280);
}

/* ──────────────────────────────────────────────────────────────────────
 *  App navigation — IA: Home · Watchlist · Events · Markets ▾ · Research ▾
 *  Right side: Upgrade pill + Account avatar dropdown.
 *  On <=768px the .appnav-main collapses into a full-screen drawer.
 *
 *  Important: this is intentionally NOT a literal <nav> element.
 *  Pico v2's nav component applies negative margins to links and flexes
 *  every nested nav <ul>, which made top-level hitboxes overlap and flyout
 *  items lay out horizontally. base.html uses <div role="navigation"> so
 *  this component owns its spacing end-to-end.
 * ────────────────────────────────────────────────────────────────────── */
body > header {
    background: #fff;
    border-bottom: 1px solid var(--appnav-border);
    box-shadow: inset 0 -2px 0 var(--brand-primary);
    position: sticky;
    top: 0;
    z-index: 50;
    margin-bottom: 0.5rem;
}

.appnav {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 1rem;
    height: var(--appnav-height);
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}
.appnav,
.appnav * {
    box-sizing: border-box;
}

.appnav-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color, #1f2937);
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none;
    flex-shrink: 0;
    justify-self: start;
}
.appnav-brand img {
    display: block;
    border-radius: 0.35rem;
}
.appnav-brand:hover { color: var(--brand-primary); }
.appnav-brand-tag {
    font-weight: 500;
    font-size: 0.78rem;
    color: var(--muted-color, #6b7280);
    letter-spacing: 0.01em;
    padding-left: 0.15rem;
    border-left: 1px solid rgba(0,0,0,0.12);
    padding: 0 0 0 0.5rem;
    margin-left: 0.1rem;
    line-height: 1.1;
    white-space: nowrap;
}
/* Hide the tagline on very narrow screens so it never wraps under the
   logo or competes for space with the hamburger toggle. */
@media (max-width: 380px) {
    .appnav-brand-tag { display: none; }
}

/* Wrapper exists only so the mobile drawer can toggle as one unit.
   On desktop ``display: contents`` makes its children participate in
   the parent grid directly (centre column for .appnav-primary,
   right column for .appnav-end). */
.appnav-main {
    display: contents;
}

.appnav-primary,
.appnav-end {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.appnav-primary { justify-self: center; }
.appnav-end { justify-self: end; gap: 0.8rem; }

.appnav-primary > li,
.appnav-end > li {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    align-items: center;
}

/* Reset Pico v2's margins inside our nav. Pico ships:
     summary { margin-bottom }
     details { margin-bottom: var(--pico-spacing) }
     details[open] > summary { margin-bottom: var(--pico-spacing) }
   The third one is the sneakiest — when a dropdown is open the summary
   gets ~14px extra bottom margin (Pico adds it to space the toggle
   from the revealed content). Inside a flex row that makes Markets/
   Research *visibly taller* than the plain links, so the row appears
   to "jump" up the moment the dropdown closes. We need higher
   specificity than Pico's ``details[open] > summary`` (0,1,2) — hence
   the explicit ``.appnav details[open] > summary`` (0,2,2) below. */
.appnav summary,
.appnav details,
.appnav details[open] > summary {
    margin: 0;
}

/* Primary links */
.appnav-link {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 0.75rem;
    border-radius: 0.35rem;
    color: var(--color, #1f2937);
    font-size: 0.92rem;
    font-weight: 500;
    text-decoration: none;
    line-height: 1.2;
    box-shadow: inset 0 -2px 0 transparent;
    transition: background 0.12s, color 0.12s, box-shadow 0.12s;
    white-space: nowrap;
    margin: 0;
}
.appnav-link:hover {
    background: var(--brand-primary-tint);
    color: var(--brand-primary);
}
.appnav-link.active {
    color: var(--brand-primary);
    box-shadow: inset 0 -2px 0 var(--brand-accent);
    font-weight: 600;
}

/* Dropdowns (Markets / Research) */
.appnav-dropdown {
    position: relative;
}
.appnav-dropdown > summary {
    list-style: none;
    cursor: pointer;
    min-height: 36px;
    padding: 0 0.75rem;
    border-radius: 0.35rem;
    font-size: 0.92rem;
    font-weight: 500;
    color: var(--color, #1f2937);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: inset 0 -2px 0 transparent;
    transition: background 0.12s, color 0.12s, box-shadow 0.12s;
    line-height: 1.2;
}
.appnav-dropdown > summary::-webkit-details-marker { display: none; }
.appnav-dropdown > summary::after {
    display: none;
    content: none;
}
.appnav-chevron {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--muted-color, #64748b);
    font-size: 1.25rem;
    font-weight: 400;
    line-height: 1;
    transition: transform 0.12s, color 0.12s;
    transform-origin: center;
}
.appnav-dropdown[open] .appnav-chevron {
    transform: rotate(90deg);
}
.appnav-dropdown > summary:hover,
.appnav-dropdown[open] > summary {
    background: var(--brand-primary-tint);
    color: var(--brand-primary);
}
.appnav-dropdown > summary:hover .appnav-chevron,
.appnav-dropdown[open] .appnav-chevron {
    color: var(--brand-primary);
}
.appnav-dropdown.has-active > summary {
    color: var(--brand-primary);
    box-shadow: inset 0 -2px 0 var(--brand-accent);
    font-weight: 600;
}
.appnav-dropdown > ul {
    display: block;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    list-style: none;
    margin: 0;
    padding: 0.4rem;
    background: #fff;
    border: 1px solid var(--appnav-border);
    border-radius: 0.5rem;
    box-shadow: 0 8px 22px rgba(0,0,0,0.08);
    min-width: 180px;
    z-index: 60;
}
.appnav-dropdown > ul > li {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    list-style: none;
}
.appnav-dropdown > ul .appnav-link {
    display: block;
    margin: 0;
    padding: 0.55rem 0.75rem;
    border-radius: 0.3rem;
    box-shadow: none;
    font-weight: 500;
    min-height: auto;
}
.appnav-dropdown > ul .appnav-link.active {
    background: var(--brand-primary-tint);
    box-shadow: none;
}

/* Upgrade pill — locked to the same 34-px visual height as the avatar
   so the right-hand controls share an exact baseline regardless of
   internal padding. */
.appnav-upgrade {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    padding: 0 0.95rem;
    border-radius: 999px;
    background: var(--brand-warning);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    line-height: 1;
    transition: background 0.12s, transform 0.12s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.appnav-upgrade:hover {
    background: #d97706;
    color: #fff;
    transform: translateY(-1px);
}

/* Anonymous "Sign in" CTA */
.appnav-cta {
    display: inline-block;
    padding: 0.45rem 0.95rem;
    border-radius: 0.4rem;
    background: var(--brand-primary);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    line-height: 1.2;
    transition: background 0.12s;
}
.appnav-cta:hover { background: var(--brand-primary-hover); color: #fff; }

/* Permanent ticker search in the global nav. Sits next to Research so
   any logged-in user can jump straight to a company's /financials/<sym>
   page from anywhere on the site. */
.appnav-search-li { display: flex; align-items: center; }
.appnav-search {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    height: 32px;
    padding: 0 0.45rem 0 0.55rem;
    border: 1px solid var(--appnav-border, #e5e7eb);
    border-radius: 999px;
    background: #fff;
    transition: border-color 0.12s, box-shadow 0.12s;
    margin: 0;
}
.appnav-search:focus-within {
    border-color: var(--brand-primary, #2563eb);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}
.appnav-search-icon {
    font-size: 0.78rem;
    line-height: 1;
    opacity: 0.6;
    pointer-events: none;
}
.appnav-search input[type="text"] {
    border: 0;
    outline: 0;
    background: transparent;
    font-size: 0.83rem;
    line-height: 1.2;
    padding: 0 0.1rem;
    width: 130px;
    color: #111827;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    /* Force light native widgets (autocomplete dropdown, autofill bg)
       even when the user has dark-mode set on the OS — otherwise Chrome
       renders the history dropdown as a dark rectangle overlapping our
       rounded pill. */
    color-scheme: light;
}
.appnav-search input[type="text"]::placeholder {
    color: #9ca3af;
    font-weight: 400;
    font-style: italic;
    text-transform: none;
    letter-spacing: 0;
    opacity: 1;
}
.appnav-search input[type="text"]:focus { width: 170px; }

/* Custom autocomplete dropdown — anchored to the form so it sits flush
   under the pill regardless of nav padding. */
.appnav-search { position: relative; }
.appnav-search-results {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 260px;
    max-width: 360px;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
    padding: 0.25rem 0;
    z-index: 1000;
    font-size: 0.85rem;
}
.appnav-search-item {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.4rem 0.7rem;
    cursor: pointer;
    line-height: 1.25;
    color: #111827;
}
.appnav-search-item .appnav-search-sym {
    font-weight: 600;
    color: #1f2937;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    min-width: 80px;
    flex-shrink: 0;
}
.appnav-search-item .appnav-search-name {
    color: #6b7280;
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.appnav-search-item.is-active,
.appnav-search-item:hover {
    background: #eff6ff;
}
.appnav-search-item.is-active .appnav-search-sym {
    color: var(--brand-primary, #2563eb);
}
.appnav-search-empty {
    padding: 0.55rem 0.7rem;
    color: #9ca3af;
    font-style: italic;
    font-size: 0.82rem;
}
@media (max-width: 900px) {
    .appnav-search-results {
        right: auto; left: 0;
        min-width: 100%; max-width: 100%;
    }
}
@media (max-width: 900px) {
    .appnav-search-li { width: 100%; }
    .appnav-search { width: 100%; height: 36px; }
    .appnav-search input[type="text"] { flex: 1; width: auto; }
    .appnav-search input[type="text"]:focus { width: auto; }
}

/* Avatar + account menu */
.appnav-account { position: relative; }
.appnav-account > summary {
    list-style: none;
    cursor: pointer;
    padding: 0;
    padding-inline-end: 0;
    display: inline-flex;
    align-items: center;
    height: 34px;
    background: transparent;
    border: 0;
}
.appnav-account > summary::-webkit-details-marker { display: none; }
/* The account summary doesn't need Pico's chevron — the avatar circle
   is the affordance. Hide it explicitly so it doesn't reserve space
   on the right of the avatar. */
.appnav-account > summary::after {
    display: none;
    content: none;
}
.appnav-account-label {
    display: none;
}

.appnav-avatar {
    display: inline-flex;
    width: 34px; height: 34px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    background: var(--brand-primary);
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    overflow: hidden;
    object-fit: cover;
    border: 2px solid transparent;
    transition: border-color 0.12s, box-shadow 0.12s;
}
.appnav-account > summary:hover .appnav-avatar,
.appnav-account[open] > summary .appnav-avatar {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 2px var(--brand-primary-tint);
}

.appnav-account-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 240px;
    background: #fff;
    border: 1px solid var(--appnav-border);
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    padding: 0.4rem;
    z-index: 60;
}
.appnav-account-header {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    margin-bottom: 0.2rem;
}
.appnav-account-header strong {
    font-size: 0.92rem;
    color: var(--color, #1f2937);
}
.appnav-account-header small {
    color: var(--muted-color, #6b7280);
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.appnav-plan-pill {
    display: inline-block;
    margin-top: 0.3rem;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    background: var(--brand-accent);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 600;
    width: fit-content;
}
.appnav-account-menu > ul {
    display: block;
    list-style: none;
    margin: 0;
    /* Small internal padding so the hover pills on Settings/Plan/Logout
       sit cleanly inside the menu border instead of hugging the edges. */
    padding: 0.25rem;
}
.appnav-account-menu > ul > li {
    display: block;
    margin: 0;
    padding: 0;
    list-style: none;
}
.appnav-account-menu a {
    display: block;
    margin: 0;
    padding: 0.55rem 0.75rem;
    font-size: 0.9rem;
    color: var(--color, #1f2937);
    text-decoration: none;
    border-radius: 0.3rem;
}
.appnav-account-menu a:hover {
    background: var(--brand-primary-tint);
    color: var(--brand-primary);
}
.appnav-account-menu .appnav-logout {
    color: var(--brand-danger);
    border-top: 1px solid #f3f4f6;
    margin-top: 0.25rem;
    padding-top: 0.55rem;
}
.appnav-account-menu .appnav-logout:hover {
    background: #fef2f2;
    color: #b91c1c;
}

/* Hamburger (hidden on desktop) */
.appnav-toggle {
    display: none;
    background: none;
    border: 0;
    box-shadow: none;
    color: inherit;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    margin: 0 0 0 auto;
    line-height: 1;
    width: auto;
    appearance: none;
}

/* ── Mobile: full-screen drawer with grouped sections ── */
@media (max-width: 768px) {
    /* Replace the desktop 1fr/auto/1fr grid with a simple flex row so the
       brand sits on the left and the hamburger on the right. The drawer
       (.appnav-main) is fixed-position when open, so it doesn't need a
       grid cell. */
    .appnav {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0 0.8rem;
    }
    .appnav-toggle { display: inline-flex; }

    .appnav-main {
        display: none;
        position: fixed;
        inset: var(--appnav-height) 0 0 0;
        background: #fff;
        flex-direction: column;
        align-items: stretch;
        padding: 0.8rem 1rem 1.5rem;
        gap: 0.3rem;
        overflow-y: auto;
        z-index: 100;
        border-top: 1px solid var(--appnav-border);
    }
    .appnav-main.open { display: flex; }

    .appnav-primary,
    .appnav-end {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 0;
    }
    .appnav-end {
        margin-left: 0;
        margin-top: auto;
        padding-top: 1rem;
        border-top: 1px solid var(--appnav-border);
        gap: 0.5rem;
    }
    .appnav-primary > li,
    .appnav-end > li {
        display: block;
        width: 100%;
    }

    .appnav-link,
    .appnav-dropdown > summary {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 48px;
        padding: 0 0.75rem;
        font-size: 1rem;
        border-radius: 0.4rem;
        border-bottom: 1px solid #f3f4f6;
        box-shadow: none;
    }
    .appnav-link.active {
        background: var(--brand-primary-tint);
        box-shadow: inset 3px 0 0 var(--brand-accent);
        border-bottom-color: var(--appnav-border);
    }
    .appnav-dropdown { width: 100%; }
    .appnav-dropdown > summary { justify-content: space-between; }
    .appnav-dropdown > ul {
        display: block;
        position: static;
        box-shadow: none;
        border: 0;
        padding: 0 0 0 0.8rem;
        background: transparent;
        min-width: 0;
    }
    .appnav-dropdown > ul .appnav-link {
        min-height: 42px;
        padding: 0 0.75rem;
        font-size: 0.95rem;
        color: var(--muted-color, #4b5563);
    }

    .appnav-upgrade,
    .appnav-cta {
        width: 100%;
        text-align: center;
        padding: 0.75rem;
    }

    .appnav-account { width: 100%; }
    .appnav-account > summary {
        display: flex;
        align-items: center;
        gap: 0.7rem;
        padding: 0.4rem 0;
        font-size: 0.95rem;
        font-weight: 600;
    }
    .appnav-account-label {
        display: inline;
    }
    .appnav-account > summary::after {
        display: none;
        content: none;
    }
    .appnav-account-menu {
        position: static;
        box-shadow: none;
        border: 0;
        padding: 0;
        margin-top: 0.4rem;
        min-width: 0;
    }
}

/* ── Category badges ── */
.badge {
    display: inline-block;
    padding: 0.2em 0.6em;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-financial { background: #dbeafe; color: #1e40af; }
.badge-dividend { background: #d1fae5; color: #065f46; }
.badge-board { background: #fef3c7; color: #92400e; }
.badge-insider { background: #fce7f3; color: #9d174d; }
.badge-corporate { background: #e0e7ff; color: #3730a3; }
.badge-management { background: #f3e8ff; color: #6b21a8; }
.badge-merger { background: #ffedd5; color: #9a3412; }
.badge-compliance { background: #f1f5f9; color: #475569; }
.badge-general { background: #f5f5f5; color: #737373; }
.badge-unanalyzed { background: #fef2f2; color: #991b1b; }

/* ── Impact indicators ── */
.impact-high { color: #dc2626; font-weight: 700; }
.impact-medium { color: #d97706; font-weight: 600; }
.impact-low { color: #6b7280; }

/* ── Alert cards ── */
.alert-card {
    display: block;
    color: inherit;
    text-decoration: none;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.5rem;
    background: #fff;
    transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
}

.alert-card:hover {
    border-color: var(--brand-primary, #2563eb);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.10);
    transform: translateY(-1px);
    color: inherit;
}
.alert-card:focus-visible {
    outline: 2px solid var(--brand-primary, #2563eb);
    outline-offset: 2px;
}
.alert-card:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.08);
}

.alert-card-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.alert-company {
    font-size: 0.95rem;
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 28ch;
}

.alert-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--muted-color, #6b7280);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.alert-meta small { font-size: 0.8rem; }

.alert-link {
    font-size: 0.85rem;
    text-decoration: none;
    white-space: nowrap;
}

.impact-pill {
    font-size: 0.85rem;
    line-height: 1;
}

.alert-summary {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--color, #1f2937);
    /* Clamp the summary to two lines so each card stays compact (3 lines
       total: header row + 2 lines of summary). Multi-line ellipsis is
       supported in all modern browsers via -webkit-line-clamp. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Older legacy class kept for any cached pages or tests; keeps space-between layout. */
.alert-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 0.5rem;
}

/* ── Watchlist entries ── */
.watchlist-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

/* ── Responsive stacking ── */
@media (max-width: 576px) {
    .alert-card-row {
        gap: 0.35rem;
    }

    .alert-company {
        max-width: 18ch;
    }

    .alert-meta {
        margin-left: auto;
        gap: 0.4rem;
    }

    .alert-card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .watchlist-entry {
        flex-direction: column;
        align-items: flex-start;
    }

    .watchlist-entry button {
        align-self: flex-end;
    }
}

/* ── Status indicators ── */
.status-ok { color: #16a34a; }
.status-warn { color: #d97706; }
.status-error { color: #dc2626; }


/* -- IPO list table -- */
.ipo-table-wrap {
    margin-top: 1rem;
    border: 1px solid var(--card-border-color, #e5e7eb);
    border-radius: 0.5rem;
    overflow-x: auto;
}
.ipo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    margin-bottom: 0;
}
.ipo-table thead th {
    background: var(--card-sectionning-background-color, #f9fafb);
    text-align: left;
    padding: 0.4rem 0.6rem;
    font-weight: 600;
    color: var(--muted-color, #6b7280);
    text-transform: uppercase;
    font-size: 0.66rem;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--card-border-color, #e5e7eb);
    white-space: nowrap;
}
.ipo-table tbody td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--card-border-color, #f1f5f9);
    vertical-align: middle;
    white-space: nowrap;
}
.ipo-table tbody tr:last-child td { border-bottom: none; }
.ipo-table tbody tr:hover { background: var(--card-sectionning-background-color, #fafbfd); }
.ipo-table th.num, .ipo-table td.num { text-align: right; font-variant-numeric: tabular-nums; }

.ipo-company-link {
    font-weight: 600;
    text-decoration: none;
    color: var(--primary, #2563eb);
}
.ipo-company-link:hover { text-decoration: underline; }
.ipo-company {
    max-width: 24ch;
    overflow: hidden;
    text-overflow: ellipsis;
}
.ipo-symbol code {
    font-size: 0.78rem;
    background: var(--card-sectionning-background-color, #f3f4f6);
    padding: 0.05rem 0.3rem;
    border-radius: 0.2rem;
}

.ipo-status-live    { color: #dc2626; font-weight: 600; }
.ipo-status-upcoming { color: #b45309; font-weight: 600; }
.ipo-status-closed  { color: #6d28d9; font-weight: 600; }
.ipo-status-listed  { color: #15803d; font-weight: 600; }
.ipo-status-other   { color: #6b7280; }

@media (max-width: 600px) {
    .ipo-table { font-size: 0.75rem; }
    /* On phones drop the optional columns to keep the row scannable */
    .ipo-table th:nth-child(4),  .ipo-table td:nth-child(4),  /* Issue ₹ */
    .ipo-table th:nth-child(5),  .ipo-table td:nth-child(5),  /* Band */
    .ipo-table th:nth-child(8),  .ipo-table td:nth-child(8),  /* Open */
    .ipo-table th:nth-child(10), .ipo-table td:nth-child(10) { /* Listing */
        display: none;
    }
    .ipo-company { max-width: 14ch; }
}

/* -- Footer last-updated badge -- */
.last-updated {
    color: var(--muted-color, #6b7280);
    font-variant-numeric: tabular-nums;
}
