/* ============================================================================
   Design Tokens - CSS Variables
   ============================================================================ */
:root {
    /* Colors */
    --color-bg: #f5f5f5;
    --color-surface: #ffffff;
    --color-border: #dee2e6;
    
    --color-primary: #007bff;
    --color-primary-dark: #0056b3;
    --color-primary-light: #2196f3;
    --color-primary-lighter: #e3f2fd;
    --color-primary-text: #1976d2;
    --color-primary-text-dark: #1565c0;
    --color-primary-text-darker: #0d47a1;
    
    --color-success: #28a745;
    --color-danger: #dc3545;
    --color-warning: #ffc107;
    --color-warning-text: #856404;
    --color-muted: #6c757d;
    --color-muted-dark: #5a6268;
    --color-disabled: #adb5bd;
    
    --color-grid-parking-bg: #fffbf0;
    --color-grid-parking-border: #6c757d;
    --color-parking-lot-bg: #fff3cd;
    --color-parking-lot-text: #856404;
    
    --color-text-main: #333;
    --color-text-secondary: #495057;
    --color-text-muted: #666;
    --color-text-light: #555;
    --color-text-lighter: #999;
    
    --color-bg-light: #f8f9fa;
    --color-bg-lighter: #e9ecef;
    --color-bg-hover: #f0f0f0;
    --color-bg-selected: #e7f3ff;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 6px;
    --space-md: 8px;
    --space-lg: 10px;
    --space-xl: 12px;
    --space-2xl: 15px;
    --space-3xl: 20px;
    --space-4xl: 24px;
    --space-5xl: 30px;
    
    /* Border Radius */
    --radius-sm: 3px;
    --radius-md: 4px;
    --radius-lg: 6px;
    --radius-xl: 8px;
    --radius-2xl: 12px;
    --radius-full: 50%;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-focus: 0 0 0 2px rgba(0, 123, 255, 0.25);
    --shadow-focus-strong: 0 0 0 2px rgba(0, 123, 255, 0.3);
    
    /* Typography */
    --font-family-system: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    --text-xs: 11px;
    --text-sm: 12px;
    --text-md: 13px;
    --text-base: 14px;
    --text-lg: 16px;
    --text-xl: 18px;
    --text-2xl: 24px;
    --text-3xl: 28px;
}

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

body {
    font-family: var(--font-family-system);
    background-color: var(--color-bg);
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* ============================================================================
   Base Button Component
   ============================================================================ */
.btn {
    padding: var(--space-md) var(--space-lg);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    color: white;
    text-decoration: none;
    display: inline-block;
}

/* Button Variants */
.btn-primary {
    background-color: var(--color-primary);
}

.btn-primary:hover:not(.active) {
    background-color: var(--color-primary-dark);
}

.btn-secondary {
    background-color: var(--color-muted);
}

.btn-secondary:hover:not(.active) {
    background-color: var(--color-muted-dark);
}

.btn-danger {
    background-color: var(--color-danger);
}

.btn-danger:hover:not(.active) {
    background-color: #c82333;
}

.btn-success {
    background-color: var(--color-success);
}

.btn-success:hover:not(.active) {
    background-color: #218838;
}

/* Button Sizes */
.btn-sm,
.btn-md {
    padding: var(--space-sm) var(--space-xl);
    font-size: var(--text-sm);
}

/* Button States */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn.active {
    background-color: var(--color-success) !important;
}

.btn.active:hover {
    background-color: #218838 !important;
}

/* ============================================================================
   Base Form Input Component
   ============================================================================ */
.input,
.textarea,
.select {
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-family: inherit;
    box-sizing: border-box;
    color: var(--color-text-main);
    background-color: var(--color-surface);
}

.input:focus,
.textarea:focus,
.select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.textarea {
    resize: vertical;
}

.select {
    cursor: pointer;
}

/* Input Sizes */
.input-sm {
    padding: var(--space-xs) var(--space-md);
    font-size: 12px;
}

.input-md {
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--text-md);
}

.input-lg {
    padding: var(--space-lg);
    font-size: var(--text-base);
}

.input-xl {
    padding: var(--space-2xl);
    font-size: var(--text-base);
    border-width: 2px;
    border-radius: var(--radius-lg);
}

/* Input Border Variants */
.input-border-light {
    border-color: var(--color-border);
}

.input-border-default {
    border-color: var(--color-border);
}

