/* Local Font - Open Sans (files in /fonts folder) */
@font-face {
    font-family: 'Open Sans';
    src: url('/fonts/OpenSans-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Open Sans';
    src: url('/fonts/OpenSans-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Open Sans';
    src: url('/fonts/OpenSans-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Open Sans';
    src: url('/fonts/OpenSans-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* DataStore Lock Overlay */
/* Unified Auth + Init Overlay */
#unified-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100000;
    backdrop-filter: blur(4px);
}
#unified-overlay .lock-content {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 400px;
}
#unified-overlay .lock-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: #0066cc;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}
#unified-overlay .overlay-state {
    display: flex;
    flex-direction: column;
    align-items: center;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Hide overlay only when it has the hidden class */
#unified-overlay.hidden { display: none !important; }
html.app-locked .app-header,
html.app-locked .app-container { display: none !important; }

:root {
    /* Font - change this to switch site font */
    --font-family: 'Open Sans', sans-serif;
    
    /* Type scale */
    --text-xs: 10px;
    --text-sm: 11px;
    --text-base: 12px;
    --text-md: 13px;
    --text-lg: 15px;
    --text-xl: 18px;
    
    /* Core colors */
    --bg-color: #f5f9ff;
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-color: #1a1a1a;
    --text-muted: #6c757d;
    --primary-blue: #0066cc;
    --light-blue: #d9eaff;
    --lighter-blue: #e8f2ff;
    --border-color: rgba(173, 216, 230, 0.5);
    --titlebar-bg: #e8f2ff;
    --titlebar-text: #666666;
    
    /* Status colors (consolidated) */
    --success-green: #10b981;
    --warning-yellow: #f5c000;
    --danger-red: #ff5f57;
    
    /* Shadows */
    --shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 20px rgba(0, 0, 0, 0.12);
    
    /* Scrollbar colors */
    --scrollbar-track: rgba(200, 220, 240, 0.3);
    --scrollbar-thumb: rgba(100, 150, 200, 0.4);
    
    /* Dialog settings - edit these to change all dialogs */
    --dialog-padding: 16px;
    --dialog-border-radius: 16px;
    --dialog-backdrop-blur: 4px;
    --dialog-header-padding: 12px 16px;
    --dialog-body-padding: 20px;
    --dialog-footer-padding: 12px 16px;
    --dialog-title-font-size: var(--text-lg);   /* 15px */
    --dialog-body-font-size: var(--text-md);    /* 13px */
    --dialog-label-font-size: var(--text-base); /* 12px */
    --dialog-hint-font-size: var(--text-sm);    /* 11px */
}

body {
    font-family: var(--font-family);
    background: radial-gradient(circle at top, #ffffff 0%, #e8f2ff 60%);
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    color: var(--text-color);
    overflow: hidden;
}

.app-container {
    display: flex;
    gap: 20px;
    width: 100%;
    height: 100%;
    padding: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(240, 248, 255, 0.9));
    box-sizing: border-box;
}

/* Left Panel - Bench Groups & Benches */
.left-panel {
    width: 280px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.panel-card {
    background: rgba(248, 252, 255, 0.95);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    background: linear-gradient(180deg, var(--lighter-blue), var(--light-blue));
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header h3 {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-color);
}

/* Sidebar connection status */
.sidebar-connection-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: var(--text-sm);
    font-weight: 500;
}
.sidebar-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.sidebar-connection-status.connected .sidebar-status-dot {
    background: var(--success-green);
}
.sidebar-connection-status.connected .sidebar-status-text {
    color: var(--success-green);
}
.sidebar-connection-status.error .sidebar-status-dot {
    background: var(--danger-red);
}
.sidebar-connection-status.error .sidebar-status-text {
    color: var(--danger-red);
}

.panel-body {
    padding: 12px;
    overflow-y: auto;
    flex: 1;
}

/* Reusable scrollbar styles */
.scrollable {
    overflow-y: auto;
}

.scrollable::-webkit-scrollbar,
.panel-body::-webkit-scrollbar {
    width: 6px;
}

.scrollable::-webkit-scrollbar-track,
.panel-body::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

.scrollable::-webkit-scrollbar-thumb,
.panel-body::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

.scrollable-wide::-webkit-scrollbar {
    width: 8px;
}

.scrollable-wide::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

.scrollable-wide::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

/* Bench Group */
.bench-group {
    margin-bottom: 16px;
}

.bench-group-header {
    background: linear-gradient(180deg, rgba(217, 234, 255, 0.6), rgba(198, 226, 255, 0.6));
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(173, 216, 230, 0.4);
    margin-bottom: 6px;
    transition: all 0.2s ease;
}

.bench-group-header:hover {
    background: linear-gradient(180deg, rgba(217, 234, 255, 0.8), rgba(198, 226, 255, 0.8));
    transform: translateY(-1px);
}

.bench-group-header span {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-color);
}

.expand-icon {
    font-size: var(--text-xs);
    color: var(--titlebar-text);
    transition: transform 0.2s ease;
}

.bench-group-header.expanded .expand-icon {
    transform: rotate(90deg);
}

.bench-list {
    padding-left: 12px;
    display: none;
}

.bench-list.visible {
    display: block;
}

.bench-item {
    background: rgba(255, 255, 255, 0.7);
    padding: 10px 12px;
    border-radius: 6px;
    margin-bottom: 6px;
    cursor: pointer;
    border: 1px solid rgba(173, 216, 230, 0.3);
    transition: all 0.2s ease;
}

.bench-item:hover {
    background: rgba(255, 255, 255, 0.95);
    border-color: var(--primary-blue);
    transform: translateX(4px);
}

.bench-item.active {
    background: linear-gradient(180deg, var(--light-blue), rgba(198, 226, 255, 0.8));
    border-color: var(--primary-blue);
}

.bench-item-name {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 4px;
}

.bench-item-path {
    font-size: var(--text-xs);
    color: var(--titlebar-text);
    font-family: 'SF Mono', 'Menlo', monospace;
}

/* Menu Tree Styles */
.menu-node {
    user-select: none;
}

.menu-node-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.menu-node-header:hover {
    background: rgba(217, 234, 255, 0.5);
}

.menu-node-header.selected {
    background: linear-gradient(180deg, var(--light-blue), rgba(198, 226, 255, 0.8));
    border: 1px solid var(--primary-blue);
}

.menu-node-header.expanded .expand-icon {
    transform: rotate(90deg);
}

.menu-node-header .expand-icon {
    font-size: var(--text-xs);
    color: var(--titlebar-text);
    transition: transform 0.15s ease;
    width: 10px;
    text-align: center;
}

.menu-node-header .expand-icon-spacer {
    width: 10px;
}

.menu-node-header .menu-name {
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text-color);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-node-header .menu-count {
    font-size: var(--text-xs);
    color: var(--titlebar-text);
    background: rgba(0, 0, 0, 0.08);
    padding: 1px 6px;
    border-radius: 10px;
}

.menu-node-children {
    display: none;
}

.menu-node-children.visible {
    display: block;
}

/* Menu separator */
.menu-separator {
    height: 1px;
    background: var(--primary-blue);
    margin: 8px 0;
    opacity: 0.4;
}

/* Sites Master-Detail Layout */
.sites-master-detail {
    display: flex;
    height: 100%;
    gap: 12px;
    padding: 12px;
}

.sites-list-panel {
    min-width: 240px;
    max-width: 400px;
    overflow-y: auto;
    background: rgba(248, 252, 255, 0.95);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.site-list-item {
    font-size: var(--text-md);
}

.inner-card {
    background: white;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    padding: 8px;
}

.app-picker-panel {
    min-width: 140px;
    max-width: 180px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.app-list-item {
    font-size: var(--text-md);
}

.app-doctype-grid {
    flex: 1;
    overflow: hidden;
}

.app-doctype-grid table {
    border-left: 1px solid var(--border-color);
}

.doctype-dot {
    color: #e53935;
    font-size: var(--text-lg);
}

.site-name {
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: var(--text-md);
    color: var(--text-color);
}

.site-detail-panel {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.site-detail-card {
    background: rgba(248, 252, 255, 0.95);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    padding: 16px;
}

.site-detail-card h4 {
    margin: 0 0 12px 0;
    font-size: var(--text-md);
    color: var(--text-primary);
}

.site-detail-row {
    display: flex;
    gap: 12px;
    padding: 6px 0;
    font-size: var(--text-md);
    border-bottom: 1px solid var(--border-color);
}

.site-detail-row:last-child {
    border-bottom: none;
}

.site-detail-row .label {
    color: var(--text-muted);
    min-width: 80px;
}

.site-detail-row .value {
    color: var(--text-primary);
}

/* Level-specific styling */
.menu-node-level-0 > .menu-node-header {
    font-weight: 600;
    background: linear-gradient(180deg, rgba(217, 234, 255, 0.6), rgba(198, 226, 255, 0.6));
    border: 1px solid rgba(173, 216, 230, 0.4);
    margin-bottom: 4px;
}

.menu-node-level-1 > .menu-node-header .menu-name {
    font-weight: 600;
}

.menu-node-level-2 > .menu-node-header .menu-name {
    font-weight: 500;
}

/* Main Content - Detail View */
.main-content {
    flex: 1;
    min-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-header {
    background: rgba(248, 252, 255, 0.95);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    padding: 20px 24px;
}

.detail-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.detail-header h2 {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
}

.detail-header .bench-path {
    font-size: var(--text-sm);
    color: var(--titlebar-text);
    font-family: 'SF Mono', 'Menlo', monospace;
}

.bench-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* Tab Toolbar */
.tab-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.tab-toolbar-left {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-color);
}

.tab-toolbar-right {
    display: flex;
    gap: 8px;
}

/* Site Card Actions Dropdown */
.site-card-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.site-actions-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.site-actions-row .btn-small {
    flex: 0 0 auto;
}

.actions-separator {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.tab-btn {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    padding: 10px 20px;
    font-size: var(--text-base);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-color);
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.9);
}

.tab-btn.active {
    background: linear-gradient(180deg, var(--light-blue), rgba(198, 226, 255, 0.9));
    border-bottom: none;
}

.detail-content {
    flex: 1;
    background: rgba(248, 252, 255, 0.95);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    padding: 20px;
    overflow-y: auto;
}

.detail-content::-webkit-scrollbar {
    width: 8px;
}

.detail-content::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

.detail-content::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

/* Sites Grid */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.site-card {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 16px;
    transition: all 0.2s ease;
}

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

.site-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.site-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success-green);
}

.site-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn {
    background: linear-gradient(180deg, var(--light-blue), rgba(198, 226, 255, 0.8));
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-color);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.btn-small {
    padding: 4px 8px;
    font-size: var(--text-xs);
}

.btn.selected,
.btn:active {
    border-color: var(--primary-blue);
}

.btn-success {
    background: linear-gradient(180deg, #d9f5e8, #c6eedd);
    border-color: rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(180deg, #ffe5e5, #ffd4d4);
    border-color: rgba(255, 95, 87, 0.3);
}

/* Apps List */
.apps-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.app-item {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-info {
    flex: 1;
}

.app-name {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 4px;
}

.app-version {
    font-size: var(--text-sm);
    color: var(--titlebar-text);
    font-family: 'SF Mono', 'Menlo', monospace;
}

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

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.visible {
    display: flex;
}

.modal {
    background: rgba(248, 252, 255, 0.98);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    background: linear-gradient(180deg, var(--lighter-blue), var(--light-blue));
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-color);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

.modal-section {
    margin-bottom: 20px;
}

.modal-section h4 {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
}

.modal-section p {
    font-size: var(--text-base);
    color: var(--titlebar-text);
    line-height: 1.6;
    margin-bottom: 8px;
}

.code-block {
    background: rgba(30, 30, 30, 0.95);
    border-radius: 8px;
    padding: 12px 16px;
    font-family: 'SF Mono', 'Menlo', monospace;
    font-size: var(--text-sm);
    color: #e0e0e0;
    overflow-x: auto;
    margin: 8px 0;
}

.code-block code {
    white-space: pre;
}

.warning-box {
    background: rgba(245, 192, 0, 0.1);
    border: 1px solid rgba(245, 192, 0, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
}

.warning-box strong {
    color: #c79400;
    font-size: var(--text-base);
}

.modal-footer {
    background: linear-gradient(180deg, var(--lighter-blue), var(--light-blue));
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Password Field with Copy & Visibility Toggle */
.password-field-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-field-wrapper input {
    flex: 1;
    padding-right: 70px; /* Space for icons */
}

.password-field-icons {
    position: absolute;
    right: 8px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.password-icon-btn {
    background: transparent;
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: var(--text-md);
    transition: all 0.2s;
    padding: 0;
    color: var(--titlebar-text);
}

.password-icon-btn:hover {
    background: rgba(0, 102, 204, 0.1);
    color: var(--primary-blue);
    transform: scale(1.05);
}

.password-icon-btn:active {
    transform: scale(0.95);
}

.password-icon-btn.copied {
    background: var(--success-green);
    color: white;
}


.btn-primary {
    background: linear-gradient(180deg, #0066cc, #0055aa);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(180deg, #0055aa, #004488);
}

.btn-secondary {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(240, 240, 240, 0.9));
    border: 1px solid var(--border-color);
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--titlebar-text);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: var(--text-lg);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: var(--text-base);
}

/* Global App Header */
.app-header {
    background: linear-gradient(180deg, rgba(248, 252, 255, 0.98), rgba(232, 242, 255, 0.95));
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.app-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-title h1 {
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text-color);
}

.app-subtitle {
    font-size: var(--text-sm);
    color: var(--titlebar-text);
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.app-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-sm);
    color: var(--titlebar-text);
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--titlebar-text);
}

.connection-dot.connected {
    background: var(--success-green);
}

.connection-dot.disconnected {
    background: var(--danger-red);
}

.btn-icon {
    background: linear-gradient(180deg, var(--light-blue), rgba(198, 226, 255, 0.8));
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: var(--text-base);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-icon:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* More menu */
.more-menu {
    position: relative;
}
.more-menu-list {
    display: none;
    position: absolute;
    top: 110%;
    right: 0;
    background: rgba(248, 252, 255, 0.98);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
    padding: 8px;
    z-index: 2100;
    min-width: 180px;
    flex-direction: column;
    gap: 6px;
}
.more-menu-separator {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}
.more-menu.open .more-menu-list {
    display: flex;
}
.more-menu-list .btn-icon {
    width: 100%;
    justify-content: flex-start;
}

/* Settings dropdown - reuse more-menu pattern */
.settings-menu {
    position: relative;
}
.settings-menu-list {
    display: none;
    position: absolute;
    top: 110%;
    right: 0;
    background: rgba(248, 252, 255, 0.98);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.12);
    padding: 8px;
    z-index: 2100;
    min-width: 160px;
    flex-direction: column;
    gap: 6px;
}
.settings-menu.open .settings-menu-list {
    display: flex;
}
.settings-menu-list .btn-icon {
    width: 100%;
    justify-content: flex-start;
}

/* Menu section labels */
.menu-section-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px 2px;
    margin-top: 4px;
}
.menu-section-label:first-child {
    margin-top: 0;
}

/* Settings Form Styles */
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-color);
}

.form-group input {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: var(--text-base);
    font-family: 'SF Mono', 'Menlo', monospace;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.form-group .hint {
    font-size: var(--text-xs);
    color: var(--titlebar-text);
}

.form-section {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.form-section h4 {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 12px;
}

.settings-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Button Variants */
.btn-warning {
    background: linear-gradient(180deg, #fff5d9, #ffefc6);
    border-color: rgba(245, 192, 0, 0.3);
}

/* Terminal Panel */
.terminal-panel {
    background: rgba(248, 252, 255, 0.95);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 300px;
    min-height: 200px;
    resize: vertical;
}

.terminal-panel.expanded {
    height: 500px;
}

.terminal-panel.collapsed {
    height: 48px;
    min-height: 48px;
    resize: none;
}

.terminal-header {
    background: linear-gradient(180deg, #2d2d2d, #1e1e1e);
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
}

.terminal-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.terminal-title {
    font-size: var(--text-md);
    font-weight: 500;
    color: #e0e0e0;
}

.terminal-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-sm);
    color: var(--titlebar-text);
}

.terminal-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #888;
}

.terminal-status-dot.connected {
    background: var(--success-green);
}

.terminal-status-dot.disconnected {
    background: var(--danger-red);
}

.terminal-status-dot.connecting {
    background: var(--warning-yellow);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.terminal-header-right {
    display: flex;
    gap: 8px;
}

.terminal-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: var(--text-sm);
    color: #ccc;
    cursor: pointer;
    transition: all 0.2s ease;
}

.terminal-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.terminal-body {
    flex: 1;
    background: #1e1e1e;
    padding: 8px;
    overflow: hidden;
}

.terminal-panel.collapsed .terminal-body {
    display: none;
}

#terminal-container {
    width: 100%;
    height: 100%;
}

/* xterm.js customization */
.xterm {
    padding: 4px;
}

.xterm-viewport::-webkit-scrollbar {
    width: 8px;
}

.xterm-viewport::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.xterm-viewport::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

/* Layout adjustment for terminal */
.main-content-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 12px;
    min-width: 500px;
}

.main-content-wrapper .main-content {
    flex: 1;
    min-width: unset;
}

/* Settings Tabs Styles */
.settings-tab-btn {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    padding: 8px 14px;
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-color);
}

