/* Custom dark dropdown styles */
select, select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

select:focus, select:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}
/* ========================================
   COMPANY PORTAL - DARK MODERN THEME
   ======================================== */

/* Color Variables */
:root {
    /* Dark Backgrounds */
    --bg-primary: #050d1a;
    --bg-secondary: #1a2b4d;
    --bg-tertiary: #243354;
    --bg-hover: #2d3e5f;
    
    /* Text Colors */
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    /* Accent Colors */
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-green: #10b981;
    --accent-green-hover: #059669;
    --accent-red: #ef4444;
    --accent-orange: #f97316;
    --accent-purple: #8b5cf6;
    
    /* UI Elements */
    --border-color: #374151;
    --input-bg: #1f3a52;
    --input-border: #4b5563;
    --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* ========================================
   LAYOUT STRUCTURE
   ======================================== */

.layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    position: relative;
    z-index: 1; /* above the mesh background */
}

/* Nav + page body sit inside .content (not a fixed left screen rail) */
/* Same vertical rhythm everywhere: optional full-width banners, then nav | main */
.page-top-banners {
    flex-shrink: 0;
    padding: 16px 28px 0 16px;
    box-sizing: border-box;
}

.page-top-banners .alert:last-child {
    margin-bottom: 12px;
}

.app-body-layout {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    width: 100%;
    min-height: 0;
    flex: 1;
    padding-top: 16px;
    padding-bottom: 24px;
    box-sizing: border-box;
}

.content:has(.page-top-banners) .app-body-layout {
    padding-top: 4px;
}

