/* ─── CSS Custom Properties ──────────────────────────────────────────────── */
:root,
[data-theme="light"] {
    --primary:            #00A76F;
    --primary-light:      #D8FBEE;
    --primary-dark:       #007867;
    --sidebar-bg:         #ffffff;
    --sidebar-width:      280px;
    --sidebar-link:       #637381;
    --sidebar-link-hover-bg: rgba(145,158,171,0.08);
    --sidebar-link-active-bg: rgba(0,167,111,0.08);
    --sidebar-link-active-color: #00A76F;
    --sidebar-label:      #919EAB;
    --header-bg:          rgba(255,255,255,0.8);
    --header-shadow:      none;
    --body-bg:            #F4F6F8;
    --card-bg:            #ffffff;
    --card-shadow:        0 0 2px 0 rgba(145,158,171,0.2), 0 12px 24px -4px rgba(145,158,171,0.12);
    --card-radius:        16px;
    --card-border:        transparent;
    --card-header-bg:     #F4F6F8;
    --text-primary:       #212B36;
    --text-secondary:     #454F5B;
    --text-muted:         #919EAB;
    --divider:            rgba(145,158,171,0.24);
    --table-header-bg:    #F4F6F8;
    --table-header-color: #637381;
    --table-border:       rgba(145,158,171,0.16);
    --input-bg:           #ffffff;
    --input-border:       rgba(145,158,171,0.32);
    --badge-success-bg:   #D8FBEE;
    --badge-success-color:#007867;
    --badge-failed-bg:    #FFE4DE;
    --badge-failed-color: #B71D18;
    --welcome-gradient:   linear-gradient(135deg, #061B64 0%, #00B8D9 100%);
}

[data-theme="dark"] {
    --primary:            #00A76F;
    --primary-light:      rgba(0,167,111,0.16);
    --primary-dark:       #5BE584;
    --sidebar-bg:         #212B36;
    --sidebar-link:       #919EAB;
    --sidebar-link-hover-bg: rgba(145,158,171,0.08);
    --sidebar-link-active-bg: rgba(0,167,111,0.16);
    --sidebar-link-active-color: #5BE584;
    --sidebar-label:      #637381;
    --header-bg:          rgba(33,43,54,0.8);
    --header-shadow:      none;
    --body-bg:            #161C24;
    --card-bg:            #212B36;
    --card-shadow:        0 0 2px 0 rgba(0,0,0,0.2), 0 12px 24px -4px rgba(0,0,0,0.24);
    --card-radius:        16px;
    --card-border:        transparent;
    --card-header-bg:     #161C24;
    --text-primary:       #FFFFFF;
    --text-secondary:     #C4CDD5;
    --text-muted:         #637381;
    --divider:            rgba(145,158,171,0.24);
    --table-header-bg:    rgba(145,158,171,0.08);
    --table-header-color: #919EAB;
    --table-border:       rgba(145,158,171,0.16);
    --input-bg:           #2D3843;
    --input-border:       rgba(145,158,171,0.32);
    --badge-success-bg:   rgba(0,167,111,0.16);
    --badge-success-color:#5BE584;
    --badge-failed-bg:    rgba(255,86,48,0.16);
    --badge-failed-color: #FF6B6B;
    --welcome-gradient:   linear-gradient(135deg, #004B50 0%, #007867 100%);
}

/* ─── Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
    background-color: var(--body-bg);
    color: var(--text-primary);
    margin: 0;
    font-family: 'Public Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 0.875rem;
    line-height: 1.57143;
    transition: background-color 0.2s, color 0.2s;
}

.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 200;
    transition: background 0.2s;
    box-shadow: 40px 40px 80px -10px rgba(145,158,171,0.16);
}

[data-theme="dark"] .sidebar {
    box-shadow: 40px 40px 80px -10px rgba(0,0,0,0.24);
}

.sidebar-logo {
    padding: 24px 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo img {
    max-width: 150px;
    max-height: 44px;
    object-fit: contain;
}

.sidebar-nav {
    padding: 4px 12px 12px;
    flex: 1;
}

.sidebar-section-label {
    font-size: 0.67rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--sidebar-label);
    padding: 16px 12px 8px;
    text-transform: uppercase;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--sidebar-link);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background 0.15s, color 0.15s;
    position: relative;
}

.sidebar-link:hover {
    background: var(--sidebar-link-hover-bg);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: var(--sidebar-link-active-bg);
    color: var(--sidebar-link-active-color);
    font-weight: 600;
}

.sidebar-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Sidebar footer (user card) */
.sidebar-footer {
    padding: 12px;
    border-top: 1px dashed var(--divider);
    margin-top: auto;
}

.sidebar-powered-by {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px 10px;
    margin-bottom: 8px;
    border-bottom: 1px dashed var(--divider);
}
.sidebar-powered-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    opacity: .6;
}
.sidebar-powered-logo {
    max-width: 110px;
    max-height: 36px;
    object-fit: contain;
    opacity: .75;
    filter: grayscale(20%);
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 10px;
    background: var(--sidebar-link-hover-bg);
    text-decoration: none;
}

.sidebar-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.sidebar-user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ─── Main Wrapper ───────────────────────────────────────────────────────── */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    overflow-x: hidden;
}