.settings-tab-btn:hover {
    background: rgba(255, 255, 255, 0.8);
}

.settings-tab-btn.active {
    background: rgba(248, 252, 255, 0.95);
    border-bottom: 1px solid rgba(248, 252, 255, 0.95);
    font-weight: 600;
}

/* Hide embedded terminal panel */
#terminal-panel {
    display: none !important;
}

/* Simple cards for content area */
.content-card {
    background: rgba(248, 252, 255, 0.95);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    padding: 16px;
}

.content-header-card {
    margin-bottom: 12px;
    min-height: 60px;
}

.content-body-card {
    flex: 1;
    min-height: 0;
}

.settings-tab-content {
    display: none !important;
}

.settings-tab-content.active {
    display: block !important;
}

/* Item Cards for Lists */
.item-card {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: start;
}

.item-card-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-card-field {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 8px;
    align-items: center;
    font-size: var(--text-sm);
}

.item-card-field label {
    font-weight: 600;
    color: var(--titlebar-text);
}

.item-card-field input,
.item-card-field select {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: var(--text-sm);
    background: white;
}

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

/* ============================================
   UTILITY CLASSES (replacing inline styles)
   ============================================ */

/* Flexbox utilities */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-end { display: flex; justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }

/* Gap utilities */
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

/* Text utilities */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-md { font-size: var(--text-md); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-muted { color: var(--titlebar-text); }
.text-center { text-align: center; }
.text-bold { font-weight: 600; }
.text-italic { font-style: italic; }
.font-mono { font-family: 'SF Mono', 'Menlo', monospace; }

/* Padding utilities */
.p-8 { padding: 8px; }
.p-12 { padding: 12px; }
.p-20 { padding: 20px; }
.px-12 { padding-left: 12px; padding-right: 12px; }
.px-24 { padding-left: 24px; padding-right: 24px; }
.py-12 { padding-top: 12px; padding-bottom: 12px; }
.pt-12 { padding-top: 12px; }

/* Margin utilities */
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }

/* Common component styles */
.card-bg {
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
}

.list-empty {
    font-size: var(--text-sm);
    color: var(--titlebar-text);
    padding: 20px;
    text-align: center;
}

.header-gradient {
    background: linear-gradient(180deg, var(--lighter-blue), var(--light-blue));
}

/* Settings tabs container */
.settings-tabs-nav {
    display: flex;
    gap: 4px;
    padding: 12px 24px 0 24px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, var(--lighter-blue), var(--light-blue));
}

/* Settings modal specific */
.settings-modal {
    max-width: 750px;
    width: 90%;
    height: 650px;
    max-height: 85vh;
}

.settings-modal-body {
    height: 450px;
    max-height: calc(85vh - 200px);
    overflow-y: auto;
}

/* Sync status area */
.sync-area {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sync-status {
    font-size: var(--text-xs);
    color: var(--titlebar-text);
}

/* Scrollable containers with max height */
.scroll-container-sm {
    max-height: 180px;
    overflow-y: auto;
}

.scroll-container-md {
    max-height: 250px;
    overflow-y: auto;
}

.scroll-container-lg {
    max-height: 350px;
    overflow-y: auto;
}

/* Status indicators */
.status-configured { color: var(--warning-yellow); }
.status-success { color: var(--success-green); }
.status-danger { color: var(--danger-red); }

/* Info/summary boxes */
.info-box {
    font-size: var(--text-sm);
    background: rgba(255, 255, 255, 0.7);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.code-display {
    font-size: var(--text-sm);
    font-family: 'SF Mono', monospace;
    background: rgba(30, 30, 30, 0.95);
    color: #e0e0e0;
    padding: 12px;
    border-radius: 8px;
}

/* Drag hint */
.drag-hint {
    font-size: var(--text-sm);
    color: #888;
    margin-left: 12px;
}

/* ============================================
   GLOBAL MODAL SYSTEM (Reusable Base Classes)
   ============================================ */

/* Base Modal Overlay */
.app-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.app-modal-overlay.visible,
.app-modal-overlay.show {
    display: flex;
}

/* Base Modal Container */
.app-modal {
    display: flex;
    flex-direction: column;
    background: rgba(248, 252, 255, 0.98);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.app-modal.draggable {
    cursor: default;
}

.app-modal.resizable {
    resize: both;
    min-width: 400px;
    min-height: 300px;
}

/* Modal Header */
.app-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(180deg, var(--lighter-blue), var(--light-blue));
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.app-modal-header.draggable {
    cursor: move;
    user-select: none;
}

.app-modal-header.draggable:active {
    cursor: grabbing;
}

.app-modal-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-modal-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-modal-header h3 {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: 600;
}

/* Mac-style close button */
.app-modal-close {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff5f57;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.app-modal-close:hover {
    opacity: 0.8;
}

/* Modal Body */
.app-modal-body {
    flex: 1;
    padding: 16px;
    overflow: auto;
    min-height: 0;
}

.app-modal-body::-webkit-scrollbar {
    width: 8px;
}

.app-modal-body::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

.app-modal-body::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

/* Modal Footer */
.app-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-color);
    background: linear-gradient(180deg, var(--lighter-blue), var(--light-blue));
}

/* Resize Handle */
.app-modal-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    z-index: 10;
}


/* ============================================
   TERMINAL DIALOG - Specific Styles
   ============================================ */

/* Terminal dialog sizing - extends dialog-modal */
.terminal-dialog {
    min-width: 600px;
    min-height: 400px;
}

/* Terminal header styling */
.terminal-dialog .modal-header h3 {
    font-size: var(--text-md);
    font-weight: 500;
}

/* Terminal status indicator styles defined above (single definition) */

/* Terminal body styling */
.terminal-dialog .modal-body {
    padding: 12px;
    background: rgba(248, 252, 255, 0.95);
}

#terminal-dialog-container {
    width: 100%;
    height: 100%;
    background: #1e1e1e;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Terminal dialog buttons - use standard button styles */
.terminal-dialog .btn-sm {
    font-size: var(--text-sm);
    padding: 4px 10px;
}

/* ============================================
   DIALOG RENDERER V2 - Config-driven dialogs
   (Extends global app-modal classes)
   ============================================ */

/* Dialog overlay */
.dialog-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(var(--dialog-backdrop-blur));
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.dialog-overlay.visible {
    display: flex;
}

/* Dialog container */
.dialog {
    display: flex;
    flex-direction: column;
    cursor: grab;
    background: rgba(248, 252, 255, 0.98);
    border-radius: var(--dialog-border-radius);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: absolute;
    min-width: 400px;
    min-height: 300px;
    font-size: var(--dialog-body-font-size);
}

.dialog.dragging {
    user-select: none;
    cursor: grabbing;
}

/* Resize handle - gradient style like dialog-modal */
.dialog-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 20px;
    height: 20px;
    cursor: nwse-resize;
    z-index: 10;
    background: linear-gradient(135deg, transparent 50%, #ccc 50%);
}

.dialog-resize-handle:hover {
    background: linear-gradient(135deg, transparent 50%, #999 50%);
}

/* Dialog Header */
.dialog-header {
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--lighter-blue), var(--light-blue));
    padding: var(--dialog-header-padding);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: grab;
    user-select: none;
}

