/* ===== Layout ===== */
html, body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f7fa;
}

.page {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1;
    background-color: #f5f7fa;
}

.sidebar {
    background: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
    width: 270px;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.1);
}

.top-row {
    backgrou    .navbar-toggler {
        display: block;
    }
}

/* ===== Modal Popup ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-dialog {
    max-width: 480px;
    width: 90%;
    margin: 1rem;
    animation: slideDown 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideDown {
    from {
        transform: translateY(-30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    overflow: hidden;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    background: #f9fafb;
}

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

.modal-icon-info {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
}

.modal-icon-success {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
}

.modal-icon-warning {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
}

.modal-icon-danger {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
}

.modal-title {
    flex: 1;
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: #111827;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #e5e7eb;
    color: #111827;
}

.modal-body {
    padding: 1.5rem;
    color: #374151;
    line-height: 1.6;
    font-size: 0.9375rem;
}

.modal-body p {
    margin: 0.5rem 0;
}

.modal-body p:first-child {
    margin-top: 0;
}

.modal-body p:last-child {
    margin-bottom: 0;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 0.625rem;
}

.modal-footer .btn {
    min-width: 110px;
    padding: 0.625rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.btn-outline {
    background: white;
    border: 1.5px solid #d1d5db;
    color: #374151;
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none;
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border: none;
    color: white;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border: none;
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* ===== Dashboard Styles ===== */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2.5rem;
}

.dashboard-title {
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dashboard-title i {
    color: #3b82f6;
}

.version-badge {
    font-size: 0.75rem;
    font-weight: 500;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    margin-left: 0.5rem;
    vertical-align: middle;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.dashboard-subtitle {
    font-size: 1rem;
    color: #6b7280;
    margin: 0;
}

.dashboard-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: white;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    color: #374151;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-action:hover:not(:disabled) {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #eff6ff;
}

.btn-action:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    border: 1px solid #e5e7eb;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
}

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

.stat-primary .stat-icon-wrapper {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
}

.stat-success .stat-icon-wrapper {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
}

.stat-warning .stat-icon-wrapper {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
}

.stat-danger .stat-icon-wrapper {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #991b1b;
}

.stat-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #111827;
    line-height: 1;
}

.stat-trend {
    font-size: 0.75rem;
    color: #9ca3af;
}

.dashboard-card {
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    margin-bottom: 2rem;
    overflow: hidden;
}

