/* styles.css - Premium Redesign */
@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800;1,14..32,400&family=Space+Grotesk:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* =========================================================
   Design System Tokens
   ========================================================= */
:root {
    /* Background Layers */
    --bg-base:      #060911;
    --bg-surface:   rgba(13, 18, 30, 0.75);
    --bg-surface-2: rgba(20, 27, 43, 0.6);
    --bg-elevated:  rgba(28, 37, 58, 0.85);

    /* Borders */
    --border:         rgba(255, 255, 255, 0.07);
    --border-strong:  rgba(255, 255, 255, 0.12);
    --border-focus:   rgba(99, 102, 241, 0.5);
    --border-success: rgba(16, 185, 129, 0.4);

    /* Text */
    --text-primary:   #f0f2f8;
    --text-secondary: #8892a4;
    --text-muted:     #4f5869;
    --text-accent:    #818cf8;

    /* Accents */
    --indigo:      #6366f1;
    --indigo-500:  #5457e0;
    --violet:      #8b5cf6;
    --purple:      #a855f7;
    --fuchsia:     #d946ef;
    --emerald:     #10b981;
    --amber:       #f59e0b;
    --rose:        #f43f5e;
    --cyan:        #06b6d4;
    --sky:         #38bdf8;

    /* Gradients */
    --grad-primary:   linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --grad-primary-h: linear-gradient(135deg, #4f46e5 0%, #9333ea 100%);
    --grad-hero-ytm:  linear-gradient(135deg, rgba(99,102,241,0.18) 0%, rgba(139,92,246,0.18) 100%);
    --grad-hero-px:   linear-gradient(135deg, rgba(168,85,247,0.15) 0%, rgba(217,70,239,0.15) 100%);
    --grad-success:   linear-gradient(135deg, rgba(16,185,129,0.15) 0%, rgba(6,182,212,0.15) 100%);
    --grad-danger:    linear-gradient(135deg, rgba(244,63,94,0.15) 0%, rgba(245,158,11,0.12) 100%);

    /* Glow Effects */
    --glow-primary: 0 0 30px rgba(99, 102, 241, 0.35);
    --glow-violet:  0 0 30px rgba(139, 92, 246, 0.25);
    --glow-success: 0 0 20px rgba(16, 185, 129, 0.25);

    /* Shadows */
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.6);

    /* Typography */
    --font-display: 'Space Grotesk', 'Inter Tight', 'Inter', system-ui, sans-serif;
    --font-body:    'Inter Tight', 'Inter', system-ui, sans-serif;
    --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

    /* Radii */
    --r-xs: 6px;
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;
    --r-full: 9999px;

    /* Transitions */
    --ease-snappy: cubic-bezier(0.175, 0.885, 0.32, 1.1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --t-fast: 0.15s;
    --t-base: 0.25s;
    --t-slow: 0.4s;
}

/* =========================================================
   Reset & Base
   ========================================================= */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-base);
    background-image:
        radial-gradient(ellipse 80% 60% at 5% 0%,   rgba(99, 102, 241, 0.13) 0%, transparent 55%),
        radial-gradient(ellipse 60% 50% at 95% 0%,  rgba(139, 92, 246, 0.10) 0%, transparent 50%),
        radial-gradient(ellipse 50% 60% at 50% 100%, rgba(16, 185, 129, 0.06) 0%, transparent 60%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.5;
    letter-spacing: -0.015em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Noise texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
}

/* =========================================================
   Header
   ========================================================= */
header {
    background: rgba(6, 9, 17, 0.82);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    height: 64px;
    display: flex;
    align-items: center;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(99,102,241,0.4) 50%, transparent 100%);
}

.header-container {
    max-width: 1520px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: var(--grad-primary);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--glow-primary), 0 0 0 1px rgba(99,102,241,0.4);
    transition: box-shadow var(--t-base) var(--ease-smooth), transform var(--t-fast) var(--ease-snappy);
}

.logo-icon:hover {
    box-shadow: var(--glow-primary), 0 0 0 1px rgba(99,102,241,0.6), 0 0 50px rgba(99,102,241,0.2);
    transform: scale(1.05) rotate(-3deg);
}

.logo-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: white;
    stroke-width: 2;
}

.logo-text h1 {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(120deg, #ffffff 30%, #c4b5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.logo-text p {
    font-size: 0.6875rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 500;
    margin-top: 1px;
}

.badge {
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.28);
    color: #a5b4fc;
    padding: 0.3rem 0.75rem;
    border-radius: var(--r-full);
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: all var(--t-base) var(--ease-smooth);
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #818cf8;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(129,140,248,0.8);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px rgba(129,140,248,0.8); }
    50% { opacity: 0.5; box-shadow: 0 0 2px rgba(129,140,248,0.4); }
}

/* =========================================================
   Main Layout
   ========================================================= */
main {
    max-width: 1520px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem;
    position: relative;
    z-index: 1;
    flex: 1;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 440px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1100px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   Card — Glassmorphism
   ========================================================= */
.card {
    background: var(--bg-surface);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.05);
    padding: 1.4rem;
    position: relative;
    overflow: hidden;
    transition: border-color var(--t-base) var(--ease-smooth),
                box-shadow var(--t-base) var(--ease-smooth);
    min-width: 0;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 60%);
    pointer-events: none;
}

.card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-xl), inset 0 1px 0 rgba(255,255,255,0.07);
}

/* =========================================================
   Tabs
   ========================================================= */
.tabs-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--r-md);
    padding: 3px;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
    gap: 4px;
}

.tab-btn {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 0.6rem;
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--t-base) var(--ease-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.tab-btn:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255,255,255,0.04);
}

.tab-btn.active {
    background: var(--grad-primary);
    color: #ffffff;
    box-shadow: 0 2px 12px rgba(99,102,241,0.45), 0 0 0 1px rgba(99,102,241,0.3);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* =========================================================
   Form Elements
   ========================================================= */
.form-group {
    margin-bottom: 1rem;
}

.form-group.row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.6875rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    min-width: 0;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    padding: 0.72rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--t-base) var(--ease-smooth);
    -webkit-appearance: none;
    -moz-appearance: none;
}

.input-wrapper input:hover,
.input-wrapper select:hover {
    border-color: rgba(255,255,255,0.16);
    background: rgba(0, 0, 0, 0.35);
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.18), 0 0 16px rgba(99,102,241,0.1);
    background: rgba(8, 10, 20, 0.6);
}

.input-wrapper input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(0.5);
    cursor: pointer;
    opacity: 0.6;
}

.input-wrapper .input-prefix {
    position: absolute;
    left: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    pointer-events: none;
    z-index: 1;
}

.input-wrapper .input-suffix {
    position: absolute;
    right: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    pointer-events: none;
    z-index: 1;
}

.input-wrapper.has-prefix input { padding-left: 2.1rem; }
.input-wrapper.has-suffix input { padding-right: 2.1rem; }

