/* =========================
   GLOBAL PAGE BASE
========================= */

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;

    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    padding: 20px 24px;
    width: 100%;
    box-sizing: border-box;

    flex: 1;
}

h1 {
    margin: 0;
    font-size: 28px;
    line-height: 1;
}


/* =========================
   GLOBAL HEADER
========================= */

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 22px;
    font-weight: bold;
    background: linear-gradient(90deg, #4c1d95, #6d28d9);
    color: #ffffff;
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-title {
    font-size: 32px;
    line-height: 1;
}

.app-client-name {
    font-size: 22px;
    line-height: 1;
    opacity: 0.95;
}

/* =========================
   HEADER LOGO
========================= */

.app-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-logo {
    height: 44px;
    width: auto;
}

/* =========================
   ENVIRONMENT LABEL (INLINE)
========================= */

.env-label {
    font-size: inherit;      /* match Supervision 360 size */
    font-weight: inherit;    /* match boldness */
    line-height: 1;
    opacity: 0.9;
}

/* =========================
   GLOBAL MENU BAR
========================= */

.app-menu {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 3px 12px;
    min-height: 30px;

    /* subtle purple tint */
    background: rgba(109, 40, 217, 0.08);

    /* soft separation */
    border-bottom: 3px solid rgba(109, 40, 217, 0.25);

    backdrop-filter: blur(4px);
}

.app-menu-left {
    display: flex;
    gap: 16px;
}

.app-menu-right {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.user-greeting {
    font-weight: 500;
    white-space: nowrap;
}

/* =========================
   LOGIN PAGE
========================= */

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;

    flex: 1;              /* fills remaining space between header + footer */
    padding: 20px;
}

/* =========================
   LOGIN TITLE
========================= */

.login-title {
    display: flex;
    align-items: center;
    gap: 10px;

    margin-bottom: 6px;
}

.login-title span {
    white-space: nowrap;
}

/* =========================
   LOGIN CARD
========================= */

.login-card {
    width: 100%;
    max-width: 480px;     /* wider for DEV text */

    padding: 28px;
    border-radius: 14px;
    border: 1px solid #cbd5e1;

    box-sizing: border-box;
}


/* =========================
   LOGIN FORM
========================= */

.login-card form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.login-card button {
    margin-top: 10px;
}


/* =========================
   LOGIN ERROR
========================= */

.login-error {
    margin-top: 16px;
    padding: 10px;
    border-radius: 8px;
    color: #ffffff;
    background: #dc2626;
}


/* =========================
   THEME TOGGLE SWITCH
========================= */

.theme-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.theme-label {
    font-size: 12px;
    opacity: 0.8;
}

.theme-switch {
    width: 42px !important;
    height: 22px !important;
    min-height: 22px !important;
    padding: 2px !important;
    border-radius: 999px !important;
    border: 1px solid #cbd5e1 !important;
    background: rgba(255, 255, 255, 0.2) !important;
    cursor: pointer;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

.theme-switch-knob {
    display: block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    transition: transform 0.2s ease;
}

.theme-switch.is-dark .theme-switch-knob {
    transform: translateX(20px);
}

/* =========================
   THEME SWITCH OVERRIDE (PREVENT BUTTON STYLES)
========================= */

.theme-switch {
    width: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    height: 22px !important;
    min-height: 22px !important;
    padding: 2px !important;

    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;

    box-sizing: border-box !important;
    overflow: hidden;
}

.theme-switch.is-dark {
    justify-content: flex-end !important;
}

.theme-switch-knob {
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    max-width: 16px !important;
    transform: none !important;
}


/* =========================
   THEME SWITCH KNOB COLORS
========================= */

/* Light mode → dark knob */
.theme-switch:not(.is-dark) .theme-switch-knob {
    background: #1f2937; /* dark gray */
}

/* Dark mode → light knob */
.theme-switch.is-dark .theme-switch-knob {
    background: #ffffff;
}


/* =========================
   MENU BAR GEAR ICON
========================= */

.app-menu .icon-button {
    width: 30px;
    height: 30px;
    font-size: 22px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
}


/* =========================
   PAGE TITLE ROW
========================= */

.page-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}


/* =========================
   LINKS
========================= */

a {
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}


/* =========================
   BUTTONS (STANDARDIZED)
========================= */

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    height: 30px;
    min-width: 86px;
    padding: 0 4px;

    border-radius: 6px;
    border: 1px solid transparent;

    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;

    transition: background 0.15s ease, opacity 0.15s ease, transform 0.05s ease;
}

