/* Node Details Panel */
.node-details {
    padding: 0;
}

.node-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    background: var(--gray-50);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-lg);
}

.node-icon-large {
    position: relative;
    font-size: 2rem;
}

.node-info h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--spacing-xs);
}

.node-type {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--spacing-xs);
}

.node-status {
    font-size: 0.875rem;
    font-weight: 500;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
}

.node-status.status-online {
    background: #f0fff4;
    color: var(--success-color);
}

.node-status.status-neutral {
    background: #f8fafc;
    color: #64748b;
}

.node-status.status-offline {
    background: #fff5f5;
    color: var(--error-color);
}

.node-properties {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.property {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background: var(--gray-50);
    border-radius: var(--radius-md);
}

.property label {
    font-weight: 500;
    color: var(--gray-700);
    font-size: 0.875rem;
}

.property span {
    color: var(--gray-900);
    font-size: 0.875rem;
}

.property .status-online {
    color: var(--success-color);
    font-weight: 500;
}

.property .status-neutral {
    color: #64748b;
    font-weight: 500;
}

.property .status-offline {
    color: var(--error-color);
    font-weight: 500;
}

.node-path {
    border-top: 1px solid var(--gray-200);
    padding-top: var(--spacing-lg);
}

.node-path label {
    font-weight: 500;
    color: var(--gray-700);
    font-size: 0.875rem;
    margin-bottom: var(--spacing-md);
    display: block;
}

.path-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    align-items: center;
}

.path-item {
    background: var(--gray-100);
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--gray-700);
}

/* Breadcrumb */
.topology-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
    color: var(--gray-500);
}

.breadcrumb-item {
    color: var(--gray-500);
}

.breadcrumb-item.active {
    color: var(--gray-900);
    font-weight: 500;
}

/* Details Panel */
/* Legacy note: details panel styles consolidated here from the former minimalist-details.css */

.details-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--gray-200);
    background: var(--sidebar-bg);
}

.details-title-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--spacing-xs);
}

.details-subtitle {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.details-type {
    background: var(--primary-color);
    color: white;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
}

.details-status {
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
}

.details-status.status-online {
    background: #f0fff4;
    color: var(--success-color);
}

.details-status.status-neutral {
    background: #f8fafc;
    color: #475569;
}

.details-status.status-offline {
    background: #fff5f5;
    color: var(--error-color);
}

/* Details Tabs */
.details-tabs {
    display: flex;
    border-bottom: 1px solid var(--gray-200);
    background: var(--white);
}

.details-tab {
    flex: 1;
    padding: var(--spacing-md);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-600);
    border-bottom: 2px solid transparent;
    transition: var(--transition-fast);
}

.details-tab:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.details-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: var(--white);
}

/* Details Content */
.details-content {
    flex: 1;
    overflow-y: auto;
}

.details-tab-content {
    display: none;
    padding: var(--spacing-lg);
}

.details-tab-content.active {
    display: block;
}

.details-loading {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    color: var(--gray-500);
    justify-content: center;
    padding: var(--spacing-2xl);
}

/* Node Details Styling */
.node-summary-card {
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.summary-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.summary-icon {
    position: relative;
    font-size: 2rem;
}

.summary-info h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--spacing-xs);
}

.summary-meta {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.node-type-badge {
    background: var(--gray-200);
    color: var(--gray-700);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
}

.node-status-badge {
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
}

/* Properties Grid */
.node-properties-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.property-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
}

.property-item label {
    font-weight: 500;
    color: var(--gray-700);
    font-size: 0.875rem;
}

.property-value {
    color: var(--gray-900);
    font-size: 0.875rem;
}

.status-badge {
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
}

/* Children Summary */
.children-summary {
    margin-bottom: var(--spacing-lg);
}

.children-summary h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--spacing-md);
}

.children-grid {
    display: grid;
    gap: var(--spacing-md);
}

.child-type-summary {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

.child-type-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}


.child-type-name {
    font-weight: 500;
    color: var(--gray-900);
    font-size: 0.875rem;
}

.child-type-stats {
    display: flex;
    gap: var(--spacing-md);
}

.child-stat {
    font-size: 0.75rem;
    color: var(--gray-600);
}

.child-stat.online {
    color: var(--success-color);
}

.child-stat.offline {
    color: var(--error-color);
}

/* Network Path */
.node-network-path h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--spacing-md);
}

.path-breadcrumb-detailed {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.path-item-detailed {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
}

.path-item-detailed.current {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.path-item-icon {
    position: relative;
}

.path-item-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.path-item-name {
    font-weight: 500;
    font-size: 0.875rem;
}

.path-item-type {
    font-size: 0.75rem;
    opacity: 0.7;
    text-transform: uppercase;
}

.path-separator {
    color: var(--gray-400);
    font-weight: bold;
}

/* Technical Details */
.technical-details {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.technical-section h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--spacing-md);
}

.technical-grid {
    display: grid;
    gap: var(--spacing-md);
}

.tech-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background: var(--gray-50);
    border-radius: var(--radius-md);
}

.config-info {
    background: var(--gray-50);
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
}

.config-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-sm);
}

.config-item:last-child {
    margin-bottom: 0;
}

/* History Details */
.history-details {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
}

.history-section h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: var(--spacing-md);
}

.history-timeline {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.history-event {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    background: var(--gray-50);
    border-radius: var(--radius-md);
}

.event-time {
    font-size: 0.75rem;
    color: var(--gray-500);
    min-width: 120px;
}

.event-status {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex: 1;
}

.event-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-400);
}

.event-status.online .event-indicator {
    background: var(--success-color);
}

.event-status.offline .event-indicator {
    background: var(--error-color);
}