.dialog-header:active {
    cursor: grabbing;
}

/* Close button - same as app-modal-close */
.dialog-close {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff5f57;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.dialog-close:hover {
    opacity: 0.8;
}

/* X mark on close button (optional visual enhancement) */
.dialog-close::before,
.dialog-close::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 1px;
    background: rgba(0, 0, 0, 0);
    transition: background 0.15s;
}

.dialog-close:hover::before,
.dialog-close:hover::after {
    background: rgba(0, 0, 0, 0.4);
}

.dialog-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.dialog-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.dialog-header-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dialog-header-icon {
    font-size: var(--text-xl);
}

.dialog-header-title {
    font-size: var(--dialog-title-font-size);
    font-weight: 600;
    color: var(--text-color);
    margin: 0;
}

.dialog-header-subtitle {
    font-size: var(--text-sm);
    color: var(--titlebar-text);
    margin-left: 8px;
}

/* Tabs (FIXED) */
.dialog-tabs {
    flex-shrink: 0;
    display: flex;
    gap: 0;
    padding: 0 24px;
    background: linear-gradient(180deg, var(--light-blue), rgba(198, 226, 255, 0.5));
    border-bottom: 2px solid var(--border-color);
    overflow-x: auto;
}

.dialog-tab {
    padding: 12px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--titlebar-text);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    white-space: nowrap;
}