button:hover,
.button-link:hover {
    font-weight: 600;
    opacity: 0.9;
    text-decoration: none;
}

button:active,
.button-link:active {
    transform: translateY(1px);
}

.button-primary {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

.button-secondary {
    background: transparent;
    color: inherit;
    border-color: #cbd5e1;
}


/* =========================
   SEARCH PANEL
========================= */

.search-panel {
    margin: 10px 0 6px 0;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.search-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 180px;
}

.search-field label {
    font-weight: 600;
    opacity: 0.8;
}

.search-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-field input {
    padding: 6px 8px;
}


/* =========================
   FORM INPUTS
========================= */

input,
select,
textarea {
    padding: 8px;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-family: inherit;
}

textarea {
    resize: vertical;
}


/* =========================
   MODALS
========================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none !important;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-overlay.is-open {
    display: flex !important;
}

.modal-box {
    padding: 24px;
    border-radius: 10px;
    min-width: 360px;
}


/* =========================
   VALIDATION / ERROR MESSAGES
========================= */

.field-error {
    border: 2px solid #dc2626;
    outline: none;
}

.error-popup {
    margin-top: 6px;
    color: #dc2626;
    font-weight: bold;
}

.muted-text {
    opacity: 0.75;
}


/* =========================
   TABLES
========================= */

.modern-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 16px;
    border-radius: 10px;
    overflow: hidden;
}

.modern-table th,
.modern-table td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

.modern-table th {
    font-weight: bold;
    background: rgba(0, 0, 0, 0.06);
}

.modern-table tr:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* =========================
   TABLE ACTIONS (STANDARDIZED)
========================= */

.table-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.table-actions button,
.table-actions .button-link {
    height: 30px;
    min-width: 92px;
    padding: 0 4px;
    font-size: 16px;
}

/* =========================
   SEARCH RIGHT ACTIONS (STANDARDIZED)
========================= */

.search-actions-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Align icon perfectly with button */
.search-actions-right .icon-button {
    margin-left: 2px;
}

/* =========================
   TABLE COLUMN SIZING
========================= */

.modern-table {
    width: 100%;
    table-layout: fixed;
    margin-top: 8px;
}

.modern-table .col-tenant {
    width: 130px;
}

.modern-table .col-name {
    width: 180px;
}

.modern-table .col-domain {
    width: 160px;
}

.modern-table .col-notes {
    width: auto;
}

.modern-table .col-active {
    width: 80px;
}

.modern-table .col-actions {
    width: 230px;
}

/* =========================
   TABLE COLUMN SIZING (EXTENSION)
========================= */

.modern-table .col-id {
    width: 100px;
}

/* =========================
   S360-32 USER MANAGEMENT TABLE
========================= */

.user-management-table {
    width: auto;
    table-layout: auto;
}

.user-management-table th,
.user-management-table td {
    white-space: nowrap;
}

.user-col-id {
    width: 70px;
}

.user-col-tenant {
    width: auto;
}

.user-col-username {
    width: auto;
}

.user-col-name {
    width: auto;
}

.user-col-email {
    width: auto;
}

.user-col-type {
    width: 120px;
}

.user-col-active {
    width: 80px;
}

.user-col-actions {
    width: 220px;
}

.user-management-table .table-actions {
    justify-content: flex-start;
}

