* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f7f7fb;
    color: #25252d;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 250px;
    background: #18151f;
    color: white;
    padding: 28px 18px;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 35px;
}

.brand-logo {
    font-size: 30px;
}

.brand h2 {
    margin: 0;
    font-size: 20px;
}

.brand span {
    font-size: 12px;
    color: #aaa6b5;
}

nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

nav a {
    text-decoration: none;
    color: #c8c5cf;
    padding: 12px 14px;
    border-radius: 9px;
}

nav a:hover,
nav a.active {
    background: #2a2634;
    color: white;
}

.environment {
    margin-top: auto;
    padding: 10px;
    border-radius: 8px;
    background: #302b3b;
    text-align: center;
    font-size: 11px;
    letter-spacing: 1px;
}

.content {
    margin-left: 250px;
    padding: 38px;
}

.page-header h1 {
    margin: 0;
    font-size: 30px;
}

.page-header p {
    margin-top: 7px;
    color: #777381;
}

.cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin: 30px 0;
}

.card,
.panel {
    background: white;
    border-radius: 14px;
    padding: 22px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

.card span {
    display: block;
    color: #777381;
    font-size: 13px;
}

.card strong {
    display: block;
    margin: 12px 0 6px;
    font-size: 27px;
}

.card small {
    color: #aaa6b5;
}

.panel h2 {
    margin-top: 0;
}

@media (max-width: 1000px) {
    .cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

.admin-profile {
    margin-top: auto;
    padding: 14px;
    background: #24202d;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-profile strong {
    font-size: 13px;
}

.admin-profile span {
    color: #aaa6b5;
    font-size: 11px;
}

.admin-profile a {
    color: #ffffff;
    font-size: 12px;
    margin-top: 6px;
}

.environment {
    margin-top: 10px;
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f7f7fb;
}

.login-card {
    width: 390px;
    background: white;
    padding: 34px;
    border-radius: 18px;
    box-shadow: 0 10px 35px rgba(0,0,0,0.08);
}

.login-brand {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo {
    font-size: 42px;
}

.login-brand h1 {
    margin: 8px 0 2px;
}

.login-brand p {
    margin: 0;
    color: #777381;
}

.login-card form {
    display: flex;
    flex-direction: column;
}

.login-card label {
    margin-bottom: 6px;
    margin-top: 15px;
    font-size: 13px;
    font-weight: 600;
}

.login-card input {
    padding: 12px;
    border: 1px solid #ddd9e3;
    border-radius: 9px;
    font-size: 14px;
}

.login-card button {
    margin-top: 22px;
    padding: 12px;
    border: 0;
    border-radius: 9px;
    background: #18151f;
    color: white;
    cursor: pointer;
    font-size: 14px;
}

.login-card button:hover {
    background: #2a2634;
}

.alert {
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 13px;
}

.alert.error {
    background: #fdeaea;
    color: #a33;
}

.login-env {
    text-align: center;
    margin-top: 20px;
    font-size: 10px;
    color: #999;
    letter-spacing: 1px;
}

.button{display:inline-block;background:#18151f;color:white;text-decoration:none;padding:11px 16px;border-radius:9px}.page-header{display:flex;justify-content:space-between;align-items:center}.data-table{width:100%;border-collapse:collapse}.data-table th,.data-table td{text-align:left;padding:14px;border-bottom:1px solid #eeeaf2}.data-table th{font-size:12px;color:#777381;text-transform:uppercase}.form-panel{max-width:650px}.form-panel form{display:flex;flex-direction:column}.form-panel label{font-weight:600;font-size:13px;margin:15px 0 6px}.form-panel input,.form-panel select{padding:12px;border:1px solid #ddd9e3;border-radius:9px;background:white;font-size:14px}.form-actions{display:flex;justify-content:flex-end;align-items:center;gap:15px;margin-top:25px}.form-actions a{color:#777381;text-decoration:none}.form-actions button{border:0;background:#18151f;color:white;padding:11px 18px;border-radius:9px;cursor:pointer}.alert.success{background:#eaf7ee;color:#28733c}

.access-tabs{display:flex;gap:6px;margin:24px 0 18px}.access-tabs a{text-decoration:none;color:#777381;background:white;padding:10px 16px;border-radius:9px}.access-tabs a.active{background:#18151f;color:white}

.form-panel textarea{padding:12px;border:1px solid #ddd9e3;border-radius:9px;background:white;font-size:14px;font-family:inherit;resize:vertical}.empty-state{text-align:center;padding:45px 20px}.empty-state h3{margin-bottom:8px}.empty-state p{color:#777381;margin-bottom:20px}

.nav-section{margin:22px 14px 7px;color:#767180;font-size:10px;font-weight:700;letter-spacing:1.2px;text-transform:uppercase}.nav-section:first-child{margin-top:0}

.filters{display:flex;flex-wrap:wrap;gap:10px;align-items:center;margin:24px 0}.filters input,.filters select{padding:10px 12px;border:1px solid #ddd9e3;border-radius:9px;background:white;min-height:40px}.filters input{min-width:230px}.filters button{border:0;background:#18151f;color:white;padding:11px 16px;border-radius:9px;cursor:pointer}.filters a{color:#777381;text-decoration:none;padding:10px}

/* Keep wide admin tables contained inside the main content area */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

.content {
    min-width: 0;
    max-width: calc(100vw - 250px);
}

.panel {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

@media (max-width: 700px) {
    .sidebar {
        position: relative;
        width: 100%;
        min-height: auto;
    }

    .content {
        margin-left: 0;
        max-width: 100%;
        width: 100%;
    }
}

/* Page navigation */
.page-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #5f5a68;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.back-link:hover {
    color: #18151f;
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    color: #8a8591;
    font-size: 13px;
}

.breadcrumbs a {
    color: #777381;
    text-decoration: none;
}

.breadcrumbs a:hover {
    color: #18151f;
}

.breadcrumb-separator {
    color: #bbb7c2;
}

@media (max-width: 700px) {
    .page-nav {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Compact table actions */
.table-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.table-actions a,
.table-actions button {
    font: inherit;
    font-size: 13px;
    text-decoration: none;
    border: 0;
    background: none;
    padding: 0;
    cursor: pointer;
}

.table-actions a {
    color: #5f5870;
}

.table-actions a:hover {
    color: #18151f;
    text-decoration: underline;
}

.table-action-danger {
    color: #b34a4a;
}

.table-action-danger:hover {
    color: #8f3030;
    text-decoration: underline;
}

.table-action-success {
    color: #39724d;
}

.table-action-success:hover {
    color: #28583a;
    text-decoration: underline;
}

/* Order form */




.order-item-price,
.order-item-subtotal {
    white-space: nowrap;
    font-size: 14px;
}

@media (max-width: 800px) {

}

.form-grid {
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:20px;
}

.form-grid label {
    display:block;
    margin-bottom:8px;
}

.form-grid select {
    width:100%;
}

.order-summary-layout {
    display:grid;
    grid-template-columns:2fr 1fr;
    gap:20px;
    margin-top:20px;
}

.order-summary-card {
    height:fit-content;
}

@media(max-width:900px){
    .form-grid,
    .order-summary-layout {
        grid-template-columns:1fr;
    }
}


/* Order form polish */

.order-information {
    padding: 24px;
}

.order-information h2 {
    margin-bottom: 22px;
}


.form-grid {
    gap: 18px 24px;
}


.form-grid select,
.form-grid input,
.form-panel select,
.form-panel input,
.form-panel textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid #ddd9e3;
    border-radius: 10px;
    background: white;
    font-size: 14px;
    font-family: inherit;
}


.form-grid select,
.form-panel select {
    cursor: pointer;
}


.order-items-panel {
    padding: 24px;
}


.order-items-table th {
    font-size: 12px;
    font-weight: 700;
}


.order-summary-layout {
    align-items: start;
}


.order-summary-card {
    padding: 24px;
}


.form-actions {
    margin-top: 20px;
}




/* Responsive content sizing */

.content {
    margin-left: 250px;
    padding: 32px;
    width: calc(100% - 250px);
    max-width: none;
}


/* Order information */

.order-top-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}


.order-top-layout .panel {
    min-width: 0;
}


/* Bottom order section */

.order-bottom-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 20px;
    align-items: start;
}


/* Inputs should fill card width */

.order-top-layout select,
.order-top-layout input {
    width: 100%;
}


/* Order items */

.order-items-table-wrapper {
    width: 100%;
    overflow-x: auto;
}


.order-items-table {
    width: 100%;
    table-layout: fixed;
}


.order-items-table th:nth-child(1) {
    width: 55%;
}

.order-items-table th:nth-child(2) {
    width: 10%;
}

.order-items-table th:nth-child(3),
.order-items-table th:nth-child(4) {
    width: 15%;
}

.order-items-table th:last-child {
    width: 5%;
}


/* Smaller screens */

@media (max-width: 1200px) {

    .order-top-layout,
    .order-bottom-layout {
        grid-template-columns: 1fr;
    }

}


@media (max-width: 800px) {

    .content {
        margin-left: 0;
        width: 100%;
        padding: 20px;
    }

}




/* Order creation layout */
.order-bottom-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr);
    gap: 24px;
    align-items: start;
}

.order-submit-actions {
    justify-content: flex-end;
    margin-top: 20px;
}


/* Better select/input styling */
.form-panel select,
.form-panel input,
.form-panel textarea,
.order-items-table select,
.order-items-table input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd9e3;
    border-radius: 10px;
    background: white;
    font-size: 14px;
    font-family: inherit;
}

.form-panel select:focus,
.form-panel input:focus,
.form-panel textarea:focus,
.order-items-table select:focus,
.order-items-table input:focus {
    outline: none;
    border-color: #18151f;
}


/* Responsive order layout */
@media (max-width: 900px) {
    .order-bottom-layout {
        grid-template-columns: 1fr;
    }
}


/* Order Items Table */
.order-items-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
}

.order-items-table th {
    padding: 0 12px 8px;
    font-size: 12px;
    color: #777381;
    text-transform: uppercase;
    text-align: left;
}

.order-items-table td {
    padding: 0 12px;
    vertical-align: middle;
}

.order-items-table th:first-child,
.order-items-table td:first-child {
    width: auto;
}

.order-items-table th:nth-child(2),
.order-items-table td:nth-child(2) {
    width: 90px;
}

.order-items-table th:nth-child(3),
.order-items-table td:nth-child(3),
.order-items-table th:nth-child(4),
.order-items-table td:nth-child(4) {
    width: 130px;
}

.order-items-table th:last-child,
.order-items-table td:last-child {
    width: 60px;
    text-align: center;
}


.order-items-table select {
    min-height: 42px;
}


.order-items-table input {
    min-height: 42px;
}


.order-item-price,
.order-item-subtotal {
    font-weight: 600;
    white-space: nowrap;
}


.table-action-danger {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid #ddd9e3;
    background: white;
    cursor: pointer;
    font-size: 16px;
}

.table-action-danger:hover {
    background: #f7f0f2;
}




/* ===== Order Page Layout Refinement ===== */

.order-summary-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 24px;
    align-items: start;
}


.order-summary-card {
    height: fit-content;
}


/* Order items spacing */
.order-items-panel {
    padding-bottom: 28px;
}


.order-items-table-wrapper {
    margin-top: 18px;
}


.order-items-table th {
    padding-bottom: 12px;
}


.order-items-table td {
    padding-top: 6px;
    padding-bottom: 6px;
}


/* Buttons alignment */
.order-submit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 18px;
}


/* Remove number input spinner */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    appearance: textfield;
}