/* Number input: hide arrows */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
input[type="number"] { -moz-appearance: textfield; }

/* Custom select arrow */
.input-wrapper select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.875rem center;
    padding-right: 2.5rem;
    cursor: pointer;
}

.input-wrapper select option {
    background: #0f172a;
    color: var(--text-primary);
}

/* Slider */
.slider-group { margin-top: 0.625rem; }

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: var(--r-full);
    outline: none;
    cursor: pointer;
    transition: background var(--t-base);
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--grad-primary);
    box-shadow: 0 0 10px rgba(99,102,241,0.6), 0 0 0 2px rgba(99,102,241,0.3);
    cursor: grab;
    transition: transform var(--t-fast) var(--ease-snappy),
                box-shadow var(--t-fast) var(--ease-smooth);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.25);
    box-shadow: 0 0 16px rgba(99,102,241,0.8), 0 0 0 3px rgba(99,102,241,0.35);
}

input[type="range"]::-webkit-slider-thumb:active { cursor: grabbing; }

/* Divider */
.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
    margin: 1.5rem 0;
}

/* =========================================================
   Primary Button
   ========================================================= */
.btn-primary {
    width: 100%;
    background: var(--grad-primary);
    border: none;
    color: white;
    padding: 0.8rem;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 700;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: all var(--t-base) var(--ease-smooth);
    box-shadow: var(--glow-primary), inset 0 1px 0 rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
    letter-spacing: 0.02em;
    position: relative;
    overflow: hidden;
}

.btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
}

.btn-primary:hover {
    background: var(--grad-primary-h);
    box-shadow: 0 0 40px rgba(99,102,241,0.55), inset 0 1px 0 rgba(255,255,255,0.2);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(1px) scale(0.99);
    box-shadow: 0 0 20px rgba(99,102,241,0.4);
}



/* =========================================================
   Outputs Panel
   ========================================================= */
.outputs-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