.dialog-tab:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.5);
}

.dialog-tab.active {
    color: var(--primary-blue);
    font-weight: 600;
    border-bottom-color: var(--primary-blue);
    background: rgba(255, 255, 255, 0.7);
}

/* Tab Content Container */
.dialog-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    padding: var(--dialog-body-padding);
}

.dialog-tab-pane {
    display: none;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.dialog-tab-pane.active {
    display: flex;
}

/* Tab Top Section (FIXED within tab) */
.dialog-tab-top {
    flex-shrink: 0;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.5);
}

.dialog-tab-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 4px 0;
}

.dialog-tab-description {
    font-size: var(--text-base);
    color: var(--titlebar-text);
    line-height: 1.5;
    margin: 0;
}

/* Lists Container */
.dialog-lists {
    flex: 1;
    overflow: visible;
    padding: 16px 24px;
}

.dialog-lists::-webkit-scrollbar {
    width: 8px;
}

.dialog-lists::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

.dialog-lists::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

/* Tab Footer (FIXED within tab) */
.dialog-tab-footer {
    flex-shrink: 0;
    padding: 12px 24px;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.5);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* Dialog Footer (FIXED) */
.dialog-footer {
    flex-shrink: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), var(--lighter-blue));
    padding: var(--dialog-footer-padding);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dialog-footer-left {
    font-size: var(--text-sm);
    color: var(--titlebar-text);
}

