/* CSS VARIABLES FOR HARMONIOUS DARK MODE */
:root {
    --bg-app: #011320;
    --bg-sidebar: #002238;
    --bg-card: rgba(0, 34, 56, 0.75);
    --bg-card-hover: rgba(0, 34, 56, 0.9);
    --bg-input: #0c334b;
    --border-color: rgba(152, 176, 71, 0.25);
    --border-focus: #98b047;
    
    --text-main: #e6e6e6;
    --text-muted: #94a3b8;
    --text-light: #ffffff;
    
    --color-primary: #98b047;
    --color-primary-hover: #a6bf4f;
    --color-success: #98b047;
    --color-success-hover: #a6bf4f;
    --color-error: #ef4444;
    --color-warning: #f0a614;
    
    --sidebar-width: 260px;
    --transition-speed: 0.25s;
    --border-radius: 12px;
    --bg-secondary: #002238;
}

/* BASE RESET */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    color: var(--text-light);
    font-weight: 600;
}

/* APP LAYOUT CONTAINER */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* SIDEBAR STYLING */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.logo-container {
    padding: 25px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
}

.logo-img {
    max-width: 100%;
    max-height: 60px;
    object-fit: contain;
}

.logo-fallback {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary);
    letter-spacing: 0.5px;
}

.nav-section {
    padding: 25px 15px;
    flex-grow: 1;
}

.nav-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    font-weight: 700;
    padding-left: 10px;
    margin-bottom: 15px;
    display: block;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 12px 15px;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--border-radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all var(--transition-speed) ease;
}

.nav-btn i {
    font-size: 16px;
    width: 20px;
    transition: color var(--transition-speed);
}

.nav-btn:hover {
    color: var(--text-main);
    background-color: var(--bg-card);
}

.nav-btn.active {
    color: var(--text-light);
    background-color: rgba(152, 176, 71, 0.15);
    border-color: rgba(152, 176, 71, 0.3);
    position: relative;
}

.nav-btn.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 4px;
    background-color: var(--color-primary);
    border-radius: 0 4px 4px 0;
}

.nav-btn.active i {
    color: var(--color-primary);
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* MAIN CONTENT AREA */
.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 25px;
    background-color: var(--bg-app);
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-shrink: 0;
}

.main-header h1 {
    font-size: 26px;
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--bg-card);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    border: 1px solid var(--border-color);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.green { background-color: var(--color-success); box-shadow: 0 0 8px var(--color-success); }
.status-dot.red { background-color: var(--color-error); box-shadow: 0 0 8px var(--color-error); }
.status-dot.yellow { background-color: var(--color-warning); box-shadow: 0 0 8px var(--color-warning); }

/* TAB CONTAINERS */
.tab-view {
    display: none;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
    animation: fadeIn var(--transition-speed) ease-out;
}

.tab-view.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* BUTTONS */
.btn {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    font-family: inherit;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--text-light);
}
.btn-primary:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
    box-shadow: 0 4px 12px rgba(152, 176, 71, 0.3);
}

.btn-success {
    background-color: var(--color-success);
    color: var(--text-light);
}
.btn-success:hover:not(:disabled) {
    background-color: var(--color-success-hover);
    box-shadow: 0 4px 12px rgba(76, 209, 55, 0.3);
}

.btn-outline {
    background: none;
    border-color: var(--border-color);
    color: var(--text-main);
}
.btn-outline:hover:not(:disabled) {
    border-color: var(--text-muted);
    background-color: var(--bg-card);
}

.btn-large {
    padding: 14px 24px;
    font-size: 15px;
    border-radius: 10px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* CONTROLS ROW */
.controls-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-shrink: 0;
    gap: 15px;
}

