:root {
    --lsp-primary: #327365;
    --lsp-secondary: #DEEDEA;
    --lsp-text-light: #ffffff;
    --lsp-text-dark: #333333;
    --lsp-border-color: #4a4a4a;
    --lsp-wrapper-bg: #2d2d2d;
    --lsp-card-bg: #3a3a3a;
    --lsp-admin-card-bg: #3a3a3a;
    --lsp-button-radius: 6px;
    --lsp-card-radius: 16px;
}
.lsp-container { max-width: 1400px; margin: 2em auto; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--lsp-text-light); }
.lsp-dashboard-layout { display: grid; grid-template-columns: 200px 1fr; gap: 2em; }
.lsp-vertical-nav ul { list-style: none; padding: 0; margin: 0; }
.lsp-vertical-nav a { display: block; padding: 0.8em 1em; text-decoration: none; color: #a0a0a0; font-weight: 600; border-radius: 5px; margin-bottom: 0.5em; transition: all 0.2s ease; }
.lsp-vertical-nav a:hover { color: var(--lsp-text-light); background-color: rgba(255, 255, 255, 0.1); }
.lsp-vertical-nav li.active a { background-color: var(--lsp-primary); color: var(--lsp-text-light); }
.lsp-main-content { background-color: var(--lsp-wrapper-bg); border-radius: var(--lsp-wrapper-radius); padding: 2em; }
.lsp-main-content h3, .lsp-main-content h4 { color: var(--lsp-text-light); margin-top: 0; }
.lsp-sub-tabs { list-style: none; padding: 0; margin: 0 0 1.5em 0; font-size: 0.9em; display: flex; align-items: baseline; gap: 0.5em; flex-wrap: wrap; border-bottom: 1px solid var(--lsp-border-color); padding-bottom: 1em; }
.lsp-sub-tabs a { background: #4a4a4a; border: 1px solid #5a5a5a; color: #ccc; padding: 0.5em 1em; border-radius: 5px; text-decoration: none; }
.lsp-sub-tabs li.active a { background: var(--lsp-secondary); border-color: var(--lsp-primary); color: var(--lsp-primary); }
.lsp-card { background: var(--lsp-card-bg); border: 1px solid var(--lsp-border-color); border-radius: var(--lsp-card-radius); padding: 1.5em; margin-bottom: 1.5em; }
.lsp-history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5em; }

/* --- REFINED ORDER CARD LAYOUT (Desktop) --- */
.lsp-order-card .lsp-order-card-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    justify-content: space-between;
    align-items: center;
}
.lsp-order-card .lsp-order-card-row:first-child {
    margin-bottom: 1.5em;
}
/* --- END REFINEMENT --- */

