/* OffboardSafe - Main Styles */
:root {
    --primary: #04445C;
    --primary-dark: #033347;
    --primary-hover: #2e84a4;
    --primary-active: #097299;
    --primary-light: #e6f2f5;
    --success: #27ae60;
    --success-light: #d5f4e6;
    --warning: #f39c12;
    --warning-light: #fef5e7;
    --danger: #e74c3c;
    --danger-light: #fadbd8;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --sidebar-width: 256px;
    --sidebar-collapsed-width: 72px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar - matches demo style */
.sidebar {
    width: 256px;
    background: var(--primary);
    color: white;
    position: fixed;
    height: 100vh;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s ease;
    z-index: 200;
    overflow: hidden;
}

.sidebar.collapsed {
    width: 72px;
}

.sidebar-logo {
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.sidebar-logo img {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    background: transparent;
    object-fit: contain;
}

.sidebar-logo span {
    font-weight: 700;
    font-size: 18px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-logo span,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .sidebar-user .user-info {
    display: none;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: rgba(255,255,255,0.7);
    transition: all 0.2s ease;
    text-decoration: none;
    border: none;
    white-space: nowrap;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-nav a.active {
    background: rgba(255,255,255,0.2);
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sidebar-nav a svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Sidebar user section at bottom */
.sidebar-user {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-user .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #10b981;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    color: white;
}

.sidebar-user .user-info {
    overflow: hidden;
}

.sidebar-user .user-info p {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user .user-info .name {
    font-size: 14px;
    font-weight: 500;
}

.sidebar-user .user-info .role {
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--gray-50);
    transition: margin-left 0.3s ease;
}

.page-content {
    flex: 1;
    padding: 24px;
}

/* Top Bar */
.top-bar {
    background: white;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Menu toggle button (desktop + mobile) */
.menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-btn:hover {
    color: #6b7280;
}

.menu-btn svg {
    width: 20px;
    height: 20px;
}

#mobileMenuBtn {
    display: none;
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 190;
    display: none;
}

.sidebar-overlay.show {
    display: block;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background 0.2s;
}

.user-menu:hover {
    background: var(--gray-100);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
}

/* Cards */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--gray-200);
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-weight: 600;
    color: var(--gray-900);
}

.card-body {
    padding: 1.5rem;
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.kpi-card {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--gray-200);
}

.kpi-label {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
}

.kpi-card.warning .kpi-value {
    color: var(--warning);
}

.kpi-card.danger .kpi-value {
    color: var(--danger);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(4, 68, 92, 0.3);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

th {
    font-weight: 600;
    color: var(--gray-600);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--gray-50);
}

tr:hover {
    background: var(--gray-50);
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.25rem;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.375rem;
    transition: all 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

/* Status Chips */
.status-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.status-active, .status-done {
    background: var(--success-light);
    color: #15803d;
}

.status-applicant, .status-not_started {
    background: var(--gray-100);
    color: var(--gray-600);
}

.status-terminating, .status-in_progress {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.status-offboarded, .status-completed {
    background: var(--gray-200);
    color: var(--gray-600);
}

.status-blocked {
    background: var(--danger-light);
    color: #b91c1c;
}

.status-na {
    background: var(--gray-100);
    color: var(--gray-500);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s;
}

.progress-fill.success {
    background: var(--success);
}

.progress-text {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

/* Overdue Badge */
.overdue-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--danger-light);
    color: var(--danger);
    border-radius: 4px;
}

.overdue-text {
    color: var(--danger);
    font-weight: 500;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab:hover {
    color: var(--gray-700);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-label {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

/* Support both display:flex (from JS) and .active class approaches */
.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 2px solid var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-active) 100%);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-title {
    font-weight: 700;
    font-size: 1.25rem;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.modal-body {
    padding: 2rem;
    max-height: 70vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: #f8f9fa;
    border-radius: 0 0 12px 12px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 1rem 1.5rem;
    border-radius: 0.375rem;
    background: var(--gray-800);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.2s ease;
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray-500);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    color: var(--gray-300);
}

.empty-state h3 {
    font-size: 1.125rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

/* Task List */
.task-list {
    display: flex;
    flex-direction: column;
}

.task-item {
    display: flex;
    align-items: flex-start;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-100);
    gap: 1rem;
}

.task-item:last-child {
    border-bottom: none;
}

.task-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.task-checkbox.checked {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.task-content {
    flex: 1;
}

.task-title {
    font-weight: 500;
    color: var(--gray-800);
}

.task-meta {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: 0.25rem;
}

.task-actions {
    display: flex;
    gap: 0.5rem;
}

/* Category Groups */
.category-group {
    margin-bottom: 1.5rem;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--gray-100);
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

.category-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
}

.category-count {
    font-size: 0.75rem;
    color: var(--gray-500);
}

/* Security Critical Badge */
.security-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--danger);
    font-weight: 500;
}

/* Loading Spinner */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-active) 100%);
}

