#appMain.is-loading {
    opacity: 0.6;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

:root {
    --header-height: 48px;
    --nav-width-expanded: 220px;
    --nav-width-collapsed: 52px;
    --filters-width: 260px;
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --color-accent: #0066cc;
    --color-accent-light: #e6f0fa;
    --color-bg: #f7f8fa;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --color-border-light: #f0f1f3;
    --color-text: #1f2937;
    --color-text-muted: #6b7280;
    --color-text-light: #9ca3af;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 2px 4px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
    --z-dropdown: 100;
    --z-drawer: 200;
    --z-backdrop: 150;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    overflow-x: hidden;
}

.table-scroll {
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
}

.table-scroll table {
    width: 100%;
    border-collapse: collapse;
}

.table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 2;
}

.app-shell {
    display: grid;
    grid-template-rows: var(--header-height) 1fr;
    grid-template-columns: var(--nav-width-expanded) 1fr;
    grid-template-areas:
        "header header"
        "nav content";
    height: 100vh;
    transition: grid-template-columns var(--transition-normal);
}

.nav-collapsed .app-shell {
    grid-template-columns: var(--nav-width-collapsed) 1fr;
}

.app-header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--spacing-md);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: 4px;
    min-width: 44px;
    min-height: 44px;
}

.hamburger-btn:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.logo-placeholder {
    width: 28px;
    height: 28px;
    background: var(--color-accent);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-placeholder .bi {
    font-size: 16px;
    color: white;
}

.logo-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
}

.logo-link { display: inline-flex; align-items: center; }
.app-logo { height: 34px; width: auto; display: block; }
.app-logo-dark { display: none; }

@media (prefers-color-scheme: dark) {
    .app-logo-light { display: none; }
    .app-logo-dark { display: block; }
}

@media (max-width: 767px) {
    .app-logo { height: 22px; }
}

.tenant-name {
    font-size: 13px;
    color: var(--color-text-muted);
    padding-left: var(--spacing-md);
    border-left: 1px solid var(--color-border);
}

.header-filters-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1 1 auto;
    justify-content: flex-end;
}

.filters-link {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
}

.filters-link:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.filters-chips {
    display: flex;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    justify-content: flex-end;
}

.filter-chip {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--color-text);
    cursor: pointer;
    flex: 0 0 auto;
}

.filter-chip:hover {
    border-color: var(--color-text-light);
}

.header-context-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 16px;
    padding: 0 12px;
    border-left: 1px solid var(--color-border);
    border-right: 1px solid var(--color-border);
    height: 32px;
    overflow-x: auto;
    white-space: nowrap;
}

.header-context-filters .filters-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
}

.header-context-filters .filter-group {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}

.header-context-filters label {
    display: inline-block;
    margin: 0 6px 0 0;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: none;
    letter-spacing: 0;
}

.header-context-filters select,
.header-context-filters .filter-select {
    height: 30px;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
}

.header-context-filters .k-input {
    height: 30px;
    padding: 4px 10px;
    font-size: 12px;
    min-width: 100px;
}

.header-context-filters .node-selectors {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-context-filters .node-selector {
    display: none;
}

.header-context-filters .node-selector[style*="display: block"] {
    display: flex !important;
}

.header-context-filters .custom-dates {
    display: none !important;
}

.header-context-filters .filter-actions {
    border-top: none;
    padding-top: 0;
}

.header-context-filters .btn-apply {
    width: auto;
    padding: 6px 10px;
    height: 30px;
    font-size: 12px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    justify-content: flex-end;
}

.header-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: 4px;
    min-width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.header-btn:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.header-btn .bi {
    font-size: 18px;
}

.filters-btn-mobile {
    display: none;
}

.support-popover, .user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-md);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
    z-index: var(--z-dropdown);
    color: var(--color-text);
}

.support-popover.visible, .user-dropdown.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(4px);
}

.support-popover h4, .user-dropdown h4 {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
}

.support-popover p {
    font-size: 13px;
    margin-bottom: var(--spacing-xs);
}

.support-popover a {
    color: var(--color-accent);
    text-decoration: none;
}

.support-popover a:hover {
    text-decoration: underline;
}

.support-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border-light);
}

.support-section h4 {
    margin-bottom: 8px;
}

.app-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.app-radio {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    margin: 0;
}

.app-radio:hover {
    background: var(--color-bg);
}

.app-radio input {
    margin: 0;
}

.mode-selector {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.mode-selector .bi {
    font-size: 14px;
    color: var(--color-text-muted);
}

.mode-selector select {
    padding: 4px 8px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 12px;
    cursor: pointer;
}

.mode-selector select:hover {
    border-color: var(--color-text-light);
}

.mode-selector select:focus {
    outline: none;
    border-color: var(--color-accent);
}

.mode-selector select option {
    background: var(--color-surface);
    color: var(--color-text);
}

.user-menu-wrapper {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    background: none;
    border: none;
    color: var(--color-text);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: 4px;
}

.user-menu-btn:hover {
    background: var(--color-bg);
}

.user-avatar {
    width: 28px;
    height: 28px;
    background: var(--color-accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.user-name {
    font-size: 13px;
    color: var(--color-text);
}

.user-dropdown-item {
    display: block;
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--color-text);
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
}

.user-dropdown-item:hover {
    background: var(--color-bg);
}

.user-dropdown-section {
    padding: var(--spacing-xs) 0;
}

.user-dropdown-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--spacing-xs) var(--spacing-md);
    margin-bottom: var(--spacing-xs);
}

.user-dropdown-divider {
    height: 1px;
    background: var(--color-border);
    margin: var(--spacing-sm) 0;
}

.user-role-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.user-role-item i {
    font-size: 14px;
    color: var(--color-text-muted);
}

.user-role-item.active {
    background: var(--color-accent-light, rgba(0, 120, 212, 0.1));
    color: var(--color-accent);
    font-weight: 500;
}

.user-role-item.active i {
    color: var(--color-accent);
}

.sidebar {
    grid-area: nav;
    background: var(--color-surface);
    border-right: 1px solid var(--color-border);
    overflow: hidden;
    transition: width var(--transition-normal);
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Ensure sidebar width follows collapsed/expanded state */
body.nav-collapsed .sidebar { width: var(--nav-width-collapsed); }
body:not(.nav-collapsed) .sidebar { width: var(--nav-width-expanded); }

/* Ensure grid column follows too (works even if class is applied on body) */
body.nav-collapsed .app-shell { grid-template-columns: var(--nav-width-collapsed) 1fr; }
body:not(.nav-collapsed) .app-shell { grid-template-columns: var(--nav-width-expanded) 1fr; }

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.sidebar-footer {
    flex: 0 0 auto;
    border-top: 1px solid var(--color-border-light);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    background: var(--color-surface);
}

.powered-by {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-text-muted);
    font-size: 12px;
    flex: 1 1 auto;
    min-width: 0;
}