.main-wrapper--full {
    margin-left: 0;
}

/* ─── Top Header ─────────────────────────────────────────────────────────── */
.top-header {
    background: var(--header-bg);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px dashed var(--divider);
    transition: background 0.2s;
}

.top-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

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

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    line-height: 1;
}

.sidebar-toggle:hover {
    background: var(--sidebar-link-hover-bg);
}

/* Icon button (theme toggle, notifications, etc.) */
.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}

.icon-btn:hover {
    background: var(--sidebar-link-hover-bg);
    color: var(--text-primary);
}

.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s;
}

.theme-toggle:hover {
    background: var(--sidebar-link-hover-bg);
    color: var(--text-primary);
}

/* Header user avatar */
.header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00AB55, #007867);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    border: 2px solid rgba(0,167,111,0.24);
}

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

.user-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    min-width: 200px;
    padding: 8px;
    z-index: 300;
}

.user-dropdown-menu.open {
    display: block;
}

.user-dropdown-header {
    padding: 8px 12px 12px;
    border-bottom: 1px dashed var(--divider);
    margin-bottom: 4px;
}

.user-dropdown-name {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.user-dropdown-email {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 176px;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background 0.12s, color 0.12s;
}

.user-dropdown-item:hover {
    background: var(--sidebar-link-hover-bg);
    color: var(--text-primary);
}

.user-dropdown-item.danger {
    color: #FF5630;
}

.user-dropdown-item.danger:hover {
    background: rgba(255,86,48,0.08);
}

/* ─── Main Content ───────────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    padding: 32px 28px 48px;
}

/* ─── Welcome Banner ─────────────────────────────────────────────────────── */
.welcome-banner {
    background: var(--welcome-gradient);
    border-radius: var(--card-radius);
    padding: 36px 40px;
    display: flex;
    align-items: center;
    gap: 24px;
    color: #fff;
    overflow: hidden;
    position: relative;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -8%;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}

.welcome-banner::after {
    content: '';
    position: absolute;
    bottom: -55%;
    right: 18%;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
}

.welcome-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    flex-shrink: 0;
    z-index: 1;
}

.welcome-text { z-index: 1; }

.welcome-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 4px;
    color: #fff;
    letter-spacing: -0.01em;
}

.welcome-subtitle {
    margin: 0;
    opacity: 0.72;
    font-size: 0.9rem;
}

/* ─── Section Label ──────────────────────────────────────────────────────── */
.section-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 16px;
    margin-top: 4px;
}

/* ─── Module Cards Grid ──────────────────────────────────────────────────── */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 992px) {
    .modules-grid { grid-template-columns: repeat(2, 1fr); }
}

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

.module-card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 0.18s, transform 0.15s, border-color 0.18s;
    overflow: hidden;
}

.module-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border-color: var(--primary);
    transform: translateY(-3px);
    color: inherit;
    text-decoration: none;
}

.module-card--disabled {
    pointer-events: none;
    opacity: 0.7;
}

.module-card-body {
    padding: 24px 24px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.module-card-footer {
    padding: 12px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--sidebar-bg);
}

.module-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.module-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}

.module-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    flex: 1;
    line-height: 1.6;
}

.module-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

.module-card:hover .module-link { text-decoration: underline; }

/* ─── Modules Divider ────────────────────────────────────────────────────── */
.modules-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0 16px;
}

.modules-divider::before,
.modules-divider::after {
    content: '';
    flex: 1;
    border-top: 2px dashed var(--border-color);
}

.modules-divider-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
    padding: 0 4px;
}

