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

:root {
    --bg-color: #1a1a1a;
    --page-bg: #2d2d2d;
    --page-margin: 0px;
    --page-padding: 20px;
    --page-border-radius: 8px;
    --page-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --page-font-size: 14px;
    --page-opacity: 1;
    --page-color: #e0e0e0;
    --page-title-font-size: 18px;
    --page-title-color: #ffffff;
    --page-title-margin-bottom: 15px;
    --element-bg: transparent;
    --element-margin: 0px;
    --element-padding: 10px;
    --element-font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --element-font-size: 14px;
    --element-opacity: 1;
    --element-color: #e0e0e0;
    --element-hover-bg: #363636;
    --header-font-size: 16px;
    --header-color: #b8b8b8;
    --header-margin: 10px 0;
    --checkbox-size: 18px;
    
    /* Z-Index constants (matching AppConstants.UI.Z_INDEX) */
    --z-index-base: 10;
    --z-index-overlay: 100;
    --z-index-modal: 1000;
    --z-index-dropdown: 2000;
    --z-index-dropdown-count: 2001;
    --z-index-max-modal: 3000;
    --z-index-tooltip: 10000;
    --z-index-chat-window: 10000;
    --z-index-max: 10001;
}

body {
    font-family: var(--page-font-family);
    background: var(--bg-color);
    color: var(--page-color);
    line-height: 1.6;
    font-size: var(--page-font-size);
}

#app {
    max-width: 100%;
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: #2d2d2d;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 0;
    padding: 10px 20px;
    flex-shrink: 0;
    min-height: 60px;
    box-sizing: border-box;
    position: relative;
    z-index: var(--z-index-base);
}

header#top-bar {
    transition: height 0.3s ease, opacity 0.3s ease, padding 0.3s ease, min-height 0.3s ease;
    overflow: visible;
    position: relative;
    z-index: var(--z-index-dropdown);
}

header#top-bar.collapsed {
    height: 0;
    min-height: 0;
    padding: 0;
    opacity: 0;
    overflow: visible;
    margin-bottom: 0;
    border: none;
}

header h1 {
    margin-bottom: 15px;
    color: #ffffff;
}

.controls {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 10px;
    position: relative;
    z-index: var(--z-index-dropdown);
}

.project-group-input-wrap {
    position: relative;
    display: inline-block;
}

.project-group-clear-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    color: #888;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-group-clear-btn:hover {
    color: #e0e0e0;
    background: rgba(255, 255, 255, 0.1);
}

.project-group-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 2px;
    max-height: 220px;
    overflow-y: auto;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: var(--z-index-dropdown);
    list-style: none;
    padding: 4px 0;
}

.project-group-autocomplete.hidden {
    display: none;
}

.project-group-autocomplete .project-group-ac-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: #e0e0e0;
}

.project-group-autocomplete .project-group-ac-item:hover,
.project-group-autocomplete .project-group-ac-item.selected {
    background: rgba(255, 255, 255, 0.08);
}

.dropdown {
    position: relative;
    display: inline-block;
    vertical-align: top;
    z-index: var(--z-index-dropdown);
}

.dropdown-toggle {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    border-radius: 0;
    margin: 0;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
}

.dropdown-toggle:hover {
    background: #3d3d3d;
}

.dropdown-icon .dropdown-toggle-icon {
    padding: 8px 12px;
    width: auto;
    font-size: 18px;
    min-width: auto;
}

.dropdown-icon .dropdown-toggle-icon:hover {
    background: #3d3d3d;
}

.dropdown-icon .dropdown-menu {
    left: auto;
    right: 0;
}

.dropdown-toggle.active {
    background: #3d3d3d;
}

.dropdown-arrow {
    font-size: 10px;
    transition: transform 0.2s;
    display: inline-block;
}

.dropdown-toggle.active .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    max-height: 0;
    overflow: hidden;
    background: #2d2d2d;
    border: none;
    border-radius: 0 0 4px 4px;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    padding: 0;
    min-width: 220px;
    width: max-content;
    z-index: var(--z-index-dropdown);
    display: block;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.dropdown-menu.active {
    max-height: 500px;
    padding: 4px 0;
    border-left: 1px solid #404040;
    border-right: 1px solid #404040;
    border-bottom: 1px solid #404040;
    border-top: 1px solid #3d3d3d;
    transition: max-height 0.3s ease-in, padding 0.3s ease-in, border 0.3s ease-in;
    display: block;
}

.dropdown-menu button {
    display: block;
    width: 100%;
    padding: 8px 20px 8px 32px;
    border: none;
    background: transparent;
    color: #e0e0e0;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s;
    border-radius: 0;
    margin: 0;
    white-space: nowrap;
    position: relative;
    opacity: 1;
    visibility: visible;
}

.dropdown-menu button::before {
    content: '';
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: #888888;
    border-radius: 50%;
    opacity: 0.5;
}

.dropdown-menu button:hover {
    background: #4a9eff;
    color: #ffffff;
}

.dropdown-menu button:hover::before {
    background: #ffffff;
    opacity: 0.8;
}

.dropdown-menu button:active {
    background: #3d8ef5;
}

.settings-btn {
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s, transform 0.2s;
    border-radius: 4px;
    margin-left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-btn:hover {
    background: #3d3d3d;
    transform: rotate(90deg);
}

.settings-btn:active {
    transform: rotate(90deg) scale(0.95);
}

.settings-modal-content {
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    padding-top: 20px; /* Override the default padding-top for settings modal */
}

.settings-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #404040;
}

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

.settings-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    transition: background 0.2s;
    padding: 8px;
    margin-left: -8px;
    margin-right: -8px;
    border-radius: 4px;
}

.settings-section-title:hover {
    background: #3d3d3d;
}

.settings-toggle-arrow {
    font-size: 12px;
    transition: transform 0.2s;
    display: inline-block;
    width: 16px;
    text-align: center;
}

.settings-section-title.collapsed .settings-toggle-arrow {
    transform: rotate(-90deg);
}

.settings-section-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
}

.settings-subsection {
    margin-left: 20px;
    margin-bottom: 15px;
    padding-left: 15px;
    border-left: 2px solid #404040;
}

.settings-subsection-title {
    font-size: 14px;
    font-weight: 600;
    color: #d0d0d0;
    margin-bottom: 12px;
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
    transition: background 0.2s;
    padding: 6px;
    margin-left: -6px;
    margin-right: -6px;
    border-radius: 4px;
}

.settings-subsection-title:hover {
    background: #3d3d3d;
}

.settings-subsection-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
    margin-top: 8px;
}

.settings-control {
    margin-bottom: 15px;
}

.settings-control label {
    display: block;
    margin-bottom: 4px;
    font-size: 14px;
    color: #e0e0e0;
    font-weight: normal;
}

.settings-control-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.settings-control input[type="text"],
.settings-control input[type="number"],
.settings-control input[type="color"],
.settings-control select {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #555555;
    border-radius: 4px;
    font-size: 14px;
    background: #1a1a1a;
    color: #e0e0e0;
}

.settings-control input[type="color"] {
    width: 50px;
    height: 35px;
    padding: 2px;
    cursor: pointer;
}

.settings-control input[type="number"] {
    width: 80px;
    flex: 0 0 80px;
}

.settings-control input[type="range"] {
    flex: 1;
    height: 6px;
    background: #404040;
    border-radius: 3px;
    outline: none;
}

.settings-control input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: #4a9eff;
    border-radius: 50%;
    cursor: pointer;
}

.settings-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #4a9eff;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.settings-reset-btn {
    margin-top: 20px;
    padding: 8px 16px;
    border: none;
    background: #555555;
    color: #ffffff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
}

.settings-reset-btn:hover {
    background: #666666;
}

.pages-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.page {
    background: var(--page-bg);
    border-radius: var(--page-border-radius);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    padding: var(--page-padding);
    margin: var(--page-margin);
    border: 1px solid #3d3d3d;
    cursor: grab;
    transition: opacity 0.2s, border-color 0.2s, background 0.2s;
    opacity: var(--page-opacity);
    font-family: var(--page-font-family);
    font-size: var(--page-font-size);
    color: var(--page-color);
}

.page:active {
    cursor: grabbing;
}

.page.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.page.drag-over {
    border-color: #4a9eff;
    background: #3a3a3a;
    box-shadow: 0 0 10px rgba(74, 158, 255, 0.3);
}

.pages-container.drag-over {
    border: 2px dashed #4a9eff;
    border-radius: 8px;
    padding: 10px;
    margin: -10px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #404040;
}

.page-toggle-arrow {
    font-size: 14px;
    transition: color 0.2s;
}

.page-toggle-arrow:hover {
    color: #b0b0b0;
}

.page-title {
    font-size: var(--page-title-font-size);
    font-weight: 600;
    color: var(--page-title-color);
    margin-bottom: var(--page-title-margin-bottom);
}

.page-controls {
    display: flex;
    gap: 8px;
}

.page-controls button {
    padding: 4px 8px;
    border: none;
    background: #ff5555;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.page-controls button:hover {
    background: #ff7777;
}

.elements-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.element {
    position: relative;
    padding: var(--element-padding);
    margin: var(--element-margin);
    border-radius: 4px;
    transition: background 0.2s, opacity 0.2s, border-color 0.2s, box-shadow 0.2s;
    cursor: grab;
    background: var(--element-bg);
    font-family: var(--element-font-family);
    font-size: var(--element-font-size);
    opacity: var(--element-opacity);
    color: var(--element-color);
    -webkit-user-select: none;
    user-select: none;
}