/* =========================
   S360-32 CLIENT MANAGEMENT TABLE
========================= */

.client-management-table {
    width: auto;
    max-width: 100%;
    table-layout: auto;
}

/* Keep most columns tight */
.client-management-table th,
.client-management-table td {
    white-space: nowrap;
}

/* Notes = ONLY flexible column */
.client-col-notes {
    width: auto;
    white-space: normal;   /* allow wrapping here ONLY */
}

/* Everything else stays tight */
.client-col-id {
    width: 80px;
}

.client-col-tenant {
    width: max-content;
}

.client-col-name {
    width: max-content;
}

.client-col-domain {
    width: max-content;
}

.client-col-active {
    width: 70px;
}

.client-col-actions {
    width: 180px;
}

/* Keep buttons tight */
.client-management-table .table-actions {
    justify-content: flex-start;
}

/* =========================
   S360-32 NODE TABLE CLEANUP
========================= */

.node-table {
    width: auto;
    max-width: 100%;
    table-layout: auto;
}

/* Keep everything tight */
.node-table th,
.node-table td {
    white-space: nowrap;
}

/* Set controlled widths (like Roles pattern) */
.node-col-id {
    width: 80px;
}

.node-col-node {
    width: 260px;
}

.node-col-module {
    width: 260px;
}

.node-col-access {
    width: 140px;
}

.node-col-active {
    width: 70px;
}

.node-col-actions {
    width: 180px;
}

/* Keep buttons aligned left */
.node-table .table-actions {
    justify-content: flex-start;
}

/* =========================
   ICON BUTTON (GEAR)
========================= */

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    text-decoration: none;
    font-size: 34px;
    cursor: pointer;
}

.icon-button:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* =========================
   INLINE FORMS
========================= */

.inline-form {
    margin: 0;
    display: inline-flex;
}


.search-field input,
.search-field select,
.search-actions button,
.search-right button {
    height: 34px;
    padding: 6px 10px;
    box-sizing: border-box;
    line-height: normal;
}

/* =========================
   ACTIVE TOGGLE BUTTON WIDTH
========================= */

.table-actions .button-secondary {
    height: 30px;
    min-width: 86px;
    text-align: center;
}


/* =========================
   SYSTEM ADMIN CARDS
========================= */

.admin-card-grid {
    display: grid;
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
}

.admin-card {
    min-height: 110px;
    padding: 18px 12px;
    border-radius: 12px;
    border: 1px solid #cbd5e1;
    text-decoration: none;
    transition: transform 0.08s ease, opacity 0.15s ease;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.admin-card:hover {
    transform: translateY(-2px);
    text-decoration: none;
    opacity: 0.95;
}

.admin-card-icon {
    font-size: 50px;
    line-height: 1;
    margin-bottom: 10px;
}

.admin-card-title {
    font-size: 24px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
}

/* Hide descriptions completely */
.admin-card-desc {
    display: none;
}

/* =========================
   FORM CARD LAYOUT (TRUE 4 COLUMN GRID)
========================= */

.form-card {
    padding: 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
}

.form-grid-fixed {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 58px);
    column-gap: 14px;
    row-gap: 12px;
    align-items: start;
}

.grid-col-1 { grid-column: 1; }
.grid-col-2 { grid-column: 2; }
.grid-col-3 { grid-column: 3; }
.grid-col-4 { grid-column: 4; }

.grid-row-1 { grid-row: 1; }
.grid-row-2 { grid-row: 2; }
.grid-row-3 { grid-row: 3; }

.form-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-field label {
    font-weight: 600;
    font-size: 16px;
    opacity: 0.8;
}

.form-field input,
.form-field select {
    width: 100%;
    height: 36px;
    box-sizing: border-box;
    padding: 6px 10px;
    font-size: 14px;
    line-height: 1;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
}

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* =========================
   USER ROLE ASSIGNMENT UI
========================= */

.roles-section {
    text-align: left;
}

#role-container {
    width: 100%;
}

