/* SP TINTED MANAGER - User Management add-on. Existing styles remain untouched. */

.um-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.um-toolbar h3 {
    margin: 0;
    font-size: 22px;
}

.um-toolbar p {
    margin: 7px 0 0;
    color: #91a4bf;
    font-size: 13px;
}

.um-panel {
    padding: 25px;
}

.um-list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 18px;
}

.um-list-head h3 {
    margin: 0 0 6px;
    font-size: 18px;
}

.um-list-head small {
    color: #91a4bf;
    font-size: 12px;
}

.um-table {
    min-width: 1050px;
}

.um-table th {
    white-space: nowrap;
}

.um-status {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border-radius: 999px;
    background: #3a2e20;
    color: #f1bd72;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.um-status.active {
    background: #21372f;
    color: #76e0ac;
}

.um-status.inactive {
    background: #3a2025;
    color: #ff8792;
}

.um-permission-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 150px;
}

.um-permission-tag,
.um-permission-none {
    display: inline-flex;
    align-items: center;
    min-height: 23px;
    padding: 0 7px;
    border-radius: 6px;
    background: #273243;
    color: #cbd5e1;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.um-permission-none {
    background: #35242a;
    color: #ff9aa4;
}

.um-modal {
    position: relative;
    width: min(560px, 100%);
    max-height: calc(100vh - 48px);
    overflow: auto;
    padding: 34px 32px 30px;
    border: 1px solid #343d4b;
    border-radius: 22px;
    background: linear-gradient(145deg, #202733, #171c25);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .55),
        0 0 0 1px rgba(255, 255, 255, .025) inset;
    text-align: left;
    animation: modalIn .2s ease-out;
}

.um-modal h3 {
    margin: 0;
    font-size: 24px;
}

.um-modal > p {
    margin: 7px 0 20px;
    color: #91a4bf;
    font-size: 13px;
}

.um-modal form > label {
    display: block;
    margin: 14px 0 7px;
    color: #cbd5e1;
    font-size: 13px;
}

.um-modal form > label small {
    margin-left: 5px;
    color: #71839e;
}

.um-modal input:not([type="checkbox"]),
.um-modal select {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid #364052;
    border-radius: 9px;
    background: #151a23;
    color: #fff;
    outline: none;
}

.um-modal input:not([type="checkbox"]):focus,
.um-modal select:focus {
    border-color: #6a7890;
}

.um-password-row {
    display: flex;
    align-items: stretch;
    gap: 7px;
}

.um-password-row input {
    flex: 1;
    min-width: 0;
}

.um-password-toggle {
    min-width: 58px;
    padding: 0 12px;
    border: 1px solid #364052;
    border-radius: 9px;
    background: #202a39;
    color: #dce3ed;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.um-password-toggle:hover {
    background: #293548;
}

.um-permissions {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid #303a4a;
    border-radius: 12px;
    background: #171d27;
}

.um-permissions h4 {
    margin: 0 0 10px;
    color: #dce3ed;
}

.um-check {
    display: flex !important;
    align-items: center;
    gap: 10px;
    margin: 10px 0 !important;
    color: #dce3ed !important;
}

.um-check input {
    width: 17px;
    height: 17px;
    accent-color: #d10b1f;
}

.um-check small {
    color: #71839e;
}

.um-page .modal-actions {
    margin-top: 18px;
}

.um-modal .error {
    min-height: 24px;
}

.um-modal .modal-danger {
    cursor: pointer;
}

.um-modal .modal-danger:disabled {
    opacity: .6;
    cursor: wait;
}

@media (max-width: 800px) {
    .um-toolbar,
    .um-list-head {
        align-items: stretch;
        flex-direction: column;
    }

    .um-toolbar .customer-action,
    .um-list-head .customer-action {
        width: 100%;
    }

    .um-panel {
        padding: 18px;
    }

    .um-modal {
        padding: 28px 20px 22px;
    }

    .um-page {
        padding: 20px 14px;
    }
}

/* =========================================================
   Company Settings
   ========================================================= */

.um-company-card {
    padding: 24px;
}

.um-company-form {
    width: 100%;
}

.um-company-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.um-company-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.um-company-field label {
    font-size: 12px;
    font-weight: 600;
}

.um-company-field input,
.um-company-field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #334155;
    border-radius: 8px;
    background: #151b25;
    color: #f8fafc;
    padding: 11px 12px;
    font: inherit;
    outline: none;
}