.powered-text {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.powered-by .bi {
    font-size: 16px;
    color: var(--color-text-light);
    flex-shrink: 0;
}

.sidebar-collapse-btn {
    position: static;
    background: transparent;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    min-width: 28px;
    min-height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-collapse-btn .bi {
    font-size: 16px;
    color: var(--color-text-muted);
    opacity: 0.7;
}

.sidebar-collapse-btn:hover {
    background: var(--color-bg);
}

.sidebar-collapse-btn:hover .bi {
    color: var(--color-text);
    opacity: 1;
}

body.nav-collapsed .sidebar-collapse-btn .bi {
    transform: rotate(180deg);
}

.nav-collapsed .powered-by {
    display: flex;
    justify-content: center;
    flex: 1;
}

.nav-collapsed .powered-text {
    display: none;
}

.nav-collapsed .sidebar-footer {
    padding: 10px 8px;
    justify-content: center;
    gap: 6px;
}


.nav-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: var(--spacing-xs);
    border-bottom: 1px solid var(--color-border-light);
}

.toggle-nav-btn {
    display: none;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: 4px;
    min-width: 36px;
    min-height: 36px;
    align-items: center;
    justify-content: center;
}

.toggle-nav-btn:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.close-nav-btn {
    display: none;
}

.nav-list {
    list-style: none;
    padding: var(--spacing-xs) 6px;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.nav-item {
    margin-bottom: 1px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 9px 12px;
    color: var(--color-text-muted);
    text-decoration: none;
    border-radius: 4px;
    transition: all var(--transition-fast);
    min-height: 36px;
    position: relative;
    font-weight: 400;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.nav-link:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.nav-item.active .nav-link {
    background: rgba(0, 102, 204, 0.06);
    color: var(--color-accent);
    font-weight: 500;
}

.nav-item.active .nav-link::before,
.nav-section.active .nav-section-header::before,
.nav-group.active .nav-section-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--color-accent);
    border-radius: 0 2px 2px 0;
}

.nav-link .bi,
.nav-section-header .bi:first-child {
    font-size: 16px;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-text {
    font-size: 12.5px;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-fast);
}

.nav-collapsed .nav-text {
    display: none;
}

.nav-collapsed .nav-submenu {
    display: none !important;
}

.nav-section, .nav-group {
    margin-bottom: 1px;
}

.nav-section-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    color: var(--color-text-muted);
    background: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-align: left;
    font-size: 12.5px;
    font-weight: 400;
    min-height: 36px;
    transition: all var(--transition-fast);
    position: relative;
    text-decoration: none;
}

.nav-section-header:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

a.nav-section-header {
    text-decoration: none;
}

.nav-section.active .nav-section-header,
.nav-group.active .nav-section-header {
    background: rgba(0, 102, 204, 0.06);
    color: var(--color-accent);
    font-weight: 500;
}

.nav-section-header .bi:first-child {
    font-size: 16px;
    flex-shrink: 0;
    width: 18px;
    display: inline-flex;
    justify-content: center;
}

.section-arrow {
    margin-left: auto;
    font-size: 12px;
    transition: transform var(--transition-fast);
    color: var(--color-text-light);
}

.nav-section.expanded .section-arrow,
.nav-group.expanded .section-arrow {
    transform: rotate(180deg);
}

.nav-collapsed .section-arrow {
    display: none;
}

.nav-collapsed .nav-link,
.nav-collapsed .nav-section-header,
.nav-collapsed .nav-section-link {
    justify-content: center;
    padding: 10px 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
}

.nav-collapsed .nav-link .bi,
.nav-collapsed .nav-section-header .bi:first-child {
    margin: 0;
}

/* Collapsed: show icon-only button styling */
body.nav-collapsed .nav-link,
body.nav-collapsed .nav-section-header,
body.nav-collapsed .nav-section-link {
    justify-content: center;
    gap: 0;
    padding: 10px 0;
}

/* Collapsed: adjust active bar position for icon-only view */
body.nav-collapsed .nav-item.active .nav-link::before,
body.nav-collapsed .nav-section.active .nav-section-header::before,
body.nav-collapsed .nav-group.active .nav-section-header::before {
    top: 10px;
    bottom: 10px;
}

body.nav-collapsed .nav-link .bi,
body.nav-collapsed .nav-section-header .bi:first-child {
    margin: 0;
}

.nav-submenu {
    list-style: none;
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal);
    padding-left: 28px;
}

.nav-section.expanded .nav-submenu,
.nav-group.expanded .nav-submenu {
    max-height: 500px;
}

.nav-collapsed .nav-submenu {
    display: none;
}

.nav-subitem {
    margin-bottom: 1px;
}

.nav-sublink {
    display: block;
    padding: 7px 12px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 12.5px;
    border-radius: 4px;
    transition: all var(--transition-fast);
    position: relative;
    font-weight: 400;
}

.nav-sublink:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

.nav-subitem.active .nav-sublink {
    background: transparent;
    color: var(--color-accent);
    font-weight: 500;
}

.nav-subitem.active .nav-sublink::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--color-accent);
    border-radius: 0 2px 2px 0;
}

.main-content {
    grid-area: content;
    overflow-y: auto;
    padding: var(--spacing-lg);
    background: var(--color-bg);
    min-width: 0;
}

.main-content > .page-container,
.main-content > div:first-child {
    background: var(--color-surface);
    border-radius: 8px;
    padding: var(--spacing-lg);
    width: 100%;
    min-width: 0;
}

.page-filters-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.page-filters-toggle {
    display: none;
}

.context-filters {
    position: fixed;
    top: var(--header-height);
    right: -280px;
    width: 280px;
    height: calc(100vh - var(--header-height));
    z-index: var(--z-drawer);
    transition: right var(--transition-normal);
    display: block;
    background: var(--color-surface);
    border-left: 1px solid var(--color-border);
    padding: var(--spacing-md);
    overflow-y: auto;
}

body.filters-drawer-open .context-filters {
    right: 0;
}

body.filters-drawer-open .drawer-backdrop {
    display: block;
}

.filter-section {
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-border-light);
}

.filter-section:last-of-type {
    border-bottom: none;
}

.filter-section-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--spacing-sm);
}

.hierarchy-tree-wrapper {
    margin-top: var(--spacing-sm);
}

.hierarchy-tree {
    border: 1px solid var(--color-border-light);
    border-radius: 6px;
    padding: var(--spacing-sm);
    background: var(--color-bg);
    max-height: 300px;
    overflow-y: auto;
}

.hierarchy-tree ul {
    list-style: none;
    padding-left: 14px;
    margin: 0;
}

.hierarchy-tree .tree-root {
    padding-left: 0;
}

.tree-item {
    margin: 1px 0;
}

.tree-node-row {
    display: flex;
    align-items: center;
    gap: 2px;
}

.tree-toggle-btn {
    width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.tree-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.06);
    color: var(--color-text);
}

.tree-toggle-icon {
    font-size: 10px;
    transition: transform 0.15s ease;
}

.tree-item.expanded > .tree-node-row .tree-toggle-icon {
    transform: rotate(90deg);
}

.tree-toggle-spacer {
    width: 20px;
    flex-shrink: 0;
}

.tree-node {
    flex: 1;
    text-align: left;
    border: none;
    background: transparent;
    padding: 5px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    color: var(--color-text);
}

.tree-node:hover {
    background: rgba(0, 0, 0, 0.04);
}

.tree-node.selected {
    background: rgba(0, 102, 204, 0.12);
    color: var(--color-accent);
    font-weight: 600;
}

.tree-node-text {
    flex: 1;
}

.tree-children {
    display: none;
    padding-left: 8px;
}

