/* ============================================================
   CLOUD TERMINAL — Admin Panel Design System
   ============================================================
   Color variables come from tokens.css. This file provides
    component-specific styles only.
    ============================================================ */

@import url('client-profile.css');
@import url('customer-profile-v2.css');


/* ============================================================
   SIDEBAR — Fixed sidebar with compact mode toggle
   ============================================================ */
#sidebar {
    width: 48px;
    height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--sidebar-border);
    overflow-y: auto;
    overflow-x: hidden;
}

/* Block all sidebar transitions on initial page load */
.no-transition #sidebar,
.no-transition #page-content-wrapper,
.no-transition .client-content-wrapper {
    transition: none !important;
}

/* Expanded mode: show text labels */
body.sidebar-expanded #sidebar {
    width: 220px;
}

/* Sidebar Header / Brand */
.sidebar-brand {
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    height: 48px;
    flex-shrink: 0;
    padding-left: 8px;
    padding-right: 8px;
}

.sidebar-brand .brand-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    font-family: "Font Awesome 6 Free";
}

.sidebar-brand .brand-icon i {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.sidebar-brand .brand-text {
    display: flex;
    flex-direction: column;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    overflow: hidden;
}

/* Show brand text in expanded mode */
body.sidebar-expanded .sidebar-brand .brand-text {
    opacity: 1;
}

.sidebar-brand .brand-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-inverse);
    line-height: 1.2;
}

.sidebar-brand .brand-role {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 500;
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 0.5rem 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-section {
    padding: 0;
    margin-bottom: 2px;
}

.sidebar-section-label {
    display: none;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.3);
    padding: 0.75rem 0.75rem 0.35rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Show section labels in expanded mode */
body.sidebar-expanded .sidebar-section-label {
    display: block;
    opacity: 1;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 0.55rem;
    height: 36px;
    color: var(--sidebar-text);
    font-size: 0.82rem;
    font-weight: 450;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    position: relative;
    margin-bottom: 1px;
    text-decoration: none;
    white-space: nowrap;
}

.sidebar-nav .nav-link i,
.sidebar-nav .nav-link .nav-icon {
    width: 36px;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: inherit;
    flex-shrink: 0;
    text-align: center;
}

.sidebar-nav .nav-link span:not(.nav-badge) {
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Show nav text in expanded mode */
body.sidebar-expanded .sidebar-nav .nav-link span:not(.nav-badge) {
    opacity: 1;
}

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

/* Active indicator bar */
.sidebar-nav .nav-link.active::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    border-radius: 0 3px 3px 0;
    background: var(--color-primary);
}

.sidebar-nav .nav-link .nav-badge {
    position: absolute;
    top: 4px;
    left: 26px;
    background: var(--color-primary);
    color: white;
    font-size: 0.55rem;
    font-weight: 600;
    padding: 0.1em 0.35em;
    border-radius: 99px;
    min-width: 14px;
    text-align: center;
    line-height: 1.4;
}

/* Sidebar divider */
.sidebar-divider {
    height: 1px;
    background: var(--sidebar-border);
    margin: 0.5rem 6px;
}

/* Sidebar footer */
.sidebar-footer {
    padding: 0.5rem 0;
    border-top: 1px solid var(--sidebar-border);
}

.sidebar-footer .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 0.55rem;
    height: 36px;
    color: var(--sidebar-text);
    font-size: 0.82rem;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
    text-decoration: none;
    white-space: nowrap;
}

.sidebar-footer .nav-link i {
    width: 36px;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: inherit;
    text-align: center;
}

.sidebar-footer .nav-link span {
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* Show footer text in expanded mode */
body.sidebar-expanded .sidebar-footer .nav-link span {
    opacity: 1;
}

/* ============================================================
   SIDEBAR EXPAND TOGGLE — Switch between compact and expanded
   ============================================================ */
.sidebar-expand-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 12px;
    height: 36px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    width: 100%;
    text-align: left;
    border-radius: 0;
    margin: 0;
}

.sidebar-expand-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.9);
}

.sidebar-expand-btn i {
    width: 24px;
    text-align: center;
    font-size: 0.8rem;
    flex-shrink: 0;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.sidebar-expand-btn span {
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    overflow: hidden;
}

/* Show toggle text in expanded mode */
body.sidebar-expanded .sidebar-expand-btn span {
    opacity: 1;
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */
#page-content-wrapper {
    margin-left: 48px;
    min-height: 100vh;
    width: calc(100% - 48px);
    display: flex;
    flex-direction: column;
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1), width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Expanded mode: adjust page content */
body.sidebar-expanded #page-content-wrapper {
    margin-left: 220px;
    width: calc(100% - 220px);
}