/* Large display: 4 cards in one row */
@media (min-width: 1280px) {
    .outputs-panel {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        gap: 0.75rem;
    }
    .outputs-panel .metrics-row {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 0.5rem;
        align-items: stretch;
    }
    /* Dissolve wrapper divs so children flow into parent grid */
    .main-metrics,
    .stats-grid {
        display: contents;
    }

    /* In 4-col row: stat-cards match hero-stat look */
    .metrics-row .stat-card {
        border-radius: var(--r-lg);
        padding: 0.9rem 1.1rem;
        justify-content: center;
        background: linear-gradient(135deg, rgba(16,185,129,0.12) 0%, rgba(6,182,212,0.1) 100%);
        border-color: rgba(16,185,129,0.22);
        box-shadow: none;
    }
    .metrics-row .stat-card:not(.accent-success) {
        background: linear-gradient(135deg, rgba(168,85,247,0.12) 0%, rgba(217,70,239,0.08) 100%);
        border-color: rgba(168,85,247,0.22);
    }
    /* Orb glow for stat-cards in row */
    .metrics-row .stat-card::after {
        content: '';
        position: absolute;
        width: 100px;
        height: 100px;
        border-radius: 50%;
        right: -15px;
        bottom: -25px;
        filter: blur(35px);
        opacity: 0.2;
        pointer-events: none;
    }
    .metrics-row .stat-card.accent-success::after  { background: var(--emerald); }
    .metrics-row .stat-card:not(.accent-success)::after { background: var(--purple); }
    /* Remove the left-border strip in row mode */
    .metrics-row .stat-card::before { display: none; }

    /* In row mode: match label/value/sub to hero-stat typography */
    .metrics-row .stat-card .stat-label {
        font-size: 0.625rem;
        color: rgba(255,255,255,0.5);
        margin-bottom: 0.2rem;
    }
    .metrics-row .stat-card .stat-value {
        font-size: clamp(0.95rem, 2vw, 1.5rem);
        font-weight: 800;
        line-height: 1.1;
        letter-spacing: -0.03em;
    }
    .metrics-row .stat-card.accent-success .stat-value {
        background: linear-gradient(120deg, #6ee7b7 20%, #34d399 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        color: unset;
    }
    .metrics-row .stat-card:not(.accent-success) .stat-value {
        background: linear-gradient(120deg, #ffffff 20%, #e9d5ff 100%);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        color: unset;
    }
    .metrics-row .stat-card .stat-sub {
        font-size: 0.6rem;
        color: rgba(255,255,255,0.35);
        margin-top: 0.2rem;
    }
}

/* Small/medium: stack metrics-row children vertically with gap */
@media (max-width: 1279px) {
    .metrics-row {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }
    .main-metrics {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    .stats-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
}

@media (max-width: 640px) {
    .main-metrics { grid-template-columns: 1fr; }
    .stats-grid   { grid-template-columns: 1fr; }
}


.hero-stat {
    border-radius: var(--r-lg);
    padding: 0.9rem 1.1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid rgba(99, 102, 241, 0.2);
    position: relative;
    overflow: hidden;
    min-width: 0;
    transition: border-color var(--t-base), transform var(--t-base) var(--ease-smooth);
}

.hero-stat:first-child {
    background: var(--grad-hero-ytm);
    border-color: rgba(99, 102, 241, 0.22);
}

.hero-stat:last-child {
    background: var(--grad-hero-px);
    border-color: rgba(168, 85, 247, 0.2);
}

.hero-stat::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, transparent 70%);
    pointer-events: none;
}

/* Glowing orb behind hero cards */
.hero-stat::after {
    content: '';
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    right: -20px;
    bottom: -30px;
    filter: blur(40px);
    opacity: 0.25;
    pointer-events: none;
}

.hero-stat:first-child::after  { background: var(--indigo); }
.hero-stat:last-child::after   { background: var(--purple); }

.hero-stat:hover { transform: translateY(-2px); }

.hero-stat .stat-label {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: rgba(255,255,255,0.5);
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.hero-stat .stat-value {
    font-family: var(--font-display);
    font-size: clamp(0.95rem, 2vw, 1.5rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    background: linear-gradient(120deg, #ffffff 20%, #c4b5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-stat .stat-sub {
    font-size: 0.6rem;
    color: rgba(255,255,255,0.35);
    margin-top: 0.2rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* =========================================================
   Stat Cards
   ========================================================= */

.stat-card {
    background: var(--bg-surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 0.65rem 0.875rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    min-width: 0;
    transition: all var(--t-base) var(--ease-smooth);
}

.stat-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    border-radius: 0 2px 2px 0;
}

.stat-card.accent-success::before { background: linear-gradient(180deg, var(--emerald), var(--cyan)); }
.stat-card:not(.accent-success)::before { background: var(--grad-primary); }

.stat-card .stat-label {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.15rem;
}

.stat-card .stat-value {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.stat-card.accent-success .stat-value { color: #6ee7b7; }

.stat-card .stat-sub {
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* =========================================================
   Charts
   ========================================================= */
.charts-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 1rem;
}

@media (max-width: 1280px) {
    .charts-grid { grid-template-columns: 1fr; }
}

.chart-card {
    height: 300px;
    display: flex;
    flex-direction: column;
    padding: 1.375rem;
}

.chart-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.chart-title {
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.chart-canvas-container {
    flex: 1;
    position: relative;
    min-height: 0;
}

/* =========================================================
   Pricing Breakdown
   ========================================================= */
.pricing-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 0 2rem;
}

.pricing-detail-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.6rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.8125rem;
    gap: 0.5rem;
}

.pricing-detail-item:last-child { border-bottom: none; }

.pricing-detail-item span:first-child {
    color: var(--text-muted);
    font-weight: 500;
}

.pricing-detail-item span:last-child {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    white-space: normal;
    word-break: break-word;
    max-width: 70%;
}

/* Section headings inside cards */
.card-section-heading {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-display);
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.9rem;
    letter-spacing: -0.01em;
}

.card-section-heading svg { flex-shrink: 0; }

/* =========================================================
   Cash Flow Schedule Table
   ========================================================= */
.schedule-container {
    overflow-x: auto;
    margin-top: 0.75rem;
    max-height: 320px;
    overflow-y: auto;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: rgba(0,0,0,0.15);
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.78rem;
}

.schedule-table thead { position: sticky; top: 0; z-index: 10; }

.schedule-table th {
    background: rgba(6, 9, 17, 0.9);
    backdrop-filter: blur(8px);
    padding: 0.6rem 0.85rem;
    font-size: 0.63rem;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.09em;
    white-space: nowrap;
}

.schedule-table td {
    padding: 0.5rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.025);
    color: var(--text-primary);
    white-space: nowrap;
    font-family: var(--font-mono);
    font-size: 0.73rem;
    font-weight: 400;
    vertical-align: middle;
}

.schedule-table th:nth-child(4),
.schedule-table td:nth-child(4) {
    white-space: normal;
    min-width: 75px;
}

.schedule-table tbody tr {
    transition: background var(--t-fast) var(--ease-smooth);
}

.schedule-table tbody tr:hover td {
    background: rgba(99, 102, 241, 0.06);
}

.schedule-table tbody tr:last-child td { border-bottom: none; }

/* Row status styles */
.schedule-table tbody tr[data-status="past"] td {
    opacity: 0.45;
}

.schedule-table tbody tr[data-status="next"] td {
    background: rgba(16, 185, 129, 0.04);
}

.schedule-table tbody tr[data-status="maturity"] td {
    background: rgba(99, 102, 241, 0.04);
}

.schedule-table tbody tr[data-status="ex-coupon"] td {
    background: rgba(245, 158, 11, 0.04);
}

/* Cash Flow Type Badges */
.cash-flow-type {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 0.15rem;
    font-family: var(--font-body);
    font-size: 0.58rem;
    font-weight: 700;
    padding: 0.05rem 0.2rem;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
    white-space: normal;
    word-break: normal;
    min-width: 65px;
    margin: 0;
}

.type-outflow {
    color: #fb7185;
    background: rgba(244, 63, 94, 0.1);
    border-color: rgba(244, 63, 94, 0.2);
}

.type-coupon {
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
}

.type-principal {
    color: #6ee7b7;
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
}

.type-ex-coupon {
    color: #fcd34d;
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
}

.amount-ex-coupon {
    display: block;
    color: var(--text-muted);
    text-decoration: line-through;
    font-size: 0.72rem;
}

.amount-buyer-ex-coupon {
    display: block;
    color: #fbbf24;
    font-weight: 700;
}

.mobile-only {
    display: none !important;
}

.desktop-only {
    /* visible on desktop */
}

@media (max-width: 600px) {
    .desktop-only {
        display: none !important;
    }
    .mobile-only {
        display: block !important;
    }
    .table-date-sub {
        font-size: 0.625rem;
        color: var(--text-muted);
        margin-top: 0.15rem;
        font-family: var(--font-body);
    }
    .table-days-sub {
        font-size: 0.6rem;
        color: var(--text-muted);
        margin-top: 0.1rem;
        font-family: var(--font-mono);
        font-weight: 600;
    }
}

/* =========================================================
   Tooltip
   ========================================================= */
.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-secondary);
    font-size: 8px;
    font-weight: 800;
    cursor: help;
    transition: all var(--t-fast) var(--ease-smooth);
    vertical-align: middle;
    flex-shrink: 0;
}

.tooltip-icon:hover {
    background: rgba(99,102,241,0.2);
    border-color: rgba(99,102,241,0.4);
    color: #a5b4fc;
}

/* =========================================================
   Badges (header & inline)
   ========================================================= */
.badge-live {
    background: rgba(16, 185, 129, 0.13) !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
    color: #34d399 !important;
}

.badge-live::before {
    background: #10b981 !important;
    box-shadow: 0 0 6px rgba(16,185,129,0.8) !important;
}

.badge-simulated {
    background: rgba(245, 158, 11, 0.13) !important;
    border: 1px solid rgba(245, 158, 11, 0.3) !important;
    color: #fbbf24 !important;
}

.badge-simulated::before {
    background: #f59e0b !important;
    box-shadow: 0 0 6px rgba(245,158,11,0.7) !important;
}

/* =========================================================
   NSDL Search
   ========================================================= */
.search-container {
    position: relative;
    margin-bottom: 1.5rem;
}

.clear-btn {
    transition: color var(--t-fast) var(--ease-smooth);
    z-index: 2;
    pointer-events: auto !important;
}

.clear-btn:hover { color: var(--rose) !important; }

.search-dropdown {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    max-height: 300px;
    background: rgba(10, 14, 26, 0.97);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--r-md);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.04);
    z-index: 999;
    overflow-y: auto;
    animation: dropdown-enter var(--t-base) var(--ease-snappy);
}

@keyframes dropdown-enter {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

.search-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: all var(--t-fast) var(--ease-smooth);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    position: relative;
}

.search-item:last-child { border-bottom: none; }

.search-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--grad-primary);
    border-radius: 0 2px 2px 0;
    opacity: 0;
    transition: opacity var(--t-fast) var(--ease-smooth);
}

.search-item:hover, .search-item.highlighted {
    background: rgba(99, 102, 241, 0.1);
    padding-left: calc(1rem + 3px);
}

.search-item:hover::before, .search-item.highlighted::before { opacity: 1; }

.search-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.search-item-issuer {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 68%;
}

.search-item-isin {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: #a78bfa;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.search-item-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.search-item-details {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.125rem;
    flex-wrap: wrap;
}

.search-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: var(--r-xs);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-coupon {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-freq {
    background: rgba(99, 102, 241, 0.1);
    color: #c7d2fe;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

/* =========================================================
   Scrollbars
   ========================================================= */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.1); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.22); }

/* =========================================================
   Utility — fade-in for output panels
   ========================================================= */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.outputs-panel > * {
    animation: fade-up 0.4s var(--ease-smooth) both;
}