/* ─── Stat Cards ─────────────────────────────────────────────────────────── */
.stat-card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: none;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border: none !important;
    border-radius: var(--card-radius) !important;
    box-shadow: var(--card-shadow);
    transition: background 0.2s;
}

.card-header {
    background: transparent;
    border-bottom: 1px dashed var(--divider);
    padding: 16px 20px;
    border-radius: var(--card-radius) var(--card-radius) 0 0;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-weight: 700;
}

.card-body {
    color: var(--text-primary);
    padding: 20px;
}

.card-body.p-0 { padding: 0 !important; }

/* ─── Tables ─────────────────────────────────────────────────────────────── */
.table {
    color: var(--text-primary);
    --bs-table-bg: transparent;
    --bs-table-hover-bg: rgba(145,158,171,0.04);
    --bs-table-border-color: var(--table-border);
    --bs-table-color: var(--text-primary);
    --bs-table-striped-bg: transparent;
    margin: 0;
}

.table-header th {
    background: var(--table-header-bg);
    color: var(--table-header-color);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px dashed var(--divider) !important;
    white-space: nowrap;
    padding: 12px 16px;
}

.table td {
    border-color: var(--table-border);
    padding: 12px 16px;
    vertical-align: middle;
}

.table th { white-space: nowrap; }