.top-header {
    height: var(--header-height);
    background: var(--header-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    position: sticky;
    top: 0;
    z-index: var(--z-sticky, 1020);
}

/* Hide page title in header - Azure doesn't have it */
.top-header .header-title {
    display: none;
}

/* Show sidebar toggle on mobile */
.top-header .header-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: transparent;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    color: var(--header-text);
    font-size: 0.85rem;
}

.top-header .header-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.top-header .header-search {
    margin: 0 auto;
    position: relative;
    flex: 0 1 460px;
    max-width: 460px;
}

.top-header .header-search input {
    width: 100%;
    height: 34px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-sm);
    padding: 0 0.75rem 0 2.25rem;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.15);
    transition: all var(--duration) var(--ease);
    color: white;
    font-family: inherit;
}

.top-header .header-search input:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.top-header .header-search input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

.top-header .header-search i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.8rem;
}

/* Azure-style separator line between search and actions */
.top-header .header-search::after {
    content: '';
    position: absolute;
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================================
   GLOBAL SEARCH DROPDOWN - Azure 2-Column Layout
   ============================================================ */
.search-results-dropdown {
    position: absolute;
    top: calc(100% + 44px);
    left: 50%;
    transform: translateX(-50%);
    width: 920px;
    max-height: 480px;
    overflow-y: auto;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: 8px;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0,0,0,0.05);
    z-index: 1060;
    display: none;
    padding: 0;
}

.search-results-dropdown.open {
    display: block;
    animation: searchDropdownIn 0.15s ease-out;
}

@keyframes searchDropdownIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* 2-column grid container */
.search-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.search-results-column {
    padding: 8px 0;
}

.search-results-column:first-child {
    border-right: 1px solid var(--border-subtle);
}

/* Group */
.search-results-group {
    padding: 0 0 4px;
}

.search-results-group + .search-results-group {
    border-top: 1px solid var(--bg-muted);
    margin-top: 4px;
}

/* Azure-style group header: label left + count link right */
.search-results-group-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 8px 16px 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.search-results-group-header .group-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.search-results-group-header .group-count {
    font-size: 11px;
    font-weight: 400;
    color: var(--color-primary);
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    margin-left: 8px;
}

.search-results-group-header .group-count:hover {
    text-decoration: underline;
}

/* Result Item */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 16px;
    text-decoration: none;
    transition: background 0.1s ease;
    cursor: pointer;
}

.search-result-item:hover {
    background: var(--bg-surface-hover);
}

/* Icon square — inline SVG */
.search-result-item .result-icon {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--bg-muted);
}

/* SVG icons inherit color from parent */
.search-result-item .result-icon svg {
    display: block;
    flex-shrink: 0;
}

/* Per-type colored icon backgrounds */
.search-results-group[data-type="customers"] .result-icon { background: var(--color-primary-light); }
.search-results-group[data-type="customers"] .result-icon svg { color: var(--color-primary); }

.search-results-group[data-type="invoices"] .result-icon { background: var(--color-success-light); }
.search-results-group[data-type="invoices"] .result-icon svg { color: var(--color-success); }

.search-results-group[data-type="tickets"] .result-icon { background: var(--color-warning-light); }
.search-results-group[data-type="tickets"] .result-icon svg { color: var(--color-warning); }

.search-results-group[data-type="domains"] .result-icon { background: var(--color-info-light); }
.search-results-group[data-type="domains"] .result-icon svg { color: var(--color-info); }

.search-results-group[data-type="products"] .result-icon { background: var(--color-primary-light); }
.search-results-group[data-type="products"] .result-icon svg { color: var(--color-primary); }

.search-results-group[data-type="orders"] .result-icon { background: var(--color-danger-light); }
.search-results-group[data-type="orders"] .result-icon svg { color: var(--color-danger); }

/* Result info */
.search-result-item .result-info {
    flex: 1;
    min-width: 0;
}

.search-result-item .result-title {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-primary);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Right-aligned type label (like Azure's "App Service" tag) */
.search-result-item .result-type {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}

/* Loading Spinner in Search Bar */
.search-loading {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

.search-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: searchSpin 0.6s linear infinite;
}

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

/* No Results State */
.search-no-results {
    padding: 20px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Footer */
.search-results-footer {
    padding: 8px 16px;
    text-align: left;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-muted);
    border-radius: 0 0 8px 8px;
}

.search-results-footer a {
    color: var(--color-primary);
    text-decoration: none;
    cursor: pointer;
}

.search-results-footer a:hover {
    text-decoration: underline;
}

/* Responsive: single column + full width on small screens */
@media (max-width: 768px) {
    .search-results-dropdown {
        width: calc(100vw - 32px);
        left: 50%;
        transform: translateX(-50%);
    }
    .search-results-grid {
        grid-template-columns: 1fr;
    }
    .search-results-column:first-child {
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
    }
}

.top-header .header-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.top-header .header-actions .action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    color: var(--header-text);
    font-size: 0.85rem;
    position: relative;
    opacity: 0.85;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.top-header .header-actions .action-btn i {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.top-header .header-actions .action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    opacity: 1;
}

.top-header .header-actions .action-btn .badge-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-warning);
    border: 2px solid var(--header-bg);
}