.input-border-muted {
    border-color: var(--color-border);
}

.app-layout {
    min-height: 100vh;
}

/* Main Content Area */
.main-content {
    min-width: 0;
    background: var(--color-bg);
    padding: 0;
    overflow-y: auto;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

/* Stage Navigation Bar */
.stage-navigation-bar {
    background: var(--color-surface);
    border-bottom: 2px solid var(--color-border);
    padding: var(--space-lg) var(--space-3xl);
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stage-nav-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-3xl);
}

.workflow-container {
    display: flex;
    align-items: center;
    gap: var(--space-2xl);
    flex: 1;
    justify-content: center;
}

.workflow-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: var(--space-xs) var(--space-md);
    background-color: var(--color-bg-light);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
}

.main-actions {
    display: flex;
    gap: var(--space-lg);
}

/* Main action buttons now use .btn base component */

.stage-nav-controls .submit-btn {
    flex-shrink: 0;
    min-width: 100px;
    padding: var(--space-md) var(--space-lg);
    font-size: var(--text-base);
}

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

.workflow-arrow {
    color: var(--color-muted);
    font-size: 18px;
    font-weight: 300;
    padding: 0 4px;
    opacity: 0.6;
}

.stage-step {
    padding: 8px 16px;
    background-color: var(--color-surface);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: default;
    transition: all 0.2s;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    position: relative;
}

.stage-step:hover:not(.locked) {
    border-color: var(--color-primary);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
    transform: translateY(-1px);
}

.stage-step.current {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
    font-weight: 600;
    cursor: default;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    transform: translateY(-2px);
}

.stage-step.visited {
    background-color: var(--color-bg-lighter);
    color: var(--color-text-secondary);
    cursor: pointer;
}

.stage-step.visited:hover {
    background-color: var(--color-border);
    border-color: var(--color-disabled);
}

.stage-step.future {
    background-color: var(--color-bg-light);
    color: var(--color-muted);
    cursor: pointer;
}

.stage-step.future:hover {
    background-color: var(--color-bg-lighter);
    border-color: var(--color-disabled);
}

.stage-step.locked {
    background-color: var(--color-bg-light);
    color: var(--color-disabled);
    cursor: not-allowed;
    opacity: 0.6;
}

.stage-step.clickable {
    cursor: pointer;
}

/* Legacy support for .active class */
.stage-step.active {
    background-color: var(--color-primary);
    color: white;
    font-weight: 600;
}

/* Content wrapper for views */
.main-content > div:not(.stage-navigation-bar) {
    padding: var(--space-3xl);
}

/* When sidebar is collapsed, add horizontal padding to content */
.left-sidebar.collapsed ~ .main-content > div:not(.stage-navigation-bar) {
    padding: var(--space-3xl) var(--space-5xl);
}

/* Sidebar Toggle Button (when sidebar is collapsed) */
/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-container {
    background: var(--color-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-3xl);
    border-bottom: 1px solid var(--color-border);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    color: var(--color-text-main);
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--color-muted);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.modal-close-btn:hover {
    color: var(--color-text-main);
}

.modal-content {
    padding: var(--space-3xl);
}

/* Notes Badge Styles */
.notes-badge {
    background-color: var(--color-bg-lighter);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-2xl);
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: var(--text-xs);
    font-weight: 500;
    margin-left: var(--space-sm);
    padding: 2px var(--space-md);
    transition: all 0.2s;
    vertical-align: middle;
    white-space: nowrap;
}

.notes-badge:hover {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    color: white;
}

.notes-badge:active {
    transform: scale(0.95);
}

/* Notes Modal Styles - Uses base modal with size modifier */
.notes-modal-container {
    /* Base styles inherited from .modal-container */
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
}

.notes-modal-content {
    /* Base styles inherited from .modal-content */
    max-height: calc(80vh - 100px);
    overflow-y: auto;
}

.notes-modal-item-name {
    font-size: 1.1em;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
}

.notes-modal-notes-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    background-color: var(--color-bg-light);
}

.note-item {
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
    background-color: var(--color-surface);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--color-primary);
    cursor: pointer;
    transition: background-color 0.2s;
}

.note-item:hover {
    background-color: var(--color-bg-hover);
}

.note-item.selected {
    background-color: var(--color-bg-selected);
    border-left-color: var(--color-primary-dark);
}

.note-item-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-bottom: var(--space-md);
    color: var(--color-text-secondary);
}