/* Responsive */
@media (max-width: 900px) {

    .order-summary-layout {
        grid-template-columns: 1fr;
    }

    .order-submit-actions {
        justify-content: stretch;
    }

}




/* Order page vertical spacing */
.order-top-layout {
    display: grid;
    gap: 24px;
}








/* ===== Order Page Layout Cleanup ===== */

.order-page {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.order-bottom-layout {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    gap: 24px;
    align-items: start;
}

.order-summary-card {
    height: fit-content;
}

.order-submit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

@media (max-width: 900px) {
    .order-bottom-layout {
        grid-template-columns: 1fr;
    }
}



/* Order items empty state */
.order-items-empty {
    min-height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-align: center;
    color: #777381;
    border-top: 1px solid #eeeaf2;
}

.order-items-empty strong {
    color: #3b3742;
    font-size: 14px;
}

.order-items-empty span {
    font-size: 13px;
}

#add-order-item:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}


/* ===== Order Item Row Polish ===== */

.order-items-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.order-items-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
    table-layout: fixed;
}

.order-items-table th,
.order-items-table td {
    padding: 0 10px;
    vertical-align: middle;
}

.order-items-table th:first-child,
.order-items-table td:first-child {
    padding-left: 0;
}

.order-items-table th:last-child,
.order-items-table td:last-child {
    padding-right: 0;
}

/* Product */
.order-items-table th:nth-child(1),
.order-items-table td:nth-child(1) {
    width: auto;
    text-align: left;
}

/* Quantity */
.order-items-table th:nth-child(2),
.order-items-table td:nth-child(2) {
    width: 100px;
    text-align: center;
}