/* User dropdown — Azure style circular avatar */
.header-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--duration) var(--ease);
    border: none;
    background: none;
    margin-left: 0.5rem;
}

.header-user:hover {
    background: rgba(255, 255, 255, 0.1);
}

.header-user .user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--header-text);
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.header-user .user-info {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.header-user .user-name {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--header-text);
    line-height: 1.2;
}

.header-user .user-role {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.7);
    text-transform: capitalize;
}

.header-chevron {
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.6);
    margin-left: 0.25rem;
}

/* Azure-style brand text in header */
.header-brand {
    font-size: 1rem;
    font-weight: 600;
    color: var(--header-text);
    white-space: nowrap;
    margin-right: 1.5rem;
}

.dropdown-item-danger {
    color: var(--color-danger) !important;
}

.dropdown-item-danger:hover {
    background: var(--color-danger-light) !important;
}

.nav-link-danger {
    color: var(--color-danger) !important;
}

.nav-link-danger:hover {
    background: var(--color-danger-light) !important;
}

.header-actions-end {
    margin-left: auto;
}

.footer-divider {
    margin: 0 0.5rem;
    opacity: 0.3;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
main {
    flex: none;
    padding: 2rem !important;
}

/* ============================================================
   NEW LAYOUT — Page Container, Breadcrumbs, Sections
   ============================================================ */
.page-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 32px;
}

/* Breadcrumb */
.breadcrumb-wrapper {
    margin-bottom: 24px;
}

.breadcrumb-wrapper .breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    font-size: 13px;
}

.breadcrumb-wrapper .breadcrumb-item a {
    color: var(--color-primary);
    text-decoration: none;
}

.breadcrumb-wrapper .breadcrumb-item a:hover {
    text-decoration: underline;
}

.breadcrumb-wrapper .breadcrumb-item.active {
    color: var(--text-muted);
}

.breadcrumb-wrapper .breadcrumb-item + .breadcrumb-item::before {
    content: "\2192";
    color: var(--border-default);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Section — Full-width with bottom border divider */
.section {
    background: var(--bg-surface);
    padding: 24px 0;
    border-bottom: 1px solid var(--border-default);
}

.section:last-child {
    border-bottom: none;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.section-title i {
    color: var(--color-primary);
    font-size: 18px;
}

/* ============================================================
   MODULE SUB-NAVIGATION
   ============================================================ */
.module-nav {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-default);
    padding: 0 1.25rem;
    position: sticky;
    top: var(--header-height, 60px);
    z-index: var(--z-fixed, 1030);
}

.module-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 42px;
}

.module-nav-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    min-width: 0;
}

.module-nav-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.module-nav-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    overflow: visible;
    scrollbar-width: none;
}

.module-nav-tabs::-webkit-scrollbar {
    display: none;
}

.module-nav-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.85rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color var(--duration) var(--ease), border-color var(--duration) var(--ease);
    margin-bottom: -1px;
}

.module-nav-tab:hover {
    color: var(--text-primary);
    text-decoration: none;
}

.module-nav-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

.module-nav-tab i {
    font-size: 0.75rem;
}

.module-nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.module-nav-search {
    position: relative;
    flex: 0 1 280px;
}

.module-nav-search i {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.75rem;
    pointer-events: none;
}

.module-nav-search-input {
    width: 100%;
    height: 32px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    padding: 0 0.75rem 0 2rem;
    font-size: 0.8rem;
    font-family: inherit;
    background: var(--bg-base);
    color: var(--text-primary);
    transition: border-color var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.module-nav-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.module-nav-search-input::placeholder {
    color: var(--text-muted);
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--duration) var(--ease), transform var(--duration) var(--ease);
    overflow: hidden;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-subtle);
    padding: 1rem 1.25rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.card-body {
    padding: 1.25rem;
}

/* ============================================================
   STAT CARDS (Dashboard)
   ============================================================ */
.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all var(--duration) var(--ease);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 4px 0 0 4px;
}

.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.stat-card .stat-icon i {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.stat-card .stat-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.25rem;
}