.note-item-timestamps {
    font-size: 0.85em;
    color: var(--color-muted);
}

.note-item-timestamp {
    margin-right: 15px;
}

/* Notes modal textarea now uses .textarea base component */
.notes-modal-textarea {
    border-color: var(--color-border);
}

.notes-modal-buttons {
    display: flex;
    gap: var(--space-lg);
}

/* Notes modal buttons now use .btn base component */
.notes-modal-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-field {
    margin-bottom: var(--space-3xl);
}

.modal-field label {
    display: block;
    margin-bottom: var(--space-md);
    font-weight: 500;
    color: var(--color-text-secondary);
}

/* Modal inputs now use .input base component */

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-lg);
    padding: var(--space-3xl);
    border-top: 1px solid var(--color-border);
}

/* Modal buttons now use .btn base component */
.modal-submit-btn:disabled {
    background-color: var(--color-disabled);
    cursor: not-allowed;
    opacity: 0.6;
}

h1 {
    margin-bottom: 30px;
    color: var(--color-text-main);
}

h2 {
    margin-bottom: var(--space-2xl);
    color: var(--color-text-light);
    font-size: 1.2em;
}

/* Settings View in Main Area */
.settings-view-section {
    padding: var(--space-3xl);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: var(--color-surface);
    min-height: calc(100vh - 100px);
}

.settings-view-content {
    width: 50%;
    max-width: 600px;
    padding: var(--space-3xl);
    margin: 0 auto;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-3xl);
    padding-bottom: 15px;
    border-bottom: 2px solid var(--color-border);
}

.settings-header h2 {
    margin: 0;
    color: var(--color-text-main);
    font-size: 1.3em;
}

.close-settings-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--color-muted);
    cursor: pointer;
    padding: var(--space-xs) var(--space-md);
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.close-settings-btn:hover {
    background-color: var(--color-bg-light);
    color: var(--color-text-main);
}

/* Settings Section */
.settings-section {
    margin-bottom: var(--space-3xl);
}


.settings-subsection {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-bg-lighter);
}

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

.settings-subsection h3 {
    margin-bottom: var(--space-2xl);
    color: var(--color-text-secondary);
    font-size: 1.1em;
    font-weight: 600;
}

.settings-group {
    margin-bottom: var(--space-3xl);
    padding: var(--space-2xl);
    background-color: var(--color-bg-light);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-bg-lighter);
}

.settings-group h4 {
    margin: 0 0 12px 0;
    color: var(--color-muted);
    font-size: 0.95em;
    font-weight: 600;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

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

.settings-row label {
    min-width: 70px;
    font-size: var(--text-md);
    color: var(--color-text-secondary);
    font-weight: 500;
}

.settings-row-vertical {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-2xl);
}

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

.settings-row-vertical label {
    font-size: var(--text-md);
    color: var(--color-text-secondary);
    font-weight: 500;
}

/* Settings inputs now use .input base component */
.settings-input {
    flex: 1;
    min-width: 0;
}

.settings-textarea {
    min-height: 60px;
}

/* Settings save buttons now use .btn base component */
.settings-save-btn {
    white-space: nowrap;
}

.settings-save-btn:active {
    transform: scale(0.98);
}

/* Clear data button removed - not used */

#commandForm {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xl);
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-field label {
    font-weight: 500;
    color: var(--color-text-light);
    font-size: var(--text-base);
}

/* Form field inputs now use .input base component */
.form-field input,
.form-field select {
    border-color: var(--color-border);
}

.submit-btn {
    align-self: flex-start;
    margin-top: 5px;
}

.submit-btn:disabled {
    background-color: var(--color-disabled);
    color: var(--color-text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Note: button element selector conflicts with .btn component - consider removing or scoping */
button {
    padding: var(--space-lg) var(--space-3xl);
    background-color: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--text-base);
    transition: background-color 0.2s;
}

button:hover:not(:disabled) {
    background-color: var(--color-primary-dark);
}

button:disabled {
    background-color: var(--color-disabled);
    color: var(--color-text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

#clearBtn {
    background-color: var(--color-danger);
}

#clearBtn:hover {
    background-color: #c82333;
}

.button-group {
    display: flex;
    gap: var(--space-lg);
}

.item-link {
    color: var(--color-primary);
    text-decoration: none;
    margin-left: 3px;
    font-size: 12px;
    display: inline-block;
}

.item-link:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

.item-inactive {
    opacity: 0.6;
    background-color: var(--color-bg-light);
}

.property-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
    border: 1px solid var(--color-border);
}