/* Unit price */
.order-items-table th:nth-child(3),
.order-items-table td:nth-child(3) {
    width: 120px;
    text-align: right;
}

/* Subtotal */
.order-items-table th:nth-child(4),
.order-items-table td:nth-child(4) {
    width: 120px;
    text-align: right;
}

/* Action */
.order-items-table th:nth-child(5),
.order-items-table td:nth-child(5) {
    width: 80px;
    text-align: right;
}

.order-items-table select {
    width: 100%;
    min-width: 0;
    height: 42px;
    padding: 0 38px 0 12px;
    border: 1px solid #ddd9e3;
    border-radius: 9px;
    background: white;
    font: inherit;
}

.order-items-table input[type="number"] {
    width: 100%;
    height: 42px;
    padding: 0 10px;
    border: 1px solid #ddd9e3;
    border-radius: 9px;
    background: white;
    text-align: center;
    font: inherit;
}

.order-item-price,
.order-item-subtotal {
    display: block;
    white-space: nowrap;
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.order-item-remove {
    border: 0;
    background: transparent;
    padding: 8px 0;
    color: #a34b54;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.order-item-remove:hover {
    text-decoration: underline;
}

@media (max-width: 850px) {
    .order-items-table {
        min-width: 700px;
    }
}


/* Table-safe order item rows */
.order-items-table tr.order-item-row {
    display: table-row;
}

.order-items-table tr.order-item-row > td {
    display: table-cell;
}

/* ===== Order Items Final Alignment ===== */

.order-items-panel .section-header {
    margin-bottom: 20px;
}

.order-items-table {
    width: 100%;
    table-layout: fixed;
    border-spacing: 0 8px;
}

.order-items-table th,
.order-items-table td {
    box-sizing: border-box;
    vertical-align: middle;
}

/* Product */
.order-items-table th:nth-child(1),
.order-items-table td:nth-child(1) {
    width: 55%;
    text-align: left;
}

/* Qty */
.order-items-table th:nth-child(2),
.order-items-table td:nth-child(2) {
    width: 10%;
    text-align: center;
}

/* Unit Price */
.order-items-table th:nth-child(3),
.order-items-table td:nth-child(3) {
    width: 12%;
    text-align: right;
}

/* Subtotal */
.order-items-table th:nth-child(4),
.order-items-table td:nth-child(4) {
    width: 12%;
    text-align: right;
}

/* Action */
.order-items-table th:nth-child(5),
.order-items-table td:nth-child(5) {
    width: 11%;
    text-align: right;
}

.order-items-table td:first-child select {
    width: 100%;
}

.order-items-table td:nth-child(2) input {
    width: 72px;
    max-width: 100%;
    margin: 0 auto;
    display: block;
}

.order-item-price,
.order-item-subtotal {
    text-align: right;
}

.order-item-remove {
    white-space: nowrap;
}

/* Keep headers and values vertically consistent */
.order-items-table thead th {
    padding-top: 0;
    padding-bottom: 10px;
}

.order-items-table tbody td {
    padding-top: 4px;
    padding-bottom: 4px;
}


/* ===== Order Detail ===== */

.order-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    gap: 20px;
    margin-bottom: 20px;
}

.order-detail-grid > .panel,
.order-detail-bottom > .panel {
    margin: 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px 32px;
    margin-top: 22px;
}

.detail-grid > div {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.detail-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: #74717f;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.detail-grid small {
    color: #74717f;
}

.order-detail-items {
    margin-bottom: 20px;
}

.order-detail-items h2 {
    margin-bottom: 22px;
}

.order-detail-bottom {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    gap: 20px;
    align-items: start;
}

.detail-notes {
    margin-top: 24px;
}

.detail-notes p {
    margin-bottom: 0;
    white-space: pre-wrap;
}

.order-detail-bottom .order-summary-card {
    align-self: start;
}

@media (max-width: 900px) {
    .order-detail-grid,
    .order-detail-bottom {
        grid-template-columns: 1fr;
    }
}

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


/* ===== Order Workflow Actions ===== */

.order-actions-panel {
    margin-top: 20px;
}

.order-actions-panel h2 {
    margin-bottom: 20px;
}

.order-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.order-actions form {
    margin: 0;
}

.order-actions button {
    width: auto;
}

.order-actions .button-danger {
    background: transparent;
    color: #b14c52;
    border: 1px solid #d9a7aa;
}

.order-actions .button-danger:hover {
    background: #fff3f3;
}



/* ===== Order Action Button Polish ===== */

.order-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.order-actions form {
    margin: 0;
}

.order-actions button {
    min-height: 40px;
    padding: 9px 15px;
    border-radius: 9px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background .15s ease,
        border-color .15s ease,
        color .15s ease,
        transform .05s ease;
}

.order-action-primary {
    background: #18151f;
    color: #fff;
    border: 1px solid #18151f;
}

.order-action-primary:hover {
    background: #2a2634;
    border-color: #2a2634;
}

.order-action-danger {
    background: #fff;
    color: #a9444c;
    border: 1px solid #dfb5b8;
}

.order-action-danger:hover {
    background: #fff5f5;
    border-color: #c97e84;
}

.order-actions button:active {
    transform: translateY(1px);
}



/* ===== Order Payment Ledger ===== */

.order-ledger-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.order-ledger-grid > .panel {
    margin: 0;
}

.order-ledger-grid h2 {
    margin-bottom: 20px;
}

.order-ledger-table .money-cell {
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.compact-empty-state {
    padding: 25px 10px;
}

.pending-charge-warning {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 9px;
    background: #f7f4ea;
    color: #6d6037;
    font-size: 13px;
    line-height: 1.45;
}

.ledger-credit {
    margin-top: 14px;
    font-size: 13px;
    color: #39724d;
}

@media (max-width: 900px) {
    .order-ledger-grid {
        grid-template-columns: 1fr;
    }
}


/* ===== Order Ledger Actions ===== */

.ledger-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ledger-actions form {
    margin: 0;
}

.ledger-actions .table-action,
.ledger-actions .table-action-danger {
    white-space: nowrap;
}



/* Waived payment summary */
.summary-row-muted {
    color: #777381;
}

.summary-row-muted strong {
    color: #777381;
}


/* ===== Orders Financial Summary ===== */

#orders .money-cell {
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.pending-charge-text {
    color: #8a6d3b;
    font-weight: 600;
    white-space: nowrap;
}


/* Allow searchable customer/project dropdowns to extend outside Order Information */
.order-information {
    overflow: visible;
    position: relative;
    z-index: 20;
}

.order-items-panel {
    position: relative;
    z-index: 1;
}

/* Limit searchable Customer / Project dropdown height */
.search-select-menu {
    max-height: 240px;
    overflow-y: auto;
    overscroll-behavior: contain;
}


/* ===== Scrollable Sidebar Navigation ===== */

.sidebar {
    height: 100vh;
    overflow: hidden;
}

.sidebar nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    margin-right: -4px;
}