.stat-card .stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stat-card .stat-link {
    font-size: 0.78rem;
    font-weight: 500;
    margin-top: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    opacity: 0.7;
    transition: opacity var(--duration) var(--ease);
}

.stat-card .stat-link i {
    font-size: 0.65rem;
}

.stat-card:hover .stat-link {
    opacity: 1;
}

/* Stat card color variants */
.stat-card.stat-accent::before { background: var(--color-primary); }
.stat-card.stat-accent .stat-icon { background: var(--color-primary-light); color: var(--color-primary); }
.stat-card.stat-accent .stat-link { color: var(--color-primary); }

.stat-card.stat-success::before { background: var(--color-success); }
.stat-card.stat-success .stat-icon { background: var(--color-success-light); color: var(--color-success); }
.stat-card.stat-success .stat-link { color: var(--color-success); }

.stat-card.stat-warning::before { background: var(--color-warning); }
.stat-card.stat-warning .stat-icon { background: var(--color-warning-light); color: var(--color-warning); }
.stat-card.stat-warning .stat-link { color: var(--color-warning); }

.stat-card.stat-danger::before { background: var(--color-danger); }
.stat-card.stat-danger .stat-icon { background: var(--color-danger-light); color: var(--color-danger); }
.stat-card.stat-danger .stat-link { color: var(--color-danger); }

.stat-card.stat-info::before { background: var(--color-info); }
.stat-card.stat-info .stat-icon { background: var(--color-info-light); color: var(--color-info); }
.stat-card.stat-info .stat-link { color: var(--color-info); }

/* ============================================================
   TABLES
   ============================================================ */
.table {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.table thead th {
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-default);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: middle;
}

.table tbody tr {
    transition: background var(--duration) var(--ease);
}