.role-row {
    display: flex;
    gap: 6px;
    align-items: center;
    margin-bottom: 6px;
}

.role-select {
    width: 100%;
    height: 34px;
}

/* REMOVE BUTTON ICON */
.remove-role-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    min-width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background-color: #b3261e;
    cursor: pointer;
    position: relative;
}

/* Draw X with CSS */
.remove-role-icon::before,
.remove-role-icon::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 2px;
    background-color: white;
}

.remove-role-icon::before {
    transform: rotate(45deg);
}

.remove-role-icon::after {
    transform: rotate(-45deg);
}

.remove-role-icon:hover {
    opacity: 0.85;
}

/* ADD ROLE LINK */
.add-role-wrapper {
    display: flex;
    justify-content: flex-start;
}

#add-role {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 18px;
    font-weight: 500;
    text-decoration: underline;
    cursor: pointer;
    color: #2e7d32;
}

#add-role::before {
    content: "+";
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #2e7d32;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* =========================
   GLOBAL FOOTER
========================= */

.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;

    width: 100%;
    box-sizing: border-box;

    padding: 4px 12px;
    font-size: 12px;

    border-top: 1px solid rgba(109, 40, 217, 0.2);
    background: rgba(109, 40, 217, 0.05);

    opacity: 0.85;
    margin-top: auto;
}

.footer-left,
.footer-right {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* =========================
   ROLE PERMISSION TABLE
========================= */

.permission-table {
    width: auto;
    table-layout: auto;
}

.permission-table th,
.permission-table td {
    white-space: nowrap;
}

.perm-col-id {
    width: 72px;
}

.perm-col-node {
    width: auto;
}

.perm-col-access {
    width: 110px;
}

.perm-col-toggle {
    width: 54px;
    text-align: center;
    padding-left: 4px;
    padding-right: 4px;
}

.perm-col-desc {
    width: 110px;
    text-align: center;
}

.permission-toggle-button {
    min-width: 42px;
    height: 26px;
    padding: 2px 8px;
    border: none;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
}

.permission-toggle-button.is-on {
    background-color: #2e7d32;
    color: #ffffff;
}

.permission-toggle-button.is-off {
    background-color: #b3261e;
    color: #ffffff;
}

/* =========================
   PERMISSION DESCRIPTION MODAL
========================= */

.permission-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.permission-modal-content {
    width: 600px;
    max-width: 1000px;
    max-height: 600px;
    min-width: 320px;
    min-height: 180px;

    padding: 20px;
    border-radius: 12px;
    background: #111827;
    border: 1px solid #cbd5e1;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);

    resize: both;
    overflow: auto;

    position: relative; /* REQUIRED for resize handle visibility */
}

.permission-modal-content h3 {
    margin-top: 0;
    margin-bottom: 12px;
}

#description-modal-body {
    overflow: auto;
    max-height: 400px;
}

.permission-modal-content p {
    margin-bottom: 18px;
    line-height: 1.5;
    white-space: pre-wrap;
}

/* Clean resize handle */
.permission-modal-content::after {
    content: "";
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 12px;
    height: 12px;
    pointer-events: none;

    border-right: 2px solid #9ca3af;
    border-bottom: 2px solid #9ca3af;
    border-radius: 2px;

    opacity: 0.7;
}

/* =========================
   ROLE MANAGEMENT TABLE
========================= */

.role-management-table {
    width: auto;
    table-layout: auto;
}

.role-management-table th,
.role-management-table td {
    white-space: nowrap;
}

.role-col-id {
    width: 70px;
}

.role-col-tenant {
    width: 180px;
}

.role-col-role {
    width: 180px;
}

.role-col-level {
    width: 200px;
}

.role-col-notes {
    min-width: 260px;
}

.role-col-active {
    width: 80px;
    text-align: center;
}

.role-col-actions {
    width: 360px;
}

.role-management-table .table-actions {
    justify-content: flex-start;
}