.tree-item.expanded > .tree-children {
    display: block;
}

.period-ending-group,
.custom-dates-group {
    margin-top: var(--spacing-sm);
}

.filter-date {
    width: 100%;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface);
}

.filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-sm);
    border-bottom: 1px solid var(--color-border-light);
}

.filters-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.btn-close-filters {
    display: none;
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: var(--spacing-xs);
    border-radius: 4px;
    min-width: 36px;
    min-height: 36px;
}

.btn-close-filters:hover {
    background: var(--color-bg);
}

.filter-group {
    margin-bottom: var(--spacing-md);
}

.filter-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-hint {
    display: block;
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 4px;
    font-style: italic;
}

.dealer-context-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--color-accent-light, rgba(0, 120, 212, 0.1));
    border-radius: 6px;
    color: var(--color-accent);
    font-weight: 500;
    margin-bottom: var(--spacing-sm);
}

.dealer-context-info i {
    font-size: 18px;
}

.dealer-context-chip {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 6px 12px;
    background: var(--color-accent-light, rgba(0, 120, 212, 0.1));
    border-radius: 16px;
    color: var(--color-accent);
    font-weight: 500;
    font-size: 13px;
}

.dealer-context-chip i {
    font-size: 14px;
}

.dealer-ranking-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    background: var(--color-info-light, rgba(0, 120, 212, 0.08));
    border-left: 3px solid var(--color-accent);
    border-radius: 4px;
    margin-bottom: var(--spacing-lg);
    color: var(--color-text);
    font-size: 14px;
}

.dealer-ranking-info i {
    color: var(--color-accent);
    font-size: 18px;
}

.filter-select:disabled {
    background: var(--color-bg);
    color: var(--color-text-muted);
    cursor: not-allowed;
}

.filter-select, .k-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 13px;
    background: var(--color-surface);
}

.filter-select:focus, .k-input:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.custom-dates {
    padding: var(--spacing-sm);
    background: var(--color-bg);
    border-radius: 4px;
    margin-bottom: var(--spacing-md);
}

.filter-actions {
    padding-top: var(--spacing-md);
    border-top: 1px solid var(--color-border-light);
}

.btn-apply {
    width: 100%;
    padding: 10px;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.btn-apply:hover {
    background: #0052a3;
}

.drawer-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: var(--z-backdrop);
}

@media (max-width: 1199px) {
    .app-shell {
        grid-template-columns: var(--nav-width-collapsed) 1fr;
        grid-template-areas:
            "header header"
            "nav content";
    }

    .nav-collapsed .app-shell {
        grid-template-columns: var(--nav-width-collapsed) 1fr;
    }

    .nav-text {
        opacity: 0;
        width: 0;
    }

    .header-context-filters {
        display: none;
    }

    .header-filters-summary {
        justify-content: flex-start;
    }

    .filters-chips {
        display: none;
    }

    .filters-btn-mobile {
        display: flex;
    }

    .btn-close-filters {
        display: flex;
    }
}

@media (max-width: 767px) {
    .app-shell {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "content";
    }

    .hamburger-btn {
        display: flex;
    }

    .tenant-name {
        display: none;
    }

    .sidebar {
        position: fixed;
        top: var(--header-height);
        left: -260px;
        width: 260px;
        height: calc(100vh - var(--header-height));
        z-index: var(--z-drawer);
        transition: left var(--transition-normal);
    }

    .nav-drawer-open .sidebar {
        left: 0;
    }

    .nav-drawer-open .drawer-backdrop,
    .filters-drawer-open .drawer-backdrop {
        display: block;
    }

    .nav-text {
        opacity: 1;
        width: auto;
    }

    .toggle-nav-btn {
        display: none;
    }

    .sidebar-footer {
        display: none;
    }

    .close-nav-btn {
        display: flex;
        background: none;
        border: none;
        color: var(--color-text-muted);
        cursor: pointer;
        padding: var(--spacing-xs);
        border-radius: 4px;
        min-width: 36px;
        min-height: 36px;
    }

    .close-nav-btn:hover {
        background: var(--color-bg);
    }

    .context-filters {
        width: 100%;
        right: -100%;
    }

    .filters-drawer-open .context-filters {
        right: 0;
    }

    .page-filters-toggle {
        display: block;
        width: 100%;
        padding: var(--spacing-sm) var(--spacing-md);
        background: var(--color-surface);
        border: 1px solid var(--color-border);
        border-radius: 6px;
        margin-bottom: var(--spacing-md);
        text-align: left;
        font-size: 13px;
        font-weight: 500;
        color: var(--color-text);
        cursor: pointer;
    }

    .page-filters-section {
        display: none;
    }

    .page-filters-section.expanded {
        display: block;
    }

    .main-content {
        padding: var(--spacing-md);
    }

    .user-name {
        display: none;
    }
}

@media (max-width: 420px) {
    .tenant-name { display: none; }
    .user-name { display: none; }
}

.header-btn, .hamburger-btn, .user-menu-btn {
    min-height: 44px;
    min-width: 44px;
}

/* RevUp dashboard widgets */
.kpi-gauge-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-gauge-card {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.kpi-gauge-card .kpi-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 8px;
}

.kpi-gauge-card .gauge-container {
    height: 140px;
}

.kpi-gauge-card .kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    margin-top: 8px;
}

@media (max-width: 900px) {
    .kpi-gauge-row { grid-template-columns: 1fr; }
}

.kpi-tiles-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.kpi-tile {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.kpi-tile-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 8px;
}

.kpi-tile-current {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.2;
}

.kpi-tile-previous {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.kpi-tile-previous .prev-label {
    color: var(--color-text-muted);
}

.kpi-tile-variance {
    font-size: 13px;
    font-weight: 600;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.kpi-tile-variance.variance-positive {
    color: #16a34a;
}

.kpi-tile-variance.variance-negative {
    color: #dc2626;
}

@media (max-width: 1200px) {
    .kpi-tiles-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .kpi-tiles-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
    .kpi-tiles-grid { grid-template-columns: 1fr; }
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 1100px) {
    .dashboard-grid { grid-template-columns: 1fr; }
}

.heat-cell {
    text-align: center;
    padding: 8px 6px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
}

.heat-cell.heat-top {
    background: rgba(34, 197, 94, 0.20);
    color: #15803d;
}

.heat-cell.heat-bottom {
    background: rgba(220, 38, 38, 0.15);
    color: #b91c1c;
}

.month-cell {
    text-align: center;
    padding: 8px 6px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
}

.month-cell.heat-top {
    background: rgba(34, 197, 94, 0.20);
    color: #15803d;
}

.month-cell.heat-bottom {
    background: rgba(220, 38, 38, 0.15);
    color: #b91c1c;
}

/* RevUp Summary page filters */
.revup-filters-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    align-items: flex-end;
}

.revup-filter-item {
    display: flex;
    flex-direction: column;
    min-width: 140px;
    max-width: 180px;
}

.revup-filter-item.revup-filter-kpi {
    min-width: 200px;
    max-width: 280px;
    flex: 1;
}

.revup-filter-item label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.revup-filter-item .filter-select {
    width: 100%;
}

.revup-chart-section {
    margin-bottom: 24px;
}

.revup-chart-section #summaryChart {
    height: 320px;
    min-height: 320px;
}

