/* =====================================================================
   Finfolio — Premium admin theme
   Clean, white-based, spacious, financial-app aesthetic.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --ff-bg: #f6f7fb;
    --ff-surface: #ffffff;
    --ff-border: #e8eaf0;
    --ff-text: #171a2b;
    --ff-text-muted: #6b7280;
    --ff-primary: #4a6cf7;
    --ff-primary-dark: #3955d8;
    --ff-primary-soft: #eef2ff;
    --ff-accent: #b8892b;
    --ff-danger: #d92d20;
    --ff-danger-soft: #fef0ef;
    --ff-success: #17a366;
    --ff-success-soft: #e7f8f0;
    --ff-warning: #b5670a;
    --ff-warning-soft: #fdf1e0;
    --ff-purple: #6f3fd1;
    --ff-purple-soft: #f2ecfb;
    --ff-blue: #2563b8;
    --ff-blue-soft: #e9f1fd;
    --ff-radius: 16px;
    --ff-radius-sm: 12px;
    --ff-shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 20px rgba(16,24,40,.05);
    --ff-sidebar-w: 260px;

    /* "Gulluck" brand palette — scoped to the auth screens (login/forgot-
       password/first-time setup) and the sidebar only, per explicit user
       request 2026-08-22. Deliberately NOT wired into --ff-primary etc.,
       so the rest of the app (dashboard, tables, buttons elsewhere) keeps
       its existing look until/unless a wider re-theme is asked for. */
    --gl-cream: #faf5f0;
    --gl-terracotta: #d06b2e;
    --gl-terracotta-dark: #b8591f;
    --gl-terracotta-soft: #feeeda;
    --gl-navy: #1e2540;
    --gl-blue: #2147cc;
    --gl-blue-dark: #1a38a8;
}

* { box-sizing: border-box; }

body {
    background: var(--ff-bg);
    color: var(--ff-text);
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    font-size: 14.5px;
}

a { text-decoration: none; }

/* ---------- Auth screen ("Gulluck" brand theme, 2026-08-22) ---------- */
.auth-body {
    background: var(--gl-cream);
    min-height: 100vh;
    display: flex;
}
/* Left brand panel — a single flat image (logo, headline, illustration,
   feature strip) cropped straight from the approved design mockup rather
   than rebuilt as markup, so it matches pixel-for-pixel. Hidden below the
   md breakpoint: at narrow widths there's no room for it beside the card,
   and the card alone still carries the "Gulluck" wordmark + icon. */
.auth-hero { flex: 0 0 46%; max-width: 640px; position: relative; overflow: hidden; display: none; }
.auth-hero img { width: 100%; height: 100%; object-fit: cover; display: block; }
.auth-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; min-height: 100vh; }
@media (min-width: 900px) { .auth-hero { display: block; } }