/* Subtle scrollbar */
.sidebar nav {
    scrollbar-width: thin;
    scrollbar-color: #4a4455 transparent;
}

.sidebar nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar nav::-webkit-scrollbar-thumb {
    background: #4a4455;
    border-radius: 999px;
}

.sidebar nav::-webkit-scrollbar-thumb:hover {
    background: #625b70;
}

/* Keep profile/footer from shrinking */
.admin-profile,
.environment {
    flex-shrink: 0;
}


/* ===== Clickable Moonhaus Brand ===== */

.brand-link {
    color: inherit;
    text-decoration: none;
    cursor: pointer;
}

.brand-link:hover,
.brand-link:focus,
.brand-link:visited {
    color: inherit;
    text-decoration: none;
}


/* ===== Moonhaus Sidebar Logo ===== */

.brand-logo {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;

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

.brand-logo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}


/* ===== Development Environment Watermark ===== */

.dev-watermark {
    position: fixed;
    inset: 0 0 0 250px;
    z-index: 0;

    overflow: hidden;
    pointer-events: none;

    display: grid;
    grid-template-columns: repeat(2, 1fr);
    align-content: space-around;

    padding: 50px;

    opacity: 0.035;
}

.dev-watermark span {
    display: block;

    color: #18151f;

    font-size: clamp(36px, 4vw, 72px);
    font-weight: 800;
    letter-spacing: 5px;
    white-space: nowrap;

    transform: rotate(-25deg);

    text-align: center;
}

.content {
    position: relative;
    z-index: 1;
}

.sidebar {
    z-index: 100;
}

@media (max-width: 700px) {
    .dev-watermark {
        inset: 0;
        grid-template-columns: 1fr;
    }
}


/* ===== Customer Links ===== */

.customer-link {
    color: #51485d;
    font-weight: 600;
    text-decoration: none;
}

.customer-link:hover {
    color: #18151f;
    text-decoration: underline;
}


/* ===== Order Fulfilment ===== */

.order-action-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 40px;
    padding: 9px 15px;

    border: 1px solid #18151f;
    border-radius: 9px;

    background: #18151f;
    color: #fff;

    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.order-action-link:hover {
    background: #2a2634;
    color: #fff;
    text-decoration: none;
}

.fulfilment-fields[hidden] {
    display: none;
}

.fulfilment-fields {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #eeeaf2;
}

.fulfilment-section-title {
    margin-bottom: 4px;

    color: #777381;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.fulfilment-two-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.fulfilment-two-column > div {
    min-width: 0;
}

@media (max-width: 650px) {
    .fulfilment-two-column {
        grid-template-columns: 1fr;
    }
}


/* ===== Order Fulfilment Details ===== */

.order-fulfilment-details {
    margin-bottom: 20px;
}

.order-fulfilment-details .section-header {
    margin-bottom: 22px;
}

.fulfilment-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px 30px;
}

.fulfilment-detail-grid > div {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.fulfilment-detail-section {
    margin-top: 24px;
    padding-top: 22px;
    border-top: 1px solid #eeeaf2;
}

.fulfilment-detail-section h3 {
    margin: 0 0 18px;
    font-size: 15px;
}

.fulfilment-address,
.fulfilment-reference {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 20px;
}

.fulfilment-address strong {
    line-height: 1.55;
}

.fulfilment-notes {
    margin: 7px 0 0;
    white-space: pre-wrap;
    line-height: 1.55;
}

.button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 36px;
    padding: 7px 13px;

    border: 1px solid #d9d4dd;
    border-radius: 8px;

    background: #fff;
    color: #514a58;

    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

.button-secondary:hover {
    background: #f7f5f8;
    color: #18151f;
    text-decoration: none;
}

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

@media (max-width: 600px) {
    .fulfilment-detail-grid {
        grid-template-columns: 1fr;
    }
}


/* ===== Preorder Demand ===== */

.preorder-demand-summary {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid #eeeaf2;
}

.preorder-demand-summary h3 {
    margin: 0 0 14px;
    font-size: 15px;
}

.preorder-demand-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.preorder-demand-grid > div {
    padding: 14px;
    background: #f8f7fa;
    border-radius: 10px;
}

.preorder-demand-grid span {
    display: block;
    margin-bottom: 5px;
    color: #777381;
    font-size: 12px;
}

.preorder-demand-grid strong {
    font-size: 18px;
}

@media (max-width: 800px) {
    .preorder-demand-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}


/* ===== Product Form Sections ===== */

.product-form-section {
    margin: 24px 0;
    padding-top: 20px;
    border-top: 1px solid #eeeaf2;
}

.product-form-section-title {
    margin-bottom: 16px;

    color: #777381;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.product-checkbox-row {
    display: flex;
    align-items: center;
    gap: 9px;

    margin-bottom: 14px;

    cursor: pointer;
}

.product-checkbox-row input {
    width: auto;
    margin: 0;
}

.product-checkbox-row span {
    font-weight: 600;
}

#preorder-limit-fields[hidden] {
    display: none;
}

#preorder-limit-fields {
    margin-top: 16px;
}


/* ===== Moonhaus Application Footer ===== */

.content {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

.content-body {
    flex: 1;
}

.app-footer {
    margin-top: 48px;
    padding: 18px 0 4px;

    border-top: 1px solid #e8e6ec;

    color: #aaa6b5;
    font-size: 11px;
    text-align: center;
    letter-spacing: 0.2px;
}

.footer-separator {
    margin: 0 7px;
    color: #cbc8d1;
}


/* ===== Inventory Header Actions ===== */

.page-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}


/* ===== Preorders ===== */

.preorder-stock-needed {
    color: #9a6332;
    font-weight: 600;
}

.preorder-help {
    margin-top: 20px;
}

.preorder-definition-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.preorder-definition-grid > div {
    padding: 15px;
    border-radius: 10px;
    background: #f8f7fa;
}

.preorder-definition-grid strong {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
}

.preorder-definition-grid span {
    display: block;
    color: #777381;
    font-size: 12px;
    line-height: 1.45;
}

.inventory-preorder-note {
    margin: -10px 0 22px;
    color: #777381;
    font-size: 12px;
}

.inventory-preorder-note a {
    font-weight: 600;
}

.table-action-link {
    white-space: nowrap;
    font-weight: 600;
}

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