.table tbody tr:hover {
    background: var(--bg-surface-hover);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

.data-table td:first-child,
.data-table th:first-child {
    padding-left: 1.25rem;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.72rem;
    padding: 0.3em 0.65em;
    border-radius: var(--radius-xs);
    letter-spacing: 0.01em;
    white-space: nowrap;
}

/* Button styles now defined in ui/css/core/button.css — imported in layout.php */

/* Text utilities */
.text-success { color: var(--color-success) !important; }
.text-danger { color: var(--color-danger) !important; }
.text-warning { color: var(--color-warning) !important; }
.text-info { color: var(--color-info) !important; }
.text-muted { color: var(--text-muted) !important; }

/* Alert overrides — use design tokens */
.alert-success {
    background: var(--color-success-light);
    color: var(--color-success);
    border-color: var(--color-success-light);
}
.alert-danger {
    background: var(--color-danger-light);
    color: var(--color-danger);
    border-color: var(--color-danger-light);
}
.alert-warning {
    background: var(--color-warning-light);
    color: var(--color-warning);
    border-color: var(--color-warning-light);
}
.alert-info {
    background: var(--color-info-light);
    color: var(--color-info);
    border-color: var(--color-info-light);
}

/* Badge overrides */
.badge.bg-success { background: var(--color-success) !important; }
.badge.bg-danger { background: var(--color-danger) !important; }
.badge.bg-warning { background: var(--color-warning) !important; }
.badge.bg-info { background: var(--color-info) !important; }

/* Table overrides */
.table > :not(caption) > * > * {
    color: var(--text-primary);
    background-color: transparent;
}
.table-bordered > :not(caption) > * {
    border-color: var(--border-default);
}
.table-hover > tbody > tr:hover > * {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

/* Card overrides */
.card {
    border-color: var(--border-default);
    background: var(--bg-surface);
}
.card-header {
    background: var(--bg-surface);
    border-bottom-color: var(--border-default);
    color: var(--text-primary);
}

/* Dropdown overrides */
.dropdown-menu {
    border-color: var(--border-default);
    background: var(--bg-surface);
}
.dropdown-item {
    color: var(--text-secondary);
}
.dropdown-item:hover,
.dropdown-item:focus {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

/* Modal overrides */
.modal-content {
    border-color: var(--border-default);
    background: var(--bg-surface);
}
.modal-header {
    border-bottom-color: var(--border-default);
}
.modal-footer {
    border-top-color: var(--border-default);
}

/* Pagination overrides */
.page-link {
    color: var(--color-primary);
    border-color: var(--border-default);
}
.page-item.active .page-link {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

/* Impersonation banner */
.impersonate-bar {
    background: linear-gradient(135deg, var(--color-warning), var(--color-warning-hover));
    color: var(--text-inverse);
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
}
.impersonate-bar a {
    color: var(--text-inverse);
    text-decoration: underline;
    font-weight: var(--font-bold);
}

/* Logout button reset — remove default link styling */
.logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}
.nav-link.logout-btn {
    width: 100%;
    text-align: left;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-label {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
}

.form-control,
.form-select {
    border-radius: var(--radius-sm);
    border-color: var(--border-default);
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
    transition: all var(--duration) var(--ease);
    color: var(--text-primary);
    font-family: inherit;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================================
   SEARCH BOX
   ============================================================ */
.search-box {
    position: relative;
    max-width: 320px;
}

.search-box input {
    padding-left: 2.5rem;
}

.search-box i {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal {
    z-index: 1060 !important;
}

.modal-backdrop {
    z-index: 1055 !important;
}

.modal-backdrop.show {
    opacity: 0.5 !important;
}

[data-theme="dark"] .modal-backdrop {
    background-color: rgba(0, 0, 0, 0.8) !important;
}

[data-theme="dark"] .modal-backdrop.show {
    opacity: 1 !important;
}

.modal-content {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: 1061 !important;
}

.modal-header {
    background: var(--bg-base);
    border-bottom: 1px solid var(--border-default);
    padding: 1rem 1.25rem;
}

.modal-header .modal-title {
    font-size: 1rem;
    font-weight: 600;
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination .page-link {
    border-color: var(--border-default);
    color: var(--text-secondary);
    font-size: 0.82rem;
    border-radius: var(--radius-xs);
    margin: 0 2px;
    transition: all var(--duration) var(--ease);
}

.pagination .page-link:hover {
    background: var(--bg-base);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.pagination .page-item.active .page-link {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
    box-shadow: 0 2px 6px rgba(0, 120, 212, 0.3);
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 50%, var(--color-primary) 100%);
    position: relative;
    overflow: hidden;
}

/* Geometric pattern background */
.login-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, var(--color-primary-light) 0%, transparent 50%);
    pointer-events: none;
}

/* Grid pattern overlay */
.login-wrapper::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
}

.login-card {
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.login-card .card {
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    overflow: hidden;
}

.login-card .card-body {
    padding: 2.5rem;
}

.login-card .brand-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-hover) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-inverse);
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0 auto 1rem;
    box-shadow: 0 4px 15px var(--color-primary-glow);
}

.login-card h4 {
    color: var(--text-primary);
    font-size: 1.15rem;
    margin-bottom: 0.25rem;
}

.login-card .subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.login-card .form-label {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.login-card .form-control {
    background: var(--bg-base);
    border-color: var(--border-default);
    color: var(--text-primary);
    font-size: 0.9rem;
    padding: 0.65rem 0.85rem;
}

.login-card .form-control:focus {
    background: var(--bg-surface);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 120, 212, 0.15);
    color: var(--text-primary);
}

.login-card .form-control::placeholder {
    color: var(--text-muted);
}

.login-card .form-check-label {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.login-card .btn-primary {
    padding: 0.7rem;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.login-card .login-links a {
    color: var(--color-primary);
    font-size: 0.82rem;
    transition: color var(--duration) var(--ease);
}

.login-card .login-links a:hover {
    color: var(--color-primary-hover);
}

.login-card .login-links .divider {
    color: var(--border-default);
    margin: 0 0.5rem;
}

/* ============================================================
   DASHBOARD WIDGETS
   ============================================================ */
.widget-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.widget-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ============================================================
   DROPDOWN
   ============================================================ */
.dropdown-menu {
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    padding: 0.35rem;
    min-width: 180px;
}

.dropdown-item {
    font-size: 0.85rem;
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-xs);
    color: var(--text-secondary);
    transition: all var(--duration) var(--ease);
}

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

.dropdown-item i {
    width: 18px;
    margin-right: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.6;
}

.dropdown-divider {
    border-color: var(--border-subtle);
    margin: 0.25rem 0;
}

/* ============================================================
   ANIMATIONS — Staggered Reveal
   ============================================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.animate-in {
    animation: fadeInUp 0.4s var(--ease) forwards;
    opacity: 0;
}

.delay-1 { animation-delay: 0.05s; }
.delay-2 { animation-delay: 0.1s; }
.delay-3 { animation-delay: 0.15s; }
.delay-4 { animation-delay: 0.2s; }
.delay-5 { animation-delay: 0.25s; }
.delay-6 { animation-delay: 0.3s; }
.delay-7 { animation-delay: 0.35s; }
.delay-8 { animation-delay: 0.4s; }

/* Page transition */
.page-enter {
    animation: fadeIn 0.3s var(--ease);
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

#sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
}

#sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    #sidebar {
        width: 220px !important;
        transform: translateX(-100%);
    }

    body.sidebar-compact #sidebar {
        width: 48px !important;
    }

    #sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    }

    #page-content-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .top-header .header-toggle {
        display: flex;
    }
}

