﻿
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #ebebeb;
}

/* =========================================
               CONTAINER
           ========================================= */
.container {
    width: 100%;
    max-width: 1200px;
    min-height: 97dvh;
    margin: 0 auto;
    background: white;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    margin-top: 8px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* =========================================
               HEADER
         ========================================= */
.header {
    background: linear-gradient(90deg, #1e3c72 0%, #2a5298 100%);
    color: #fff;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: -7px;
}

.header-logo img {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #ffffff;
    padding: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.header-title {
    display: flex;
    flex-direction: column;
    margin-right: auto;
}

    .header-title h1 {
        font-size: clamp(15px, 4.2vw, 18px);
        font-weight: 600;
        margin: 0;
        letter-spacing: 0.4px;
    }

    .header-title .tagline {
        font-size: clamp(10px, 2.8vw, 12px);
        color: #cfd8dc;
        letter-spacing: 0.3px;
    }

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =========================================
           ADD ACTION MENU
        ========================================= */
.add-action-menu {
    position: relative;
    display: inline-flex;
}

.btn-main-add {
    height: 36px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

    .btn-main-add:hover {
        background: #1d4ed8;
        box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
    }

    .btn-main-add .material-symbols-outlined {
        font-size: 18px;
        line-height: 1;
    }

.add-action-options {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 150px;
    padding: 6px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all 0.18s ease;
}

.add-action-menu.open .add-action-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.add-action-options .btn-AddNew,
.add-action-options .btn-Paid {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 6px;
    font-size: 13px;
    color: #374151;
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

    .add-action-options .btn-AddNew:hover,
    .add-action-options .btn-Paid:hover {
        background: #f3f4f6;
        color: #111827;
    }

.add-action-options .material-symbols-outlined {
    font-size: 18px;
    color: #6b7280;
}

/* =========================================
   MORE MENU
========================================= */
.more-menu {
    position: relative;
    display: inline-flex;
}

.btn-more {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    transition: background 0.2s ease;
}

    .btn-more:hover {
        background: rgba(255, 255, 255, 0.22);
    }

    .btn-more .material-symbols-outlined {
        font-size: 22px;
    }

.more-menu-options {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    padding: 6px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.18s ease;
}

.more-menu.open .more-menu-options {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.more-item {
    width: 100%;
    height: 42px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-radius: 7px;
    font-size: 13.5px;
    color: #374151;
    text-decoration: none;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

    .more-item:hover {
        background: #f3f4f6;
        color: #111827;
    }

    .more-item .material-symbols-outlined {
        font-size: 20px;
        color: #6b7280;
    }

.language-item {
    cursor: default;
}

.language-select {
    margin-left: auto;
    height: 28px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    padding: 0 8px;
    font-size: 13px;
    background: #f9fafb;
    outline: none;
    cursor: pointer;
}

/* =========================================
                 CONTENT
   ========================================= */
.content {
    flex: 1 1 auto;
    min-width: 0;
    width: 100%;
    padding: clamp(4px, 1vh, 8px) clamp(8px, 1.5vw, 16px);
    box-sizing: border-box;
    position: relative;
}

@media (max-width: 480px) {
    .content {
        padding-left: 8px;
        padding-right: 8px;
    }
}

/* =========================================
           FILTERS ROW
        ========================================= */
.filters-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
    width: 100%;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Combined Search */
.combined-search {
    display: flex;
    align-items: stretch;
    height: 36px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    overflow: hidden;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

    .combined-search:focus-within {
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
    }

.search-type-select {
    height: 100%;
    border: none;
    border-right: 1px solid #e5e7eb;
    padding: 0 28px 0 10px;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    background-color: #f8fafc;
    cursor: pointer;
    outline: none;
    width: 90px;
    min-width: 90px;
    appearance: none;
    -webkit-appearance: none;
    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' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
}

    .search-type-select:hover {
        background-color: #f1f5f9;
    }

.combined-search-right {
    flex: 1;
    position: relative;
    display: flex;
    height: 100%;
    min-width: 0;
}

.combined-search .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #9ca3af;
    pointer-events: none;
    z-index: 2;
}

.combined-search-right input,
.combined-search-right select {
    width: 100% !important;
    height: 100% !important;
    border: none !important;
    border-radius: 0 !important;
    padding: 0 12px 0 34px !important;
    font-size: 13px !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

    .combined-search-right input[type="date"] {
        padding-left: 34px !important;
    }

.btn-clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: clamp(36px, 3.5vw, 36px);
    padding: 0 clamp(6px, 1.2vw, 10px);
    flex-shrink: 1;
    min-width: 0;
    background: rgba(0, 0, 0, 0.08);
    color: #374151;
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid #ced4da;
    cursor: pointer;
    box-sizing: border-box;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

    .btn-clear img {
        width: clamp(18px, 2vw, 20px) !important;
        height: clamp(18px, 2vw, 20px) !important;
        object-fit: contain;
        flex-shrink: 0;
    }


    .btn-clear:hover {
        background: rgba(0, 0, 0, 0.14);
        border-color: #adb5bd;
    }

    .btn-clear:active {
        transform: scale(0.96);
    }


.filter-group.btn-group-align {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    /* Flex-shrink & Min-width to prevent layout break */
    flex-shrink: 0; /* Switch core layout ko compress hone se rokne ke liye pehle flex-shrink manage karta hai */
    min-width: 0;
}

.switch {
    --_switch-bg-clr: #70a9c5;
    --_switch-padding: 3px;
    --_slider-bg-clr: rgba(12, 74, 110, 0.65);
    --_slider-bg-clr-on: rgba(12, 74, 110, 1);
    /* Dynamic Padding & Font Size */
    --_label-padding: clamp(3px, 0.8vw, 5px) clamp(6px, 1.2vw, 10px);
    --_switch-easing: cubic-bezier(0.47, 1.64, 0.41, 0.8);
    color: white;
    width: fit-content;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    position: relative;
    isolation: isolate;
    border-radius: 5px;
    cursor: pointer;
    /* Responsive Fluid Font & Height */
    font-size: clamp(10.5px, 1.1vw, 12px); /* Default 12px, Space kam par 10.5px tak shrink */
    height: clamp(36px, 3vw, 32px); /* Default 32px, Small screen par 28px tak shrink */

    user-select: none;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
}

    .switch input[type="checkbox"] {
        position: absolute;
        width: 1px;
        height: 1px;
        padding: 0;
        margin: -1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
        border-width: 0;
    }

    .switch > span {
        display: grid;
        place-content: center;
        transition: opacity 300ms ease-in-out 150ms;
        padding: var(--_label-padding);
        white-space: nowrap; /* Text ko 2 lines me jaane se rokta hai */
    }

    .switch::before,
    .switch::after {
        content: "";
        position: absolute;
        border-radius: inherit;
        transition: inset 150ms ease-in-out;
    }

    .switch::before {
        background-color: var(--_slider-bg-clr);
        inset: var(--_switch-padding) 50% var(--_switch-padding) var(--_switch-padding);
        transition: inset 500ms var(--_switch-easing), background-color 500ms ease-in-out;
        z-index: -1;
        box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.3), 0 1px rgba(255, 255, 255, 0.3);
    }

    .switch::after {
        background-color: var(--_switch-bg-clr);
        inset: 0;
        z-index: -2;
    }

    .switch:has(input:checked)::before {
        background-color: var(--_slider-bg-clr-on);
        inset: var(--_switch-padding) var(--_switch-padding) var(--_switch-padding) 50%;
    }

    .switch > span:last-of-type,
    .switch > input:checked + span:first-of-type {
        opacity: 0.7;
    }

    .switch > input:checked ~ span:last-of-type {
        opacity: 1;
    }

    /* Touch devices visual feedback */
    .switch:active::before {
        filter: brightness(1.1);
    }

/* =========================================
   UTILITY
========================================= */
.hidden {
    display: none;
}

.highlight-text {
    font-weight: 600;
    color: black;
    padding: 0 1px;
    background: yellow;
}

.filter-active {
    border: 2px solid #facc15 !important;
    box-shadow: 0 0 5px rgba(250, 204, 21, 0.4) !important;
    background-color: #fef9c3 !important;
    transition: all 0.3s ease;
}

    .filter-active:hover {
        box-shadow: 0 0 8px rgba(250, 204, 21, 0.6) !important;
    }

/* =========================================
   TABLET & UP (min-width: 600px)
========================================= */
@media (min-width: 600px) {


    .header {
        padding: 12px 18px;
        position: relative;
    }

    .combined-search {
        width: 245px;
        max-width: 245px;
    }

    .filters-row {
        flex-wrap: nowrap;
        gap: 12px;
    }
}

/* =========================================
            DESKTOP (min-width: 900px)
          ========================================= */
@media (min-width: 900px) {

    .combined-search {
        width: 245px;
    }

    .header-title h1 {
        font-size: 18px;
    }

    .header-title .tagline {
        font-size: 12px;
    }
}

/*-------------------------Table Grid -----------------------------*/
.grid-section {
    background: #ffffff;
    border-radius: 2px 2px 4px 4px;
    border: 1px solid #d1d5db;
    overflow: hidden;
    margin: 0px;
    height: 352px;
    animation: fadeInSmooth 0.5s ease-in-out;
    margin-bottom: 5px;
}
/* ============================================ */
/* ===== GROCERY TITLE ===== *
        /* ============================================ */

.sort-controls h3 {
    margin: 0;
    font-size: clamp(16px, 2.2vw, 22px);
    font-weight: 600;
    color: #374151;
    letter-spacing: 0.015em;
    font-variant-caps: small-caps;
    animation: fadeInSmooth 0.5s ease-in-out;
    display: flex;
    align-items: center;
    gap: 8px;
}

.grocery-title .gi {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(36px, 4vw, 44px);
    height: clamp(32px, 3.5vw, 40px);
    border-radius: 6px;
    background: #ffffff;
}

    .grocery-title .gi img {
        width: clamp(26px, 3vw, 34px);
        height: clamp(26px, 3vw, 34px);
        object-fit: contain;
    }

/* ============================================ */
/* ===== SORT CONTROLS ===== */
/* ============================================ */
.sort-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(6px, 1vw, 6px) clamp(10px, 1.5vw, 8px);
    background: linear-gradient(112deg, #e1a02cab 0%, #f6ba5b4d 100%);
    border-bottom: 1px solid #d1d5db;
    flex-wrap: nowrap;
    gap: 8px;
}



.sort-wrapper {
    display: flex;
    align-items: center;
    gap: clamp(6px, 1vw, 10px);
    flex-wrap: wrap;
}

.sort-label {
    font-size: clamp(11px, 1.1vw, 13px);
    font-weight: 500;
    color: #64748b;
}

.sort-dropdown {
    padding: clamp(4px, 0.6vw, 8px) clamp(8px, 1vw, 14px);
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: #ffffff;
    font-size: clamp(11px, 1.1vw, 13px);
    color: #374151;
    min-width: clamp(100px, 12vw, 140px);
    transition: all 0.2s ease;
    cursor: pointer;
}

    .sort-dropdown:hover {
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }

    .sort-dropdown:focus {
        outline: none;
        border-color: #3b82f6;
        box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }

/* ============================================ */
/* ===== LIST CONTAINERS & WRAPPERS ===== */
/* ============================================ */
.Grocery-list,
.Payment-list {
    flex: 1;
    padding: 0;
    background: #ffffff;
}

.table-body-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    width: 100%;
    max-height: clamp(310px, 28vh, 310px);
    -webkit-overflow-scrolling: touch;
}

/* ============================================ */
/* ===== TABLE LAYOUT ENGINE ===== */
/* ============================================ */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: clamp(11px, 1.1vw, 13px);
    background: #ffffff;
    border-bottom: 2px solid #d1d5db;
    /* FIX 1: Auto table layout so content drives minimum width smoothly */
    table-layout: auto;
    min-width: 680px; /* Force minimum table width to preserve horizontal layout */
}

    .table thead {
        position: sticky;
        border: hidden;
        top: 0;
        z-index: 10;
        background: #f8fafc;
    }

    .table th {
        padding: 8px 10px;
        background: #e2e8f0;
        text-align: left;
        color: #174a67;
        font-size: clamp(10px, 1vw, 11px);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
        border: 1px solid #cbd5e1;
        /* FIX 2: Text breaks vertically strictly disabled */
        white-space: nowrap;
    }

    .table tbody tr {
        border-bottom: 1px solid #e2e8f0;
        transition: background-color 0.15s ease;
    }

        .table tbody tr:hover {
            background: #f8fafc;
        }

    .table td {
        padding: 6px 10px;
        color: #374151;
        vertical-align: middle;
        font-weight: 400;
        line-height: 1.3;
        border: 1px solid #e2e8f0;
        /* FIX 3: Horizontal lock — Vertical letters flow prevent kar diya */
        white-space: nowrap;
        word-break: normal;
        overflow: hidden;
        text-overflow: ellipsis;
    }

        /* ===== OPTIMIZED COLUMN MIN-WIDTHS ===== */
        /* Sr. No */
        .table th:nth-child(1), .table td:nth-child(1) {
            width: 45px;
            min-width: 45px;
            text-align: center;
        }

        /* GR-Code & Dates */
        .table th:nth-child(2), .table td:nth-child(2) {
            min-width: 85px;
        }

        .table th:nth-child(3), .table td:nth-child(3) {
            min-width: 85px;
        }

        /* Issued By & Received By */
        .table th:nth-child(4), .table td:nth-child(4) {
            min-width: 100px;
        }

        .table th:nth-child(5), .table td:nth-child(5) {
            min-width: 100px;
        }

        /* Amount / Purchase */
        .table th:nth-child(6), .table td:nth-child(6) {
            min-width: 90px;
        }

        /* Actions (Dynamic Space for 5 Action Buttons) */
        .table th:nth-child(7), .table td:nth-child(7) {
            min-width: 240px;
            white-space: nowrap;
        }

        /* Specific Formatting Rules */
        .table td:first-child {
            font-weight: 600;
            color: #6b7280;
        }

        .table td:nth-child(2) {
            font-family: monospace;
            font-weight: 600;
            color: #2563eb;
        }

        .table td:nth-child(6) span {
            font-weight: 700;
            color: #059669;
            font-size: 12px;
            background: #ecfdf5;
            padding: 2px 8px;
            border-radius: 4px;
            border: 1px solid #a7f3d0;
            display: inline-block;
        }

        /* ============================================ */
        /* ===== ACTION BUTTONS HORIZONTAL FLOW ===== */
        /* ============================================ */
        /* Parent TD alignment fix */
        .table td:last-child {
            display: table-cell;
            vertical-align: middle;
        }

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 6px;
    margin: 1px 2px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    border: 1px solid transparent;
    /* Buttons line breakpoint prevention */
    white-space: nowrap;
    flex-shrink: 0;
}

.icon-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap; /* Icon aur Text toota nahi chahiye */
}

    .icon-wrapper i {
        font-size: 12px;
    }

.icon-text {
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

/* Color variations */
.action-btn:hover {
    transform: translateY(-1px);
}

.action-btn:nth-of-type(1) {
    background: #eff6ff;
    color: #2563eb;
    border-color: #bfdbfe;
}

.action-btn:nth-of-type(2) {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #bbf7d0;
}

.action-btn:nth-of-type(3) {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fecaca;
}

.action-btn:nth-of-type(4) {
    background: #e8f5e9;
    color: #25d366;
    border-color: #a5d6a7;
}

.action-btn:nth-of-type(5) {
    background: #f3f4f6;
    color: #4b5563;
    border-color: #d1d5db;
}
/* ============================================ */
/* ===== FOOTER ===== */
/* ============================================ */

.containerFooter {
}

.footer-card {
    background: #f8fafc;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    overflow: hidden;
    border-radius: 2px 2px 4px 4px;
    border: 1px solid #d1d5db;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: clamp(8px, 1vw, 12px) clamp(12px, 1.5vw, 20px);
    gap: clamp(10px, 1.5vw, 16px);
    flex-wrap: wrap;
    margin-left: 5px;
    margin-right: 5px;
}

/* ===== TOTALS SECTION ===== */
.totals-section {
    display: flex;
    align-items: center;
    gap: clamp(12px, 2vw, 38px);
    flex: 1;
    flex-wrap: wrap;
    justify-content: center;
}

.total-item {
    display: flex;
    align-items: center;
    gap: clamp(4px, 0.6vw, 8px);
    padding: clamp(4px, 0.5vw, 8px) clamp(6px, 0.8vw, 12px);
    background: #f8fafc;
    border-radius: 6px;
    border-left: 3px solid transparent;
    transition: all 0.2s ease;
    flex: 1 1 auto;
    min-width: clamp(120px, 15vw, 180px);
}

    .total-item:hover {
        background: #f1f5f9;
        transform: translateY(-1px);
    }

.total-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: clamp(28px, 3vw, 36px);
    height: clamp(28px, 3.5vw, 36px);
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
}

    .total-icon .material-symbols-outlined {
        font-size: clamp(20px, 2.5vw, 28px);
        color: #64748b;
    }

.total-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.total-label {
    font-size: clamp(10px, 1vw, 15px);
    font-weight: 500;
    color: #64748bcc;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.total-amount {
    font-size: clamp(16px, 2vw, 22px);
    font-weight: 600;
    line-height: 1;
    font-family: math;
}

/* ===== COLOR VARIANTS ===== */
.purchase-total {
    border-left-color: #10b981;
    box-shadow: 0px 0px 3px 2px #d1d5dba3;
}

    .purchase-total .total-icon {
        background: rgba(16, 185, 129, 0.1);
    }

        .purchase-total .total-icon .material-symbols-outlined {
            color: #10b981;
        }

.purchase-amount {
    color: #10b981;
}

.payment-total {
    border-left-color: #3b82f6;
    box-shadow: 0px 0px 3px 2px #d1d5dba3;
}

    .payment-total .total-icon {
        background: rgba(59, 130, 246, 0.1);
    }

        .payment-total .total-icon .material-symbols-outlined {
            color: #3b82f6;
        }

.payment-amount {
    color: #3b82f6;
}

.remaining-total {
    border-left-color: #f59e0b;
    box-shadow: 0px 0px 3px 2px #d1d5dba3;
}

    .remaining-total .total-icon {
        background: rgba(245, 158, 11, 0.1);
    }

        .remaining-total .total-icon .material-symbols-outlined {
            color: #f59e0b;
        }

.remaining-amount {
    color: #f59e0b;
}

/* ===== ACTIONS SECTION ===== */
.actions-section {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}



@media screen and (max-width: 768px) {


    .sort-wrapper {
        justify-content: center;
    }

    .Grocery-list,
    .Payment-list {
        height: clamp(250px, 55vh, 520px);
        overflow-y: auto;
        height: auto;
        overflow-y: visible;
    }

    .table {
        font-size: 11px;
        min-width: 500px;
    }

        .table th {
            font-size: 9px;
            padding: 5px 8px;
        }

        .table td {
            padding: 4px 6px;
            font-size: 10px;
        }

    /* Hide Issued By & Received By on tablets */
    .Grocery-list .table th:nth-child(4),
    .Grocery-list .table td:nth-child(4),
    .Grocery-list .table th:nth-child(5),
    .Grocery-list .table td:nth-child(5) {
        display: none;
    }

    .table th {
        text-align: left;
        color: #174a67;
        font-size: clamp(10px, 1vw, 11px);
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

        .table th:nth-child(7),
        .table td:nth-child(7) {
            width: auto;
            min-width: 140px;
        }

    .action-btn {
        padding: 3px 3px;
        font-size: 9px;
        min-width: 32px;
    }

    .icon-text {
        font-size: 8px;
    }

    .icon-wrapper i {
        font-size: 10px;
    }

    .footer-content {
        flex-direction: column;
        align-items: stretch;
    }

    .totals-section {
        justify-content: space-around;
        gap: 8px;
    }

    .total-item {
        min-width: 100px;
        flex: 1 1 30%;
    }

    .total-label {
        font-size: 10px;
    }

    .total-amount {
        font-size: 16px;
    }

    .total-icon .material-symbols-outlined {
        font-size: 20px;
    }

    .actions-section {
        justify-content: center;
    }

    .paid-history-btn {
        width: 36px;
    }

        .paid-history-btn:hover {
            width: 110px;
        }

        .paid-history-btn .material-symbols-outlined {
            font-size: 22px;
        }

    .tooltip-slide {
        font-size: 12px;
    }
}

/* === My OnePlus Mobile Phones === */
@media screen and (max-width: 480px) {
    .filter-label {
        font-size: 9px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .filter-control-filter {
        width: 100% !important;
        min-width: 0 !important;
        font-size: 11px !important;
        padding: 5px 4px !important;
        height: 30px;
        box-sizing: border-box;
    }

    #txtFromDate,
    #txtToDate {
        width: 100% !important;
        font-size: 10px !important;
        padding: 5px 2px !important;
    }

    .search-wrapper {
        width: 100%;
    }

    .search-icon {
    }

    span.material-symbols-outlined.search-icon {
        font-size: 14px;
        top: 14px;
    }

    .grid-section {
        border-radius: 4px;
        border: 1px solid #d1d5db;
        overflow: hidden;
        margin: 0;
        height: 506px;
        margin-bottom: 10px;
        animation: fadeInSmooth 0.5s ease-in-out;
    }

    .Grocery-list,
    .Payment-list {
        height: inherit;
        max-height: 446px;
    }

    .table-body-wrapper {
        max-height: fit-content;
    }

    /* ============================================ */
    /* ===== MOBILE TABLE - <= 480px ===== */
    /* ============================================ */

    .Grocery-list,
    .Payment-list {
        overflow-x: hidden;
    }

    .table-body-wrapper {
        overflow-x: hidden;
        overflow-y: auto;
        height: 461px;
    }

    .table {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        table-layout: fixed;
        font-size: 10px;
        box-sizing: border-box;
    }

        .table th {
            font-size: 8px;
            padding: 4px 4px;
            white-space: nowrap;
            box-sizing: border-box;
        }

        .table td {
            padding: 3px 4px;
            font-size: 9px;
            box-sizing: border-box;
            overflow-wrap: anywhere;
        }

    /* ============================================ */
    /* ===== GROCERY - MOBILE COLUMNS ===== */
    /* ============================================ */

    /* SR */
    .Grocery-list .table th:nth-child(1),
    .Grocery-list .table td:nth-child(1) {
        width: 6%;
        min-width: 0;
        text-align: center;
    }

    /* GR-Code - HIDDEN */
    .Grocery-list .table th:nth-child(2),
    .Grocery-list .table td:nth-child(2) {
        display: none;
        text-align: center;
    }

    /* Date */
    .Grocery-list .table th:nth-child(3),
    .Grocery-list .table td:nth-child(3) {
        width: 14%;
        min-width: 0;
        text-align: center;
    }

    /* Issued By - HIDDEN */
    .Grocery-list .table th:nth-child(4),
    .Grocery-list .table td:nth-child(4) {
        display: none;
        text-align: center;
    }

    /* Received By - HIDDEN */
    .Grocery-list .table th:nth-child(5),
    .Grocery-list .table td:nth-child(5) {
        display: none;
        text-align: center;
    }

    /* Purchase */
    .Grocery-list .table th:nth-child(6),
    .Grocery-list .table td:nth-child(6) {
        width: 12%;
        min-width: 0;
        text-align: center;
        text-align: center;
    }

    /* Actions */
    .Grocery-list .table th:nth-child(7),
    .Grocery-list .table td:nth-child(7) {
        width: 45%;
        min-width: 0;
        text-align: center;
    }


    /* ============================================ */
    /* ===== PAYMENT - MOBILE COLUMNS ===== */
    /* ============================================ */

    /* SR */
    .Payment-list .table th:nth-child(1),
    .Payment-list .table td:nth-child(1) {
        width: 10%;
        min-width: 0;
        text-align: center;
    }

    /* DATE */
    .Payment-list .table th:nth-child(2),
    .Payment-list .table td:nth-child(2) {
        width: 20%;
        min-width: 0;
        white-space: nowrap;
        text-align: center;
    }

    /* PAID BY - HIDDEN */
    .Payment-list .table th:nth-child(3),
    .Payment-list .table td:nth-child(3) {
        display: none;
        text-align: center;
    }

    /* PAYMENT MODE - HIDDEN */
    .Payment-list .table th:nth-child(4),
    .Payment-list .table td:nth-child(4) {
        display: none;
        text-align: center;
    }

    /* PAID AMOUNT */
    .Payment-list .table th:nth-child(5),
    .Payment-list .table td:nth-child(5) {
        width: 22%;
        min-width: 0;
        text-align: center;
        white-space: nowrap;
    }

    /* REMARK */
    .Payment-list .table th:nth-child(6),
    .Payment-list .table td:nth-child(6) {
        width: 23%;
        min-width: 0;
        text-align: center;
    }

    /* ACTIONS */
    .Payment-list .table th:nth-child(7),
    .Payment-list .table td:nth-child(7) {
        width: 25%;
        min-width: 0;
        text-align: center;
    }


    /* ============================================ */
    /* ===== MOBILE ACTION BUTTONS ===== */
    /* ============================================ */

    .action-group {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 2px;
        width: 100%;
    }

    .action-btn {
        padding: 2px 4px;
        margin: 0;
        font-size: 8px;
        min-width: 28px;
        max-width: 100%;
        border-radius: 3px;
        box-sizing: border-box;
    }

    .icon-wrapper {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 2px;
        white-space: nowrap;
    }

    .icon-text {
        font-size: 7px;
    }

    .icon-wrapper i {
        font-size: 9px;
    }

    .whatsapp-btn i {
        font-size: 12px !important;
    }


    /* ============================================ */
    /* ===== MOBILE TOTAL/PURCHASE ===== */
    /* ============================================ */

    .table td:nth-child(6) span {
        font-size: 10px;
        color: #6b7280;
        background: none;
        border-color: inherit;
        padding: 2px 4px;
    }

    /* Hide Issued By, Received By, GR-Code on mobile */
    .Grocery-list .table th:nth-child(2),
    .Grocery-list .table td:nth-child(2),
    .Grocery-list .table th:nth-child(4),
    .Grocery-list .table td:nth-child(4),
    .Grocery-list .table th:nth-child(5),
    .Grocery-list .table td:nth-child(5) {
        display: none;
    }
    /* Payment */
    .Payment-list .table th:nth-child(3),
    .Payment-list .table td:nth-child(3),
    .Payment-list .table th:nth-child(4),
    .Payment-list .table td:nth-child(4) {
        display: none;
    }

    .table th:nth-child(1),
    .table td:nth-child(1) {
        width: 30px;
        text-align: center;
        vertical-align: middle;
        font-weight: 600;
        height: 35px;
    }

    .table th:nth-child(3),
    .table td:nth-child(3) {
        width: 60px;
        min-width: 60px;
    }

    .table th:nth-child(6),
    .table td:nth-child(6) {
        width: 70px;
        min-width: 70px;
    }

    .table th:nth-child(7),
    .table td:nth-child(7) {
        width: auto;
        min-width: 120px;
    }

    .table td:nth-child(6) span {
        font-size: 10px;
        color: #6b7280;
        background: none;
        border-color: inherit;
        padding: 2px 4px;
    }

    .action-group {
        gap: 2px;
    }

    .action-btn {
        padding: 2px 3px;
        font-size: 8px;
        min-width: 28px;
        border-radius: 3px;
    }

    .icon-text {
        font-size: 7px;
    }

    .icon-wrapper {
        gap: 4px;
    }

        .icon-wrapper i {
            font-size: 9px;
        }

    .whatsapp-btn i {
        font-size: 12px !important;
    }

    .footer-content {
        padding: 8px 10px;
        gap: 8px;
        flex-direction: column;
    }

    .totals-section {
        width: 100%;
    }

    .total-item {
        min-width: unset;
        width: 100%;
        padding: 4px 8px;
        gap: 6px;
    }

    .total-label {
        font-size: 10px;
    }

    .total-amount {
        font-size: 15px;
    }

    .total-icon {
        width: 28px;
        height: 28px;
    }

        .total-icon .material-symbols-outlined {
            font-size: 18px;
        }

    .actions-section {
        width: 100%;
        justify-content: center;
    }

    .paid-history-btn {
        width: 34px;
        padding: 4px;
    }

        .paid-history-btn:hover {
            width: 100px;
        }

        .paid-history-btn .material-symbols-outlined {
            font-size: 20px;
        }

    .tooltip-slide {
        font-size: 11px;
    }
}

/* === Very Small Mobile === */
@media screen and (max-width: 360px) {

    .table {
        width: 100%;
        min-width: 0;
        max-width: 100%;
        table-layout: fixed;
        font-size: 9px;
        height: auto;
    }

        .table th {
            font-size: 7px;
            padding: 3px 4px;
        }

        .table td {
            padding: 2px 3px;
            font-size: 8px;
        }


    .action-btn {
        padding: 2px 2px;
        font-size: 7px;
        min-width: 24px;
        height: 21px;
    }

    .icon-text {
        font-size: 7px;
    }

    .icon-wrapper i {
        font-size: 9px;
    }

    .whatsapp-btn i {
        font-size: 10px !important;
    }

    .total-item {
        padding: 3px 6px;
    }

    .total-label {
        font-size: 9px;
    }

    .total-amount {
        font-size: 13px;
    }

    .total-icon {
        width: 24px;
        height: 24px;
    }

        .total-icon .material-symbols-outlined {
            font-size: 16px;
        }
    /* ============================================ */
    /* ===== VERY SMALL SCREEN - PAYMENT ===== */
    /* ============================================ */

    .Payment-list .table th:nth-child(1),
    .Payment-list .table td:nth-child(1) {
        width: 9%;
    }

    .Payment-list .table th:nth-child(2),
    .Payment-list .table td:nth-child(2) {
        width: 21%;
    }

    .Payment-list .table th:nth-child(5),
    .Payment-list .table td:nth-child(5) {
        width: 23%;
    }

    .Payment-list .table th:nth-child(6),
    .Payment-list .table td:nth-child(6) {
        width: 22%;
    }

    .Payment-list .table th:nth-child(7),
    .Payment-list .table td:nth-child(7) {
        width: 38%;
    }

    .Payment-list .table th,
    .Payment-list .table td {
        padding-left: 3px;
        padding-right: 3px;
    }

    .Payment-list .action-btn {
        padding: 1px 3px;
        min-width: 24px;
        height: 21px;
    }

    .Payment-list .icon-text {
        font-size: 6px;
    }

    .Payment-list .icon-wrapper i {
        font-size: 8px;
    }
}

/* === Landscape Mobile === */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .Grocery-list,
    .Payment-list {
        max-height: 140px;
    }

    .table-body-wrapper {
        max-height: 110px;
    }



    .table {
        font-size: 9px;
        min-width: 400px;
    }

        .table th {
            font-size: 8px;
            padding: 3px 6px;
        }

        .table td {
            padding: 2px 4px;
            font-size: 8px;
        }

    .action-btn {
        padding: 2px 4px;
        font-size: 7px;
        min-width: 24px;
    }

    .icon-text {
        font-size: 7px;
    }

    .totals-section {
        flex-direction: row;
        gap: 4px;
    }

    .total-item {
        padding: 2px 6px;
        min-width: 80px;
    }

    .total-label {
        font-size: 8px;
    }

    .total-amount {
        font-size: 12px;
    }

    .total-icon {
        width: 20px;
        height: 20px;
    }

        .total-icon .material-symbols-outlined {
            font-size: 14px;
        }

    .footer-content {
        padding: 4px 10px;
        flex-direction: row;
    }

    .actions-section {
        flex-shrink: 0;
    }
}

/* ============================================ */
/* ===== ANIMATIONS ===== */
/* ============================================ */
@keyframes fadeInSmooth {
    0% {
        opacity: 0;
        transform: translateY(8px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}


.btnPdf {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #28a745; /* Bootstrap green */
    color: white;
    padding: 8px 14px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

    .btnPdf:hover {
        background-color: #218838;
        text-decoration: none;
        color: white;
    }

    .btnPdf .material-symbols-outlined {
        font-size: 18px;
    }




.btn-secondary {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
}

    .btn-secondary:hover {
        box-shadow: 0 5px 15px rgba(108, 117, 125, 0.3);
    }


.table-textbox-container {
    overflow: scroll;
    max-height: 305px;
    margin-bottom: 15px;
    animation: fadeInSmooth 0.5s ease-in-out;
}

.entry-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #ffffff;
    border-bottom: 2px solid #d1d5db;
    overflow: hidden;
    table-layout: fixed;
}

    .entry-table thead {
        position: sticky;
        top: 0;
        z-index: 10;
        background: #f8fafc;
    }

        .entry-table thead tr {
            background: #f8fafc;
            border-bottom: 2px solid #e2e8f0;
        }

    .entry-table th {
        padding: 7px 14px;
        background: #ccc;
        text-align: left;
        color: #174a67;
        font-size: 13px;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        border-bottom: 2px solid #d1d5db;
        border-top: 1px solid #d1d5db;
        border-left: 1px solid #d1d5db;
        border-right: 1px solid #d1d5db;
    }

    .entry-table tbody tr {
        border-bottom: 1px solid #f1f5f9;
        transition: all 0.2s ease;
    }

        .entry-table tbody tr:hover {
            background: #f8fafc;
        }

        .entry-table tbody tr:last-child {
            border-bottom: none;
        }

    .entry-table td {
        padding: 5px 14px;
        color: #374151;
        vertical-align: middle;
        font-weight: 400;
        line-height: 1.4;
        border-right: 1px solid #d1d5db;
        border-left: 1px solid #d1d5db;
    }

        .entry-table td input[type="text"] {
            width: 100%;
            box-sizing: border-box;
            padding: 10px 12px;
            border: 2px solid #e9ecef;
            border-radius: 6px;
            font-size: 14px;
            transition: border-color 0.3s ease, box-shadow 0.3s ease;
        }




        .entry-table td:first-child {
            font-weight: 600;
            color: #6b7280;
            width: 50px;
        }


        .entry-table th:nth-child(1), .entry-table td:nth-child(1) {
            width: 28px;
        }

        .entry-table th:nth-child(2), .entry-table td:nth-child(2) {
            width: 114px;
        }

        .entry-table th:nth-child(3), .entry-table td:nth-child(3) {
            width: 114px;
        }

        .entry-table th:nth-child(4), .entry-table td:nth-child(4) {
            width: 114px;
        }

.form-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    margin-top: 6px;
}

    .form-section h3 {
        color: #495057;
        margin-bottom: 20px;
        margin-top: -14px;
        font-weight: 500;
    }

.date-error-row {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    gap: 45px;
    animation: fadeInSmooth 0.5s ease-in-out;
}

.form-group {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

    .form-group label {
        font-weight: bold;
        margin-right: 5px;
        white-space: nowrap;
        display: inline-block;
    }
/* Direct Select Dropdown Styling (Price Input Match) */
/* Base Inputs & Dropdowns */
#divEntryForm input[type="text"],
#divEntryForm input[type="date"],
#divEntryForm .form-control-ddl {
    width: 95%;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

    #divEntryForm input[type="text"]:focus,
    #divEntryForm .date-input:focus,
    #divEntryForm .form-control-ddl:focus {
        outline: none;
        border-color: #4CAF50 !important;
        box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1) !important;
    }
/* Select2 Search Box (Indigo Match) */
.select2-search--dropdown .select2-search__field {
    background-color: #eef2ff !important;
    border: 2px solid #c7d2fe !important;
    border-radius: 6px !important;
    padding: 6px 10px !important;
    font-size: 14px !important;
    color: #333 !important;
    outline: none !important;
}

    .select2-search--dropdown .select2-search__field:focus {
        border-color: #6366f1 !important;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
    }

/* ===== QTY/UNIT (Amber Theme) ===== */
#divEntryForm input[name*="qty_"] {
    background-color: #fffbeb !important;
    border-color: #fde68a !important;
}

    #divEntryForm input[name*="qty_"]:focus {
        border-color: #f59e0b !important;
        box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15) !important;
    }