.event-text {
    font-size: 0.875rem;
    color: var(--gray-700);
}

.metrics-grid {
    display: grid;
    gap: var(--spacing-md);
}

.metric-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    background: var(--gray-50);
    border-radius: var(--radius-md);
}

.metric-value {
    font-weight: 500;
}

.metric-value.online {
    color: var(--success-color);
}

.metric-value.offline {
    color: var(--error-color);
}

/* Details Footer */
.details-footer {
    border-top: 1px solid var(--gray-200);
    padding: var(--spacing-lg);
    background: #f5f5f7;
}

html[data-theme="dark"] .details-footer {
    background: #2c2c2e;
    border-top-color: #3a3a3c;
}

.details-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.details-timestamp {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-align: center;
}

/* Minimalist Details Panel - Flex Layout (like sidebar) */
.details-panel {
    flex: 0 0 auto;
    background: var(--white);
    border-left: 1px solid var(--gray-200);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;

    /* Hidden by default - shrink to 0 width */
    flex-basis: 0;
    min-width: 0;
    opacity: 0;
    transition: flex-basis var(--transition-normal), opacity var(--transition-normal), min-width var(--transition-normal);
}

.details-panel:not(.hidden) {
    flex-basis: clamp(var(--details-panel-min-width), var(--details-panel-width), var(--details-panel-max-width));
    min-width: clamp(var(--details-panel-min-width), var(--details-panel-width), var(--details-panel-max-width));
    max-width: var(--details-panel-max-width);
    opacity: 1;
}

/* Minimalist Header with Breadcrumb */
.details-header {
    padding: 0 var(--spacing-lg);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--sidebar-bg);
    flex-shrink: 0;
    min-height: var(--pane-header-height);
}

.details-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-top: 4px;  /* Base nudge for general usage */
}

/* Fine-tune only the CTO details header action buttons positioning */
.details-header .details-actions {
    margin-top: 2px;   /* Tiny nudge up for centering */
    margin-bottom: 0;  /* Neutralize global bottom margin to fit header height */
}

.details-action-btn,
.details-close {
    border: 1px solid var(--gray-300);
    background: var(--white);
    color: var(--gray-600);
    width: var(--details-action-size);
    height: var(--details-action-size);
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    cursor: pointer;
}

/* Match the folder color with topology expand button */
.details-action-btn {
    color: var(--gray-700);
}

/* Ensure the collapse button is properly centered in the header */
#details-collapse-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    width: var(--details-action-size);
    height: var(--details-action-size);
    padding: 0;
}

.details-action-btn img {
    width: var(--details-action-icon-size);
    height: var(--details-action-icon-size);
    display: block;
}

.details-action-btn:hover,
.details-close:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-800);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.details-action-btn.active {
    border-color: var(--gray-400);
    color: var(--gray-900);
}

.details-close {
    font-size: var(--details-close-font-size);
    line-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* Dark mode for details panel buttons */
html[data-theme="dark"] .details-action-btn,
html[data-theme="dark"] .details-close {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
    box-shadow: none;
}

html[data-theme="dark"] .details-action-btn:hover,
html[data-theme="dark"] .details-close:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.95);
}

html[data-theme="dark"] .details-action-btn.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.details-breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.875rem;
    color: var(--gray-600);
    flex: 1;
}

.breadcrumb-label {
    font-weight: 600;
    color: var(--gray-700);
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.breadcrumb-separator {
    color: var(--gray-400);
    font-size: 0.75rem;
}


/* Details Content */
.details-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.details-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-2xl);
    color: var(--gray-500);
    gap: var(--spacing-md);
}

/* Spinner definitions moved to animations.css to avoid duplication */

/* CTO Cards Container */
.cto-table-container {
    height: 100%;
    overflow-y: auto;
}

.card-mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0;
    padding: 2px;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 6px;
    flex-shrink: 0;
}

.power-tab-actions {
    display: none;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    flex-shrink: 0;
}

.power-tab-actions.is-visible {
    display: inline-flex;
}

/* Elegant tabs when inside card content - Compact & Beautiful */
.cto-mode-toggle-inside .details-tab-btn {
    padding: var(--cto-mode-tab-padding);
    font-size: var(--cto-mode-tab-font-size);
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.005em;
    background: rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

.cto-mode-toggle-inside .details-tab-btn:hover:not(.is-active) {
    background: rgba(241, 245, 249, 0.7);
    border-color: rgba(148, 163, 184, 0.25);
    transform: translateY(-0.5px);
}

.cto-mode-toggle-inside .details-tab-btn.is-active {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(59, 130, 246, 0.55);
    box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.85);
    transform: none;
}

.details-tab-btn {
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 3px 10px;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--gray-600);
    background: transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.details-tab-btn:hover:not(.is-active) {
    color: var(--gray-800);
    background: rgba(241, 245, 249, 0.7);
    border-color: rgba(148, 163, 184, 0.25);
}

.details-tab-btn.is-active {
    color: var(--gray-900);
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(59, 130, 246, 0.55);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(29, 78, 216, 0.15);
}

html[data-theme="dark"] .card-mode-toggle {
    background: rgba(255, 255, 255, 0.06);
}

html[data-theme="dark"] .cto-mode-toggle-inside {
    background: transparent;
}

html[data-theme="dark"] .cto-mode-toggle-inside .details-tab-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.25);
}

html[data-theme="dark"] .cto-mode-toggle-inside .details-tab-btn:hover:not(.is-active) {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.16);
}

html[data-theme="dark"] .cto-mode-toggle-inside .details-tab-btn.is-active {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(191, 219, 254, 0.9);
    box-shadow: 0 0 0 2px rgba(191, 219, 254, 0.9);
}

