.ground-stock-summary-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.ground-stock-summary-card {
    min-height: 116px;
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    background: #fff;
    box-shadow: 0 12px 26px rgba(15, 23, 42, 0.06);
}

.ground-stock-summary-card h3 {
    margin: 6px 0 3px;
    color: #0f172a;
    font-size: clamp(1.28rem, 2vw, 1.62rem);
    line-height: 1.12;
    overflow-wrap: anywhere;
}

.ground-stock-summary-card h3.is-ok {
    color: #166534;
}

.ground-stock-summary-card h3.is-missing {
    color: #b45309;
}

.ground-stock-summary-card h3.is-extra {
    color: #c2410c;
}

.ground-stock-summary-note {
    margin: 0;
    color: var(--admin-text-muted, #64748b);
    font-size: 0.78rem;
    line-height: 1.35;
}

.ground-stock-reconciliation-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 800;
}

.ground-stock-reconciliation-banner.is-ok {
    border: 1px solid rgba(34, 197, 94, 0.18);
    background: #f0fdf4;
    color: #166534;
}

.ground-stock-reconciliation-banner.is-mismatch {
    border: 1px solid rgba(245, 158, 11, 0.24);
    background: #fffbeb;
    color: #92400e;
}

.ground-stock-filter-bar {
    display: grid;
    grid-template-columns: minmax(150px, 0.75fr) minmax(150px, 0.75fr) minmax(240px, 1.35fr) minmax(140px, 0.65fr);
    gap: 10px;
    align-items: end;
    margin-bottom: 14px;
}

.ground-stock-filter-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.ground-stock-filter-field span {
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.ground-stock-filter-field input,
.ground-stock-filter-field select {
    width: 100%;
    min-width: 0;
    min-height: 40px;
    padding: 0 12px;
    border: 1px solid rgba(148, 163, 184, 0.34);
    border-radius: 12px;
    background: #fff;
    color: #0f172a;
}

.ground-stock-grouped-summary {
    margin-bottom: 16px;
}

.ground-stock-grouped-summary[hidden] {
    display: none;
}

.ground-stock-design-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.ground-stock-design-chip {
    min-width: 170px;
    padding: 10px 12px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 14px;
    background: #f8fafc;
}

.ground-stock-design-chip strong,
.ground-stock-design-chip span {
    display: block;
    line-height: 1.3;
}

.ground-stock-design-chip span {
    margin-top: 3px;
    color: #64748b;
    font-size: 0.8rem;
}

.ground-stock-table {
    min-width: 1080px;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.ground-stock-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom: 0;
    background: transparent;
    color: #64748b;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.ground-stock-table th,
.ground-stock-table td {
    padding: 11px 12px;
    border-top: 1px solid rgba(226, 232, 240, 0.85);
    border-bottom: 1px solid rgba(226, 232, 240, 0.85);
    background: rgba(255, 255, 255, 0.98);
    vertical-align: middle;
}

.ground-stock-table tbody td:first-child {
    border-left: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 16px 0 0 16px;
}

.ground-stock-table tbody td:last-child {
    border-right: 1px solid rgba(226, 232, 240, 0.85);
    border-radius: 0 16px 16px 0;
}

.ground-stock-table tbody tr:hover td {
    border-color: rgba(251, 146, 60, 0.28);
    background: #fffaf5;
}

.ground-stock-product-cell strong {
    display: block;
    max-width: 230px;
    color: #0f172a;
    line-height: 1.32;
    white-space: normal;
    overflow-wrap: anywhere;
}

.ground-stock-number-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.ground-stock-difference-value {
    font-weight: 800;
}

.ground-stock-difference-value.is-ok {
    color: #166534;
}

.ground-stock-difference-value.is-missing {
    color: #b45309;
}

.ground-stock-difference-value.is-extra {
    color: #c2410c;
}

.ground-stock-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 68px;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 900;
    line-height: 1;
}

.ground-stock-status-pill strong {
    font-size: inherit;
}

.ground-stock-status-pill small {
    display: none;
}

.ground-stock-status-pill.is-ok {
    border: 1px solid rgba(22, 163, 74, 0.22);
    background: #dcfce7;
    color: #166534;
}

.ground-stock-status-pill.is-low {
    border: 1px solid rgba(217, 119, 6, 0.24);
    background: #fef3c7;
    color: #92400e;
}

.ground-stock-status-pill.is-high {
    border: 1px solid rgba(234, 88, 12, 0.24);
    background: #ffedd5;
    color: #c2410c;
}

.ground-stock-table-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: nowrap;
    min-width: max-content;
}

