/* ==========================================================================
   home.css — PineApple home page styles
   Page-specific only. Requires (in this order):
     style.css   -> shared CSS variables
     header.css  -> site header
     footer.css  -> site footer
   ========================================================================== */


:root {
    /* --primary: #0f8a5f; */
    --primary-light: #e6f6ef;
    --primary-dark: #0a6647;
    --warning: #d9822b;
    --warning-700: #b5651a;
    --warning-light: #fdf1e2;
    --surface: #ffffff;
    --page-bg: #f4f5f7;
    --on-surface: #1a1d21;
    --on-surface-variant: #6b7280;
    --border: #e8eaed;
    --radius: 18px;
}

/* ===== Date filter card ===== */
.card-shadow{ box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.filter-card{
    background: var(--surface);
    border:1px solid rgba(189,202,186,0.3);
    border-radius: var(--radius-2xl);
    padding:1.5rem;
}
.form-label-custom{
    font-size:11px; font-weight:700; letter-spacing:0.05em; text-transform:uppercase;
    color: var(--on-surface-variant);
    margin-bottom:.5rem;
    display:block;
}
.form-control-custom{
    background-color: var(--surface-container-low);
    border:1px solid rgba(189,202,186,0.5);
    border-radius: var(--radius-lg);
    padding:10px 16px;
    font-size:14px;
    width:100%;
}
.form-control-custom:focus{
    outline:none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,107,44,0.15);
}
.btn-view-price{
    background-color: var(--primary);
    color:#fff;
    border:none;
    border-radius: var(--radius-lg);
    padding:10px 32px;
    font-weight:700; font-size:12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    transition: all .15s ease;
    white-space: nowrap;
    width: 100%;
}
.btn-view-price:hover{ background-color: var(--primary-container); color:#fff; }
.btn-view-price:active{ transform: scale(0.95); }
@media (min-width: 576px){
    .btn-view-price{ width: auto; }
}


/* ===== Price Cards ===== */
.price-card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 24px 22px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(16,24,40,0.04), 0 1px 3px rgba(16,24,40,0.03);
    transition: box-shadow .2s ease, transform .2s ease;
}

.price-card:hover {
    box-shadow: 0 4px 16px rgba(16,24,40,0.08);
    transform: translateY(-2px);
}