.outputs-panel > *:nth-child(1) { animation-delay: 0.05s; }
.outputs-panel > *:nth-child(2) { animation-delay: 0.10s; }
.outputs-panel > *:nth-child(3) { animation-delay: 0.15s; }
.outputs-panel > *:nth-child(4) { animation-delay: 0.20s; }
.outputs-panel > *:nth-child(5) { animation-delay: 0.25s; }

/* =========================================================
   Bond Info Strip (shown after NSDL bond selection)
   ========================================================= */
.bond-info-strip {
    background: linear-gradient(135deg, rgba(99,102,241,0.1) 0%, rgba(139,92,246,0.08) 100%);
    backdrop-filter: blur(20px) saturate(160%);
    -webkit-backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(99, 102, 241, 0.28);
    border-radius: var(--r-md);
    padding: 0.9rem 1rem 0.75rem;
    margin-bottom: 1.25rem;
    animation: fade-up 0.3s var(--ease-smooth);
    position: relative;
    overflow: hidden;
    box-shadow: 0 0 24px rgba(99,102,241,0.1), inset 0 1px 0 rgba(255,255,255,0.06);
}

/* Shimmer top-left corner */
.bond-info-strip::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 55%);
    pointer-events: none;
    border-radius: inherit;
}

/* Left accent glow bar */
.bond-info-strip::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--grad-primary);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 10px rgba(99,102,241,0.6);
}

.bond-info-details-table {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    margin-top: 0.7rem;
    border-top: 1px solid rgba(99,102,241,0.15);
    padding-top: 0.65rem;
}

.bid-column {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.bid-label {
    font-size: 0.58rem;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 0.09em;
}

.bid-value {
    font-family: var(--font-display);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.bond-info-name {
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
    background: linear-gradient(120deg, #ffffff 30%, #c4b5fd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.bond-info-isin {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: #a78bfa;
    font-weight: 600;
    margin-top: 0.15rem;
    letter-spacing: 0.06em;
    text-shadow: 0 0 10px rgba(167,139,250,0.4);
}

.bond-info-chips {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.bond-chip {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--r-sm);
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--border);
}

.chip-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
}

.chip-value {
    font-family: var(--font-display);
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.chip-value.accent { color: #34d399; }

/* =========================================================
   Number of Bonds Stepper
   ========================================================= */
.stepper-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-strong);
    border-radius: var(--r-sm);
    overflow: hidden;
    height: 46px;
    transition: border-color var(--t-fast) var(--ease-smooth);
}

.stepper-wrapper:focus-within {
    border-color: var(--indigo);
}

.stepper-btn {
    width: 40px;
    height: 100%;
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--t-fast) var(--ease-smooth);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.stepper-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.stepper-btn:active {
    background: rgba(255, 255, 255, 0.1);
}

.stepper-input {
    flex: 1;
    width: 0;
    min-width: 0;
    height: 100%;
    background: none;
    border: none !important;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    padding: 0 !important;
    outline: none;
    -moz-appearance: textfield;
}

.stepper-input::-webkit-outer-spin-button,
.stepper-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* =========================================================
   Result Summary Card
   ========================================================= */
.result-summary-card {
    background: var(--grad-hero-ytm);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: var(--r-md);
    padding: 1.125rem 1.25rem;
    margin-top: 1.25rem;
    animation: fade-up 0.35s var(--ease-smooth);
}

.rsc-top {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.875rem;
    flex-wrap: wrap;
}

.rsc-price {
    font-family: var(--font-display);
    font-size: 1.375rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.rsc-at {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.rsc-ytm {
    font-family: var(--font-display);
    font-size: 1.375rem;
    font-weight: 800;
    color: #818cf8;
    letter-spacing: -0.02em;
}

.rsc-bottom {
    display: flex;
    align-items: stretch;
    gap: 0;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--r-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

.rsc-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.625rem 0.5rem;
    gap: 0.25rem;
}

.rsc-divider {
    width: 1px;
    background: var(--border);
    margin: 0.375rem 0;
    flex-shrink: 0;
}

.rsc-lbl {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
}

.rsc-val {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}

/* =========================================================
   Separator (HR)
   ========================================================= */
hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-strong), transparent);
    margin: 1.5rem 0;
}

/* =========================================================
   Sticky Result Strip (shows after calculation)
   ========================================================= */
.result-strip {
    display: none; /* shown on mobile only via media query */
    position: sticky;
    top: 64px;
    z-index: 90;
    background: rgba(6, 9, 17, 0.92);
    backdrop-filter: blur(16px) saturate(160%);
    -webkit-backdrop-filter: blur(16px) saturate(160%);
    border-bottom: 1px solid var(--border);
    padding: 0.625rem 1rem;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.3s var(--ease-smooth), transform 0.3s var(--ease-smooth);
    pointer-events: none;
}

.result-strip::-webkit-scrollbar { display: none; }

.result-strip.has-data {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.result-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 0.875rem;
    min-width: max-content;
    flex-shrink: 0;
}

.result-chip-divider {
    width: 1px;
    align-self: stretch;
    background: var(--border);
    margin: 0.125rem 0;
    flex-shrink: 0;
}

.rc-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}