html[data-theme="dark"] .details-tab-btn {
    color: rgba(235, 235, 245, 0.6);
    border-color: transparent;
}

html[data-theme="dark"] .details-tab-btn:hover:not(.is-active) {
    color: rgba(235, 235, 245, 0.9);
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.18);
}

html[data-theme="dark"] .details-tab-btn.is-active {
    color: rgba(255, 255, 255, 0.95);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(191, 219, 254, 0.9);
    box-shadow: 0 0 0 2px rgba(191, 219, 254, 0.9);
}

.cto-cards-container {
    padding: var(--spacing-lg);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    background: transparent;
}

/* Slightly reduce card max width inside CTO sidebar for better layout */
.details-panel .cto-cards-container {
    max-width: 680px;
    margin: 0 auto;
}

html[data-theme="dark"] .cto-cards-container {
    background: transparent;
}

.cto-empty {
    padding: var(--spacing-lg);
    text-align: center;
    color: var(--gray-600);
    font-size: 0.9rem;
}

.details-empty {
    padding: var(--spacing-lg);
    text-align: center;
    color: var(--gray-600);
    font-size: 0.9rem;
}

/* CTO Card Styles - Clean, No Artifacts */
.cto-card {
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.96) 0%, rgba(241, 245, 249, 0.94) 100%);
    border: 1px solid rgba(148, 163, 184, 0.26);
    border-radius: var(--radius-lg);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
    margin: 0;
}

/* Preserve the previous height baseline only when the card is expanded */
.cto-card.expanded {
    min-height: 68px;
}

/* Give collapsed cards breathing room and a subtle floating effect */
.cto-card:not(.expanded) {
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.cto-card.cto-card-updated {
    animation: cto-card-glow 1.2s ease;
}

@keyframes cto-card-glow {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.28); border-color: rgba(59, 130, 246, 0.35); }
    100% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); border-color: var(--gray-200); }
}

html[data-theme="dark"] .cto-card.cto-card-updated {
    animation: cto-card-glow-dark 1.2s ease;
}

@keyframes cto-card-glow-dark {
    0% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.45); border-color: rgba(96, 165, 250, 0.55); }
    100% { box-shadow: 0 18px 32px rgba(8, 11, 18, 0.55); border-color: rgba(51, 65, 85, 0.6); }
}

.cto-card:hover {
    border-color: rgba(59, 130, 246, 0.26);
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.1);
    transform: translateY(-1px);
}

.cto-card-header {
    padding: var(--cto-card-header-padding);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: var(--cto-card-header-gap);
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
    min-height: var(--cto-card-header-min-height);
    flex-shrink: 0;
    position: relative;
    background: transparent;
    border: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background-clip: padding-box;
}

.cto-path-header {
    width: 100%;
    text-align: center;
    color: var(--gray-600);
    font-size: 0.8rem;
    line-height: 1.2;
    margin: 0 0 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cto-card-header[role="button"] {
    cursor: pointer;
}

.cto-card-header[role="button"]:hover {
    background: rgba(255, 255, 255, 0.3);
}

.cto-card-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-sm);
    flex: 1;
    width: 100%;
    position: relative;
}

.cto-main-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    flex-shrink: 0;
}

.cto-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cto-subtitle {
    font-size: 0.75rem;
    color: var(--gray-500);
}


.cto-header-metrics {
    width: 100%;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.client-count {
    font-size: var(--client-count-font-size);
    color: var(--gray-500);
    font-weight: 500;
    letter-spacing: -0.01em;
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}

.card-mode-toggle {
    margin-left: auto;
}

/* When tabs are inside the card content - Just the buttons, no bar */
.cto-mode-toggle-inside {
    margin: var(--cto-mode-toggle-margin);
    padding: var(--cto-mode-toggle-padding);
    display: flex;
    align-items: center;
    flex-wrap: var(--cto-mode-toggle-wrap);
    justify-content: flex-start;
    background: transparent;
    border-bottom: none;
    border-radius: var(--cto-mode-toggle-radius);
    width: 100%;
    gap: var(--cto-mode-toggle-gap);
    min-height: var(--cto-mode-toggle-min-height);
    height: var(--cto-mode-toggle-height);
}

.cto-card:not(.expanded) .card-mode-toggle {
    pointer-events: auto;
    opacity: 0.8;
}

.cto-card:not(.expanded) .card-mode-toggle:hover {
    opacity: 1;
}

/* CTO Card Content (expandable) */
.cto-card-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.2s ease-out;
    background: var(--white);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    opacity: 0;
    display: none;
}

.cto-card-content.expanded {
    max-height: 2000px;
    opacity: 1;
    border-top: 1px solid rgba(148, 163, 184, 0.22);
    display: block;
}

.cto-card-content .client-table-container {
    padding: var(--cto-card-content-padding);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    background: var(--white);
}

/* Ensure tabs container doesn't add unnecessary padding */
.cto-card-content .cto-mode-toggle-inside {
    margin: 0;
}

.cto-expand-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--gray-500);
    transition: color var(--transition-fast);
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cto-expand-btn:hover {
    color: var(--gray-700);
}


.cto-expand-btn .expand-icon {
    font-size: 0.8rem;
}

/* Status and Reason Pills - Rounded & Tight Design */
.status-pill,
.reason-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: -0.005em;
    white-space: nowrap;
    min-width: fit-content;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.status-pill::before,