.element:active {
    cursor: grabbing;
}

.element.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.element.drag-over {
    border: 2px solid #4a9eff;
    background: #363636;
    box-shadow: 0 0 10px rgba(74, 158, 255, 0.3);
}

.element:hover {
    background: var(--element-hover-bg);
}

.element.task {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.element.task .task-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.element.task input[type="checkbox"] {
    margin-top: 3px;
    width: var(--checkbox-size, 18px);
    height: var(--checkbox-size, 18px);
    cursor: pointer;
}

.element.task .task-text {
    flex: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    -webkit-user-select: none;
    user-select: none;
}

.element.task .task-text .subtask-arrow {
    color: #888888;
    font-size: 12px;
    user-select: none;
    display: inline-block;
    width: 14px;
}

.element.header {
    font-size: var(--header-font-size);
    font-weight: 600;
    color: var(--header-color);
    padding: 8px 0;
    border-bottom: 1px solid #404040;
    margin: var(--header-margin);
}

.element.header-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--header-font-size);
    font-weight: 600;
    color: var(--header-color);
    padding: 8px 0;
    border-bottom: 1px solid #404040;
    margin: var(--header-margin);
}

.element.header-checkbox input[type="checkbox"] {
    width: var(--checkbox-size, 18px);
    height: var(--checkbox-size, 18px);
    cursor: pointer;
}

.element.subtask-container {
    margin-top: 5px;
    margin-left: 80px;
    padding-left: 20px;
    border-left: 2px solid #404040;
}

.element.subtask-container .dropdown-content {
    display: block;
    margin-top: 5px;
}

.element.subtask {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    margin-bottom: 8px;
    width: 100%;
}

.element.subtask input[type="checkbox"] {
    width: var(--checkbox-size, 18px);
    height: var(--checkbox-size, 18px);
    cursor: pointer;
}