.rc-value {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.rc-value.accent-green { color: #6ee7b7; }

/* =========================================================
   Collapsible Sections
   ========================================================= */
.collapsible-section {
    display: flex;
    flex-direction: column;
}

.collapse-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 0.875rem 1.125rem;
    cursor: pointer;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    transition: all var(--t-base) var(--ease-smooth);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.collapse-toggle:hover {
    background: var(--bg-surface-2);
    border-color: var(--border-strong);
}

.collapse-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.collapse-chevron {
    flex-shrink: 0;
    transition: transform var(--t-base) var(--ease-smooth);
    color: var(--text-muted);
}

.collapsible-section.collapsed .collapse-chevron {
    transform: rotate(180deg);
}

.collapsible-body {
    overflow: hidden;
    transition: max-height 0.35s var(--ease-smooth);
    display: flex;
    flex-direction: column;
    gap: 0; /* handled by children */
}

/* =========================================================
   Floating Action Button (mobile only)
   ========================================================= */
.fab {
    display: flex; /* Visible everywhere to open standalone calculator */
    position: fixed;
    bottom: calc(1.5rem + env(safe-area-inset-bottom));
    right: 1.25rem;
    z-index: 200;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--grad-primary);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.6), 0 0 0 1px rgba(99,102,241,0.4);
    transition: all var(--t-base) var(--ease-snappy);
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.fab:hover, .fab:active {
    transform: scale(1.1);
    box-shadow: 0 6px 28px rgba(99, 102, 241, 0.8);
}

.fab:active { transform: scale(0.95); }

/* =========================================================
   MOBILE — Main breakpoints
   ========================================================= */

/* ── ≤ 1100px: Stack side-by-side to full column ── */
@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .charts-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── ≤ 768px: Tablet portrait ── */
@media (max-width: 768px) {
    /* Layout */
    main {
        padding: 1rem;
        padding-bottom: 5.5rem; /* space for FAB */
    }

    .dashboard-grid { gap: 1rem; }

    /* Header */
    header { height: 56px; padding: 0 1rem; }
    .logo-text h1 { font-size: 1rem; }
    .logo-text p  { display: none; }
    .logo-icon    { width: 32px; height: 32px; border-radius: 9px; }
    .logo-icon svg { width: 15px; height: 15px; }
    .badge#conventionBadge { display: none; }

    /* Result strip becomes visible */
    .result-strip {
        display: none;
        top: 56px;
    }
    .result-strip.has-data {
        display: flex;
    }

    /* Cards */
    .card { padding: 1.25rem; border-radius: var(--r-md); }
    .input-card { border-radius: var(--r-md); }

    /* Hero stats: hide redundant metrics cards on mobile */
    .main-metrics,
    .stats-grid {
        display: none !important;
    }

    /* Charts */
    .charts-grid { grid-template-columns: 1fr; gap: 0.75rem; }
    .chart-card  { height: 320px; padding: 1.125rem; }

    /* Collapsible sections */
    .collapsible-section { gap: 0.625rem; }
    .collapse-toggle { padding: 0.75rem 1rem; font-size: 0.8125rem; }

    /* Collapsible body spacing */
    .collapsible-body .card { margin-top: 0.5rem; }
    .collapsible-body .charts-grid { margin-top: 0.5rem; }

    /* Pricing breakdown → 2 col */
    .pricing-breakdown { grid-template-columns: 1fr 1fr; gap: 0 1rem; }

    /* Schedule table */
    .schedule-container { max-height: 450px; }
    .schedule-table th,
    .schedule-table td { padding: 0.45rem 0.65rem; font-size: 0.68rem; }

    /* Tabs: bigger touch targets */
    .tabs-container { margin-bottom: 1.25rem; }
    .tab-btn { padding: 0.75rem 0.5rem; font-size: 0.8rem; }

    /* Form */
    .form-group { margin-bottom: 0.75rem; }
    label { font-size: 0.65rem; margin-bottom: 0.3rem; }
    .input-wrapper input,
    .input-wrapper select {
        padding: 0.75rem 0.9rem;
        font-size: 0.9375rem; /* 15px — prevents iOS zoom */
        border-radius: var(--r-sm);
    }

    /* Slider — bigger thumb for touch */
    input[type="range"] { height: 4px; }
    input[type="range"]::-webkit-slider-thumb {
        width: 22px;
        height: 22px;
    }

    /* Button */
    .btn-primary { padding: 0.8rem; font-size: 0.9rem; margin-top: 0.9rem; }

    /* FAB */
    .fab { display: flex; }



    /* Outputs panel animations: disable on mobile for perf */
    .outputs-panel > * { animation: none; }
}

/* ── ≤ 480px: Small phones ── */
@media (max-width: 480px) {
    main { padding: 0.75rem; padding-bottom: 5.5rem; }
    .dashboard-grid { gap: 0.75rem; }

    /* Header */
    header { padding: 0 0.875rem; }

    /* Card */
    .card { padding: 0.85rem; }

    /* Charts */
    .chart-card  { height: 280px; }

    /* Stack row-2 elements (Bonds & Dates, Maturity & Day count, Coupon & Freq) on mobile */
    .form-group.row-2 {
        grid-template-columns: 1fr;
        gap: 0.875rem;
    }

    /* Pricing: single column on tiny phones */
    .pricing-breakdown { grid-template-columns: 1fr; gap: 0; }

    /* Schedule: compressed */
    .schedule-table th,
    .schedule-table td { padding: 0.4rem 0.5rem; font-size: 0.65rem; }

    /* FAB size */
    .fab { width: 52px; height: 52px; right: 1rem; }

    /* Collapse toggle */
    .collapse-toggle { padding: 0.7rem 0.875rem; font-size: 0.775rem; }
    .collapse-title svg { display: none; } /* save space */

    /* Result strip */
    .rc-value { font-size: 0.75rem; }
    .rc-label { font-size: 0.57rem; }
    .result-chip { padding: 0 0.625rem; }

    /* Result summary card mobile stacking */
    .rsc-bottom {
        flex-direction: column;
    }
    .rsc-divider {
        width: 100%;
        height: 1px;
        margin: 0;
    }
    .rsc-item {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1rem;
        width: 100%;
    }
    .rsc-val {
        text-align: right;
    }
}

/* ── ≤ 360px: Very small phones ── */
@media (max-width: 360px) {
    .form-group.row-2 { grid-template-columns: 1fr; }
}

/* =========================================================
   Touch / Hover: remove hover states on touch devices
   ========================================================= */
@media (hover: none) {
    .card:hover         { transform: none; border-color: var(--border); }
    .hero-stat:hover    { transform: none; }
    .stat-card:hover    { transform: none; border-color: var(--border); }
    .btn-primary:hover  { transform: none; }
    .search-item:hover  { background: rgba(99,102,241,0.12); }
}

/* =========================================================
   iOS Safe Area insets
   ========================================================= */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    main {
        padding-bottom: calc(5.5rem + env(safe-area-inset-bottom));
    }
    .fab {
        bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }
}

/* =========================================================
   Print: hide chrome, show content
   ========================================================= */
@media print {
    header, .fab, .result-strip, .collapse-toggle,
    .btn-primary, .tabs-container { display: none !important; }
    main { padding: 0; }
    .dashboard-grid { display: block; }
    .collapsible-body { max-height: none !important; }
    .card { box-shadow: none; border: 1px solid #ccc; }
    body { background: white; color: black; }
}

/* =========================================================
   Manual Overrides Toggle Styles
   ========================================================= */
.manual-toggle-container {
    margin: 1rem 0 0.75rem 0;
    display: flex;
    justify-content: center;
}

.btn-toggle-manual {
    background: rgba(99, 102, 241, 0.07);
    border: 1px solid rgba(99, 102, 241, 0.22);
    color: #a5b4fc;
    padding: 0.5rem 0.8rem;
    font-family: var(--font-display);
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--r-md);
    cursor: pointer;
    transition: all var(--t-base) var(--ease-smooth);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    outline: none;
}

.btn-toggle-manual:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.45);
    color: #c4b5fd;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.12);
}

.btn-toggle-manual:active {
    transform: scale(0.98);
}

.btn-toggle-manual.active {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.35);
    color: #34d399;
}

.btn-toggle-manual.active:hover {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.5);
    color: #6ee7b7;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.12);
}

.btn-toggle-manual svg {
    transition: transform var(--t-base) var(--ease-smooth);
}

.btn-toggle-manual.active svg {
    transform: rotate(180deg);
}

.manual-bond-params {
    transition: all var(--t-base) var(--ease-smooth);
}