.lsp-order-id { font-weight: bold; }
.lsp-order-date, .lsp-order-summary { font-size: 0.9em; color: #a0a0a0; }
.lsp-order-card-right { text-align: right; }
.lsp-editable-heading { position: relative; cursor: pointer; display: inline-block; }
.lsp-project-name-heading { margin: 0; font-size: 1.5em; font-weight: bold; padding: 5px 8px; min-width: 200px; border: 1px solid transparent; border-radius: 4px; color: var(--lsp-text-light); }
.lsp-project-name-heading.is-placeholder { color: #999; font-style: italic; font-weight: normal; }
.lsp-project-name-heading:focus { outline: none; border-color: #666; background: #2d2d2d; }
.lsp-edit-icon { position: absolute; top: 50%; right: -25px; transform: translateY(-50%); opacity: 0; transition: opacity 0.2s; color: #777; font-size: 0.8em; }
.lsp-editable-heading:hover .lsp-edit-icon { opacity: 1; }
.lsp-actions { display: flex; flex-wrap: wrap; gap: 0.75em; align-items: center; }
.lsp-actions-footer { justify-content: flex-end; }
.lsp-button { display: inline-block; padding: 0.6em 1.2em; background-color: #4a4a4a; color: #ccc; border-radius: var(--lsp-button-radius); text-decoration: none; border: 1px solid #5a5a5a; cursor: pointer; transition: all 0.2s ease; font-weight: 500; font-size: 0.9em; }
.lsp-button:hover { background-color: #5a5a5a; color: var(--lsp-text-light); }
.lsp-button-primary { background-color: var(--lsp-primary); color: var(--lsp-text-light); border-color: var(--lsp-primary); }
.lsp-button-primary:hover { background-color: #4a8a7b; }
.lsp-button:disabled, .lsp-button.is-disabled { background-color: #333; border-color: #444; color: #666; cursor: not-allowed; opacity: 0.6; }
.lsp-button:disabled:hover, .lsp-button.is-disabled:hover { background-color: #333; color: #666; }
.lsp-meta-bar { display: flex; flex-wrap: wrap; gap: 0.75em; font-size: 0.85em; }
.lsp-meta-bar span { background-color: rgba(0,0,0,0.2); padding: 0.3em 0.8em; border-radius: 20px; color: #ccc; }
.lsp-table, .wp-list-table { width: 100%; border-collapse: collapse; margin: 1.5em 0; }
.lsp-table th, .lsp-table td, .wp-list-table th, .wp-list-table td {
    padding: 0.8em 1em;
    text-align: left;
    border-bottom: 1px solid var(--lsp-border-color);
    vertical-align: middle;
    color: #ccc;
}
.lsp-table thead th, .wp-list-table thead th {
    border-bottom: none !important;
    background-color: rgba(0,0,0,0.1);
    font-size: 0.85em;
    text-transform: uppercase;
    color: var(--lsp-text-light);
}
.lsp-table .lsp-col-quantity { text-align: center; width: 120px; }
.lsp-table .lsp-col-image { width: 80px; }
.lsp-table .lsp-col-image img { width: 60px; height: 60px; object-fit: cover; border-radius: 4px; }
.lsp-sku-meta { display: block; font-size: 0.85em; color: #777; }
.lsp-request-project-name { margin-top: 0; font-weight: bold; color: var(--lsp-text-light); }
.lsp-form-field-date { margin: 1.5em 0; }
.lsp-form-field-date input { max-width: 200px; }
.lsp-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2em; }
.lsp-form-section { display: flex; flex-direction: column; gap: 1em; }
.lsp-form-section strong { font-size: 1.1em; margin-bottom: 0.5em; display: block; }
.lsp-form input[type="text"], .lsp-form input[type="email"], .lsp-form input[type="tel"], .lsp-form input[type="date"], .lsp-form input[type="number"], .lsp-form textarea, .lsp-qty-input { width: 100%; padding: 0.8em; border: 1px solid var(--lsp-border-color) !important; border-radius: var(--lsp-button-radius) !important; background: #555 !important; color: #E0E0E0 !important; box-sizing: border-box; }
.lsp-form input[type="date"] { color-scheme: dark !important; }
.lsp-form ::placeholder { color: #a0a0a0 !important; opacity: 1 !important; }
.lsp-form :-ms-input-placeholder { color: #a0a0a0 !important; }
.lsp-form ::-ms-input-placeholder { color: #a0a0a0 !important; }
.lsp-form textarea { min-height: 120px; }
.lsp-qty-input { width: 80px; text-align: center; }
.lsp-form-response { padding: 1em; margin: 1em 0; border-radius: var(--lsp-button-radius); display: none; }
.lsp-form-response.is-error { display: block; background: #ffebee; color: #b71c1c; }
.lsp-form-response.is-success { display: block; background: #e8f3ef; color: #275e53; }
.lsp-spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.2); border-top-color: var(--lsp-secondary); border-radius: 50%; animation: lsp-spin 1s linear infinite; opacity: 0; transition: opacity 0.2s; position: absolute; top: 50%; right: 8px; margin-top: -8px; }
.lsp-spinner.is-active { opacity: 1; }
@keyframes lsp-spin { to { transform: rotate(360deg); } }

/* --- FINAL MODAL STYLES --- */
body.lsp-modal-is-open {
    overflow: hidden !important;
}
.lsp-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 2em;
    box-sizing: border-box;
}
.lsp-modal-overlay.is-visible {
    display: flex;
}
.lsp-modal-content {
    background: var(--lsp-wrapper-bg);
    color: var(--lsp-text-light);
    border-radius: var(--lsp-card-radius);
    width: 100%;
    max-width: 800px;
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    padding: 0;
}
#lsp-ship-form {}
.lsp-modal-header,
.lsp-modal-body,
.lsp-modal-footer {
    padding: 1.5em;
    box-sizing: border-box;
    flex-shrink: 0;
}
.lsp-modal-header {
    border-bottom: 1px solid var(--lsp-border-color);
}
.lsp-modal-body {
    padding: 1.5em;
    box-sizing: border-box;
    overflow-y: auto !important;
    max-height: calc(90vh - 180px);
}
.lsp-modal-footer {
    border-top: 1px solid var(--lsp-border-color);
    text-align: right;
}
.lsp-modal-close {
    position: absolute;
    top: 1em;
    right: 1em;
    background: none;
    border: none;
    color: #888;
    font-size: 1.5em;
    cursor: pointer;
    line-height: 1;
    z-index: 10;
}
.lsp-modal-close:hover {
    color: var(--lsp-text-light);
}

.lsp-request-table .lsp-qty-input, .lsp-short-ship-table input[type="number"] { min-width: 80px; box-sizing: border-box; }

.lsp-pill-edited { background-color: #881e1e !important; color: #fff !important; }
.lsp-view-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5em; border-bottom: 1px solid var(--lsp-border-color); padding-bottom: 1.5em; margin-bottom: 1.5em; }
.lsp-view-header-main h3 { margin-bottom: 0.75em; }
.lsp-view-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2em; margin-bottom: 1.5em; }
.lsp-address-box { background: rgba(0,0,0,0.1); border-radius: var(--lsp-button-radius); padding: 1.5em; height: 100%; }
.lsp-address-box h4, .lsp-view-section h4 { margin-top: 0; }
.lsp-view-section address { font-style: normal; line-height: 1.6; color: #a0a0a0; }
.lsp-view-section a { color: var(--lsp-secondary); }
.lsp-view-shipment .lsp-card-footer { margin-top: 2em; padding-top: 1.5em; border-top: 1px solid var(--lsp-border-color); }
.pill { display: inline-block; padding: 3px 9px; margin-right: 8px; border-radius: 12px; font-size: 7.5pt; font-weight: normal; color: var(--lsp-text-dark); }
.pill-requested { background-color: #DEEDEA !important; }
.pill-target { background-color: #cde2da !important; }
.pill-shipped { background-color: #b3d3c3 !important; }
.pill-received { background-color: #a0c8b6 !important; }
.lsp-shipment-group-header { background-color: #4a4a4a; font-weight: bold; color: #ffffff; text-align: left !important; }

/* --- DELIVERY PROGRESS (ALWAYS OPEN) --- */
.lsp-progress-dashboard {
    width: 100% !important;
    display: block !important;
}
.lsp-progress-order-group.lsp-card { 
    width: 100% !important; 
    display: block !important;
    margin-bottom: 1.5em;
}
.lsp-progress-order-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: baseline; 
    cursor: default; /* No longer clickable */
}
.lsp-progress-project-name { 
    font-size: 1em; 
    color: #a0a0a0; 
    font-weight: normal; 
    margin-left: 1.5em; 
    flex-grow: 1; 
}
.lsp-toggle-arrow { 
    display: none; /* Hide the arrow */
}
.lsp-collapsible-content { 
    display: block !important; /* Force open */
    padding-top: 1.5em; 
    border-top: 1px solid var(--lsp-border-color); 
    margin-top: 1.5em; 
}
.lsp-progress-summary { display: flex; gap: 2em; margin-bottom: 1.5em; padding: 1em; background-color: rgba(0,0,0,0.1); border-radius: 8px; }
.lsp-summary-item { display: flex; flex-direction: column; font-size: 0.9em; color: #a0a0a0; }
.lsp-summary-item strong { font-size: 1.5em; color: var(--lsp-text-light); font-weight: bold; }
.lsp-progress-table .lsp-col-product { width: 40%; }
.lsp-progress-table .lsp-col-progress { width: 30%; }
.lsp-product-info { display: flex; align-items: center; gap: 1em; }
.lsp-product-info img { width: 50px; height: 50px; border-radius: 4px; object-fit: cover; }
.lsp-progress-bar { position: relative; height: 20px; background-color: rgba(255,255,255,0.1); border-radius: 10px; overflow: hidden; }
.lsp-progress-received, .lsp-progress-requested { position: absolute; top: 0; bottom: 0; transition: width 0.3s; }
.lsp-progress-received { background-color: var(--lsp-primary); z-index: 2; }
.lsp-progress-requested { background-color: var(--lsp-secondary); opacity: 0.5; z-index: 1; }
.lsp-progress-text { font-size: 0.8em; color: #a0a0a0; margin-top: 4px; }

/* --- ADMIN VIEW CARD STYLES --- */
.lsp-admin-cards-view .lsp-admin-toolbar { margin-bottom: 1.5em; }
.lsp-grid-admin-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 1.5em; }
.lsp-admin-card { background: var(--lsp-card-bg); border: 1px solid var(--lsp-border-color); border-radius: var(--lsp-card-radius); }
.lsp-admin-card-header { display: flex; justify-content: space-between; padding: 1em 1.5em; border-bottom: 1px solid var(--lsp-border-color); font-weight: bold; }
.lsp-admin-card-body { padding: 1.5em; }
.lsp-admin-card-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 1em; font-size: 0.9em; margin: 1em 0; }
.lsp-admin-card-meta strong { color: #a0a0a0; }
.lsp-admin-card-shipments { display: grid; grid-template-columns: 1fr 1fr; gap: 1em; font-size: 0.9em; margin-top: 1.5em; }
.lsp-admin-card-shipments strong { display: block; margin-bottom: 0.5em; color: #a0a0a0; }
.lsp-pill-group { display: flex; flex-wrap: wrap; gap: 0.5em; }
.lsp-pill-group .lsp-pill { background: #4a4a4a; border: 1px solid #5a5a5a; color: #ccc; padding: 0.3em 0.8em; border-radius: 20px; text-decoration: none; font-size: 0.9em; }
.lsp-pill-group .lsp-pill.lsp-pill-shipped { background: var(--lsp-primary); color: var(--lsp-text-light); }
.lsp-admin-card-actions { padding: 1.5em; border-top: 1px solid var(--lsp-border-color); justify-content: flex-start; }


/* ==========================================================================
   RESPONSIVE STYLES (TABLET & MOBILE)
   ========================================================================== */

@media (max-width: 900px) {
    
    /* --- Main Layout --- */
    .lsp-dashboard-layout {
        grid-template-columns: 1fr;
    }
    .lsp-vertical-nav {
        margin-bottom: 2em;
    }
    .lsp-main-content {
        padding: 1em;
    }
    
    /* --- Grids --- */
    .lsp-form-grid,
    .lsp-view-grid,
    .lsp-admin-card-meta,
    .lsp-admin-card-shipments,
    .lsp-grid-admin-cards {
        grid-template-columns: 1fr;
    }

    /* --- JUMBLED SUB-TABS FIX --- */
    .lsp-sub-tabs {
        flex-direction: column;
        gap: 0.5em;
        border-bottom: none; /* Remove bottom border */
    }
    .lsp-sub-tabs li {
        width: 100%;
        box-sizing: border-box;
    }
    .lsp-sub-tabs li a {
        display: block;
        text-align: center;
    }
    .lsp-sub-tabs li.lsp-sub-tabs-label {
        text-align: center;
        padding: 0.5em 0;
        border-bottom: 1px solid var(--lsp-border-color);
        margin-bottom: 0.5em;
        width: 100%;
    }
    /* --- END SUB-TABS FIX --- */

    /* --- HYBRID ORDER CARD LAYOUT (MOBILE) --- */
    .lsp-order-card .lsp-order-card-row:first-child {
        flex-direction: column-reverse; /* Puts 2nd item (Project Name) on top */
        align-items: flex-start;
        gap: 0.5em;
    }
    .lsp-order-card .lsp-order-card-right {
        display: block; /* Make it visible again */
        width: 100%;
        text-align: left; /* Align left on mobile */
    }
    .lsp-order-card .lsp-order-card-row:last-child {
        flex-direction: column;
        align-items: stretch;
    }
    .lsp-order-card .lsp-order-card-row:last-child .lsp-actions {
        flex-direction: column;
    }
    .lsp-order-card .lsp-order-card-row:last-child .lsp-actions .lsp-button {
        width: 100%;
        text-align: center;
    }
    /* --- END HYBRID ORDER CARD --- */
    
    /* --- General Table Stacking (Card View) --- */
    .lsp-table thead {
        display: none; /* Hide desktop headers */
    }
    .lsp-table tr,
    .lsp-table tbody {
        display: block;
        width: 100%;
    }
    .lsp-table tr {
        background: var(--lsp-card-bg);
        border: 1px solid var(--lsp-border-color);
        border-radius: var(--lsp-card-radius);
        margin-bottom: 1.5em;
        padding: 1em;
        box-sizing: border-box;
    }
    .lsp-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: right;
        padding: 0.8em 0.5em;
        width: 100% !important;
        border-bottom: 1px dotted var(--lsp-border-color);
        flex: none !important;
        order: initial !important;
    }
    .lsp-table tr:last-child {
         margin-bottom: 0;
    }
    .lsp-table td:last-child {
        border-bottom: none;
    }
    
    .lsp-table td[data-label]::before {
        content: attr(data-label);
        text-align: left;
        font-weight: bold;
        color: #ffffff;
        text-transform: uppercase;
        font-size: 0.85em;
        margin-right: 1em;
    }
    
    /* --- Table-Specific Adjustments --- */
    
    .lsp-table td.lsp-col-image {
        justify-content: center;
    }
    .lsp-table td.lsp-col-image::before {
        display: none;
    }
    
    .lsp-table td[data-label="Product"] {
        display: block;
        text-align: left !important;
        font-size: 1.1em;
        font-weight: bold;
        padding-bottom: 1em;
    }
    .lsp-table td[data-label="Product"]::before {
        display: none;
    }
    .lsp-table .lsp-product-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5em;
    }

    .lsp-request-table .lsp-qty-input {
        width: 100px;
        margin-left: auto;
    }
    
    .lsp-table td.lsp-col-progress {
         text-align: right !important;
    }
    .lsp-table td.lsp-col-progress .lsp-progress-bar {
        width: 60%;
        display: inline-block;
        margin-left: auto;
    }
     .lsp-table td.lsp-col-progress .lsp-progress-text {
        text-align: right;
        margin-top: 8px;
    }
    
    .lsp-actions .lsp-button {
         width: 100%;
         text-align: center;
         box-sizing: border-box;
    }
    .lsp-view-history .lsp-card-footer {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.75em;
    }
}