.dialog-footer-right {
    display: flex;
    gap: 12px;
}

/* ============================================
   LIST COMPONENT (Collapsible)
   ============================================ */

.dialog-list {
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.6);
}

.dialog-list:last-child {
    margin-bottom: 0;
}

.dialog-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(180deg, rgba(217, 234, 255, 0.6), rgba(198, 226, 255, 0.6));
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.dialog-list-header:hover {
    background: linear-gradient(180deg, rgba(217, 234, 255, 0.8), rgba(198, 226, 255, 0.8));
}

.dialog-list-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dialog-list-toggle {
    font-size: var(--text-xs);
    color: var(--titlebar-text);
    transition: transform 0.2s;
}

.dialog-list.collapsed .dialog-list-toggle {
    transform: rotate(-90deg);
}

.dialog-list-title {
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-color);
}

.dialog-list-count {
    font-size: var(--text-sm);
    color: var(--titlebar-text);
    background: rgba(255, 255, 255, 0.7);
    padding: 2px 8px;
    border-radius: 10px;
}

.dialog-list-header-actions {
    display: flex;
    gap: 6px;
}

/* Header select variant */
.dialog-list.header-select {
    padding: 0;
    box-shadow: none;
    border: none;
}
.dialog-list.header-select .dialog-list-header {
    cursor: default;
    padding: 8px 12px;
    background: linear-gradient(180deg, rgba(217, 234, 255, 0.9), rgba(198, 226, 255, 0.9));
    border: 1px solid #c6e2ff;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dialog-list.header-select .header-select-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.dialog-list.header-select .dialog-list-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-color);
}
.dialog-list.header-select .dialog-list-count {
    margin-left: 6px;
}
.header-select-actions {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: flex-start;
    flex: 1;
    position: relative;
}
.header-select-display {
    width: 100%;
    color: var(--text-color);
    font-weight: 600;
    padding: 6px 8px;
    pointer-events: none;
    user-select: none;
}
.header-select-arrow {
    font-size: var(--text-xs);
    color: var(--titlebar-text);
    pointer-events: none;
}
.header-select-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.header-select-count {
    background: #f3f7ff;
    color: #555;
}
/* Header-less list (used for simple selector row) */
.dialog-list.no-header {
    background: transparent;
    box-shadow: none;
    border: none;
    padding: 0;
}
.dialog-list-content.no-header {
    padding: 0;
    background: transparent;
}

.dialog-list-content {
    overflow-y: auto;
    transition: max-height 0.3s ease;
}

/* Set max-height from data attribute when not collapsed */
.dialog-list:not(.collapsed) .dialog-list-content[data-max-height="200px"] {
    max-height: 200px;
}

.dialog-list:not(.collapsed) .dialog-list-content[data-max-height="300px"] {
    max-height: 300px;
}

.dialog-list:not(.collapsed) .dialog-list-content[data-max-height="400px"] {
    max-height: 400px;
}

/* Default max-height if no data attribute */
.dialog-list:not(.collapsed) .dialog-list-content:not([data-max-height]) {
    max-height: 300px;
}

.dialog-list.collapsed .dialog-list-content {
    max-height: 0 !important;
    overflow: hidden;
}

.dialog-list-content::-webkit-scrollbar {
    width: 6px;
}

.dialog-list-content::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

.dialog-list-content::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 3px;
}

/* ============================================
   ACCORDION GROUP (within list)
   ============================================ */

.dialog-group {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dialog-group:last-child {
    border-bottom: none;
}

.dialog-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(248, 252, 255, 0.8);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s;
}

.dialog-group-header:hover {
    background: rgba(217, 234, 255, 0.5);
}

.dialog-group-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dialog-group-toggle {
    font-size: var(--text-xs);
    color: var(--titlebar-text);
    transition: transform 0.2s;
}

.dialog-group.collapsed .dialog-group-toggle {
    transform: rotate(-90deg);
}

.dialog-group-title {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--text-color);
}

.dialog-group-count {
    font-size: var(--text-xs);
    color: var(--titlebar-text);
}

.dialog-group-content {
    transition: max-height 0.2s ease;
}

.dialog-group.collapsed .dialog-group-content {
    max-height: 0;
    overflow: hidden;
}

/* ============================================
   LIST ITEM
   ============================================ */

.dialog-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    transition: all 0.15s;
    gap: 16px;
}

.dialog-item:last-child {
    border-bottom: none;
}

.dialog-item:hover {
    background: rgba(0, 102, 204, 0.04);
}

.dialog-item-content {
    flex: 1;
    min-width: 0;
}

/* Selectable List Styles */
.dialog-selectable-list {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.dialog-selectable-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-base);
}

.dialog-selectable-table thead {
    background: rgba(248, 252, 255, 0.9);
    position: sticky;
    top: 0;
}

