/* css/users.css - USER MANAGEMENT & ACCESS CONTROL (Catalog Design System) */

/* --- 1. DESIGN TOKENS --- */
:root {
    --bg-main: #F9FAFB;
    --bg-surface: #FFFFFF;
    --bg-hover: #F3F4F6;
    --bg-subtle: #F8FAFC;

    --text-main: #111827;
    --text-secondary: #374151;
    --text-muted: #6B7280;

    --brand-primary: #2563EB;
    --brand-primary-hover: #1D4ED8;
    --brand-soft: #EFF6FF;

    --status-success-bg: #D1FAE5;
    --status-success-text: #059669;
    --status-warning-bg: #FEF3C7;
    --status-warning-text: #D97706;
    --status-danger-bg: #FEE2E2;
    --status-danger-text: #DC2626;
    --status-purple-bg: #F3E8FF;
    --status-purple-text: #7E22CE;

    --border-light: #E5E7EB;
    --border-grid: #E2E8F0;
    --border-strong: #CBD5E1;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 12px 24px -4px rgba(15, 23, 42, 0.12), 0 4px 8px -2px rgba(15, 23, 42, 0.06);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Roboto Mono', monospace;
    --transition-fast: 0.15s ease-in-out;
}

/* --- 2. BASE RESETS & GLOBAL UI UPPERCASE --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    font-size: 13px;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    text-transform: uppercase;
    -webkit-font-smoothing: antialiased;
}

input[type="text"],
select,
textarea {
    text-transform: uppercase;
}

/* Preserve exact case-sensitive credentials & emails underneath */
input[type="email"],
input[type="password"],
.email-input,
.password-input,
.email-cell {
    text-transform: none !important;
}

.mono-text,
.mono-input {
    font-family: var(--font-mono) !important;
    font-variant-numeric: tabular-nums;
}

/* --- 3. MODERN CATALOG-STYLE HEADER --- */
.app-header {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-light);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
    z-index: 40;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-badge {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #2563EB 0%, #3B82F6 100%);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
    flex-shrink: 0;
}

.app-header h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-main);
    line-height: 1.2;
}

.header-submeta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 3px;
    font-size: 11px;
    color: var(--text-muted);
}

.meta-dot {
    color: var(--border-strong);
}

.stats-pill,
.sync-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 11px;
}

.stats-pill {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.sync-pill {
    background: var(--status-success-bg);
    color: var(--status-success-text);
}

.sync-pill.stale {
    background: var(--status-warning-bg);
    color: var(--status-warning-text);
}

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

.header-divider {
    width: 1px;
    height: 22px;
    background: var(--border-light);
    margin: 0 2px;
}

.header-btn {
    height: 34px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.header-btn.ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border-light);
}
.header-btn.ghost:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-main);
}

.header-btn.secondary {
    background: var(--bg-surface);
    color: var(--text-main);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}
.header-btn.secondary:hover:not(:disabled) {
    background: var(--bg-hover);
}

.header-btn.primary {
    background: var(--brand-primary);
    color: #FFFFFF;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
}
.header-btn.primary:hover:not(:disabled) {
    background: var(--brand-primary-hover);
}

.header-btn.danger-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border-light);
}
.header-btn.danger-ghost:hover:not(:disabled) {
    background: var(--status-danger-bg);
    color: var(--status-danger-text);
    border-color: #FCA5A5;
}

/* --- 4. WORKSPACE & KPI STRIP --- */
.catalog-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 24px 18px 24px;
    max-width: 1700px;
    width: 100%;
    margin: 0 auto;
    min-height: 0;
}

.kpi-strip {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    flex-shrink: 0;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    overflow: hidden;
}

.kpi-card > div:not(.kpi-icon) {
    min-width: 0;
    flex: 1;
}

.kpi-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.kpi-icon.blue { background: var(--brand-soft); color: var(--brand-primary); }
.kpi-icon.green { background: var(--status-success-bg); color: var(--status-success-text); }
.kpi-icon.red { background: var(--status-danger-bg); color: var(--status-danger-text); }
.kpi-icon.purple { background: var(--status-purple-bg); color: var(--status-purple-text); }
.kpi-icon.amber { background: var(--status-warning-bg); color: var(--status-warning-text); }
.kpi-icon.slate { background: var(--bg-hover); color: var(--text-secondary); }

.kpi-label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.kpi-value {
    display: block;
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kpi-value-sm {
    font-size: 11.5px;
    line-height: 1.25;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
}

.kpi-submeta {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- 5. TOOLBAR & PILLS --- */
.toolbar-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex-shrink: 0;
}

.toolbar-row-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.search-wrap {
    position: relative;
    flex: 1;
    min-width: 260px;
    max-width: 480px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
}

.toolbar-input {
    width: 100%;
    height: 36px;
    padding: 0 32px 0 36px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-main);
    background: var(--bg-subtle);
    outline: none;
    transition: all var(--transition-fast);
}

