/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    color: #334155;
    line-height: 1.6;
    min-height: 100vh;
}

/* Colors */
:root {
    --primary: #1e40af;
    --primary-light: #3b82f6;
    --primary-dark: #1e3a8a;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* 6M Colors */
    --method: #10b981;
    --machine: #8b5cf6;
    --material: #f59e0b;
    --manpower: #ef4444;
    --environment: #3b82f6;
    --measurement: #ec4899;
    
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    
    --border-radius: 8px;
    --border-radius-lg: 12px;
}

/* Utilities */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.text-center { text-align: center; }
.mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }

/* App Container */
#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Screens */
.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.screen.hidden {
    display: none;
}

/* Progress Container */
.progress-container {
    background: var(--white);
    padding: 1rem;
    box-shadow: var(--shadow-md);
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 10;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.progress-header h2 {
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.progress-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow-x: auto;
    gap: 0.5rem;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
    position: relative;
}

.progress-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    right: -25px;
    width: 50px;
    height: 2px;
    background: var(--gray-300);
    z-index: -1;
}

.progress-step.completed:not(:last-child)::after {
    background: var(--success);
}

.step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-bottom: 0.25rem;
    background: var(--gray-300);
    color: var(--gray-600);
    transition: all 0.3s ease;
}

.progress-step.completed .step-circle {
    background: var(--success);
    color: white;
}

.progress-step.active .step-circle {
    background: var(--primary);
    color: white;
    transform: scale(1.1);
}

.progress-step span {
    font-size: 0.75rem;
    color: var(--gray-600);
    text-align: center;
}

/* Header */
.header {
    text-align: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background: var(--gray-200);
}

.big-btn {
    padding: 1rem 2rem;
    font-size: 1.125rem;
    min-height: 60px;
    justify-content: center;
}

/* Dashboard */
.dashboard-actions {
    padding: 0 1rem;
    margin-bottom: 2rem;
}

#new-problem-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    box-shadow: var(--shadow-lg);
}

.dashboard-filters {
    display: flex;
    gap: 0.5rem;
    padding: 0 1rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    background: var(--white);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.filter-btn.active, .filter-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.problems-list {
    flex: 1;
    padding: 0 1rem;
}

/* Problem Cards */
.problem-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    cursor: pointer;
    transition: all 0.2s ease;
}

.problem-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.problem-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.problem-title {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 1.125rem;
    flex: 1;
}

.problem-status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-in-progress {
    background: var(--warning);
    color: white;
}

.status-completed {
    background: var(--success);
    color: white;
}

.status-draft {
    background: var(--gray-300);
    color: var(--gray-700);
}

.problem-meta {
    display: flex;
    gap: 1rem;
    color: var(--gray-600);
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.problem-step {
    color: var(--primary);
    font-weight: 600;
}

/* Wizard Container */
.wizard-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 140px);
}

.mobile-tabs {
    display: none;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 0.5rem 1rem;
}

.tab-btn {
    padding: 0.75rem 1rem;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: var(--border-radius);
    margin-right: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.wizard-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wizard-panel:not(.active) {
    display: none;
}

/* Chat Panel */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--white);
    height: 100%;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    max-width: 80%;
    padding: 0.875rem 1.25rem;
    border-radius: var(--border-radius-lg);
    position: relative;
    animation: slideIn 0.3s ease;
}

.chat-message.assistant {
    background: var(--gray-100);
    color: var(--gray-800);
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-message.user {
    background: var(--primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-input-container {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
    background: var(--white);
}

.quick-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.quick-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--gray-300);
    background: var(--white);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

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

.chat-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.chat-input {
    flex: 1;
    padding: 0.875rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 1rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.mic-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    background: var(--white);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mic-btn:hover {
    border-color: var(--primary);
    background: rgba(30, 64, 175, 0.05);
}

.mic-btn.recording {
    border-color: #dc2626;
    background: #fef2f2;
    animation: mic-pulse 1s ease-in-out infinite;
}

@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(220, 38, 38, 0); }
}

@keyframes pulse-record {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-10px); }
}

.send-btn {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.send-btn:hover {
    background: var(--primary-dark);
}

.send-btn-inline {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn-inline:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* Step editing */
.step-toggle {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--gray-400);
    transition: transform 0.2s;
}

.summary-step.editing {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.15);
}

.step-edit {
    padding: 0.75rem 0 0.25rem;
}

.step-edit.hidden {
    display: none;
}

.edit-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary);
    margin: 0.75rem 0 0.25rem;
    font-style: italic;
}