.element.multi-checkbox {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.element.multi-checkbox .multi-checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.element.multi-checkbox .multi-checkbox-row input[type="checkbox"] {
    width: var(--checkbox-size, 18px);
    height: var(--checkbox-size, 18px);
    cursor: pointer;
}

.element.multi-checkbox .multi-checkbox-row .checkbox-label {
    flex: 1;
}

.element.multi-checkbox .multi-checkbox-controls {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

.element.multi-checkbox .multi-checkbox-controls button {
    padding: 4px 8px;
    border: none;
    background: #555555;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.element.multi-checkbox .multi-checkbox-controls button:hover {
    background: #666666;
}

.element.completed {
    opacity: 0.6;
    text-decoration: line-through;
}

.tooltip {
    position: fixed;
    background: #000000;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: var(--z-index-modal);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    border: 1px solid #333333;
    top: 20px;
    left: 20px;
}

.tooltip.visible {
    opacity: 1;
}

.element.one-time {
    background: #3d3520;
    border-left: 3px solid #ffaa00;
}

/* One-time tasks remain visible when completed - they'll be deleted on day reset */
.element.one-time.completed {
    opacity: 0.7; /* Slightly faded to show it's completed, but still visible */
}

.add-element-btn {
    margin-top: 10px;
    padding: 8px 16px;
    border: 1px dashed #555555;
    background: transparent;
    color: #888888;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

.add-element-btn:hover {
    background: #363636;
    border-color: #666666;
    color: #b0b0b0;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: var(--z-index-modal);
    align-items: center;
    justify-content: center;
}

.modal[style*="display: flex"],
.modal[style*="display:flex"] {
    display: flex !important;
}

.modal.active {
    display: flex !important;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 1;
    cursor: pointer;
}

.modal-content {
    position: relative;
    background: #2d2d2d;
    padding: 0;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid #404040;
    color: #e0e0e0;
    pointer-events: auto;
    z-index: 2;
}

.modal-header {
    position: relative;
    padding: 20px;
    padding-right: 50px;
    border-bottom: 1px solid #404040;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    color: #ffffff;
    font-size: 20px;
}

.modal-header .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: var(--z-index-base);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #404040;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-shrink: 0;
}

.modal-content h3 {
    margin-bottom: 15px;
    color: #ffffff;
}

.modal-content label {
    display: block;
    margin-bottom: 4px;
    font-weight: normal;
    font-size: 14px;
}

.modal-content input,
.modal-content textarea,
.modal-content select {
    width: 100%;
    padding: 8px;
    border: 1px solid #555555;
    border-radius: 4px;
    margin-bottom: 15px;
    font-size: 14px;
    background: #1a1a1a;
    color: #e0e0e0;
}

.modal-content input:focus,
.modal-content textarea:focus,
.modal-content select:focus {
    outline: none;
    border-color: #4a9eff;
}

.modal-content textarea {
    min-height: 80px;
    resize: vertical;
}

.modal-content button {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    background: #3498db;
    color: white;
    cursor: pointer;
    margin-right: 10px;
}

.modal-content button.cancel {
    background: #555555;
}

.modal-content button.cancel:hover {
    background: #666666;
}

.modal-content button:hover {
    opacity: 0.9;
}

.context-menu {
    position: fixed;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    z-index: var(--z-index-max-modal);
    display: none;
    min-width: 150px;
}

.context-menu.active {
    display: block;
}

.context-menu-item {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    color: #e0e0e0;
}

.context-menu-item:hover {
    background: #3d3d3d;
}

.context-menu-item:first-child {
    border-radius: 4px 4px 0 0;
}

.context-menu-item:last-child {
    border-radius: 0 0 4px 4px;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #888888;
}

.modal-close:hover {
    color: #ffffff;
}

/* Floating panels (rom-browser style) */
.feat-panel {
    display: none;
    position: fixed;
    top: max(12px, env(safe-area-inset-top, 12px));
    left: 50%;
    transform: translateX(-50%);
    width: 480px;
    min-width: 360px;
    max-width: min(480px, calc(100vw - 24px));
    height: fit-content;
    min-height: 200px;
    max-height: calc(100dvh - 24px);
    flex-direction: column;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: var(--z-index-dropdown);
    overflow: hidden;
    box-sizing: border-box;
    touch-action: none;
    color: var(--page-color);
}
.feat-panel.open {
    display: flex;
}
.feat-panel.docked-left {
    top: 0;
    left: 0;
    right: auto;
    bottom: 0;
    transform: none;
    width: min(420px, 90vw);
    height: 100vh;
    height: 100dvh;
    max-height: none;
    max-width: none;
    border-radius: 0;
    border-left: none;
    border-right: 1px solid #404040;
}
.feat-panel-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #1a1a1a;
    border-bottom: 1px solid #404040;
    cursor: move;
    user-select: none;
}
.feat-panel-title {
    font-size: 12px;
    font-weight: 600;
    color: #a0a0a0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.feat-panel-actions { display: flex; align-items: center; gap: 4px; }
.feat-panel-btn-small {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #a0a0a0;
    font-size: 14px;
    cursor: pointer;
}
.feat-panel-btn-small:hover { background: #3d3d3d; color: #e0e0e0; }
.feat-panel-close {
    padding: 2px 8px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #a0a0a0;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.feat-panel-close:hover { background: #3d3d3d; color: #e0e0e0; }
.feat-panel-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.feat-panel-footer {
    padding: 12px;
    border-top: 1px solid #404040;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-shrink: 0;
}
.settings-panel .settings-panel-body {
    max-height: calc(100dvh - 180px);
}
.settings-panel .settings-body {
    padding: 0;
}
/* Resize handles */
.feat-panel-resize-n, .feat-panel-resize-s {
    position: absolute;
    left: 8px; right: 8px; height: 8px;
    cursor: ns-resize;
}
.feat-panel-resize-n { top: 0; }
.feat-panel-resize-s { bottom: 0; }
.feat-panel-resize-e, .feat-panel-resize-w {
    position: absolute;
    top: 8px; bottom: 8px; width: 8px;
    cursor: ew-resize;
}
.feat-panel-resize-e { right: 0; }
.feat-panel-resize-w { left: 0; }
.feat-panel-resize-ne, .feat-panel-resize-nw,
.feat-panel-resize-se, .feat-panel-resize-sw {
    position: absolute;
    width: 12px; height: 12px;
}
.feat-panel-resize-ne { top: 0; right: 0; cursor: nesw-resize; }
.feat-panel-resize-nw { top: 0; left: 0; cursor: nwse-resize; }
.feat-panel-resize-se { bottom: 0; right: 0; cursor: nwse-resize; }
.feat-panel-resize-sw { bottom: 0; left: 0; cursor: nesw-resize; }
.feat-panel.docked-left .feat-panel-resize-n,
.feat-panel.docked-left .feat-panel-resize-s,
.feat-panel.docked-left .feat-panel-resize-w,
.feat-panel.docked-left .feat-panel-resize-ne,
.feat-panel.docked-left .feat-panel-resize-nw,
.feat-panel.docked-left .feat-panel-resize-se,
.feat-panel.docked-left .feat-panel-resize-sw { display: none; }
.feat-panel.docked-left .feat-panel-resize-e { cursor: col-resize; }

.data-display {
    font-family: 'Courier New', monospace;
    background: #1a1a1a;
    padding: 15px;
    border-radius: 4px;
    max-height: 400px;
    overflow-y: auto;
    font-size: 13px;
    color: #e0e0e0;
    border: 1px solid #404040;
}

.data-display pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.data-field {
    margin-bottom: 10px;
}

.data-field strong {
    color: #ffffff;
    display: inline-block;
    min-width: 120px;
}

.subtask-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.subtask-item input {
    flex: 1;
    background: #1a1a1a;
    color: #e0e0e0;
    border: 1px solid #555555;
    border-radius: 4px;
    padding: 6px;
}

.subtask-item input:focus {
    outline: none;
    border-color: #4a9eff;
}

.subtask-item button {
    padding: 4px 8px;
    background: #ff5555;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.subtask-item button:hover {
    background: #ff7777;
}

.edit-subtasks-container {
    max-height: 300px;
    overflow-y: auto;
    margin-top: 10px;
    padding: 10px;
    background: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 4px;
}

.edit-subtask-repeat-label {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    font-size: 13px;
    color: #e0e0e0;
}

.remove-subtask-btn {
    padding: 4px 8px;
    background: #ff5555;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    min-width: 28px;
}

.remove-subtask-btn:hover {
    background: #ff7777;
}

.subtask-modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.add-subtask-btn {
    padding: 6px 12px;
    background: #4a9eff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.add-subtask-btn:hover {
    background: #5baaff;
}

.remove-all-subtasks-btn {
    padding: 6px 12px;
    background: #ff5555;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.remove-all-subtasks-btn:hover {
    background: #ff7777;
}

.subtask-actions {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #404040;
}

.subtask-actions button {
    margin-right: 8px;
}

/* ============================================
   New Layout Styles (Projects/Sections)
   ============================================ */

/* Main Layout */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    height: calc(100vh - 60px);
}

/* Projects Sidebar */
.projects-sidebar {
    width: 250px;
    background: var(--page-bg, #252525);
    border-right: 1px solid #404040;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
    color: var(--page-color, #e0e0e0);
    font-family: var(--page-font-family);
    font-size: var(--page-font-size);
    transition: width 0.3s ease, opacity 0.3s ease;
}

.projects-sidebar.collapsed {
    width: 0;
    opacity: 0;
    overflow: hidden;
    border-right: none;
}

.pane-toggle-btn-collapsed {
    position: fixed;
    z-index: 2000;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 4px;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 16px;
    padding: 8px 12px;
    transition: background 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.pane-toggle-btn-collapsed:hover {
    background: #3d3d3d;
}

#toggle-projects-sidebar-collapsed {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    border-left: none;
    border-radius: 0 4px 4px 0;
}

#toggle-references-panel-collapsed {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    border-right: none;
    border-radius: 4px 0 0 4px;
}

#toggle-top-bar-collapsed {
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    border-top: none;
    border-radius: 0 0 4px 4px;
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #404040;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    margin: 0;
    color: #ffffff;
    font-size: 16px;
}

.btn-icon {
    background: transparent;
    border: none;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: #3d3d3d;
}

.projects-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.project-item {
    padding: 12px;
    margin-bottom: 8px;
    background: var(--element-bg, #2d2d2d);
    border-radius: var(--page-border-radius, 6px);
    cursor: pointer;
    transition: background 0.2s, border 0.2s;
    border: 2px solid transparent;
    color: var(--element-color, #e0e0e0);
    font-family: var(--element-font-family);
    font-size: var(--element-font-size);
}

.project-item:hover {
    background: var(--element-hover-bg, #353535);
}

.project-item.active {
    border-color: #4a9eff;
    background: #353535;
}

.project-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.project-status {
    font-size: 12px;
    color: #888;
}

.project-name {
    font-weight: 500;
    color: #ffffff;
    flex: 1;
}

.project-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #888;
    margin-top: 4px;
}

.project-workflow {
    text-transform: uppercase;
    font-size: 10px;
}

.project-progress {
    font-weight: 500;
}

.empty-message {
    padding: 20px;
    text-align: center;
    color: #888;
    font-style: italic;
}

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-color);
    color: var(--page-color);
    font-family: var(--page-font-family);
    font-size: var(--page-font-size);
    position: relative;
    z-index: var(--z-index-base);
}

.main-content.collapsed > *:not(.view-toggle) {
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}

.main-content.collapsed .view-toggle {
    opacity: 1 !important;
    pointer-events: auto !important;
    position: relative;
    z-index: 100;
    background: var(--bg-color);
    border-bottom: 1px solid #404040;
}


.main-content.collapsed .view-toggle .view-btn {
    opacity: 0.3;
    pointer-events: none;
}

.view-toggle {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #404040;
    padding: 0 20px;
    background: #252525;
}

.view-btn {
    padding: 10px 20px;
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}

.view-btn:hover {
    color: #e0e0e0;
}

.view-btn.active {
    color: #4a9eff;
    border-bottom-color: #4a9eff;
}

.content-view {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.section-view-placeholder,
.pipeline-flow-placeholder {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-style: italic;
}

/* Section View */
.section-view-content {
    max-width: 1200px;
    margin: 0 auto;
}

.section-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #404040;
}

.section-title-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.section-title-nav .btn-nav-arrow {
    padding: 8px 12px;
    min-width: 40px;
    background: #2d2d2d;
    border: 1px solid #404040;
    color: #e0e0e0;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
    transition: background 0.2s;
}

.section-title-nav .btn-nav-arrow:hover:not(:disabled) {
    background: #3d3d3d;
}

.section-title-nav .btn-nav-arrow:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.section-title-nav .section-title-select {
    flex: 1;
    max-width: 400px;
    padding: 10px 14px;
    background: #2d2d2d;
    border: 1px solid #404040;
    color: var(--page-title-color, #ffffff);
    font-size: var(--page-title-font-size, 24px);
    font-family: var(--page-font-family);
    border-radius: 4px;
    cursor: pointer;
}

.section-title-nav .section-title-select:focus {
    outline: none;
    border-color: #4a9eff;
}

.section-automation-id-row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    padding: 8px;
    background: #1a1a1a;
    border-radius: 4px;
    border: 1px solid #404040;
}

.automation-id-input {
    padding: 4px 8px;
    border: 1px solid #404040;
    background: #1a1a1a;
    color: #e0e0e0;
    border-radius: 4px;
    font-size: 12px;
    width: 100px;
    font-family: 'Courier New', monospace;
}

.automation-id-input:focus {
    outline: none;
    border-color: #4a9eff;
    background: #2d2d2d;
}

.automation-id-status {
    font-size: 11px;
    margin-left: 8px;
    font-weight: 500;
}

.section-status {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-not-started {
    background: #404040;
    color: #888;
}

.status-in-progress {
    background: #4a9eff;
    color: #ffffff;
}

.status-complete {
    background: #4caf50;
    color: #ffffff;
}

.status-needs-revision {
    background: #ff9800;
    color: #ffffff;
}

.section-locked {
    background: #3d2d1a;
    border: 1px solid #ff9800;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
    color: #ffcc80;
}

.section-locked ul {
    margin: 10px 0 0 20px;
}

/* Breadcrumb Navigation */
.breadcrumb {
    margin-bottom: 12px;
    padding: 8px 0;
}

.breadcrumb-list {
    display: flex;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    gap: 4px;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-link {
    background: transparent;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    transition: color 0.2s, background 0.2s;
    text-decoration: none;
}

.breadcrumb-link:hover {
    color: #4a9eff;
    background: #2d2d2d;
}

.breadcrumb-link:focus {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

.breadcrumb-separator {
    color: #666;
    margin: 0 4px;
    font-size: 14px;
    user-select: none;
}

.breadcrumb-current {
    color: #e0e0e0;
    font-weight: 500;
    padding: 4px 8px;
}

/* Responsive: collapse breadcrumb on small screens */
@media (max-width: 768px) {
    .breadcrumb-list {
        font-size: 12px;
    }
    
    .breadcrumb-link,
    .breadcrumb-current {
        padding: 2px 6px;
    }
    
    .breadcrumb-separator {
        margin: 0 2px;
    }
}

/* Progress Bar */
.progress-bar-container {
    margin: 12px 0;
    padding: 12px;
    background: #2d2d2d;
    border-radius: 6px;
    border: 1px solid #404040;
}

.progress-bar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.progress-label {
    color: #e0e0e0;
    font-weight: 500;
}

.progress-count {
    color: #888;
    font-size: 12px;
}

.progress-bar {
    display: flex;
    height: 24px;
    background: #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid #404040;
    cursor: pointer;
}

.progress-segment {
    height: 100%;
    transition: opacity 0.2s;
    border-right: 1px solid #1a1a1a;
}

.progress-segment:last-child {
    border-right: none;
}

.progress-segment:hover {
    opacity: 0.8;
    filter: brightness(1.2);
}

.progress-segment-not_started {
    background: #404040;
}

.progress-segment-in_progress {
    background: #4a9eff;
}

.progress-segment-complete {
    background: #4caf50;
}

.progress-segment-needs_revision {
    background: #ff9800;
}

/* Progress bar in project sidebar */
.project-item .progress-bar-container {
    margin: 8px 0 0 0;
    padding: 8px;
    background: #1a1a1a;
}

.project-item .progress-bar {
    height: 16px;
}

.project-item .progress-bar-header {
    margin-bottom: 4px;
    font-size: 11px;
}

.project-item .progress-label,
.project-item .progress-count {
    font-size: 11px;
}

.section-panels {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.section-panel {
    background: var(--element-bg, #2d2d2d);
    border-radius: var(--page-border-radius, 6px);
    border: 1px solid #404040;
    overflow: hidden;
    color: var(--element-color, #e0e0e0);
    font-family: var(--element-font-family);
    font-size: var(--element-font-size);
    padding: var(--element-padding, 0);
    margin: var(--element-margin, 0);
}

.panel-header {
    padding: 12px 16px;
    background: var(--page-bg, #252525);
    border-bottom: 1px solid #404040;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--page-color, #ffffff);
    font-family: var(--page-font-family);
    font-size: var(--page-font-size);
}

.panel-header h3 {
    margin: 0;
    font-size: 14px;
    color: #ffffff;
    font-weight: 500;
}

.panel-content {
    padding: 16px;
}

.panel-content.collapsed {
    display: none;
}

.prompt-text {
    background: #1a1a1a;
    padding: 12px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    color: #e0e0e0;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.section-input,
.section-output,
.section-notes,
.section-override-instructions {
    width: 100%;
    min-height: 200px;
    padding: 12px;
    background: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 4px;
    color: #e0e0e0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
}

.section-output {
    min-height: 300px;
}

.section-notes {
    min-height: 100px;
}

.btn-copy,
.btn-paste,
.btn-complete,
.btn-revision,
.btn-collapse {
    padding: 6px 12px;
    background: #4a9eff;
    border: none;
    color: #ffffff;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    transition: background 0.2s;
}

.btn-copy:hover,
.btn-paste:hover {
    background: #3d8ef5;
}

.btn-complete {
    background: #4caf50;
}

.btn-complete:hover {
    background: #45a049;
}

.btn-revision {
    background: #ff9800;
}

.btn-revision:hover {
    background: #f57c00;
}

.btn-collapse {
    background: transparent;
    color: #888;
    padding: 4px 8px;
}

.btn-collapse:hover {
    background: #3d3d3d;
    color: #e0e0e0;
}

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

/* Pipeline Flow View */
.pipeline-flow-content {
    max-width: 1200px;
    margin: 0 auto;
}

.pipeline-flow-content h2 {
    color: #ffffff;
    margin-bottom: 20px;
}

.pipeline-sections {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pipeline-section-item {
    padding: 12px 16px;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.2s, border-color 0.2s;
}

.pipeline-section-item:hover:not(.locked) {
    background: #353535;
    border-color: #4a9eff;
}

.pipeline-section-item.locked {
    opacity: 0.5;
    cursor: not-allowed;
}

.pipeline-section-item.active {
    background: #353535;
    border-color: #4a9eff;
    border-width: 2px;
}

.section-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.section-name {
    flex: 1;
    color: #e0e0e0;
}

.section-status {
    color: #888;
    font-size: 14px;
}

/* Reference Documents Panel */
.references-panel {
    position: fixed;
    right: 0;
    top: 0;
    width: 400px;
    height: 100vh;
    background: #252525;
    border-left: 1px solid #404040;
    display: flex;
    flex-direction: column;
    z-index: var(--z-index-modal);
    box-shadow: -2px 0 8px rgba(0,0,0,0.3);
    transition: width 0.3s ease, opacity 0.3s ease;
}

.references-panel.collapsed {
    width: 0;
    opacity: 0;
    overflow: hidden;
    border-left: none;
}

.panel-header {
    padding: 15px;
    border-bottom: 1px solid #404040;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0;
    color: #ffffff;
    font-size: 16px;
}

.panel-search {
    padding: 15px;
    border-bottom: 1px solid #404040;
    flex-shrink: 0;
}

.panel-search input {
    width: 100%;
    padding: 8px 12px;
    background: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 14px;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
}

.references-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reference-item {
    padding: 12px;
    background: #2d2d2d;
    border-radius: 6px;
    border: 1px solid #404040;
}

.reference-item h4 {
    margin: 0 0 8px 0;
    color: #ffffff;
    font-size: 14px;
}

.btn-view {
    padding: 6px 12px;
    background: #4a9eff;
    border: none;
    color: #ffffff;
    cursor: pointer;
    border-radius: 4px;
    font-size: 12px;
    transition: background 0.2s;
}

.btn-view:hover {
    background: #3d8ef5;
}

.reference-content {
    background: #1a1a1a;
    padding: 15px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    color: #e0e0e0;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 600px;
    overflow-y: auto;
}

.automation-btn {
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
    border-radius: 4px;
    margin-left: 10px;
}

.automation-btn:hover {
    background: #3d3d3d;
}

.automation-refresh-btn {
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s, transform 0.2s;
    border-radius: 4px;
    margin-left: 5px;
}

.automation-refresh-btn:hover {
    background: #3d3d3d;
    transform: rotate(90deg);
}

.automation-refresh-btn:active {
    transform: rotate(90deg) scale(0.95);
}

.references-btn {
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
    border-radius: 4px;
    margin-left: 10px;
}

.references-btn:hover {
    background: #3d3d3d;
}

.close-btn {
    background: transparent;
    border: none;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.close-btn:hover {
    background: #3d3d3d;
}

/* Case Badges */
.case-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 8px;
}

.case-badge.case-1 {
    background: #4a9eff;
    color: #ffffff;
}

.case-badge.case-2 {
    background: #9b59b6;
    color: #ffffff;
}

.case-badge.case-3 {
    background: #e67e22;
    color: #ffffff;
}

.case-chain-indicator {
    display: inline-block;
    margin-left: 8px;
    font-size: 14px;
    cursor: help;
}

.case-chain-info {
    display: inline-block;
    padding: 4px 8px;
    background: #3d3d3d;
    border-radius: 4px;
    font-size: 11px;
    color: #b8b8b8;
    margin-left: 8px;
}

.inference-count,
.process-count {
    display: inline-block;
    padding: 2px 6px;
    background: #2d2d2d;
    border-radius: 4px;
    font-size: 10px;
    color: #b8b8b8;
    margin-left: 4px;
}

/* Section Case Header */
.section-case-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #2d2d2d;
    border-bottom: 1px solid #404040;
    margin-bottom: 16px;
}

.workflow-context {
    margin-left: auto;
    font-size: 12px;
    color: #888888;
}

/* Section Type Badges */
.section-type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
}

.section-type-badge-optional {
    background: #6c757d;
    font-size: 0.85em;
    opacity: 0.8;
    margin-left: 8px;
}

.core-step-badge {
    background: #4a9eff;
    color: #ffffff;
}

.process-step-badge {
    background: #9b59b6;
    color: #ffffff;
}

.inference-step-badge {
    background: #e67e22;
    color: #ffffff;
}

/* Modifier Tags */
/* Modifiers as second line of prompt panel header - visible only when panel expanded */
.panel-header-modifiers {
    flex: 1 1 100%;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #404040;
}

.prompt-panel.is-collapsed .panel-header-modifiers {
    display: none;
}

.prompt-panel .panel-header {
    flex-wrap: wrap;
}

.prompt-panel .panel-header h3 {
    margin-right: auto;
}

.panel-header-modifiers .section-modifiers {
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
}

.panel-header-modifiers .section-modifiers .modifier-tags {
    flex-wrap: wrap;
}

.section-modifiers {
    padding: 12px 16px;
    background: #2d2d2d;
    border-bottom: 1px solid #404040;
    margin-bottom: 16px;
    position: relative;
}

.section-modifiers h4 {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #b8b8b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    user-select: none;
}

.section-modifiers.collapsed h4 {
    margin: 0;
    padding: 4px 0;
}

.section-modifiers.collapsed h4::after {
    content: ' (click to expand, right-click to edit)';
    font-size: 10px;
    color: #666;
    font-weight: normal;
    text-transform: none;
    letter-spacing: 0;
}

.section-modifiers .modifier-content {
    display: block;
}

.section-modifiers.collapsed .modifier-content {
    display: none;
}

.section-modifiers.collapsed {
    padding: 8px 16px;
    cursor: pointer;
}

.section-modifiers.collapsed:hover {
    background: #333333;
}

.modifier-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.modifier-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    position: relative;
}

.modifier-tag.base {
    background: #4a9eff;
    color: #ffffff;
}

.modifier-tag.layering {
    background: #e67e22;
    color: #ffffff;
}

.modifier-remove {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    cursor: pointer;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    padding: 0;
    transition: background 0.2s;
}

.modifier-remove:hover {
    background: rgba(255, 255, 255, 0.3);
}

.no-modifiers {
    color: #888888;
    font-size: 11px;
    font-style: italic;
}

.btn-edit-modifiers {
    padding: 4px 10px;
    background: #3d3d3d;
    border: 1px solid #555555;
    color: #e0e0e0;
    cursor: pointer;
    border-radius: 4px;
    font-size: 11px;
    transition: background 0.2s;
}

.btn-edit-modifiers:hover {
    background: #4d4d4d;
}

/* Inference Step Indicator */
.inference-step-indicator {
    padding: 12px 16px;
    background: #3d2d1a;
    border-left: 4px solid #e67e22;
    border-radius: 4px;
    margin-bottom: 16px;
}

.inference-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e67e22;
    color: #ffffff;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
}

.inference-step-indicator p {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: #b8b8b8;
}

/* Pipeline Flow View */
.pipeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #404040;
}

.pipeline-case-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pipeline-sections {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
}

.pipeline-section-item {
    padding: 12px 16px;
    background: #2d2d2d;
    border-radius: 6px;
    border: 1px solid #404040;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.pipeline-section-item:hover {
    background: #363636;
    border-color: #555555;
}

.pipeline-section-item.active {
    background: #3d3d3d;
    border-color: #4a9eff;
}

.pipeline-section-item.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.pipeline-section-item.core-step {
    border-left: 4px solid #4a9eff;
}

.pipeline-section-item.process-step {
    border-left: 4px solid #9b59b6;
}

.pipeline-section-item.inference-step {
    border-left: 4px solid #e67e22;
}

.section-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.section-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #888888;
}

.modifier-count {
    display: inline-block;
    padding: 2px 6px;
    background: #3d3d3d;
    border-radius: 4px;
    font-size: 10px;
}

/* Case Selection Modal */
.case-selection-content {
    max-width: 600px;
}

.automation-engine-selection {
    flex-shrink: 0;
}

.case-selection-layout {
    display: flex;
    gap: 20px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.case-selection-body {
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    max-height: calc(90vh - 300px);
    min-width: 0;
}

.case-selection-preview {
    width: 350px;
    padding: 20px;
    background: #1a1a1a;
    border-left: 1px solid #404040;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: calc(90vh - 300px);
}

.preview-placeholder {
    padding: 40px 20px;
    text-align: center;
    color: #888;
    font-style: italic;
}

.preview-content h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    color: #e0e0e0;
}

.preview-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    padding: 12px;
    background: #2d2d2d;
    border-radius: 6px;
}

.preview-stat {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.preview-stat-label {
    color: #b8b8b8;
}

.preview-stat-value {
    color: #e0e0e0;
    font-weight: 500;
}

.preview-sections-list {
    margin-bottom: 20px;
}

.preview-section-item {
    padding: 10px;
    margin-bottom: 8px;
    background: #2d2d2d;
    border-radius: 6px;
    border-left: 3px solid #4a9eff;
}

.preview-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.preview-section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: #4a9eff;
    color: #ffffff;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.preview-section-name {
    font-size: 13px;
    color: #e0e0e0;
    font-weight: 500;
}

.preview-section-deps {
    font-size: 11px;
    color: #888;
    margin-left: 32px;
    line-height: 1.4;
}

.preview-dependencies {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #404040;
}

.preview-dependencies h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #e0e0e0;
}

.dependency-chain {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dependency-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: #2d2d2d;
    border-radius: 4px;
    font-size: 12px;
}

.dependency-from {
    color: #4a9eff;
    font-weight: 500;
}

.dependency-arrow {
    color: #666;
}

.dependency-to {
    color: #e0e0e0;
}

/* Enhanced Automation Progress Styles */
.automation-progress-section {
    padding: 12px;
    background: #1a1a1a;
    border-radius: 6px;
    border: 1px solid #404040;
}

.automation-progress-bar-container {
    width: 100%;
    height: 24px;
    background: #2d2d2d;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #404040;
}

.automation-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4a9eff 0%, #3d8ef5 100%);
    transition: width 0.3s ease;
    border-radius: 12px;
}

.automation-steps-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 300px;
    overflow-y: auto;
}

.automation-step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #2d2d2d;
    border-radius: 6px;
    border-left: 3px solid #404040;
    font-size: 13px;
}

.automation-step-item.current {
    background: #2d3d4d;
    border-left-color: #4a9eff;
}

.automation-step-item.complete {
    border-left-color: #4caf50;
}

.automation-step-item.pending {
    opacity: 0.6;
}

.automation-step-checkbox {
    width: 18px;
    height: 18px;
    border: 2px solid #666;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.automation-step-checkbox.checked {
    background: #4caf50;
    border-color: #4caf50;
}

.automation-step-checkbox.checked::after {
    content: '✓';
    color: #ffffff;
    font-size: 12px;
    font-weight: bold;
}

.automation-step-name {
    flex: 1;
    color: #e0e0e0;
}

.automation-step-status {
    font-size: 11px;
    color: #888;
    padding: 2px 8px;
    background: #1a1a1a;
    border-radius: 4px;
}

.automation-step-status.running {
    color: #4a9eff;
    background: #2d3d4d;
}

.automation-step-status.complete {
    color: #4caf50;
}

.automation-step-status.error {
    color: #ff5722;
}

/* Template Selection Styles */
.template-selection {
    flex-shrink: 0;
}

.template-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #2d2d2d;
    border: 2px solid #404040;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.template-option:hover {
    border-color: #555555;
    background: #363636;
}