@media (max-width: 600px) {
    .revup-filters-row {
        flex-direction: column;
    }
    
    .revup-filter-item,
    .revup-filter-item.revup-filter-kpi {
        max-width: 100%;
        width: 100%;
    }
}

/* RevUp Metrics Grid Styles */
.revup-grid-section {
    margin-top: 24px;
}

.revup-metrics-grid {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
}

.revup-metrics-grid.k-grid {
    border: none;
    font-size: 13px;
}

.revup-metrics-grid.k-grid table,
.revup-metrics-grid .k-grid-header table,
.revup-metrics-grid .k-grid-content table {
    table-layout: fixed;
    width: 100%;
}

.revup-metrics-grid.k-grid col,
.revup-metrics-grid .k-grid-header col,
.revup-metrics-grid .k-grid-content col {
    width: auto !important;
}

.revup-metrics-grid .k-grid-header col:first-child,
.revup-metrics-grid .k-grid-content col:first-child {
    width: 180px !important;
}

.revup-metrics-grid .k-grid-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--color-bg-surface);
}

.revup-metrics-grid .k-grid-header th {
    background: var(--color-bg-muted);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--color-text-muted);
    padding: 12px 10px;
    border-bottom: 2px solid var(--color-border);
    text-align: center;
}

.revup-metrics-grid .k-grid-header th:first-child {
    text-align: left;
}

.revup-metrics-grid .k-grid-content {
    max-height: 420px;
    overflow: auto;
}

.revup-metrics-grid tbody tr:nth-child(even) td {
    background-color: #e9ecef !important;
}

.revup-metrics-grid tbody tr:nth-child(odd) td {
    background-color: #ffffff !important;
}

.revup-metrics-grid tbody tr:hover td {
    background-color: rgba(0, 102, 204, 0.15) !important;
    cursor: pointer;
}

.revup-metrics-grid tbody tr.kpi-selected-row td,
.revup-metrics-grid tbody tr.kpi-selected-row:nth-child(odd) td,
.revup-metrics-grid tbody tr.kpi-selected-row:nth-child(even) td {
    background-color: rgba(0, 102, 204, 0.25) !important;
}

.revup-metrics-grid tbody tr.kpi-selected-row td:first-child {
    position: relative;
}

.revup-metrics-grid tbody tr.kpi-selected-row td:first-child::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: #0066cc;
}

.revup-metrics-grid td,
.revup-metrics-grid.k-grid td {
    padding: 10px;
    vertical-align: middle;
    border-bottom: 1px solid var(--color-border-light);
}

.revup-metrics-grid td.numeric-cell,
.revup-metrics-grid.k-grid td.numeric-cell,
.revup-metrics-grid .k-grid-content td.numeric-cell {
    text-align: right !important;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono, 'SF Mono', 'Monaco', 'Consolas', monospace);
    font-size: 12px;
}

.revup-metrics-grid td.metric-name-cell,
.revup-metrics-grid.k-grid td.metric-name-cell {
    font-weight: 500;
    text-align: left !important;
}

.revup-metrics-grid .k-state-selected,
.revup-metrics-grid .k-selected {
    background-color: transparent !important;
    color: inherit !important;
}

.revup-metrics-grid .k-header .k-link {
    color: var(--color-text-muted);
}

.revup-metrics-grid .k-i-sort-asc-sm,
.revup-metrics-grid .k-i-sort-desc-sm {
    color: var(--color-primary);
}

/* ========================================
   AUTH PAGES (Sign In, Logged Out)
   Scoped to .auth-page wrapper only
   ======================================== */

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(180deg, #023578 0%, #293B64 100%);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: #ffffff;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border-top: 4px solid #FFCA29;
}

.auth-logo {
    text-align: center;
    margin-bottom: 8px;
}

.auth-logo img {
    height: 48px;
    width: auto;
}

.auth-subtitle {
    text-align: center;
    color: #8291AF;
    font-size: 14px;
    margin-bottom: 32px;
}

.auth-headline {
    text-align: center;
    color: #293B64;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 8px;
}

.auth-message {
    text-align: center;
    color: #8291AF;
    font-size: 15px;
    margin-bottom: 32px;
}

.auth-error {
    background: #fef2f2;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid #fecaca;
}

.auth-form-group {
    margin-bottom: 20px;
}

.auth-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #293B64;
    margin-bottom: 6px;
}

.auth-form-group input,
.auth-form-group select {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    color: #293B64;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-form-group input:focus,
.auth-form-group select:focus {
    outline: none;
    border-color: #8291AF;
    box-shadow: 0 0 0 3px rgba(255, 202, 41, 0.3);
}

.auth-form-group input::placeholder {
    color: #9ca3af;
}

.auth-form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238291AF' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.auth-button {
    display: block;
    width: 100%;
    padding: 14px;
    background: #023578;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s ease;
}

.auth-button:hover {
    background: #293B64;
}

.auth-hint {
    text-align: center;
    color: #8291AF;
    font-size: 13px;
    margin-top: 20px;
}

@media (max-width: 480px) {
    .auth-card {
        padding: 32px 24px;
    }
    
    .auth-logo img {
        height: 40px;
    }
}

.scorecard-filters-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--color-surface);
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.scorecard-filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
}

.scorecard-filter-item label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted);
}

.scorecard-filter-item .filter-select,
.scorecard-filter-item .filter-input {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: #fff;
    color: var(--color-text);
}

.scorecard-filter-item .filter-select:focus,
.scorecard-filter-item .filter-input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.scorecard-search {
    flex: 1;
    min-width: 180px;
    max-width: 280px;
}

.scorecard-chart-section {
    margin-bottom: 20px;
}

.task-mix-chart {
    padding: 16px 0;
}

.task-mix-bar {
    display: flex;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--color-bg);
}

.task-mix-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 4px;
    cursor: pointer;
    transition: opacity 0.15s;
    position: relative;
}

.task-mix-segment:hover {
    opacity: 0.85;
}

.segment-label {
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}

.task-mix-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin-top: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.legend-item:hover {
    background: var(--color-bg);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-text {
    font-size: 13px;
    color: var(--color-text);
}

.legend-value {
    font-size: 12px;
    color: var(--color-text-muted);
}

.task-filter-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #e6f0fa;
    border-radius: 6px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--color-text);
}

.clear-task-btn {
    padding: 4px 10px;
    font-size: 12px;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.clear-task-btn:hover {
    background: #0052a3;
}

.scorecard-table-section {
    overflow: hidden;
    width: 100%;
    min-width: 0;
}

.scorecard-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.scorecard-table-header h3 {
    margin: 0;
}

.scorecard-pagination-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--color-text-muted);
}

.filter-select-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.scorecard-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    width: 100%;
    min-width: 0;
}

.scorecard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: fixed;
    min-width: 1400px;
}

.scorecard-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

.scorecard-table th {
    background: #f8f9fb;
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--color-text);
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}

.scorecard-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.scorecard-table th.sortable:hover {
    background: #eef1f5;
}

.scorecard-table th.active-sort {
    background: #e6f0fa;
    color: var(--color-accent);
}

.sort-icon {
    font-size: 11px;
    margin-left: 4px;
    opacity: 0.5;
}