.provider-switch {
    display: flex;
    background-color: var(--bg-sidebar);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.provider-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.provider-btn:hover {
    color: var(--text-main);
}

.provider-btn.active {
    background-color: var(--bg-card);
    color: var(--text-light);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* CARDS AND DUAL PANELS */
.card {
    background-color: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

.card-full {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    overflow: hidden;
    padding: 0; /* Let lists pad independently */
}

.dual-panel {
    display: flex;
    gap: 20px;
    flex-grow: 1;
    overflow: hidden;
}

.panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-left {
    width: 320px;
    flex-shrink: 0;
}

.panel-right {
    flex-grow: 1;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-shrink: 0;
    gap: 15px;
}

.panel-header.border-bottom {
    border-bottom: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 0;
}

.title-desc h3 {
    margin-bottom: 4px;
}

.subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.panel-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.panel-filter-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    flex-shrink: 0;
}

.row-count {
    font-size: 13px;
    color: var(--text-muted);
}

/* SEARCH BOX */
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-box i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 14px;
}

.search-box input {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 12px 8px 36px;
    border-radius: 8px;
    font-size: 13px;
    width: 100%;
    outline: none;
    transition: border-color var(--transition-speed);
}

.search-box input:focus {
    border-color: var(--border-focus);
}

.width-300 { width: 300px; }

/* TENANT LIST CONTAINER */
.tenant-list-container {
    flex-grow: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-right: 5px;
}

.tenant-item {
    display: block;
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-main);
    padding: 12px 14px;
    text-align: left;
    font-size: 13px;
    border-radius: 6px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.2s ease;
    flex-shrink: 0; /* Prevent vertical squishing inside the flex list */
    min-height: 40px;
    line-height: 1.4;
}

.tenant-item:hover {
    background-color: var(--bg-input);
    border-color: var(--border-color);
}

.tenant-item.selected {
    background-color: var(--color-primary);
    color: var(--text-light);
    font-weight: 500;
    box-shadow: 0 4px 10px rgba(30, 144, 255, 0.2);
}

/* TABLE STYLING */
.table-container {
    flex-grow: 1;
    overflow-y: auto;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.padding-0 { padding: 0; }
.height-500 { height: 500px; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

thead {
    position: sticky;
    top: 0;
    background-color: var(--bg-secondary);
    box-shadow: 0 1px 0 var(--border-color);
    z-index: 1;
}

th {
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-main);
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background-color: var(--bg-card-hover);
}

.double-click-hint {
    cursor: pointer;
}

.empty-row {
    color: var(--text-muted);
    padding: 40px !important;
}

.text-center { text-align: center; }

/* CUSTOM SCROLLBARS */
.scrollbar::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.scrollbar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* PROGRESS BAR */
.progress-container {
    padding: 15px 20px;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.progress-bar-wrapper {
    height: 6px;
    background-color: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar-fill {
    height: 100%;
    background-color: var(--color-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-bar-fill.animated {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 40px 40px;
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    from { background-position: 40px 0; }
    to { background-position: 0 0; }
}

.progress-status {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.hidden { display: none !important; }

/* MODALS */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    animation: fadeIn 0.2s ease;
}

.modal {
    width: 800px;
    max-width: 90vw;
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 0;
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--color-error);
}

.modal-progress {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    background-color: hsl(222, 19%, 10%);
}

.max-height-400 {
    max-height: 400px;
    border: none;
    border-radius: 0;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* AUDIT LAYOUTS & FORMS */
.grid-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    flex-grow: 1;
    overflow-y: auto;
    padding-bottom: 10px;
}

.grid-col-2 { grid-column: span 1; }
.grid-col-1 { grid-column: span 1; }

.modern-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-top: 15px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.flex-2 { flex: 2; }
.flex-1 { flex: 1; }

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
}

.required {
    color: var(--color-error);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="date"],
.form-group input[type="month"],
.form-group input[type="email"],
.form-group select,
.modern-form .form-group input[type="date"] {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    width: 100%;
    height: 42px;
    min-height: 42px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(30, 144, 255, 0.2);
}

.form-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
    margin-top: 10px;
}

/* COMBOBOX & DROP-DOWN AUTO-COMPLETE */
.combobox-wrapper {
    position: relative;
}

.combobox-wrapper select {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    z-index: 10;
    max-height: 180px;
    overflow-y: auto;
    border-radius: 0 0 8px 8px;
    border-top: none;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    background-color: var(--bg-input);
}

.combobox-wrapper select option {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-main);
}

.combobox-wrapper select option:hover,
.combobox-wrapper select option:checked {
    background-color: var(--color-primary);
    color: var(--text-light);
}

/* CHECKBOX STYLING */
.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 28px;
    cursor: pointer;
    font-size: 13px;
    user-select: none;
    color: var(--text-main);
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    left: 0;
    height: 18px;
    width: 18px;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.checkbox-container:hover input ~ .checkmark {
    border-color: var(--text-muted);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.check-group {
    padding: 5px 0;
}

/* FILE UPLOAD STYLING */
.file-upload-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
}

.drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    background-color: hsl(222, 19%, 10%);
    transition: all var(--transition-speed) ease;
    min-height: 140px;
    position: relative;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--color-primary);
    background-color: var(--bg-input);
}