/* =========================================================
   Side-by-Side Mode Selector & Inputs
   ========================================================= */
.mode-selector-grid {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.mode-input-card {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    padding: 0.85rem;
    border-radius: var(--r-md);
    transition: all var(--t-base) var(--ease-smooth);
    position: relative;
}

.mode-input-card.active {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.04);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.08);
}

.or-separator {
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 800;
    text-align: center;
    letter-spacing: 0.05em;
    user-select: none;
}

.mode-radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    margin-bottom: 0.6rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    user-select: none;
}

.mode-radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 12px;
    height: 12px;
    border: 2px solid var(--text-muted);
    border-radius: 50%;
    display: inline-block;
    position: relative;
    transition: border-color var(--t-fast) var(--ease-smooth);
    flex-shrink: 0;
}

.mode-radio-label input[type="radio"]:checked + .radio-custom {
    border-color: var(--indigo);
}

.mode-radio-label input[type="radio"]:checked + .radio-custom::after {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--indigo);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.mode-helper-text {
    font-size: 0.68rem;
    font-weight: 600;
    margin-top: 0.4rem;
    letter-spacing: 0.02em;
}

.success-text {
    color: #34d399; /* Green calculated output text */
}

/* Style for read-only input fields acting as outputs */
.readonly-input {
    background: rgba(0, 0, 0, 0.15) !important;
    border-color: var(--border) !important;
    color: var(--text-secondary) !important;
    cursor: default !important;
    font-weight: 600 !important;
}

.slider-form-group {
    margin-bottom: 1.25rem;
}

/* =========================================================
   Bond Info Details Table Styles
   ========================================================= */
.bond-info-isin-desc {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.45);
    margin-top: 0.2rem;
    font-weight: 500;
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
    letter-spacing: 0.01em;
}



@media (max-width: 600px) {
    .mode-selector-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    .or-separator {
        margin: 0.25rem 0;
    }
}

/* Premium design overrides to remove inner input borders/box and make text large & bold */
.mode-input-card .input-wrapper {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding: 0 !important;
    margin-top: 0.25rem !important;
}

.mode-input-card .input-wrapper input {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    font-size: 1.75rem !important;
    font-weight: 800 !important;
    color: var(--text-primary) !important;
    padding: 0.25rem 0 !important;
    height: auto !important;
    width: 100% !important;
    font-family: var(--font-body) !important;
    line-height: 1.2 !important;
}

.mode-input-card .input-wrapper input:focus {
    box-shadow: none !important;
    outline: none !important;
    background: transparent !important;
}

.mode-input-card .input-wrapper .input-prefix,
.mode-input-card .input-wrapper .input-suffix {
    position: static !important;
    font-size: 1.5rem !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    padding: 0 !important;
    margin: 0 !important;
}

.mode-input-card .input-wrapper.has-prefix input {
    padding-left: 0.25rem !important;
}

.mode-input-card .input-wrapper.has-suffix input {
    padding-right: 0.25rem !important;
}

/* Inactive card input overrides */
.mode-input-card:not(.active) .input-wrapper input {
    color: var(--text-muted) !important;
}

.mode-input-card:not(.active) .input-wrapper .input-prefix,
.mode-input-card:not(.active) .input-wrapper .input-suffix {
    color: var(--text-muted) !important;
}

/* View More Details Link styles */
.view-more-details-wrapper {
    margin-top: 0.6rem;
    padding-top: 0.45rem;
    border-top: 1px solid rgba(99,102,241,0.12);
}

.view-more-link {
    color: #818cf8;
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
    transition: all var(--t-fast) var(--ease-smooth);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.view-more-link::after {
    content: '→';
    font-size: 0.8em;
    transition: transform var(--t-fast) var(--ease-snappy);
}

.view-more-link:hover {
    color: #c4b5fd;
    text-shadow: 0 0 10px rgba(196,181,253,0.5);
}

.view-more-link:hover::after {
    transform: translateX(3px);
}

/* =========================================================
   Top Navigation Tabs
   ========================================================= */
.nav-tabs {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--r-md);
    padding: 0.2rem;
    gap: 0.2rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    transition: all var(--t-base) var(--ease-smooth);
}

.nav-tab svg {
    opacity: 0.65;
    transition: opacity var(--t-base) var(--ease-smooth);
}

.nav-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab:hover svg {
    opacity: 1;
}

.nav-tab.active {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.25) 0%, rgba(139, 92, 246, 0.2) 100%);
    border: 1px solid rgba(99, 102, 241, 0.3);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.12);
}

.nav-tab.active svg {
    color: #a5b4fc;
    opacity: 1;
}

/* =========================================================
   SGB Gold Theme
   ========================================================= */
.accent-gold {
    border-left: 3px solid #eab308 !important;
}

.mode-input-card.gold-active {
    border: 1px solid rgba(234, 179, 8, 0.35) !important;
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.08) 0%, rgba(202, 138, 4, 0.06) 100%) !important;
    box-shadow: 0 0 20px rgba(234, 179, 8, 0.08) !important;
}

.mode-input-card.gold-active::before {
    background: radial-gradient(circle at 0% 0%, rgba(234, 179, 8, 0.15) 0%, transparent 60%) !important;
}

.mode-input-card.gold-active .input-prefix {
    color: #f59e0b !important;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
}

.mode-input-card.gold-active .input-wrapper input {
    color: #ffffff !important;
}

/* =========================================================
   Responsive Overrides for Nav Tabs
   ========================================================= */
@media (max-width: 600px) {
    .nav-tabs {
        padding: 0.15rem;
        gap: 0.15rem;
    }
    .nav-tab {
        padding: 0.35rem 0.65rem;
        font-size: 0.72rem;
        gap: 0.3rem;
    }
}

@media (max-width: 480px) {
    .logo-text {
        display: none !important;
    }
    .nav-tab span {
        display: none;
    }
    .nav-tab {
        padding: 0.45rem;
    }
}

/* =========================================================
   Database Status Container & Badge
   ========================================================= */
.db-status-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
}
.db-status-badge {
    background: rgba(99, 102, 241, 0.1);
    color: #818cf8;
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* =========================================================
   Admin Panel Styles
   ========================================================= */
.admin-container {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    animation: fade-up 0.4s var(--ease-smooth);
}

.admin-login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(80vh - 120px);
}

.admin-login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(30, 41, 59, 0.45);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--r-lg);
    padding: 2.25rem;
    box-shadow: var(--shadow-xl), 0 0 40px rgba(99, 102, 241, 0.05);
    animation: fade-up 0.3s var(--ease-smooth);
}