.um-company-field input:focus,
.um-company-field textarea:focus {
    border-color: #64748b;
}

.um-company-field textarea {
    resize: vertical;
    min-height: 110px;
}

.um-company-full {
    grid-column: 1 / -1;
}

.um-company-actions {
    justify-content: flex-end;
    margin-top: 20px;
}

#navChangePassword {
    cursor: pointer;
}

#settingsNav {
    cursor: pointer;
}

@media (max-width: 800px) {
    .um-company-grid {
        grid-template-columns: 1fr;
    }

    .um-company-full {
        grid-column: auto;
    }
}


/* Sidebar icon alignment for Change Password. */
.sidebar .nav .nav-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Global confirmation dialog used before save/update operations. */
.um-confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(5px);
}

.um-confirm-overlay.hidden {
    display: none;
}

.um-confirm-modal {
    width: min(420px, 100%);
    padding: 28px;
    border: 1px solid #344155;
    border-radius: 16px;
    background: #1b2330;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
    text-align: center;
}

.um-confirm-icon {
    width: 42px;
    height: 42px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(226, 0, 26, 0.14);
    color: #e2001a;
    font-size: 22px;
    font-weight: 800;
}

.um-confirm-modal h3 {
    margin: 0 0 8px;
    color: #f4f7fb;
    font-size: 20px;
}

.um-confirm-modal p {
    margin: 0;
    color: #aab7ca;
    line-height: 1.5;
    font-size: 14px;
}

.um-confirm-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 24px;
}

.um-confirm-actions button {
    min-height: 42px;
    border: 1px solid #3b4759;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

.um-confirm-no {
    background: #242e3c;
    color: #e7edf6;
}

.um-confirm-yes {
    border-color: #e2001a !important;
    background: #e2001a;
    color: #ffffff;
}

@media (max-width: 520px) {
    .um-confirm-modal {
        padding: 22px;
    }
}

/* ======================================================
   V7 UI FIXES
   ====================================================== */

/* Make the Change Password SVG match the other sidebar icons. */
.sidebar .nav#navChangePassword .nav-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    display: block;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar .nav#navChangePassword .nav-icon circle {
    fill: none !important;
}

/* Recent Customers control: keep Show, number and Customers on one clean line. */
.recent .recent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.recent-limit-control {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    white-space: nowrap;
}

.recent-limit-control label,
.recent-limit-control span {
    margin: 0;
    font-size: 12px;
    color: #91a4bf;
}

.recent-limit-control select {
    min-width: 58px;
    height: 32px;
    padding: 0 26px 0 10px;
    border: 1px solid #3b4759;
    border-radius: 7px;
    background: #151b24;
    color: #f4f7fb;
    font-size: 12px;
    font-weight: 700;
    outline: none;
}

.recent-limit-control select:focus {
    border-color: #66758d;
}

/* Company Details save button. */
#companySave {
    min-width: 110px;
    width: auto !important;
    padding: 0 28px;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Confirmation dialog is always above every other modal. */
.um-confirm-overlay {
    z-index: 99999;
}

.um-confirm-modal {
    max-width: 430px;
}

.um-confirm-actions button {
    min-height: 44px;
}

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

    .recent-limit-control {
        justify-content: flex-start;
    }
}



/* =========================================================
   V9 - SAFE ALIGNMENT ONLY
   Existing V7 layout and functionality remain unchanged.
   ========================================================= */

/* User Management table: keep content vertically aligned and
   prevent long permission lists from disturbing the columns. */
.um-table th,
.um-table td {
    vertical-align: middle;
}

.um-table th {
    text-align: left;
}

.um-table th:nth-child(4),
.um-table th:nth-child(5),
.um-table th:nth-child(6),
.um-table th:nth-child(7),
.um-table th:nth-child(8),
.um-table td:nth-child(4),
.um-table td:nth-child(5),
.um-table td:nth-child(6),
.um-table td:nth-child(7),
.um-table td:nth-child(8) {
    text-align: center;
}