.scorecard-table th.active-sort .sort-icon {
    opacity: 1;
}

.scorecard-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border-light);
    vertical-align: middle;
}

.scorecard-table .even-row {
    background: #fff;
}

.scorecard-table .odd-row {
    background: #fafbfc;
}

.scorecard-table tr:hover td {
    background: #f0f5ff;
}

.sticky-col {
    position: sticky;
    background: inherit;
    z-index: 1;
}

.col-name {
    left: 0;
    min-width: 150px;
    width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-supervisor {
    left: 150px;
    min-width: 130px;
    width: 130px;
}

.col-cert {
    left: 280px;
    min-width: 120px;
    width: 120px;
}

.col-top3 {
    left: 400px;
    min-width: 160px;
    width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-kpi {
    min-width: 110px;
    width: 110px;
    text-align: right;
}

.col-task {
    min-width: 90px;
    width: 90px;
    text-align: right;
}

.scorecard-table thead .sticky-col {
    z-index: 3;
}

.cert-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.cert-master {
    background: #dcfce7;
    color: #166534;
}

.cert-ase {
    background: #dbeafe;
    color: #1e40af;
}

.cert-uncert {
    background: #f3f4f6;
    color: #6b7280;
}

.kpi-value {
    font-weight: 500;
    font-size: inherit;
}

.kpi-delta {
    font-size: 11px;
    font-weight: 400;
}

.delta-positive {
    color: #059669;
}

.delta-negative {
    color: #dc2626;
}

.no-data {
    text-align: center;
    padding: 40px;
    color: var(--color-text-muted);
}

.scorecard-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid var(--color-border);
}

.pagination-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 14px;
    font-size: 13px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
    color: var(--color-text);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--color-bg);
    border-color: var(--color-text-light);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-numbers {
    display: flex;
    gap: 4px;
}

.page-num {
    min-width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    cursor: pointer;
    color: var(--color-text);
}

.page-num:hover {
    background: var(--color-bg);
}

.page-num.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

@media (max-width: 1024px) {
    .scorecard-filters-row {
        flex-direction: column;
    }
    
    .scorecard-filter-item {
        min-width: 100%;
    }
    
    .scorecard-search {
        max-width: 100%;
    }
}

.overall-dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.overall-dashboard-grid .full-width {
    width: 100%;
}

.dashboard-top-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--spacing-lg);
    align-items: stretch;
}

.dashboard-top-grid .dashboard-widget {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.dashboard-top-grid .widget-body {
    flex: 1;
}

@media (max-width: 1100px) {
    .dashboard-top-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .dashboard-top-grid > :nth-child(3) {
        grid-column: 1 / -1;
    }
}

@media (max-width: 700px) {
    .dashboard-top-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-top-grid > :nth-child(3) {
        grid-column: auto;
    }
}

.dashboard-widget {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
}

.widget-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
}

.widget-body {
    padding: var(--spacing-md);
}

.kpi-main {
    display: flex;
    align-items: baseline;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-xs);
}

.kpi-main .kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-text);
}

.kpi-delta {
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.kpi-delta.positive {
    color: #16a34a;
}

.kpi-delta.negative {
    color: #dc2626;
}

.kpi-prior {
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-md);
}

.sparkline-container {
    height: 50px;
    margin-bottom: var(--spacing-xs);
}

.sparkline-label {
    font-size: 11px;
    color: var(--color-text-light);
    text-align: center;
}

.social-sentiment-row {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
}

.sentiment-item {
    flex: 1;
    text-align: center;
    padding: var(--spacing-sm);
    border-radius: 6px;
    background: var(--color-bg);
}

.sentiment-count {
    display: block;
    font-size: 20px;
    font-weight: 700;
}

.sentiment-label {
    font-size: 11px;
    color: var(--color-text-muted);
}

.sentiment-item.positive .sentiment-count {
    color: #16a34a;
}

.sentiment-item.neutral .sentiment-count {
    color: #6b7280;
}

.sentiment-item.negative .sentiment-count {
    color: #dc2626;
}

.top-themes {
    margin-top: var(--spacing-md);
}

.themes-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-sm);
}

.theme-item {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-xs) 0;
    font-size: 13px;
}

.theme-name {
    color: var(--color-text);
}

.theme-count {
    font-weight: 600;
}

.theme-count.positive {
    color: #16a34a;
}

.theme-count.negative {
    color: #dc2626;
}

.health-toggle {
    display: flex;
    gap: 4px;
}

.toggle-btn {
    padding: 6px 14px;
    border: 1px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all var(--transition-fast);
}

.toggle-btn:first-child {
    border-radius: 4px 0 0 4px;
}

.toggle-btn:last-child {
    border-radius: 0 4px 4px 0;
}

.toggle-btn.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
    color: #fff;
}

.toggle-btn:hover:not(.active) {
    background: var(--color-border);
}

.widget-header-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.widget-date-range {
    font-size: 12px;
    color: var(--color-text-muted);
    font-weight: 400;
}

.health-chart-section {
    margin-bottom: var(--spacing-md);
}

.chart-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-sm);
}

.health-chart-container {
    height: 220px;
    margin-bottom: var(--spacing-sm);
}

.health-grid-section {
    margin-top: var(--spacing-md);
}

.grid-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-sm);
}

.health-grid-container {
    overflow: visible;
    width: 100%;
}

.health-grid-container .k-grid,
.health-grid-container table {
    width: 100%;
    border: 1px solid var(--color-border-light);
    font-size: 13px;
}

.health-grid-container table {
    border-collapse: collapse;
}

.health-grid-container table th,
.health-grid-container table td {
    overflow: hidden;
    text-overflow: ellipsis;
}

.health-grid-container .k-grid-header th {
    background-color: var(--color-bg-secondary);
    font-weight: 600;
    padding: 10px 8px;
    border-bottom: 2px solid var(--color-border);
}

.health-grid-container .k-grid-content td {
    padding: 8px;
    border-bottom: 1px solid var(--color-border-light);
}

.health-grid-container .metric-name-cell {
    font-weight: 500;
}

.health-grid-container .numeric-cell {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.health-grid-container .numeric-header {
    text-align: right;
}

.health-metrics-grid {
    display: grid;
    gap: 0;
}

.health-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border-light);
}

.health-row:last-child {
    border-bottom: none;
}

.metric-label {
    font-size: 13px;
    color: var(--color-text);
}

.metric-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}

.rate-delta {
    margin-left: 6px;
    font-size: 12px;
}

.rate-delta.positive {
    color: #16a34a;
}

.rate-delta.negative {
    color: #dc2626;
}

.view-all-link {
    font-size: 13px;
    color: var(--color-accent);
    text-decoration: none;
}

.view-all-link:hover {
    text-decoration: underline;
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.comment-item {
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--color-border-light);
}

.comment-item:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.comment-badges {
    display: flex;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-xs);
}

.badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.source-badge.survey {
    background: #dbeafe;
    color: #1e40af;
}

.source-badge.social {
    background: #f3e8ff;
    color: #7c3aed;
}

.lob-badge.sales {
    background: #dcfce7;
    color: #15803d;
}

.lob-badge.service {
    background: #fef3c7;
    color: #b45309;
}

.comment-meta {
    display: flex;
    gap: var(--spacing-sm);
    font-size: 12px;
    margin-bottom: var(--spacing-xs);
}