@media (max-width: 640px) {
    main {
        padding: 1rem !important;
    }

    .stat-card {
        padding: 1rem;
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }

    .service-card .card-body {
        padding: 1rem 0.5rem;
    }

    .service-card-icon {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }
}

/* ============================================================
   PRINT
   ============================================================ */
@media print {
    #sidebar, .top-header, .btn, footer {
        display: none !important;
    }

    #page-content-wrapper {
        margin-left: 0 !important;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--border-default);
    }

    .stat-card::before {
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* ============================================================
   BLADE TEMPLATE SHARED STYLES
   ============================================================ */
.blade-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.blade-info-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
}

.blade-info-grid.cols-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.blade-info-item {
    /* Container for label + value pairs */
}

.blade-info-item label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.blade-info-item span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.blade-info-item a {
    color: var(--color-primary);
    text-decoration: none;
}

.blade-info-item a:hover {
    text-decoration: underline;
}

.blade-section {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-default);
}

.blade-section:last-child {
    border-bottom: none;
}

.blade-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.blade-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.blade-table th {
    text-align: left;
    padding: 6px 8px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-default);
}

.blade-table td {
    padding: 6px 8px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-default);
}

.blade-totals {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.blade-totals > div {
    padding: 3px 0;
}

.blade-totals .text-success {
    color: var(--color-success) !important;
}

.blade-totals .text-danger {
    color: var(--color-danger) !important;
}

.blade-totals .text-warning {
    color: var(--color-warning) !important;
}

.blade-nowrap {
    white-space: nowrap;
}

.blade-messages {
    max-height: 280px;
    overflow-y: auto;
}

.blade-muted {
    font-size: 0.85rem;
}

.blade-mono {
    font-family: Consolas, monospace;
    font-size: 0.8rem;
}

.blade-border-top {
    border-top: 1px solid var(--border-default);
}

/* ============================================================
   AZURE SERVICE CARDS (Dashboard)
   ============================================================ */
.ticket-msg {
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 8px;
    background: var(--bg-surface);
}

.ticket-msg.client {
    background: var(--bg-elevated);
    border-left: 3px solid var(--color-primary);
}

.ticket-msg.staff {
    background: var(--bg-surface);
    border-left: 3px solid var(--color-info);
}

.ticket-msg-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.ticket-msg p {
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

/* ============================================================
   AZURE SERVICE CARDS (Dashboard) — Large prominent style
   ============================================================ */
.service-cards-section h5 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.service-card {
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    text-decoration: none;
    display: block;
    text-align: center;
}

.service-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--color-primary);
}

.service-card .card-body {
    padding: 1.5rem 1rem;
    text-align: center;
}

.service-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem;
    font-size: 1.5rem;
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.service-card-icon i {
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
}

.service-card-icon.blue {
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.service-card-icon.green {
    background: var(--color-success-light);
    color: var(--color-success);
}

.service-card-icon.orange {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

.service-card-icon.purple {
    background: var(--color-info-light);
    color: var(--color-info);
}

.service-card-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ============================================================
   BLADE PANEL SYSTEM (Azure Portal Style)
   ============================================================ */
.blade-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: var(--z-modal-backdrop, 1050);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.blade-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.blade-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 640px;
    max-width: 90vw;
    z-index: var(--z-modal, 1060);
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    box-shadow: var(--shadow-xl);
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.blade-panel.open {
    transform: translateX(0);
}

.blade-panel .blade-header {
    background: var(--color-primary);
    color: var(--text-inverse);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 0.75rem;
}

.blade-panel .blade-header .blade-back {
    background: none;
    border: none;
    color: var(--text-inverse);
    font-size: 1rem;
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.8;
    transition: opacity 0.15s;
    display: none;
}

.blade-panel .blade-header .blade-back.visible {
    display: block;
}

.blade-panel .blade-header .blade-back:hover {
    opacity: 1;
}

.blade-panel .blade-header .blade-title {
    font-size: 1rem;
    font-weight: 600;
    flex: 1;
}

.blade-panel .blade-header .blade-close {
    background: none;
    border: none;
    color: var(--text-inverse);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.8;
    transition: opacity 0.15s;
    line-height: 1;
}

.blade-panel .blade-header .blade-close:hover {
    opacity: 1;
}

.blade-panel .blade-breadcrumb {
    padding: 0.5rem 1.25rem;
    font-size: 0.78rem;
    border-bottom: 1px solid var(--border-default);
    color: var(--text-secondary);
    background: var(--bg-base);
    flex-shrink: 0;
}

.blade-panel .blade-breadcrumb a {
    color: var(--color-primary);
    text-decoration: none;
}

.blade-panel .blade-breadcrumb a:hover {
    text-decoration: underline;
}

.blade-panel .blade-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

/* Stacked blades */
.blade-panel.level-2 {
    width: 620px;
}

.blade-panel.level-3 {
    width: 600px;
}

@media (max-width: 768px) {
    .blade-panel {
        width: 100vw;
        max-width: 100vw;
    }
}

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-overlay .spinner-border {
    width: 2rem;
    height: 2rem;
    color: var(--color-primary) !important;
    border-width: 0.2em;
}

/* ============================================================
   EMPTY STATES
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    opacity: 0.3;
    margin-bottom: 1rem;
    display: block;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ============================================================
   SETTINGS PAGES
   ============================================================ */

/* Settings card */
.settings-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.settings-card:last-child {
    margin-bottom: 0;
}

.settings-card .card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-default);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.settings-card .card-header h3 {
    font-size: 15px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-card .card-body {
    padding: 24px;
}

/* Form grid 2 columns */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 32px;
}

/* Form group */
.form-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group .field-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 400;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-base);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--duration, 0.15s) var(--ease, ease);
}

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