@media (max-width: 600px) {
    .preorder-definition-grid {
        grid-template-columns: 1fr;
    }
}


.preorder-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}


/* ===== Application Top Bar ===== */

.app-topbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    min-height: 52px;
    margin: -18px 0 24px;
}

.app-topbar-spacer {
    flex: 1;
}


/* ===== Account Menu ===== */

.account-menu {
    position: relative;
}

.account-menu-trigger {
    appearance: none;

    display: flex;
    align-items: center;
    gap: 10px;

    padding: 7px 10px;

    border: 1px solid transparent;
    border-radius: 10px;

    background: transparent;

    color: #312b36;
    font: inherit;

    cursor: pointer;
}

.account-menu-trigger:hover,
.account-menu-trigger[aria-expanded="true"] {
    background: #fff;
    border-color: #e5e1e8;
}

.account-avatar {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;

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

    border-radius: 50%;

    background: #292431;
    color: #fff;

    font-size: 13px;
    font-weight: 700;
}

.account-menu-user {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    min-width: 0;
}

.account-menu-user strong {
    max-width: 170px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    font-size: 13px;
}

.account-menu-user small {
    max-width: 170px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    color: #8c8793;
    font-size: 10px;
}

.account-menu-chevron {
    color: #8c8793;
    font-size: 14px;
}

.account-dropdown {
    position: absolute;
    z-index: 500;

    top: calc(100% + 8px);
    right: 0;

    width: 235px;

    padding: 7px;

    border: 1px solid #e5e1e8;
    border-radius: 12px;

    background: #fff;

    box-shadow:
        0 18px 45px rgba(30, 26, 36, 0.13),
        0 3px 10px rgba(30, 26, 36, 0.06);
}

.account-dropdown[hidden] {
    display: none;
}

.account-dropdown-header {
    display: flex;
    flex-direction: column;
    gap: 3px;

    padding: 10px 11px;
}

.account-dropdown-header strong {
    font-size: 13px;
}

.account-dropdown-header span {
    color: #8c8793;
    font-size: 11px;
}

.account-dropdown a {
    display: block;

    padding: 10px 11px;

    border-radius: 8px;

    color: #514a58;
    font-size: 13px;
    text-decoration: none;
}

.account-dropdown a:hover {
    background: #f6f4f7;
    color: #18151f;
}

.account-dropdown-divider {
    height: 1px;
    margin: 5px 4px;
    background: #eeeaf2;
}

.account-dropdown .account-dropdown-logout {
    color: #9b3c3c;
}


/* ===== My Profile ===== */

.profile-layout {
    display: grid;
    gap: 20px;
}

.profile-identity {
    display: flex;
    align-items: center;
    gap: 18px;
}

.profile-identity h2 {
    margin: 0 0 4px;
}

.profile-identity p {
    margin: 0;
    color: #777381;
}

.profile-avatar-large {
    width: 68px;
    height: 68px;
    flex: 0 0 68px;

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

    border-radius: 50%;

    background: #292431;
    color: #fff;

    font-size: 24px;
    font-weight: 700;
}

.profile-role-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;

    margin-top: 10px;
}

.profile-role-list span {
    padding: 4px 8px;

    border-radius: 999px;

    background: #f0edf2;
    color: #625b69;

    font-size: 10px;
    font-weight: 600;
}

.profile-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px 30px;

    margin-top: 20px;
}

.profile-detail-grid > div {
    display: flex;
    flex-direction: column;
    gap: 5px;

    min-width: 0;
}


/* Sidebar no longer needs account card */

.admin-profile {
    display: none;
}


@media (max-width: 850px) {

    .profile-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}


@media (max-width: 600px) {

    .app-topbar {
        margin-top: -10px;
    }

    .account-menu-user {
        display: none;
    }

    .profile-detail-grid {
        grid-template-columns: 1fr;
    }

}


/* ===== Telegram Linking ===== */

.telegram-link-panel {
    max-width: 760px;
}

.telegram-status-card {
    display: flex;
    align-items: center;
    gap: 14px;

    padding: 16px;

    border-radius: 12px;
    background: #f7f5f8;
}

.telegram-status-card > div:last-child {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.telegram-status-card strong {
    font-size: 14px;
}

.telegram-status-card span {
    color: #777381;
    font-size: 12px;
}

.telegram-status-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;

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

    border-radius: 50%;
    background: #292431;
    color: #fff;

    font-weight: 700;
}

.telegram-status-linked {
    background: #f3f8f4;
}

.telegram-link-description {
    margin: 16px 0 0;
    color: #777381;
    line-height: 1.5;
}

.telegram-code-section {
    margin-top: 26px;
    padding-top: 22px;

    border-top: 1px solid #eeeaf2;
}

.telegram-section-label {
    display: block;
    margin-bottom: 10px;

    color: #777381;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.telegram-code-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;

    padding: 18px;

    border: 1px solid #e8e4eb;
    border-radius: 12px;

    background: #fbfafc;
}

.telegram-code-card strong {
    font-size: 30px;
    letter-spacing: 5px;
}

.telegram-command-card {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;

    margin-top: 14px;
    padding: 14px;

    border-radius: 10px;

    background: #f7f5f8;
}

.telegram-command-card span {
    width: 100%;

    color: #777381;
    font-size: 12px;
}

.telegram-command-card code {
    flex: 1;

    padding: 8px 10px;

    border-radius: 7px;

    background: #fff;
    border: 1px solid #e8e4eb;

    font-size: 13px;
}

.telegram-expiry {
    margin: 14px 0 18px;

    color: #777381;
    font-size: 12px;
}

.telegram-link-steps {
    margin: 16px 0 22px;
    padding-left: 22px;

    color: #625d68;
    line-height: 1.8;
}

@media (max-width: 600px) {

    .telegram-code-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .telegram-code-card strong {
        font-size: 24px;
    }

}


/* ===== Profile Picture Upload ===== */

.account-avatar {
    overflow: hidden;
}

.account-avatar img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.profile-avatar-large {
    overflow: hidden;
}

.profile-avatar-large img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.profile-section-description {
    margin: 4px 0 0;
    color: #777381;
    font-size: 12px;
}

.profile-photo-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;

    margin-top: 18px;
}

.profile-photo-form input[type="file"] {
    flex: 1;
    min-width: 260px;

    padding: 10px;

    border: 1px solid #ddd9e3;
    border-radius: 9px;

    background: #fff;
}

.profile-photo-remove-form {
    margin-top: 12px;
}


/* ===== Refined Profile Picture Card ===== */

.profile-photo-panel {
    padding: 26px;
}

.profile-photo-layout {
    display: flex;
    align-items: center;
    gap: 28px;
}