.auth-wrapper { width: 100%; max-width: 420px; padding: 24px; }
.auth-card {
    background: #fff;
    border: none;
    border-radius: 22px;
    padding: 44px 40px;
    box-shadow: 0 2px 4px rgba(30,37,64,.04), 0 24px 60px rgba(30,37,64,.10);
}
.auth-brand {
    display: flex; flex-direction: column; align-items: center; text-align: center;
    gap: 14px; font-size: 1.5rem; font-weight: 800; color: var(--gl-navy);
}
.auth-brand-badge {
    width: 84px; height: 84px; border-radius: 50%;
    background: var(--gl-terracotta-soft);
    display: inline-flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.auth-brand-badge img { width: 52px; height: auto; display: block; }
.auth-subtitle { color: var(--ff-text-muted); margin: 6px 0 24px; text-align: center; }
.auth-card .btn-primary {
    background: var(--gl-blue); border-color: var(--gl-blue);
}
.auth-card .btn-primary:hover, .auth-card .btn-primary:focus {
    background: var(--gl-blue-dark); border-color: var(--gl-blue-dark);
}
.auth-footer { text-align: center; color: var(--ff-text-muted); margin-top: 20px; font-size: .85rem; }
.auth-trust {
    display: flex; align-items: center; justify-content: center; gap: 6px;
    margin-top: 18px; color: var(--ff-text-muted); font-size: .82rem;
}
.auth-trust i { color: #2f9e44; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--ff-sidebar-w);
    flex-shrink: 0;
    background: var(--gl-cream);
    border-right: 1px solid #f0e6da;
    color: var(--ff-text);
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: margin-left .2s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px 22px;
}
.sidebar-brand-icon { width: 38px; height: auto; flex-shrink: 0; display: block; }
.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sidebar-brand-text strong { font-size: 1.05rem; font-weight: 800; color: var(--gl-navy); }
.sidebar-brand-text span { font-size: .68rem; color: var(--ff-text-muted); font-weight: 500; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: 12px;
    color: var(--gl-navy);
    padding: 10px 12px;
    border-radius: var(--ff-radius-sm);
    font-weight: 500;
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
}
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: #f5ece0; color: var(--gl-navy); }
.sidebar-nav .nav-link.active { background: var(--gl-terracotta-soft); color: var(--gl-terracotta-dark); font-weight: 600; }
.sidebar-nav .nav-link-button { cursor: pointer; }
.sidebar-divider { height: 1px; background: #f0e6da; margin: 14px 6px; }
.sidebar-mascot { margin-top: auto; padding: 24px 10px 8px; text-align: center; }
.sidebar-mascot img { width: 116px; height: auto; margin-bottom: 10px; }
.sidebar-mascot p { font-size: .78rem; color: var(--gl-navy); font-weight: 600; line-height: 1.4; margin: 0; }

.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.app-topbar {
    display: flex; align-items: center; gap: 16px;
    padding: 14px 28px;
    background: var(--ff-surface);
    border-bottom: 1px solid var(--ff-border);
    position: sticky; top: 0; z-index: 20;
}
.sidebar-toggle {
    display: none;
    border: none; background: transparent; font-size: 1.4rem; color: var(--ff-text);
}
.topbar-search { position: relative; flex: 1; max-width: 480px; }
.topbar-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--ff-text-muted); }
.topbar-search input {
    width: 100%; padding: 9px 14px 9px 38px;
    border-radius: 999px; border: 1px solid var(--ff-border);
    background: var(--ff-bg);
    font-size: .9rem;
}
.topbar-search input:focus { outline: none; border-color: var(--ff-primary); background: var(--ff-surface); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-user { display: flex; align-items: center; gap: 8px; border: none; background: transparent; padding: 6px 10px; border-radius: 999px; }
.topbar-user:hover { background: var(--ff-bg); }
.user-avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--ff-primary-soft); color: var(--ff-primary);
    display: flex; align-items: center; justify-content: center; font-weight: 700;
}

.app-content { padding: 28px; max-width: 1400px; width: 100%; margin: 0 auto; }

.flash-stack { margin-bottom: 18px; }

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header h1 { font-size: 1.55rem; font-weight: 700; margin: 0 0 4px; letter-spacing: -.01em; }
.page-header p { color: var(--ff-text-muted); margin: 0; }