/* =========================
   LOGIN SUCCESS MESSAGE
========================= */

.login-success {
    background: #16a34a;
    color: #ffffff;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    font-weight: 600;
}

/* =========================
   SUCCESS MESSAGE
========================= */

.success-message {
    margin-top: 6px;
    color: #16a34a;
    font-weight: bold;
}

/* =========================
   LOOKUP TABLE MANAGER
========================= */

.lookup-manager-layout {
    display: grid !important;
    grid-template-columns: 320px minmax(0, 1fr) !important;
    gap: 20px !important;
    align-items: stretch !important;
    height: calc(100vh - 240px);
    min-height: 360px;
}

.lookup-panel {
    display: block !important;
    align-items: initial !important;
    justify-content: flex-start !important;
    text-align: left !important;
    height: calc(100vh - 240px);
    min-height: 360px;
    overflow: hidden;
    padding-top: 12px !important;
    padding-left: 12px !important;
    padding-right: 8px !important;
}

.lookup-panel-scroll {
    height: 100%;
    overflow-y: auto;
    padding: 2px;
}

.lookup-panel h2 {
    margin-top: 2px;
}

.lookup-panel:hover {
    transform: none !important;
    opacity: 1 !important;
}

.lookup-panel .admin-card-title {
    text-align: left !important;
    font-size: 18px !important;
}

.lookup-panel .admin-card-desc {
    display: block !important;
    font-size: 14px;
    opacity: 0.75;
}

.lookup-search-form {
    margin-top: 12px;
}

.lookup-search-input {
    width: 100%;
    box-sizing: border-box;
}

.lookup-search-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.lookup-module-group {
    margin-bottom: 10px;
}

.lookup-module-summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
}

.lookup-table-list {
    margin-top: 4px;
    padding-left: 12px;
}

.lookup-table-link {
    display: block;
    padding: 5px 6px;
    margin-bottom: 4px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 16px;
    transition: none !important;
}

.lookup-table-link:hover {
    transform: none !important;
    text-decoration: none;
    opacity: 1 !important;
}

.lookup-table-link.is-selected {
    font-weight: 600;
    background: rgba(120, 120, 120, 0.18);
}

.lookup-scope-badge {
    font-size: 11px;
    opacity: 0.75;
}

.lookup-empty-panel {
    min-height: 100%;
}

/* Lookup value display table inside lookup_tables.php only */
.lookup-values-table {
    width: auto !important;
    table-layout: auto !important;
    display: inline-table;
    margin-top: 2px;
}

.lookup-values-table th,
.lookup-values-table td {
    width: auto !important;
    white-space: nowrap;

    padding-top: 8px !important;
    padding-bottom: 8px !important;
    padding-left: 12px !important;
    padding-right: 36px !important;

    font-size: 18px !important;
}

.lookup-values-table th:last-child,
.lookup-values-table td:last-child {
    padding-right: 10px !important;
}

.lookup-results-panel .lookup-values-table th {
    font-size: 15px !important;
    font-weight: 600;
}

.lookup-results-panel .permission-toggle-button {
    min-width: 42px;
    height: 24px;
    padding: 0 8px;
    font-size: 11px;
}

.lookup-values-table .lookup-col-rownum,
.lookup-values-table .lookup-col-handle,
.lookup-values-table .lookup-col-dbid {
    width: auto !important;
}

.lookup-values-table .lookup-col-active {
    width: auto !important;
    text-align: left !important;
}

.lookup-values-table .lookup-col-value {
    width: auto !important;
}

.lookup-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    cursor: default;
    font-size: 16px;
    line-height: 1;
    opacity: 0.65;
    user-select: none;
}

.lookup-values-table.is-sort-enabled .lookup-drag-handle {
    color: inherit;
    cursor: grab;
    opacity: 0.9;
}

.lookup-values-table.is-sort-enabled .lookup-drag-handle:active {
    cursor: grabbing;
}