.form-group input:disabled,
.form-group select:disabled {
    background: var(--bg-surface-hover);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Password toggle */
.input-group-btn {
    display: flex;
}

.input-group-btn input {
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    border-right: none;
}

.input-group-btn .btn-toggle {
    padding: 8px 12px;
    border: 1px solid var(--border-default);
    border-left: none;
    background: var(--bg-surface-hover);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    transition: background var(--duration, 0.15s) var(--ease, ease);
}

.input-group-btn .btn-toggle:hover {
    background: var(--border-default);
}

/* Switch group */
.switch-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-base);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.switch-group .switch-label {
    font-size: 13px;
    font-weight: 500;
}

.switch-group .switch-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Save bar */
.save-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 16px 0 0;
    margin-top: 24px;
    border-top: 1px solid var(--border-default);
}

.save-bar .save-actions {
    display: flex;
    gap: 8px;
}

/* Connection badge */
.conn-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 500;
}

.conn-badge.connected {
    background: var(--color-success-light);
    color: var(--color-success);
}

.conn-badge.connected::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-success);
}

.conn-badge.disconnected {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

.conn-badge.disconnected::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-danger);
}

/* ============================================================
   SETTINGS INDEX — Card Grid & Search
   ============================================================ */

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.settings-card-link {
    display: block;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 24px;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s ease;
    position: relative;
}

.settings-card-link:hover {
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.settings-card-link .card-icon {
    width: 48px;
    height: 48px;
    background: var(--color-primary-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--color-primary);
    margin-bottom: 16px;
}

.settings-card-link .card-title {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--text-primary);
}

.settings-card-link .card-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

.settings-card-link .card-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.settings-card-link .card-badge.configured {
    background: var(--color-success-light);
    color: var(--color-success);
}

.settings-card-link .card-badge.not-configured {
    background: var(--color-danger-light);
    color: var(--color-danger);
}

/* Settings Categories */
.settings-category {
    margin-bottom: 8px;
}

.settings-category-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin: 0 0 12px;
    padding-left: 2px;
}

.settings-search {
    position: relative;
    max-width: 320px;
}

.settings-search input {
    width: 100%;
    padding: 10px 12px 10px 36px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--bg-base);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--duration) var(--ease);
}

.settings-search input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

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

.settings-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 16px;
}

.settings-page-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin: 0;
}

.settings-page-header p {
    font-size: 14px;
    color: var(--text-muted);
    margin: 4px 0 0;
}

.no-results {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.no-results i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.no-results p {
    font-size: 14px;
}

/* ============================================================
   ICON ACCENT — Utility class for accent-colored icons
   ============================================================ */

.icon-accent {
    color: var(--color-primary);
}

/* ============================================================
   DARK MODE TOGGLE
   ============================================================ */

.theme-toggle {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--duration) var(--ease);
    color: var(--header-text);
    font-size: 0.85rem;
    position: relative;
    opacity: 0.85;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    opacity: 1;
}

.theme-toggle .fa-moon {
    display: none;
}

[data-theme="dark"] .theme-toggle .fa-sun {
    display: none;
}

[data-theme="dark"] .theme-toggle .fa-moon {
    display: inline;
}

/* ============================================================
   Utility Classes — Design Token Consistency
   ============================================================ */

/* Badge sizes */
.badge-sm { font-size: 0.7rem; padding: 0.25em 0.55em; }
.badge-xs { font-size: 0.65rem; padding: 0.2em 0.45em; }