#divEntryForm input[id*="txtPrice"] {
    background-color: #ecfdf5 !important;
    border: 2px solid #a7f3d0 !important;
}

    #divEntryForm input[id*="txtPrice"]:focus {
        border-color: #10b981 !important;
        box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
        outline: none;
    }

/* ===== ITEM NAME (Indigo Theme) ===== */
.txtItemNameSelect,
select.txtItemNameSelect {
    background-color: #eef2ff !important;
    border: 2px solid #c7d2fe !important;
    width: 95% !important;
    padding: 10px 36px 10px 12px;
    font-size: 14px;
    border-radius: 6px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236366f1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
}

    #divEntryForm .txtItemNameSelect:focus,
    select.txtItemNameSelect:focus,
    .txtItemNameSelect + .select2-container--default.select2-container--open .select2-selection--single,
    .txtItemNameSelect + .select2-container--default.select2-container--focus .select2-selection--single {
        border-color: #6366f1 !important;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15) !important;
        outline: none;
    }

    /* Select2 Generated UI (Indigo Match) */
    .txtItemNameSelect + .select2-container--default .select2-selection--single {
        background-color: #eef2ff !important;
        border: 2px solid #c7d2fe !important;
        border-radius: 6px !important;
        height: auto !important;
        padding: 4px 6px;
        transition: border-color 0.3s ease, box-shadow 0.3s ease;
    }

        .txtItemNameSelect + .select2-container--default .select2-selection--single .select2-selection__rendered {
            color: #333 !important;
            font-size: 14px;
            line-height: 24px;
        }

        .txtItemNameSelect + .select2-container--default .select2-selection--single .select2-selection__arrow {
            height: 100% !important;
            top: 0 !important;
            right: 8px !important;
        }