.toolbar-input:focus {
    background: var(--bg-surface);
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.input-clear-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}
.input-clear-btn:hover { color: var(--text-main); }

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar-select {
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    font-family: var(--font-sans);
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-main);
}

.modern-select-trigger.enhanced-select {
    min-width: 165px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    font-size: 11.5px;
}

.drawer-form .modern-select-trigger.enhanced-select {
    width: 100%;
}

.toolbar-btn {
    height: 34px;
    padding: 0 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
    white-space: nowrap;
}
.toolbar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}
.toolbar-btn.secondary {
    background: var(--bg-surface);
    color: var(--text-main);
}
.toolbar-btn.clear-btn {
    border-color: #FCA5A5;
    color: var(--status-danger-text);
    background: #FEF2F2;
}

.toolbar-row-pills {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
}

.pills-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}

.quick-pill {
    height: 26px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid var(--border-light);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all var(--transition-fast);
}
.quick-pill:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}
.quick-pill.active {
    background: var(--brand-primary);
    color: #FFFFFF;
    border-color: var(--brand-primary);
}

.keyboard-hint {
    margin-left: auto;
    font-size: 10.5px;
    color: var(--text-muted);
    font-weight: 500;
}

/* --- 6. STAFF DIRECTORY SHEET GRID --- */
.sheet-card {
    flex: 1;
    min-height: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.item-table-wrapper {
    flex: 1;
    overflow: auto;
    min-height: 0;
}

.ledger-grid {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.ledger-grid thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #F8FAFC;
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    height: 34px;
    padding: 0 10px;
    border-bottom: 1px solid var(--border-strong);
    border-right: 1px solid var(--border-grid);
    text-align: left;
    white-space: nowrap;
}

.ledger-grid tbody td {
    height: 38px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border-grid);
    border-right: 1px solid var(--border-grid);
    background: var(--bg-surface);
    vertical-align: middle;
    font-size: 12px;
    color: var(--text-main);
    white-space: nowrap;
}

.ledger-grid tbody tr:hover td {
    background-color: #F8FAFC;
    cursor: pointer;
}

.ledger-grid tbody tr.row-suspended td {
    background-color: #FEF2F2;
    color: var(--text-muted);
}

.staff-name-cell {
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.staff-avatar {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--brand-soft);
    color: var(--brand-primary);
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.email-cell {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-secondary);
}

.status-pill,
.role-pill,
.module-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.status-pill.active {
    background: var(--status-success-bg);
    color: var(--status-success-text);
}

.status-pill.suspended {
    background: var(--status-danger-bg);
    color: var(--status-danger-text);
}

.role-pill {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.role-pill.owner {
    background: var(--status-purple-bg);
    color: var(--status-purple-text);
}

.role-pill.sales {
    background: var(--brand-soft);
    color: var(--brand-primary);
}

.role-pill.accounts {
    background: var(--status-warning-bg);
    color: var(--status-warning-text);
}

.modules-cell-wrap {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: nowrap;
}

.module-chip {
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    color: var(--text-secondary);
}

.module-chip.all-access {
    background: var(--status-purple-bg);
    border-color: #E9D5FF;
    color: var(--status-purple-text);
}

.login-time-cell {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
}

.icon-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: var(--bg-surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    margin: 0 1px;
    transition: all var(--transition-fast);
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand-primary); border-color: #93C5FD; }
.icon-btn.history:hover { background: var(--status-purple-bg); color: var(--status-purple-text); border-color: #D8B4FE; }
.icon-btn.suspend:hover { background: var(--status-warning-bg); color: var(--status-warning-text); border-color: #FCD34D; }
.icon-btn.reactivate:hover { background: var(--status-success-bg); color: var(--status-success-text); border-color: #6EE7B7; }
.icon-btn.delete:hover { background: var(--status-danger-bg); color: var(--status-danger-text); border-color: #FCA5A5; }

.empty-state {
    padding: 48px 20px;
    text-align: center;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 32px;
    margin-bottom: 10px;
    color: var(--border-strong);
}
.empty-state h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}
.empty-state p {
    font-size: 12px;
}

.sheet-footer {
    height: 40px;
    padding: 0 16px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.footer-note {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
}

/* --- 7. SLIDE-OVER DRAWER & MODALS --- */
.modal-backdrop,
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    display: none;
    z-index: 9999;
}

.modal-backdrop {
    justify-content: center;
    align-items: center;
    padding: 16px;
}

.drawer-backdrop {
    justify-content: flex-end;
}

.modal-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
    width: 100%;
    overflow: hidden;
}

.modal-sm { max-width: 440px; }
.modal-lg { max-width: 780px; }

.drawer-panel {
    width: 680px;
    max-width: 96vw;
    height: 100vh;
    background: var(--bg-surface);
    box-shadow: -8px 0 30px rgba(15, 23, 42, 0.15);
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.2s ease-out;
}

.drawer-panel.drawer-lg {
    width: 760px;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-subtitle {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 3px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 6px;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-main); }

.modal-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.drawer-footer-split {
    justify-content: space-between;
    flex-wrap: wrap;
}

.drawer-secondary-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.drawer-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.drawer-section-card {
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 14px;
    background: var(--bg-subtle);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.section-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-main);
}

.mode-pill,
.modules-count-pill {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    background: var(--brand-soft);
    color: var(--brand-primary);
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-secondary);
}

.ledger-input {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: var(--font-sans);
    font-size: 12.5px;
    color: var(--text-main);
    background: var(--bg-surface);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.ledger-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.ledger-input:disabled,
.ledger-input[readonly] {
    background: var(--bg-hover);
    color: var(--text-muted);
    cursor: not-allowed;
}

.password-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.password-field-wrap {
    position: relative;
    flex: 1;
}

.password-field-wrap .ledger-input {
    padding-right: 34px;
    font-family: var(--font-mono);
}

.pwd-eye-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
}
.pwd-eye-btn:hover { color: var(--text-main); }

.field-hint {
    font-size: 10.5px;
    color: var(--text-muted);
}

.preset-bar {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.preset-quick-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.owner-notice-banner {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--status-purple-bg);
    border: 1px solid #E9D5FF;
    color: var(--status-purple-text);
    font-size: 11.5px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* --- 8. MODULE PERMISSIONS MATRIX --- */
.module-groups-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.module-group-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-group-box {
    grid-column: 1 / -1;
    border-color: #DDD6FE;
    background: #FAF5FF;
}

.module-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 6px;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--border-light);
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-secondary);
}