.ground-stock-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 30px;
    padding: 0 9px;
    border: 1px solid rgba(203, 213, 225, 0.95);
    border-radius: 10px;
    background: #fff;
    color: #334155;
    font-size: 0.76rem;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.04);
    white-space: nowrap;
}

.ground-stock-action-btn:hover,
.ground-stock-action-btn:focus-visible {
    border-color: rgba(251, 146, 60, 0.4);
    color: #92400e;
    outline: none;
}

.ground-stock-action-danger {
    border-color: rgba(220, 38, 38, 0.18);
    background: #fef2f2;
    color: #b91c1c;
}

.ground-stock-action-danger:hover,
.ground-stock-action-danger:focus-visible {
    border-color: rgba(220, 38, 38, 0.35);
    background: #fee2e2;
    color: #991b1b;
}

.ground-stock-action-primary {
    border-color: rgba(37, 99, 235, 0.2);
    background: #eff6ff;
    color: #1d4ed8;
}

.ground-stock-action-primary:hover,
.ground-stock-action-primary:focus-visible {
    border-color: rgba(37, 99, 235, 0.38);
    background: #dbeafe;
    color: #1e40af;
}

.ground-stock-action-more {
    min-width: 34px;
    background: #f8fafc;
    color: #475569;
}

.ground-stock-more-menu {
    position: relative;
    display: inline-flex;
}

.ground-stock-more-panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 20;
    display: none;
    min-width: 150px;
    padding: 6px;
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
}

.ground-stock-more-floating-panel {
    position: fixed;
    top: 0;
    left: 0;
    right: auto;
    z-index: 2147483000;
    display: grid;
    gap: 3px;
}

.ground-stock-more-menu:hover .ground-stock-more-panel,
.ground-stock-more-menu:focus-within .ground-stock-more-panel {
    display: grid;
    gap: 3px;
}

.ground-stock-more-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 34px;
    padding: 7px 9px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #334155;
    font-size: 0.8rem;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
}

.ground-stock-more-item:hover,
.ground-stock-more-item:focus-visible {
    background: #f8fafc;
    color: #0f172a;
    outline: none;
}

.ground-stock-card-list {
    display: none;
}

.ground-stock-mobile-card {
    padding: 14px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
}

.ground-stock-mobile-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ground-stock-mobile-card h3 {
    margin: 0;
    color: #0f172a;
    font-size: 1rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.ground-stock-mobile-card p {
    margin: 3px 0 0;
    color: #64748b;
    font-size: 0.82rem;
}

.ground-stock-mobile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin-top: 12px;
}

.ground-stock-mobile-grid > div {
    display: grid;
    gap: 4px;
    padding: 10px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    border-radius: 13px;
    background: #f8fafc;
}

.ground-stock-mobile-grid span {
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.ground-stock-mobile-grid strong {
    color: #0f172a;
    font-size: 0.92rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.ground-stock-mobile-actions {
    display: inline-flex;
    width: auto;
    margin-top: 12px;
}

.ground-stock-mobile-actions .ground-stock-action-btn {
    width: 34px;
    padding: 0;
}

.ground-stock-modal-shell[hidden] {
    display: none;
}

.gs-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.56);
    backdrop-filter: blur(4px);
}

.gs-modal {
    position: relative;
    width: min(540px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow: auto;
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: #fff;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.3);
}

.gs-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px 12px;
    border-bottom: 1px solid rgba(226, 232, 240, 0.95);
}

.gs-modal-header > div {
    min-width: 0;
}

.gs-modal-header h3 {
    margin: 4px 0 0;
    color: #0f172a;
    font-size: 1.12rem;
    line-height: 1.35;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.gs-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 999px;
    background: #fff;
    color: #475569;
    cursor: pointer;
}