.edit-label:first-child {
    margin-top: 0;
}

.edit-field {
    width: 100%;
    padding: 0.625rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
    background: var(--white);
}

.edit-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.1);
}

textarea.edit-field {
    resize: vertical;
    min-height: 60px;
}

select.edit-field {
    cursor: pointer;
    appearance: auto;
}

/* Summary Panel */
.summary-container {
    padding: 1rem;
    background: var(--gray-50);
    overflow-y: auto;
    height: 100%;
}

.eight-d-summary {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.summary-step {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.summary-step.completed {
    border-color: var(--success);
    border-left: 4px solid var(--success);
}

.summary-step.active {
    border-color: var(--primary);
    border-left: 4px solid var(--primary);
}

.step-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--gray-300);
    color: var(--gray-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

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

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

.step-title {
    font-weight: 600;
    color: var(--gray-800);
    font-size: 1.125rem;
}

.step-content {
    color: var(--gray-600);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Viewer Headers */
.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
}

.viewer-header h2 {
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 600;
}

/* Ishikawa Diagram */
.ishikawa-container {
    flex: 1;
    position: relative;
    background: var(--white);
    overflow: hidden;
}

.ishikawa-svg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.ishikawa-postits {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.ishikawa-postit {
    position: absolute;
    padding: 0.5rem 0.75rem;
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    border: 2px solid var(--gray-300);
    font-size: 0.875rem;
    cursor: move;
    pointer-events: auto;
    min-width: 120px;
    max-width: 200px;
    word-wrap: break-word;
    transition: all 0.2s ease;
}

.ishikawa-postit:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

.ishikawa-postit.method { border-color: var(--method); }
.ishikawa-postit.machine { border-color: var(--machine); }
.ishikawa-postit.material { border-color: var(--material); }
.ishikawa-postit.manpower { border-color: var(--manpower); }
.ishikawa-postit.environment { border-color: var(--environment); }
.ishikawa-postit.measurement { border-color: var(--measurement); }

.ishikawa-controls {
    padding: 1rem;
    background: var(--white);
    border-top: 1px solid var(--gray-200);
}

.category-legend {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.legend-item {
    padding: 0.5rem 0.75rem;
    background: var(--gray-100);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.legend-item:hover {
    background: var(--gray-200);
}

/* Five Whys */
.five-whys-container {
    padding: 2rem 1rem;
    background: var(--gray-50);
    min-height: calc(100vh - 80px);
}

.why-level {
    display: flex;
    align-items: center;
    margin-bottom: 2rem;
    position: relative;
}

.why-level:not(:last-child)::after {
    content: '↓';
    position: absolute;
    bottom: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    color: var(--primary);
}

.why-question {
    background: var(--primary);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-lg);
    font-weight: 600;
    margin-right: 1rem;
    min-width: 120px;
}

.why-answer {
    flex: 1;
    background: var(--white);
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-lg);
    border: 2px solid var(--gray-300);
    box-shadow: var(--shadow);
}

.why-answer.root-cause {
    border-color: var(--error);
    border-width: 3px;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Mode Toggle */
.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.mode-toggle {
    display: flex;
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 0.25rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
}

.mode-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    border-radius: calc(var(--border-radius) - 2px);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--gray-600);
    white-space: nowrap;
}

.mode-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow);
}

.mode-btn:hover:not(.active) {
    background: var(--gray-100);
    color: var(--gray-800);
}

/* Direct Mode Styles */
.direct-container {
    flex: 1;
    background: var(--gray-50);
    overflow-y: auto;
    padding: 1rem;
}

.direct-form {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.direct-section {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-200);
    overflow: hidden;
}

.section-header {
    display: flex;
    align-items: center;
    padding: 1.25rem 1.5rem;
    cursor: pointer;
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
    border-bottom: 1px solid var(--gray-200);
    transition: all 0.2s ease;
}

.section-header:hover {
    background: linear-gradient(135deg, var(--gray-100) 0%, var(--gray-50) 100%);
}

.section-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.125rem;
    margin-right: 1rem;
}

.section-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.section-title {
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--gray-800);
}

.section-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.progress-bar {
    width: 200px;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    min-width: 35px;
}

.section-toggle {
    margin-left: auto;
}

.chevron {
    width: 24px;
    height: 24px;
    color: var(--gray-500);
    transition: transform 0.3s ease;
}

.section-content {
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.section-content.open {
    padding: 1.5rem;
    max-height: none;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--gray-700);
    font-size: 0.875rem;
}