.drop-icon {
    font-size: 32px;
    color: var(--text-muted);
    margin-bottom: 10px;
    transition: color var(--transition-speed);
}

.drop-zone:hover .drop-icon {
    color: var(--color-primary);
}

.drop-text {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.hidden-file-input {
    display: none;
}

.file-info {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-card);
    border-radius: calc(var(--border-radius) - 2px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    z-index: 2;
}

.file-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
    display: block;
}

.remove-file {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    transition: color 0.2s;
}

.remove-file:hover {
    color: var(--color-error);
}

/* JSON FILES LIST */
.files-list {
    margin-top: 12px;
    background: rgba(12, 51, 75, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

.files-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 1px solid rgba(152, 176, 71, 0.15);
    padding-bottom: 8px;
    margin-bottom: 4px;
}

.btn-clear-all {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: color var(--transition-speed);
}

.btn-clear-all:hover {
    color: var(--color-error);
}

.files-list-items {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12px;
    transition: all 0.2s ease;
}

.file-item:hover {
    background-color: rgba(255, 255, 255, 0.07);
    border-color: rgba(152, 176, 71, 0.3);
    transform: translateX(2px);
}

.file-item-name {
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 85%;
}

.file-item-name i {
    color: var(--color-primary);
    font-size: 14px;
}

.file-item-name .file-size {
    color: var(--text-muted);
    font-size: 10px;
    margin-left: 4px;
}

.file-item-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    transition: color var(--transition-speed), transform 0.2s;
}