.login-card {
    background: white;
    border-radius: 0.5rem;
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h1 {
    font-size: 1.5rem;
    color: var(--gray-800);
}

.login-logo p {
    color: var(--gray-500);
    font-size: 0.875rem;
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-btn {
    width: 100%;
    margin-top: 0.5rem;
}

.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.login-footer a {
    color: var(--primary);
    text-decoration: none;
}

/* Old mobile-menu-btn styles removed — now using .menu-btn */

/* ============================================
   Responsive Styles
   ============================================ */

/* Mobile devices (max-width: 768px) */
@media (max-width: 768px) {
    /* Show mobile menu btn, hide desktop one */
    #mobileMenuBtn {
        display: flex;
    }
    #desktopMenuBtn {
        display: none;
    }
    
    /* Sidebar - hidden by default on mobile, slides in from left */
    .sidebar {
        position: fixed;
        left: -256px;
        top: 0;
        bottom: 0;
        width: 256px;
        z-index: 1000;
        transition: left 0.3s ease;
        overflow-y: auto;
    }
    
    .sidebar.collapsed {
        width: 256px; /* don't collapse on mobile */
    }
    
    /* Sidebar open state */
    .sidebar.mobile-open {
        left: 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }
    
    .sidebar-overlay.show {
        z-index: 999;
    }
    
    /* Adjust main content for mobile */
    .main-content {
        margin-left: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 30px !important;
        width: 100%;
    }
    
    .page-content {
        padding: 1rem;
    }
    
    /* Top bar adjustments */
    .top-bar {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .top-bar-left {
        flex: 1;
        min-width: 0;
    }
    
    .top-bar-right {
        gap: 0.5rem;
    }
    
    .page-name {
        font-size: 1rem;
    }
    
    /* Info bar mobile */
    .info-bar {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem 1rem;
    }
    
    .info-bar-left,
    .info-bar-right {
        gap: 0.75rem;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .info-item {
        font-size: 0.75rem;
    }
    
    .info-label {
        font-size: 0.75rem;
    }
    
    .info-value {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }
    
    /* Footer adjustments */
    .app-footer {
        padding: 8px 0.75rem;
        left: 0;
        right: 0;
        width: 100%;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 4px;
    }
    
    .footer-divider {
        display: none;
    }
    
    .footer-copyright,
    .footer-lafoba {
        font-size: 0.75rem;
    }
    
    .lafoba-logo {
        height: 14px;
    }
    
    /* Tables responsive */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        font-size: 0.875rem;
    }
    
    th, td {
        padding: 0.5rem 0.75rem;
    }
    
    /* Modals full width on mobile */
    .modal {
        width: 95%;
        max-width: 95%;
        margin: 1rem auto;
    }
    
    /* Forms */
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    /* Buttons */
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* KPIs */
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .kpi-card {
        padding: 1rem;
    }
    
    .kpi-value {
        font-size: 1.5rem;
    }
    
    /* Page header */
    .page-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    /* Filters */
    .filters {
        flex-direction: column;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-group .form-select,
    .filter-group .form-input {
        width: 100%;
    }
    
    /* Tabs */
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab {
        padding: 0.5rem 1rem;
        font-size: 0.8125rem;
        white-space: nowrap;
    }
    
    /* Detail header */
    .detail-header {
        padding: 1rem;
        margin: -1rem -1rem 1rem -1rem;
    }
    
    .detail-title {
        font-size: 1.25rem;
    }
    
    .detail-meta {
        gap: 1rem;
    }
    
    /* Permissions grid */
    .permissions-grid {
        grid-template-columns: 1fr;
    }
    
    .role-header {
        flex-direction: column;
        text-align: center;
    }
    
    /* User menu */
    .user-menu span {
        display: none;
    }
}

/* Tablet styles */
@media (min-width: 769px) and (max-width: 1024px) {
    .info-bar-left,
    .info-bar-right {
        gap: 1.5rem;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .top-bar {
        padding: 0.5rem;
    }
    
    .top-bar-right {
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    /* Hide plan on very small screens */
    .info-item:has(#info-plan) {
        display: none;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .role-badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
    
    /* Action buttons stack */
    .action-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
}

/* Dropdown Menu */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 160px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 100;
}

.dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: var(--gray-700);
    text-decoration: none;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--gray-100);
}

.dropdown-divider {
    border-top: 1px solid var(--gray-200);
    margin: 0.25rem 0;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}

.badge-primary {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.badge-success {
    background: var(--success-light);
    color: #15803d;
}

.badge-warning {
    background: var(--warning-light);
    color: #b45309;
}

.badge-danger {
    background: var(--danger-light);
    color: #b91c1c;
}

/* Action buttons row */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* Hide empty action containers to prevent layout issues */
.action-buttons:empty {
    display: none !important;
}

/* Hide action buttons that only contain whitespace */
.action-buttons:not(:has(*)) {
    display: none !important;
}

/* Table action cells - hide when empty */
td.action-buttons:empty,
td.action-buttons:not(:has(*)) {
    display: none;
}

/* Fix for detail header when actions are hidden */
.detail-header-top {
    flex-wrap: wrap;
}

.detail-header-top:has(.action-buttons:empty),
.detail-header-top:has(.action-buttons:not(:has(*))) {
    justify-content: flex-start;
}

/* Card actions - hide border when empty */
.card-actions:empty,
.card-actions:not(:has(*)) {
    display: none !important;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* Ensure consistent spacing when actions are hidden */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Page header adjusts when button is hidden */
.page-header:has(.btn:only-child:empty) {
    justify-content: flex-start;
}

/* Section headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-800);
}

/* Detail page header */
.detail-header {
    background: white;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--gray-200);
    margin: -2rem -2rem 2rem -2rem;
}

.detail-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.detail-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--gray-900);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.detail-meta {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.detail-meta-item {
    font-size: 0.875rem;
}

.detail-meta-item .label {
    color: var(--gray-500);
}

.detail-meta-item .value {
    color: var(--gray-800);
    font-weight: 500;
}

/* Grid layout */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

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



/* ============================================
   Top Bar - additional styles (base in earlier block)
   ============================================ */

.page-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.top-bar-center {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.info-icon {
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.info-icon svg {
    flex-shrink: 0;
}

.info-text {
    font-weight: 500;
    color: #555;
}

/* User Dropdown */
.user-dropdown {
    position: relative;
}

.user-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    font-size: 0.875rem;
}

.user-dropdown-btn:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

.user-icon {
    font-size: 1.2rem;
}

.user-avatar-container {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    background: linear-gradient(135deg, #04445C 0%, #097299 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-avatar-initials {
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-name {
    font-weight: 600;
    color: #2c3e50;
}

.dropdown-arrow {
    font-size: 0.7rem;
    color: #888;
    transition: transform 0.2s;
}

.user-dropdown-btn:hover .dropdown-arrow {
    transform: translateY(2px);
}

.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
    z-index: 1000;
}

.user-dropdown-menu.show,
.user-dropdown-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: #2c3e50;
    text-decoration: none;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.user-dropdown-menu .dropdown-item:last-child {
    border-bottom: none;
}

.user-dropdown-menu .dropdown-item:hover {
    background: #f5f5f5;
}

.user-dropdown-menu .dropdown-item span {
    font-size: 1rem;
}

.user-dropdown-menu .dropdown-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 0.25rem 0;
}

/* Role Badge */
.role-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.role-admin,
.role-owner {
    background: #fee;
    color: #e74c3c;
}

.role-it {
    background: #e3f2fd;
    color: #2196f3;
}

.role-hr {
    background: #f3e5f5;
    color: #9c27b0;
}

.role-manager {
    background: #fff3e0;
    color: #ff9800;
}

.role-user {
    background: #f5f5f5;
    color: #757575;
}

/* Plan Badge */
.plan-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}

.plan-trial {
    background: #e3f2fd;
    color: #1976d2;
}

.plan-core {
    background: #e8f5e9;
    color: #388e3c;
}

.plan-pro {
    background: #fff3e0;
    color: #f57c00;
}

.plan-enterprise {
    background: #fce4ec;
    color: #c2185b;
}

.plan-status-expired {
    background: #fee;
    color: #d32f2f;
}

.plan-status-disabled {
    background: #f5f5f5;
    color: #757575;
}

/* ============================================
   Footer Styles - Dark Theme with Lafoba Logo
   ============================================ */
.app-footer {
    background: linear-gradient(135deg, #04445C 0%, #065f85 100%);
    color: #ffffff;
    padding: 10px 1.5rem;
    text-align: center;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.footer-copyright {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

.footer-divider {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.7rem;
}

.footer-lafoba {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.footer-lafoba a {
    display: inline-flex;
    align-items: center;
    transition: opacity 0.2s ease;
}

.footer-lafoba a:hover {
    opacity: 0.8;
}

.lafoba-logo {
    height: 18px;
    width: auto;
    vertical-align: middle;
    filter: brightness(1);
    transition: filter 0.2s ease;
}

.footer-lafoba a:hover .lafoba-logo {
    filter: brightness(1.2);
}

.footer-legal {
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

.footer-legal a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-legal a:hover {
    color: rgba(255, 255, 255, 1);
    text-decoration: underline;
}

/* Adjust main content to use flexbox for footer positioning */
.main-content {
    display: flex;
    flex-direction: column;
}

.page-content {
    flex: 1;
}

/* Footer mobile fix */
@media (max-width: 768px) {
    .app-footer {
        padding: 10px 1rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 6px;
    }
    
    .footer-divider {
        display: none;
    }
    
    .footer-copyright {
        font-size: 0.75rem;
    }
    
    .footer-legal {
        font-size: 0.7rem;
        gap: 10px;
    }
}

/* ============================================
   Permissions Section Styles (Settings Page)
   ============================================ */
.permissions-container {
    display: grid;
    gap: 1.5rem;
}

.role-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    border: 1px solid var(--gray-200);
    border-left: 4px solid var(--primary);
}

.role-section[data-role="it"] {
    border-left-color: #3498db;
}

.role-section[data-role="hr"] {
    border-left-color: #9b59b6;
}

.role-section[data-role="manager"] {
    border-left-color: #f39c12;
}

.role-section[data-role="user"] {
    border-left-color: #95a5a6;
}

.role-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.role-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--gray-100);
}

.role-icon.it {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.role-icon.hr {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    color: white;
}

.role-icon.manager {
    background: linear-gradient(135deg, #f39c12, #e67e22);
    color: white;
}

.role-icon.user {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.role-section h3 {
    margin: 0 0 0.25rem 0;
    color: var(--gray-800);
    font-size: 1.125rem;
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.permission-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.permission-checkbox:hover {
    background: var(--gray-50);
}

.permission-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
}

.permission-checkbox .label-text {
    color: var(--gray-700);
}

/* Dirty state for save buttons */
.btn-primary.dirty {
    background: #e67e22;
}

.btn-primary.dirty:hover {
    background: #d35400;
}

/* Sidebar logo adjustments removed — now in main sidebar section */

/* Responsive adjustments for top bar */
@media (max-width: 992px) {
    .top-bar-center {
        gap: 1rem;
    }
    
    .info-item {
        font-size: 0.75rem;
    }
    
    .info-icon {
        font-size: 0.875rem;
    }
}

@media (max-width: 768px) {
    .top-bar {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .top-bar-center {
        order: 3;
        width: 100%;
        justify-content: center;
        gap: 0.75rem;
        padding-top: 0.5rem;
        border-top: 1px solid #eee;
        margin-top: 0.5rem;
    }
    
    .page-name {
        font-size: 1.2rem;
    }
    
    .user-dropdown-btn {
        padding: 0.375rem 0.75rem;
    }
    
    .user-name {
        display: none;
    }
    
    .info-icon {
        font-size: 0.875rem;
    }
    
    .info-text {
        font-size: 0.75rem;
    }
    
    /* Hide plan on mobile */
    .top-bar-center .info-item:nth-child(3) {
        display: none;
    }
    
    .permissions-grid {
        grid-template-columns: 1fr;
    }
    
    .role-header {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .top-bar-center {
        gap: 0.5rem;
    }
    
    .info-item {
        font-size: 0.7rem;
    }
    
    .role-badge {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
    }
}

/* ============================================
   Inline SVG Icon Styles
   ============================================ */

/* Make inline SVGs align with text properly */
h1 > svg, h2 > svg, h3 > svg, h4 > svg, h5 > svg,
a > svg, button > svg, span > svg, p > svg, label > svg, strong > svg, td > svg,
.stat-icon > svg, .icon > svg, .feature-icon > svg, .kpi-icon > svg,
.empty-icon > svg, .security-icon > svg, .notice-icon > svg,
.plan-icon > svg, .trial-warning-icon > svg, .comments-empty-icon > svg,
.signoff-icon > svg, li > svg {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

/* Headings with SVGs */
h1 > svg { width: 28px; height: 28px; margin-right: 8px; vertical-align: -3px; }
h2 > svg { width: 24px; height: 24px; margin-right: 6px; vertical-align: -3px; }
h3 > svg { width: 20px; height: 20px; margin-right: 6px; vertical-align: -2px; }
h4 > svg { width: 18px; height: 18px; margin-right: 4px; vertical-align: -2px; }

/* Inline text icons */
a > svg, button > svg, span > svg, p > svg, label > svg, strong > svg, li > svg, td > svg {
    width: 16px;
    height: 16px;
    margin-right: 4px;
    vertical-align: -2px;
}

/* Stat card icons (vendor pages) */
.stat-icon > svg {
    width: 24px;
    height: 24px;
}

/* Feature/KPI card icons */
.icon > svg, .feature-icon > svg, .kpi-icon > svg {
    width: 24px;
    height: 24px;
}

/* Empty state icons */
.empty-icon > svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

/* Comments empty state */
.comments-empty-icon > svg {
    width: 48px;
    height: 48px;
    opacity: 0.4;
}

/* Security icons in settings */
.security-icon > svg {
    width: 32px;
    height: 32px;
}

/* Plan icon */
.plan-icon > svg {
    width: 40px;
    height: 40px;
}

/* Trial warning icon */
.trial-warning-icon > svg {
    width: 24px;
    height: 24px;
}