.price-card-strip {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
}
.strip-primary { background: linear-gradient(90deg, #0f8a5f, #35c084); }
.strip-warning { background: linear-gradient(90deg, #d9822b, #f0a94e); }

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.card-title {
    font-size: 19px;
    font-weight: 700;
    margin: 0 0 4px;
    letter-spacing: -0.01em;
}

.card-sub {
    font-size: 12.5px;
    color: var(--on-surface-variant);
    margin: 0;
    font-weight: 500;
}

.icon-badge {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.icon-badge-primary { background: var(--primary-light); color: var(--primary); }
.icon-badge-warning { background: var(--warning-light); color: var(--warning-700); }
.icon-badge .material-symbols-outlined { font-size: 22px; }

/* ---- Price range: one big readable statement ---- */
.range-block {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.range-value {
    font-size: 34px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    color: var(--on-surface);
}

.range-sep {
    font-size: 22px;
    font-weight: 500;
    color: var(--on-surface-variant);
}

.range-unit {
    font-size: 13px;
    font-weight: 600;
    color: var(--on-surface-variant);
    margin-left: 2px;
}

.avg-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 14px;
}

.avg-strip-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--on-surface-variant);
    display: flex;
    align-items: center;
    gap: 6px;
}
.avg-strip-label .material-symbols-outlined { font-size: 16px; }

.avg-strip-value {
    font-size: 17px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.avg-value-primary { color: var(--primary); }
.avg-value-warning { color: var(--warning-700); }

.info-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    font-weight: 600;
    padding: 6px 12px 6px 10px;
    border-radius: 99px;
}
.info-pill-primary { background: var(--primary-light); color: var(--primary-dark); }
.info-pill-warning { background: var(--warning-light); color: var(--warning-700); }

.info-pill .date-relative { font-weight: 700; }
.info-pill .date-exact {
    font-weight: 500;
    opacity: 0.75;
}
.info-pill .date-dot {
    opacity: 0.45;
    font-weight: 400;
}

/* ===== Chart Section ===== */
.section-card{
    background: var(--surface);
    border-radius: var(--radius-2xl);
    border:1px solid rgba(189,202,186,0.3);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.timeframe-toggle{
    display:flex;
    background-color: var(--surface-container-low);
    border-radius: var(--radius-lg);
    padding:4px;
    border:1px solid rgba(189,202,186,0.2);
}
.timeframe-btn{
    padding:6px 16px;
    font-size:11px; font-weight:700;
    border-radius: var(--radius-lg);
    border:none;
    background:transparent;
    color: var(--on-surface-variant);
    transition: all .15s ease;
}
.timeframe-btn:hover{ background-color:#fff; }
.timeframe-btn.active{
    background-color:#fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    color: var(--primary);
}

.chart-wrap{ height:16rem; position:relative; overflow:hidden; display:flex; align-items:flex-end; }
.chart-bars{
    position:absolute; inset-inline:0; bottom:0;
    display:flex; align-items:flex-end; justify-content:space-between;
    height:12rem; padding:0 1rem; gap: .25rem;
}
.chart-bar{
    width:100%;
    background-color: rgba(0,107,44,0.1);
    border-radius: 8px 8px 0 0;
    transition: all .5s ease;
}
.chart-bar:hover{ background-color: rgba(0,107,44,0.2); }
.chart-bar.strong{ background-color: rgba(0,107,44,0.3); }
.chart-bar.strong:hover{ background-color: rgba(0,107,44,0.4); }
.chart-bar.stronger{ background-color: rgba(0,107,44,0.5); }
.chart-bar.stronger:hover{ background-color: rgba(0,107,44,0.6); }
.chart-bar.full{ background-color: var(--primary); }

.chart-gridlines{
    position:absolute; inset:0;
    display:flex; flex-direction:column; justify-content:space-between;
    pointer-events:none; padding: 1rem 0;
}
.chart-gridlines div{ border-top:1px dashed rgba(189,202,186,0.3); width:100%; }

.chart-xaxis{
    display:flex; justify-content:space-between;
    margin-top:1rem; padding:0 .5rem;
    font-size:10px; text-transform:uppercase; font-weight:700;
    letter-spacing:0.05em; color: var(--on-surface-variant); opacity:.6;
}

/* ===== Tables ===== */
.table-custom{ width:100%; text-align:left; }
.table-custom thead tr{
    background-color: rgba(242,244,246,0.5);
    font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:0.05em;
    color: var(--on-surface-variant);
    opacity:.8;
}
.table-custom th{ padding:1rem 1rem; }
.table-custom th:first-child{ padding-left:1.5rem; }
.table-custom td{ padding:1rem; vertical-align:middle; }
.table-custom td:first-child{ padding-left:1.5rem; }
.table-custom tbody tr{
    border-top:1px solid rgba(189,202,186,0.2);
    transition: background-color .2s ease, transform .2s ease;
}
.table-custom tbody tr:hover{ background-color: rgba(0,107,44,0.02); }

.trend-icon{
    width:32px; height:32px; border-radius:50%;
    display:inline-flex; align-items:center; justify-content:center;
}
.trend-up{ background-color: rgba(22,163,74,0.1); color: var(--success); }
.trend-flat{ background-color: rgba(62,74,61,0.1); color: var(--on-surface-variant); }
.trend-down{ background-color: rgba(186,26,26,0.1); color: var(--error); }

.table-footer{
    padding:1rem;
    background-color: rgba(242,244,246,0.3);
    border-top:1px solid rgba(189,202,186,0.2);
    display:flex; justify-content:space-between; align-items:center;
}
.page-btn{
    padding:8px; border-radius: var(--radius-lg);
    border:1px solid transparent; background:transparent;
    color: var(--on-surface-variant);
    transition: all .15s ease;
}
.page-btn:hover{ background-color:#fff; border-color: rgba(189,202,186,0.3); }

/* Summary tables */
.summary-card-header{
    padding:1rem;
    border-bottom:1px solid rgba(189,202,186,0.3);
    display:flex; align-items:center; gap:.5rem;
}
.summary-card-header.green{ background-color: rgba(0,107,44,0.05); }
.summary-card-header.warn{ background-color: rgba(245,158,11,0.05); }

/* ===== Sidebar ===== */
.sidebar{ width:100%; }
@media (min-width:992px){ .sidebar{ width:340px; flex-shrink:0; } }

.monthly-summary-card{
    background-color: var(--inverse-surface);
    color: var(--surface);
    border-radius: var(--radius-2xl);
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
    overflow:hidden;
    position:relative;
}
.monthly-summary-bg-icon{
    position:absolute; top:0; right:0; padding:1.5rem; opacity:.1;
}
.monthly-summary-bg-icon .material-symbols-outlined{ font-size:4rem; }

.progress-custom{
    height:8px; width:100%; background-color: rgba(255,255,255,0.1);
    border-radius: var(--radius-full); overflow:hidden;
}
.progress-custom-bar{
    background-color: var(--primary-fixed-dim);
    height:100%; border-radius: var(--radius-full);
    transition: width 1s ease;
}
.stat-box-dark{
    background-color: rgba(255,255,255,0.05);
    border:1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-xl);
    padding:1rem;
    display:flex; align-items:center; justify-content:space-between;
}
.btn-download-report{
    width:100%; padding:12px;
    background-color:#fff; color: var(--inverse-surface);
    font-weight:700; border-radius: var(--radius-xl);
    border:none; font-size:14px;
    transition: all .15s ease;
}
.btn-download-report:hover{ background-color: var(--primary-fixed-dim); }
.btn-download-report:active{ transform: scale(0.95); }

.market-pulse-card{
    background: var(--surface);
    border:1px solid rgba(189,202,186,0.3);
    border-radius: var(--radius-2xl);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow:hidden;
}
.pulse-header{
    padding:1.25rem;
    border-bottom:1px solid rgba(189,202,186,0.3);
    background-color: rgba(242,244,246,0.3);
}
.pulse-item{
    padding:1.25rem;
    border-top:1px solid rgba(189,202,186,0.2);
    cursor:pointer;
    transition: background-color .2s ease;
}
.pulse-item:first-child{ border-top:none; }
.pulse-item:hover{ background-color: var(--surface-container-low); }
.pulse-icon{
    width:40px; height:40px; border-radius: var(--radius-xl);
    display:flex; align-items:center; justify-content:center;
    flex-shrink:0;
}
.pulse-icon-error{ background-color: rgba(186,26,26,0.1); color: var(--error); }
.pulse-icon-info{ background-color: rgba(37,99,235,0.1); color: var(--info); }
.pulse-footer{
    padding:1rem; background-color: rgba(242,244,246,0.5); text-align:center;
}
.live-dot{
    display:inline-flex; height:8px; width:8px; position:relative;
}
.live-dot-ping{
    position:absolute; inset:0; border-radius:50%;
    background-color: var(--error); opacity:.75;
    animation: ping 1.5s cubic-bezier(0,0,0.2,1) infinite;
}
.live-dot-core{
    position:relative; border-radius:50%; height:8px; width:8px;
    background-color: var(--error);
}
@keyframes ping{
    75%,100%{ transform: scale(2); opacity:0; }
}

.terminal-promo{
    position:relative; border-radius: var(--radius-2xl); overflow:hidden;
    aspect-ratio: 4/3; cursor:pointer;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    border:1px solid rgba(189,202,186,0.3);
}
.terminal-promo-bg{
    position:absolute; inset:0; background-size:cover; background-position:center;
    transition: transform .7s ease;
}
.terminal-promo:hover .terminal-promo-bg{ transform: scale(1.1); }
.terminal-promo-overlay{
    position:absolute; inset:0;
    background: linear-gradient(to top, var(--primary), rgba(0,107,44,0.4), transparent);
}
.terminal-promo-content{
    position:absolute; inset:0; padding:1.5rem;
    display:flex; flex-direction:column; justify-content:flex-end;
    color:#fff;
}

.terminal-promo-content p {
    color:#fff;
}

.btn-upgrade{
    display:inline-flex; align-items:center; gap:.5rem;
    background:#fff; color: var(--primary);
    padding:8px 16px; border-radius: var(--radius-lg);
    font-size:12px; font-weight:700; width:fit-content;
    transition: background-color .15s ease;
    text-decoration:none;
}
.btn-upgrade:hover{ background-color: var(--primary-fixed); color: var(--primary); }

.price-unavailable-message {
    display: flex;
    align-items: center;
    gap: 18px;
    width: 100%;
    padding: 22px 24px;
    margin: 20px 0;
    background: #ffffff;
    border: 1px solid #e8ebef;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(15, 23, 42, 0.05);
    position: relative;
    overflow: hidden;
}

/* Subtle left accent */
.price-unavailable-message::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #f0a500;
}

/* Icon */
.price-unavailable-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 12px;
    background: #fff7e6;
    color: #d98a00;

    font-size: 20px;
}

/* Content */
.price-unavailable-message h5 {
    margin: 0 0 5px;

    font-size: 16px;
    font-weight: 600;
    line-height: 1.4;

    color: #1f2937;
}

.price-unavailable-message p {
    margin: 0;

    font-size: 14px;
    font-weight: 400;
    line-height: 1.6;

    color: #6b7280;
}

/* Hover */
.price-unavailable-message {
    transition:
            transform 0.2s ease,
            box-shadow 0.2s ease,
            border-color 0.2s ease;
}

.price-unavailable-message:hover {
    transform: translateY(-1px);
    border-color: #dde2e8;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
}

/* Mobile */
@media (max-width: 576px) {
    .price-unavailable-message {
        gap: 14px;
        padding: 18px;
        border-radius: 12px;
    }

    .price-unavailable-icon {
        width: 42px;
        height: 42px;
        min-width: 42px;
        font-size: 18px;
    }

    .price-unavailable-message h5 {
        font-size: 15px;
    }

    .price-unavailable-message p {
        font-size: 13px;
    }
}


.pine-page-header {
    position: relative;
    width: 100%;
    margin-bottom: 18px;
    padding: clamp(24px, 4vw, 25px);
    overflow: hidden;
    border: 1px solid var(--border-color);

    background:
            radial-gradient(circle at 90% 10%, rgba(228,208,10,.13), transparent 32%),
            linear-gradient(135deg, #ffffff 0%, #f7f9fb 100%);
}

.pine-page-header::after {
    content: "";
    position: absolute;
    right: -80px;
    bottom: -100px;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(0,107,44,.035);
    pointer-events: none;
}

.pine-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 22px;
    color: var(--primary);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .15em;
}

.pine-eyebrow .material-symbols-outlined {
    font-size: 17px;
}

.pine-header-row {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
}

.pine-header-copy {
    max-width: 720px;
}

.pine-header-copy h1 {
    margin: 0;
    color: var(--on-surface);
    font-family: var(--font-headline);
    font-size: clamp(32px, 5vw, 58px);
    font-weight: 800;
    line-height: .98;
    letter-spacing: -.045em;
}

.pine-header-copy h1 span {
    display: block;
    color: var(--primary);
}

.pine-header-copy p {
    max-width: 610px;
    margin: 18px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
}

.pine-header-status {
    flex: 0 0 auto;
    min-width: 180px;
    padding: 18px;
    border: 1px solid rgba(189,202,186,.55);
    background: rgba(255,255,255,.72);
    backdrop-filter: blur(8px);
}

.pine-live-indicator {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 10px;
    color: var(--primary);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.pine-live-indicator span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(22,163,74,.12);
}

.pine-header-status strong {
    display: block;
    color: var(--on-surface);
    font-family: var(--font-headline);
    font-size: 18px;
}

.pine-header-status small {
    display: block;
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 10px;
}

/* ============================================================
   RESPONSIVE — TABLET (≤ 991.98px)
   ============================================================ */
@media (max-width: 991.98px) {
    .pine-header-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .pine-header-status {
        width: 100%;
        min-width: 0;
    }
}

/* ============================================================
   RESPONSIVE — MOBILE (≤ 767.98px)
   ============================================================ */
@media (max-width: 767.98px) {
    .pine-page-header {
        padding: 25px 20px;
        border-radius: var(--radius-xl);
    }

    .pine-header-copy h1 {
        font-size: clamp(31px, 10vw, 44px);
    }

    .pine-header-copy p {
        font-size: 13px;
    }
}

/* ============================================================
   RESPONSIVE — SMALL PHONES (≤ 575.98px)
   ============================================================ */
@media (max-width: 575.98px) {
    .pine-page-header {
        margin-left: -1px;
        margin-right: -1px;
    }

    .pine-eyebrow {
        margin-bottom: 17px;
    }

    .pine-header-status {
        padding: 14px;
    }
}

/* ============================================================
   RESPONSIVE — EXTRA SMALL (≤ 359.98px, down to 320px)
   ============================================================ */
@media (max-width: 359.98px) {
    .pine-page-header {
        padding: 21px 15px;
    }

    .pine-header-copy h1 {
        font-size: 30px;
    }
}


/* ============================================================
PINE FILTER CARD
============================================================ */

.pine-filter-card {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border-color);
    background: var(--surface);
}

.pine-filter-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1 1 260px;   /* width hint — only meaningful in row mode */
}

.pine-filter-icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-lg);
    background: rgba(0,107,44,.07);
    color: var(--primary);
}