.template-option.selected {
    border-color: #4a9eff;
    background: #2d3d4d;
}

.template-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.template-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.template-name {
    font-size: 14px;
    color: #ffffff;
    font-weight: 500;
}

.template-description {
    font-size: 12px;
    color: #b8b8b8;
    line-height: 1.4;
}

/* Dependency Graph Styles */
.dependency-mini-graph {
    margin: 8px 0;
    padding: 8px 12px;
    background: #1a1a1a;
    border-radius: 6px;
    border-left: 3px solid #4a9eff;
}

.dependency-mini-label {
    font-size: 11px;
    color: #888;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dependency-mini-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.dependency-mini-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #2d2d2d;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.dependency-mini-item:hover {
    background: #353535;
}

.dependency-mini-icon {
    font-size: 12px;
}

.dependency-mini-name {
    color: #b8b8b8;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dependency-mini-item.status-complete .dependency-mini-icon {
    color: #4caf50;
}

.dependency-mini-item.status-in_progress .dependency-mini-icon {
    color: #4a9eff;
}

.dependency-mini-item.status-needs_revision .dependency-mini-icon {
    color: #ff9800;
}

.dependency-mini-item.status-not_started .dependency-mini-icon {
    color: #666;
}

.dependency-none {
    color: #888;
    font-size: 12px;
    font-style: italic;
}