/* Status badge color tokens */
.badge-active { background: var(--color-success-light); color: var(--color-success); }
.badge-suspended { background: var(--color-danger-light); color: var(--color-danger); }
.badge-pending { background: var(--color-warning-light); color: var(--color-warning); }
.badge-closed { background: var(--color-info-light); color: var(--color-info); }
.badge-paid { background: var(--color-success-light); color: var(--color-success); }
.badge-unpaid { background: var(--color-danger-light); color: var(--color-danger); }
.badge-overdue { background: var(--color-danger-light); color: var(--color-danger); }
.badge-draft { background: var(--color-info-light); color: var(--color-info); }
.badge-accepted { background: var(--color-success-light); color: var(--color-success); }
.badge-rejected { background: var(--color-danger-light); color: var(--color-danger); }
.badge-dead { background: var(--color-info-light); color: var(--color-info); }
.badge-sent { background: var(--color-info-light); color: var(--color-info); }
.badge-delivered { background: var(--color-info-light); color: var(--color-info); }

/* Summary card icon circles */
.sc-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 0.9rem; margin-bottom: 0.5rem; }
.sc-icon-blue { background: var(--color-info-light); color: var(--color-info); }
.sc-icon-green { background: var(--color-success-light); color: var(--color-success); }
.sc-icon-yellow { background: var(--color-warning-light); color: var(--color-warning); }
.sc-icon-purple { background: var(--color-info-light); color: var(--color-info); }

/* Scrollable card body */
.card-body-scroll { max-height: 300px; overflow-y: auto; }
.card-body-scroll-lg { max-height: 400px; overflow-y: auto; }
.card-body-scroll-xl { max-height: 500px; overflow-y: auto; }

/* Mono / nowrap helpers */
.nowrap { white-space: nowrap; }
.mono { font-family: monospace; }

/* Section subtitle — repeated pattern across templates */
.section-subtitle { font-size: 0.75rem; letter-spacing: 0.05em; }

/* Progress bar size variants */
.progress-sm { height: 6px; }
.progress-lg { height: 20px; }

/* Table column width utilities */
.w-actions { width: 120px; }
.w-col-sm { width: 80px; }
.w-col-md { width: 130px; }
.w-col-lg { width: 250px; }
.w-input { width: 280px; }

/* Sticky sidebar */
.sticky-sidebar { position: sticky; top: 20px; }

/* Chart bar chart */
.chart-bars { height: 120px; display: flex; align-items: flex-end; gap: 4px; }
.chart-bar-column { flex: 1; display: flex; flex-direction: column; align-items: center; }
.chart-bar-fill { width: 100%; background: var(--color-primary); border-radius: 4px 4px 0 0; min-height: 4px; }
.chart-bar-label { font-size: 0.6rem; color: var(--text-muted); margin-top: 2px; }

/* DNS value cell */
.dns-value-cell { max-width: 300px; word-break: break-all; }

/* EPP code */
.epp-code { font-family: monospace; letter-spacing: 2px; }

/* Activity indicator dot */
.dot-sm { font-size: 0.5rem; }

/* Pre-wrap utility */
.pre-wrap { white-space: pre-wrap; }

/* Audit Log */
.audit-log-filters {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}
.filter-item label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.filter-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.filter-buttons {
    display: flex;
    gap: 8px;
}
.badge-action {
    font-size: 0.7rem;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
.badge-login { background: var(--accent-subtle); color: var(--accent); }
.badge-logout { background: var(--bg-surface-hover); color: var(--text-secondary); }
.badge-login-failed { background: #fef2f2; color: #dc2626; }
.badge-login-blocked { background: #fef2f2; color: #dc2626; }
.badge-product-created { background: #f0fdf4; color: #16a34a; }
.badge-product-updated { background: #f0f9ff; color: #2563eb; }
.badge-domain-suspended,
.badge-domain-terminated { background: #fef2f2; color: #dc2626; }
.badge-hosting-suspended { background: #fef2f2; color: #dc2626; }
.badge-hosting-unsuspended { background: #f0fdf4; color: #16a34a; }
.badge-hosting-package-changed { background: #f0f9ff; color: #2563eb; }
.badge-note-added { background: #f0fdf4; color: #16a34a; }
.badge-note-deleted { background: #fef2f2; color: #dc2626; }
.badge-impersonate { background: #fefce8; color: #ca8a04; }
.badge-funds-added,
.badge-credit-applied { background: #f0fdf4; color: #16a34a; }
.badge-balance-deducted { background: #fef2f2; color: #dc2626; }
.badge-invoice-paid-via-balance { background: #f0fdf4; color: #16a34a; }
#auditLogGrid-search { display: none; }

/* Sticky Header */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-surface, #fff);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    padding: 0.75rem 0;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 1024px) {
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
}