.card-header-custom {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title-custom {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
    margin: 0 0 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-subtitle-custom {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: #3b82f6;
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-link:hover {
    color: #2563eb;
    gap: 0.625rem;
}

.card-body-custom {
    padding: 0;
}

.devices-table {
    width: 100%;
    overflow-x: auto;
}

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

.devices-table thead {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.devices-table th {
    padding: 0.875rem 1.5rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.devices-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.2s ease;
}

.devices-table tbody tr:hover {
    background: #f9fafb;
}

.devices-table td {
    padding: 1rem 1.5rem;
}

.device-info {
    display: flex;
    align-items: center;
    gap: 0.875rem;
}

.device-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.device-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.device-name {
    font-weight: 600;
    color: #111827;
    font-size: 0.9375rem;
}

.device-id {
    font-size: 0.8125rem;
    color: #9ca3af;
    font-family: 'Courier New', monospace;
}

.activity-time {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.time-primary {
    font-weight: 500;
    color: #374151;
    font-size: 0.9375rem;
}

.time-secondary {
    font-size: 0.8125rem;
    color: #9ca3af;
}

.sample-count {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-weight: 600;
    color: #111827;
    font-size: 0.9375rem;
}

.sample-count i {
    color: #10b981;
}

.btn-table-action {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-table-action:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    color: white;
}

.btn-table-action.btn-live {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.btn-table-action.btn-live:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    color: white;
}

.device-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.25rem;
}

.quick-action-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    transition: all 0.3s ease;
}

.quick-action-card:hover {
    border-color: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.12);
}

.quick-action-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: linear-gradient(135deg, #eff6ff, #dbeafe);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #2563eb;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.quick-action-content {
    flex: 1;
}

.quick-action-content h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
}

.quick-action-content p {
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
}

.quick-action-arrow {
    color: #d1d5db;
    font-size: 1.25rem;
    transition: all 0.3s ease;
}

.quick-action-card:hover .quick-action-arrow {
    color: #3b82f6;
    transform: translateX(4px);
}

.empty-state-wrapper {
    padding: 3rem 1.5rem;
}

.btn-primary-large {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary-large:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
    color: white;
}

.loading-overlay {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

/* ===== Utilities ===== */
lor: white;
    border-bottom: 1px solid #e2e8f0;
    justify-content: flex-end;
    height: 3.5rem;
    display: flex;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.content {
    padding: 2rem;
}

/* ===== Sidebar Navigation ===== */
.nav-scrollable {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
}

.nav-scrollable::-webkit-scrollbar {
    width: 6px;
}

.nav-scrollable::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.nav-scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.nav-scrollable::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.navbar-toggler {
    appearance: none;
    cursor: pointer;
    width: 3.5rem;
    height: 2.5rem;
    color: white;
    position: absolute;
    top: 0.5rem;
    right: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.55%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") no-repeat center center;
}

.navbar-toggler:checked {
    background-color: rgba(255, 255, 255, 0.1);
}

/* ===== Sidebar Header ===== */
.sidebar-header {
    padding: 1.75rem 1.5rem;
    background-color: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.brand-logo {
    max-height: 40px;
    max-width: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: brightness(0) invert(1);
    transition: transform 0.3s ease;
}

.brand-logo:hover {
    transform: scale(1.05);
}

.brand-icon {
    font-size: 1.75rem;
    color: #ffc107;
    filter: drop-shadow(0 0 8px rgba(255, 193, 7, 0.5));
}

.brand-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.3px;
}

/* ===== Sidebar Navigation Items ===== */
.sidebar-nav {
    padding: 1.5rem 0;
    flex: 1;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 2rem;
}

.nav-section-title {
    padding: 0 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.5);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0.875rem 1.5rem;
    margin: 0 0.75rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
    transform: scaleX(0);
    transition: transform 0.25s ease;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: white;
    padding-left: 1.75rem;
}

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

.nav-item.active::before {
    transform: scaleX(1);
}

.nav-icon {
    font-size: 1.25rem;
    width: 24px;
    text-align: center;
    transition: transform 0.2s ease;
}

.nav-item:hover .nav-icon {
    transform: scale(1.1);
}

.nav-item.active .nav-icon {
    color: #ffc107;
}

.nav-text {
    font-size: 0.95rem;
    letter-spacing: 0.3px;
}

/* ===== Sidebar Footer ===== */
.sidebar-footer {
    padding: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    margin-top: auto;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.3) 100%);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.875rem;
    background-color: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-info:hover {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.user-role {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-actions {
    display: flex;
    gap: 4px;
}

.btn-icon-only {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon-only:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: scale(1.05);
}

.btn-icon-only i {
    font-size: 0.9rem;
}

/* ===== Login Page ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, rgb(5, 39, 103) 0%, #3a0647 70%);
    padding: 2rem;
}

.login-box {
    background: white;
    padding: 3rem 2.5rem;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 440px;
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-logo {
    max-width: 180px;
    max-height: 180px;
    width: auto;
    height: auto;
    object-fit: contain;
    margin-bottom: 1.5rem;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    font-size: 0.95rem;
    color: #718096;
    margin: 0;
}

.login-box .form-label {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 0.5rem;
}

.login-box .form-control {
    padding: 0.75rem 1rem;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    transition: all 0.2s;
}

.login-box .form-control:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.login-box .btn-primary {
    padding: 0.875rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    margin-top: 1rem;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border: none;
    transition: transform 0.2s, box-shadow 0.2s;
}

.login-box .btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.login-box .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== Dashboard Cards ===== */

/* ===== Stat Box ===== */
.stat-box {
    padding: 1rem;
}

.stat-label {
    font-size: 0.85rem;
    color: #718096;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #6366f1;
}

/* ===== Tables ===== */
.table {
    background: white;
    margin-bottom: 0;
}

.table thead {
    background: #f8f9fa;
}

.table thead th {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    color: #495057;
}

.table-hover tbody tr {
    transition: background-color 0.15s ease;
}

.table-hover tbody tr:hover {
    background-color: #f8f9fa;
}

/* ===== Badges ===== */
.badge {
    padding: 0.5em 0.8em;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 6px;
}

/* ===== Cards ===== */
.card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    background: white;
}

.card-header {
    background: white;
    border-bottom: 2px solid #f1f5f9;
    font-weight: 600;
    padding: 1.25rem 1.5rem;
    border-radius: 12px 12px 0 0;
}

.card-body {
    padding: 1.5rem;
}

/* ===== Buttons ===== */
.btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 0.625rem 1.25rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn i {
    font-size: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #5568d3 0%, #63398b 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-outline-primary {
    border: 2px solid #667eea;
    color: #667eea;
    background: white;
}

.btn-outline-primary:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.btn-outline-secondary {
    border: 2px solid #cbd5e0;
    color: #4a5568;
    background: white;
}

.btn-outline-secondary:hover {
    background: #f7fafc;
    border-color: #a0aec0;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* ===== Responsive ===== */
@media (max-width: 640.98px) {
    .top-row:not(.auth) {
        display: none;
    }

    .sidebar {
        width: 100%;
    }

    .navbar-toggler {
        display: block;
    }

    .nav-scrollable {
        display: none;
    }

    .navbar-toggler:checked ~ .nav-scrollable {
        display: flex;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .page-header-actions {
        width: 100%;
        flex-direction: column;
    }

    .page-header-actions button {
        width: 100%;
    }
}

@media (min-width: 641px) {
    .page {
        flex-direction: row;
    }

    .sidebar {
        width: 270px;
        height: 100vh;
        position: sticky;
        top: 0;
        display: flex;
        flex-direction: column;
    }

    .top-row {
        position: sticky;
        top: 0;
        z-index: 100;
    }

    .content {
        padding-left: 2.5rem !important;
        padding-right: 2.5rem !important;
    }

    .navbar-toggler {
        display: none;
    }
}

/* ===== Form Elements ===== */
.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 0.625rem 1rem;
}

.form-control:focus, .form-select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

/* ===== Utilities ===== */
.text-muted {
    color: #9ca3af !important;
}

/* ===== Blazor Error UI ===== */
#blazor-error-ui {
    background: #fef2f2;
    bottom: 0;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
    display: none;
    left: 0;
    padding: 1rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    border-top: 2px solid #ef4444;
    color: #991b1b;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #991b1b;
}

/* ============================================ */
/* ADMINISTRATION PAGE STYLES                   */
/* ============================================ */

.admin-container {
    max-width: 1400px;
    margin: 0 auto;
}

.admin-header {
    margin-bottom: 2rem;
}

.admin-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.admin-subtitle {
    color: #6b7280;
    font-size: 1rem;
}

.admin-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 2rem;
}