.profile-photo-preview {
    width: 112px;
    height: 112px;
    flex: 0 0 112px;

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

    overflow: hidden;

    border-radius: 50%;
    border: 4px solid #fff;

    background: #292431;
    color: #fff;

    box-shadow:
        0 0 0 1px #e7e3ea,
        0 6px 18px rgba(28, 24, 34, 0.08);

    font-size: 34px;
    font-weight: 700;
}

.profile-photo-preview img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.profile-photo-content {
    flex: 1;
    min-width: 0;
}

.profile-photo-content h2 {
    margin: 0 0 7px;
}

.profile-photo-content p {
    max-width: 620px;
    margin: 0;

    color: #777381;
    font-size: 12px;
    line-height: 1.6;
}

.profile-photo-form {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;

    margin-top: 20px;
}

.profile-photo-picker {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 38px;

    padding: 9px 14px;

    border: 1px solid #d9d4de;
    border-radius: 9px;

    background: #fff;

    color: #4f4856;
    font-size: 12px;
    font-weight: 600;

    cursor: pointer;
}

.profile-photo-picker:hover {
    background: #f7f5f8;
}

.profile-photo-filename {
    min-width: 0;
    max-width: 230px;

    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;

    color: #8a8590;
    font-size: 11px;
}

.profile-photo-form button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.profile-photo-remove-form {
    margin-top: 12px;
}

.profile-photo-remove {
    appearance: none;

    padding: 0;

    border: 0;
    background: transparent;

    color: #a14747;
    font: inherit;
    font-size: 11px;
    font-weight: 600;

    cursor: pointer;
}

.profile-photo-remove:hover {
    text-decoration: underline;
}


/* Slightly more polished main profile identity */

.profile-card {
    padding: 28px;
}

.profile-avatar-large {
    width: 78px;
    height: 78px;
    flex: 0 0 78px;

    box-shadow:
        0 0 0 1px #e7e3ea,
        0 6px 18px rgba(28, 24, 34, 0.08);
}


/* Top account avatar */

.account-avatar {
    border: 2px solid #fff;

    box-shadow:
        0 0 0 1px #ded9e2;
}


@media (max-width: 650px) {

    .profile-photo-layout {
        align-items: flex-start;
        flex-direction: column;
    }

    .profile-photo-preview {
        width: 96px;
        height: 96px;
        flex-basis: 96px;
    }

    .profile-photo-form {
        align-items: flex-start;
        flex-direction: column;
    }

    .profile-photo-filename {
        max-width: 100%;
    }

}


/* ===== Clickable Profile Avatar ===== */

.profile-avatar-form {
    margin: 0;
    flex: 0 0 auto;
}

.profile-avatar-editable {
    position: relative;
    cursor: pointer;
}

.profile-avatar-editable img,
.profile-avatar-initial {
    transition:
        transform 160ms ease,
        filter 160ms ease;
}

.profile-avatar-overlay {
    position: absolute;
    inset: 0;

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

    padding: 8px;

    border-radius: 50%;

    background: rgba(24, 21, 31, 0.68);
    color: #fff;

    opacity: 0;

    font-size: 9px;
    font-weight: 600;
    text-align: center;

    transition: opacity 160ms ease;
}

.profile-avatar-camera {
    font-size: 16px;
    line-height: 1;
}

.profile-avatar-editable:hover .profile-avatar-overlay,
.profile-avatar-editable:focus-within .profile-avatar-overlay {
    opacity: 1;
}

.profile-avatar-editable:hover img {
    transform: scale(1.04);
}

.profile-avatar-initial {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;
}

.profile-photo-remove-inline {
    margin: -10px 0 0 106px;
}

@media (max-width: 600px) {
    .profile-photo-remove-inline {
        margin-left: 0;
    }
}


/* ===== Profile Avatar Remove Action ===== */

.profile-avatar-control {
    position: relative;
    flex: 0 0 auto;
}

.profile-avatar-remove-form {
    position: absolute;
    right: -3px;
    bottom: -3px;

    margin: 0;
    z-index: 5;
}

.profile-avatar-remove-button {
    appearance: none;

    width: 25px;
    height: 25px;

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

    padding: 0;

    border: 2px solid #fff;
    border-radius: 50%;

    background: #f1eef3;
    color: #776f7d;

    box-shadow: 0 2px 7px rgba(28, 24, 34, 0.14);

    font: inherit;
    font-size: 17px;
    line-height: 1;

    cursor: pointer;
}

.profile-avatar-remove-button:hover {
    background: #a14747;
    color: #fff;
}

/* Retire previous detached remove-photo positioning */

.profile-photo-remove-inline {
    display: none;
}


/* ==========================================================
   Collapsible Sidebar
   ========================================================== */

:root {
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 76px;
}

.sidebar,
.content {
    transition:
        width 180ms ease,
        margin-left 180ms ease,
        max-width 180ms ease;
}

.sidebar {
    width: var(--sidebar-width);
    z-index: 300;
}

.brand-link {
    min-width: 0;
}

.brand-logo {
    flex: 0 0 auto;
}

.brand-copy {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;

    transition:
        opacity 130ms ease,
        width 180ms ease;
}

.sidebar nav {
    min-height: 0;
    overflow-y: auto;
    overflow-x: visible;
}

.sidebar nav a {
    position: relative;

    display: flex;
    align-items: center;
    gap: 11px;

    min-height: 42px;
}

.nav-icon {
    width: 20px;
    flex: 0 0 20px;

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

    font-size: 16px;
    line-height: 1;
}

.nav-label {
    min-width: 0;
    white-space: nowrap;

    transition:
        opacity 120ms ease,
        width 180ms ease;
}


/* Toggle */

.sidebar-toggle {
    position: absolute;

    top: 31px;
    right: -14px;

    z-index: 310;

    width: 28px;
    height: 28px;

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

    padding: 0;

    border: 1px solid #ddd8e2;
    border-radius: 50%;

    background: #fff;
    color: #514a58;

    box-shadow: 0 3px 9px rgba(20, 17, 25, 0.12);

    cursor: pointer;
}

.sidebar-toggle:hover {
    background: #f6f4f7;
}

.sidebar-toggle-icon {
    position: relative;
    top: -1px;

    font-size: 22px;
    line-height: 1;
}


/* DEV compact label */

.environment-short {
    display: none;
}


/* ==========================================================
   Collapsed state
   ========================================================== */

html.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
    padding-left: 12px;
    padding-right: 12px;
}

html.sidebar-collapsed .content {
    margin-left: var(--sidebar-collapsed-width);
    max-width:
        calc(100vw - var(--sidebar-collapsed-width));
}