/* ---------- Cards ---------- */
.ff-card {
    background: var(--ff-surface);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    box-shadow: var(--ff-shadow);
    padding: 22px;
}
.ff-card + .ff-card { margin-top: 20px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat-card {
    background: var(--ff-surface);
    border: 1px solid var(--ff-border);
    border-radius: var(--ff-radius);
    box-shadow: var(--ff-shadow);
    padding: 20px 22px;
    display: flex; flex-direction: column; gap: 10px;
}
.stat-card .stat-icon {
    width: 40px; height: 40px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: var(--ff-primary-soft); color: var(--ff-primary); font-size: 1.15rem;
}
.stat-card .stat-value { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; }
.stat-card .stat-label { color: var(--ff-text-muted); font-size: .85rem; }

/* Rotate accent colors across the standard metric icons so a row of stat
   cards reads with the same varied, colorful-but-white look as the rest of
   the app's semantic palette (kept purely presentational — no new markup). */
.stat-card .stat-icon:has(.bi-people-fill) { background: var(--ff-primary-soft); color: var(--ff-primary); }
.stat-card .stat-icon:has(.bi-graph-up-arrow) { background: var(--ff-success-soft); color: var(--ff-success); }
.stat-card .stat-icon:has(.bi-bank2) { background: var(--ff-purple-soft); color: var(--ff-purple); }
.stat-card .stat-icon:has(.bi-envelope-fill) { background: var(--ff-blue-soft); color: var(--ff-blue); }
.stat-card .stat-icon:has(.bi-phone-fill) { background: var(--ff-warning-soft); color: var(--ff-warning); }
.stat-card .stat-icon:has(.bi-check-circle-fill) { background: var(--ff-success-soft); color: var(--ff-success); }
.stat-card .stat-icon:has(.bi-rocket-takeoff-fill) { background: var(--ff-warning-soft); color: var(--ff-warning); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.ff-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.ff-table th {
    text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--ff-text-muted); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--ff-border);
    white-space: nowrap;
}
.ff-table td { padding: 14px; border-bottom: 1px solid var(--ff-border); vertical-align: middle; }
.ff-table tr:last-child td { border-bottom: none; }
.ff-table tr:hover td { background: #fafbfc; }

.masked-value { font-family: 'SFMono-Regular', Consolas, monospace; letter-spacing: .02em; }

/* ---------- Badges ---------- */
.badge-active { background: var(--ff-success-soft); color: var(--ff-success); }
.badge-inactive { background: #f1f2f4; color: var(--ff-text-muted); }
.badge-closed { background: var(--ff-danger-soft); color: var(--ff-danger); }
.badge-neutral { background: #f1f2f4; color: var(--ff-text-muted); }
.badge-warning { background: var(--ff-warning-soft); color: var(--ff-warning); }
.badge-active, .badge-inactive, .badge-closed, .badge-neutral, .badge-warning {
    font-weight: 600; padding: 5px 11px; border-radius: 999px; font-size: .76rem; text-transform: capitalize;
}

/* ---------- IPO Cards (compact, one per row) ---------- */
.ipo-card-grid { display: flex; flex-direction: column; gap: 10px; }
.ipo-group-heading {
    font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
    color: var(--ff-text-muted); margin: 14px 0 -2px; padding-top: 10px; border-top: 1px solid var(--ff-border);
}
.ipo-group-heading:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.ipo-card {
    background: var(--ff-surface); border: 1px solid var(--ff-border); border-radius: var(--ff-radius);
    box-shadow: var(--ff-shadow); padding: 12px 18px;
    display: flex; align-items: center; flex-wrap: wrap; gap: 18px;
}
.ipo-card-top { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; }
.ipo-card-identity { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.ipo-card-logo {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    background: var(--ff-primary-soft); color: var(--ff-primary);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .95rem;
}
.ipo-card-name { font-size: .92rem; font-weight: 700; margin: 0; line-height: 1.25; }
.ipo-card-name a { color: inherit; text-decoration: none; }
.ipo-card-name a:hover { color: var(--ff-primary); text-decoration: underline; }
.ipo-card-badges { display: flex; gap: 5px; margin-top: 4px; flex-wrap: wrap; }
.ipo-card-badges .badge-active, .ipo-card-badges .badge-inactive, .ipo-card-badges .badge-closed,
.ipo-card-badges .badge-neutral, .ipo-card-badges .badge-warning { padding: 3px 9px; font-size: .68rem; }
.ipo-card-invest { text-align: right; flex: 0 0 auto; min-width: 110px; }
.ipo-card-invest .amount { font-size: 1.05rem; font-weight: 700; color: var(--ff-success); }
.ipo-card-invest .shares { color: var(--ff-text-muted); font-size: .74rem; margin-left: 3px; }
.ipo-card-invest .label { color: var(--ff-text-muted); font-size: .62rem; text-transform: uppercase; letter-spacing: .04em; margin-top: 1px; }

.ipo-stat-grid {
    display: flex; flex-wrap: wrap; gap: 16px;
    margin: 0; padding: 0 18px; border-left: 1px solid var(--ff-border); border-right: 1px solid var(--ff-border);
    flex: 1 1 320px;
}
.ipo-stat-item { min-width: 76px; }
.ipo-stat-item .stat-label {
    display: flex; align-items: center; gap: 4px; color: var(--ff-text-muted);
    font-size: .6rem; text-transform: uppercase; letter-spacing: .03em; margin-bottom: 2px;
}
.ipo-stat-item .stat-value { font-weight: 700; font-size: .8rem; }

.ipo-timeline { display: flex; justify-content: space-between; position: relative; flex: 1 1 260px; min-width: 220px; }
.ipo-timeline::before { content: ''; position: absolute; top: 9px; left: 6%; right: 6%; height: 2px; background: var(--ff-border); }
.ipo-timeline-item { position: relative; flex: 1; text-align: center; z-index: 1; }
.ipo-timeline-dot {
    width: 20px; height: 20px; border-radius: 50%; margin: 0 auto 4px;
    background: var(--ff-surface); border: 2px solid var(--ff-border); color: var(--ff-text-muted);
    display: flex; align-items: center; justify-content: center; font-size: .6rem;
}
.ipo-timeline-item.is-done .ipo-timeline-dot { background: var(--ff-primary); border-color: var(--ff-primary); color: #fff; }
.ipo-timeline-item.is-current .ipo-timeline-dot { background: var(--ff-accent); border-color: var(--ff-accent); color: #fff; }
.ipo-timeline-date { font-weight: 700; font-size: .68rem; }
.ipo-timeline-label { color: var(--ff-text-muted); font-size: .62rem; }
.ipo-timeline-status { font-size: .56rem; text-transform: uppercase; letter-spacing: .03em; font-weight: 600; color: var(--ff-text-muted); margin-top: 1px; }
.ipo-timeline-item.is-done .ipo-timeline-status { color: var(--ff-primary); }
.ipo-timeline-item.is-current .ipo-timeline-status { color: var(--ff-accent); }

.ipo-card-footer { flex: 0 0 auto; margin: 0; }

/* Live subscription (bidding demand) mini-panel — always its own
   full-width row within the card, under everything else, regardless of
   screen width. Only rendered for "Open for Subscription" / "Closed but
   Not Listed" cards (see ipos/index.php's $showSubscription). Source:
   Chittorgarh's live subscription report (NSE's own site has no
   fetchable public data for this — see IpoSubscriptionService's doc
   comment). Per explicit user request 2026-08-20. */
.ipo-subscription {
    flex-basis: 100%; border-top: 1px dashed var(--ff-border);
    padding-top: 10px; margin-top: 2px;
}
.ipo-subscription-header {
    display: flex; justify-content: space-between; align-items: baseline;
    font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
    color: var(--ff-text-muted); margin-bottom: 6px;
}
.ipo-subscription-header .as-of { text-transform: none; font-weight: 500; letter-spacing: normal; }
.ipo-subscription-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.ipo-subscription-grid .label {
    display: block; color: var(--ff-text-muted); font-size: .6rem;
    text-transform: uppercase; letter-spacing: .03em; margin-bottom: 1px;
}
.ipo-subscription-grid .value { display: block; font-weight: 700; font-size: .8rem; }
.ipo-subscription-empty { color: var(--ff-text-muted); font-size: .74rem; }
.ipo-subscription-prediction {
    display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; padding-top: 8px;
    border-top: 1px dashed var(--ff-border); font-size: .74rem; color: var(--ff-text-muted);
}
.ipo-subscription-prediction strong { color: inherit; }
.ipo-card-gmp {
    flex-basis: 100%; font-size: .74rem; padding-top: 6px; margin-top: 2px;
}
.ipo-card-gmp strong { color: inherit; }

@media (max-width: 1100px) {
    .ipo-stat-grid { border-left: none; border-right: none; order: 3; flex-basis: 100%; padding: 10px 0 0; border-top: 1px solid var(--ff-border); }
    .ipo-timeline { order: 4; flex-basis: 100%; padding-top: 6px; }
    .ipo-card-invest { order: 2; }
    .ipo-subscription { order: 5; }
    .ipo-card-footer { order: 6; }
}

/* ---------- IPO Application Matrix ---------- */
/* Column width bumped 30% (110px -> 143px, 100px -> 130px) per explicit
   user request 2026-08-20, to give the Refund Date / Est. Gain lines added
   the same day more room to breathe without wrapping awkwardly. */
.ipo-matrix-th { max-width: 157px; white-space: normal; vertical-align: bottom; }
.ipo-matrix-company {
    display: block; max-width: 144px; white-space: normal; word-break: break-word;
    line-height: 1.25; font-weight: 700;
}
.ipo-matrix-date { display: block; margin-top: 3px; }
.ipo-matrix-badge { display: inline-block; margin-top: 5px; font-size: .62rem; padding: 2px 8px; }

/* ---------- Buttons ---------- */
.btn-primary { background: var(--ff-primary); border-color: var(--ff-primary); }
.btn-primary:hover, .btn-primary:focus { background: var(--ff-primary-dark); border-color: var(--ff-primary-dark); }
.btn-outline-primary { color: var(--ff-primary); border-color: var(--ff-primary); }
.btn-outline-primary:hover { background: var(--ff-primary); border-color: var(--ff-primary); }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--ff-text-muted); }
.empty-state i { font-size: 2.6rem; color: #cfd4db; margin-bottom: 14px; display: block; }
.empty-state h3 { color: var(--ff-text); font-size: 1.1rem; margin-bottom: 6px; }

/* ---------- Tabs ---------- */
.ff-tabs { border-bottom: 1px solid var(--ff-border); margin-bottom: 20px; }
.ff-tabs .nav-link { color: var(--ff-text-muted); font-weight: 600; border: none; border-bottom: 2px solid transparent; padding: 10px 4px; margin-right: 24px; }
.ff-tabs .nav-link.active { color: var(--ff-primary); border-bottom-color: var(--ff-primary); background: transparent; }

/* ---------- Profile header ---------- */
.profile-header { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; flex-wrap: wrap; }
.profile-avatar {
    width: 64px; height: 64px; border-radius: 50%;
    background: var(--ff-primary-soft); color: var(--ff-primary);
    display: flex; align-items: center; justify-content: center; font-size: 1.6rem; font-weight: 700;
}
.profile-meta { display: flex; gap: 22px; flex-wrap: wrap; color: var(--ff-text-muted); font-size: .9rem; margin-top: 4px; }
.profile-meta span i { margin-right: 6px; }

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: .86rem; }
.form-section-title { font-size: 1rem; font-weight: 700; margin: 26px 0 14px; padding-top: 10px; border-top: 1px solid var(--ff-border); }
.form-section-title:first-child { border-top: none; padding-top: 0; margin-top: 0; }

/* ---------- Reveal ---------- */
.reveal-field { display: inline-flex; align-items: center; gap: 8px; }
.reveal-btn { background: none; border: none; color: var(--ff-primary); font-size: .85rem; padding: 0; }
.reveal-btn:hover { text-decoration: underline; }

/* ---------- Pagination ---------- */
.ff-pagination { display: flex; gap: 6px; justify-content: flex-end; margin-top: 18px; }

/* ---------- IPO Activity Calendar (Dashboard) ---------- */
.ipo-cal-header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; }
.ipo-cal-title { font-size: 1.1rem; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 7px; }
.ipo-cal-title i { font-size: .85rem; cursor: help; }
.ipo-cal-subtitle { color: var(--ff-text-muted); font-size: .85rem; margin: 2px 0 0; }
.ipo-cal-nav { display: flex; align-items: center; gap: 8px; }
.ipo-cal-range { text-align: center; font-weight: 700; margin-bottom: 16px; }
.ipo-cal-range .badge-active { margin-left: 8px; vertical-align: middle; }

.ipo-cal-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.ipo-cal-stat {
    border-radius: var(--ff-radius); padding: 16px 18px;
    background: var(--ff-surface); border: 1px solid var(--ff-border); box-shadow: var(--ff-shadow);
}
.ipo-cal-stat .label { font-size: .68rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; margin-bottom: 6px; color: var(--ff-text-muted); }
.ipo-cal-stat .value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.ipo-cal-stat .desc { font-size: .76rem; color: var(--ff-text-muted); margin-top: 3px; }
.ipo-cal-stat.is-open .value { color: var(--ff-success); }
.ipo-cal-stat.is-allot .value { color: var(--ff-purple); }
.ipo-cal-stat.is-listing .value { color: var(--ff-blue); }
.ipo-cal-stat.is-today .value { color: var(--ff-warning); }
.ipo-cal-stat-clickable {
    cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.ipo-cal-stat-clickable:hover, .ipo-cal-stat-clickable:focus-visible {
    transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, .08); border-color: var(--ff-border-strong, var(--ff-border));
    outline: none;
}

.ipo-cal-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 10px; min-width: 760px; }
.ipo-cal-day { border: 1px solid var(--ff-border); border-radius: var(--ff-radius-sm); padding: 10px; min-height: 130px; background: #fbfbfd; }
.ipo-cal-day.is-today { border-color: var(--ff-primary); background: var(--ff-primary-soft); }
.ipo-cal-day-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.ipo-cal-day-name { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ff-text-muted); font-weight: 700; }
.ipo-cal-day.is-today .ipo-cal-day-name { color: var(--ff-primary); }
.ipo-cal-day-date { font-weight: 700; font-size: .9rem; }
.ipo-cal-day-count { background: #fff; border: 1px solid var(--ff-border); border-radius: 999px; font-size: .68rem; padding: 1px 7px; color: var(--ff-text-muted); }

.ipo-cal-event {
    display: block; border-left: 3px solid var(--ff-border); border-radius: 6px; background: #fff;
    padding: 6px 8px; margin-bottom: 6px; font-size: .76rem; text-decoration: none; color: inherit;
}
.ipo-cal-event:hover { background: var(--ff-bg); }
.ipo-cal-event .company { font-weight: 700; display: block; color: var(--ff-text); }
.ipo-cal-event .badge-line { display: block; font-weight: 700; font-size: .66rem; text-transform: uppercase; letter-spacing: .02em; }
.ipo-cal-event .sub { display: block; color: var(--ff-text-muted); font-size: .7rem; }
.ipo-cal-event.type-open { border-left-color: var(--ff-success); }
.ipo-cal-event.type-open .badge-line { color: var(--ff-success); }
.ipo-cal-event.type-closing { border-left-color: var(--ff-warning); }
.ipo-cal-event.type-closing .badge-line { color: var(--ff-warning); }
.ipo-cal-event.type-allotment { border-left-color: var(--ff-purple); }
.ipo-cal-event.type-allotment .badge-line { color: var(--ff-purple); }
.ipo-cal-event.type-listing { border-left-color: var(--ff-blue); }
.ipo-cal-event.type-listing .badge-line { color: var(--ff-blue); }
.ipo-cal-event.type-refund { border-left-color: #0c8599; }
.ipo-cal-event.type-refund .badge-line { color: #0c8599; }

/* An archived IPO's event still shows on the calendar if its date falls in
   the viewed week (see DashboardController::index() / Ipo::allArchivedForCalendar()) —
   dashed + faded so it reads as historical rather than an active IPO. */
.ipo-cal-event.is-archived { opacity: .68; border-left-style: dashed; }
.ipo-cal-archived-tag {
    display: inline-block; font-weight: 600; font-size: .6rem; text-transform: uppercase;
    letter-spacing: .02em; color: var(--ff-text-muted); background: var(--ff-bg);
    border: 1px solid var(--ff-border); border-radius: 999px; padding: 0 5px; margin-left: 4px;
}

.ipo-cal-empty-day { color: var(--ff-text-muted); font-size: .72rem; text-align: center; padding-top: 20px; }

.ipo-cal-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 16px; font-size: .78rem; color: var(--ff-text-muted); }
.ipo-cal-legend .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.ipo-cal-legend .dot-open { background: var(--ff-success); }
.ipo-cal-legend .dot-closing { background: var(--ff-warning); }
.ipo-cal-legend .dot-allotment { background: var(--ff-purple); }
.ipo-cal-legend .dot-listing { background: var(--ff-blue); }
.ipo-cal-legend .dot-refund { background: #0c8599; }

/* ---------- Fund Availability ---------- */
.fund-blocked { color: var(--ff-warning); font-weight: 600; }
.fund-available { color: var(--ff-success); font-weight: 700; }
.fund-borrowed { color: var(--ff-danger); font-weight: 600; }
.fund-self-form { margin: 0; }
.fund-self-input-wrap { display: inline-flex; align-items: center; gap: 6px; justify-content: flex-end; }
.fund-self-input { width: 110px; padding: 4px 8px; border: 1px solid var(--ff-border, #d8dce3); border-radius: 6px; text-align: right; font-size: 0.85rem; }
.fund-self-input-wrap .btn { padding: 3px 8px; line-height: 1; }

/* ---------- IPO Fund Ownership / Profit Sharing / Settlement ---------- */
.fund-ownership-panel {
    background: var(--ff-bg); border: 1px solid var(--ff-border, #e6e8ec); border-radius: 8px;
    padding: 10px 14px; font-size: 0.85rem; color: var(--ff-text-muted); display: flex; flex-wrap: wrap; gap: 16px; align-items: center;
}
.fund-ownership-panel.has-data { color: inherit; }
.fund-panel-item { white-space: nowrap; }
.capital-profit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.capital-profit-item { background: var(--ff-bg); border-radius: 8px; padding: 12px 14px; text-align: center; }
.capital-profit-item .label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ff-text-muted); margin-bottom: 4px; }
.capital-profit-item .value { font-size: 1.15rem; font-weight: 700; }

/* Listed IPO "Subscription & Allotment" card: a real two-panel split
   (divider between them, per-panel header sitting tight above its own
   chart, custom legend) rather than two default Chart.js donuts floating
   in open space — the first pass at this read like an unstyled demo, per
   explicit user feedback 2026-08-21. */
.ipo-chart-panels { display: flex; flex-wrap: wrap; }
.ipo-chart-panel { flex: 1 1 260px; min-width: 230px; padding: 4px 32px; display: flex; flex-direction: column; align-items: center; }
.ipo-chart-panel:first-child { padding-left: 4px; }
.ipo-chart-panel:last-child { padding-right: 4px; }
.ipo-chart-panel + .ipo-chart-panel { border-left: 1px solid var(--ff-border); }
.ipo-chart-panel-head { width: 100%; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 18px; }
.ipo-chart-panel-title { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ff-text-muted); }
.ipo-chart-panel-meta { font-size: .74rem; color: var(--ff-text-muted); white-space: nowrap; }
.ipo-donut-wrap { position: relative; width: 190px; height: 190px; margin: 0 auto 20px; }
.ipo-chart-legend { list-style: none; margin: 0; padding: 0; width: 100%; max-width: 240px; }
.ipo-chart-legend li { display: flex; align-items: center; gap: 9px; padding: 7px 0; font-size: .82rem; border-bottom: 1px dashed var(--ff-border); }
.ipo-chart-legend li:last-child { border-bottom: none; padding-bottom: 0; }
.ipo-chart-legend .dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.ipo-chart-legend .name { flex: 1; color: var(--ff-text); font-weight: 500; }
.ipo-chart-legend .value { font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 720px) {
    .ipo-chart-panel + .ipo-chart-panel { border-left: none; border-top: 1px solid var(--ff-border); margin-top: 20px; padding-top: 20px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .app-sidebar { position: fixed; z-index: 40; margin-left: calc(-1 * var(--ff-sidebar-w)); box-shadow: 0 0 40px rgba(16,24,40,.15); }
    .app-sidebar.open { margin-left: 0; }
    .sidebar-toggle { display: inline-block; }
    .app-content { padding: 18px; }
    .topbar-search { display: none; }
}