.gs-modal-close:hover,
.gs-modal-close:focus-visible {
    border-color: rgba(251, 146, 60, 0.35);
    background: #fff7ed;
    color: #92400e;
    outline: none;
}

.gs-modal-body {
    display: grid;
    gap: 14px;
    padding: 18px 20px 20px;
}

.ground-stock-modal-product-name {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 12px;
    background: #f8fafc;
    color: #0f172a;
    font-weight: 800;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.ground-stock-modal-helper {
    margin: 0;
    color: #64748b;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.45;
}

.gs-form-group {
    display: grid;
    gap: 7px;
}

.gs-form-group span {
    color: #475569;
    font-size: 0.78rem;
    font-weight: 800;
}

.gs-form-group input,
.gs-form-group select,
.gs-form-group textarea {
    width: 100%;
    min-height: 42px;
    border: 1px solid rgba(148, 163, 184, 0.38);
    border-radius: 12px;
    background: #fff;
    color: #0f172a;
    font: inherit;
}

.gs-form-group input,
.gs-form-group select {
    padding: 8px 10px;
}

.gs-form-group textarea {
    min-height: 88px;
    padding: 10px;
    resize: vertical;
}

.gs-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 2px;
}

.gs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 108px;
    min-height: 40px;
    padding: 9px 16px;
    border-radius: 10px;
    font-weight: 800;
    line-height: 1.3;
    white-space: nowrap;
    cursor: pointer;
}

.gs-btn:disabled {
    cursor: wait;
    opacity: 0.72;
}

.ground-stock-modal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.ground-stock-empty-state {
    padding: 24px 12px;
    text-align: center;
    color: var(--admin-text-muted, #64748b);
}

@media (max-width: 1180px) {
    .ground-stock-summary-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .ground-stock-filter-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .ground-stock-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
        margin-bottom: 12px;
    }

    .ground-stock-summary-card {
        min-height: 0;
        padding: 12px;
        border-radius: 16px;
    }

    .ground-stock-summary-card h3 {
        font-size: 1.18rem;
    }

    .ground-stock-summary-note {
        font-size: 0.72rem;
    }

    .ground-stock-filter-bar {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .ground-stock-reconciliation-banner {
        align-items: flex-start;
        margin-bottom: 12px;
        font-size: 0.84rem;
        line-height: 1.35;
    }

    .admin-table-scroll-shell {
        display: none;
    }

    .ground-stock-card-list {
        display: grid;
        gap: 10px;
    }

    .ground-stock-design-chip-row {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .ground-stock-design-chip {
        min-width: 210px;
    }

    .gs-modal-overlay {
        align-items: flex-end;
        padding: 10px;
        overflow-y: auto;
    }

    .gs-modal {
        width: min(100%, calc(100vw - 20px));
        max-height: 88vh;
        border-radius: 20px 20px 16px 16px;
    }

    .gs-modal-header,
    .gs-modal-body {
        padding-left: 16px;
        padding-right: 16px;
    }

    .ground-stock-modal-grid {
        grid-template-columns: 1fr;
    }

    .gs-modal-footer {
        flex-direction: column-reverse;
    }

    .gs-btn {
        width: 100%;
    }
}

.ground-stock-table-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.ground-stock-history-modal {
    width: min(1100px, calc(100vw - 32px));
}

.ground-stock-history-filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.ground-stock-history-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 12px;
}

.ground-stock-history-table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

.ground-stock-history-table th,
.ground-stock-history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    text-align: left;
    vertical-align: top;
    font-size: 0.86rem;
}

.ground-stock-history-table th {
    background: rgba(15, 23, 42, 0.04);
    color: #475569;
    font-weight: 700;
    white-space: nowrap;
}

.ground-stock-history-empty {
    padding: 24px 16px;
    color: #64748b;
    text-align: center;
}

@media (max-width: 430px) {
    .ground-stock-summary-grid,
    .ground-stock-mobile-grid {
        grid-template-columns: 1fr;
    }

    .ground-stock-mobile-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .ground-stock-history-filters {
        grid-template-columns: 1fr;
    }

    .ground-stock-history-modal {
        width: min(100%, calc(100vw - 20px));
    }
}