/* Dependency Graph Panel */
.dependency-graph-panel {
    margin: 12px 0;
    background: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 6px;
    overflow: hidden;
}

.dependency-graph-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #2d2d2d;
    cursor: pointer;
    transition: background 0.2s;
}

.dependency-graph-panel-header:hover {
    background: #353535;
}

.dependency-graph-panel-title {
    margin: 0;
    font-size: 14px;
    color: #e0e0e0;
    font-weight: 500;
}

.dependency-graph-toggle {
    font-size: 12px;
    color: #888;
    user-select: none;
}

.dependency-graph-panel-content {
    padding: 16px;
    max-height: 600px;
    overflow-y: auto;
}

.dependency-graph-panel-content.collapsed {
    display: none;
}

/* Full Dependency Graph */
.dependency-graph-container {
    position: relative;
}

.dependency-circular-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #5a2d2d;
    border: 1px solid #ff5722;
    border-radius: 6px;
    color: #ffcc80;
    font-size: 13px;
    margin-bottom: 12px;
}

.warning-icon {
    font-size: 16px;
}

.dependency-graph-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px;
    background: #2d2d2d;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #b8b8b8;
}

.legend-icon {
    font-size: 14px;
    width: 18px;
    text-align: center;
}

.legend-icon.status-complete {
    color: #4caf50;
}

.legend-icon.status-in_progress {
    color: #4a9eff;
}

.legend-icon.status-not_started {
    color: #666;
}

.legend-badge.available {
    display: inline-block;
    padding: 2px 6px;
    background: #2d5a3d;
    color: #4caf50;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.dependency-graph-content {
    position: relative;
    min-height: 200px;
}

.dependency-nodes-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    position: relative;
    z-index: 2;
}

.dependency-node {
    padding: 10px;
    background: #2d2d2d;
    border: 2px solid #404040;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.dependency-node:hover {
    background: #353535;
    border-color: #555;
    transform: translateY(-2px);
}

.dependency-node.current {
    border-color: #4a9eff;
    background: #2d3d4d;
    box-shadow: 0 0 8px rgba(74, 158, 255, 0.3);
}

.dependency-node.available {
    border-left: 4px solid #4caf50;
}

.dependency-node.status-complete {
    border-color: #4caf50;
    opacity: 0.8;
}

.dependency-node.status-in_progress {
    border-color: #4a9eff;
}

.dependency-node.status-needs_revision {
    border-color: #ff9800;
}

.dependency-node-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dependency-node-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.dependency-node-name {
    font-size: 13px;
    color: #e0e0e0;
    font-weight: 500;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dependency-available-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 6px;
    background: #2d5a3d;
    color: #4caf50;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
}

.dependency-edges-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    pointer-events: none;
}

.dependency-edge {
    position: absolute;
    pointer-events: none;
}

.dependency-edge-line {
    height: 2px;
    background: #555;
    opacity: 0.5;
}

.dependency-edge.complete .dependency-edge-line {
    background: #4caf50;
    opacity: 0.8;
}

.dependency-graph-unavailable,
.dependency-graph-error {
    padding: 20px;
    text-align: center;
    color: #888;
    font-style: italic;
}

/* Automation Setup Wizard Styles */
.wizard-content {
    max-width: 700px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.wizard-steps {
    display: flex;
    justify-content: space-between;
    padding: 16px;
    background: #1a1a1a;
    border-bottom: 1px solid #404040;
}

.wizard-step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    opacity: 0.5;
}

.wizard-step-indicator.active {
    opacity: 1;
}

.wizard-step-indicator.completed {
    opacity: 0.8;
}

.wizard-step-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #2d2d2d;
    border: 2px solid #404040;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    color: #888;
}

.wizard-step-indicator.active .wizard-step-number {
    background: #4a9eff;
    border-color: #4a9eff;
    color: #ffffff;
}

.wizard-step-indicator.completed .wizard-step-number {
    background: #4caf50;
    border-color: #4caf50;
    color: #ffffff;
}

.wizard-step-label {
    font-size: 11px;
    color: #888;
    text-align: center;
}