.admin-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s;
    position: relative;
    bottom: -2px;
}

.admin-tab:hover {
    color: #1f2937;
    background: #f9fafb;
}

.admin-tab.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.data-table thead {
    background: linear-gradient(135deg, rgb(5,39,103), #3a0647);
}

.data-table th {
    padding: 1rem;
    text-align: left;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background-color: #f9fafb;
}

.data-table td {
    padding: 1rem;
    color: #374151;
}

.entity-info {
    display: flex;
    flex-direction: column;
}

.entity-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.entity-id {
    font-size: 0.75rem;
    color: #9ca3af;
    font-family: monospace;
}

.tier-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tier-badge.free {
    background: #f3f4f6;
    color: #6b7280;
}

.tier-badge.basic {
    background: #dbeafe;
    color: #1e40af;
}

.tier-badge.pro {
    background: #fef3c7;
    color: #92400e;
}

.tier-badge.enterprise {
    background: #f3e8ff;
    color: #6b21a8;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
}

.role-badge.owner {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
}

.role-badge.admin {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.role-badge.operator {
    background: #dbeafe;
    color: #1e40af;
}

.role-badge.viewer {
    background: #f3f4f6;
    color: #6b7280;
}

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

.btn-table-action {
    padding: 0.5rem;
    background: none;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-table-action:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #374151;
}

.btn-table-action.edit:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.btn-table-action.delete:hover {
    border-color: #ef4444;
    color: #ef4444;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #9ca3af;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.btn-create {
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-create:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

/* ============================================ */
/* SETTINGS PAGE STYLES                         */
/* ============================================ */

.settings-container {
    max-width: 1000px;
    margin: 0 auto;
}

.settings-header {
    text-align: center;
    margin-bottom: 3rem;
}

.settings-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.settings-subtitle {
    color: #6b7280;
    font-size: 1rem;
}

.settings-header h2 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, rgb(5,39,103), #3a0647);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.settings-header p {
    color: #6b7280;
    font-size: 1rem;
}

.settings-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.settings-card .card-header {
    border-bottom: 2px solid #f3f4f6;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
}

.settings-card .card-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.settings-card .card-body {
    padding: 0;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.info-item {
    background: white;
    padding: 1.25rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.info-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.info-value {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-value.monospace,
.info-value.info-code {
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    color: #6b7280;
    background: #f9fafb;
    padding: 0.5rem;
    border-radius: 4px;
    word-break: break-all;
}

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

.status-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.status-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    text-align: center;
}

.status-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 1.5rem;
}

.status-icon.success {
    background: #d1fae5;
    color: #065f46;
}

.status-icon.success,
.status-icon.status-success {
    background: #d1fae5;
    color: #065f46;
}

.status-icon.warning {
    background: #fef3c7;
    color: #92400e;
}

.status-icon.info,
.status-icon.status-info {
    background: #dbeafe;
    color: #1e40af;
}

.status-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.status-value {
    font-size: 1.125rem;
    font-weight: 700;
}

.status-value.success {
    color: #059669;
}

.status-value.warning {
    color: #d97706;
}

.role-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: capitalize;
}

.role-badge.role-owner {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
}

.role-badge.role-admin {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.role-badge.role-operator,
.role-badge.role-user {
    background: #dbeafe;
    color: #1e40af;
}

.role-badge.role-viewer {
    background: #f3f4f6;
    color: #6b7280;
}

.permissions-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}

.permission-item i {
    color: #059669;
    font-size: 1.25rem;
}

.settings-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-settings {
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
}

.btn-settings.primary {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.btn-settings.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-settings.secondary {
    background: white;
    color: #374151;
    border: 1px solid #d1d5db;
}

.btn-settings.secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
}

.btn-settings:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-settings:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* ============================================ */
/* RESPONSIVE DESIGN - ADMINISTRATION & SETTINGS */
/* ============================================ */

@media (max-width: 768px) {
    .admin-tabs {
        overflow-x: auto;
    }

    .data-table {
        font-size: 0.875rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem 0.5rem;
    }

    .table-actions {
        flex-direction: column;
        gap: 0.25rem;
    }

    .info-grid,
    .status-grid {
        grid-template-columns: 1fr;
    }

    .settings-actions {
        flex-direction: column;
        width: 100%;
    }

    .btn-settings {
        width: 100%;
        justify-content: center;
    }
}

/* ============================================ */
/* SETTINGS PAGE - NEW STYLES                   */
/* ============================================ */

.settings-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.settings-section .section-header {
    border-bottom: 2px solid #f3f4f6;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
}

.settings-section .section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.info-card {
    background: #f9fafb;
    padding: 1.25rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.info-card .info-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    display: block;
}

.info-card .info-value {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-content {
    flex: 1;
}

.status-content .status-label {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.status-content .status-value {
    font-size: 1.125rem;
    font-weight: 700;
}

.status-content .status-value.status-success {
    color: #059669;
}

.status-content .status-value.status-warning {
    color: #d97706;
}

.status-content .status-value.status-info {
    color: #3b82f6;
}

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

.text-success {
    color: #059669 !important;
}