.reason-pill::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* Status Colors */
.status-pill.online {
    background: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.status-pill.offline {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.status-pill.neutral {
    background: rgba(148, 163, 184, 0.15);
    color: #64748b;
}

.status-pill.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

/* Reason Colors */
.reason-pill.reason-link-loss {
    background: rgba(249, 115, 22, 0.15);
    color: #ea580c;
}

.reason-pill.reason-dying-gasp {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.reason-pill.reason-unknown {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.reason-pill.reason-none {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

/* Dark Mode */
html[data-theme="dark"] .status-pill.online {
    background: rgba(34, 197, 94, 0.25);
    color: #4ade80;
}

html[data-theme="dark"] .status-pill.offline {
    background: rgba(239, 68, 68, 0.25);
    color: #f87171;
}

html[data-theme="dark"] .status-pill.neutral {
    background: rgba(148, 163, 184, 0.25);
    color: #cbd5e1;
}

html[data-theme="dark"] .status-pill.warning {
    background: rgba(245, 158, 11, 0.25);
    color: #fbbf24;
}

html[data-theme="dark"] .reason-pill.reason-link-loss {
    background: rgba(249, 115, 22, 0.25);
    color: #fb923c;
}

html[data-theme="dark"] .reason-pill.reason-dying-gasp {
    background: rgba(59, 130, 246, 0.25);
    color: #60a5fa;
}

html[data-theme="dark"] .reason-pill.reason-unknown {
    background: rgba(168, 85, 247, 0.25);
    color: #c084fc;
}

html[data-theme="dark"] .reason-pill.reason-none {
    background: rgba(148, 163, 184, 0.25);
    color: #cbd5e1;
}

.reason-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

@keyframes inline-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

@keyframes reason-spinner {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.reason-status {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 6px;
    margin-left: 6px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.24);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.reason-status::after {
    content: '';
    position: absolute;
    inset: 0;
}

.reason-status.is-loading {
    opacity: 1;
}

.reason-status.is-loading::after {
    background: linear-gradient(90deg, rgba(148, 163, 184, 0) 0%, rgba(148, 163, 184, 0.55) 50%, rgba(148, 163, 184, 0) 100%);
    animation: inline-shimmer 1.1s linear infinite;
}

.reason-status.is-error {
    opacity: 1;
    background: rgba(248, 113, 113, 0.24);
}

.reason-status.is-error::after {
    content: '!';
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--error-color);
    animation: none;
}

html[data-theme="dark"] .reason-status {
    background: rgba(71, 85, 105, 0.45);
}

html[data-theme="dark"] .reason-status.is-loading::after {
    background: linear-gradient(90deg, rgba(148, 163, 184, 0) 0%, rgba(148, 163, 184, 0.75) 50%, rgba(148, 163, 184, 0) 100%);
}

html[data-theme="dark"] .reason-status.is-error {
    background: rgba(248, 113, 113, 0.32);
}

html[data-theme="dark"] .reason-status.is-error::after {
    color: #fca5a5;
}

.reason-inline-loader {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 10px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.18);
    overflow: hidden;
    vertical-align: middle;
}

.reason-inline-loader::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(148, 163, 184, 0) 0%, rgba(148, 163, 184, 0.55) 50%, rgba(148, 163, 184, 0) 100%);
    transform: translateX(-100%);
    animation: inline-shimmer 1.1s linear infinite;
}

.reason-missing {
    color: rgba(100, 116, 139, 0.75);
    font-style: italic;
}

html[data-theme="dark"] .reason-inline-loader {
    background: rgba(71, 85, 105, 0.35);
}

html[data-theme="dark"] .reason-inline-loader::after {
    background: linear-gradient(90deg, rgba(148, 163, 184, 0) 0%, rgba(148, 163, 184, 0.85) 50%, rgba(148, 163, 184, 0) 100%);
}

html[data-theme="dark"] .reason-missing {
    color: rgba(203, 213, 225, 0.7);
}

html[data-theme="dark"] .client-ip {
    color: rgba(199, 199, 204, 0.82);
}

html[data-theme="dark"] .client-ip.ip-blocked {
    color: #fb923c;
}

html[data-theme="dark"] .client-ip.ip-public {
    color: #6ee7b7;
}

html[data-theme="dark"] .identity-token.identity-login {
    color: rgba(255, 255, 255, 0.92);
}

html[data-theme="dark"] .identity-token.identity-serial {
    color: rgba(174, 174, 178, 0.8);
}

html[data-theme="dark"] .identity-token.identity-ip:not(.ip-blocked):not(.ip-public) {
    color: rgba(199, 199, 204, 0.82);
}

html[data-theme="dark"] .identity-token.identity-placeholder {
    color: rgba(142, 142, 147, 0.65);
}

/* Light theme explicit overrides for IP coloring */
/* These ensure consistent behavior and proper specificity matching dark theme */
html[data-theme="light"] .client-ip.ip-blocked {
    color: #d97706 !important;  /* Orange for blocked IPs (192.x) */
}

html[data-theme="light"] .client-ip.ip-public {
    color: #15803d !important;  /* Green for public/valid IPs */
}


.cto-name {
    font-weight: 600;
    color: var(--gray-900);
    white-space: nowrap;
    font-size: var(--cto-name-font-size);
    letter-spacing: 0.01em;
}


/* Status color coding for CTO cards - Clean, Solid Colors */
.cto-card.status-online {
    border-color: rgba(34, 197, 94, 0.32);
}

.cto-card.status-online .cto-card-header {
    background: rgba(34, 197, 94, 0.12);
}

.cto-card.status-warning {
    border-color: rgba(250, 204, 21, 0.32);
}

.cto-card.status-warning .cto-card-header {
    background: rgba(250, 204, 21, 0.15);
}

.cto-card.status-neutral {
    border-color: rgba(148, 163, 184, 0.3);
}

.cto-card.status-neutral .cto-card-header {
    background: rgba(226, 232, 240, 0.2);
}

.cto-card.status-offline {
    border-color: rgba(239, 68, 68, 0.36);
}

.cto-card.status-offline .cto-card-header {
    background: rgba(248, 113, 113, 0.18);
}

.cto-card.status-offline .cto-name,
.cto-card.status-warning .cto-name,
.cto-card.status-neutral .cto-name,
.cto-card.status-online .cto-name {
    color: var(--gray-900);
}

html[data-theme="dark"] .cto-card {
    background: rgba(28, 28, 30, 0.92);
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.55);
}

html[data-theme="dark"] .cto-card:not(.expanded) {
    box-shadow: 0 20px 42px rgba(0, 0, 0, 0.65);
}

html[data-theme="dark"] .cto-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.6);
}