.wizard-step-indicator.active .wizard-step-label {
    color: #e0e0e0;
}

.wizard-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    min-height: 300px;
}

.wizard-step-content h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #e0e0e0;
}

.wizard-step-description {
    margin: 0 0 24px 0;
    color: #b8b8b8;
    font-size: 14px;
    line-height: 1.5;
}

.wizard-engine-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wizard-engine-option {
    padding: 16px;
    background: #2d2d2d;
    border: 2px solid #404040;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.wizard-engine-option:hover {
    border-color: #555;
    background: #353535;
}

.wizard-engine-option.selected {
    border-color: #4a9eff;
    background: #2d3d4d;
}

.wizard-engine-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.wizard-engine-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.wizard-engine-info {
    flex: 1;
}

.wizard-engine-name {
    margin: 0 0 6px 0;
    font-size: 16px;
    color: #e0e0e0;
    font-weight: 500;
}

.wizard-engine-description {
    margin: 0;
    font-size: 13px;
    color: #b8b8b8;
    line-height: 1.5;
}

.wizard-engine-usecases {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #404040;
    font-size: 12px;
    color: #b8b8b8;
}

.wizard-engine-usecases strong {
    color: #e0e0e0;
    display: block;
    margin-bottom: 6px;
}

.wizard-engine-usecases ul {
    margin: 6px 0 0 20px;
    padding: 0;
    list-style-type: disc;
}

.wizard-engine-usecases li {
    margin: 4px 0;
    line-height: 1.4;
}

.wizard-radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.wizard-radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #2d2d2d;
    border: 2px solid #404040;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.wizard-radio-option:hover {
    border-color: #555;
    background: #353535;
}

.wizard-radio-option.selected {
    border-color: #4a9eff;
    background: #2d3d4d;
}

.wizard-radio-option input[type="radio"] {
    margin: 0;
    cursor: pointer;
}

.wizard-radio-option span {
    color: #e0e0e0;
    font-size: 14px;
}

.wizard-input-group {
    margin-bottom: 20px;
}

.wizard-input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #e0e0e0;
    font-size: 14px;
}

.wizard-input {
    width: 100%;
    padding: 10px;
    background: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 6px;
    color: #e0e0e0;
    font-family: monospace;
    font-size: 13px;
    margin-bottom: 8px;
}

.wizard-input:focus {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
    border-color: #4a9eff;
}

.wizard-btn-secondary {
    padding: 6px 12px;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 4px;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.wizard-btn-secondary:hover {
    background: #353535;
    border-color: #555;
}

.wizard-help-text {
    padding: 12px;
    background: #1a1a1a;
    border-left: 3px solid #4a9eff;
    border-radius: 4px;
    font-size: 12px;
    color: #b8b8b8;
    line-height: 1.6;
}

.wizard-help-text p {
    margin: 6px 0;
}

.wizard-help-text strong {
    color: #e0e0e0;
}

.wizard-review-section {
    padding: 16px;
    background: #2d2d2d;
    border-radius: 6px;
    margin-bottom: 20px;
}

.wizard-review-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #404040;
}

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

.wizard-review-item strong {
    color: #e0e0e0;
    font-size: 14px;
}

.wizard-review-item span {
    color: #b8b8b8;
    font-size: 13px;
}

.wizard-review-path {
    font-family: monospace;
    color: #4a9eff;
}

.wizard-validation-errors {
    padding: 12px;
    background: #5a2d2d;
    border: 1px solid #ff5722;
    border-radius: 6px;
    color: #ffcc80;
    margin-bottom: 20px;
}

.wizard-validation-errors h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
}

.wizard-validation-errors ul {
    margin: 8px 0 0 20px;
    padding: 0;
}

.wizard-validation-errors li {
    margin: 4px 0;
    font-size: 13px;
}

.wizard-footer {
    display: flex;
    justify-content: space-between;
    padding: 16px;
    border-top: 1px solid #404040;
    background: #1a1a1a;
}

/* Automation Dashboard Styles */
.automation-dashboard-container {
    margin: 20px;
    background: #1a1a1a;
    border-radius: 8px;
    border: 1px solid #404040;
    overflow: hidden;
}

.automation-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #2d2d2d;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.automation-dashboard-header:hover {
    background: #353535;
}

.automation-dashboard-title {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    color: #e0e0e0;
}

.automation-dashboard-toggle {
    font-size: 14px;
    color: #888;
    transition: transform 0.2s;
}

.automation-dashboard-content {
    padding: 20px;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
    overflow: hidden;
}

.automation-dashboard-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

/* Automation Directory Section - collapsible */
.automation-dir-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.automation-dir-section-header:hover {
    background: rgba(255, 255, 255, 0.05);
}

.automation-dir-section-toggle {
    font-size: 14px;
    color: #888;
}

.automation-dir-section-content {
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.automation-dir-section-content.collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.automation-dashboard {
    width: 100%;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #404040;
}

.dashboard-header h2 {
    margin: 0;
    font-size: 20px;
    color: #e0e0e0;
}

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

.dashboard-btn {
    padding: 6px 12px;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 4px;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.dashboard-btn:hover {
    background: #353535;
    border-color: #555;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.dashboard-card {
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 8px;
    overflow: hidden;
}

.dashboard-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #1a1a1a;
    border-bottom: 1px solid #404040;
}

.dashboard-card-header h3 {
    margin: 0;
    font-size: 14px;
    color: #e0e0e0;
    font-weight: 500;
}

.dashboard-toggle {
    padding: 4px 8px;
    background: transparent;
    border: 1px solid #404040;
    border-radius: 4px;
    color: #888;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.2s;
}

.dashboard-toggle:hover {
    border-color: #555;
    color: #e0e0e0;
}

.dashboard-card-content {
    padding: 16px;
}

.dashboard-empty {
    padding: 20px;
    text-align: center;
    color: #888;
    font-style: italic;
    font-size: 13px;
}

.dashboard-error {
    padding: 20px;
    text-align: center;
    color: #ff5722;
    font-size: 13px;
}

/* Status Card */
.status-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px;
    background: #1a1a1a;
    border-radius: 6px;
}

.status-icon {
    font-size: 24px;
}

.status-text {
    font-size: 16px;
    font-weight: 500;
    color: #e0e0e0;
}

.status-running .status-icon {
    color: #4caf50;
}

.status-paused .status-icon {
    color: #ff9800;
}

.status-stopped .status-icon {
    color: #666;
}

.status-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.status-detail-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.detail-label {
    color: #888;
}

.detail-value {
    color: #e0e0e0;
    font-weight: 500;
}

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

.dashboard-action-btn {
    flex: 1;
    padding: 8px 12px;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 6px;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.dashboard-action-btn:hover {
    background: #353535;
    border-color: #555;
}

.dashboard-action-btn.start-btn {
    background: #4caf50;
    border-color: #4caf50;
    color: #ffffff;
}

.dashboard-action-btn.start-btn:hover {
    background: #45a049;
}

.dashboard-action-btn.pause-btn {
    background: #ff9800;
    border-color: #ff9800;
    color: #ffffff;
}

.dashboard-action-btn.pause-btn:hover {
    background: #f57c00;
}

.dashboard-action-btn.resume-btn {
    background: #4a9eff;
    border-color: #4a9eff;
    color: #ffffff;
}

.dashboard-action-btn.resume-btn:hover {
    background: #3d8ef5;
}

.dashboard-action-btn.stop-btn {
    background: #f44336;
    border-color: #f44336;
    color: #ffffff;
}

.dashboard-action-btn.stop-btn:hover {
    background: #d32f2f;
}

/* Progress Card */
.progress-overview {
    margin-bottom: 12px;
}

.progress-percentage {
    font-size: 32px;
    font-weight: 600;
    color: #4a9eff;
    text-align: center;
    margin-bottom: 12px;
}

.progress-breakdown {
    display: flex;
    justify-content: space-around;
    gap: 12px;
}

.progress-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.stat-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
}

.stat-value.complete {
    color: #4caf50;
}

.stat-value.in-progress {
    color: #4a9eff;
}

.stat-value.pending {
    color: #888;
}

.progress-bar-mini {
    height: 8px;
    background: #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
}

.progress-segment-mini {
    height: 100%;
    background: #4caf50;
    transition: width 0.3s;
}

/* Active Sections Card */
.active-sections-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.active-section-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #1a1a1a;
    border-radius: 6px;
    border-left: 3px solid #4a9eff;
}

.section-name {
    font-size: 13px;
    color: #e0e0e0;
    font-weight: 500;
}

.section-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    background: #2d3d4d;
    color: #4a9eff;
}

/* File Watch Card */
.file-watch-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.file-watch-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
}

.file-watch-label {
    color: #888;
}

.file-watch-value {
    color: #e0e0e0;
    font-family: monospace;
    font-size: 12px;
}

.file-watch-status {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.file-watch-status.status-active {
    background: #2d5a3d;
    color: #4caf50;
}

.file-watch-status.status-inactive {
    background: #5a2d2d;
    color: #ff5722;
}

.file-watch-status.status-not_configured {
    background: #3d3d2d;
    color: #888;
}

/* Agent Status Card */
.agent-status-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agent-status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #1a1a1a;
    border-radius: 6px;
}

.agent-section {
    font-size: 13px;
    color: #e0e0e0;
}

.agent-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    background: #2d5a3d;
    color: #4caf50;
    font-weight: 600;
}