.comment-location {
    color: var(--color-text);
    font-weight: 500;
}

.comment-time {
    color: var(--color-text-muted);
}

.comment-text {
    font-size: 13px;
    color: var(--color-text);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.comment-actions {
    margin-top: var(--spacing-xs);
}

.view-survey-link,
.survey-link {
    font-size: 12px;
    color: var(--color-accent);
    text-decoration: none;
    cursor: pointer;
}

.view-survey-link:hover,
.survey-link:hover,
.view-review-link:hover {
    text-decoration: underline;
}

.view-review-link {
    font-size: 12px;
    color: var(--color-accent);
    text-decoration: none;
    cursor: pointer;
}

/* Enhanced Recent Comments Styles */
.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 6px;
}

.comment-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.comment-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sentiment-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sentiment-dot.positive {
    background: #38a169;
}

.sentiment-dot.neutral {
    background: #718096;
}

.sentiment-dot.negative {
    background: #e53e3e;
}

.score-badge {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    background: #f0f4f8;
    color: #4a5568;
    white-space: nowrap;
}

.score-badge.five-star {
    background: #fef3c7;
    color: #92400e;
}

.score-badge.rating-1000 {
    background: #dbeafe;
    color: #1e40af;
}

.score-badge.rating-5 {
    background: #f3e8ff;
    color: #7c3aed;
}

.widget-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.source-filter-select {
    font-size: 12px;
    padding: 4px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    background: white;
    color: #4a5568;
    cursor: pointer;
}

.source-filter-select:focus {
    outline: none;
    border-color: var(--color-accent);
}

.sentiment-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.sentiment-badge.positive {
    background: #dcfce7;
    color: #15803d;
}

.sentiment-badge.neutral {
    background: #f1f5f9;
    color: #64748b;
}

.sentiment-badge.negative {
    background: #fee2e2;
    color: #dc2626;
}

.respondent-table .survey-link {
    font-size: 13px;
    font-weight: 500;
}

.survey-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
}

.survey-overlay-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
}

.survey-overlay-content {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.survey-overlay-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--color-border-light);
}

.survey-overlay-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.survey-overlay-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 0;
    line-height: 1;
}

.survey-overlay-close:hover {
    color: var(--color-text);
}

.survey-overlay-body {
    padding: var(--spacing-lg);
    overflow-y: auto;
    flex: 1;
}

.survey-id-display {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-md);
}

.survey-id-display span {
    font-weight: 600;
    color: var(--color-text);
}

.survey-placeholder {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--color-text-muted);
}

.survey-placeholder p {
    margin: var(--spacing-sm) 0;
}

.survey-overlay-footer {
    display: flex;
    justify-content: flex-end;
    padding: var(--spacing-md);
    border-top: 1px solid var(--color-border-light);
}

.survey-overlay-footer .btn {
    padding: 8px 20px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}

.survey-overlay-footer .btn-primary {
    background-color: var(--color-primary);
    color: white;
    border: none;
}

.survey-overlay-footer .btn-primary:hover {
    background-color: var(--color-primary-dark);
}

.survey-detail-overlay {
    max-width: 900px;
    max-height: 90vh;
}

.survey-detail-overlay .survey-overlay-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.survey-detail-overlay .survey-overlay-header i {
    font-size: 18px;
    color: var(--color-primary);
}

.survey-detail-overlay .survey-overlay-body {
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.survey-detail-section {
    border-bottom: 1px solid var(--color-border);
}

.survey-detail-section:last-child {
    border-bottom: none;
}

.survey-detail-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 0;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.survey-detail-section-header:hover {
    color: var(--color-primary-dark);
}

.survey-detail-section-header .section-toggle {
    font-size: 12px;
    transition: transform 0.2s ease;
}

.survey-detail-section-body {
    padding: 0 0 16px 24px;
}

.survey-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid var(--color-border-light, #f0f0f0);
}

.survey-detail-row:last-child {
    border-bottom: none;
}

.survey-detail-label {
    color: var(--color-text-muted);
    font-weight: 500;
    min-width: 140px;
}

.survey-detail-value {
    color: var(--color-text);
    text-align: right;
    flex: 1;
}

.survey-questions-table {
    width: 100%;
    border-collapse: collapse;
}

.survey-questions-table tr {
    border-bottom: 1px solid var(--color-border-light, #f0f0f0);
}

.survey-questions-table tr:last-child {
    border-bottom: none;
}

.survey-questions-table td {
    padding: 8px 4px;
    font-size: 12px;
    vertical-align: top;
}

.survey-questions-table .question-id {
    color: var(--color-text-muted);
    font-weight: 500;
    width: 40px;
    white-space: nowrap;
}

.survey-questions-table .question-text {
    color: var(--color-text);
    padding-right: 16px;
}

.survey-questions-table .question-answer {
    color: var(--color-text);
    text-align: right;
    min-width: 120px;
}

.survey-questions-table .question-followup {
    display: block;
    font-size: 11px;
    color: var(--color-text-muted);
    font-style: italic;
    margin-top: 4px;
}

.sales-dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-lg);
}

.sales-dashboard-grid .full-width {
    grid-column: 1 / -1;
}

@media (max-width: 1100px) {
    .sales-dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.btn-link {
    background: none;
    border: none;
    color: var(--color-accent);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}

.btn-link:hover {
    text-decoration: underline;
}

.widget-body.no-padding {
    padding: 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
}

.data-table th {
    font-weight: 600;
    color: var(--color-text-muted);
    background: var(--color-bg);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-table th.sortable:hover {
    color: var(--color-text);
}

.data-table th.sort-asc::after {
    content: ' \25B2';
    font-size: 10px;
}

.data-table th.sort-desc::after {
    content: ' \25BC';
    font-size: 10px;
}

.text-right {
    text-align: right !important;
}

.font-semibold {
    font-weight: 600;
}

.ranking-row.level-0 {
    background: var(--color-bg);
    font-weight: 600;
}

.ranking-row.level-1 {
    font-weight: normal;
}

.ranking-row.level-1 .location-name {
    padding-left: 24px;
}

.expand-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin-right: 4px;
    color: var(--color-text-muted);
}

.expand-toggle:hover {
    color: var(--color-text);
}

.impact-value {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.impact-value.positive {
    color: #16a34a;
}

.impact-value.negative {
    color: #dc2626;
}

.delta-value {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.delta-value.positive {
    color: #16a34a;
}

.delta-value.negative {
    color: #dc2626;
}

.link-value {
    color: var(--color-accent);
    text-decoration: none;
}

.link-value:hover {
    text-decoration: underline;
}

.sparkline-col {
    width: 80px;
}

.mini-sparkline {
    height: 24px;
    width: 60px;
}

.health-trend-chart {
    height: 180px;
    margin-bottom: var(--spacing-md);
}

.health-metrics-list {
    display: flex;
    flex-direction: column;
}

.sentiment-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
}

.sentiment-badge.promoter {
    background: #dcfce7;
    color: #15803d;
}

.sentiment-badge.passive {
    background: #fef3c7;
    color: #b45309;
}

.sentiment-badge.detractor {
    background: #fee2e2;
    color: #dc2626;
}

.invite-list-card,
.respondent-list-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
}

.respondent-table-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.respondent-pagination-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 13px;
    color: var(--color-text-muted);
}