html[data-theme="dark"] .cto-card .cto-card-header {
    background: rgba(58, 58, 60, 0.45);
    color: #f5f5f7;
}

html[data-theme="dark"] .cto-card .cto-subtitle,
html[data-theme="dark"] .cto-card .client-count {
    color: rgba(174, 174, 178, 0.9);
}

html[data-theme="dark"] .cto-card.status-online {
    border-color: rgba(48, 209, 88, 0.85);
    box-shadow: 0 0 0 2px rgba(48, 209, 88, 0.45), 0 18px 40px rgba(48, 209, 88, 0.28);
}

html[data-theme="dark"] .cto-card.status-online .cto-card-header {
    background: linear-gradient(135deg, rgba(48, 209, 88, 0.45) 0%, rgba(48, 209, 88, 0.16) 100%);
    color: #f5fff5;
}

html[data-theme="dark"] .cto-card.status-warning {
    border-color: rgba(255, 214, 10, 0.75);
    box-shadow: 0 0 0 2px rgba(255, 214, 10, 0.4), 0 18px 40px rgba(255, 214, 10, 0.26);
}

html[data-theme="dark"] .cto-card.status-warning .cto-card-header {
    background: linear-gradient(135deg, rgba(255, 214, 10, 0.45) 0%, rgba(255, 214, 10, 0.18) 100%);
    color: #1f1600;
}

html[data-theme="dark"] .cto-card.status-neutral {
    border-color: rgba(142, 142, 147, 0.65);
    box-shadow: 0 0 0 2px rgba(142, 142, 147, 0.35), 0 18px 40px rgba(142, 142, 147, 0.25);
}

html[data-theme="dark"] .cto-card.status-neutral .cto-card-header {
    background: linear-gradient(135deg, rgba(142, 142, 147, 0.45) 0%, rgba(142, 142, 147, 0.16) 100%);
    color: #f2f2f7;
}

html[data-theme="dark"] .cto-card.status-offline {
    border-color: rgba(255, 69, 58, 0.85);
    box-shadow: 0 0 0 2px rgba(255, 69, 58, 0.45), 0 18px 40px rgba(255, 69, 58, 0.3);
}

html[data-theme="dark"] .cto-card.status-offline .cto-card-header {
    background: linear-gradient(135deg, rgba(255, 69, 58, 0.45) 0%, rgba(255, 69, 58, 0.16) 100%);
    color: #ffeae8;
}

html[data-theme="dark"] .cto-card .cto-name {
    color: #ffffff;
}

html[data-theme="dark"] .cto-card-content {
    background: rgba(44, 44, 46, 0.92);
}

html[data-theme="dark"] .cto-card-content.expanded {
    border-top-color: rgba(255, 255, 255, 0.12);
}

html[data-theme="dark"] .client-table tbody tr:nth-child(odd) td {
    background: #1f1f22;
}

html[data-theme="dark"] .client-table tbody tr:nth-child(even) td {
    background: #26262b;
}

@media (max-width: 768px) {
    .client-table td {
        background: transparent !important;
    }
}

.restore-btn {
    width: var(--details-action-size);
    height: var(--details-action-size);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-300);
    background: var(--white);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
}

.restore-btn:hover {
    border-color: rgba(34, 197, 94, 0.35);
    background: rgba(34, 197, 94, 0.12);
    box-shadow: var(--shadow-md);
}

.restore-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: none;
}

.restore-btn .restore-icon {
    width: 22px;
    height: 22px;
    filter: invert(46%) sepia(92%) saturate(521%) hue-rotate(87deg) brightness(91%) contrast(92%);
}

.restore-btn.loading .restore-icon {
    animation: spin 1s linear infinite;
    opacity: 0.75;
}

html[data-theme="dark"] .restore-btn {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.14);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .restore-btn:hover {
    border-color: rgba(48, 209, 88, 0.6);
    background: rgba(48, 209, 88, 0.18);
    box-shadow: 0 8px 22px rgba(48, 209, 88, 0.28);
}

html[data-theme="dark"] .restore-btn .restore-icon {
    filter: drop-shadow(0 0 4px rgba(48, 209, 88, 0.45));
}

/* Client Table (within cards) */
.client-loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 32px 0;
    color: var(--gray-500);
    font-size: 0.9rem;
}

.client-loading-spinner {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid rgba(148, 163, 184, 0.45);
    border-top-color: rgba(148, 163, 184, 0.15);
    animation: reason-spinner 0.9s linear infinite;
}

html[data-theme="dark"] .client-loading-state {
    color: rgba(226, 232, 240, 0.75);
}

html[data-theme="dark"] .client-loading-spinner {
    border: 3px solid rgba(148, 163, 184, 0.35);
    border-top-color: rgba(148, 163, 184, 0.1);
}

.client-table {
    width: 100%;
    min-width: 420px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.8rem;
    margin: 0;
    background: var(--white);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.22);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(15, 23, 42, 0.06);
}

.client-table th {
    background: #f5f7fb;
    padding: var(--client-table-cell-padding);
    text-align: left;
    font-weight: 500;
    color: var(--gray-600);
    border-bottom: 1px solid rgba(148, 163, 184, 0.22);
    font-size: 0.75rem;
}