/* ─── Form Controls ──────────────────────────────────────────────────────── */
.form-control,
.form-select {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.875rem;
    padding: 10px 14px;
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.form-control-sm,
.form-select-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.form-control:focus,
.form-select:focus {
    background-color: var(--input-bg);
    color: var(--text-primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(0,167,111,0.16);
}

.form-label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.825rem;
    margin-bottom: 6px;
}

.form-label.small, .form-label.fw-semibold.small {
    font-size: 0.75rem;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    font-weight: 700;
    border-radius: 8px;
    font-size: 0.825rem;
    letter-spacing: 0;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #fff !important;
    box-shadow: 0 8px 16px 0 rgba(0,167,111,0.24);
}

.btn-primary:hover {
    background-color: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
    box-shadow: 0 8px 16px 0 rgba(0,167,111,0.36);
}

.btn-success {
    background-color: #00A76F !important;
    border-color: #00A76F !important;
    box-shadow: 0 8px 16px 0 rgba(0,167,111,0.24);
}

.btn-success:hover {
    background-color: #007867 !important;
    border-color: #007867 !important;
}

.btn-outline-secondary {
    border-color: var(--input-border);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background: var(--sidebar-link-hover-bg);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn-outline-danger {
    border-color: rgba(255,86,48,0.32);
    color: #FF5630;
}

.btn-outline-danger:hover {
    background: rgba(255,86,48,0.08);
    border-color: #FF5630;
}

/* ─── Job Status Badges ──────────────────────────────────────────────────── */
.job-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: capitalize;
    letter-spacing: 0;
    gap: 4px;
}

.job-status-pending  { background: #FFF5CC; color: #7A4F01; }
.job-status-running  { background: #CAFDF5; color: #003768; }
.job-status-completed{ background: #D8FBEE; color: #007867; }
.job-status-failed   { background: #FFE9D5; color: #B71D18; }
.job-status-cancelled{ background: rgba(145,158,171,0.16); color: #637381; }

[data-theme="dark"] .job-status-pending  { background: rgba(255,171,0,0.16); color: #FFD666; }
[data-theme="dark"] .job-status-running  { background: rgba(0,184,217,0.16); color: #61F3F3; }
[data-theme="dark"] .job-status-completed{ background: rgba(0,167,111,0.16); color: #5BE584; }
[data-theme="dark"] .job-status-failed   { background: rgba(255,86,48,0.16); color: #FF6B6B; }
[data-theme="dark"] .job-status-cancelled{ background: rgba(145,158,171,0.16); color: #919EAB; }

/* ─── File Log Status Badges ─────────────────────────────────────────────── */
.file-log-status {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
}

.file-log-status-success, .file-log-status-moved {
    background: var(--badge-success-bg);
    color: var(--badge-success-color);
}

.file-log-status-failed {
    background: var(--badge-failed-bg);
    color: var(--badge-failed-color);
}

.file-log-status-skipped {
    background: rgba(145,158,171,0.16);
    color: #637381;
}

.file-log-status-success_retry {
    background: rgba(245,158,11,0.12);
    color: #b45309;
}

/* ─── Live Log Console ───────────────────────────────────────────────────── */
.live-log-console {
    background: #0d1117;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    line-height: 1.55;
    padding: 12px 16px;
    max-height: 320px;
    overflow-y: auto;
    border-radius: 0 0 var(--card-radius) var(--card-radius);
}

.live-log-placeholder {
    padding: 8px 0;
    color: #8b949e;
}

.live-log-line {
    display: flex;
    gap: 12px;
    padding: 1px 0;
    word-break: break-all;
}

.live-log-ts {
    color: #8b949e;
    flex-shrink: 0;
    user-select: none;
}

.live-log-msg { color: #c9d1d9; }

.live-log-info  .live-log-msg { color: #c9d1d9; }
.live-log-warn  .live-log-msg { color: #e3b341; }
.live-log-error .live-log-msg { color: #f85149; }

[data-theme="light"] .live-log-console { background: #1c2128; }

/* ─── Type Badges (SharePoint / OneDrive) ────────────────────────────────── */
.badge-type {
    display: inline-flex;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 2px;
}

.badge-sharepoint { background: #EDE9FE; color: #5119B7; }
.badge-onedrive   { background: #D0F2FF; color: #04297A; }

[data-theme="dark"] .badge-sharepoint { background: rgba(81,25,183,0.24); color: #C8B6FF; }
[data-theme="dark"] .badge-onedrive   { background: rgba(4,41,122,0.32); color: #61B8F3; }

/* ─── Alerts ─────────────────────────────────────────────────────────────── */
.alert {
    border-radius: 10px;
    border: none;
    font-size: 0.85rem;
    padding: 12px 16px;
}

.alert-success  { background: #D8FBEE; color: #007867; }
.alert-danger   { background: #FFE4DE; color: #B71D18; }
.alert-warning  { background: #FFF5CC; color: #7A4F01; }
.alert-info     { background: #CAFDF5; color: #003768; }

[data-theme="dark"] .alert-success  { background: rgba(0,167,111,0.16); color: #5BE584; }
[data-theme="dark"] .alert-danger   { background: rgba(255,86,48,0.16); color: #FF6B6B; }
[data-theme="dark"] .alert-warning  { background: rgba(255,171,0,0.16); color: #FFD666; }
[data-theme="dark"] .alert-info     { background: rgba(0,184,217,0.16); color: #61F3F3; }

/* ─── Progress ───────────────────────────────────────────────────────────── */
.progress {
    background-color: var(--divider);
    border-radius: 100px;
    height: 8px;
}

.progress-bar {
    background-color: var(--primary);
    border-radius: 100px;
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--divider); border-radius: 2px; }

/* ─── Dark mode text overrides ───────────────────────────────────────────── */
[data-theme="dark"] .text-muted { color: var(--text-muted) !important; }
[data-theme="dark"] h1,[data-theme="dark"] h2,[data-theme="dark"] h3,
[data-theme="dark"] h4,[data-theme="dark"] h5,[data-theme="dark"] p {
    color: var(--text-primary);
}
[data-theme="dark"] .card-body { color: var(--text-primary); }
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: var(--input-bg);
    border-color: var(--input-border);
    color: var(--text-primary);
}
[data-theme="dark"] .table-header th {
    border-bottom-color: var(--divider) !important;
}
[data-theme="dark"] .btn-outline-secondary {
    color: var(--text-secondary);
    border-color: var(--input-border);
}
[data-theme="dark"] .btn-outline-secondary:hover {
    background: var(--sidebar-link-hover-bg);
    color: var(--text-primary);
}

/* ─── Desktop sidebar collapse ───────────────────────────────────────────── */
.sidebar {
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), width 0.3s cubic-bezier(0.4,0,0.2,1);
}
.app-layout.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}
.app-layout.sidebar-collapsed .main-wrapper {
    margin-left: 0;
}
.sidebar-desktop-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    line-height: 1;
    display: none;
}
@media (min-width: 1120px) {
    .sidebar-desktop-toggle { display: inline-flex; align-items: center; }
}
.sidebar-desktop-toggle:hover { background: var(--sidebar-link-hover-bg); }

/* ─── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 1119px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 24px 0 48px -8px rgba(0,0,0,0.24);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .main-content {
        padding: 24px 16px 40px;
    }
}

/* ─── Utilities ──────────────────────────────────────────────────────────── */
.text-primary-color { color: var(--primary); }
.coords-link { font-family: monospace; white-space: nowrap; }

/* Sidebar overlay on mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(22,28,36,0.8);
    z-index: 199;
}

.sidebar-overlay.open,
.sidebar-overlay.active { display: block; }

/* ─── Login Page (novo fullscreen) ───────────────────────────────────────── */
.main-wrapper--full .main-content {
    padding: 0;
    overflow-y: auto;
}

/* ═══ Login page ═══════════════════════════════════════════════════════════ */
/* ─── New fullscreen login ───────────────────────────────────────────────── */
.lp-root {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: #0a0f1e;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}
.lp-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.lp-float-icon {
    position: absolute;
    left: var(--x);
    top: var(--y);
    font-size: calc(var(--s) * 3.5rem);
    opacity: var(--op);
    color: #60a5fa;
    animation: lp-float var(--t) ease-in-out infinite alternate;
    animation-delay: calc(var(--i) * -1.3s);
    will-change: transform;
}
@keyframes lp-float {
    0%   { transform: translateY(0) rotate(-4deg); }
    100% { transform: translateY(-28px) rotate(4deg); }
}
.lp-center {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 1.5rem;
}
.lp-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.10);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 24px;
    padding: 2.75rem 2.5rem 2.25rem;
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .75rem;
    box-shadow: 0 24px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05) inset;
}
.lp-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: .5rem 0;
    margin-bottom: .25rem;
}
.lp-logo {
    width: 220px;
    height: auto;
    display: block;
    object-fit: contain;
}
.lp-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.02em;
    text-align: center;
    margin-top: .25rem;
}
.lp-subtitle {
    font-size: .82rem;
    color: rgba(255,255,255,.45);
    text-align: center;
    letter-spacing: .04em;
    text-transform: uppercase;
    font-weight: 600;
}
.lp-divider {
    width: 48px;
    height: 2px;
    border-radius: 1px;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    margin: .35rem 0;
}
.lp-desc {
    font-size: .82rem;
    color: rgba(255,255,255,.5);
    text-align: center;
    line-height: 1.6;
    margin: 0;
}
.lp-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    background: #fff;
    color: #1e293b;
    font-weight: 700;
    font-size: .92rem;
    border-radius: 12px;
    padding: .8rem 2rem;
    width: 100%;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background .15s, transform .15s, box-shadow .15s;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    margin-top: .35rem;
}
.lp-btn:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
    box-shadow: 0 8px 28px rgba(0,0,0,0.35);
    color: #1e293b;
}
.lp-hint {
    font-size: .72rem;
    color: rgba(255,255,255,.3);
    text-align: center;
    margin: 0;
}
.lp-powered {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .5rem;
    border-top: 1px solid rgba(255,255,255,.06);
    padding-top: .85rem;
    width: 100%;
    justify-content: center;
}
.lp-powered span {
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.2);
}
.lp-powered-img {
    max-height: 28px;
    max-width: 100px;
    object-fit: contain;
    opacity: .45;
    filter: grayscale(30%);
}
@media (max-width: 480px) {
    .lp-card { padding: 2rem 1.5rem 1.75rem; border-radius: 20px; }
}

.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: calc(100vh - 57px);
    justify-content: center;
    padding: 2rem 1rem;
    gap: 1.5rem;
    background: var(--body-bg);
}

/* Logos acima do card */
.login-top-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.login-wrap {
    display: flex;
    width: 100%;
    max-width: 800px;
    border-radius: 20px;
    box-shadow: 0 16px 56px rgba(0,0,0,0.14);
    overflow: hidden;
}

/* ── Visual panel (left) ────────────────────────────────────────────────── */
.login-visual-panel {
    flex: 1;
    background: linear-gradient(148deg, #005fa3 0%, #0284c7 45%, #0891b2 100%);
    padding: 2.75rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2.25rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.login-visual-panel::before {
    content: '';
    position: absolute;
    width: 320px; height: 320px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    top: -90px; right: -90px;
    pointer-events: none;
}
.login-visual-panel::after {
    content: '';
    position: absolute;
    width: 220px; height: 220px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
    bottom: -70px; left: -70px;
    pointer-events: none;
}

/* Brand logos row */
.login-brand-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    z-index: 1;
}
.login-brand-pill {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 1.1rem 2.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.10);
}
.login-brand-img {
    max-height: 90px;
    max-width: 260px;
    object-fit: contain;
    display: block;
}
.login-brand-sep {
    width: 1px;
    height: 64px;
    background: var(--border-color, #e2e8f0);
    flex-shrink: 0;
}
.login-powered-img {
    max-height: 80px;
    max-width: 240px;
    object-fit: contain;
    display: block;
}

/* Transfer animation */
.login-transfer-anim {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    z-index: 1;
}
.lta-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}
.lta-icon-wrap {
    width: 56px; height: 56px;
    background: rgba(255,255,255,0.15);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.65rem;
    border: 1.5px solid rgba(255,255,255,0.28);
    box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}
.lta-label {
    font-size: 0.68rem;
    font-weight: 700;
    opacity: 0.85;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.lta-track-wrap {
    flex: 1;
    position: relative;
    height: 48px;
    display: flex;
    align-items: center;
}
.lta-track {
    position: relative;
    width: 100%;
    height: 2px;
    background: rgba(255,255,255,0.22);
    border-radius: 1px;
    overflow: visible;
}
.lta-track::after {
    content: '';
    position: absolute;
    right: -6px; top: 50%;
    transform: translateY(-50%);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 8px solid rgba(255,255,255,0.45);
}
.lta-file {
    position: absolute;
    top: 50%;
    left: 0;
    font-size: 1.1rem;
    opacity: 0;
    color: rgba(255,255,255,0.95);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    transform: translateY(-50%);
    animation: lta-slide 3.9s var(--d, 0s) infinite ease-in-out;
}
@keyframes lta-slide {
    0%   { left: -6%;   opacity: 0; transform: translateY(-50%) scale(0.7); }
    7%   {              opacity: 1; transform: translateY(-50%) scale(1);   }
    80%  {              opacity: 1;                                          }
    95%  {              opacity: 0; transform: translateY(-60%) scale(0.85);}
    100% { left: 108%;  opacity: 0; transform: translateY(-50%) scale(0.7); }
}

.login-visual-tagline {
    font-size: 0.77rem;
    opacity: 0.72;
    text-align: center;
    line-height: 1.55;
    z-index: 1;
    margin: 0;
    max-width: 220px;
}

/* ── Form panel (right) ─────────────────────────────────────────────────── */
.login-form-panel {
    flex: 0 0 320px;
    background: var(--card-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 2rem;
}

.login-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    text-align: center;
}

.login-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
}

.login-card-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.55;
}

.login-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    padding: 0.7rem 1.5rem;
    border-radius: 10px;
    margin-top: 0.25rem;
}

.login-card-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0;
    line-height: 1.5;
}

/* Hide page title on login (no user) */
.main-wrapper--full .page-title { display: none; }

/* Mobile: stack panels vertically */
@media (max-width: 660px) {
    .login-wrap { flex-direction: column; max-width: 420px; border-radius: 16px; }
    .login-visual-panel { padding: 1.75rem 1.5rem 1.25rem; gap: 1.5rem; }
    .login-form-panel { flex: unset; padding: 1.75rem 1.5rem; }
    .lta-track-wrap, .login-visual-tagline { display: none; }
}

[data-theme="dark"] .login-form-panel {
    background: var(--card-bg);
}

/* ═══ Mobile responsiveness ════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.active { opacity: 1; pointer-events: auto; }

    .main-wrapper { margin-left: 0 !important; }

    .top-header { padding: 0 1rem; }

    .content-area { padding: 1rem; }

    .card { border-radius: 12px; }

    .table-responsive { font-size: .8rem; }

    .btn { font-size: .8rem; padding: .35rem .75rem; }

    .modules-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 12px; }

    .stat-card { padding: 1rem; }

    .page-title { font-size: 1.2rem; }
}

@media (max-width: 480px) {
    .modules-grid { grid-template-columns: 1fr !important; gap: 10px; }

    .content-area { padding: .75rem; }

    h1, .page-title { font-size: 1.1rem; }

    .top-header-right { gap: .35rem; }
}

/* Launch page mobile */
@media (max-width: 600px) {
    .launch-sidebar {
        position: fixed !important;
        z-index: 300;
        top: 0;
        left: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform .25s ease;
        width: 240px !important;
        min-width: 240px !important;
        border-right: 1px solid var(--divider) !important;
    }
    .launch-sidebar.mobile-open {
        transform: translateX(0) !important;
    }
    .launch-sidebar.collapsed {
        transform: translateX(-100%) !important;
    }
    .launch-toolbar { flex-wrap: wrap; gap: .4rem; padding: .4rem .6rem; }
    .launch-url-bar { font-size: .72rem; }
}