.admin-login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.admin-login-header h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.admin-login-header p {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.admin-login-error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #ef4444;
    padding: 0.75rem 1rem;
    border-radius: var(--r-sm);
    font-size: 0.8125rem;
    margin-bottom: 1.25rem;
    display: none;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Terminal Window */
.terminal-window {
    background: #090d16;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--r-md);
    overflow: hidden;
    margin-top: 1.5rem;
    box-shadow: var(--shadow-lg);
}

.terminal-header {
    background: #111827;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    padding: 0.75rem 1.125rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.terminal-dots {
    display: flex;
    gap: 0.4rem;
}

.terminal-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.terminal-dot.red { background: #ef4444; }
.terminal-dot.yellow { background: #f59e0b; }
.terminal-dot.green { background: #10b981; }

.terminal-title {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.terminal-body {
    padding: 1.25rem;
    height: 380px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-all;
}

.terminal-body::-webkit-scrollbar {
    width: 6px;
}
.terminal-body::-webkit-scrollbar-track {
    background: transparent;
}
.terminal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
.terminal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.terminal-status-bar {
    background: #111827;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
    padding: 0.65rem 1.125rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #6b7280;
}
.status-dot.active {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 1.5s infinite alternate;
}
.status-dot.syncing {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
    animation: pulse 0.7s infinite alternate;
}

@keyframes pulse {
    0% { opacity: 0.4; }
    100% { opacity: 1; }
}

.admin-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.btn-admin-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary);
    border: none;
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: var(--r-md);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--t-base) var(--ease-smooth);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

.btn-admin-action:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.btn-admin-action:active {
    transform: translateY(0);
}

.btn-admin-action.secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-primary);
    box-shadow: none;
}

.btn-admin-action.secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.16);
}

.btn-admin-action.secondary:active {
    background: rgba(255, 255, 255, 0.04);
}

.btn-admin-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.admin-link-container {
    text-align: center;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.admin-link {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--t-base) var(--ease-smooth);
}
.admin-link:hover {
    color: var(--primary-light);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =========================================================
   Trader Portal Layout Override & Table Rules
   ========================================================= */
.dashboard-grid {
    grid-template-columns: 1.55fr 1fr !important;
}

@media (max-width: 1280px) {
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
}

.search-controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.db-toggle-group {
    display: inline-flex;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 3px;
    gap: 4px;
}

.db-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.45rem 1rem;
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--t-fast) var(--ease-smooth);
}

.db-toggle-btn:hover:not(.active) {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.db-toggle-btn.active {
    background: var(--grad-primary);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(99,102,241,0.3);
}

.add-custom-btn {
    padding: 0.45rem 0.85rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--r-sm);
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-primary);
    transition: all var(--t-fast);
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.add-custom-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.global-settings-row {
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 0.75rem 1rem;
}

.global-settings-row label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.3rem;
}

.global-settings-row input {
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.quote-sheet-wrapper {
    margin-top: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
}

.table-scroll-container {
    width: 100%;
    overflow-x: auto;
}

.quote-sheet-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.8125rem;
}

.quote-sheet-table th {
    background: rgba(13, 18, 30, 0.95);
    padding: 0.85rem 0.75rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-strong);
}

.quote-sheet-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-primary);
}

.quote-sheet-table tr.selected-row {
    background: rgba(99, 102, 241, 0.08);
}

.quote-sheet-table tr.selected-row td {
    border-bottom-color: rgba(99, 102, 241, 0.25);
}

.quote-sheet-table tr:hover:not(.selected-row) {
    background: rgba(255, 255, 255, 0.02);
}

.table-empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

/* Inline inputs inside table */
.inline-input {
    background: rgba(0, 0, 0, 0.45) !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: var(--r-xs) !important;
    color: var(--text-primary) !important;
    font-family: var(--font-mono) !important;
    font-size: 0.8125rem !important;
    padding: 0.35rem 0.5rem !important;
    width: 100% !important;
    text-align: right !important;
    transition: border-color var(--t-fast) !important;
}

.inline-input:focus {
    border-color: var(--border-focus) !important;
    outline: none !important;
    background: rgba(0, 0, 0, 0.6) !important;
}

/* Buy/Sell toggle cell */
.trade-type-toggle {
    display: inline-flex;
    border-radius: var(--r-xs);
    overflow: hidden;
    border: 1px solid var(--border);
    padding: 1px;
    background: rgba(0, 0, 0, 0.2);
}

.trade-type-btn {
    border: none;
    background: transparent;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    cursor: pointer;
    color: var(--text-muted);
    transition: all var(--t-fast);
}

.trade-type-btn.active.buy {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.25);
}

.trade-type-btn.active.sell {
    background: rgba(244, 63, 94, 0.15);
    color: #f43f5e;
    box-shadow: inset 0 0 0 1px rgba(244, 63, 94, 0.25);
}

/* Action buttons */
.row-action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all var(--t-fast);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.row-action-btn.details-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.06);
}

.row-action-btn.delete-btn:hover {
    color: var(--rose);
    background: rgba(244, 63, 94, 0.08);
}

/* Totals Strip */
.summary-metrics-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.summary-metric-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 0.65rem 0.85rem;
    display: flex;
    flex-direction: column;
}

.summary-metric-card .sm-lbl {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.15rem;
}

.summary-metric-card .sm-val {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.summary-metric-card.buy-card {
    border-left: 3px solid var(--emerald);
}

.summary-metric-card.buy-card .sm-val {
    color: #6ee7b7;
}

.summary-metric-card.sell-card {
    border-left: 3px solid var(--rose);
}

.summary-metric-card.sell-card .sm-val {
    color: #fda4af;
}

.summary-metric-card.net-card {
    border-left: 3px solid var(--sky);
}

.summary-metric-card.yield-card {
    border-left: 3px solid var(--violet);
}

.sharing-actions-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
    border-top: 1px solid var(--border);
    padding-top: 1.25rem;
}

.sharing-actions-row .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--t-base);
}