.respondent-table-wrapper {
    overflow-x: auto;
    max-height: calc(100vh - 320px);
    overflow-y: auto;
}

.respondent-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    table-layout: auto;
}

.respondent-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.respondent-table th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--color-text-muted);
    background: var(--color-bg);
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
    user-select: none;
}

.respondent-table th.sortable {
    cursor: pointer;
    transition: background 0.15s;
}

.respondent-table th.sortable:hover {
    background: #e5e7eb;
}

.respondent-table th.active-sort {
    color: var(--color-accent);
    background: #e5e7eb;
}

.respondent-table th .sort-icon {
    margin-left: 4px;
    font-size: 11px;
    opacity: 0.6;
}

.respondent-table th.active-sort .sort-icon {
    opacity: 1;
}

.respondent-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}

.respondent-table .even-row {
    background: var(--color-surface);
}

.respondent-table .odd-row {
    background: var(--color-bg);
}

.respondent-table tr:hover td {
    background: rgba(0, 102, 204, 0.06);
}

.respondent-table .clickable-row {
    cursor: pointer;
}

.respondent-table .no-data {
    text-align: center;
    padding: 40px;
    color: var(--color-text-muted);
    font-style: italic;
}

.respondent-table .col-vin {
    min-width: 170px;
}

.survey-response-table {
    overflow-x: auto;
    max-height: calc(100vh - 320px);
}

.survey-response-table .respondent-table {
    table-layout: auto;
    min-width: 2200px;
}

.survey-response-table .respondent-table th,
.survey-response-table .respondent-table td {
    min-width: 90px;
    padding: 10px 12px;
    white-space: nowrap;
}

.survey-response-table .col-fixed {
    position: sticky;
    left: 0;
    background: var(--color-surface);
    z-index: 5;
    min-width: 120px;
}

.survey-response-table thead th.col-fixed {
    background: var(--color-bg);
    z-index: 15;
}

.survey-response-table .response-col {
    min-width: 50px;
    max-width: 80px;
    text-align: center;
    font-size: 11px;
    padding: 12px 6px;
}

.survey-response-table .response-cell {
    text-align: center;
    font-size: 12px;
    padding: 8px 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
}

.respondent-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md);
    border-top: 1px solid var(--color-border);
    background: var(--color-bg);
}

.pagination-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.pagination-left label {
    font-size: 13px;
    color: var(--color-text-muted);
}

.pagination-left .filter-select-sm {
    width: auto;
    min-width: 70px;
    height: 32px;
    padding: 4px 8px;
}

.pagination-center {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.pagination-right {
    display: flex;
    align-items: center;
    font-size: 13px;
    color: var(--color-text-muted);
}

.toolbar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
    flex-wrap: wrap;
    gap: var(--spacing-sm);
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    height: 36px;
}

.search-box i {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    pointer-events: none;
}

.search-box input {
    padding: 8px 12px 8px 32px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    height: 36px;
    box-sizing: border-box;
    font-size: 13px;
    width: 280px;
    background: var(--color-bg);
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-accent);
}

.toolbar-row .filter-group,
.toolbar-left .filter-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    height: 36px;
    margin: 0;
    margin-bottom: 0;
}

.toolbar-row .filter-group label,
.toolbar-left .filter-group label {
    display: inline-flex;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    line-height: 36px;
    height: 36px;
    margin: 0;
    margin-bottom: 0;
}

.toolbar-row .filter-select,
.toolbar-left .filter-select {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background: var(--color-bg);
    min-width: 140px;
    height: 36px;
    box-sizing: border-box;
}

.toolbar-row input[type="date"],
.toolbar-left input[type="date"] {
    height: 36px;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background: var(--color-bg);
    box-sizing: border-box;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    height: 36px;
}

.filter-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    line-height: 36px;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background: var(--color-bg);
    min-width: 140px;
    height: 36px;
    box-sizing: border-box;
}

.date-input {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background: var(--color-bg);
    height: 36px;
    box-sizing: border-box;
}

.date-separator {
    color: var(--color-text-muted);
    font-size: 13px;
    line-height: 36px;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 14px;
    height: 36px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-sizing: border-box;
}

.btn-secondary:hover {
    background: var(--color-bg);
    border-color: var(--color-accent);
}


.vin-cell {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    letter-spacing: -0.5px;
}

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-received {
    background: #e0f2fe;
    color: #0369a1;
}

.status-delivered {
    background: #dbeafe;
    color: #1e40af;
}

.status-reminder {
    background: #fef3c7;
    color: #b45309;
}

.status-started {
    background: #f3e8ff;
    color: #7c3aed;
}

.status-completed {
    background: #dcfce7;
    color: #15803d;
}

.status-failed {
    background: #fee2e2;
    color: #dc2626;
}

.status-new {
    background: #e0f2fe;
    color: #0369a1;
}

.status-escalated {
    background: #fef3c7;
    color: #b45309;
}

.status-overdue {
    background: #fee2e2;
    color: #dc2626;
}

.status-closed {
    background: #dcfce7;
    color: #15803d;
}

.details-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s 0.3s, opacity 0.3s;
}

.details-drawer.open {
    visibility: visible;
    opacity: 1;
    transition: visibility 0s, opacity 0.3s;
}

.drawer-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.4);
}

.drawer-content {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    max-width: 90vw;
    background: var(--color-surface);
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.details-drawer.open .drawer-content {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    border-bottom: 1px solid var(--color-border);
}

.drawer-header h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.drawer-close {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    color: var(--color-text-muted);
    font-size: 18px;
}

.drawer-close:hover {
    color: var(--color-text);
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
}

.details-section {
    margin-bottom: var(--spacing-lg);
}

.details-section h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin: 0 0 var(--spacing-md) 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border-light);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    font-size: 13px;
    color: var(--color-text-muted);
}

.detail-value {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
}

.detail-value.vin-value {
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-border);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--spacing-md);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -20px;
    top: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-surface);
    border: 2px solid var(--color-border);
}

.timeline-item.completed .timeline-marker {
    background: #16a34a;
    border-color: #16a34a;
}

.timeline-item.pending .timeline-marker {
    background: var(--color-bg);
    border-color: var(--color-border);
}

.timeline-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.timeline-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
}

.timeline-date {
    font-size: 12px;
    color: var(--color-text-muted);
}

.timeline-item.pending .timeline-label,
.timeline-item.pending .timeline-date {
    color: var(--color-text-light);
}