.lookup-values-table tr.is-dragging {
    opacity: 0.45;
}

.lookup-sort-note {
    margin: 4px 0 8px;
    font-size: 13px;
    opacity: 0.75;
}

.lookup-sort-submit-form {
    display: none;
}

.lookup-sort-mode-link {
    min-width: 96px;
}

.lookup-results-panel .permission-toggle-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.lookup-table-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

/* Lookup table action rows */
.lookup-table-actions-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    margin: 0;
}

/* Lookup pagination spacing */
.lookup-pagination {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;

    transform: translateY(1px);
}

.lookup-pagination .button-link,
.lookup-pagination button {
    height: 30px;
    min-width: 54px;
    padding: 0 6px;

    font-size: 16px;
    border-radius: 5px;
}

.lookup-pagination-page-text {
    white-space: nowrap;
    opacity: 0.85;
    font-size: 14px;
}

/* Lookup add button */
.lookup-add-button {
    background: #15803d !important;
    border-color: #15803d !important;
    color: #ffffff !important;
}

.lookup-add-button:hover {
    background: #166534 !important;
    border-color: #166534 !important;
}

.lookup-global-legend {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #facc15;
    font-size: 17px;
    line-height: 1.25;
    white-space: nowrap;
}

.lookup-global-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    min-width: 14px;
    border-radius: 999px;
    background: #facc15;
    box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.35), 0 0 8px rgba(250, 204, 21, 0.25);
    vertical-align: middle;
}

/* Tighten lookup detail spacing */
.lookup-panel .page-title-row {
    margin-bottom: 10px;
}

.lookup-panel .muted-text {
    margin-bottom: 6px;
}

.lookup-table-actions-row {
    margin: 0;
}

.lookup-table-actions {
    margin-top: 4px;
    margin-bottom: 10px;
}

.lookup-results-panel .lookup-panel-scroll {
    overflow: auto;
}

.lookup-results-panel .lookup-values-table {
    display: inline-table !important;
    width: auto !important;
    table-layout: auto !important;
    border-collapse: collapse !important;
}

.lookup-results-panel .lookup-values-table thead {
    display: table-header-group;
    width: auto;
}

.lookup-results-panel .lookup-values-table tbody {
    display: table-row-group;
    max-height: none;
    overflow: visible;
    padding-bottom: 0;
}

.lookup-results-panel .lookup-values-table tr {
    display: table-row;
    width: auto;
    table-layout: auto;
}

.lookup-results-panel .lookup-values-table th,
.lookup-results-panel .lookup-values-table td {
    box-sizing: border-box;
}

.lookup-results-panel .lookup-values-table .lookup-col-rownum,
.lookup-results-panel .lookup-values-table td:nth-child(1) {
    width: 62px !important;
    min-width: 62px !important;
    padding-right: 12px !important;
}

.lookup-results-panel .lookup-values-table .lookup-col-handle,
.lookup-results-panel .lookup-values-table td:nth-child(2) {
    width: 42px !important;
    min-width: 42px !important;
    text-align: center;
    padding-left: 4px !important;
    padding-right: 4px !important;
}

.lookup-results-panel .lookup-values-table .lookup-col-active,
.lookup-results-panel .lookup-values-table td:nth-child(3) {
    width: 74px !important;
    min-width: 74px !important;
    padding-right: 12px !important;
}

.lookup-results-panel .lookup-values-table .lookup-col-value,
.lookup-results-panel .lookup-values-table td:nth-child(4) {
    padding-left: 8px !important;
    padding-right: 16px !important;
}

.lookup-results-panel .lookup-values-table .lookup-col-value {
    width: auto !important;
    min-width: max-content !important;
}

.lookup-results-panel .lookup-values-table .lookup-col-global,
.lookup-results-panel .lookup-values-table td.lookup-col-global {
    width: 32px !important;
    min-width: 32px !important;
    text-align: center;
    padding-left: 4px !important;
    padding-right: 4px !important;
    vertical-align: middle;
}