.pine-filter-text {
    min-width: 0;
}

.pine-filter-label {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .13em;
}

.pine-filter-text strong {
    display: block;
    margin-top: 2px;
    font-size: 16px;
}

.pine-filter-text small {
    display: block;
    margin-top: 2px;
    color: var(--text-secondary);
    font-size: 12px;
}

.pine-date-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 260px;   /* width hint — only meaningful in row mode */
}

.pine-date-form input {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;

    min-height: 44px;
    padding: 10px 12px;
    line-height: 1.4;

    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);

    background: var(--surface-container-low);
    color: var(--on-surface);

    font-family: var(--font-body);
    font-size: 14px;

    outline: none;
}

.pine-date-form input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0,107,44,.08);
}

.pine-date-form input::-webkit-calendar-picker-indicator {
    padding: 4px;
    margin-left: 6px;
    cursor: pointer;
}

.pine-date-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 0 0 auto;
    box-sizing: border-box;

    min-height: 44px;
    padding: 10px 17px;

    border: 0;
    border-radius: var(--radius-lg);

    background: var(--primary);
    color: #fff;

    font-size: 12px;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;

    transition: .18s ease;
}

.pine-date-form button:hover {
    background: var(--primary-container);
    transform: translateY(-1px);
}

.pine-date-form button .material-symbols-outlined {
    font-size: 16px;
}