.file-item-remove:hover {
    color: var(--color-error);
    transform: scale(1.15);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

.margin-top-20 { margin-top: 20px; }
.margin-top-10 { margin-top: 10px; }
.width-full { width: 100%; }

.flex-col {
    display: flex;
    flex-direction: column;
}

/* AUDIT GENERATION PROGRESS */
.audit-status-panel {
    background-color: hsl(222, 19%, 10%);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.audit-status-panel h4 {
    font-size: 14px;
}

.status-msg {
    font-size: 12px;
    color: var(--text-muted);
}

/* CONFIGURATION DETAILS */
.grid-form-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    padding: 20px;
    overflow-y: auto;
    flex-grow: 1;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.section-heading {
    font-size: 16px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.section-heading i {
    color: var(--color-primary);
}

.action-footer {
    padding: 20px;
    display: flex;
    justify-content: flex-end;
    flex-shrink: 0;
}

.action-footer.border-top {
    border-top: 1px solid var(--border-color);
}

/* OAUTH CONNECT CARD */
.oauth-connection-card {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
}

.oauth-connection-card h5 {
    font-size: 13px;
    margin-bottom: 12px;
}

.connection-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.status-indicator {
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-hint {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}

.card-hint code {
    background-color: var(--bg-card);
    padding: 2px 4px;
    border-radius: 4px;
    font-family: monospace;
}

/* RESPONSIVE DESIGN FOR SMARTPHONES (iPhone 15 Pro, etc.) */
.sidebar-toggle-btn {
    display: none;
}
.sidebar-close-btn {
    display: none;
}
.header-title-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

@media (max-width: 768px) {
    .sidebar-toggle-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: var(--bg-sidebar);
        border: 1px solid var(--border-color);
        color: var(--text-main);
        width: 40px;
        height: 40px;
        border-radius: 8px;
        cursor: pointer;
        font-size: 18px;
        transition: all var(--transition-speed);
        flex-shrink: 0;
    }
    .sidebar-toggle-btn:hover {
        background: var(--bg-card);
        border-color: var(--border-focus);
    }
    
    .sidebar-close-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: transparent;
        border: none;
        color: var(--text-muted);
        cursor: pointer;
        font-size: 20px;
        padding: 5px;
        transition: color var(--transition-speed);
        margin-left: auto;
    }
    .sidebar-close-btn:hover {
        color: var(--color-error);
    }
    
    body {
        overflow-y: auto;
        height: auto;
    }
    
    .app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        overflow-x: hidden;
    }
    
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform var(--transition-speed) ease-in-out;
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.7);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        padding: 15px;
        width: 100%;
        overflow-y: visible;
        height: auto;
    }
    
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .main-header h1 {
        font-size: 20px;
        line-height: 1.3;
    }
    
    .status-bar {
        font-size: 11px;
        padding: 4px 10px;
    }
    
    .controls-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    
    .provider-switch {
        width: 100%;
        flex-wrap: wrap;
        gap: 4px;
        padding: 2px;
    }
    
    .provider-btn {
        flex: 1 1 calc(50% - 6px);
        text-align: center;
        padding: 8px 6px;
        font-size: 12px;
    }
    
    .dual-panel {
        flex-direction: column;
        height: auto;
        overflow-y: visible;
        gap: 15px;
    }
    
    .panel-left {
        width: 100%;
        height: 250px;
        flex-shrink: 0;
    }
    
    .panel-right {
        width: 100%;
        height: auto;
    }
    
    .panel-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .panel-actions {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .panel-actions .search-box,
    .panel-actions button {
        width: 100%;
    }
    
    /* Atera Contracts layout */
    .panel-filter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .width-300 {
        width: 100%;
    }
    
    .height-500 {
        height: auto;
        max-height: 400px;
    }
    
    /* Audit Layout */
    .grid-layout {
        grid-template-columns: 1fr;
        height: auto;
        overflow-y: visible;
    }
    
    .form-row {
        flex-direction: column;
        gap: 15px;
    }
    
    .file-upload-section {
        margin-top: 15px;
    }
    
    /* Configuration Form Layout */
    .grid-form-sections {
        grid-template-columns: 1fr;
        gap: 25px;
        padding: 10px;
        height: auto;
        overflow-y: visible;
    }
    
    .connection-status-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .connection-status-row button {
        width: 100%;
    }
    
    .action-footer {
        padding: 15px 10px;
        justify-content: center;
    }
    
    .action-footer button {
        width: 100%;
    }
    
    /* Modals */
    .modal {
        width: 95vw;
        max-height: 90vh;
        margin: 10px;
    }
    
    .max-height-400 {
        max-height: 300px;
    }
}

/* GLOBAL LOGIN OVERLAY STYLING */
.login-overlay-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(1, 19, 32, 0.96);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* Plus élevé que les autres éléments */
    animation: fadeIn 0.3s ease;
}

.login-overlay-wrapper.hidden {
    display: none !important;
}

.login-card {
    width: 420px;
    max-width: 90vw;
    padding: 35px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75);
}

.login-logo {
    margin-bottom: 25px;
}

.login-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    padding: 10px;
    border-radius: 6px;
    margin-top: 15px;
}

/* ==========================================
   TIME TRACKING & LEAVE MANAGEMENT STYLES
   ========================================== */

.time-counters-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