.lookup-results-panel .lookup-values-table td.lookup-col-global .lookup-global-dot {
    width: 12px;
    height: 12px;
    min-width: 12px;
}

.lookup-results-panel .lookup-values-table .lookup-col-dbid,
.lookup-results-panel .lookup-values-table td.lookup-col-dbid {
    width: 68px !important;
    min-width: 68px !important;
    padding-left: 8px !important;
    padding-right: 10px !important;
}

.lookup-results-panel .lookup-values-table .lookup-col-actions,
.lookup-results-panel .lookup-values-table td.lookup-col-actions {
    width: 100px !important;
    min-width: 100px !important;
}

.lookup-results-panel .lookup-fixed-action-table {
    display: table !important;
    width: auto !important;
    table-layout: auto !important;
}

.lookup-results-panel .lookup-fixed-action-table thead {
    display: table-header-group;
}

.lookup-results-panel .lookup-fixed-action-table tbody {
    display: table-row-group;
    max-height: none;
    overflow: visible;
    padding-bottom: 0;
}

.lookup-results-panel .lookup-fixed-action-table tr {
    display: table-row;
    width: auto;
}

.lookup-results-panel .lookup-fixed-action-table .lookup-fixed-col-rownum,
.lookup-results-panel .lookup-fixed-action-table .lookup-col-rownum,
.lookup-results-panel .lookup-fixed-action-table td:nth-child(1) {
    width: 62px !important;
    min-width: 62px !important;
}

.lookup-results-panel .lookup-fixed-action-table .lookup-fixed-col-handle,
.lookup-results-panel .lookup-fixed-action-table .lookup-col-handle,
.lookup-results-panel .lookup-fixed-action-table td:nth-child(2) {
    width: 42px !important;
    min-width: 42px !important;
    text-align: center;
}

.lookup-results-panel .lookup-fixed-action-table .lookup-fixed-col-active,
.lookup-results-panel .lookup-fixed-action-table .lookup-col-active,
.lookup-results-panel .lookup-fixed-action-table td:nth-child(3) {
    width: 74px !important;
    min-width: 74px !important;
}

.lookup-results-panel .lookup-fixed-action-table .lookup-fixed-col-value,
.lookup-results-panel .lookup-fixed-action-table .lookup-col-value,
.lookup-results-panel .lookup-fixed-action-table td:nth-child(4) {
    width: auto !important;
    min-width: 0 !important;
    padding-left: 8px !important;
    padding-right: 16px !important;
}

.lookup-results-panel .lookup-fixed-action-table .lookup-fixed-col-global,
.lookup-results-panel .lookup-fixed-action-table .lookup-col-global,
.lookup-results-panel .lookup-fixed-action-table td.lookup-col-global {
    width: 32px !important;
    min-width: 32px !important;
}

.lookup-results-panel .lookup-fixed-action-table .lookup-fixed-col-actions,
.lookup-results-panel .lookup-fixed-action-table .lookup-col-actions,
.lookup-results-panel .lookup-fixed-action-table td.lookup-col-actions {
    width: 100px !important;
    min-width: 100px !important;
}

.lookup-results-panel .lookup-fixed-action-table .lookup-fixed-col-dbid,
.lookup-results-panel .lookup-fixed-action-table .lookup-col-dbid,
.lookup-results-panel .lookup-fixed-action-table td.lookup-col-dbid {
    width: 68px !important;
    min-width: 68px !important;
}

.lookup-value-modal.modal-overlay,
.lookup-idnumbertype-modal.modal-overlay {
    background: rgba(3, 7, 18, 0.78);
}

.lookup-value-modal-box,
.lookup-idnumbertype-modal-box {
    width: min(640px, calc(100vw - 48px));
    box-sizing: border-box;
    background: #172033;
    border: 1px solid #64748b;
    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.65),
        0 0 0 1px rgba(148, 163, 184, 0.18),
        0 0 28px rgba(37, 99, 235, 0.18);
    color: #f9fafb;
}