/* ============================================================
   PINE NOTICE
   ============================================================ */

.pine-notice {
    width: 100%;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 30px;
    padding: 13px 15px;
    border: 1px solid rgba(245,158,11,.22);
    border-radius: var(--radius-xl);
    background: rgba(245,158,11,.055);
}

.pine-notice-icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(245,158,11,.12);
    color: var(--warning-700);
}

.pine-notice-icon .material-symbols-outlined {
    font-size: 17px;
}

.pine-notice-text {
    min-width: 0;
}

.pine-notice-text strong {
    display: block;
    color: var(--on-surface);
    font-size: 12px;
}

.pine-notice-text p {
    margin: 3px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.5;
}

/* ============================================================
   RESPONSIVE — TABLET (≤ 991.98px)
   ============================================================ */
@media (max-width: 991.98px) {
    /* card itself keeps flex-wrap from the base rule, which
       already gives it breathing room in this range */
}

/* ============================================================
   RESPONSIVE — MOBILE (≤ 767.98px)
   ============================================================ */
@media (max-width: 767.98px) {
    .pine-filter-card {
        align-items: stretch;
        flex-direction: column;
    }

    /* reset the row-mode width basis so it doesn't get
       reinterpreted as a min-height once stacked */
    .pine-filter-info,
    .pine-date-form {
        flex: 1 1 auto;
        width: 100%;
    }
}