/* Brand */

html.sidebar-collapsed .brand {
    justify-content: center;

    margin-left: 0;
    margin-right: 0;
}

html.sidebar-collapsed .brand-copy {
    width: 0;
    opacity: 0;
    pointer-events: none;
}


/* Section labels */

html.sidebar-collapsed .nav-section {
    height: 1px;

    margin: 14px 8px 8px;
    padding: 0;

    overflow: hidden;

    background: #302b3b;

    color: transparent;
    font-size: 0;
}


/* Navigation */

html.sidebar-collapsed .sidebar nav a {
    justify-content: center;

    width: 48px;
    height: 44px;

    margin-left: auto;
    margin-right: auto;

    padding: 0;
}

html.sidebar-collapsed .nav-icon {
    width: 24px;
    flex-basis: 24px;

    font-size: 18px;
}

html.sidebar-collapsed .nav-label {
    position: absolute;

    width: 0;
    height: 0;

    overflow: hidden;

    opacity: 0;
}


/* Tooltip */

html.sidebar-collapsed .sidebar nav a::after {
    content: attr(data-tooltip);

    position: absolute;

    left: calc(100% + 12px);
    top: 50%;

    z-index: 500;

    padding: 7px 10px;

    border-radius: 7px;

    background: #18151f;
    color: #fff;

    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.16);

    font-size: 11px;
    font-weight: 600;

    white-space: nowrap;

    opacity: 0;
    visibility: hidden;

    pointer-events: none;

    transform: translateY(-50%) translateX(-3px);

    transition:
        opacity 120ms ease,
        transform 120ms ease,
        visibility 120ms ease;
}

html.sidebar-collapsed .sidebar nav a:hover::after {
    opacity: 1;
    visibility: visible;

    transform: translateY(-50%) translateX(0);
}


/* Environment */

html.sidebar-collapsed .environment {
    padding: 8px 4px;

    font-size: 9px;
    letter-spacing: 0.5px;
}

html.sidebar-collapsed .environment-full {
    display: none;
}

html.sidebar-collapsed .environment-short {
    display: inline;
}


/* Main content default */

.content {
    margin-left: var(--sidebar-width);
    max-width: calc(100vw - var(--sidebar-width));
}


/* ==========================================================
   Mobile keeps existing full-width navigation behavior
   ========================================================== */

@media (max-width: 700px) {

    html.sidebar-collapsed .sidebar {
        width: 100%;
        padding: 28px 18px;
    }

    html.sidebar-collapsed .content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }

    html.sidebar-collapsed .brand {
        justify-content: flex-start;
    }

    html.sidebar-collapsed .brand-copy {
        width: auto;
        opacity: 1;
    }

    html.sidebar-collapsed .nav-section {
        height: auto;

        margin: 22px 14px 7px;

        background: transparent;
        color: #767180;

        font-size: 10px;
    }

    html.sidebar-collapsed .sidebar nav a {
        justify-content: flex-start;

        width: auto;
        height: auto;

        margin: 0;
        padding: 12px 14px;
    }

    html.sidebar-collapsed .nav-label {
        position: static;

        width: auto;
        height: auto;

        overflow: visible;

        opacity: 1;
    }

    html.sidebar-collapsed .sidebar nav a::after {
        display: none;
    }

    html.sidebar-collapsed .environment-full {
        display: inline;
    }

    html.sidebar-collapsed .environment-short {
        display: none;
    }

    .sidebar-toggle {
        display: none;
    }

}


/* ===== Supplier Order History ===== */

.supplier-order-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.supplier-order-help {
    margin-top: 4px;
    color: #777381;
    font-size: 12px;
    line-height: 1.5;
}

.supplier-order-status {
    display: inline-flex;
    align-items: center;

    padding: 4px 8px;

    border-radius: 999px;

    font-size: 10px;
    font-weight: 700;
}

.supplier-order-status.active {
    background: #eaf7ee;
    color: #28733c;
}

.supplier-order-status.voided {
    background: #f0edf2;
    color: #777381;
}

.supplier-order-voided {
    opacity: 0.62;
}

.supplier-order-voided td {
    text-decoration-color: #aaa6b5;
}

.supplier-order-void-form {
    margin: 0;
}

.supplier-order-void-button {
    appearance: none;

    padding: 0;

    border: 0;
    background: transparent;

    color: #a14747;

    font: inherit;
    font-size: 12px;
    font-weight: 600;

    cursor: pointer;
}

.supplier-order-void-button:hover {
    text-decoration: underline;
}

@media (max-width: 850px) {
    .supplier-order-summary {
        grid-template-columns: 1fr;
    }
}


/* ===== Preorder Supplier Receipts ===== */

.supplier-receipt-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

@media (max-width: 850px) {
    .supplier-receipt-summary {
        grid-template-columns: 1fr;
    }
}


/* ==========================================================
   Automatic New Order Type
   ========================================================== */

.order-items-header {
    align-items: flex-start;
}

.order-items-header h2 {
    margin-bottom: 7px;
}

.order-type-indicator {
    display: inline-flex;
    align-items: center;
    gap: 7px;

    padding: 5px 9px;

    border-radius: 999px;

    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.order-type-indicator-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;
}

.order-type-indicator.unset {
    background: #f0edf2;
    color: #777381;
}

.order-type-indicator.unset .order-type-indicator-dot {
    background: #aaa6b5;
}

.order-type-indicator.ready-stock {
    background: #eaf7ee;
    color: #28733c;
}

.order-type-indicator.ready-stock .order-type-indicator-dot {
    background: #36a65a;
}

.order-type-indicator.preorder {
    background: #f1edfb;
    color: #624b99;
}

.order-type-indicator.preorder .order-type-indicator-dot {
    background: #7658b5;
}


/* Stock shortage */

.order-stock-warning {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;

    margin: 16px;
    padding: 14px 16px;

    border: 1px solid #edcd9f;
    border-radius: 10px;

    background: #fff8ed;
}

.order-stock-warning[hidden] {
    display: none;
}

.order-stock-warning > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.order-stock-warning strong {
    color: #80551d;
    font-size: 13px;
}

.order-stock-warning span {
    color: #846d50;
    font-size: 12px;
    line-height: 1.45;
}

#convert-order-preorder {
    flex: 0 0 auto;

    border: 0;
    border-radius: 8px;

    padding: 9px 13px;

    background: #5d478e;
    color: #fff;

    font-size: 11px;
    font-weight: 700;

    cursor: pointer;
}


/* Summary order type */

.order-summary-type {
    margin-bottom: 18px;
    padding: 9px 12px;

    border-radius: 8px;

    text-align: center;

    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.6px;
}