.client-table td {
    padding: var(--client-table-cell-padding);
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    background: var(--white);
}

.client-table th.identity-col,
.client-table td.identity-col {
    min-width: 140px;
    max-width: 180px;
    text-align: left;
}

.client-table th.status-col,
.client-table td.status-col {
    width: 1%;
    min-width: 110px;
    text-align: center;
    white-space: nowrap;
}

.client-table th.power-col,
.client-table td.power-col {
    min-width: 230px;
    text-align: left;
    font-variant-numeric: tabular-nums;
}

.client-table tbody tr:nth-child(odd) td {
    background: var(--white);
}

.client-table tbody tr:nth-child(even) td {
    background: #f8fafc;
}

.power-values {
    display: grid;
    gap: 4px;
    font-size: 0.75rem;
}

.power-values--diff {
    font-size: 0.72rem;
}

.power-values--empty {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.power-values--empty .power-reading--empty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    text-align: center;
}

.client-table[data-view-mode="power"] .power-values {
    align-items: center;
}

.client-table[data-view-mode="power"] .power-line {
    justify-content: flex-start;
}


.power-line {
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.2;
    white-space: nowrap; /* Prevent wrapping */
}

.power-label {
    flex: 0 0 36px;
}

/* Mobile-only power actions are hidden on desktop */
.mobile-power-actions {
    display: none;
}

.client-table th.trend-col,
.client-table td.trend-col {
    min-width: 140px;
    text-align: left;
}

.client-table th.timestamp-col,
.client-table td.timestamp-col {
    min-width: 140px;
    white-space: nowrap;
    font-size: 0.75rem;
    text-align: center;
}

.client-table th.reason-col,
.client-table td.reason-col {
    min-width: 140px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
}

.client-table th.reason-col .reason-header {
    width: 100%;
    justify-content: center;
}

.client-table td.reason-col > * {
    margin-left: auto;
    margin-right: auto;
    display: inline-flex;
    justify-content: center;
}

.client-table td.disconnect-col {
    white-space: normal;
    text-align: center;
}

.client-identity {
    display: flex;
    flex-direction: column;
    gap: 3px;
    line-height: 1.2;
    align-items: flex-start;
}

.client-identity.identity-stacked {
    width: 100%;
}

.identity-primary {
    display: flex;
    align-items: center;
    line-height: 1.3;
}

.identity-secondary {
    display: flex;
    align-items: center;
    line-height: 1.2;
}

.identity-token {
    display: inline;
    font-size: 0.8125rem;
    color: var(--gray-700);
}

.identity-token.identity-login {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-900);
}

.identity-token.identity-serial {
    font-size: 0.75rem;
    color: var(--gray-500);
    font-family: ui-monospace, 'SF Mono', 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, Consolas, monospace;
}

.identity-token.identity-ip {
    font-size: 0.75rem;
    font-family: ui-monospace, 'SF Mono', 'Cascadia Code', 'Source Code Pro', Menlo, Monaco, Consolas, monospace;
}

.identity-token.identity-placeholder {
    color: var(--gray-400);
    font-style: italic;
}

.client-login {
    font-weight: 600;
    color: var(--gray-800);
}

.client-serial,
.client-ip {
    font-size: 0.7rem;
    color: var(--gray-500);
    word-break: break-all;
}

.client-ip.ip-blocked {
    color: #d97706;
}

.client-ip.ip-public {
    color: #15803d;
}

.client-table tbody tr.client-row:hover td {
    background: var(--gray-50);
}

html[data-theme="dark"] .client-table tbody tr.client-row:hover td {
    background: #2b2b30;
}

.client-row:last-child td {
    border-bottom: none;
}

.client-table tbody tr.client-row-updated {
    animation: row-update-glow 1.2s ease;
}

@keyframes row-update-glow {
    0% { background: rgba(59, 130, 246, 0.16); }
    100% { background: inherit; }
}

html[data-theme="dark"] .power-label {
    color: rgba(174, 174, 178, 0.9);
}

html[data-theme="dark"] .power-reading {
    color: rgba(235, 235, 245, 0.8);
}

html[data-theme="dark"] .client-table tbody tr.client-row-updated {
    animation: row-update-glow-dark 1.3s ease;
}

@keyframes row-update-glow-dark {
    0% { background: rgba(96, 165, 250, 0.28); }
    100% { background: inherit; }
}

.client-table tbody tr.client-row-highlight {
    position: relative;
    z-index: 5;
    background-color: rgba(59, 130, 246, 0.05) !important;
}

.client-table tbody tr.client-row-highlight td {
    border-top: 2px solid rgba(29, 78, 216, 0.9) !important;
    border-bottom: 2px solid rgba(29, 78, 216, 0.9) !important;
}