/* ============================================================
   RESPONSIVE — SMALL PHONES (≤ 575.98px)
   ============================================================ */
@media (max-width: 575.98px) {
    .pine-filter-card {
        padding: 13px;
    }

    .pine-filter-text small {
        display: none;
    }

    .pine-date-form {
        align-items: stretch;
        flex-direction: column;
    }

    .pine-date-form input,
    .pine-date-form button {
        width: 100%;
        min-height: 46px;
    }

    .pine-notice {
        padding: 12px;
    }
}

/* ============================================================
   RESPONSIVE — EXTRA SMALL (≤ 359.98px, down to 320px)
   ============================================================ */
@media (max-width: 359.98px) {
    .pine-filter-card {
        padding: 12px;
    }

    .pine-date-form input,
    .pine-date-form button {
        min-height: 44px;
        font-size: 13px;
    }
}

:root {
    --phi-green: #198754;
    --phi-yellow: #eab308;
}

.phi-legend {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 14px;
}

.phi-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--on-surface, #0f172a);
}

.phi-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    display: inline-block;
}

.phi-dot-green {
    background: var(--phi-green);
}

.phi-dot-yellow {
    background: var(--phi-yellow);
}

/*
 * The old static design used a fixed-height, overflow-hidden chart-wrap
 * to clip the fake bars at exactly 100%. That clips a real line chart's
 * peaks, so it's overridden here for this line-graph version.
 */