.property-btn.increment-btn {
    background-color: var(--color-success);
    color: white;
    border-color: var(--color-success);
}

.property-btn.increment-btn:hover:not(:disabled) {
    background-color: #218838;
    border-color: #218838;
}

.property-btn.decrement-btn {
    background-color: var(--color-danger);
    color: white;
    border-color: var(--color-danger);
}

.property-btn.decrement-btn:hover:not(:disabled) {
    background-color: #c82333;
    border-color: #c82333;
}

.property-btn:disabled {
    background-color: var(--color-bg-lighter);
    color: var(--color-disabled);
    border-color: var(--color-border);
    cursor: not-allowed;
    opacity: 0.6;
}

.empty-state {
    color: var(--color-text-lighter);
    text-align: center;
    padding: 40px;
}


#jsonDisplay {
    background-color: #282c34;
    color: #abb2bf;
    padding: var(--space-3xl);
    border-radius: var(--radius-md);
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: var(--text-md);
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 500px;
    overflow-y: auto;
    /* Note: #282c34 and #abb2bf are code editor colors - consider adding to design tokens if reused */
}

.test-section {
    margin-top: 20px;
    margin-bottom: var(--space-3xl);
    padding-top: 15px;
    border-top: 2px solid var(--color-bg-lighter);
}

#testResults {
    background-color: var(--color-bg-light);
    padding: var(--space-3xl);
    border-radius: var(--radius-md);
    min-height: 100px;
}

.test-summary {
    margin-bottom: var(--space-3xl);
    padding-bottom: 15px;
    border-bottom: 2px solid var(--color-border);
}

.test-summary h3 {
    margin-bottom: var(--space-lg);
    color: var(--color-text-main);
}

.test-stats {
    display: flex;
    gap: var(--space-3xl);
    flex-wrap: wrap;
}

.test-stat {
    padding: var(--space-xs) var(--space-xl);
    background-color: var(--color-bg-lighter);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    font-weight: 500;
}

.test-stat.pass {
    background-color: #d4edda;
    color: #155724;
    /* Note: Test-specific colors - consider adding to design tokens if reused */
}

.test-stat.fail {
    background-color: #f8d7da;
    color: #721c24;
    /* Note: Test-specific colors - consider adding to design tokens if reused */
}

.test-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.test-result {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-lg);
    border-radius: var(--radius-md);
    background-color: var(--color-surface);
    border-left: 4px solid var(--color-border);
}

.test-result.pass {
    border-left-color: var(--color-success);
}

.test-result.fail {
    border-left-color: var(--color-danger);
}

.test-result.error {
    border-left-color: var(--color-warning);
}

.test-status {
    font-weight: 600;
    font-size: 12px;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-sm);
    min-width: 50px;
    text-align: center;
}

.test-result.pass .test-status {
    background-color: #d4edda;
    color: #155724;
    /* Note: Test-specific colors - consider adding to design tokens if reused */
}

.test-result.fail .test-status {
    background-color: #f8d7da;
    color: #721c24;
    /* Note: Test-specific colors - consider adding to design tokens if reused */
}

.test-result.error .test-status {
    background-color: var(--color-parking-lot-bg);
    color: var(--color-parking-lot-text);
}

.test-number {
    font-weight: 600;
    font-size: 12px;
    color: var(--color-text-muted);
    min-width: 50px;
    text-align: right;
    margin-right: 10px;
}

.test-message {
    flex: 1;
    font-size: var(--text-base);
    color: var(--color-text-main);
}

.test-actions {
    margin-bottom: var(--space-2xl);
}

#copyFailingTestsBtn {
    background-color: var(--color-warning);
    color: #000;
}

#copyFailingTestsBtn:hover {
    background-color: #e0a800;
}

.start-app-btn {
    background-color: #17a2b8;
    /* Note: Specific button color - consider adding to design tokens if reused */
}

.start-app-btn:hover {
    background-color: #138496;
}

#runTestsBtn {
    background-color: var(--color-success);
}

#runTestsBtn:hover {
    background-color: #218838;
}

.form-info {
    padding: var(--space-lg);
    background-color: var(--color-bg-selected);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2xl);
    font-size: var(--text-base);
    color: var(--color-primary-text-darker);
}