.um-status {
    justify-content: center;
    white-space: nowrap;
}

.um-permission-tags {
    align-items: center;
    justify-content: center;
}

.um-table td:last-child {
    white-space: nowrap;
    text-align: center;
}

/* Recent Customers: preserve the original card layout and keep
   the Show control compact on desktop. */
.recent .recent-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.recent-limit-control {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
    white-space: nowrap;
}

.recent-limit-control label,
.recent-limit-control span {
    margin: 0;
    color: #91a4bf;
    font-size: 12px;
}

.recent-limit-control select {
    min-width: 58px;
    height: 32px;
    padding: 0 26px 0 10px;
    border: 1px solid #3b4759;
    border-radius: 7px;
    background: #151b24;
    color: #f4f7fb;
    font-size: 12px;
    font-weight: 700;
    outline: none;
}

/* Company Details: keep the V7 SAVE button styling and prevent
   the form from being stretched by the alignment rules. */
.um-company-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

#companySave {
    width: auto !important;
    min-width: 110px;
}

/* Change Password icon: same size/alignment as the other sidebar icons. */
.sidebar .nav#navChangePassword .nav-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
    display: block;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar .nav#navChangePassword .nav-icon circle {
    fill: none !important;
}

@media (max-width: 700px) {
    .recent .recent-header {
        align-items: center;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .recent-limit-control {
        justify-content: flex-start;
    }
}

@media (max-width: 420px) {
    .recent .recent-header {
        align-items: flex-start;
        flex-direction: column;
    }
}


/* =========================================================
   V11 - RESTORE CLEAN ORIGINAL ALIGNMENT
   Visual correction only. No application functions changed.
   ========================================================= */

/* ---------- Company Details ---------- */

#companySettingsPage .um-company-card {
    display: block;
    width: 100%;
    padding: 24px;
}

#companySettingsPage .um-company-form {
    display: block;
    width: 100%;
}

#companySettingsPage .um-company-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    width: 100%;
}

#companySettingsPage .um-company-field {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    gap: 7px;
}

#companySettingsPage .um-company-field label {
    display: block;
    width: 100%;
    margin: 0;
    color: #dce3ed;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
}

#companySettingsPage .um-company-field input,
#companySettingsPage .um-company-field textarea {
    display: block;
    width: 100% !important;
    min-width: 0;
    box-sizing: border-box;
    margin: 0;
    border: 1px solid #334155;
    border-radius: 8px;
    background: #151b25;
    color: #f8fafc;
    padding: 11px 12px;
    font-family: Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    outline: none;
}

#companySettingsPage .um-company-field input {
    height: 44px;
}

#companySettingsPage .um-company-field textarea {
    min-height: 110px;
    resize: vertical;
}

#companySettingsPage .um-company-field input:focus,
#companySettingsPage .um-company-field textarea:focus {
    border-color: #64748b;
}

#companySettingsPage .um-company-full {
    grid-column: 1 / -1;
}

#companySettingsPage .um-company-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100%;
    margin-top: 20px;
}

#companySettingsPage #companySave {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-width: 0 !important;
    height: 42px;
    margin: 0 !important;
    padding: 0 20px !important;
    box-sizing: border-box;
    text-align: center !important;
    line-height: 1 !important;
}

/* ---------- Customer View copy control ---------- */

#customerViewModal .customer-view-name-row {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: auto;
    max-width: 100%;
    min-height: 32px;
    margin: 0 auto !important;
    gap: 9px;
}

#customerViewModal .customer-view-name-row h3 {
    display: block;
    margin: 0 !important;
    padding: 0;
    line-height: 1.2;
}

#customerViewModal .customer-view-name-row .copy-name-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: static !important;
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    flex: 0 0 30px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid #364052 !important;
    border-radius: 8px !important;
    background: #171d27 !important;
    color: #91a4bf !important;
    font-size: 0 !important;
    line-height: 1 !important;
    box-shadow: none !important;
}

#customerViewModal .customer-view-name-row .copy-name-btn svg {
    display: block !important;
    width: 15px !important;
    height: 15px !important;
    margin: 0 !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 1.8 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
}

#customerViewModal .customer-view-value-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px;
}