.client-table tbody tr.client-row-highlight td:first-child {
    border-left: 2px solid rgba(29, 78, 216, 0.9) !important;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.client-table tbody tr.client-row-highlight td:last-child {
    border-right: 2px solid rgba(29, 78, 216, 0.9) !important;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

html[data-theme="dark"] .client-table tbody tr.client-row-highlight {
    background-color: rgba(59, 130, 246, 0.15) !important;
}

html[data-theme="dark"] .client-table tbody tr.client-row-highlight td {
    border-color: rgba(191, 219, 254, 0.9) !important;
}

/* Remove unnecessary action buttons from tree nodes */
.tree-node-actions {
    display: none !important;
}

/* Animation for expanding client rows */
@keyframes expandRow {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.client-table-row.expanded {
    animation: expandRow 0.2s ease-out;
}

/* Scrollbar styling for details panel */
.details-content::-webkit-scrollbar,
.cto-table-container::-webkit-scrollbar {
    width: 6px;
}

.details-content::-webkit-scrollbar-track,
.cto-table-container::-webkit-scrollbar-track {
    background: var(--gray-100);
}

.details-content::-webkit-scrollbar-thumb,
.cto-table-container::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 3px;
}

.details-content::-webkit-scrollbar-thumb:hover,
.cto-table-container::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}
/* Updated Thu Sep 18 16:03:28 -03 2025 - Force browser reload */
/* Size fix and positioning update Thu Sep 18 16:09:36 -03 2025 */
.pagination-notice {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: rgba(148, 163, 184, 0.08);
    color: var(--gray-600);
    font-size: 0.8rem;
    text-align: center;
}

html[data-theme="dark"] .pagination-notice {
    background: rgba(71, 85, 105, 0.22);
    color: rgba(226, 232, 240, 0.75);
}

@keyframes spin { 100% { transform: rotate(360deg); } }

/* Modern Refresh Button - Sophisticated Redesign */
.modern-refresh-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--refresh-btn-size);
    height: var(--refresh-btn-size);
    padding: 0;
    margin-left: 8px;
    border-radius: 8px; /* Softer, modern corners */
    background: var(--white);
    border: 1px solid var(--gray-300);
    color: var(--gray-600);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.modern-refresh-btn svg {
    width: var(--refresh-btn-icon-size);
    height: var(--refresh-btn-icon-size);
    transition: transform 0.4s ease;
    stroke-width: 2.5px;
}

.modern-refresh-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary-color);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.modern-refresh-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

.modern-refresh-btn:hover svg {
    transform: rotate(45deg);
}

.modern-refresh-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.modern-refresh-btn:disabled,
.modern-refresh-btn.is-disabled {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--gray-400);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.7;
    pointer-events: none;
}

.modern-refresh-btn:disabled:hover,
.modern-refresh-btn.is-disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--gray-200);
    color: var(--gray-400);
}

/* Loading State */
.cto-card.refreshing .modern-refresh-btn {
    border-color: #eab308;
    color: #eab308;
    background: #fefce8;
    cursor: wait;
    box-shadow: none;
    transform: none;
}

.cto-card.refreshing .modern-refresh-btn svg {
    animation: spin-smooth 1s linear infinite;
    transform: none !important; /* Override hover rotation */
}

@keyframes spin-smooth {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Row Refresh Button (Mini Version) */
.modern-row-refresh-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--row-refresh-btn-size);
    height: var(--row-refresh-btn-size);
    padding: 0;
    border-radius: 6px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--gray-400);
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0.6;
}

.client-row:hover .modern-row-refresh-btn {
    opacity: 1;
    background: var(--white);
    border-color: var(--gray-200);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.modern-row-refresh-btn:hover {
    color: var(--primary-color);
    border-color: var(--primary-color) !important;
    background: var(--white) !important;
    transform: scale(1.05);
}

.modern-row-refresh-btn svg {
    width: var(--row-refresh-btn-icon-size);
    height: var(--row-refresh-btn-icon-size);
    stroke-width: 2.5px;
    filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.1));
}

.cto-card.refreshing .modern-row-refresh-btn[data-action="refresh-client"] svg {
    animation: spin-smooth 1s linear infinite;
}

/* Dark Mode Overrides */
html[data-theme="dark"] .modern-refresh-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: #facc15;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

html[data-theme="dark"] .modern-refresh-btn:hover {
    background: rgba(234, 179, 8, 0.15);
    border-color: #facc15;
    color: #fef08a;
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.2);
}

html[data-theme="dark"] .modern-refresh-btn:disabled,
html[data-theme="dark"] .modern-refresh-btn.is-disabled {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.3);
    box-shadow: none;
}

html[data-theme="dark"] .cto-card.refreshing .modern-refresh-btn {
    background: rgba(234, 179, 8, 0.2);
    border-color: rgba(250, 204, 21, 0.6);
    color: #facc15;
}

html[data-theme="dark"] .modern-row-refresh-btn {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: #facc15;
}

html[data-theme="dark"] .modern-row-refresh-btn:hover {
    background: rgba(234, 179, 8, 0.15);
    border-color: rgba(234, 179, 8, 0.4);
    color: #fef08a;
}

html[data-theme="dark"] .modern-row-refresh-btn.is-disabled {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.3);
}

/* Flex Header for Power Column */
.power-header-flex {
    display: flex;
    align-items: center;
    justify-content: flex-start; /* Changed from space-between to align closer */
    gap: 16px; /* Match row gap */
    width: 100%;
    min-width: 0;
}

.power-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
    width: var(--power-actions-size);
    flex: 0 0 var(--power-actions-size);
    justify-content: center;
}

/* Timestamp Wrapper */
.timestamp-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 4px;
    line-height: 1.1;
    font-size: 0.72rem;
    white-space: nowrap;
}

.ts-date {
    color: var(--gray-600);
    font-weight: 600; /* Increased weight */
}

.ts-time {
    color: var(--gray-400);
    font-size: inherit;
}

html[data-theme="dark"] .ts-date {
    color: rgba(235, 235, 245, 0.9);
}

html[data-theme="dark"] .ts-time {
    color: rgba(235, 235, 245, 0.6);
}

/* Difference Column Layout (No Labels) */
.power-values--diff .power-line {
    display: flex;
    justify-content: flex-start;
    padding-left: 4px;
}


/* Power Status Colors */
.power-optimal {
    color: #16a34a; /* Green */
    font-weight: 600;
}

.power-regular {
    color: #eab308; /* Yellow */
    font-weight: 600;
}