/* Item Listing View Styles */
.item-listing-view-section {
    /* Base styles inherited from .view-section */
    padding: var(--space-3xl);
}


.item-listing-view-content {
    display: block;
}

.item-listing-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-2xl);
}

/* Item listing textarea now uses .textarea base component */
.item-listing-textarea {
    min-height: 200px;
    line-height: 1.6;
}

.item-listing-submit-btn {
    align-self: flex-start;
    padding: var(--space-xl) var(--space-4xl);
    font-size: 16px;
    font-weight: 500;
}

.sample-initiatives-btn {
    background-color: #9c27b0; /* Purple/violet color */
    color: white;
}

.sample-initiatives-btn:hover:not(:disabled) {
    background-color: #7b1fa2; /* Darker purple on hover */
}

.item-listing-items {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 2px solid var(--color-border);
}

.item-listing-items h3 {
    margin: 0 0 15px 0;
    color: var(--color-text-light);
    font-size: 1.1em;
}

.item-listing-items-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    max-height: 400px;
    overflow-y: auto;
    padding: var(--space-lg);
    background-color: var(--color-bg-light);
    border-radius: var(--radius-lg);
}

.item-listing-item {
    /* Base styles inherited from .list-item-card */
    justify-content: space-between;
    padding: var(--space-lg) var(--space-2xl);
    background-color: var(--color-surface);
    gap: var(--space-lg);
}

.item-remove-btn {
    background: none;
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: var(--space-xs) var(--space-md);
    border-radius: var(--radius-md);
    transition: all 0.2s;
    opacity: 0.6;
    flex-shrink: 0;
}

.item-remove-btn:hover {
    opacity: 1;
    background-color: var(--color-bg-light);
    transform: scale(1.1);
}

.item-remove-btn:active {
    transform: scale(0.95);
}

.item-listing-item-name .item-link {
    color: var(--color-primary);
    text-decoration: none;
    margin-left: var(--space-sm);
    font-size: var(--text-base);
    display: inline-block;
}

.item-listing-item-name .item-link:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* ============================================================================
   Base View Components
   ============================================================================ */

/* View Section - Base component for all view sections */
.view-section {
    margin-bottom: var(--space-3xl);
    padding: var(--space-2xl);
    background-color: var(--color-surface);
    border-radius: var(--radius-xl);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
}

/* View Section Padding Variants */
.view-section-padding-sm {
    padding: var(--space-2xl);
}

.view-section-padding-md {
    padding: var(--space-3xl);
}

/* View Header - Base component for view headers */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2xl);
}

.view-header h2 {
    margin: 0;
    color: var(--color-text-main);
}

/* View Content - Base component for view content */
.view-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

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