.order-summary-type.unset {
    background: #f3f1f4;
    color: #88828d;
}

.order-summary-type.ready-stock {
    background: #eaf7ee;
    color: #28733c;
}

.order-summary-type.preorder {
    background: #f1edfb;
    color: #624b99;
}

@media (max-width: 700px) {

    .order-stock-warning {
        align-items: stretch;
        flex-direction: column;
    }

    #convert-order-preorder {
        width: 100%;
    }

}


/* ==========================================================
   Mixed Order Item Allocation
   ========================================================== */

.order-type-indicator.mixed,
.order-summary-type.mixed {
    background: #fff1dd;
    color: #8a5a16;
}

.order-type-indicator.mixed
.order-type-indicator-dot {
    background: #d38a22;
}


.order-item-allocation {
    display: flex;
    flex-direction: column;
    gap: 7px;
}


.order-item-allocation-status {
    display: inline-flex;
    align-self: flex-start;

    padding: 5px 8px;

    border-radius: 7px;

    font-size: 11px;
    font-weight: 700;
}


.order-item-allocation-status.unset {
    background: #f2f0f3;
    color: #88828d;
}

.order-item-allocation-status.ready-stock {
    background: #eaf7ee;
    color: #28733c;
}

.order-item-allocation-status.preorder {
    background: #f1edfb;
    color: #624b99;
}

.order-item-allocation-status.mixed {
    background: #fff1dd;
    color: #8a5a16;
}

.order-item-allocation-status.warning {
    background: #fff8ed;
    color: #8a5a16;
}

.order-item-allocation-status.error {
    background: #fdeaea;
    color: #a33;
}


.order-item-allocation-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}


.allocation-option {
    border: 0;
    border-radius: 7px;

    padding: 7px 9px;

    background: #5d478e;
    color: #fff;

    font-size: 10px;
    font-weight: 700;

    cursor: pointer;
}


.allocation-option.secondary {
    border: 1px solid #d8d3de;

    background: #fff;
    color: #625b69;
}


.allocation-option:hover {
    opacity: 0.9;
}



/* ===== Order Detail Allocation Badges ===== */

.order-item-allocation-badge {
    display: inline-flex;
    align-items: center;

    padding: 5px 8px;

    border-radius: 7px;

    font-size: 10px;
    font-weight: 700;
    line-height: 1.3;
}

.order-item-allocation-badge.ready-stock {
    background: #eaf7ee;
    color: #28733c;
}

.order-item-allocation-badge.preorder {
    background: #f1edfb;
    color: #624b99;
}

.order-item-allocation-badge.mixed {
    background: #fff1dd;
    color: #8a5a16;
}

.order-item-allocation-badge.unset {
    background: #f0edf2;
    color: #777381;
}

/* Fulfilment stock warning */

.fulfilment-stock-warning {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 18px 20px;
    margin: 0 0 20px 0;
    border: 1px solid #f1c7c7;
    border-radius: 14px;
    background: #fff5f5;
}

.fulfilment-stock-warning-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #c94b4b;
    color: #ffffff;
    font-size: 19px;
    font-weight: 700;
    line-height: 1;
}

.fulfilment-stock-warning-content {
    min-width: 0;
}

.fulfilment-stock-warning-content strong {
    display: block;
    margin-bottom: 5px;
    color: #842f2f;
    font-size: 15px;
}

.fulfilment-stock-warning-content p {
    margin: 0 0 6px 0;
    color: #5f3434;
    line-height: 1.5;
}

.fulfilment-stock-warning-content small {
    display: block;
    color: #8c6868;
    line-height: 1.45;
}

/* ===== Coming Soon Modal ===== */

.modal-open {
    overflow: hidden;
}

.coming-soon-modal[hidden] {
    display: none;
}

.coming-soon-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;

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

    padding: 24px;
}

.coming-soon-backdrop {
    position: absolute;
    inset: 0;

    background: rgba(24, 21, 31, 0.42);

    backdrop-filter: blur(3px);
}

.coming-soon-dialog {
    position: relative;
    z-index: 1;

    width: min(420px, 100%);

    padding: 34px 32px 30px;

    border: 1px solid #ebe7ee;
    border-radius: 18px;

    background: #ffffff;

    box-shadow:
        0 28px 80px rgba(24, 21, 31, 0.18),
        0 6px 20px rgba(24, 21, 31, 0.08);

    text-align: center;
}

.coming-soon-close {
    position: absolute;
    top: 14px;
    right: 14px;

    width: 32px;
    height: 32px;

    border: 0;
    border-radius: 8px;

    background: transparent;

    color: #8d8792;

    font-size: 24px;
    line-height: 1;

    cursor: pointer;
}

.coming-soon-close:hover {
    background: #f4f1f5;
    color: #302a35;
}

.coming-soon-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 58px;
    height: 58px;

    margin: 0 auto 18px;

    border-radius: 16px;

    background: #f2edf7;

    font-size: 28px;
}

.coming-soon-dialog h2 {
    margin: 0 0 10px;

    font-size: 22px;
}

.coming-soon-dialog p {
    margin: 0;

    color: #625c68;

    font-size: 14px;
    line-height: 1.55;
}

.coming-soon-description {
    margin-top: 8px !important;

    color: #89838f !important;

    font-size: 12px !important;
}

.coming-soon-primary {
    width: 100%;

    margin-top: 24px;
    padding: 11px 16px;

    border: 0;
    border-radius: 9px;

    background: #18151f;
    color: #ffffff;

    font-size: 13px;
    font-weight: 600;

    cursor: pointer;
}

.coming-soon-primary:hover {
    background: #2a2634;
}

@media (max-width: 520px) {

    .coming-soon-modal {
        align-items: flex-end;

        padding: 12px;
    }

    .coming-soon-dialog {
        width: 100%;

        padding: 32px 24px 24px;

        border-radius: 18px;
    }

}

/* ===== Dashboard Work In Progress ===== */

.dashboard-wip-banner {
    display: flex;
    align-items: flex-start;
    gap: 14px;

    margin-bottom: 22px;
    padding: 16px 18px;

    border: 1px solid #e5d8af;
    border-radius: 12px;

    background: #fffaf0;
}

.dashboard-wip-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 36px;

    width: 36px;
    height: 36px;

    border-radius: 10px;

    background: #f6edd0;

    font-size: 18px;
}

.dashboard-wip-banner strong {
    display: block;

    margin-bottom: 4px;

    color: #67521d;

    font-size: 13px;
}

.dashboard-wip-banner p {
    margin: 0;

    color: #82724c;

    font-size: 12px;
    line-height: 1.5;
}