@media (max-width: 1200px) {
    .time-counters-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .time-counters-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .time-counters-grid {
        grid-template-columns: 1fr;
    }
}

.time-counter-card {
    background-color: var(--bg-card-hover);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.time-counter-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.6);
    border-color: rgba(152, 176, 71, 0.5);
}

.time-counter-card .counter-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.time-counter-card .counter-icon.color-primary {
    color: var(--color-primary);
    background-color: rgba(152, 176, 71, 0.1);
}

.time-counter-card .counter-icon.color-success {
    color: #10b981;
    background-color: rgba(16, 185, 129, 0.1);
}

.time-counter-card .counter-icon.color-warning {
    color: #fbbf24;
    background-color: rgba(251, 191, 36, 0.1);
}

.time-counter-card .counter-icon.color-danger {
    color: #ef4444;
    background-color: rgba(239, 68, 68, 0.1);
}

.time-counter-card .counter-info {
    display: flex;
    flex-direction: column;
}

.time-counter-card .counter-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.time-counter-card h3 {
    font-size: 20px;
    margin: 0;
    font-weight: 700;
}

/* Calendar styling adjustments */
.calendar-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.calendar-grid-header {
    user-select: none;
}

.calendar-grid {
    flex-grow: 1;
}

.calendar-day {
    position: relative;
    user-select: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.calendar-day:hover {
    background-color: rgba(152, 176, 71, 0.1) !important;
    border-color: rgba(152, 176, 71, 0.5) !important;
    transform: scale(1.02);
}

.calendar-day.today {
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 12px rgba(152, 176, 71, 0.3) !important;
}

.calendar-day.today .day-number {
    color: var(--color-primary);
}

.calendar-day.has-entries {
    background-color: rgba(152, 176, 71, 0.08) !important;
}

.day-badges-container {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    margin-top: auto;
    padding-top: 4px;
}

.day-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    cursor: help;
    position: relative;
}

/* Tooltip for calendar badges */
.day-badge-dot[title]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #011320;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    white-space: nowrap;
    z-index: 10;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

/* History list scroll bar & transitions */
.time-history-container {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.time-history-container::-webkit-scrollbar {
    width: 6px;
}

.time-history-container::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}



.modern-form .form-group input[type="date"]:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(152, 176, 71, 0.2);
}

.modern-form textarea:focus {
    border-color: var(--border-focus) !important;
    outline: none;
    box-shadow: 0 0 0 2px rgba(152, 176, 71, 0.2);
}

/* Admin actions alignment */
.admin-actions-row .form-group input[type="month"] {
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    width: 100%;
    transition: all 0.2s ease;
    font-family: inherit;
}

.admin-actions-row .form-group input[type="month"]:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(152, 176, 71, 0.2);
}

/* Configuration Page Scroll & Header Opacity Fix */
#tab-config {
    overflow-y: auto !important;
    padding-bottom: 20px;
    scrollbar-width: thin;
}

#tab-config.active {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#tab-config .card-full {
    overflow: visible !important;
    flex-shrink: 0;
}

#tab-config .table-container {
    overflow-x: auto;
    overflow-y: visible !important;
}

/* Make table headers completely opaque when scrolling */
thead th {
    background-color: #002238 !important;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Badge for optional fields */
.badge-optional {
    display: inline-block;
    background-color: rgba(240, 166, 20, 0.12);
    color: var(--color-warning);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    border: 1px solid rgba(240, 166, 20, 0.35);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 8px;
    vertical-align: middle;
}

/* Fix for iOS Safari date/month input default height and text alignment */
input[type="date"]::-webkit-date-and-time-value,
input[type="month"]::-webkit-date-and-time-value {
    min-height: 20px;
    height: 20px;
}

/* ========================================
   INVOICE COMPARISON STYLES
   ======================================== */

.invoice-upload-zone {
    margin-bottom: 8px;
}

.invoice-dropzone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background: rgba(255,255,255,0.02);
}