.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #757575;
}



/* Modal Overlay (for success/error modals) - Modified for smooth transition */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
}

    .modal-overlay.is-active {
        opacity: 1;
        visibility: visible;
    }

.modal-box {
    background: #ffffff;
    padding: 20px 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 0 12px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    width: 90%;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.modal-overlay.is-active .modal-box {
    opacity: 1;
    transform: translateY(0);
}

.modal-box p {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 15px;
}

.modal-box .btn {
    padding: 8px 20px;
    font-size: 14px;
    background-color: #0f4c45fa;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

    .modal-box .btn:hover {
        background-color: #0d3b36;
    }


#modalOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 999;
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

    #modalOverlay.is-active {
        opacity: 1;
        visibility: visible;
    }

/* ===== BASE STYLES ===== */
#itemModal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 92%;
    max-width: 900px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    max-height: 90vh;
    overflow-y: auto;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s ease;
    visibility: hidden;
}

    #itemModal.is-active {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
        visibility: visible;
    }

/* ===== HEADER INFO GRID ===== */
.header-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    padding: 15px 20px;
}

.info-card {
    background: white;
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-left: 4px solid;
    transition: transform 0.2s ease;
}

    .info-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    }

.date-card {
    border-left-color: #3b82f6;
}

.groc-card {
    border-left-color: #10b981;
}