/* Quality Metrics Card */
.quality-metrics {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quality-average {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #1a1a1a;
    border-radius: 6px;
}

.quality-label {
    font-size: 13px;
    color: #888;
}

.quality-value {
    font-size: 20px;
    font-weight: 600;
    color: #4a9eff;
}

.quality-breakdown {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.quality-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: #1a1a1a;
    border-radius: 4px;
    font-size: 12px;
}

.quality-section {
    color: #b8b8b8;
}

.quality-score {
    color: #4a9eff;
    font-weight: 500;
}

/* Activity Timeline */
.activity-timeline {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.activity-timeline.collapsed {
    display: none;
}

.activity-item {
    display: flex;
    gap: 12px;
    padding: 8px 12px;
    background: #1a1a1a;
    border-radius: 6px;
    font-size: 12px;
    border-left: 3px solid #4a9eff;
}

.activity-time {
    color: #888;
    font-family: monospace;
    font-size: 11px;
    flex-shrink: 0;
    min-width: 80px;
}

.activity-message {
    color: #b8b8b8;
    flex: 1;
}

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

/* Quick Start Wizard Specific Styles */
.welcome-step {
    text-align: center;
}

.welcome-header {
    margin-bottom: 32px;
}

.welcome-header h2 {
    margin: 0 0 8px 0;
    font-size: 24px;
    color: #e0e0e0;
}

.welcome-subtitle {
    margin: 0;
    font-size: 16px;
    color: #b8b8b8;
}

.welcome-content {
    text-align: left;
    max-width: 600px;
    margin: 0 auto;
}

.welcome-section {
    margin-bottom: 24px;
}

.welcome-section h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: #e0e0e0;
}

.welcome-section p {
    margin: 0 0 12px 0;
    font-size: 14px;
    color: #b8b8b8;
    line-height: 1.6;
}

.welcome-list {
    margin: 12px 0 0 0;
    padding-left: 24px;
    color: #b8b8b8;
    font-size: 14px;
    line-height: 1.8;
}

.welcome-list li {
    margin: 8px 0;
}

.wizard-case-recommendations {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.recommendation-card {
    padding: 20px;
    background: #2d2d2d;
    border: 2px solid #404040;
    border-radius: 8px;
}

.recommendation-card.recommended {
    border-color: #4a9eff;
    background: #2d3d4d;
}

.recommendation-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #4a9eff;
    color: #ffffff;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.recommendation-card h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #e0e0e0;
}

.recommendation-card p {
    margin: 0 0 16px 0;
    font-size: 13px;
    color: #b8b8b8;
    line-height: 1.5;
}

.wizard-case-btn {
    padding: 10px 20px;
    background: #4a9eff;
    border: none;
    border-radius: 6px;
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.wizard-case-btn:hover {
    background: #3d8ef5;
}

.wizard-case-btn-secondary {
    padding: 8px 16px;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 6px;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.wizard-case-btn-secondary:hover {
    background: #353535;
    border-color: #555;
}

.all-cases-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.wizard-case-option {
    padding: 16px;
    background: #2d2d2d;
    border: 2px solid #404040;
    border-radius: 8px;
}

.wizard-case-option h4 {
    margin: 0 0 8px 0;
    font-size: 15px;
    color: #e0e0e0;
}

.wizard-case-option p {
    margin: 0 0 12px 0;
    font-size: 12px;
    color: #b8b8b8;
    line-height: 1.4;
}

.wizard-template-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wizard-template-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #2d2d2d;
    border: 2px solid #404040;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.wizard-template-option:hover {
    border-color: #555;
    background: #353535;
}

.wizard-template-option.selected {
    border-color: #4a9eff;
    background: #2d3d4d;
}

.template-icon-small {
    font-size: 20px;
    flex-shrink: 0;
}

.template-info-small {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.template-name-small {
    font-size: 13px;
    color: #e0e0e0;
    font-weight: 500;
}

.template-description-small {
    font-size: 11px;
    color: #b8b8b8;
}

.wizard-checkbox-group {
    margin-bottom: 20px;
}

.wizard-checkbox-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: #2d2d2d;
    border: 2px solid #404040;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.wizard-checkbox-option:hover {
    border-color: #555;
    background: #353535;
}

.wizard-checkbox-option input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.wizard-checkbox-option span {
    color: #e0e0e0;
    font-size: 14px;
}

.wizard-automation-options {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #404040;
}

.wizard-help-text-small {
    margin-top: 6px;
    font-size: 11px;
    color: #888;
    font-style: italic;
}

.wizard-dont-show {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #b8b8b8;
    cursor: pointer;
}

.wizard-dont-show input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.wizard-error {
    padding: 20px;
    text-align: center;
    color: #ff5722;
    font-size: 13px;
}

/* Responsive: stack preview below on small screens */
@media (max-width: 1024px) {
    .case-selection-layout {
        flex-direction: column;
    }
    
    .case-selection-preview {
        width: 100%;
        border-left: none;
        border-top: 1px solid #404040;
        max-height: 300px;
    }
}

.case-option {
    padding: 16px;
    background: #2d2d2d;
    border: 2px solid #404040;
    border-radius: 8px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.case-option:hover {
    border-color: #555555;
    background: #363636;
}

.case-option.selected {
    border-color: #4a9eff;
    background: #2d3d4d;
}

.case-option h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #ffffff;
}

.case-option p {
    margin: 0;
    font-size: 13px;
    color: #b8b8b8;
    line-height: 1.5;
}

/* Enhanced Case Selection Styles */
.case-option-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.case-option-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.case-option-title-row h3 {
    margin: 0;
    flex: 1;
}

.complexity-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.complexity-beginner {
    background: #2d5a3d;
    color: #4caf50;
    border: 1px solid #4caf50;
}

.complexity-intermediate {
    background: #3d3d2d;
    color: #ffc107;
    border: 1px solid #ffc107;
}

.complexity-advanced {
    background: #5a2d2d;
    color: #ff5722;
    border: 1px solid #ff5722;
}

.case-option-meta {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #888;
}

.section-count::before {
    content: '📋 ';
}

.time-estimate::before {
    content: '⏱️ ';
}

.case-description {
    margin: 8px 0 12px 0;
    font-size: 13px;
    color: #b8b8b8;
    line-height: 1.5;
}

.case-use-cases {
    margin: 12px 0;
    font-size: 12px;
    color: #b8b8b8;
}

.case-use-cases strong {
    color: #e0e0e0;
    display: block;
    margin-bottom: 6px;
}

.case-use-cases ul {
    margin: 6px 0 0 20px;
    padding: 0;
    list-style-type: disc;
}

.case-use-cases li {
    margin: 4px 0;
    line-height: 1.4;
}

.case-sections-preview {
    margin: 12px 0;
    font-size: 12px;
}

.case-sections-preview strong {
    color: #e0e0e0;
    display: block;
    margin-bottom: 6px;
}

.section-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
}

.section-tag {
    display: inline-block;
    padding: 4px 8px;
    background: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 4px;
    font-size: 11px;
    color: #b8b8b8;
}

.section-tag-more {
    display: inline-block;
    padding: 4px 8px;
    background: #2d2d2d;
    border: 1px solid #555;
    border-radius: 4px;
    font-size: 11px;
    color: #888;
    font-style: italic;
}

.case-learn-more-btn {
    width: 100%;
    padding: 8px 12px;
    margin-top: 12px;
    background: transparent;
    border: 1px solid #555;
    border-radius: 4px;
    color: #b8b8b8;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s, border-color 0.2s;
}

.case-learn-more-btn:hover {
    background: #2d2d2d;
    border-color: #666;
}

.case-learn-more-btn.expanded {
    border-color: #4a9eff;
    color: #4a9eff;
}

.learn-more-icon {
    font-size: 10px;
    transition: transform 0.2s;
}

.case-details {
    margin-top: 12px;
    padding: 12px;
    background: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 6px;
}

.case-details-content h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    color: #e0e0e0;
}

.case-details-content p {
    margin: 8px 0 0 0;
    font-size: 12px;
    color: #b8b8b8;
    line-height: 1.5;
}

.case-sections-list {
    margin: 8px 0;
    padding-left: 20px;
    font-size: 12px;
    color: #b8b8b8;
}

.case-sections-list li {
    margin: 4px 0;
    line-height: 1.4;
}

/* Quick Jump Dialog */
.quick-jump-content {
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.quick-jump-search {
    width: 100%;
    padding: 12px;
    background: #1a1a1a;
    border: 1px solid #404040;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 14px;
    margin-bottom: 12px;
}

.quick-jump-search:focus {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
    border-color: #4a9eff;
}

.quick-jump-list {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
    border: 1px solid #404040;
    border-radius: 6px;
    background: #1a1a1a;
}

.quick-jump-item {
    padding: 12px;
    border-bottom: 1px solid #2d2d2d;
    cursor: pointer;
    transition: background 0.2s;
}

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

.quick-jump-item:hover,
.quick-jump-item:focus {
    background: #2d2d2d;
    outline: none;
}

.quick-jump-item.active {
    background: #2d3d4d;
    border-left: 3px solid #4a9eff;
}

.quick-jump-item-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quick-jump-status {
    font-size: 16px;
    width: 24px;
    text-align: center;
}

.quick-jump-name {
    flex: 1;
    font-size: 14px;
    color: #e0e0e0;
    font-weight: 500;
}

.quick-jump-id {
    font-size: 12px;
    color: #888;
    font-family: monospace;
}

.quick-jump-empty {
    padding: 40px;
    text-align: center;
    color: #888;
    font-style: italic;
}

.status-complete {
    color: #4caf50;
}

.status-in_progress {
    color: #4a9eff;
}

.status-needs_revision {
    color: #ff9800;
}

.status-not_started {
    color: #666;
}

/* Section Pagination (bottom, rom-browser style) */
.section-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
    margin-top: 16px;
    border-top: 1px solid #404040;
    background: #1a1a1a;
    flex-wrap: wrap;
}