#customerViewModal .customer-view-value-row .copy-field-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: static !important;
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    flex: 0 0 30px !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
}

#customerViewModal .customer-view-value-row .copy-field-btn svg {
    display: block !important;
    width: 15px !important;
    height: 15px !important;
    margin: 0 !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 1.8 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
}

/* ---------- Recent Customers header ---------- */

#dashboardPage .recent.card {
    width: 100%;
    min-width: 0;
}

#dashboardPage .recent-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100%;
    gap: 16px;
}

#dashboardPage .recent-header h3 {
    margin: 0 !important;
    flex: 1 1 auto;
}

#dashboardPage .recent-limit-control {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    flex: 0 0 auto;
    gap: 7px !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    white-space: nowrap;
}

#dashboardPage .recent-limit-control label,
#dashboardPage .recent-limit-control span {
    display: inline-flex !important;
    align-items: center !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 32px;
    white-space: nowrap;
}

#dashboardPage .recent-limit-control select {
    display: block !important;
    width: 58px !important;
    min-width: 58px !important;
    height: 32px !important;
    margin: 0 !important;
    padding: 0 22px 0 9px !important;
    box-sizing: border-box;
}

/* ---------- User Management table ---------- */

#userManagementPage .um-table th,
#userManagementPage .um-table td {
    vertical-align: middle;
}

#userManagementPage .um-table td:last-child {
    white-space: nowrap;
}

@media (max-width: 800px) {
    #companySettingsPage .um-company-grid {
        grid-template-columns: 1fr;
    }

    #companySettingsPage .um-company-full {
        grid-column: auto;
    }

    #dashboardPage .recent-header {
        align-items: center !important;
        flex-direction: row !important;
        flex-wrap: wrap;
    }

    #dashboardPage .recent-limit-control {
        margin-left: auto !important;
    }
}

@media (max-width: 420px) {
    #dashboardPage .recent-header {
        align-items: flex-start !important;
        flex-direction: column !important;
    }

    #dashboardPage .recent-limit-control {
        margin-left: 0 !important;
    }
}


/* =========================================================
   V12 - TARGETED ALIGNMENT FIX
   DO NOT CHANGE APPLICATION FUNCTIONS.
   ========================================================= */

/* Company Details */
#companySettingsPage .um-company-card {
    padding: 24px !important;
}

#companySettingsPage .um-company-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    gap: 18px !important;
}

#companySettingsPage .um-company-field {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 7px !important;
}

#companySettingsPage .um-company-field label {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
}

#companySettingsPage .um-company-field input,
#companySettingsPage .um-company-field textarea {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

#companySettingsPage .um-company-full {
    grid-column: 1 / -1 !important;
}

#companySettingsPage .um-company-actions {
    display: flex !important;
    width: 100% !important;
    justify-content: center !important;
    align-items: center !important;
    margin-top: 20px !important;
}

#companySettingsPage #companySave {
    display: flex !important;
    width: 100% !important;
    height: 44px !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    text-align: center !important;
}

/* Recent Customers header */
#dashboardPage .recent-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 20px !important;
}

#dashboardPage .recent-header h3 {
    margin: 0 !important;
    flex: 1 1 auto !important;
}

#dashboardPage .recent-limit-control {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    width: auto !important;
    margin: 0 !important;
    white-space: nowrap !important;
}

#dashboardPage .recent-limit-control select {
    width: 70px !important;
    min-width: 70px !important;
    height: 36px !important;
    margin: 0 !important;
}

/* Customer View copy button */
#customerViewModal .customer-view-name-row {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 9px !important;
    margin: 0 auto !important;
}

#customerViewModal .copy-name-btn {
    position: static !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 30px !important;
    min-width: 30px !important;
    height: 30px !important;
    margin: 0 !important;
    padding: 0 !important;
}

@media (max-width: 800px) {
    #companySettingsPage .um-company-grid {
        grid-template-columns: 1fr !important;
    }

    #companySettingsPage .um-company-full {
        grid-column: auto !important;
    }
}

@media (max-width: 520px) {
    #dashboardPage .recent-header {
        flex-direction: row !important;
        flex-wrap: wrap !important;
    }

    #dashboardPage .recent-limit-control {
        margin-left: auto !important;
    }
}