/* List Item Card - Base component for items in lists (results, item-listing) */
.list-item-card {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
    padding: var(--space-xl) var(--space-2xl);
    background-color: var(--color-bg-light);
    border-left: 4px solid var(--color-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.list-item-card.list-item-card-inactive {
    opacity: 0.6;
    background-color: var(--color-bg-lighter);
    border-left-color: var(--color-muted);
}

.list-item-card-name {
    font-weight: 500;
    color: var(--color-text-main);
    font-size: var(--text-base);
    flex: 1;
}

/* ============================================================================
   Urgency View Styles
   ============================================================================ */
.toggle-view-btn {
    padding: var(--space-sm) var(--space-xl);
    font-size: var(--text-md);
    background-color: var(--color-muted);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background-color 0.2s;
}

.toggle-view-btn:hover {
    background-color: var(--color-muted-dark);
}

.urgency-callout,
.value-callout,
.duration-callout,
.results-callout,
.item-listing-callout {
    background-color: var(--color-primary-lighter);
    border-left: 4px solid var(--color-primary-light);
    border-radius: var(--radius-md);
    padding: var(--space-xl) var(--space-lg);
    margin-bottom: var(--space-2xl);
    color: var(--color-primary-text);
    font-size: var(--text-base);
    font-weight: 500;
}

.urgency-callout a,
.value-callout a,
.duration-callout a,
.results-callout a,
.item-listing-callout a {
    color: var(--color-primary-text-dark);
    text-decoration: underline;
    font-weight: 600;
}

.urgency-callout a:hover,
.value-callout a:hover,
.duration-callout a:hover,
.results-callout a:hover,
.item-listing-callout a:hover {
    color: var(--color-primary-text-darker);
    text-decoration: none;
}

/* Collapsed state handled by .view-content.collapsed */

/* Grid containers use flex to contain the grid */

.value-grid-header-row,
.duration-grid-header-row,
.urgency-grid-header-row {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    align-items: flex-end;
    flex-shrink: 0;
    width: 100%;
}

.value-axis-label-container,
.duration-axis-label-container,
.urgency-axis-label-container {
    width: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-bottom: 5px;
    flex-shrink: 0;
}

/* Urgency row labels are visible placeholders (grey background, not blue, since urgency is not the active stage for rows) */
/* They inherit the base grid header styles automatically */

/* Urgency columns are now part of the grid - no separate container needed */

/* Urgency column uses same styles as grid cells (defined above) */

/* Urgency column content - now just a flex container */
.urgency-column-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.urgency-column-content .urgency-item {
    /* Base styles inherited from .item-card */
    /* Note: urgency items use flex-direction: column, which is unique to urgency view */
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: var(--space-sm);
}

.urgency-column-content .urgency-item > div:first-child {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
    width: 100%;
}

/* Item link styles - work with both base .item-name and view-specific classes */
.item-name .item-link,
.urgency-item-name .item-link,
.value-item-name .item-link,
.duration-item-name .item-link {
    color: var(--color-primary);
    text-decoration: none;
    margin-left: var(--space-xs);
    font-size: var(--text-base);
    display: inline-block;
}

.item-name .item-link:hover,
.urgency-item-name .item-link:hover,
.value-item-name .item-link:hover,
.duration-item-name .item-link:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

.urgency-quick-buttons {
    display: flex;
    gap: var(--space-sm);
    margin-top: 8px;
    flex-wrap: wrap;
}

.urgency-quick-btn {
    padding: var(--space-xs) var(--space-lg);
    font-size: var(--text-xs);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border);
    background-color: var(--color-bg-light);
    color: var(--color-text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    font-weight: 500;
}

.urgency-quick-btn:hover:not(:disabled) {
    background-color: var(--color-bg-lighter);
    border-color: var(--color-disabled);
}

.urgency-quick-btn.active {
    background-color: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.urgency-quick-btn.active:hover:not(:disabled) {
    background-color: var(--color-primary-dark);
    border-color: var(--color-primary-dark);
}

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

.urgency-column-footer {
    background-color: var(--color-bg-lighter);
    padding: var(--space-lg);
    text-align: center;
    font-weight: 500;
    color: var(--color-text-secondary);
    border-top: 1px solid var(--color-border);
    font-size: var(--text-base);
}

/* Urgency no-value items match other items */
.urgency-no-value-content .urgency-item {
    /* Base styles inherited from .item-card */
    /* Note: parking lot items use different border color (#6c757d) and flex-direction: column */
    border-left-color: var(--color-muted);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Empty state handled by .parking-lot-content.empty */

/* Value View Styles */

/* ============================================
   BASE GRID COMPONENT CLASSES
   ============================================ */

/* Grid Container - Base class for all grid containers */
.grid-container {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Grid Base - Common grid properties */
.grid {
    display: grid;
    grid-template-columns: 80px 1fr 1fr 1fr;
    gap: var(--space-sm);
    flex: 1;
    min-height: 0;
    width: 100%;
}

/* Grid row count modifiers */
.grid-rows-3 {
    grid-template-rows: auto minmax(120px, auto) auto;
}

.grid-rows-4 {
    grid-template-rows: auto minmax(120px, auto) minmax(120px, auto) minmax(120px, auto);
}

.grid-rows-5 {
    grid-template-rows: auto minmax(120px, auto) minmax(120px, auto) minmax(120px, auto) auto;
}

/* Grid Cell - Base class for all grid cells */
.grid-cell {
    min-height: 100px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-surface);
    padding: var(--space-lg);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}

/* Grid Label - Base class for all grid labels */
.grid-label {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-bg-lighter);
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--color-text-secondary);
    padding: 5px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Grid Label Row - Vertical text labels */
.grid-label-row {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    width: 80px;
    flex: 1;
    min-height: 100px;
}

/* Grid Label Column - Horizontal text labels */
.grid-label-column {
    height: 40px;
    min-width: 0;
}

/* Item Card - Base class for all item cards */
.item-card {
    padding: var(--space-sm) var(--space-md);
    background-color: var(--color-bg-light);
    border-left: 3px solid var(--color-primary);
    border-radius: var(--radius-md);
    font-size: var(--text-md);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* Item Card - Inactive state */
.item-card-inactive {
    opacity: 0.6;
    background-color: var(--color-bg-lighter);
}

/* Item Name - Base class for item names */
.item-name {
    flex: 1;
    font-weight: 500;
    color: var(--color-text-main);
}

/* Item Controls - Base class for item controls */
.item-controls {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* Parking Lot Box - Base class for parking lot containers */
.parking-lot-box {
    display: flex;
    flex-direction: column;
    background-color: var(--color-grid-parking-bg); /* Slightly different background for parking lot */
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-sizing: border-box;
    min-height: 100px;
}

/* Parking Lot Content - Inner content area */
.parking-lot-content {
    min-height: 100px;
    padding: var(--space-lg);
    background-color: var(--color-grid-parking-bg); /* Slightly different background for parking lot */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.parking-lot-content.empty {
    text-align: center;
    color: var(--color-text-lighter);
    padding: var(--space-3xl);
    font-style: italic;
    font-size: 12px;
}

/* ============================================
   EXISTING VIEW-SPECIFIC CLASSES (to be migrated)
   ============================================ */

/* Grid containers now extend .grid-container base class */
/* Old axis label styles - no longer needed with CSS Grid */
/* Old flexbox containers - no longer needed with CSS Grid */
/* Grid labels now extend .grid-label base class with modifiers */
/* Grid corner cells (empty placeholders) - no styling needed */

/* Color value row labels in value view to indicate active stage */
#valueViewSection .value-row-label {
    background-color: var(--color-primary-lighter); /* Light blue to indicate value stage */
}

/* Parking Lot label - different color from other headers, must override view-specific colors */
.parking-lot-label {
    background-color: var(--color-parking-lot-bg); /* Light yellow/beige */
    color: var(--color-parking-lot-text); /* Darker brown/yellow for contrast */
}

/* Ensure parking lot label keeps its distinct color in both views (higher specificity override) */
#valueViewSection .value-row-label.parking-lot-label,
#urgencyViewSection .urgency-row-label.parking-lot-label {
    background-color: var(--color-parking-lot-bg) !important;
    color: var(--color-parking-lot-text) !important;
}

/* Grid definitions now extend .grid base class with row modifiers */
/* Urgency no-value box spans columns 2-4 */
.urgency-no-value-box {
    grid-column: 2 / 5; /* Spans from column 2 to column 5 (columns 2, 3, 4) */
}

/* Value no-value box merged (spans columns 2-4 when all items have value) */
.value-no-value-box-merged {
    grid-column: 2 / 5; /* Spans from column 2 to column 5 (columns 2, 3, 4) */
}

/* Grid cells now extend .grid-cell base class */


/* Remove color coding from value view arrows - use neutral colors */
.value-grid-cell .property-btn.increment-btn,
.value-grid-cell .property-btn.decrement-btn,
.value-no-value-box-content .property-btn.increment-btn,
.value-no-value-box-content .property-btn.decrement-btn {
    background-color: var(--color-bg-light);
    color: var(--color-text-main);
    border-color: var(--color-border);
}

.value-grid-cell .property-btn.increment-btn:hover:not(:disabled),
.value-grid-cell .property-btn.decrement-btn:hover:not(:disabled),
.value-no-value-box-content .property-btn.increment-btn:hover:not(:disabled),
.value-no-value-box-content .property-btn.decrement-btn:hover:not(:disabled) {
    background-color: var(--color-bg-lighter);
    border-color: var(--color-disabled);
}


/* Duration select now uses .select base component */
.duration-select {
    background-color: var(--color-primary-lighter); /* Light blue to indicate duration stage */
    min-width: 80px;
}

/* Empty duration dropdowns use parking lot colors */
.duration-select-empty {
    background-color: var(--color-parking-lot-bg) !important;
    color: var(--color-parking-lot-text) !important;
}

.duration-select:disabled {
    background-color: var(--color-bg-lighter);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Focus styles now handled by base .select component */

/* Urgency column labels are now direct grid children - no container needed */

/* Urgency column label uses same styles as other headers (defined above) */

/* Color urgency column labels in urgency view to indicate active stage */
#urgencyViewSection .urgency-column-label {
    background-color: var(--color-primary-lighter); /* Light blue to indicate urgency stage */
}

/* Clickable header links */
.header-link {
    color: inherit;
    text-decoration: underline;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: opacity 0.2s;
}

.header-link:hover {
    opacity: 0.8;
}

.header-link:active {
    opacity: 0.6;
}

/* Value no-value boxes are now part of the grid (row 5, columns 2-4) */
.value-no-value-box-content .value-item {
    /* Note: parking lot items use different border color */
    border-left-color: var(--color-muted);
}

/* Empty state handled by .parking-lot-content.empty */

/* Results View Styles */
.results-view-content {
    /* Base styles inherited from .view-content */
    overflow: visible; /* Override for results view */
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.new-item-badge {
    display: inline-block;
    margin-left: var(--space-sm);
    padding: 2px var(--space-sm);
    background-color: var(--color-warning);
    color: var(--color-warning-text);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
}

.reordered-badge {
    display: inline-block;
    margin-left: var(--space-sm);
    padding: 2px var(--space-sm);
    background-color: var(--color-primary-lighter);
    color: var(--color-primary-text);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
}

.results-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: var(--color-primary);
    color: white;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.results-item.item-inactive .results-slot {
    background-color: var(--color-muted);
}

.results-item-controls {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.results-arrow-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background-color: var(--color-bg-light);
    color: var(--color-text-main);
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.results-arrow-btn:hover:not(:disabled) {
    background-color: var(--color-bg-lighter);
    border-color: var(--color-disabled);
}

.results-arrow-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: var(--color-bg-lighter);
}


.results-view-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--space-2xl);
}

.reset-order-btn {
    padding: var(--space-md) var(--space-lg);
    font-size: var(--text-base);
    font-weight: 500;
    color: var(--color-text-main);
    background-color: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.reset-order-btn:hover {
    background-color: var(--color-bg-lighter);
    border-color: var(--color-disabled);
}

.reset-order-btn:active {
    background-color: var(--color-border);
}

.results-item-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.results-item-name {
    font-weight: 500;
    color: var(--color-text-main);
    font-size: 16px;
}

.results-item-metrics {
    display: flex;
    gap: var(--space-2xl);
    font-size: var(--text-base);
    color: var(--color-text-muted);
    flex-wrap: wrap;
}

.results-metric {
    color: var(--color-text-muted);
}

.results-cd3 {
    font-weight: 600;
    color: var(--color-text-secondary);
}

.confidence-weighted-cd3 {
    color: var(--color-success);
    font-weight: 600;
}

/* Confidence Survey Styles */
.confidence-survey-buttons {
    margin-top: 10px;
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

/* Confidence survey buttons now use .btn base component */
.confidence-survey-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.confidence-survey-form {
    margin-top: 15px;
    padding: var(--space-2xl);
    background-color: var(--color-bg-light);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    transition: all 0.3s ease;
}

.confidence-survey-section {
    margin-bottom: var(--space-3xl);
    padding-bottom: 15px;
    border-bottom: 1px solid var(--color-border);
}

.confidence-survey-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.confidence-survey-question {
    font-weight: 500;
    color: var(--color-text-secondary);
    margin-bottom: 12px;
    font-size: var(--text-base);
}

.confidence-vote-inputs {
    display: flex;
    flex-direction: row;
    gap: var(--space-2xl);
    flex-wrap: wrap;
    align-items: flex-start;
}

.confidence-vote-input-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
    flex: 1;
    min-width: 200px;
}

.confidence-vote-label {
    font-size: 12px;
    color: var(--color-text-secondary);
    font-weight: 400;
    line-height: 1.3;
}

/* Confidence vote inputs now use .input base component */
.confidence-vote-input {
    max-width: 100px;
    text-align: center;
}

.confidence-survey-form-actions {
    margin-top: 20px;
    display: flex;
    gap: var(--space-lg);
    justify-content: flex-end;
}

/* Confidence survey buttons now use .btn base component */
.confidence-survey-submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* CD3 link styling */
.cd3-link {
    color: #007bff;
    text-decoration: underline;
    cursor: pointer;
}

.cd3-link:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* Confidence survey error styling */
.confidence-survey-error {
    margin: var(--space-2xl) 0;
    padding: var(--space-xl);
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: var(--radius-md);
    color: #721c24;
}

.confidence-survey-error-message {
    font-size: var(--text-sm);
    line-height: 1.5;
}