.chart-wrap {
    position: relative !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    padding-top: 12px;
}

#pineapple-history-chart {
    width: 100%;
    min-height: 280px;
    overflow: visible;
}

#pineapple-history-chart .apexcharts-svg {
    overflow: visible !important;
}

.phi-loading {
    position: absolute;
    inset: 0;
    z-index: 10;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;

    background: rgba(255, 255, 255, 0.88);
    border-radius: 10px;

    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.phi-loading.visible {
    opacity: 1;
    pointer-events: all;
}

.phi-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--outline, #e5e7eb);
    border-top-color: var(--phi-green);
    border-radius: 50%;
    animation: phi-spin 0.8s linear infinite;
}

.phi-loading p {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--on-surface-variant, #64748b);
}

.phi-error {
    display: none;
    margin-top: 14px;
    padding: 12px 15px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #b91c1c;
    font-size: 13px;
}

.phi-error.visible {
    display: block;
}

.timeframe-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

@media (prefers-reduced-motion: reduce) {
    .phi-loading,
    .phi-spinner {
        animation: none !important;
        transition: none !important;
    }
}

/* ============================================================
   PINEAPPLE — SAFE MOBILE / IOS FIXES
   These overrides preserve the existing design and only fix:
   1. mobile date input width
   2. unwanted horizontal overflow
   3. chart container sizing on small screens
   ============================================================ */

/* Prevent box-model expansion for this page's main components. */
.pine-page-header,
.pine-filter-card,
.pine-filter-info,
.pine-date-form,
.pine-notice,
.section-card,
.chart-wrap,
#pineapple-history-chart {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
}

/* Keep form controls inside their flex/grid parent. */
.pine-date-form input,
.pine-date-form button,
.form-control-custom,
.btn-view-price {
    box-sizing: border-box;
    max-width: 100%;
}

/* The -1px mobile margins were making the header wider than its parent. */
@media (max-width: 575.98px) {
    .pine-page-header {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    .pine-filter-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .pine-date-form {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        flex: none;
        box-sizing: border-box;
    }

    .pine-date-form input,
    .pine-date-form button {
        display: block;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
        flex: none;
    }
}

/* Bootstrap/flex columns must be allowed to shrink on narrow Safari viewports. */
.row > *,
.row > .col,
.row > [class*="col-"] {
    min-width: 0;
}

/* Give ApexCharts a stable containing block without changing its existing
   series/options/JavaScript. */
.chart-wrap {
    position: relative !important;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

#pineapple-history-chart {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

@media (max-width: 575.98px) {
    .chart-wrap {
        height: 300px !important;
        max-width: 100%;
        overflow: hidden !important;
    }

    #pineapple-history-chart {
        width: 100%;
        max-width: 100%;
        height: 100%;
        min-height: 0;
        overflow: hidden;
    }

    #pineapple-history-chart .apexcharts-canvas {
        max-width: 100% !important;
    }
}