.dialog-selectable-table th {
    text-align: left;
    padding: 8px 12px;
    font-weight: 500;
    color: var(--titlebar-text);
    border-bottom: 1px solid var(--border-color);
}

.dialog-selectable-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.dialog-selectable-row {
    cursor: pointer;
    transition: background 0.15s;
}

.dialog-selectable-row:hover {
    background: rgba(217, 234, 255, 0.3);
}

.dialog-selectable-row.selected {
    background: rgba(0, 122, 255, 0.12);
}

.dialog-selectable-row.selected td:first-child {
    font-weight: 600;
    color: var(--primary-blue);
}

.dialog-selectable-empty {
    padding: 24px;
    text-align: center;
    color: var(--titlebar-text);
    font-size: var(--text-base);
}

.dialog-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: var(--text-xs);
    font-weight: 500;
}

.dialog-badge.badge-success {
    background: rgba(52, 199, 89, 0.15);
    color: #34c759;
}

.dialog-badge.badge-pending {
    background: rgba(255, 149, 0, 0.15);
    color: #ff9500;
}

.dialog-item-title {
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Content Tables - Common styling for all content area tables */
.content-table {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
    font-size: var(--text-sm);
    line-height: 14px;
    border: 1px solid var(--border-color);
}

.content-table thead tr {
    background: var(--bg-secondary);
    position: sticky;
    top: 0;
    z-index: 1;
}

.content-table th {
    text-align: left;
    padding: 6px 3px;
    font-weight: 600;
    letter-spacing: -0.3px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid #e0e0e0;
}

.content-table th:last-child {
    border-right: none;
}

.content-table td {
    padding: 4px 3px;
    border-bottom: 1px solid #e0e0e0;
    border-right: 1px solid #e0e0e0;
}

.content-table td:last-child {
    border-right: none;
}

.content-table tbody tr:nth-child(even) {
    background: var(--bg-secondary);
}

.content-table tbody tr:nth-child(odd) {
    background: var(--bg-primary);
}

/* Column type classes */
.content-table .col-name {
    white-space: nowrap;
    font-weight: 600;
}

.content-table .col-short {
    white-space: nowrap;
}

.content-table .col-actions {
    white-space: nowrap;
    text-align: center;
}

.content-table .col-mono {
    font-family: monospace;
    font-size: var(--text-sm);
}

.content-table .col-muted {
    color: var(--text-muted);
}

/* Table action buttons */
.btn-table {
    padding: 3px 10px;
    font-size: var(--text-sm);
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-weight: 500;
    color: white;
    transition: opacity 0.15s ease;
}

.btn-table:hover {
    opacity: 0.8;
}

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

.btn-install {
    background: var(--primary-blue);
}

.btn-uninstall {
    background: #dc3545;
}

.btn-table-grey {
    padding: 3px 8px;
    font-size: var(--text-base);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    cursor: pointer;
    background: var(--bg-secondary);
    color: var(--text-muted);
    transition: all 0.15s ease;
}
.btn-table-grey:hover {
    background: var(--light-blue);
    color: var(--text-color);
}

.readme-content h1, .readme-content h2, .readme-content h3 {
    color: var(--text-color); margin: 16px 0 8px; font-weight: 600;
}
.readme-content h1 { font-size: var(--text-xl); border-bottom: 1px solid var(--border-color); padding-bottom: 6px; }
.readme-content h2 { font-size: var(--text-lg); border-bottom: 1px solid var(--border-color); padding-bottom: 4px; }
.readme-content h3 { font-size: var(--text-md); }
.readme-content p { margin: 8px 0; line-height: 1.6; }
.readme-content ul, .readme-content ol { margin: 8px 0; padding-left: 24px; }
.readme-content li { margin: 4px 0; line-height: 1.5; }
.readme-content code {
    background: var(--bg-secondary); padding: 1px 5px; border-radius: 3px;
    font-family: monospace; font-size: var(--text-sm);
}
.readme-content pre {
    background: var(--bg-secondary); padding: 10px; border-radius: 4px;
    overflow-x: auto; margin: 8px 0;
}
.readme-content pre code { background: none; padding: 0; }
.readme-content a { color: var(--primary-blue); text-decoration: none; }
.readme-content a:hover { text-decoration: underline; }
.readme-content blockquote {
    border-left: 3px solid var(--border-color); margin: 8px 0;
    padding: 4px 12px; color: var(--text-muted);
}
.readme-content table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.readme-content th, .readme-content td {
    border: 1px solid var(--border-color); padding: 6px 10px; font-size: var(--text-base); text-align: left;
}
.readme-content th { background: var(--bg-secondary); font-weight: 600; }
.readme-content img { max-width: 100%; }

.btn-update {
    background: #ff8c00;
}

.btn-remove {
    background: #dc3545;
}

/* Ghost-style buttons for deployment grid */
.btn-grid {
    padding: 4px 12px;
    font-size: var(--text-sm);
    font-weight: 500;
    background: transparent;
    color: #999;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-grid.btn-grid-install:hover {
    color: #28a745;
    border-color: #28a745;
}

.btn-grid.btn-grid-uninstall:hover {
    color: #dc3545;
    border-color: #dc3545;
}

.dialog-item-subtitle {
    font-size: var(--text-xs);
    color: var(--titlebar-text);
    font-family: 'SF Mono', monospace;
    margin-top: 2px;
}

.dialog-item-description {
    font-size: var(--text-xs);
    color: var(--titlebar-text);
    font-style: italic;
    margin-top: 2px;
}

.dialog-item-fields {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    min-width: 300px;
}

.dialog-item-field {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-sm);
}