@media (max-width: 900px) {
    .toolbar-left {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    
    .search-box input {
        width: 100%;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filter-select {
        flex: 1;
    }
}

.trend-table-container,
.ranking-table-container {
    overflow-x: auto;
}

.trend-table-container .frozen-col,
.ranking-table-container .frozen-col {
    position: sticky;
    left: 0;
    background: #fff;
    z-index: 1;
    border-right: 2px solid #dee2e6;
}

.trend-table-container thead .frozen-col,
.ranking-table-container thead .frozen-col {
    background: #f8f9fa;
}

.trend-table-container .even-row .frozen-col {
    background: #fff;
}

.trend-table-container .odd-row .frozen-col {
    background: #f8f9fa;
}

.ranking-table-container .even-row .frozen-col {
    background: #fff;
}

.ranking-table-container .odd-row .frozen-col {
    background: #f8f9fa;
}

.expand-toggle {
    cursor: pointer;
    display: inline-block;
}

.expand-toggle:hover {
    color: #0d6efd;
}

.level-national td:first-child {
    font-weight: 600;
}

.level-region td:first-child {
    font-weight: 500;
}

.level-district td:first-child {
    font-weight: 500;
    font-style: italic;
}

.level-dealer td:first-child {
    font-weight: normal;
}

.alert-list-layout {
    display: flex;
    gap: 20px;
    height: calc(100vh - 160px);
}

.alert-list-main {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.alert-list-main .respondent-list-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.alert-list-main .respondent-table-wrapper {
    flex: 1;
    overflow-y: auto;
    max-height: none;
}

.alert-detail-panel {
    width: 380px;
    min-width: 380px;
    background: var(--color-surface);
    border-radius: 8px;
    border: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    padding: 40px;
    text-align: center;
}

.panel-placeholder i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.panel-placeholder p {
    font-size: 14px;
    margin: 0;
}

.panel-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-bg);
}

.panel-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
}

.panel-subtitle {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 4px;
}

.panel-close-btn {
    background: none;
    border: none;
    font-size: 18px;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
}

.panel-close-btn:hover {
    color: var(--color-text);
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.panel-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.panel-info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.panel-info-item .info-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-muted);
}

.panel-info-item .info-value {
    font-size: 13px;
    color: var(--color-text);
}

.panel-info-item .vin-value {
    font-family: monospace;
    font-size: 11px;
    word-break: break-all;
}

.panel-section {
    margin-bottom: 24px;
}

.panel-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    margin: 0 0 12px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}

.section-header-row h4 {
    margin: 0;
    padding: 0;
    border: none;
}

.btn-link {
    background: none;
    border: none;
    color: var(--color-accent);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
}

.btn-link:hover {
    text-decoration: underline;
}

.interview-detail {
    margin-bottom: 16px;
}

.interview-detail .detail-question {
    display: block;
    font-size: 12px;
    color: var(--color-text-muted);
    margin-bottom: 4px;
}

.interview-detail .detail-answer {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.interview-detail .detail-answer span:first-child {
    font-size: 13px;
    color: var(--color-text);
}

.rating-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rating-value {
    font-size: 13px;
    color: var(--color-text-muted);
}

.detail-comment {
    font-size: 13px;
    color: var(--color-text);
    margin: 0;
    line-height: 1.5;
    font-style: italic;
}

.history-timeline {
    display: flex;
    flex-direction: column;
}

.history-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.history-item:last-child {
    border-bottom: none;
}

.history-marker {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-accent);
    margin-top: 4px;
    flex-shrink: 0;
}

.history-content {
    flex: 1;
}

.history-date {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-bottom: 2px;
}

.history-action {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text);
}

.history-by {
    font-size: 12px;
    color: var(--color-text-muted);
}

.panel-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.panel-actions .btn-primary,
.panel-actions .btn-secondary {
    flex: 1;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
}

.panel-actions .btn-primary {
    background: var(--color-accent);
    color: white;
}

.panel-actions .btn-primary:hover {
    background: #0052a3;
}

.panel-actions .btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}

.panel-actions .btn-secondary:hover {
    background: var(--color-bg);
}

.panel-actions .dropdown-container {
    position: relative;
    flex: 1;
}

.panel-actions .dropdown-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.panel-actions .dropdown-toggle i.bi-chevron-down {
    font-size: 10px;
    transition: transform 0.2s;
}

.panel-actions .dropdown-toggle.open i.bi-chevron-down {
    transform: rotate(180deg);
}

.panel-actions .dropdown-menu {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
    z-index: 100;
    margin-bottom: 4px;
}

.panel-actions .dropdown-menu.show {
    display: block;
}

.panel-actions .dropdown-header {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--color-border);
}

.panel-actions .dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: none;
    text-align: left;
    font-size: 13px;
    color: var(--color-text);
    cursor: pointer;
    transition: background 0.15s;
}

.panel-actions .dropdown-item:hover {
    background: var(--color-bg);
}

.panel-actions .dropdown-item i {
    color: var(--color-text-muted);
    font-size: 14px;
}

.panel-actions .personnel-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.panel-actions .personnel-name {
    font-weight: 500;
}

.panel-actions .personnel-role {
    font-size: 11px;
    color: var(--color-text-muted);
}

.panel-actions .reassign-menu {
    max-height: 240px;
    overflow-y: auto;
}

.action-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
}

.action-modal-content {
    position: relative;
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.action-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border);
}

.action-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-modal-header h3 i {
    color: var(--color-accent);
}

.action-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--color-text-muted);
    line-height: 1;
}

.action-modal-close:hover {
    color: var(--color-text);
}

.action-modal-body {
    padding: 20px;
}

.action-modal-body p {
    margin: 0 0 16px;
}

.action-modal-body .form-group {
    margin-bottom: 16px;
}

.action-modal-body .form-group:last-child {
    margin-bottom: 0;
}

.action-modal-body label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
}

.action-modal-body textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
}

.action-modal-body textarea:focus {
    outline: none;
    border-color: var(--color-accent);
}

.contact-method-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.contact-method-options .radio-option {
    display: grid;
    grid-template-columns: 24px 24px 70px 1fr;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.contact-method-options .radio-option input[type="radio"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.contact-method-options .radio-option:hover {
    background: var(--color-bg);
}

.contact-method-options .radio-option:has(input:checked) {
    border-color: var(--color-accent);
    background: rgba(0, 102, 204, 0.05);
}

.contact-method-options .radio-option i {
    color: var(--color-accent);
    font-size: 16px;
}

.contact-method-detail {
    color: #666;
    font-size: 12px;
    text-align: right;
}

.action-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--color-border);
}

.action-modal-footer .btn-primary,
.action-modal-footer .btn-secondary {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
}

.action-modal-footer .btn-primary {
    background: var(--color-accent);
    color: white;
}

.action-modal-footer .btn-primary:hover {
    background: #0052a3;
}

.action-modal-footer .btn-secondary {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-border);
}

.action-modal-footer .btn-secondary:hover {
    background: var(--color-bg);
}

.escalation-warning {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 16px;
    padding: 12px;
    background: #fef3c7;
    border-radius: 6px;
    font-size: 12px;
    color: #92400e;
}

.escalation-warning i {
    font-size: 16px;
    flex-shrink: 0;
}

.selected-row td {
    background: rgba(0, 102, 204, 0.1) !important;
}

.dealer-cell {
    line-height: 1.3;
}

.dealer-cell small {
    color: var(--color-text-muted);
    font-size: 11px;
}

.rating-stars {
    display: inline-flex;
    gap: 2px;
}

.rating-star {
    color: #f59e0b;
    font-size: 12px;
}

.rating-star-empty {
    color: #d1d5db;
    font-size: 12px;
}

.status-badge.status-overdue-sub {
    background: #fef2f2;
    color: #dc2626;
    margin-left: 4px;
}

.action-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1f2937;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 10000;
    opacity: 0;
    transition: transform 0.3s, opacity 0.3s;
}

.action-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.action-toast i {
    color: #22c55e;
}