@media (max-width: 359.98px) {
    .chart-wrap {
        height: 280px !important;
    }
}


/* ============================================================
   MARKETNIRO PINEAPPLE - SAFARI / IOS FINAL LAYOUT OVERRIDES
   Added after the existing rules intentionally.
   ============================================================ */

/* Global page-width safety for this page */
.pine-page-header,
.pine-filter-card,
.pine-notice,
.section-card,
.price-card,
.chart-wrap,
#pineapple-history-chart {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
}

/* Keep Bootstrap/flex children from using intrinsic widths */
.pine-page-header *,
.pine-filter-card *,
.pine-notice *,
.section-card *,
.chart-wrap *,
#pineapple-history-chart * {
    box-sizing: border-box;
    min-width: 0;
}

/* Header: never extend the viewport on small iPhones */
.pine-page-header {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
}

/* Date filter card */
.pine-filter-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.pine-filter-info {
    min-width: 0;
    max-width: 100%;
}

.pine-filter-text {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.pine-date-form {
    min-width: 0;
    max-width: 100%;
    width: 100%;
}

.pine-date-form input[type="date"],
.pine-date-form input[type="text"],
.pine-date-form input {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    box-sizing: border-box;
    -webkit-appearance: none;
    appearance: none;
}

/* Restore the native date control affordance without allowing
   the Safari date field to determine the element width */
.pine-date-form input[type="date"] {
    -webkit-appearance: none;
    appearance: none;
    min-inline-size: 0;
}

.pine-date-form input[type="date"]::-webkit-date-and-time-value {
    text-align: left;
    min-width: 0;
}

.pine-date-form input[type="date"]::-webkit-calendar-picker-indicator {
    width: 18px;
    height: 18px;
    padding: 0;
    margin: 0 0 0 6px;
    flex: 0 0 auto;
}

/* Button cannot create a second intrinsic-width problem */
.pine-date-form button {
    box-sizing: border-box;
    max-width: 100%;
    min-width: 0;
}

/* Chart card and chart wrapper */
.section-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.chart-wrap {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 320px !important;
    max-height: 320px !important;
    min-height: 320px !important;
    padding: 12px 0 0 !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

#pineapple-history-chart {
    position: relative;
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 308px !important;
    min-height: 0 !important;
    max-height: 308px !important;
    margin: 0;
    padding: 0;
    overflow: hidden !important;
    box-sizing: border-box !important;
}

#pineapple-history-chart .apexcharts-canvas {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 100% !important;
    margin: 0 auto;
}

#pineapple-history-chart .apexcharts-svg {
    max-width: 100% !important;
}

/* Loading layer stays inside the chart */
.chart-wrap > .phi-loading {
    position: absolute;
    top: 12px;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* Error message also stays inside its parent */
.phi-error {
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: anywhere;
}

/* Prevent tables/content from making the page wider */
.table-custom {
    max-width: 100%;
}

.table-custom th,
.table-custom td {
    max-width: 0;
}

/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 767.98px) {

    .pine-page-header {
        width: 100%;
        max-width: 100%;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding-left: 20px;
        padding-right: 20px;
    }

    .pine-header-row,
    .pine-header-copy,
    .pine-header-status {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .pine-filter-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        padding-left: 13px;
        padding-right: 13px;
    }

    .pine-filter-info,
    .pine-date-form {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        flex: none !important;
    }

    .pine-date-form {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 25px;
    }

    .pine-date-form input,
    .pine-date-form input[type="date"],
    .pine-date-form button {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        flex: none !important;
    }

    .chart-wrap {
        width: 100% !important;
        max-width: 100% !important;
        height: 300px !important;
        min-height: 300px !important;
        max-height: 300px !important;
    }

    #pineapple-history-chart {
        width: 100% !important;
        max-width: 100% !important;
        height: 288px !important;
        min-height: 288px !important;
        max-height: 288px !important;
    }
}

/* ============================================================
   SMALL IPHONES
   ============================================================ */