.dialog-item-field.password-edit-field {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.dialog-item-field-label {
    color: var(--titlebar-text);
    min-width: 70px;
    flex-shrink: 0;
    font-size: var(--text-sm);
}

.dialog-item-field-value {
    font-family: 'SF Mono', monospace;
    color: var(--text-color);
}

.dialog-item-actions {
    display: flex;
    gap: 6px;
    margin-left: 12px;
}

/* ============================================
   FORM FIELDS (for form-type lists)
   ============================================ */

.dialog-form {
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 24px;
}

.dialog-form-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dialog-form-row.full-width {
    grid-column: 1 / -1;
}

.dialog-form-label {
    font-size: var(--dialog-label-font-size);
    font-weight: 600;
    color: var(--text-color);
}

.dialog-form-field {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dialog-form-input {
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: var(--text-base);
    font-family: 'SF Mono', 'Menlo', monospace;
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.dialog-form-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.dialog-form-input:disabled,
.dialog-form-input[readonly] {
    background: rgba(240, 240, 240, 0.9);
    color: var(--titlebar-text);
}

.dialog-form-hint {
    font-size: var(--dialog-hint-font-size);
    color: var(--titlebar-text);
    margin-top: 2px;
}

.dialog-form-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.dialog-form-input-wrapper input {
    flex: 1;
    padding-right: 60px;
}

.dialog-form-input-icons {
    position: absolute;
    right: 6px;
    display: flex;
    gap: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .dialog {
        width: 100% !important;
        height: 100% !important;
        max-width: 100% !important;
        max-height: 100% !important;
        border-radius: 0;
    }
    
    .dialog-tabs {
        padding: 0 12px;
    }
    
    .dialog-tab {
        padding: 10px 14px;
        font-size: var(--text-sm);
    }
    
    .dialog-form {
        grid-template-columns: 1fr;
    }
    
    .dialog-form-row.full-width {
        grid-column: 1;
    }
}

/* ============================================
   MENU CONTENT RENDERER - List & Detail Panels
   ============================================ */

/* Content List Panel */
.content-list-panel {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    padding: 8px;
}

.content-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.content-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid transparent;
}

.content-list-item:hover {
    background: rgba(217, 234, 255, 0.6);
    border-color: var(--border-color);
}

.content-list-item.selected {
    background: linear-gradient(180deg, var(--light-blue), rgba(198, 226, 255, 0.9));
    border-color: var(--primary-blue);
}

.content-list-item-icon {
    font-size: var(--text-lg);
    flex-shrink: 0;
}

.content-list-item-info {
    flex: 1;
    min-width: 0;
}

.content-list-item-name {
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.content-list-item-count {
    font-size: var(--text-xs);
    color: var(--titlebar-text);
    margin-top: 2px;
}

/* Content Tab Bar */
.content-tab-bar {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    padding: 4px;
}

.content-tab {
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--titlebar-text);
    transition: all 0.15s ease;
}

.content-tab:hover {
    background: rgba(255, 255, 255, 0.7);
    color: var(--text-color);
}

.content-tab.active {
    background: linear-gradient(180deg, var(--light-blue), rgba(198, 226, 255, 0.9));
    border-color: var(--primary-blue);
    color: var(--text-color);
    font-weight: 600;
}

/* Content Detail Panel */
.content-detail-panel {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    padding: 16px;
}

.detail-content-inner {
    max-width: 600px;
}

.detail-title {
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 16px;
}

.detail-fields {
    display: flex;
    flex-direction: column;
}

.detail-field:last-child {
    border-bottom: none;
}

.detail-children {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* Content Split Layouts */
.content-split,
.content-triple-split {
    display: flex;
    height: 100%;
    gap: 16px;
}

.content-tabs-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.content-tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
}

/* ============================================
   WIZARD DIALOG STYLES
   ============================================ */

.wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.wizard-step.active {
    background: linear-gradient(180deg, var(--light-blue), rgba(198, 226, 255, 0.9));
    border: 1px solid var(--primary-blue);
}

.wizard-step.completed {
    background: linear-gradient(180deg, #d9f5e8, #c6eedd);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.wizard-step-number {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 600;
}

.wizard-step.active .wizard-step-number {
    background: var(--primary-blue);
    color: white;
}

.wizard-step.completed .wizard-step-number {
    background: var(--success-green);
    color: white;
}

.wizard-step-label {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--titlebar-text);
}

.wizard-step.active .wizard-step-label {
    color: var(--text-color);
    font-weight: 600;
}

.wizard-step-connector {
    color: var(--titlebar-text);
    font-size: var(--text-base);
}

.wizard-pane {
    display: none;
}

.wizard-pane.active {
    display: block;
}

/* Password Composer Styles */
#composer-word-options .btn {
    transition: all 0.15s;
}

#composer-word-options .btn:hover {
    background: linear-gradient(180deg, var(--light-blue), rgba(198, 226, 255, 0.9));
    transform: scale(1.05);
}

.composer-sep {
    min-width: 32px;
}

.composer-sep.btn-primary {
    background: linear-gradient(180deg, #0066cc, #0055aa);
    color: white;
}

#terminal-dialog-command-text::placeholder {
    color: var(--text-muted);
}