.given-card {
    border-left-color: #8b5cf6;
}

.taken-card {
    border-left-color: #f59e0b;
}

.info-content {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.info-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0; /* Prevents overflow */
}

.info-label {
    font-size: clamp(10px, 1.2vw, 12px);
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: clamp(13px, 1.6vw, 16px);
    font-weight: 600;
    color: #1e293b;
    word-break: break-word;
}

.material-symbols-outlined {
    font-size: clamp(20px, 2.5vw, 28px);
    flex-shrink: 0;
}

/* ===== TABLE SECTION ===== */
.table-section {
    padding: 0 20px 20px;
}

.table-header {
    background: linear-gradient(90deg, #eff6ff 0%, #e0e7ff 100%);
    padding: 12px 16px;
    border-radius: 8px 8px 0 0;
    border-bottom: 1px solid #e2e8f0;
}

    .table-header h4 {
        margin: 0 0 4px 0;
        font-size: clamp(15px, 1.8vw, 18px);
        font-weight: 600;
        color: #1e293b;
    }

    .table-header p {
        margin: 0;
        font-size: clamp(11px, 1.2vw, 13px);
        color: #64748b;
    }

.table-container {
    border: 1px solid #e2e8f0;
    border-radius: 0 0 8px 8px;
    overflow-x: auto; /* Horizontal scroll for small screens */
    -webkit-overflow-scrolling: touch;
}

.items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: clamp(12px, 1.3vw, 14px);
    min-width: 500px; /* Ensures table doesn't break */
}