@media (max-width: 575.98px) {

    .pine-page-header {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .pine-filter-card {
        width: 100% !important;
        max-width: 100% !important;
        padding: 13px !important;
    }

    .pine-date-form {
        width: 100% !important;
        max-width: 100% !important;
        gap: 25px;
    }

    .pine-date-form input[type="date"] {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        height: 46px;
        min-height: 46px;
        padding-left: 12px;
        padding-right: 12px;
    }

    .pine-date-form button {
        width: 100% !important;
        max-width: 100% !important;
        height: 46px;
        min-height: 46px;
    }

    .chart-wrap {
        width: 100% !important;
        max-width: 100% !important;
        height: 280px !important;
        min-height: 280px !important;
        max-height: 280px !important;
        padding-top: 8px !important;
    }

    #pineapple-history-chart {
        width: 100% !important;
        max-width: 100% !important;
        height: 272px !important;
        min-height: 272px !important;
        max-height: 272px !important;
    }
}

/* ============================================================
   EXTRA SMALL IPHONES
   ============================================================ */

@media (max-width: 359.98px) {

    .pine-page-header {
        padding-left: 15px !important;
        padding-right: 15px !important;
    }

    .pine-filter-card {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .pine-date-form input[type="date"],
    .pine-date-form button {
        min-height: 44px;
        height: 44px;
        font-size: 13px;
    }

    .chart-wrap {
        height: 260px !important;
        min-height: 260px !important;
        max-height: 260px !important;
    }

    #pineapple-history-chart {
        height: 252px !important;
        min-height: 252px !important;
        max-height: 252px !important;
    }
}


/* ============================================================
   PINEAPPLE CHART - VISIBILITY FIX
   Keep the chart inside the page width, but DO NOT clip the
   ApexCharts plot vertically.
   ============================================================ */

.section-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: visible !important;
}

.chart-wrap {
    position: relative !important;
    display: block !important;

    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;

    height: 360px !important;
    min-height: 360px !important;
    max-height: none !important;

    padding: 12px 0 24px !important;
    box-sizing: border-box !important;

    /* Important: ApexCharts must not be vertically clipped */
    overflow: visible !important;
}

#pineapple-history-chart {
    position: relative !important;
    display: block !important;

    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;

    height: 324px !important;
    min-height: 324px !important;
    max-height: none !important;

    margin: 0 !important;
    padding: 0 !important;

    box-sizing: border-box !important;

    /* Allow the ApexCharts SVG/labels to remain visible */
    overflow: visible !important;
}

#pineapple-history-chart .apexcharts-canvas {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 100% !important;
}

#pineapple-history-chart .apexcharts-svg {
    max-width: 100% !important;
    overflow: visible !important;
}

/* Never let the chart create horizontal page overflow */
#pineapple-history-chart .apexcharts-inner,
#pineapple-history-chart .apexcharts-grid,
#pineapple-history-chart .apexcharts-xaxis,
#pineapple-history-chart .apexcharts-yaxis {
    max-width: 100%;
}

/* Keep loading overlay contained without clipping the chart */
.chart-wrap > .phi-loading {
    position: absolute;
    top: 12px;
    right: 0;
    bottom: 24px;
    left: 0;

    width: 100%;
    max-width: 100%;

    box-sizing: border-box;
}

/* Mobile chart */
@media (max-width: 767.98px) {

    .chart-wrap {
        height: 340px !important;
        min-height: 340px !important;
        max-height: none !important;
        padding: 8px 0 24px !important;
        overflow: visible !important;
    }

    #pineapple-history-chart {
        height: 308px !important;
        min-height: 308px !important;
        max-height: none !important;
        overflow: visible !important;
    }
}

/* Small iPhones */
@media (max-width: 575.98px) {

    .chart-wrap {
        height: 330px !important;
        min-height: 330px !important;
        max-height: none !important;
        padding: 8px 0 24px !important;
        overflow: visible !important;
    }

    #pineapple-history-chart {
        height: 298px !important;
        min-height: 298px !important;
        max-height: none !important;
        overflow: visible !important;
    }
}

/* Extra-small phones */
@media (max-width: 359.98px) {

    .chart-wrap {
        height: 310px !important;
        min-height: 310px !important;
    }

    #pineapple-history-chart {
        height: 278px !important;
        min-height: 278px !important;
    }
}