.section-pagination button {
    background: #2d2d2d;
    border: 1px solid #404040;
    color: #e0e0e0;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.section-pagination button:hover:not(:disabled) {
    background: #353535;
    border-color: #555;
}

.section-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.section-pagination .page-numbers {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.section-pagination .page-number {
    min-width: 36px;
    padding: 6px 10px;
    position: relative;
}

.section-pagination .page-number.active {
    background: #2d3d4d;
    border-color: #4a9eff;
    color: #4a9eff;
    font-weight: 500;
}

.section-pagination .page-number:hover:not(:disabled):not(.active) {
    background: #353535;
}

.section-pagination .page-ellipsis {
    color: #888;
    padding: 0 4px;
    user-select: none;
}

/* Section pagination hover tooltip */
.page-tooltip {
    position: fixed;
    background: #2d2d2d;
    border: 1px solid #404040;
    color: #e0e0e0;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    pointer-events: none;
    z-index: var(--z-index-tooltip);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Automation Engine Options */
.automation-engine-option {
    flex: 1;
    padding: 12px;
    background: #2d2d2d;
    border: 2px solid #404040;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
}

.automation-engine-option:hover {
    border-color: #555555;
    background: #363636;
}

.automation-engine-option.selected {
    border-color: #4a9eff;
    background: #2d3d4d;
}

/* Modifier Editor Modal */
.modifier-editor-content {
    max-width: 500px;
}

.modifier-editor-body {
    padding: 20px;
}

.modifier-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #2d2d2d;
    border-radius: 6px;
    margin-bottom: 8px;
}

.modifier-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.modifier-checkbox label {
    flex: 1;
    cursor: pointer;
    font-size: 13px;
    color: #e0e0e0;
}

.modifier-description {
    font-size: 11px;
    color: #888888;
    margin-top: 4px;
    margin-left: 28px;
}

/* Process Step Results Panel */
.process-step-results-panel {
    position: fixed;
    bottom: 0;
    right: 0;
    width: 400px;
    max-height: 60vh;
    background: #2d2d2d;
    border-top: 1px solid #404040;
    border-left: 1px solid #404040;
    border-radius: 8px 0 0 0;
    box-shadow: -2px -2px 8px rgba(0, 0, 0, 0.3);
    z-index: var(--z-index-modal);
    display: flex;
    flex-direction: column;
}

.process-step-results-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #404040;
}

.process-step-results-panel .panel-header h3 {
    margin: 0;
    font-size: 14px;
    color: #ffffff;
}

.process-step-results-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    font-size: 12px;
    color: #e0e0e0;
    line-height: 1.6;
}

/* Automation Modal */
.automation-content {
    max-width: 600px;
}

.automation-body {
    padding: 20px;
}

.automation-info {
    margin-bottom: 20px;
}

.automation-info ul {
    margin: 10px 0 20px 20px;
    color: #b8b8b8;
}

.automation-info li {
    margin: 8px 0;
}

.automation-status {
    background: #1a1a1a;
    padding: 12px;
    border-radius: 4px;
    border: 1px solid #404040;
    margin-top: 15px;
}

.automation-status p {
    margin: 5px 0;
}

#automation-status-text {
    color: #4CAF50;
    font-weight: 500;
}

#automation-status-text.running {
    color: #2196F3;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
    pointer-events: all;
}

.loading-overlay[style*="display: block"],
.loading-overlay[style*="display:flex"],
.loading-overlay[style*="display: flex"] {
    opacity: 1;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: #4CAF50;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: #e0e0e0;
    font-size: 16px;
    font-weight: 500;
}

#automation-status-text.stopped {
    color: #f44336;
}

/* Step Selection Buttons */
.step-option-btn {
    padding: 8px 16px;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 4px;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
}

.step-option-btn:hover:not([disabled]) {
    background: #3d3d3d;
    border-color: #4a9eff;
    color: #ffffff;
}

.step-option-btn.active {
    background: #4a9eff;
    border-color: #4a9eff;
    color: #ffffff;
}

.step-option-btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Chat Window Styles */
.chat-window {
    position: fixed;
    display: flex;
    flex-direction: column;
    background: var(--page-bg);
    border: 1px solid #404040;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    min-width: 400px;
    min-height: 300px;
    max-width: 90vw;
    max-height: 90vh;
}

.chat-window-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #2d2d2d;
    border-bottom: 1px solid #404040;
    border-radius: 8px 8px 0 0;
    cursor: move;
    user-select: none;
}

.chat-window-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}

.chat-window-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-window-clear-history {
    background: none;
    border: none;
    color: #888;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.chat-window-clear-history:hover {
    color: #ff5555;
}

.chat-window-close {
    background: none;
    border: none;
    color: #888;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.chat-window-close:hover {
    color: #ffffff;
}

.chat-window-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.chat-tab-bar-container {
    display: flex;
    align-items: center;
    padding: 8px;
    background: #252525;
    border-bottom: 1px solid #404040;
    gap: 4px;
}

.chat-tab-bar {
    display: flex;
    flex: 1;
    gap: 4px;
    overflow-x: auto;
}

.chat-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-size: 13px;
}

.chat-tab:hover {
    background: #363636;
    border-color: #505050;
}

.chat-tab-active {
    background: #4a9eff;
    border-color: #4a9eff;
    color: #ffffff;
}

.chat-tab-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-tab-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.chat-tab-close:hover {
    opacity: 1;
}

.chat-new-tab-button {
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 4px;
    color: #e0e0e0;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.chat-new-tab-button:hover {
    background: #363636;
    border-color: #505050;
}

.chat-message-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.chat-message-user {
    align-items: flex-end;
}

.chat-message-assistant {
    align-items: flex-start;
}

.chat-message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #888;
}

.chat-message-role {
    font-weight: 600;
}

.chat-message-time {
    opacity: 0.7;
}

.chat-message-content {
    padding: 10px 14px;
    border-radius: 8px;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.5;
}

.chat-message-user .chat-message-content {
    background: #4a9eff;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.chat-message-assistant .chat-message-content {
    background: #363636;
    color: #e0e0e0;
    border-bottom-left-radius: 4px;
}

.chat-message-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 8px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 8px 0;
}

.chat-message-content code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 4px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.chat-message-content pre code {
    background: none;
    padding: 0;
}

.chat-input-container {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: #252525;
    border-top: 1px solid #404040;
}

.chat-input-field {
    flex: 1;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 4px;
    color: #e0e0e0;
    padding: 10px;
    font-family: inherit;
    font-size: 14px;
    resize: none;
    min-height: 60px;
    max-height: 150px;
}

.chat-input-field:focus {
    outline: none;
    border-color: #4a9eff;
}

.chat-send-button {
    background: #4a9eff;
    border: none;
    border-radius: 4px;
    color: #ffffff;
    padding: 10px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.2s;
    align-self: flex-end;
}

.chat-send-button:hover:not(:disabled) {
    background: #3a8eef;
}

.chat-send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Chat Loading Indicator */
.chat-message-loading {
    opacity: 0.8;
}

.chat-loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #404040;
    border-top-color: #4a9eff;
    border-radius: 50%;
    animation: chat-spin 0.8s linear infinite;
}

@keyframes chat-spin {
    to { transform: rotate(360deg); }
}

/* Chat Error Message */
.chat-message-error {
    background: rgba(255, 85, 85, 0.1);
    border-left: 3px solid #ff5555;
}

.chat-message-error .chat-message-content {
    color: #ff5555;
}

/* Chat Settings Modal */
.chat-settings-modal .modal-content {
    max-width: 500px;
}

.chat-settings-modal .form-group {
    margin-bottom: 16px;
}

.chat-settings-modal label {
    display: block;
    margin-bottom: 6px;
    color: #e0e0e0;
    font-size: 14px;
}

.chat-settings-modal input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    background: #2d2d2d;
    border: 1px solid #404040;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 14px;
}

.chat-settings-modal input[type="text"]:focus {
    outline: none;
    border-color: #4a9eff;
}

.chat-settings-modal input[type="checkbox"] {
    margin-right: 8px;
}

/* Resize handles */
.resize-handle {
    position: absolute;
    z-index: var(--z-index-max);
}

.resize-handle-nw {
    cursor: nwse-resize;
    top: 0;
    left: 0;
}

.resize-handle-n {
    cursor: ns-resize;
    top: 0;
    left: 0;
}

.resize-handle-ne {
    cursor: nesw-resize;
    top: 0;
    right: 0;
}

.resize-handle-e {
    cursor: ew-resize;
    top: 0;
    right: 0;
}

.resize-handle-se {
    cursor: nwse-resize;
    bottom: 0;
    right: 0;
}

.resize-handle-s {
    cursor: ns-resize;
    bottom: 0;
    left: 0;
}

.resize-handle-sw {
    cursor: nesw-resize;
    bottom: 0;
    left: 0;
}

.resize-handle-w {
    cursor: ew-resize;
    top: 0;
    left: 0;
}