.table-header-row {
    background: #f8fafc !important;
    color: #374151 !important;
    font-weight: 600 !important;
    font-size: clamp(11px, 1.2vw, 13px) !important;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

    .table-header-row th {
        padding: 10px 12px !important;
        border-bottom: 2px solid #e5e7eb !important;
        text-align: left;
        white-space: nowrap;
    }

.table-row {
    background: white !important;
    transition: background-color 0.2s ease;
}

    .table-row:hover {
        background: #f9fafb !important;
    }

.table-row-alt {
    background: #f8fafc !important;
}

    .table-row-alt:hover {
        background: #f1f5f9 !important;
    }

    .table-row td,
    .table-row-alt td {
        padding: 8px 10px !important;
        border-bottom: 1px solid #d3d3d3 !important;
        vertical-align: middle;
        font-size: clamp(11px, 1.2vw, 13px);
    }

.table-footer {
    background: linear-gradient(90deg, #309a8100 0%, #00546ecc 100%) !important;
    color: white !important;
    font-weight: 700 !important;
    font-size: clamp(15px, 1.8vw, 18px) !important;
}

    .table-footer td {
        padding: 6px !important;
        border: none !important;
        text-align: center;
    }

/* ===== TEXT ALIGNMENT ===== */
.text-center {
    text-align: center !important;
}

.text-right {
    text-align: center !important;
}

.item-name {
    font-weight: 500 !important;
    color: #1e293b;
    text-align: left;
}

.total-cell {
    font-weight: 600 !important;
    color: #1e293b;
}

/* ===== MODAL ACTIONS ===== */
.modal-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    background: #f8fafc;
    border-radius: 0 0 12px 12px;
    border-top: 1px solid #e2e8f0;
}

.btn-primary,
.btn-secondary,
.btnsave,
.btnPdf {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: clamp(12px, 1.3vw, 14px);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btnsave {
    background: #38a538e3;
    color: white;
}

    .btnsave:hover {
        background: #258c25e3;
        transform: translateY(-1px);
    }

.btn-primary {
    background: #10b981;
    color: white;
}

    .btn-primary:hover {
        background: #059669;
        transform: translateY(-1px);
    }

.btn-secondary {
    background: #6b7280;
    color: white;
}

    .btn-secondary:hover {
        background: #4b5563;
        transform: translateY(-1px);
    }

.btnPdf {
    background: #dc3545;
    color: white;
}

    .btnPdf:hover {
        background: #b02a37;
        transform: translateY(-1px);
    }

.action-buttons {
    text-align: center;
}

.button-wrapper {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 18px;
}

body:has(#itemModal.is-active)::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 999;
}






/* Payment Entry Form Container */
.form-section-payment {
    background-color: #ffffff;
    padding: 25px 30px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    max-width: 900px;
    margin: 25px auto 0 auto;
    box-sizing: border-box;
    animation: fadeInSmooth 0.5s ease-in-out;
}

    /* Form Title */
    .form-section-payment h3 {
        font-size: 24px;
        font-weight: 600;
        color: #333;
        margin-bottom: 25px;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }


.form-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}


.form-payment {
    display: flex;
    flex-direction: column;
}

/* Labels */
.form-section-payment label {
    font-size: 14px;
    color: #555;
    margin-bottom: 8px;
    font-weight: 500;
    display: block;
}


.form-cntl-payment {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    color: #333;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    min-width: 120px;
}

    .form-cntl-payment:focus {
        border-color: #007bff;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
        outline: none;
    }

    .form-cntl-payment::placeholder {
        color: #888;
        opacity: 0.7;
    }


textarea.form-cntl-payment {
    resize: vertical;
    grid-column: 1 / -1;
}

.form-actions-payment {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 36px;
    grid-column: 1 / -1;
}


.btnsavepayment,
.btncancelpayment {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: white;
}


.btnsavepayment {
    background: linear-gradient(135deg, #28a745 0%, #218838 100%); /* Green gradient */
    color: #ffffff;
}

    .btnsavepayment:hover {
        background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
        box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
        text-decoration: none;
        color: white;
    }

.btncancelpayment {
    background: linear-gradient(135deg, #6c757d 0%, #5a6268 100%);
    color: #ffffff;
}

    .btncancelpayment:hover {
        background: linear-gradient(135deg, #5a6268 0%, #4e555b 100%);
        box-shadow: 0 5px 15px rgba(108, 117, 125, 0.3);
        text-decoration: none;
        color: white;
    }


/* Parent container core recognition fixes */
.entry-table td {
    position: relative !important;
}
/* Ensure table container row allows absolute items to float correctly */
.entry-table td {
    position: relative;
}


/* Responsive adjustments for the form */
@media (max-width: 900px) { /* Adjust breakpoint for grid */
    .form-section-payment {
        max-width: 100%; /* Allow form to take full width */
    }

    .form-fields-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Adjust min-width for smaller screens */
    }
}

@media (max-width: 600px) {
    .form-section-payment {
        padding: 20px;
        margin: 15px auto 0 auto;
    }

        .form-section-payment h3 {
            font-size: 22px;
            margin-bottom: 20px;
        }

    .form-fields-grid {
        grid-template-columns: 1fr; /* Stack all fields vertically on small screens */
        gap: 15px;
    }

    .form-actions-payment {
        flex-direction: column; /* Stack buttons vertically on smaller screens */
        align-items: stretch; /* Stretch buttons to full width */
        gap: 10px;
    }

    .btnsavepayment, .btncancelpayment {
        width: 100%; /* Full width buttons */
    }
}

@media (max-width: 480px) {
    .form-section-payment {
        border-radius: 0; /* Remove border-radius on very small screens */
        box-shadow: none; /* Remove shadow on very small screens */
        padding: 15px;
    }

        .form-section-payment h3 {
            font-size: 20px;
        }
}




/* Keyframes for smooth fade-in and fade-out */
@keyframes fadeInPage {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInSmooth {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOutSmooth {
    from {
        opacity: 1;
        transform: translateY(0);
    }

    to {
        opacity: 0;
        transform: translateY(10px); /* Fades out moving down slightly */
    }
}

@import "tailwindcss";
@import "tw-animate-css";

@custom-variant dark (&:is(.dark *));

:root {
    --background: oklch(1 0 0);
    --foreground: oklch(0.145 0 0);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.145 0 0);
    --popover: oklch(1 0 0);
    --popover-foreground: oklch(0.145 0 0);
    --primary: oklch(0.205 0 0);
    --primary-foreground: oklch(0.985 0 0);
    --secondary: oklch(0.97 0 0);
    --secondary-foreground: oklch(0.205 0 0);
    --muted: oklch(0.97 0 0);
    --muted-foreground: oklch(0.556 0 0);
    --accent: oklch(0.97 0 0);
    --accent-foreground: oklch(0.205 0 0);
    --destructive: oklch(0.577 0.245 27.325);
    --destructive-foreground: oklch(0.577 0.245 27.325);
    --border: oklch(0.922 0 0);
    --input: oklch(0.922 0 0);
    --ring: oklch(0.708 0 0);
    --chart-1: oklch(0.646 0.222 41.116);
    --chart-2: oklch(0.6 0.118 184.704);
    --chart-3: oklch(0.398 0.07 227.392);
    --chart-4: oklch(0.828 0.189 84.429);
    --chart-5: oklch(0.769 0.188 70.08);
    --radius: 0.625rem;
    --sidebar: oklch(0.985 0 0);
    --sidebar-foreground: oklch(0.145 0 0);
    --sidebar-primary: oklch(0.205 0 0);
    --sidebar-primary-foreground: oklch(0.985 0 0);
    --sidebar-accent: oklch(0.97 0 0);
    --sidebar-accent-foreground: oklch(0.205 0 0);
    --sidebar-border: oklch(0.922 0 0);
    --sidebar-ring: oklch(0.708 0 0);
}

.dark {
    --background: oklch(0.145 0 0);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.145 0 0);
    --card-foreground: oklch(0.985 0 0);
    --popover: oklch(0.145 0 0);
    --popover-foreground: oklch(0.985 0 0);
    --primary: oklch(0.985 0 0);
    --primary-foreground: oklch(0.205 0 0);
    --secondary: oklch(0.269 0 0);
    --secondary-foreground: oklch(0.985 0 0);
    --muted: oklch(0.269 0 0);
    --muted-foreground: oklch(0.708 0 0);
    --accent: oklch(0.269 0 0);
    --accent-foreground: oklch(0.985 0 0);
    --destructive: oklch(0.396 0.141 25.723);
    --destructive-foreground: oklch(0.637 0.237 25.331);
    --border: oklch(0.269 0 0);
    --input: oklch(0.269 0 0);
    --ring: oklch(0.439 0 0);
    --chart-1: oklch(0.488 0.243 264.376);
    --chart-2: oklch(0.696 0.17 162.48);
    --chart-3: oklch(0.769 0.188 70.08);
    --chart-4: oklch(0.627 0.265 303.9);
    --chart-5: oklch(0.645 0.246 16.439);
    --sidebar: oklch(0.205 0 0);
    --sidebar-foreground: oklch(0.985 0 0);
    --sidebar-primary: oklch(0.488 0.243 264.376);
    --sidebar-primary-foreground: oklch(0.985 0 0);
    --sidebar-accent: oklch(0.269 0 0);
    --sidebar-accent-foreground: oklch(0.985 0 0);
    --sidebar-border: oklch(0.269 0 0);
    --sidebar-ring: oklch(0.439 0 0);
}

@theme inline {
    --color-background: var(--background);
    --color-foreground: var(--foreground);
    --color-card: var(--card);
    --color-card-foreground: var(--card-foreground);
    --color-popover: var(--popover);
    --color-popover-foreground: var(--popover-foreground);
    --color-primary: var(--primary);
    --color-primary-foreground: var(--primary-foreground);
    --color-secondary: var(--secondary);
    --color-secondary-foreground: var(--secondary-foreground);
    --color-muted: var(--muted);
    --color-muted-foreground: var(--muted-foreground);
    --color-accent: var(--accent);
    --color-accent-foreground: var(--accent-foreground);
    --color-destructive: var(--destructive);
    --color-destructive-foreground: var(--destructive-foreground);
    --color-border: var(--border);
    --color-input: var(--input);
    --color-ring: var(--ring);
    --color-chart-1: var(--chart-1);
    --color-chart-2: var(--chart-2);
    --color-chart-3: var(--chart-3);
    --color-chart-4: var(--chart-4);
    --color-chart-5: var(--chart-5);
    --radius-sm: calc(var(--radius) - 4px);
    --radius-md: calc(var(--radius) - 2px);
    --radius-lg: var(--radius);
    --radius-xl: calc(var(--radius) + 4px);
    --color-sidebar: var(--sidebar);
    --color-sidebar-foreground: var(--sidebar-foreground);
    --color-sidebar-primary: var(--sidebar-primary);
    --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
    --color-sidebar-accent: var(--sidebar-accent);
    --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
    --color-sidebar-border: var(--sidebar-border);
    --color-sidebar-ring: var(--sidebar-ring);
}

@layer base {
    * {
        @apply border-border outline-ring/50;
    }

    body {
        @apply bg-background text-foreground;
        font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; /* Modern, clean font */
        color: #333;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }
}

.v0-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

    .v0-modal-overlay.v0-is-active {
        opacity: 1;
        visibility: visible;
    }

/* ============================================ */
/* ===== MODAL BOX ===== */
/* ============================================ */
.v0-modal-box {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px) scale(0.97);
    transition: opacity 0.3s ease, transform 0.3s ease;
    width: 92%;
    max-width: 850px;
}

.v0-modal-overlay.v0-is-active .v0-modal-box {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.v0-payment-history-modal {
    max-height: 88vh;
}

/* ============================================ */
/* ===== MODAL HEADER ===== */
/* ============================================ */
.v0-modal-header {
    padding: clamp(14px, 2vw, 20px) clamp(16px, 2.5vw, 24px);
    border-bottom: 1px solid #e8e8e8;
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: #ffffff;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    flex-shrink: 0;
}

    .v0-modal-header h3 {
        margin: 0;
        font-size: clamp(16px, 2vw, 22px);
        font-weight: 600;
        color: #1a1a2e;
        display: flex;
        align-items: center;
        gap: 8px;
        font-family: 'Segoe UI', system-ui, sans-serif;
    }

    .v0-modal-header .material-symbols-outlined {
        font-size: clamp(22px, 2.8vw, 28px);
        color: #4a4a6a;
    }

/* ============================================ */
/* ===== PAYMENT SUMMARY ===== */
/* ============================================ */
.v0-payment-summary {
    display: flex;
    justify-content: space-around;
    padding: clamp(12px, 1.8vw, 18px) clamp(16px, 2.5vw, 24px);
    background: linear-gradient(135deg, #f8f9fc 0%, #eef1f5 100%);
    border-bottom: 1px solid #e8e8e8;
    gap: 10px;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.v0-summary-item {
    text-align: center;
    flex: 1;
    min-width: 100px;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(2px);
    transition: transform 0.2s ease;
}

    .v0-summary-item:hover {
        transform: translateY(-2px);
    }

    .v0-summary-item .v0-label {
        font-size: clamp(10px, 1.1vw, 13px);
        color: #6b7280;
        margin-bottom: 4px;
        display: block;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        font-weight: 500;
    }

    .v0-summary-item .v0-value {
        font-size: clamp(16px, 2vw, 22px);
        font-weight: 700;
        color: #1a1a2e;
        display: block;
    }

    .v0-summary-item.v0-total .v0-value {
        color: #2563eb;
    }

    .v0-summary-item.v0-paid .v0-value {
        color: #16a34a;
    }

    .v0-summary-item.v0-balance .v0-value {
        color: #dc2626;
    }

/* ============================================ */
/* ===== TABLE SECTION ===== */
/* ============================================ */
.v0-table-section {
    flex-grow: 1;
    padding: 0 clamp(12px, 2vw, 20px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.v0-table-container {
    margin: clamp(10px, 1.5vw, 16px) 0;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    overflow: auto;
    height: 246px;
    max-height: 246px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
}

/* ============================================ */
/* ===== GRIDVIEW / TABLE ===== */
/* ============================================ */
.v0-items-table,
.v0-paid-history-grid {
    width: 100%;
    border-collapse: collapse;
    font-size: clamp(12px, 1.2vw, 14px);
    line-height: 1.5;
    min-width: 600px;
}

.v0-table-header-row {
    background-color: #f1f3f6;
    color: #374151;
    font-weight: 600;
    border-bottom: 2px solid #d1d5db;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
}

    .v0-table-header-row th {
        padding: clamp(8px, 1vw, 12px) clamp(8px, 1.2vw, 14px);
        white-space: nowrap;
        text-align: center;
        font-size: clamp(11px, 1.1vw, 13px);
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

.v0-table-row,
.v0-table-row-alt {
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s ease;
}

    .v0-table-row:last-child,
    .v0-table-row-alt:last-child {
        border-bottom: none;
    }

    .v0-table-row td,
    .v0-table-row-alt td {
        padding: clamp(6px, 0.8vw, 10px) clamp(8px, 1.2vw, 14px);
        vertical-align: middle;
        text-align: center !important;
        font-size: clamp(11px, 1.1vw, 13px);
        word-break: break-word;
    }

    .v0-table-row:hover,
    .v0-table-row-alt:hover {
        background-color: #f8fafc !important;
        transition: background-color 0.2s ease;
    }

.v0-table-row-alt {
    background-color: #fafbfc;
}

/* ===== TEXT ALIGNMENT ===== */
.v0-text-center {
    text-align: center !important;
}

.v0-text-left {
    text-align: left !important;
}

.v0-text-right {
    text-align: right !important;
}

/* ===== PAYMENT ROW HIGHLIGHTS ===== */
.payment-row {
    background-color: #fffbeb !important;
}

.payment-cell {
    font-weight: 700;
    color: #2563eb;
    background: #f1f5f9;
    border-bottom: 2px solid #d1d5db;
    text-align: center;
    border-top: 2px solid #d1d5db;
    padding: 6px 10px !important;
}

    .payment-cell:nth-child(3),
    .payment-cell:nth-child(4),
    .payment-cell:nth-child(5) {
        background-color: #e5e7eb;
        color: #16a34a;
    }

.payment-highlight {
    font-size: clamp(16px, 1.8vw, 20px);
}

/* ============================================ */
/* ===== MODAL ACTIONS (FOOTER) ===== */
/* ============================================ */
.v0-modal-actions {
    padding: clamp(12px, 1.5vw, 18px) clamp(16px, 2.5vw, 24px);
    border-top: 1px solid #e8e8e8;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    background-color: #ffffff;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 12px;
    flex-shrink: 0;
}

.v0-btn-secondary {
    padding: clamp(7px, 0.8vw, 10px) clamp(14px, 1.5vw, 20px);
    border: 1px solid #d1d5db;
    border-radius: 6px;
    text-decoration: none;
    background-color: #f9fafb;
    color: #374151;
    font-size: clamp(12px, 1.2vw, 14px);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    white-space: nowrap;
}

    .v0-btn-secondary:hover {
        background-color: #f3f4f6;
        border-color: #9ca3af;
        transform: translateY(-1px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }

    .v0-btn-secondary i {
        font-size: clamp(16px, 1.5vw, 20px);
    }




/* Responsive Design - Adjusted for compact design */
/* ================================================
   OnePlus Nord 2 5G — Responsive CSS
   CSS Width: 412px | Screen: 6.43" | FHD+
   Add this at the END of your existing CSS file
   ================================================ */

@media (max-width: 480px) {

    .container {
        margin-top: 0;
        border-radius: 0;
    }
    /* --- Global Responsive Base --- */
    .form-section, .form-section-payment {
        padding: 15px;
        margin: 15px auto;
        width: 100%;
        max-width: 800px; /* Badi screen par isse zyada bada nahi hoga aur center rahega */
        box-sizing: border-box;
        border-radius: 10px;
        background-color: #fff; /* Base background */
    }

        .form-section h3, .form-section-payment h3 {
            font-size: clamp(18px, 4vw, 24px); /* Screen ke hisab se font size chota-bada hoga */
            text-align: center;
            margin-bottom: 20px;
        }

    /* --- Date + Dropdowns (Responsive Flex) --- */
    .date-error-row {
        display: flex;
        flex-direction: column;
        gap: 15px;
    }

    .form-group, .form-payment {
        width: 100%;
        flex: 1;
    }

        .form-group label, .form-payment label {
            display: block;
            font-size: 14px;
            font-weight: 600;
            margin-bottom: 6px;
        }

    .date-input,
    .form-control-ddl,
    .form-cntl-payment {
        width: 100%;
        height: 45px;
        border-radius: 8px;
        font-size: 15px;
        padding: 0 12px;
        box-sizing: border-box;
    }

    /* --- Payment Form Grid (Automatic Fit) --- */
    .form-fields-grid {
        display: grid;
        grid-template-columns: 1fr; /* Mobile par single column */
        gap: 15px;
    }


    .form-fields-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns layout */
    }

    .full-width-remarks {
        grid-column: span 2; /* Remarks full width le lega */
    }

    .table-textbox-container {
    }
    /*=============================================================================
                             popup ---    view items details 
                           date, grCode, issued by, received by, item details, 
                                      buttons:  Close , Download
                ===============================================================================
                */

    /* === Laptops & Small Desktops === */
    @media screen and (max-width: 1024px) {
        .header-info-grid {
            grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
            gap: 10px;
            padding: 12px 16px;
        }

        .table-section {
            padding: 0 16px 16px;
        }

        .modal-actions {
            padding: 14px 16px;
        }
    }

    /* === Tablets (iPad) === */
    @media screen and (max-width: 768px) {
        #itemModal {
            width: 95%;
            max-height: 92vh;
            border-radius: 10px;
        }

        .header-info-grid {
            grid-template-columns: repeat(2, 1fr);
            gap: 8px;
            padding: 10px 14px;
        }

        .info-card {
            padding: 8px 12px;
        }

        .info-content {
            gap: 8px;
        }

        .table-section {
            padding: 0 14px 14px;
        }

        .table-header {
            padding: 10px 14px;
        }

            .table-header h4 {
                font-size: 15px;
            }

        .modal-actions {
            padding: 12px 14px;
            gap: 8px;
            justify-content: center;
        }

        .btn-primary,
        .btn-secondary,
        .btnsave,
        .btnPdf {
            padding: 7px 14px;
            font-size: 13px;
        }

        /* Make table scrollable */
        .table-container {
            overflow-x: auto;
        }

        .items-table {
            min-width: 480px;
            font-size: 12px;
        }

        .table-header-row th {
            padding: 8px 10px !important;
            font-size: 11px !important;
        }

        .table-row td,
        .table-row-alt td {
            padding: 6px 8px !important;
            font-size: 12px;
        }
    }

    /* === Mobile Phones === */
    @media screen and (max-width: 480px) {
        #itemModal {
            width: 98%;
            max-height: 95vh;
            border-radius: 8px;
            top: 50%;
            left: 50%;
        }

            #itemModal.is-active {
                transform: translate(-50%, -50%) scale(1);
            }

        .header-info-grid {
            grid-template-columns: 1fr 1fr;
            gap: 6px;
            padding: 8px 10px;
        }

        .info-card {
            padding: 6px 10px;
            border-left-width: 3px;
        }

        .info-content {
            gap: 6px;
        }

        .info-label {
            font-size: 9px;
        }

        .info-value {
            font-size: 12px;
        }

        .material-symbols-outlined {
            font-size: 18px !important;
        }

        .table-section {
            padding: 0 10px 10px;
        }

        .table-header {
            padding: 8px 12px;
        }

            .table-header h4 {
                font-size: 14px;
            }

            .table-header p {
                font-size: 10px;
            }

        .table-container {
            border-radius: 0 0 6px 6px;
        }

        .items-table {
            min-width: 400px;
            font-size: 11px;
        }

        .table th {
            text-align: left;
            color: #174a67;
            font-size: clamp(8px, 1vw, 11px);
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
        }

        .table-header-row th {
            padding: 6px 8px !important;
            font-size: 10px !important;
        }

        .table-row td,
        .table-row-alt td {
            padding: 5px 6px !important;
            font-size: 11px;
        }

        .table-footer {
            font-size: 14px !important;
        }

        .modal-actions {
            padding: 10px;
            gap: 6px;
            flex-wrap: wrap;
            justify-content: center;
        }

        .btn-primary,
        .btn-secondary,
        .btnsave,
        .btnPdf {
            padding: 6px 12px;
            font-size: 11px;
        }

            .btnPdf i {
                font-size: 16px !important;
            }
    }

    /* === Very Small Mobile === */
    @media screen and (max-width: 360px) {
        .header-info-grid {
            grid-template-columns: 1fr 1fr;
            gap: 4px;
            padding: 6px 8px;
        }

        .info-card {
            padding: 4px 8px;
        }

        .info-label {
            font-size: 8px;
        }

        .info-value {
            font-size: 10px;
        }

        .material-symbols-outlined {
            font-size: 16px !important;
        }

        .items-table {
            min-width: 320px;
            font-size: 10px;
        }

        .table-header-row th {
            padding: 4px 6px !important;
            font-size: 9px !important;
        }

        .table-row td,
        .table-row-alt td {
            padding: 4px 5px !important;
            font-size: 10px;
        }

        .modal-actions {
            flex-direction: column;
            align-items: stretch;
        }

        .btn-primary,
        .btn-secondary,
        .btnsave,
        .btnPdf {
            justify-content: center;
            padding: 8px 12px;
        }
    }

    /* ============================================ */
    /* ============================================= */
    /* =========payment & Purchase History========== */
    /* ============================================= */
    /* ============================================= */

    /* === Laptops & Small Desktops === */
    @media screen and (max-width: 1024px) {
        .v0-modal-box {
            width: 95%;
            max-width: 750px;
        }

        .v0-payment-summary {
            gap: 8px;
        }

        .v0-summary-item {
            min-width: 80px;
        }

        .v0-table-container {
            max-height: 260px;
        }

        .v0-items-table {
            min-width: 550px;
        }
    }

    /* === Tablets (iPad) === */
    @media screen and (max-width: 768px) {
        .v0-modal-box {
            width: 98%;
            max-width: 100%;
            border-radius: 10px;
            max-height: 95dvh;
            height: 100%;
        }
    }

    .v0-modal-header {
        border-radius: 10px 10px 0 0;
    }

    .v0-modal-actions {
        border-radius: 0 0 10px 10px;
    }

    .v0-payment-summary {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        padding: 12px 16px;
    }

    .v0-summary-item {
        flex: 1 1 calc(33.33% - 12px);
        min-width: 80px;
        padding: 4px 6px;
    }

        .v0-summary-item .v0-label {
            font-size: 10px;
        }

        .v0-summary-item .v0-value {
            font-size: 16px;
        }

    .v0-table-container {
        max-height: 100vh;
        overflow-y: auto;
        border-radius: 6px;
    }

    .v0-items-table {
        min-width: 500px;
        font-size: 12px;
    }

    .v0-table-header-row th {
        padding: 8px 10px !important;
        font-size: 10px !important;
    }

    .v0-table-row td,
    .v0-table-row-alt td {
        padding: 6px 8px !important;
        font-size: 11px;
    }

    .v0-modal-actions {
        padding: 12px 16px;
        gap: 8px;
        justify-content: center;
    }

    .v0-btn-secondary {
        padding: 6px 14px;
        font-size: 12px;
    }
}

/* === Mobile Phones === */
@media screen and (max-width: 480px) {
    .v0-modal-overlay {
        backdrop-filter: blur(2px);
        -webkit-backdrop-filter: blur(2px);
    }

    .v0-modal-box {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100vh;
        border-radius: 0;
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    .v0-modal-overlay.v0-is-active .v0-modal-box {
        transform: translateY(0) scale(1);
    }

    .v0-modal-header {
        border-radius: 0;
        padding: 12px 14px;
    }

        .v0-modal-header h3 {
            font-size: 16px;
            gap: 6px;
        }

        .v0-modal-header .material-symbols-outlined {
            font-size: 20px;
        }

    .v0-payment-summary {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 10px 14px;
    }

    .v0-summary-item {
        flex: 1 1 auto;
        min-width: unset;
        padding: 6px 10px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: rgba(255, 255, 255, 0.8);
    }

        .v0-summary-item .v0-label {
            font-size: 11px;
            margin-bottom: 0;
            display: inline-block;
        }

        .v0-summary-item .v0-value {
            font-size: 16px;
            display: inline-block;
        }

    .v0-table-section {
        padding: 0 12px;
    }

    .v0-table-container {
        max-height: 100vh;
        overflow-y:auto;
        margin: 10px 0;
        border-radius: 6px;
    }

    .v0-items-table {
        min-width: 420px;
        font-size: 11px;
    }

    .v0-table-header-row th {
        padding: 6px 8px !important;
        font-size: 9px !important;
        white-space: nowrap;
    }

    .v0-table-row td,
    .v0-table-row-alt td {
        padding: 5px 6px !important;
        font-size: 10px;
    }

        /* Hide less important columns on mobile */
        .v0-table-header-row th:nth-child(6),
        .v0-table-row td:nth-child(6),
        .v0-table-row-alt td:nth-child(6) {
        }

    .v0-modal-actions {
        padding: 10px 14px;
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .v0-btn-secondary {
        padding: 6px 12px;
        font-size: 11px;
        flex: 1 1 auto;
        justify-content: center;
        min-width: 80px;
    }

        .v0-btn-secondary i {
            font-size: 16px;
        }

    .payment-cell {
        font-size: 10px;
        padding: 4px 6px !important;
    }

    .payment-highlight {
        font-size: 14px;
    }
}

/* === Very Small Mobile === */
@media screen and (max-width: 360px) {
    .v0-modal-header {
        padding: 10px 12px;
    }

        .v0-modal-header h3 {
            font-size: 14px;
        }

        .v0-modal-header .material-symbols-outlined {
            font-size: 18px;
        }

    .v0-payment-summary {
        padding: 8px 10px;
    }

    .v0-summary-item {
        padding: 4px 8px;
    }

        .v0-summary-item .v0-label {
            font-size: 9px;
        }

        .v0-summary-item .v0-value {
            font-size: 14px;
        }

    .v0-table-container {
        max-height: 100vh; 
        overflow-y: auto;
    }

    .v0-items-table {
        min-width: 320px;
        font-size: 10px;
    }

    .v0-table-header-row th {
        padding: 4px 6px !important;
        font-size: 8px !important;
    }

    .v0-table-row td,
    .v0-table-row-alt td {
        padding: 4px 5px !important;
        font-size: 9px;
    }

        /* Hide more columns on very small screens */
        .v0-table-header-row th:nth-child(5),
        .v0-table-row td:nth-child(5),
        .v0-table-row-alt td:nth-child(5) {
        }

    .v0-modal-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .v0-btn-secondary {
        padding: 8px 12px;
        font-size: 12px;
        justify-content: center;
    }
}

/* === Landscape Mobile === */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .v0-modal-box {
        max-height: 95vh;
        border-radius: 8px;
    }

    .v0-modal-header {
        padding: 8px 14px;
    }

        .v0-modal-header h3 {
            font-size: 14px;
        }

    .v0-payment-summary {
        flex-direction: row;
        padding: 6px 14px;
        gap: 4px;
    }

    .v0-summary-item {
        flex: 1;
        padding: 2px 6px;
    }

        .v0-summary-item .v0-label {
            font-size: 8px;
        }

        .v0-summary-item .v0-value {
            font-size: 12px;
        }

    .v0-table-container {
        max-height: 120px;
    }

    .v0-items-table {
        font-size: 10px;
        min-width: 400px;
    }

    .v0-table-header-row th {
        padding: 4px 8px !important;
        font-size: 8px !important;
    }

    .v0-table-row td,
    .v0-table-row-alt td {
        padding: 3px 6px !important;
        font-size: 9px;
    }

    .v0-modal-actions {
        padding: 6px 14px;
    }

    .v0-btn-secondary {
        padding: 4px 10px;
        font-size: 10px;
    }
}

/* ============================================
   Extra Small — Purane ya chhote phones (375px)
   ============================================ */
@media (max-width: 280px) {

    .totals-section {
    }

    .total-item {
        width: 100%;
    }

    .btn-AddNew,
    .btn-Paid {
        font-size: 12px;
        padding: 8px 10px;
    }

    .sort-controls h3 {
        font-size: 15px;
    }
}
/* =========================================================
   RATE ANALYSIS POPUP — PROFESSIONAL CLEAN UI (COMPACT + LIGHT)
   ========================================================= */

/* ---------- Base reset for popup only ---------- */
.rate-analysis-overlay * {
    box-sizing: border-box;
}

/* ---------- Overlay (full screen backdrop) ---------- */
.rate-analysis-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 16px;
    z-index: 99999;
    animation: rateFadeIn 0.2s ease;
}

@keyframes rateFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ---------- Modal container ---------- */
.rate-analysis-modal {
    width: 100%;
    max-width: 1150px;
    max-height: 96vh;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
    animation: rateSlideUp 0.22s ease;
}

@keyframes rateSlideUp {
    from {
        transform: translateY(12px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Custom scrollbar for the whole modal */
.rate-analysis-modal::-webkit-scrollbar {
    width: 7px;
}

.rate-analysis-modal::-webkit-scrollbar-track {
    background: #f8fafc;
}

.rate-analysis-modal::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

    .rate-analysis-modal::-webkit-scrollbar-thumb:hover {
        background: #cbd5e1;
    }

/* =========================================================
   HEADER — light, compact
   ========================================================= */
.rate-analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 22px;
    background: #eff6ff;
    border-bottom: 1px solid #dbeafe;
    color: #1e293b;
    position: sticky;
    top: 0;
    z-index: 5;
    border-radius: 14px 14px 0 0;
}

    .rate-analysis-header h2 {
        margin: 0 0 2px 0;
        font-size: 16.5px;
        font-weight: 700;
        letter-spacing: -0.01em;
        color: #1e3a8a;
    }

    .rate-analysis-header span {
        display: block;
        font-size: 12px;
        font-weight: 400;
        color: #64748b;
    }

.rate-analysis-close {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    color: #64748b;
    background: #ffffff;
    border: 1px solid #dbeafe;
    text-decoration: none;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s ease;
    cursor: pointer;
}

    .rate-analysis-close:hover {
        background: #fef2f2;
        border-color: #fecaca;
        color: #dc2626;
    }

/* =========================================================
   BODY WRAPPER (compact padding)
   ========================================================= */
.rate-analysis-modal > .rate-analysis-filters,
.rate-analysis-modal > .rate-summary,
.rate-analysis-modal > .rate-status-box,
.rate-analysis-modal > .rate-history {
    padding-left: 22px;
    padding-right: 22px;
}

/* =========================================================
   FILTERS ROW — compact, single line on desktop
   ========================================================= */
.rate-analysis-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    padding-top: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid #f1f5f9;
}

.rate-filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 140px;
    min-width: 130px;
}

    .rate-filter-group label {
        font-size: 11px;
        font-weight: 600;
        color: #94a3b8;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

.rate-filter-control {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #e2e8f0;
    border-radius: 7px;
    font-size: 13px;
    color: #1e293b;
    background: #f8fafc;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

    .rate-filter-control:hover {
        border-color: #cbd5e1;
        background: #ffffff;
    }

    .rate-filter-control:focus {
        outline: none;
        border-color: #93c5fd;
        background: #ffffff;
        box-shadow: 0 0 0 3px rgba(147, 197, 253, 0.25);
    }

.rate-filter-button {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

/* ---------- Analyze / Clear buttons ---------- */
.btn-analyze-rate,
.btn-clear-rate {
    height: 36px;
    min-height: 36px;
    padding: 0 18px;
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-analyze-rate {
    background: #3b82f6;
    color: #ffffff;
}

    .btn-analyze-rate:hover {
        background: #2563eb;
        transform: translateY(-1px);
    }

    .btn-analyze-rate:active {
        transform: translateY(0);
    }

.btn-clear-rate {
    background: #f8fafc;
    color: #64748b;
    border: 1px solid #e2e8f0;
    margin-left: 0;
}

    .btn-clear-rate:hover {
        background: #f1f5f9;
        color: #334155;
    }

/* =========================================================
   RATE SUMMARY CARDS — compact, light
   ========================================================= */
.rate-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding-top: 14px;
    padding-bottom: 4px;
}

.rate-card {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 10px;
    padding: 12px 14px;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .rate-card:hover {
        border-color: #dbeafe;
        background: #f9fbff;
    }

.rate-card-title {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.rate-card strong {
    display: block;
    font-size: 19px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

/* Value tint helpers (optional use on card strong tags) */
.rate-value.increase {
    color: #16a34a !important;
}

.rate-value.decrease {
    color: #dc2626 !important;
}

.rate-value.neutral {
    color: #94a3b8 !important;
}

/* =========================================================
   STATUS BOX — compact
   ========================================================= */
.rate-status-box {
    display: flex;
    align-items: center;
    padding: 9px 14px;
    border-radius: 8px;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    margin: 12px 22px;
    width: calc(100% - 44px);
}

    /* Rate History ko bilkul left rakhne ke liye margin reset */
    .rate-status-box h3 {
        margin: 0;
    }

    /* Status text aur strong tag ko center me push karne ke liye */
    .rate-status-box span {
        margin-left: auto;
    }

    /* Status aur "NO DATA" ke beech thoda gap dene ke liye */
    .rate-status-box strong {
        margin-left: 6px;
        margin-right: auto; /* Isse Status center me hi locked rahega */
    }

.rate-analysis-modal > .rate-status-box {
    padding-left: 14px;
    padding-right: 14px;
}

.rate-status-box strong.increased, .rate-status.increased {
    color: #16a34a !important;
}

.rate-status-box strong.decreased, .rate-status.decreased {
    color: #dc2626 !important;
}

.rate-status-box strong.no-change, .rate-status.no-change {
    color: #94a3b8 !important;
}

.rate-status-box strong.first-rate, .rate-status.first-rate {
    color: #3b82f6 !important;
}

/* =========================================================
   RATE HISTORY SECTION — compact
   ========================================================= */
.rate-history {
    padding-top: 2px;
    padding-bottom: 20px;
}

    .rate-history h3 {
        margin: 0 0 10px 0;
        font-size: 14px;
        font-weight: 700;
        color: #1e293b;
        display: flex;
        align-items: center;
        gap: 6px;
    }

.rate-history-table {
    width: 100%;
    overflow-x: auto;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    background: #ffffff;
    max-height: 260px;
    overflow-y: auto;
}

    .rate-history-table::-webkit-scrollbar {
        height: 6px;
        width: 6px;
    }

    .rate-history-table::-webkit-scrollbar-track {
        background: #f8fafc;
    }

    .rate-history-table::-webkit-scrollbar-thumb {
        background: #e2e8f0;
        border-radius: 10px;
    }

        .rate-history-table::-webkit-scrollbar-thumb:hover {
            background: #cbd5e1;
        }

/* ---------- Table ---------- */
.rate-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 680px;
}

    .rate-table th {
        background: #f8fafc;
        color: #64748b;
        font-size: 11px;
        font-weight: 700;
        text-align: left;
        text-transform: uppercase;
        letter-spacing: 0.02em;
        padding: 9px 12px;
        border-bottom: 1px solid #f1f5f9;
        white-space: nowrap;
        position: sticky;
        top: 0;
        z-index: 2;
    }

    .rate-table td {
        padding: 8px 12px;
        font-size: 12.5px;
        color: #334155;
        border-bottom: 1px solid #f8fafc;
        white-space: nowrap;
    }

    .rate-table tr:last-child td {
        border-bottom: none;
    }

    .rate-table tbody tr {
        transition: background 0.15s ease;
    }

        .rate-table tbody tr:hover {
            background: #f8fafc;
        }

    .rate-table tr td[colspan] {
        text-align: center;
        padding: 24px 15px;
        color: #94a3b8;
        font-weight: 500;
        white-space: normal;
    }

/* ---------- Change color helpers ---------- */
.history-increase {
    color: #16a34a !important;
    font-weight: 700;
}

.history-decrease {
    color: #dc2626 !important;
    font-weight: 700;
}

.history-neutral {
    color: #94a3b8 !important;
    font-weight: 600;
}

/* ---------- Status badges — light pastel ---------- */
.rate-table .status-increased,
.rate-table .status-decreased,
.rate-table .status-no-change,
.rate-table .status-first-rate {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.rate-table .status-increased {
    background: #f0fdf4;
    color: #16a34a !important;
    border: 1px solid #dcfce7;
}

.rate-table .status-decreased {
    background: #fef2f2;
    color: #dc2626 !important;
    border: 1px solid #fee2e2;
}

.rate-table .status-no-change {
    background: #f8fafc;
    color: #94a3b8 !important;
    border: 1px solid #f1f5f9;
}

.rate-table .status-first-rate {
    background: #eff6ff;
    color: #3b82f6 !important;
    border: 1px solid #dbeafe;
}

/* =========================================================
   RESPONSIVE — TABLET
   ========================================================= */
@media (max-width: 900px) {
    .rate-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* =========================================================
   RESPONSIVE — MOBILE
   ========================================================= */
@media (max-width: 600px) {
    .rate-analysis-overlay {
        padding: 0;
        align-items: stretch;
    }

    .rate-analysis-modal {
        max-width: 100%;
        max-height: 100vh;
        height: 100%;
        border-radius: 0;
    }

    .rate-analysis-header {
        padding: 12px 14px;
        border-radius: 0;
    }

    .rate-analysis-modal > .rate-analysis-filters,
    .rate-analysis-modal > .rate-summary,
    .rate-analysis-modal > .rate-history {
        padding-left: 14px;
        padding-right: 14px;
    }

    .rate-status-box {
        margin: 10px 14px;
        width: calc(100% - 28px);
    }

    .rate-analysis-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .rate-filter-group {
        min-width: 100%;
    }

    .rate-filter-button {
        width: 100%;
        justify-content: stretch;
    }

    .btn-analyze-rate,
    .btn-clear-rate {
        flex: 1 1 auto;
    }

    .rate-summary {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .rate-card strong {
        font-size: 17px;
    }

    .rate-history-table {
        max-height: 320px;
    }
}

/* ==========================================
   STEP 4 - RATE ANALYSIS MOBILE RESPONSIVE
========================================== */

@media (max-width: 768px) {

    /* ------------------------------------------
       RATE ANALYSIS OVERLAY
    ------------------------------------------ */

    .rate-analysis-overlay {
        padding: 10px;
        align-items: flex-start;
        overflow-y: auto;
    }


    /* ------------------------------------------
       MODAL
    ------------------------------------------ */

    .rate-analysis-modal {
        width: 100%;
        max-width: 100%;
        max-height: 95vh;
        margin: 10px 0;
        border-radius: 12px;
        overflow-y: auto;
    }


    /* ------------------------------------------
       HEADER
    ------------------------------------------ */

    .rate-analysis-header {
        padding: 15px;
        gap: 10px;
    }

        .rate-analysis-header h2 {
            font-size: 18px;
            line-height: 1.3;
        }

        .rate-analysis-header span {
            font-size: 12px;
        }


    /* ------------------------------------------
       FILTER AREA
    ------------------------------------------ */

    .rate-analysis-filters {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 15px;
    }


    .rate-filter-group {
        width: 100%;
    }


        .rate-filter-group label {
            display: block;
            margin-bottom: 5px;
            font-size: 13px;
            font-weight: 600;
        }


    .rate-filter-control {
        width: 100%;
        min-height: 42px;
        font-size: 14px;
    }


    /* ------------------------------------------
       ANALYZE BUTTON
    ------------------------------------------ */

    .rate-filter-button {
        width: 100%;
    }

    .btn-analyze-rate {
        width: 100%;
        min-height: 44px;
    }


    /* ------------------------------------------
       RATE CARDS
    ------------------------------------------ */

    .rate-summary {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        margin: 15px;
    }


    .rate-card {
        padding: 14px;
        border-radius: 10px;
    }


    .rate-card-title {
        font-size: 12px;
        margin-bottom: 6px;
    }


    .rate-card strong {
        font-size: 19px;
    }


    /* ------------------------------------------
       STATUS
    ------------------------------------------ */

    .rate-status-box {
        margin: 0 15px 15px 15px;
        padding: 12px;
        flex-wrap: wrap;
    }


        .rate-status-box span,
        .rate-status-box strong {
            font-size: 13px;
        }


    /* ------------------------------------------
       HISTORY SECTION
    ------------------------------------------ */

    .rate-history {
        margin: 0 15px 15px 15px;
    }


        .rate-history h3 {
            font-size: 16px;
            margin-bottom: 10px;
        }


    /* ------------------------------------------
       HISTORY TABLE
    ------------------------------------------ */

    .rate-history-table {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }


    .rate-table {
        min-width: 700px;
    }


        .rate-table th {
            padding: 11px 10px;
            font-size: 12px;
        }


        .rate-table td {
            padding: 10px;
            font-size: 12px;
        }


    /* ------------------------------------------
       CLOSE BUTTON
    ------------------------------------------ */

    .rate-analysis-close {
        width: 34px;
        height: 34px;
        flex-shrink: 0;
    }
}


/* ==========================================
   SMALL PHONES
========================================== */

@media (max-width: 480px) {

    .rate-analysis-overlay {
        padding: 6px;
    }


    .rate-analysis-modal {
        margin: 5px 0;
        max-height: 96vh;
        border-radius: 10px;
    }


    .rate-analysis-header {
        padding: 13px;
    }


        .rate-analysis-header h2 {
            font-size: 16px;
        }


        .rate-analysis-header span {
            font-size: 11px;
        }


    .rate-analysis-filters {
        padding: 12px;
        gap: 10px;
    }


    .rate-filter-control {
        min-height: 40px;
        font-size: 13px;
    }


    .rate-summary {
        margin: 12px;
        gap: 8px;
    }


    .rate-card {
        padding: 12px;
    }


        .rate-card strong {
            font-size: 17px;
        }


    .rate-card-title {
        font-size: 11px;
    }


    .rate-status-box {
        margin: 0 12px 12px 12px;
    }


    .rate-history {
        margin: 0 12px 12px 12px;
    }


    .rate-history-table {
        border-radius: 8px;
    }


    .rate-table {
        min-width: 680px;
    }
}



/* =========================================================
   NEW ITEM MODAL
   Step 1
   ========================================================= */
.new-item-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.new-item-modal {
    width: 100%;
    max-width: 450px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.new-item-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #eeeeee;
}

    .new-item-modal-header h3 {
        margin: 0;
        font-size: 20px;
        font-weight: 600;
    }

.new-item-modal-close {
    border: none;
    background: transparent;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.new-item-modal-body {
    padding: 20px;
}

.new-item-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

    .new-item-form-group label {
        font-weight: 600;
        font-size: 14px;
    }

.new-item-input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 12px;
    border: 1px solid #cccccc;
    border-radius: 6px;
    font-size: 15px;
    outline: none;
}

    .new-item-input:focus {
        border-color: #007bff;
    }

.new-item-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #eeeeee;
}

.new-item-btn-cancel,
.new-item-btn-save {
    border: none;
    border-radius: 6px;
    padding: 10px 18px;
    cursor: pointer;
    font-weight: 600;
}

.new-item-btn-cancel {
    background: #eeeeee;
}

.new-item-btn-save {
    background: #007bff;
    color: #ffffff;
}

@media (max-width: 600px) {

    .new-item-modal-overlay {
        padding: 15px;
    }

    .new-item-modal {
        max-width: 100%;
    }

    .new-item-modal-header h3 {
        font-size: 18px;
    }

    .new-item-modal-footer {
        flex-direction: column-reverse;
    }

    .new-item-btn-cancel,
    .new-item-btn-save {
        width: 100%;
    }
}