.lookup-value-modal-header,
.lookup-idnumbertype-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.lookup-value-modal-header h2,
.lookup-idnumbertype-modal-header h2 {
    margin: 0;
}

.lookup-value-modal-frame,
.lookup-idnumbertype-modal-frame {
    display: block;
    width: 100%;
    border: 0;
}

.lookup-value-modal-page,
.lookup-idnumbertype-modal-page {
    display: block;
    min-height: 0;
    padding: 12px;
    box-sizing: border-box;
}

.lookup-value-modal-form form,
.lookup-idnumbertype-modal-form form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lookup-value-modal-form textarea,
.lookup-idnumbertype-modal-form textarea {
    width: 100%;
    box-sizing: border-box;
}

.lookup-value-modal-form .lookup-toggle-field {
    align-items: flex-start;
}

.lookup-value-modal-form .lookup-toggle-input {
    display: none;
}

.lookup-value-modal-form .lookup-toggle-button {
    align-self: flex-start;
}

.lookup-value-modal-form .lookup-toggle-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.lookup-value-edit-disabled,
.lookup-value-edit-disabled:hover,
.lookup-idnumbertype-edit-disabled,
.lookup-idnumbertype-edit-disabled:hover {
    opacity: 0.45;
    cursor: not-allowed !important;
    font-weight: 400;
    transform: none;
}

/* =========================
   LUT ADMIN SUMMARY COUNTS
========================= */

.lut-admin-summary-row {
    display: flex;
    gap: 32px;
    align-items: center;
    flex-wrap: wrap;
}

.lut-admin-summary-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* =========================
   LUT ADMIN STATUS COUNTS
========================= */

.lut-admin-count-alert {
    color: #ff4d4d !important;
    font-weight: 700 !important;
}

.lut-admin-summary-separator {
    opacity: 0.5;
    font-weight: 600;
}

/* =========================
   LUT ADMIN UNREGISTERED TABLE
========================= */

.lut-unregistered-table {
    width: auto;
    table-layout: auto;
}

.lut-unregistered-table th,
.lut-unregistered-table td {
    white-space: nowrap;
}

.lut-unregistered-table th:first-child,
.lut-unregistered-table td:first-child {
    width: auto;
    padding-right: 80px;
}

.lut-unregistered-table th:last-child,
.lut-unregistered-table td:last-child {
    width: 120px;
    text-align: left;
}

/* =========================
   LUT ADMIN RESULTS TABLE
========================= */

.lut-admin-table {
    width: auto;
    table-layout: auto;
}

.lut-admin-table th,
.lut-admin-table td {
    white-space: nowrap;
    padding-right: 40px;
}

/* =========================
   LUT ADMIN EDIT FORM
========================= */

.lut-admin-description-field {
    margin-top: 18px;
}

/* =========================
   USER SESSIONS PAGE
========================= */

.user-sessions-filter-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.user-sessions-filter-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.user-sessions-filter-group label {
    margin: 0;
}

.user-sessions-filter-select {
    width: 170px;
    height: 34px;
}

.user-sessions-panel {
    min-height: 0;
    padding: 18px 24px;
    display: block;
    text-align: left;
    align-items: unset;
    justify-content: unset;
    margin-bottom: 22px;
}

.user-sessions-panel:hover {
    transform: none !important;
    opacity: 1 !important;
}

.user-sessions-tenant-header {
    margin-bottom: 14px;
}

.user-sessions-tenant-header h2 {
    margin: 0;
    text-align: left;
}

.user-sessions-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.user-sessions-table {
    width: auto !important;
    table-layout: auto !important;
    margin-top: 0;
    border-collapse: collapse;
}

.user-sessions-table th,
.user-sessions-table td {
    text-align: left !important;
    white-space: nowrap;
    padding-left: 0 !important;
    padding-right: 40px !important;
}