/* Sticky is relative to .content scrollport — not viewport header offset */
.inline-app-nav {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: sticky;
    top: 12px;
    align-self: flex-start;
    max-height: calc(100vh - 120px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 0.5rem 0 16px;
    box-sizing: border-box;
}

.page-primary {
    flex: 1;
    min-width: 0;
    padding: 0 28px 0 12px;
    box-sizing: border-box;
}

.sidebar-nav-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

@media (max-width: 900px) {
    .page-top-banners {
        padding: 12px 16px 0;
    }

    .app-body-layout {
        flex-direction: column;
        padding-top: 12px;
    }

    .content:has(.page-top-banners) .app-body-layout {
        padding-top: 4px;
    }

    .inline-app-nav {
        width: 100%;
        position: static;
        max-height: none;
        padding: 0 16px;
    }

    .page-primary {
        padding: 0 16px 16px;
    }
}

/* `eleigichek` mesh-like background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 20%, rgba(29, 78, 216, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(5, 150, 105, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 20%, rgba(220, 38, 38, 0.08) 0%, transparent 40%);
    pointer-events: none;
    z-index: 0;
}

/* Glass primitive used across the port. */
.glass {
    background: rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

/* Legacy fixed rail — kept for any old markup; app shell uses .inline-app-nav */
.sidebar {
    width: 220px;
    padding: 24px 16px;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.sidebar-header {
    padding: 0 20px 24px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s;
}

.sidebar-logo:hover {
    color: var(--accent-blue-hover);
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-nav-item {
    padding: 0;
    margin: 8px 12px;
}

.sidebar-nav-link {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 10px;
    border: 1px solid transparent;
    transition: all 0.2s;
    font-size: 0.8rem;
    font-weight: 500;
}

.sidebar-nav-link:hover {
    background: rgba(26, 86, 219, 0.15);
    color: var(--text-primary);
    border-color: rgba(26, 86, 219, 0.3);
}

.sidebar-nav-link.active {
    background: rgba(26, 86, 219, 0.25);
    color: #60a5fa;
    border-color: rgba(26, 86, 219, 0.5);
}

.sidebar-nav-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* `eleigichek` sidebar nav item styling */
.nav-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    color: #94a3b8;
    font-size: 12.5px;
    font-weight: 500;
    border: 1px solid transparent;
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(26, 86, 219, 0.15);
    color: #e2e8f0;
    border-color: rgba(26, 86, 219, 0.3);
}

.nav-item.active {
    background: rgba(26, 86, 219, 0.25);
    color: #60a5fa;
    border-color: rgba(26, 86, 219, 0.5);
}

.sidebar-stats {
    position: absolute;
    bottom: 24px;
    left: 0;
    right: 0;
    padding: 16px 12px;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.sidebar-stat {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    color: var(--text-secondary);
}

.sidebar-stat-label {
    display: block;
}

.sidebar-stat-value {
    color: var(--text-primary);
    font-weight: 600;
}

.company-sidebar {
    padding-top: 18px;
}

.company-sidebar-meta {
    margin: 0 12px 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.06);
}

.company-sidebar-title {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1.35;
    margin-bottom: 8px;
}

.company-sidebar-code {
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.35;
}

.company-sidebar-section {
    margin: 4px 12px 6px;
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.company-tab-nav .sidebar-nav-link {
    align-items: flex-start;
    gap: 10px;
}

.company-tab-icon {
    width: 22px;
    text-align: center;
    line-height: 1.2;
}

.company-tab-text {
    display: block;
    min-width: 0;
}

.company-tab-text strong {
    display: block;
    color: inherit;
    font-size: 0.9rem;
    line-height: 1.25;
    font-weight: 600;
}

.company-tab-text small {
    display: block;
    margin-top: 2px;
    font-size: 0.75rem;
    line-height: 1.25;
    color: var(--text-secondary);
}

.company-tab-nav .sidebar-nav-link.active .company-tab-text small {
    color: rgba(255, 255, 255, 0.85);
}

.main-content {
    margin-left: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.header {
    background: rgba(2, 6, 23, 0.45);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.14);
    padding: 24px 28px 24px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.header-title h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 700;
}

.header-title p {
    margin: 4px 0 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.header-logo {
    width: 36px;
    height: 36px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1a56db, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(26, 86, 219, 0.35);
    color: #ffffff;
    flex-shrink: 0;
}

.header-logo i {
    font-size: 16px;
}

/* Header badges / brand (port of `eleigichek` look) */
.ai-badge {
    display: inline-block;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 9999px;
    font-weight: 800;
    letter-spacing: 0.2px;
    background: linear-gradient(90deg, #1a56db, #7c3aed);
    color: #ffffff;
    margin-left: 8px;
}

.header-badges {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.header-badges .badge {
    font-size: 0.7rem;
    padding: 5px 10px;
    text-transform: none;
    letter-spacing: 0;
}

.badge-nse {
    background: #1e3a8a;
    color: #93c5fd;
    border: 1px solid #1d4ed8;
}

.badge-bse {
    background: #7f1d1d;
    color: #fca5a5;
    border: 1px solid #dc2626;
}

.badge-sebi {
    background: #064e3b;
    color: #6ee7b7;
    border: 1px solid #059669;
}

.badge-sme {
    background: #4a1d96;
    color: #c4b5fd;
    border: 1px solid #7c3aed;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #4ade80;
    font-size: 0.8rem;
    font-weight: 600;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    background: #4ade80;
    display: inline-block;
}

.dot-pulse {
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.sidebar-ai-badge {
    font-size: 0.65rem;
    font-weight: 900;
    padding: 3px 8px;
    border-radius: 9999px;
    background: linear-gradient(90deg, #1a56db, #7c3aed);
    color: #ffffff;
}

/* Full-bleed under header: avoids empty margin strip on the left (nav sits at true left) */
.content {
    flex: 1;
    min-height: 0;
    padding: 0;
    overflow-y: auto;
    width: 100%;
    max-width: none;
    margin: 0;
    background: transparent;
    backdrop-filter: none;
    border: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}

/* ========================================
   COMPONENTS
   ======================================== */

.card {
    background: rgba(15, 23, 42, 0.78);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s;
    backdrop-filter: blur(20px);
}

.card:hover {
    border-color: rgba(148, 163, 184, 0.22);
    transform: translateY(-1px);
    box-shadow: 0 0 0 2px rgba(148, 163, 184, 0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Badges & Status */
.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-blue {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
}

.badge-green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

.badge-red {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.badge-purple {
    background: rgba(139, 92, 246, 0.1);
    color: var(--accent-purple);
    border: 1px solid var(--accent-purple);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="file"],
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s;
    font-family: inherit;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="file"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.05);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: 0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, #1a56db, #7c3aed);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #174ea7, #6d28d9);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.2);
}

.btn-success {
    background: var(--accent-green);
    color: white;
}

.btn-success:hover {
    background: var(--accent-green-hover);
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
}

.btn-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    border-left: 4px solid;
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.alert-title {
    font-weight: 600;
    margin: 0 0 4px;
}

.alert-message {
    margin: 0;
    font-size: 0.95rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--accent-green);
    color: var(--accent-green);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--accent-blue);
    color: var(--accent-blue);
}

/* Upload Area */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 14px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(59, 130, 246, 0.02);
}

.upload-zone:hover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.05);
}

.upload-zone.dragover {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.upload-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 8px;
}

.upload-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab {
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab:hover {
    color: var(--text-primary);
    border-bottom-color: var(--border-color);
}

.tab.active {
    color: white;
    background: linear-gradient(135deg, #1a56db, #7c3aed);
    border-bottom-color: transparent;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(26, 86, 219, 0.4);
}

/* Data Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.table thead {
    background: #0f172a;
    border-bottom: 2px solid var(--border-color);
}

.table th {
    padding: 9px 12px;
    text-align: left;
    font-weight: 600;
    color: #94a3b8;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.table tbody tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

/* Grid Layouts */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Company Cards */
.company-card {
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 16px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s;
    backdrop-filter: blur(20px);
}

.company-card:hover {
    border-color: rgba(148, 163, 184, 0.22);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.company-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.company-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.company-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.company-card-detail {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: none;
    font-size: 0.85rem;
}

.company-card-detail-label {
    color: var(--text-secondary);
}

.company-card-detail-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* Search results: compact glass cards grid like `eleigichek` */
.company-grid {
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.company-grid .badge {
    font-size: 0.7rem;
    padding: 4px 10px;
    border-radius: 9999px;
    text-transform: none;
    letter-spacing: 0;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ─── Search page (reference EligiCheck layout) ─── */
.search-page-form {
    display: block;
}

.search-hero-card {
    border-radius: 18px;
    padding: 26px 22px 22px;
    margin-bottom: 18px;
}

.search-hero-title {
    font-size: clamp(1.35rem, 2.2vw, 1.75rem);
    font-weight: 800;
    color: #ffffff;
    margin: 0 0 10px;
    text-align: center;
    letter-spacing: -0.02em;
}

.search-hero-sub {
    font-size: 0.875rem;
    color: #94a3b8;
    margin: 0 auto 22px;
    max-width: 38rem;
    line-height: 1.55;
    text-align: center;
}

.search-hero-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: stretch;
    max-width: 48rem;
    margin: 0 auto 18px;
}

.search-input-wrap {
    position: relative;
    flex: 1 1 220px;
    min-width: 0;
}

.search-input-wrap .search-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    pointer-events: none;
    font-size: 0.9rem;
}

.search-input-ref {
    width: 100%;
    padding: 14px 16px 14px 42px;
    background: #0f172a;
    border: 1px solid #475569;
    border-radius: 14px;
    color: #f1f5f9;
    font-size: 0.9375rem;
    box-sizing: border-box;
}

.search-input-ref::placeholder {
    color: #64748b;
}

.search-input-ref:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.search-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.search-hero-actions .btn-primary {
    border-radius: 14px;
    padding: 14px 20px;
}

.btn-all-companies {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 18px;
    border-radius: 14px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    background: #2563eb;
    color: #ffffff;
    border: 1px solid #3b82f6;
    transition: background 0.2s, box-shadow 0.2s;
    font-family: inherit;
    cursor: pointer;
    box-sizing: border-box;
}

.btn-all-companies:hover {
    background: #1d4ed8;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.35);
    color: #ffffff;
}

.quick-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.quick-filters-label {
    font-size: 0.75rem;
    color: #64748b;
    margin-right: 4px;
}

.quick-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    padding: 8px 12px;
    border-radius: 10px;
    text-decoration: none;
    border: 1px solid #334155;
    background: #1e293b;
    color: #cbd5e1;
    transition: background 0.15s, border-color 0.15s;
}

.quick-filter-btn:hover {
    background: #334155;
    border-color: #475569;
    color: #f1f5f9;
}

.quick-filter-btn--nse {
    border-color: rgba(37, 99, 235, 0.55);
    background: rgba(30, 58, 138, 0.5);
    color: #93c5fd;
}

.quick-filter-btn--bse {
    border-color: rgba(220, 38, 38, 0.5);
    background: rgba(127, 29, 29, 0.4);
    color: #fca5a5;
}

.quick-filter-btn--sme {
    border-color: rgba(124, 58, 237, 0.5);
    background: rgba(76, 29, 149, 0.4);
    color: #c4b5fd;
}

.search-db-card {
    border-radius: 18px;
    padding: 20px 20px 24px;
}

.search-db-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.search-db-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.search-db-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: #f8fafc;
}

.search-db-count {
    font-size: 0.85rem;
    font-weight: 500;
    color: #94a3b8;
}

.search-db-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.search-db-select {
    font-size: 0.75rem;
    padding: 8px 12px;
    border-radius: 10px;
    background: #0f172a;
    border: 1px solid #334155;
    color: #e2e8f0;
    min-width: 130px;
    cursor: pointer;
}

.search-db-select:focus {
    outline: none;
    border-color: #3b82f6;
}

.search-db-empty {
    padding: 32px 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 0.95rem;
}

.company-grid-ref {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

@media (min-width: 1200px) {
    .company-grid-ref {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.company-card-ref {
    margin: 0;
}

.company-card-ref-link {
    display: block;
    text-decoration: none;
    color: inherit;
    background: linear-gradient(165deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.82));
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 16px;
    padding: 14px 16px 12px;
    height: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.company-card-ref-link:hover {
    border-color: rgba(148, 163, 184, 0.28);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.company-card-ref-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
}

.company-card-ref-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.company-tag {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0.02em;
}

.company-tag--nse {
    background: rgba(30, 58, 138, 0.85);
    color: #93c5fd;
    border: 1px solid #1d4ed8;
}

.company-tag--bse {
    background: rgba(127, 29, 29, 0.85);
    color: #fca5a5;
    border: 1px solid #dc2626;
}

.company-tag--muted {
    background: rgba(30, 41, 59, 0.9);
    color: #94a3b8;
    border: 1px solid #334155;
    font-weight: 600;
}

.company-card-ref-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.company-pill {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 9999px;
    white-space: nowrap;
}

.company-pill--cap {
    background: rgba(30, 58, 138, 0.35);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.45);
}

.company-pill--ok {
    background: rgba(6, 78, 59, 0.5);
    color: #6ee7b7;
    border: 1px solid #059669;
}

.company-card-ref-names {
    margin-bottom: 14px;
}

.company-card-ref-ticker {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #94a3b8;
    line-height: 1.3;
}

.company-card-ref-legal {
    font-size: 1.05rem;
    color: #f8fafc;
    margin-top: 2px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.company-card-ref-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
    margin-bottom: 14px;
    padding-top: 4px;
    border-top: 1px solid rgba(51, 65, 85, 0.5);
}

.company-metric-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    margin-bottom: 2px;
}

.company-metric-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f1f5f9;
}

.company-card-ref-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid rgba(51, 65, 85, 0.45);
}

.company-card-ref-sector {
    font-size: 0.72rem;
    color: #64748b;
    line-height: 1.3;
    min-width: 0;
}

.company-card-ref-compare {
    font-size: 0.72rem;
    font-weight: 600;
    color: #facc15;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    cursor: pointer;
}

.company-card-ref-compare:hover {
    color: #fde047;
}

/* Search page: enforce card grid + toolbar row (Tailwind CDN may inject CSS after this file) */
form.search-page-form .search-db-toolbar {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 16px !important;
}

form.search-page-form .search-db-filters {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 10px !important;
}

form.search-page-form .search-db-select {
    width: auto !important;
    min-width: 140px !important;
    max-width: 200px !important;
}

form.search-page-form .company-grid-ref {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
    gap: 16px !important;
    width: 100% !important;
    align-items: stretch !important;
}

@media (min-width: 1200px) {
    form.search-page-form .company-grid-ref {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }
}

form.search-page-form .company-card-ref {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    height: 100% !important;
}

form.search-page-form .company-card-ref-link {
    display: block !important;
    flex: 1 !important;
    width: 100% !important;
    text-decoration: none !important;
    color: inherit !important;
    background: linear-gradient(165deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.82)) !important;
    border: 1px solid rgba(148, 163, 184, 0.14) !important;
    border-radius: 16px !important;
    padding: 14px 16px 12px !important;
    box-sizing: border-box !important;
}

form.search-page-form .company-card-ref-top {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    gap: 8px !important;
}

form.search-page-form .company-card-ref-tags,
form.search-page-form .company-card-ref-badges {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
}

form.search-page-form .company-card-ref-metrics {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px 14px !important;
}

form.search-page-form .company-metric {
    display: block !important;
    min-width: 0 !important;
}

form.search-page-form .company-card-ref-footer {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
}

form.search-page-form .search-hero-row {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    align-items: stretch !important;
}

form.search-page-form .quick-filters {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 8px !important;
}

.nav-item i.fas,
.btn i.fas,
.search-input-icon.fas,
.quick-filter-btn .fas {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-style: normal;
}

/* Data Sections */
.data-section {
    margin-bottom: 24px;
}

.data-section-header {
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: 8px 8px 0 0;
    border-left: 4px solid var(--accent-blue);
}

.data-section-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.data-rows {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
}

.data-row {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    align-items: start;
}

.data-row:last-child {
    border-bottom: none;
}

.data-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.data-value {
    color: var(--text-secondary);
    word-break: break-word;
}

.data-value a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color 0.2s;
}

.data-value a:hover {
    color: var(--accent-blue-hover);
    text-decoration: underline;
}

.data-type-email::before {
    content: "✉ ";
    color: var(--accent-blue);
}

.data-type-phone::before {
    content: "☎ ";
    color: var(--accent-green);
}

.data-type-url::before {
    content: "🔗 ";
    color: var(--accent-orange);
}

.data-type-date::before {
    content: "📅 ";
    color: var(--accent-purple);
}

/* Shareholding summary - compact card style for Tab 3 */
.data-section .grid-3 {
    gap: 12px;
}
.data-section .grid-3 .data-row {
    grid-template-columns: 1fr !important;
    gap: 6px;
    padding: 12px;
    border-bottom: none;
    text-align: center;
    align-items: center;
    background: transparent;
}
.data-section .grid-3 .data-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.data-section .grid-3 .data-value {
    color: var(--text-primary);
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 6px;
}
.data-section .grid-3 .data-row + .data-row {
    border-top: 1px solid rgba(255,255,255,0.02);
}
@media (min-width: 900px) {
    .data-section .grid-3 .data-row { padding: 16px; }
    .data-section .grid-3 .data-label { font-size: 0.95rem; }
    .data-section .grid-3 .data-value { font-size: 1.6rem; }
}

/* Stat card used for shareholding summary */
.share-summary {
    align-items: stretch;
}
.share-summary .stat-card {
    background: linear-gradient(180deg, rgba(255,255,255,0.01), transparent);
    border: 1px solid rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    min-height: 80px;
}
.share-summary .stat-label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
}
.share-summary .stat-value {
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 700;
}
@media (max-width: 600px) {
    .share-summary { gap: 10px; }
    .share-summary .stat-card { min-height: 64px; padding: 10px; }
    .share-summary .stat-value { font-size: 1.2rem; }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-badges {
        display: none;
    }

    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        padding: 12px 0;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar-stats {
        position: static;
        border-top: 1px solid var(--border-color);
        margin-top: 12px;
        padding-top: 12px;
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }

    .sidebar-nav {
        display: flex;
        overflow-x: auto;
        padding: 0 12px;
    }

    .sidebar-nav-item {
        flex-shrink: 0;
    }

    /* Only legacy fixed `.sidebar` rail hid meta on small screens; inline company nav keeps it */
    .sidebar .company-sidebar-meta,
    .sidebar .company-sidebar-section {
        display: none;
    }

    .company-tab-nav .sidebar-nav-link {
        align-items: center;
    }

    .company-tab-text small {
        display: none;
    }

    .main-content {
        margin-left: 0;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .content {
        padding: 0;
    }

    .page-primary {
        padding: 16px;
    }

    .data-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

/* SPA clone support (iframe-based tab panels) */
.clone-content {
    padding: 0;
    height: calc(100vh - 88px);
    overflow: hidden;
}

.clone-tab-panel {
    height: 100%;
    display: flex;
}

.clone-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    background: transparent;
}

.clone-iframe-content {
    padding: 24px;
    overflow-y: auto;
    height: 100%;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.gap-2 {
    gap: 8px;
}

.flex {
    display: flex;
    align-items: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.manual-row {
    margin-bottom: 16px;
    padding: 16px;
}

.manual-row-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.manual-row-actions {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

.is-hidden {
    display: none;
}

.section-title {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

/* Table variants used in `detail.php` */
.table-sm th,
.table-sm td {
    padding: 8px 12px;
}

.table-bordered {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

.table-bordered th,
.table-bordered td {
    border-bottom: 1px solid var(--border-color);
}

/* Tab 8 — eligibility spreadsheet-style grids */
.eligibility-sheet-wrap {
    margin-top: 8px;
}
.eligibility-sheet-note {
    margin: 0 0 16px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.eligibility-dual-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}
@media (max-width: 960px) {
    .eligibility-dual-grid {
        grid-template-columns: 1fr;
    }
}
.eligibility-status-pill {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
}
.eligibility-status-pill.is-yes {
    color: var(--accent-green);
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.12);
}
.eligibility-status-pill.is-no {
    color: var(--accent-red);
    border-color: rgba(239, 68, 68, 0.45);
    background: rgba(239, 68, 68, 0.1);
}
.eligibility-sheet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
    background: rgba(0, 0, 0, 0.15);
}
.eligibility-sheet-table th,
.eligibility-sheet-table td {
    border: 1px solid var(--border-color);
    padding: 6px 8px;
    vertical-align: top;
}
.eligibility-sheet-table thead th {
    background: rgba(255, 255, 255, 0.06);
    font-weight: 600;
    text-align: left;
}
.eligibility-sheet-table .eligibility-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.eligibility-met-yes {
    color: var(--accent-green);
    font-weight: 600;
}
.eligibility-met-no {
    color: var(--accent-red);
    font-weight: 600;
}
.eligibility-cell-note {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
}
.eligibility-block-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 24px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}
.eligibility-subhead {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 8px;
}

/* ========================================
   COMPANY DETAIL MODAL (search.php overlay)
   ======================================== */
.company-detail-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: stretch;
    justify-content: center;
}
.company-detail-modal.is-visible {
    display: flex;
}
body.company-modal-open {
    overflow: hidden;
}

.company-detail-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 6, 18, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity 220ms ease;
    cursor: pointer;
}
.company-detail-modal.is-visible .company-detail-modal-backdrop {
    opacity: 1;
}

.company-detail-modal-panel {
    position: relative;
    margin: 32px auto;
    width: min(1280px, calc(100vw - 48px));
    height: calc(100vh - 64px);
    background: linear-gradient(165deg, rgba(15, 23, 42, 0.98), rgba(10, 18, 36, 0.96));
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 18px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(0.985);
    transition: opacity 220ms ease, transform 220ms ease;
}
.company-detail-modal.is-open .company-detail-modal-panel {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.company-detail-modal.is-animating:not(.is-open) .company-detail-modal-panel {
    opacity: 0;
}

.company-detail-modal-head {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 22px 14px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    flex: 0 0 auto;
}
.company-detail-modal-title-wrap {
    min-width: 0;
    flex: 1 1 auto;
}
.company-detail-modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.01em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.company-detail-modal-subtitle {
    margin: 4px 0 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.company-detail-modal-close {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}
.company-detail-modal-close:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.45);
    color: #fecaca;
}

.company-detail-modal-tabs {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 4px;
    padding: 10px 18px 0;
    overflow-x: auto;
    scrollbar-width: thin;
    border-bottom: 1px solid rgba(148, 163, 184, 0.10);
    flex: 0 0 auto;
}
.company-detail-tab-btn {
    flex: 0 0 auto;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 10px 10px 0 0;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
    position: relative;
    bottom: -1px;
}
.company-detail-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(148, 163, 184, 0.08);
}
.company-detail-tab-btn.is-active {
    color: var(--text-primary);
    background: linear-gradient(165deg, rgba(59, 130, 246, 0.18), rgba(59, 130, 246, 0.06));
    border-color: rgba(148, 163, 184, 0.16);
    border-bottom-color: transparent;
    font-weight: 600;
}

.company-detail-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    background: var(--bg-primary);
    display: flex;
}
.company-detail-modal-frame {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    border: 0;
    background: var(--bg-primary);
    display: block;
}

/* Card-expand ghost that animates from clicked card into the modal panel */
.company-card-expand-ghost {
    position: fixed;
    z-index: 999;
    pointer-events: none;
    background: linear-gradient(165deg, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.82));
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    opacity: 1;
    transition: left 280ms ease, top 280ms ease, width 280ms ease, height 280ms ease, opacity 280ms ease, border-radius 280ms ease;
}
.company-card-expand-ghost * {
    pointer-events: none;
}

@media (max-width: 720px) {
    .company-detail-modal-panel {
        margin: 0;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
        border: 0;
    }
    .company-detail-modal-head {
        padding: 14px 16px 10px;
    }
    .company-detail-modal-tabs {
        padding: 8px 12px 0;
    }
    .company-detail-tab-btn {
        padding: 7px 11px;
        font-size: 0.8rem;
    }
}