.power-functional {
    color: #f97316; /* Orange */
    font-weight: 600;
}

.power-degraded {
    color: #dc2626; /* Red */
    font-weight: 600;
}

html[data-theme="dark"] .power-optimal { color: #4ade80; }
html[data-theme="dark"] .power-regular { color: #facc15; }
html[data-theme="dark"] .power-functional { color: #fb923c; }
html[data-theme="dark"] .power-degraded { color: #f87171; }

.power-label--ghost {
    visibility: hidden;
}

.cto-card.power-refreshing .power-content-wrapper,
.cto-card.power-refreshing .timestamp-wrapper,
.client-row.power-refreshing .power-content-wrapper,
.client-row.power-refreshing .timestamp-wrapper {
    filter: blur(1.5px);
    opacity: 0.55;
}

.power-content-wrapper,
.timestamp-wrapper {
    transition: filter 0.2s ease, opacity 0.2s ease;
}

.diff-pos {
    color: var(--status-online);
}

.diff-neg {
    color: var(--status-critical);
}

.diff-zero {
    color: var(--gray-400);
}

/* Power Layout Wrappers */
.power-content-wrapper {
    flex: 1 1 auto;
    min-width: 0;
}

.power-mobile-timestamp {
    display: none;
}

.power-timestamp-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.power-row-actions {
    display: flex;
    align-items: center;
    justify-content: center;
}

.power-header-title {
    flex: 1 1 auto;
    min-width: 0;
}

@media (min-width: 769px) {
    .client-table[data-view-mode="power"] .power-values {
        gap: 2px;
        font-size: 0.72rem;
    }

    .client-table[data-view-mode="power"] .power-line {
        line-height: 1.1;
    }

    .client-table[data-view-mode="power"] .power-label {
        line-height: 1.1;
    }

    .client-table[data-view-mode="power"] .power-timestamp-wrapper {
        gap: 2px;
    }

    .client-table[data-view-mode="power"] .timestamp-wrapper {
        line-height: 1.1;
    }
}

/* Updated Row Refresh Button - Visible & Bold */
.modern-row-refresh-btn {
    width: 26px;
    height: 26px;
    margin: 0; /* Reset margins */
    border-radius: 6px;
    background: var(--white);
    border: 1px solid var(--gray-300);
    color: #eab308; /* Bold Yellow */
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 1; /* Always visible */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    flex-shrink: 0;
}

.modern-row-refresh-btn.is-disabled {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.5);
    background: rgba(220, 38, 38, 0.08);
    cursor: not-allowed;
}

html[data-theme="dark"] .modern-row-refresh-btn.is-disabled {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(248, 113, 113, 0.12);
}

/* Updated Header Refresh Button - Neutral Default, Yellow Icon */
.modern-refresh-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    margin-left: 0; /* Removed margin-left */
    border-radius: 8px;
    background: var(--white); /* Neutral background */
    border: 1px solid var(--gray-300); /* Neutral border */
    color: #eab308; /* Yellow icon */
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.modern-refresh-btn:hover {
    background: #fefce8; /* Light yellow bg on hover */
    border-color: #eab308;
    color: #ca8a04;
    box-shadow: 0 4px 12px rgba(234, 179, 8, 0.15);
    transform: translateY(-1px);
}

.modern-refresh-btn:hover svg {
    transform: scale(1.1); /* Scale instead of rotate */
}

/* Hover States for Row Button */
.modern-row-refresh-btn:hover {
    background: #fefce8 !important;
    border-color: #eab308 !important;
    color: #ca8a04;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.client-row:hover .modern-row-refresh-btn {
    /* Override old opacity rules */
    opacity: 1; 
    background: var(--white);
}

/* Dark Mode Adjustments */
html[data-theme="dark"] .modern-row-refresh-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: #facc15; /* Brighter yellow for dark mode */
}

html[data-theme="dark"] .modern-row-refresh-btn:hover {
    background: rgba(234, 179, 8, 0.15) !important;
    border-color: #facc15 !important;
    color: #fef08a;
}

html[data-theme="dark"] .modern-refresh-btn {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: #facc15;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Online CTOs Toggle - Clean Design with Fading Lines */
.online-ctos-toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    padding: var(--spacing-lg) var(--spacing-lg);
    margin-top: var(--spacing-md);
}

/* Thin fading horizontal lines */
.decorative-horizontal-line {
    height: 1px;
    flex: 1;
    max-width: 120px;
    background: linear-gradient(
        to right,
        transparent,
        var(--gray-200) 30%,
        var(--gray-200) 70%,
        transparent
    );
}

/* Button container */
.online-ctos-toggle-container {
    display: flex;
    justify-content: center;
    flex-shrink: 0;
}

.online-ctos-toggle-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 200px;
    padding: 8px 20px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    background: var(--white);
    color: var(--gray-600);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    outline: none;
    white-space: nowrap;
}

.online-ctos-toggle-btn:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-800);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.online-ctos-toggle-btn:active {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.online-ctos-toggle-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.online-ctos-toggle-btn:disabled {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--gray-500);
    box-shadow: none;
    cursor: not-allowed;
}

/* Hidden Online CTOs */
.cto-card.hidden-online-cto {
    display: none;
}

/* Dark Mode Styles */
html[data-theme="dark"] .decorative-horizontal-line {
    background: linear-gradient(
        to right,
        transparent,
        rgba(255, 255, 255, 0.15) 30%,
        rgba(255, 255, 255, 0.15) 70%,
        transparent
    );
}

html[data-theme="dark"] .online-ctos-toggle-btn {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
    box-shadow: none;
}

html[data-theme="dark"] .online-ctos-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.95);
}

html[data-theme="dark"] .online-ctos-toggle-btn:disabled {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.5);
}