.invoice-dropzone:hover,
.invoice-dropzone.dragover {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.08);
    transform: scale(1.01);
}

.invoice-file-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(255,255,255,0.03);
}

.invoice-file-info span {
    flex: 1;
    font-weight: 500;
    font-size: 14px;
}

.invoice-progress-anim {
    transition: width 0.6s ease;
}

.invoice-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.invoice-analysis-content {
    max-height: 450px;
    overflow-y: auto;
    padding: 4px 0;
    font-size: 13.5px;
    line-height: 1.7;
}

.invoice-analysis-content p {
    margin: 6px 0;
}

.invoice-analysis-content h3,
.invoice-analysis-content h4,
.invoice-analysis-content h5,
.invoice-md-heading {
    margin: 18px 0 8px;
    color: var(--accent);
    font-weight: 700;
}

.invoice-analysis-content h3 { font-size: 16px; }
.invoice-analysis-content h4 { font-size: 14px; }
.invoice-analysis-content h5 { font-size: 13px; }

.invoice-md-bold-line {
    font-weight: 700;
    margin: 14px 0 6px;
    font-size: 14px;
    color: var(--text-primary);
}

.invoice-md-list {
    margin: 6px 0 6px 20px;
    padding: 0;
}

.invoice-md-list li {
    margin-bottom: 4px;
}

/* Invoice result tables */
.invoice-result-table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
}

.invoice-result-table th {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    font-weight: 700;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid var(--accent);
    white-space: nowrap;
}

.invoice-result-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
}

.invoice-result-table tbody tr:hover {
    background: rgba(255,255,255,0.04);
}

.invoice-result-table tbody tr:last-child td {
    border-bottom: none;
}





/* =========================================================
   UNIVERSAL MODAL MOBILE RESPONSIVENESS FIX (FORCE OVERFLOW)
   ========================================================= */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background-color: rgba(0, 0, 0, 0.85) !important;
    display: flex;
    justify-content: center !important;
    align-items: flex-start !important;
    z-index: 2000 !important;
    padding: max(10px, calc(5px + env(safe-area-inset-top))) 10px max(15px, calc(15px + env(safe-area-inset-bottom))) 10px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;

    /* Override mobile fix when modal should be hidden */
    &.hidden {
        display: none !important;
    }
}

.modal, .modal-card {
    width: 800px;
    max-width: 96vw !important;
    max-height: calc(100dvh - 30px) !important;
    background-color: var(--bg-card, #002238) !important;
    border-radius: var(--border-radius, 12px) !important;
    padding: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7) !important;
    margin: auto !important;
    overflow: hidden !important;
}

.modal-header {
    flex-shrink: 0 !important;
    padding: 14px 18px !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.modal-body {
    flex: 1 1 auto !important;
    max-height: calc(100dvh - 120px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 16px !important;
    min-height: 0 !important;
}

.modal-footer {
    flex-shrink: 0 !important;
    padding: 12px 18px !important;
    border-top: 1px solid var(--border-color) !important;
    background-color: rgba(0, 0, 0, 0.3) !important;
    display: flex !important;
    justify-content: flex-end !important;
    gap: 10px !important;
}

@media (max-width: 768px) {
    .modal-overlay {
        padding-top: max(12px, env(safe-area-inset-top)) !important;
        padding-bottom: max(20px, calc(15px + env(safe-area-inset-bottom))) !important;
    }

    .modal, .modal-card {
        width: 98vw !important;
        max-width: 98vw !important;
        max-height: calc(100dvh - 20px) !important;
        border-radius: 10px !important;
    }

    .modal-header {
        padding: 10px 12px !important;
    }

    .modal-header h3 {
        font-size: 14px !important;
    }

    .modal-body {
        padding: 10px 12px !important;
        max-height: calc(100dvh - 110px) !important;
    }

    .invoice-dropzone {
        padding: 12px 10px !important;
        min-height: 100px !important;
    }

    .invoice-analysis-content {
        max-height: 250px !important;
    }
}