.sharing-actions-row .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Placeholder and Active View States */
.details-placeholder-card {
    padding: 4.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-style: dashed !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

.selected-bond-header {
    background: rgba(99, 102, 241, 0.03) !important;
    border-color: rgba(99, 102, 241, 0.15) !important;
}

.override-card .override-grid label {
    margin-bottom: 0.25rem;
}

.override-card .override-grid input,
.override-card .override-grid select {
    padding: 0.5rem 0.75rem;
    font-size: 0.825rem;
}

/* =========================================================
   Print Stylesheet
   ========================================================= */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
        font-size: 10pt !important;
        padding: 0.5in !important;
        margin: 0 !important;
    }
    
    body::before {
        display: none !important;
    }
    
    header, 
    footer,
    .search-section, 
    .global-settings-row, 
    .sharing-actions-row, 
    .admin-link-container, 
    .outputs-panel, 
    .fab,
    .row-action-btn.delete-btn,
    #btnBondsMinus,
    #btnBondsPlus,
    th:last-child,
    td:last-child {
        display: none !important;
    }
    
    main {
        padding: 0 !important;
        margin: 0 !important;
        max-width: 100% !important;
    }
    
    .dashboard-grid {
        display: block !important;
    }
    
    .quote-builder-card {
        background: none !important;
        border: none !important;
        padding: 0 !important;
        box-shadow: none !important;
    }
    
    /* Add Print Invoice Header */
    .quote-builder-card::before {
        content: "BOND PORTFOLIO QUOTATION\nKrishnarpan Investments\nGenerated: " attr(data-date) "\nPrepared For: " attr(data-client) !important;
        display: block !important;
        white-space: pre-wrap !important;
        font-family: 'Space Grotesk', -apple-system, sans-serif !important;
        font-size: 14pt !important;
        font-weight: 700 !important;
        margin-bottom: 2rem !important;
        border-bottom: 2px solid #000000 !important;
        padding-bottom: 1rem !important;
        color: #000000 !important;
    }
    
    .quote-sheet-wrapper {
        border: 1px solid #000000 !important;
        background: none !important;
        border-radius: 0 !important;
    }
    
    .quote-sheet-table {
        font-size: 8.5pt !important;
    }
    
    .quote-sheet-table th {
        background: #f3f4f6 !important;
        color: #000000 !important;
        border-bottom: 2px solid #000000 !important;
        font-weight: bold !important;
    }
    
    .quote-sheet-table td {
        border-bottom: 1px solid #e5e7eb !important;
        color: #000000 !important;
        background: none !important;
    }
    
    /* Hide inputs and show values in print */
    .quote-sheet-table input,
    .quote-sheet-table select {
        border: none !important;
        background: none !important;
        padding: 0 !important;
        text-align: right !important;
        font-family: inherit !important;
        font-size: inherit !important;
        color: #000000 !important;
    }
    
    .summary-metrics-strip {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 1rem !important;
        margin-top: 2rem !important;
    }
    
    .summary-metric-card {
        flex: 1 !important;
        min-width: 120px !important;
        background: #f9fafb !important;
        border: 1px solid #e5e7eb !important;
        border-left: 4px solid #4b5563 !important;
        border-radius: 0 !important;
        padding: 0.5rem !important;
    }
    
    .summary-metric-card.buy-card {
        border-left-color: #10b981 !important;
    }
    
    .summary-metric-card.sell-card {
        border-left-color: #f43f5e !important;
    }
    
    .summary-metric-card.net-card {
        border-left-color: #38bdf8 !important;
    }
    
    .summary-metric-card.yield-card {
        border-left-color: #8b5cf6 !important;
    }
    
    .summary-metric-card .sm-lbl {
        color: #4b5563 !important;
    }
    
    .summary-metric-card .sm-val {
        color: #000000 !important;
        font-size: 11pt !important;
    }
}

/* =========================================================
   Footer
   ========================================================= */
footer {
    background: rgba(6, 9, 17, 0.82);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-top: 1px solid var(--border);
    padding: 3rem 2rem 2rem 2rem;
    margin-top: auto;
    position: relative;
    z-index: 10;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(99,102,241,0.2) 50%, transparent 100%);
}

.footer-container {
    max-width: 1520px;
    margin: 0 auto;
    width: 100%;
    display: grid;
    grid-template-columns: 2fr 1fr 2fr;
    gap: 3rem;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-brand .logo-section {
    align-self: flex-start;
}

.footer-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 320px;
}

.footer-links-group {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.footer-links-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-primary);
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.78rem;
    transition: color var(--t-base) var(--ease-smooth);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.footer-link:hover {
    color: #a5b4fc;
}

.footer-compliance {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.footer-compliance-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-primary);
}

.footer-disclaimer {
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.footer-divider {
    grid-column: 1 / -1;
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
    margin: 1.25rem 0;
}

.footer-bottom {
    grid-column: 1 / -1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.footer-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.5rem;
    border-radius: var(--r-sm);
}

.footer-status-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(16,185,129,0.8);
}

@media (max-width: 992px) {
    .footer-container {
        grid-template-columns: 1fr 1fr;
        gap: 2.5rem;
    }
    .footer-compliance {
        grid-column: 1 / -1;
    }
}

@media (max-width: 640px) {
    footer {
        padding: 2rem 1rem 1.5rem 1rem;
    }
    .footer-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* =========================================================
   Mobile Overrides for Quote Sheet Table Rows
   ========================================================= */
@media (max-width: 600px) {
    .quote-sheet-table thead {
        display: none !important;
    }
    
    .quote-sheet-table tbody {
        display: block !important;
    }
    
    .quote-sheet-table tr {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) auto !important;
        grid-template-areas:
            "type type type type"
            "desc desc desc desc"
            "qty px ytm actions" !important;
        gap: 0.65rem !important;
        padding: 0.75rem 0.9rem !important;
        margin-bottom: 0.75rem !important;
        background: rgba(255, 255, 255, 0.02) !important;
        border: 1px solid var(--border) !important;
        border-radius: var(--r-md) !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .quote-sheet-table td {
        display: block !important;
        padding: 0 !important;
        border: none !important;
        width: 100% !important;
        text-align: left !important;
    }
    
    .quote-sheet-table td:nth-child(1) {
        grid-area: type !important;
    }
    
    .quote-sheet-table td:nth-child(2) {
        grid-area: desc !important;
        margin-bottom: 0.35rem !important;
    }
    
    .quote-sheet-table td:nth-child(3) {
        grid-area: qty !important;
    }
    
    .quote-sheet-table td:nth-child(4) {
        grid-area: px !important;
    }
    
    .quote-sheet-table td:nth-child(5) {
        grid-area: ytm !important;
    }
    
    .quote-sheet-table td:nth-child(6) {
        grid-area: actions !important;
        justify-self: end !important;
        align-self: center !important;
    }
    
    /* Input sizing inside quote table cells */
    .quote-sheet-table td .inline-input {
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Inject labels above fields */
    .quote-sheet-table td:nth-child(3)::before {
        content: "Qty" !important;
        display: block !important;
        font-size: 0.65rem !important;
        color: var(--text-secondary) !important;
        margin-bottom: 0.2rem !important;
        text-transform: uppercase !important;
        font-weight: 600 !important;
        letter-spacing: 0.05em !important;
    }
    
    .quote-sheet-table td:nth-child(4)::before {
        content: "Price" !important;
        display: block !important;
        font-size: 0.65rem !important;
        color: var(--text-secondary) !important;
        margin-bottom: 0.2rem !important;
        text-transform: uppercase !important;
        font-weight: 600 !important;
        letter-spacing: 0.05em !important;
    }
    
    .quote-sheet-table td:nth-child(5)::before {
        content: "YTM" !important;
        display: block !important;
        font-size: 0.65rem !important;
        color: var(--text-secondary) !important;
        margin-bottom: 0.2rem !important;
        text-transform: uppercase !important;
        font-weight: 600 !important;
        letter-spacing: 0.05em !important;
    }
    
    .quote-sheet-table td:nth-child(6)::before {
        content: "Actions" !important;
        display: block !important;
        font-size: 0.65rem !important;
        visibility: hidden !important;
        margin-bottom: 0.2rem !important;
    }
}