.group-toggle-btn {
    border: 1px solid var(--border-strong);
    background: var(--bg-subtle);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 9.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 5px;
    cursor: pointer;
}
.group-toggle-btn:hover {
    background: var(--brand-soft);
    color: var(--brand-primary);
    border-color: #93C5FD;
}

.mod-check-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.mod-check-item:hover {
    background: var(--bg-hover);
}

.mod-check-item input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: var(--brand-primary);
    cursor: pointer;
}

/* --- 9. LOGIN HISTORY & CONFIRM MODALS --- */
.history-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.dkpi-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 9px 12px;
}
.dkpi-box.highlight {
    background: var(--brand-soft);
    border-color: #BFDBFE;
}
.dkpi-box span {
    display: block;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
}
.dkpi-box strong {
    display: block;
    margin-top: 2px;
    font-size: 12.5px;
    color: var(--text-main);
    word-break: break-all;
}

.modal-table-wrap {
    max-height: 360px;
    overflow: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
}

.action-btn {
    height: 36px;
    padding: 0 15px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: all var(--transition-fast);
}
.action-btn.primary { background: var(--brand-primary); color: #FFFFFF; }
.action-btn.primary:hover { background: var(--brand-primary-hover); }
.action-btn.secondary { background: var(--bg-surface); color: var(--text-main); border-color: var(--border-strong); }
.action-btn.secondary:hover { background: var(--bg-hover); }
.action-btn.danger { background: var(--status-danger-text); color: #FFFFFF; }
.action-btn.danger:hover { background: #B91C1C; }

.confirm-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--status-danger-bg);
    color: var(--status-danger-text);
    font-size: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.confirm-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
}

.confirm-message {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 18px;
}

.confirm-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* --- 10. LOADING OVERLAY & TOASTS --- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(2px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10002;
}

.loading-card {
    background: var(--bg-surface);
    padding: 22px 28px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: 12.5px;
    font-weight: 600;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-light);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast-container {
    position: fixed;
    top: 18px;
    right: 20px;
    z-index: 10005;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast-msg {
    min-width: 260px;
    max-width: 390px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: #111827;
    color: #FFFFFF;
    font-size: 12px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
}
.toast-success { border-left: 4px solid #10B981; }
.toast-error { border-left: 4px solid #EF4444; }
.toast-warning { border-left: 4px solid #F59E0B; }
.toast-info { border-left: 4px solid #3B82F6; }

/* --- 11. RESPONSIVE --- */
@media (max-width: 1200px) {
    .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
    body { overflow: auto; height: auto; }
    .catalog-workspace { padding: 12px; }
    .kpi-strip,
    .form-row-2,
    .module-groups-grid,
    .history-kpi-row {
        grid-template-columns: 1fr;
    }
    .keyboard-hint { margin-left: 0; }
}