.guide-question {
    color: var(--primary);
    font-style: italic;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-textarea.highlight {
    border-color: var(--warning);
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

/* Radio Groups */
.radio-group {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--gray-700);
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 50%;
    position: relative;
    transition: all 0.2s ease;
}

.radio-label input[type="radio"]:checked + .radio-custom {
    border-color: var(--primary);
    background: var(--primary);
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

/* Checkbox Groups */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--gray-700);
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-300);
    border-radius: 4px;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    border-color: var(--primary);
    background: var(--primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 0.875rem;
    font-weight: 700;
}

/* IS/NOT IS Table */
.is-not-table {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 0.75rem;
}

.is-not-column h4 {
    margin-bottom: 0.5rem;
    color: var(--gray-700);
    font-size: 0.875rem;
    text-transform: uppercase;
    font-weight: 600;
}

/* Actions Table */
.actions-table {
    margin-top: 0.75rem;
}

.table-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--gray-100);
    border-radius: var(--border-radius);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

.table-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.table-input, .table-select {
    padding: 0.5rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
}

.btn-add-action {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--success);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    margin-top: 0.75rem;
    transition: all 0.2s ease;
}

.btn-add-action:hover {
    background: var(--success);
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-remove-action {
    padding: 0.5rem;
    background: var(--error);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.btn-remove-action:hover {
    background: var(--error);
    filter: brightness(1.1);
}

/* Analysis Tools */
.analysis-tools {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.btn-tool {
    padding: 0.5rem 1rem;
    background: var(--white);
    color: var(--primary);
    border: 2px solid var(--primary);
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.btn-tool:hover {
    background: var(--primary);
    color: white;
}

/* Completion Summary */
.completion-summary {
    background: linear-gradient(135deg, var(--gray-50) 0%, var(--white) 100%);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 2px solid var(--gray-200);
    margin-top: 1rem;
}

.completion-score {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.score-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) 0deg, var(--primary-light) 180deg, var(--gray-300) 180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.score-circle::before {
    content: '';
    position: absolute;
    width: 65px;
    height: 65px;
    background: var(--white);
    border-radius: 50%;
}

.score-value {
    position: relative;
    z-index: 1;
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--primary);
}

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

.closure-actions {
    display: flex;
    gap: 0.75rem;
}

#close-8d-btn {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
}

#close-8d-btn:disabled {
    background: var(--gray-300);
    color: var(--gray-600);
    cursor: not-allowed;
}

#export-pdf-btn {
    background: var(--warning);
    color: white;
}

#export-pdf-btn:hover {
    background: #d97706;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .mobile-tabs {
        display: flex;
    }
    
    .wizard-container {
        height: calc(100vh - 180px);
    }
    
    .progress-bar {
        gap: 0.25rem;
    }
    
    .progress-step {
        min-width: 60px;
    }
    
    .progress-step span {
        font-size: 0.7rem;
    }
    
    .step-circle {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }
    
    .progress-step:not(:last-child)::after {
        width: 30px;
        right: -15px;
    }
    
    .chat-message {
        max-width: 85%;
    }
    
    .category-legend {
        gap: 0.5rem;
    }
    
    .legend-item {
        font-size: 0.75rem;
        padding: 0.375rem 0.5rem;
    }
    
    .viewer-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .viewer-header h2 {
        text-align: center;
    }
    
    /* Direct Mode Mobile */
    .direct-container {
        padding: 0.5rem;
    }
    
    .direct-form {
        gap: 0.75rem;
    }
    
    .section-header {
        padding: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .section-number {
        width: 40px;
        height: 40px;
        font-size: 1rem;
        margin-right: 0;
    }
    
    .section-info {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    
    .section-title {
        font-size: 1.125rem;
    }
    
    .progress-bar {
        width: 100px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .radio-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .is-not-table {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .table-header {
        display: none;
    }
    
    .table-row {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        background: var(--gray-50);
        padding: 0.75rem;
        border-radius: var(--border-radius);
        margin-bottom: 0.75rem;
    }
    
    .analysis-tools {
        flex-direction: column;
    }
    
    .completion-summary {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
    
    .closure-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .mode-toggle {
        order: -1;
        margin-bottom: 0.5rem;
    }
    
    .header-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
}

@media (min-width: 769px) {
    .wizard-container {
        flex-direction: row;
    }
    
    .wizard-panel {
        width: 50%;
        border-right: 1px solid var(--gray-200);
    }
    
    .wizard-panel:last-child {
        border-right: none;
    }
    
    .wizard-panel.active {
        display: flex;
    }
    
    .mobile-tabs {
        display: none;
    }
}