/**
 * Triumph Digital Thailand - SEO Report Builder
 * Light Mode Modern Professional Stylesheet
 */

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-border: #c7d2fe;
    
    --secondary: #06b6d4;
    --secondary-hover: #0891b2;
    --secondary-light: #ecfeff;
    
    --success: #059669;
    --success-light: #d1fae5;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --danger: #dc2626;
    --danger-light: #fee2e2;

    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: var(--font-sans);
    background: #f8fafc;
    color: var(--slate-800);
    line-height: 1.5;
    font-size: 14px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.builder-header {
    background: #ffffff;
    border-bottom: 1px solid var(--slate-200);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.04);
}

.header-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-logo {
    width: 42px;
    height: 42px;
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 20px;
}

.brand-text h1 {
    font-size: 17px;
    font-weight: 700;
    color: var(--slate-900);
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.2;
}

.brand-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: var(--primary-light);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.brand-text p {
    font-size: 12px;
    color: var(--slate-500);
    margin-top: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #4338ca);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.35);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #4338ca, #3730a3);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.45);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #ffffff;
    border-color: var(--slate-300);
    color: var(--slate-700);
}
.btn-secondary:hover {
    background: var(--slate-50);
    border-color: var(--slate-400);
    color: var(--slate-900);
}

.btn-success {
    background: var(--success);
    color: #ffffff;
}
.btn-success:hover {
    background: #047857;
}

.btn-outline-danger {
    background: transparent;
    border-color: #fca5a5;
    color: var(--danger);
}
.btn-outline-danger:hover {
    background: var(--danger-light);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* AI Draft Trigger Buttons */
.btn-trigger-ai {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    font-family: inherit;
    color: #4338ca;
    background: linear-gradient(135deg, #ffffff 0%, #f5f3ff 50%, #eef2ff 100%);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    vertical-align: middle;
}

.btn-trigger-ai:hover {
    background: linear-gradient(135deg, #ede9fe 0%, #e0e7ff 100%);
    border-color: #818cf8;
    color: #3730a3;
    box-shadow: 0 3px 10px rgba(99, 102, 241, 0.22), 0 1px 2px rgba(79, 70, 229, 0.12);
    transform: translateY(-1px);
}

.btn-trigger-ai:active {
    background: #e0e7ff;
    border-color: #6366f1;
    color: #312e81;
    box-shadow: 0 1px 2px rgba(79, 70, 229, 0.15) inset;
    transform: translateY(0);
}

.btn-trigger-ai:focus {
    outline: none;
}

.btn-trigger-ai:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #6366f1;
}

.btn-trigger-ai svg,
.btn-trigger-ai .ai-sparkle-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    color: #6366f1;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.18s ease;
}

.btn-trigger-ai:hover svg,
.btn-trigger-ai:hover .ai-sparkle-icon {
    transform: scale(1.18) rotate(8deg);
    color: #4338ca;
}

.btn-trigger-ai:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Smart Paste / Format Table Buttons */
.btn-smart-paste {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    font-family: inherit;
    color: #0f766e;
    background: linear-gradient(135deg, #ffffff 0%, #f0fdfa 50%, #e6fffa 100%);
    border: 1px solid #99f6e4;
    border-radius: var(--radius-sm, 6px);
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    box-shadow: 0 1px 2px rgba(13, 148, 136, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    vertical-align: middle;
}

.btn-smart-paste:hover {
    background: linear-gradient(135deg, #ccfbf1 0%, #e0f2fe 100%);
    border-color: #2dd4bf;
    color: #115e59;
    box-shadow: 0 3px 10px rgba(13, 148, 136, 0.22), 0 1px 2px rgba(13, 148, 136, 0.12);
    transform: translateY(-1px);
}

.btn-smart-paste:active {
    background: #ccfbf1;
    border-color: #14b8a6;
    color: #134e4a;
    box-shadow: 0 1px 2px rgba(13, 148, 136, 0.15) inset;
    transform: translateY(0);
}

.btn-smart-paste:focus {
    outline: none;
}

.btn-smart-paste:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px #14b8a6;
}

.btn-smart-paste svg,
.btn-smart-paste .smart-paste-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    color: #0d9488;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.18s ease;
}

.btn-smart-paste:hover svg,
.btn-smart-paste:hover .smart-paste-icon {
    transform: scale(1.15);
    color: #0f766e;
}

.btn-smart-paste:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Form Label Row with Left Label and Right Action Button */
.form-label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 6px;
    gap: 12px;
}

.form-label-row .form-label {
    margin-bottom: 0 !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.form-label-row .form-label .sub-label {
    margin-left: auto;
    margin-right: 8px;
}

.form-label-row .btn-trigger-ai {
    margin: 0 !important;
    flex-shrink: 0;
    align-self: center;
}

.assist-field-draft {
    margin: 0;
    flex-shrink: 0;
}

/* Two-Column Application Layout */
.builder-layout {
    display: flex;
    max-width: 1600px;
    margin: 0 auto;
    width: 100%;
    align-items: flex-start;
    min-height: calc(100vh - 67px);
}

/* Sidebar Navigation */
.builder-sidebar {
    width: 320px;
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid var(--slate-200);
    padding: 24px 16px 120px;
    position: sticky;
    top: 67px;
    height: calc(100vh - 67px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
}

.builder-sidebar::-webkit-scrollbar {
    width: 5px;
}
.builder-sidebar::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: 4px;
}

/* Sidebar Progress Card */
.sidebar-progress-card {
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}

.sidebar-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--slate-500);
    margin-bottom: 8px;
}

.sidebar-progress-bar {
    height: 6px;
    background: var(--slate-200);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.sidebar-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    width: 9%;
    transition: width 0.3s ease;
    border-radius: var(--radius-full);
}

.sidebar-nav-title {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--slate-400);
    padding: 0 8px;
    margin-top: 4px;
}

/* Step Items List */
.sidebar-steps-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    color: var(--slate-600);
    border-left: 3px solid transparent;
    user-select: none;
}

.step-item:hover {
    color: var(--slate-900);
    background: var(--slate-50);
}

.step-item.active {
    color: var(--primary);
    background: var(--primary-light);
    border-left-color: var(--primary);
    font-weight: 600;
}

.step-number {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--slate-200);
    color: var(--slate-600);
    font-size: 11px;
    font-weight: 700;
    display: grid;
    place-items: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.step-item.active .step-number {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(79, 70, 229, 0.35);
}

.step-item.completed .step-number {
    background: var(--success);
    color: #ffffff;
}

.step-content {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.step-title {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--slate-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.25;
}

.step-item.active .step-title {
    color: var(--primary);
}

.step-sub {
    font-size: 11px;
    color: var(--slate-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.step-item.active .step-sub {
    color: var(--primary);
    opacity: 0.85;
}

/* Sidebar Brand Stamp */
.sidebar-brand-stamp {
    margin-top: auto;
    padding: 12px 14px;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand-stamp .stamp-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    color: #ffffff;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
}

.sidebar-brand-stamp .stamp-text {
    display: flex;
    flex-direction: column;
    font-size: 11px;
    line-height: 1.3;
}

.sidebar-brand-stamp .stamp-text b {
    color: var(--slate-800);
    font-size: 11.5px;
}

.sidebar-brand-stamp .stamp-text span {
    color: var(--slate-400);
}

/* Main Workspace */
.builder-main {
    flex: 1;
    min-width: 0;
    padding: 24px 32px 100px;
    margin: 0;
}

@media (max-width: 1024px) {
    .builder-layout {
        flex-direction: column;
    }
    .builder-sidebar {
        width: 100%;
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--slate-200);
        padding: 16px 20px;
    }
    .sidebar-steps-list {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        gap: 8px;
        padding-bottom: 8px;
    }
    .step-item {
        border-left: none;
        border-bottom: 3px solid transparent;
        white-space: nowrap;
        flex-shrink: 0;
    }
    .step-item.active {
        border-left-color: transparent;
        border-bottom-color: var(--primary);
    }
    .builder-main {
        width: 100%;
        padding: 20px 16px 100px;
    }
}

/* Section Card */
.form-section {
    display: none;
    animation: fadeIn 0.25s ease;
}
.form-section.active {
    display: block;
}

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

.builder-card {
    background: #ffffff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 32px;
    margin-bottom: 24px;
}

.section-head {
    margin-bottom: 24px;
    border-bottom: 1px solid var(--slate-100);
    padding-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.section-head-title h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--slate-900);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-badge {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #ffffff;
    width: 30px;
    height: 30px;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 800;
}

.section-head-title p {
    color: var(--slate-500);
    font-size: 13.5px;
    margin-top: 4px;
}

/* Form Controls */
.form-grid {
    display: grid;
    gap: 18px;
}
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 900px) {
    .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

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

.form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--slate-700);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    position: relative;
    user-select: none;
    line-height: 1.35;
}

.form-label .sub-label {
    margin-left: auto;
    font-weight: 400;
    color: var(--slate-400);
    font-size: 11px;
}

.form-label-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.form-label-tools .form-label {
    flex: 1;
    margin: 0;
}
.field-calculator-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    padding: 4px;
    border: 1px solid var(--primary-border);
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}
.field-calculator-button:hover,
.field-calculator-button:focus-visible {
    background: var(--primary);
    color: #fff;
    outline: none;
}
.field-calculator-button svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.calculator-only-group input,
.calculator-only-group select,
.calculator-only-group textarea {
    display: none !important;
}
.calculator-only-notice {
    display: block;
    margin-top: 6px;
    color: var(--slate-500);
    font-size: 11px;
}
.metrics-field-card {
    min-width: 0;
    padding: 14px;
    background: #ffffff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.metrics-field-card .form-label {
    min-height: 25px;
}
.metrics-field-card .calculator-only-notice {
    min-height: 30px;
}

.shared-metric-note {
    margin: -4px 0 14px;
    color: var(--slate-500);
    font-size: 11.5px;
}
.shared-metric-mirror {
    background: var(--slate-50) !important;
    color: var(--slate-600);
    cursor: not-allowed;
}

/* Tooltip Help Icon Button (Enhanced Size & Question Mark Badge) */
.field-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #eef2ff;
    border: 1.5px solid #c7d2fe;
    color: #4f46e5;
    cursor: help;
    flex-shrink: 0;
    transition: all 0.15s ease;
    outline: none;
    line-height: 1;
    margin-left: 3px;
    vertical-align: middle;
}

.field-help:hover,
.field-help:focus,
.field-help:focus-visible,
.field-help.active {
    background: #4f46e5;
    border-color: #4338ca;
    color: #ffffff;
    transform: scale(1.12);
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.35);
}

.field-help svg {
    pointer-events: none;
    width: 15px;
    height: 15px;
}

/* Tooltip Floating Guidance Bubble - Premium Crisp White */
.field-help-bubble {
    display: none;
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    width: 320px;
    max-width: min(350px, 88vw);
    padding: 12px 14px;
    background: #ffffff;
    color: #0f172a;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.45;
    text-align: left;
    box-shadow: 0 16px 36px -4px rgba(15, 23, 42, 0.16), 0 6px 16px -2px rgba(15, 23, 42, 0.08);
    border: 1px solid #e2e8f0;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.18s;
    z-index: 1050;
    white-space: normal;
}

/* Viewport-positioned bubbles avoid clipping from cards, scrolling panes, and the sticky header. */
.field-help-bubble.tooltip-fixed {
    position: fixed !important;
    margin: 0;
    transform: none !important;
}

.field-help-bubble.tooltip-portal {
    display: block !important;
}
.field-help-bubble.tooltip-portal.tooltip-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
.field-help-bubble.tooltip-portal.placement-right::before {
    top: 50%;
    left: auto;
    right: 100%;
    transform: translateY(-50%);
    border-width: 7px 7px 7px 0;
    border-color: transparent #e2e8f0 transparent transparent;
}
.field-help-bubble.tooltip-portal.placement-right::after {
    top: 50%;
    left: auto;
    right: 100%;
    transform: translateY(-50%);
    border-width: 6px 6px 6px 0;
    border-color: transparent #ffffff transparent transparent;
    margin: 0 -1px 0 0;
}
.field-help-bubble.tooltip-portal.placement-bottom::before {
    top: auto;
    bottom: 100%;
    border-width: 0 7px 7px 7px;
    border-color: transparent transparent #e2e8f0 transparent;
}
.field-help-bubble.tooltip-portal.placement-bottom::after {
    top: auto;
    bottom: 100%;
    border-width: 0 6px 6px 6px;
    border-color: transparent transparent #ffffff transparent;
    margin: 0 0 -1px 0;
}
.field-help-bubble.tooltip-portal.placement-left::before {
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    border-width: 7px 0 7px 7px;
    border-color: transparent transparent transparent #e2e8f0;
}
.field-help-bubble.tooltip-portal.placement-left::after {
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    border-width: 6px 0 6px 6px;
    border-color: transparent transparent transparent #ffffff;
    margin: 0 0 0 -1px;
}

/* Triangle Pointer Arrow (White with 1px border) */
.field-help-bubble::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 7px 7px 0 7px;
    border-style: solid;
    border-color: #e2e8f0 transparent transparent transparent;
}

.field-help-bubble::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
    margin-top: -1px;
}

/* Open on Hover, Focus, or Click Active */
.field-help:hover .field-help-bubble,
.field-help:focus .field-help-bubble,
.field-help:focus-visible .field-help-bubble,
.field-help.active .field-help-bubble {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

/* Bubble Header & Tool Badge */
.field-help-bubble .help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.field-help-bubble .help-tool-badge {
    display: inline-flex;
    align-items: center;
    background: #eef2ff;
    color: #4338ca;
    border: 1px solid #c7d2fe;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* Breadcrumb Navigation Path */
.field-help-bubble .help-loc {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: #334155;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 4px 8px;
    border-radius: 6px;
    margin-bottom: 8px;
    word-break: break-word;
    line-height: 1.35;
}

.field-help-bubble .help-loc svg {
    flex-shrink: 0;
    color: #64748b;
}

/* Description Text */
.field-help-bubble .help-desc {
    display: block;
    color: #475569;
    font-size: 12px;
    line-height: 1.5;
}

/* Calculation & Formula Box */
.field-help-bubble .help-calc {
    margin-top: 9px;
    padding: 8px 10px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    font-size: 11.5px;
    line-height: 1.45;
}

.field-help-bubble .help-calc .calc-label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #15803d;
    margin-bottom: 4px;
}

.field-help-bubble .help-calc .calc-label svg {
    color: #16a34a;
}

.field-help-bubble .help-calc .calc-content {
    color: #14532d;
    font-size: 11.5px;
}

.field-help-bubble .help-calc code {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
    padding: 1px 5px;
    border-radius: 4px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 600;
}

/* Alignment Variations to Avoid Viewport/Card Edge Clipping */
.field-help.help-left .field-help-bubble {
    left: -8px;
    transform: translateY(4px);
}
.field-help.help-left .field-help-bubble::before {
    left: 19px;
    transform: none;
}
.field-help.help-left .field-help-bubble::after {
    left: 20px;
    transform: none;
}
.field-help.help-left:hover .field-help-bubble,
.field-help.help-left:focus .field-help-bubble,
.field-help.help-left:focus-visible .field-help-bubble,
.field-help.help-left.active .field-help-bubble {
    transform: translateY(0);
}

.field-help.help-right .field-help-bubble {
    left: auto;
    right: -8px;
    transform: translateY(4px);
}
.field-help.help-right .field-help-bubble::before {
    left: auto;
    right: 19px;
    transform: none;
}
.field-help.help-right .field-help-bubble::after {
    left: auto;
    right: 20px;
    transform: none;
}
.field-help.help-right:hover .field-help-bubble,
.field-help.help-right:focus .field-help-bubble,
.field-help.help-right:focus-visible .field-help-bubble,
.field-help.help-right.active .field-help-bubble {
    transform: translateY(0);
}

/* JavaScript adds a placement class after checking the available viewport space. */
.field-help.placement-right .field-help-bubble {
    top: 50%;
    bottom: auto;
    left: calc(100% + 10px);
    right: auto;
    transform: translateY(-50%) translateX(-4px);
}
.field-help.placement-right .field-help-bubble::before {
    top: 50%;
    left: auto;
    right: 100%;
    transform: translateY(-50%);
    border-width: 7px 7px 7px 0;
    border-color: transparent #e2e8f0 transparent transparent;
}
.field-help.placement-right .field-help-bubble::after {
    top: 50%;
    left: auto;
    right: 100%;
    transform: translateY(-50%);
    border-width: 6px 6px 6px 0;
    border-color: transparent #ffffff transparent transparent;
    margin-right: -1px;
    margin-top: 0;
}
.field-help.placement-right:hover .field-help-bubble,
.field-help.placement-right:focus .field-help-bubble,
.field-help.placement-right:focus-visible .field-help-bubble,
.field-help.placement-right.active .field-help-bubble {
    transform: translateY(-50%) translateX(0);
}

.field-help.placement-bottom .field-help-bubble {
    top: calc(100% + 10px);
    bottom: auto;
    transform: translateX(-50%) translateY(-4px);
}
.field-help.placement-bottom .field-help-bubble::before {
    top: auto;
    bottom: 100%;
    border-width: 0 7px 7px 7px;
    border-color: transparent transparent #e2e8f0 transparent;
}
.field-help.placement-bottom .field-help-bubble::after {
    top: auto;
    bottom: 100%;
    border-width: 0 6px 6px 6px;
    border-color: transparent transparent #ffffff transparent;
    margin-top: 0;
    margin-bottom: -1px;
}
.field-help.placement-bottom:hover .field-help-bubble,
.field-help.placement-bottom:focus .field-help-bubble,
.field-help.placement-bottom:focus-visible .field-help-bubble,
.field-help.placement-bottom.active .field-help-bubble {
    transform: translateX(-50%) translateY(0);
}

.field-help.placement-left .field-help-bubble {
    top: 50%;
    bottom: auto;
    left: auto;
    right: calc(100% + 10px);
    transform: translateY(-50%) translateX(4px);
}
.field-help.placement-left .field-help-bubble::before {
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    border-width: 7px 0 7px 7px;
    border-color: transparent transparent transparent #e2e8f0;
}
.field-help.placement-left .field-help-bubble::after {
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    border-width: 6px 0 6px 6px;
    border-color: transparent transparent transparent #ffffff;
    margin-top: 0;
    margin-left: -1px;
}
.field-help.placement-left:hover .field-help-bubble,
.field-help.placement-left:focus .field-help-bubble,
.field-help.placement-left:focus-visible .field-help-bubble,
.field-help.placement-left.active .field-help-bubble {
    transform: translateY(-50%) translateX(0);
}

.form-control {
    width: 100%;
    padding: 9px 13px;
    font-size: 13.5px;
    font-family: inherit;
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--slate-800);
    transition: all 0.15s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Trend Input Group (Direction Icon Selector + Value) */
.trend-input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
    position: relative;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    border-radius: var(--radius-sm);
}

.trend-input-group .trend-select {
    flex: 0 0 auto;
    width: 82px;
    padding: 7px 6px 7px 10px;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    border: 1px solid var(--slate-300);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    background: #f8fafc;
    color: var(--slate-700);
    cursor: pointer;
    outline: none;
    transition: all 0.15s ease;
}

.trend-input-group .trend-select:focus {
    border-color: var(--primary);
    background: #ffffff;
    z-index: 2;
}

/* Distinct visual cues for selected trend direction */
.trend-input-group .trend-select[data-trend="up"] {
    background-color: #ecfdf5;
    color: #047857;
    border-color: #a7f3d0;
}

.trend-input-group .trend-select[data-trend="down"] {
    background-color: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.trend-input-group .trend-select[data-trend="flat"] {
    background-color: #fffbeb;
    color: #b45309;
    border-color: #fde68a;
}

.trend-input-group .trend-select[data-trend="none"] {
    background-color: #f1f5f9;
    color: #64748b;
    border-color: #cbd5e1;
}

.trend-input-group .trend-val {
    flex: 1 1 auto;
    min-width: 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 0 !important;
}

.trend-input-group .trend-val:focus {
    z-index: 3;
    position: relative;
}

/* Subtle visual glow when value is automatically calculated */
@keyframes autoCalcPulse {
    0% {
        background-color: #ecfdf5;
        border-color: #10b981;
        box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
    }
    100% {
        background-color: #ffffff;
        border-color: var(--slate-300);
        box-shadow: none;
    }
}

.auto-calc-pulse {
    animation: autoCalcPulse 0.85s ease-out;
}

textarea.form-control {
    min-height: 85px;
    line-height: 1.5;
    resize: vertical;
}

textarea.form-control.mono {
    font-family: var(--font-mono);
    font-size: 12px;
}

.input-hint {
    font-size: 11.5px;
    color: var(--slate-400);
    margin-top: 2px;
}

/* Card Boxes inside builder */
.builder-subcard {
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 22px;
    margin-top: 26px;
    margin-bottom: 26px;
}

.builder-subcard h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--slate-800);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* CSV Helper Container */
.csv-helper-box {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-md);
    padding: 20px 22px;
    margin-top: 26px;
    margin-bottom: 26px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Guaranteed spacing between ANY adjacent sections, subcards and helper blocks */
.builder-subcard + .csv-helper-box,
.csv-helper-box + .builder-subcard,
.builder-subcard + .builder-subcard,
.csv-helper-box + .csv-helper-box,
.builder-subcard + .form-grid,
.csv-helper-box + .form-grid,
.form-grid + .builder-subcard,
.form-grid + .csv-helper-box,
.form-group + .builder-subcard,
.form-group + .csv-helper-box,
.builder-subcard + .form-group,
.csv-helper-box + .form-group {
    margin-top: 26px !important;
}

/* Vertical flow inside builder cards */
.builder-card > .form-grid {
    margin-top: 22px;
    margin-bottom: 22px;
}

.builder-card > .form-group {
    margin-top: 18px;
    margin-bottom: 18px;
}

.builder-card > .section-head + * {
    margin-top: 0 !important;
}

.builder-card > :last-child {
    margin-bottom: 0 !important;
}

/* Comfortable spacing between stacked inputs within a form-group */
.form-group > input + input,
.form-group > input + .trend-input-group,
.form-group > .trend-input-group + input,
.form-group > input + .form-grid {
    margin-top: 8px !important;
}

.csv-helper-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.csv-columns-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--slate-700);
    display: flex;
    align-items: center;
    gap: 6px;
}

.csv-badge-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.col-badge {
    background: #ffffff;
    border: 1px solid var(--slate-300);
    color: var(--slate-700);
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.csv-helper-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bulk-table-editor {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}
.bulk-editor-toolbar,
.bulk-editor-actions,
.bulk-editor-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
}
.bulk-editor-toolbar {
    justify-content: space-between;
    flex-wrap: wrap;
}
.bulk-editor-tabs {
    gap: 3px;
    padding: 3px;
    background: var(--slate-100);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
}
.bulk-editor-tab {
    border: 0;
    border-radius: 4px;
    padding: 6px 11px;
    background: transparent;
    color: var(--slate-600);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}
.bulk-editor-tab.active {
    background: #fff;
    color: var(--slate-900);
    box-shadow: var(--shadow-sm);
}
.bulk-editor-status {
    color: var(--slate-500);
    font-size: 11px;
    margin-bottom: 6px;
}
.bulk-visual-table-wrap {
    max-height: 390px;
    overflow: auto;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    background: #fff;
}
.bulk-visual-table {
    width: 100%;
    min-width: 720px;
    border-collapse: separate;
    border-spacing: 0;
}
.bulk-visual-table th {
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 9px 8px;
    background: var(--slate-100);
    color: var(--slate-700);
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    border-bottom: 1px solid var(--slate-200);
}
.bulk-visual-table td {
    padding: 5px;
    border-bottom: 1px solid var(--slate-100);
}
.bulk-visual-table tr:last-child td {
    border-bottom: 0;
}
.bulk-visual-table .bulk-cell {
    min-width: 110px;
    padding: 7px 8px;
    font-size: 12px;
}
.bulk-visual-table .bulk-row-action-heading,
.bulk-visual-table .bulk-row-action-cell {
    width: 72px;
    min-width: 72px;
    text-align: center;
}
.bulk-visual-table .bulk-row-action-cell {
    white-space: nowrap;
}
.btn-duplicate-bulk-row,
.btn-remove-bulk-row {
    width: 28px;
    height: 28px;
    border: 1px solid var(--slate-200);
    border-radius: 6px;
    background: #fff;
    color: var(--slate-500);
    line-height: 1;
    cursor: pointer;
}
.btn-duplicate-bulk-row {
    margin-right: 4px;
    font-size: 17px;
}
.btn-remove-bulk-row {
    font-size: 18px;
}
.btn-duplicate-bulk-row:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.btn-remove-bulk-row:hover {
    border-color: var(--danger);
    color: var(--danger);
}
.bulk-visual-pane[hidden],
.bulk-csv-pane[hidden] {
    display: none !important;
}
.bulk-csv-pane > textarea {
    min-height: 190px;
}
.format-prompt-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.format-prompt-help,
.format-prompt-columns {
    color: var(--slate-600);
    font-size: 12px;
}
.format-prompt-columns code {
    display: block;
    margin-top: 5px;
    padding: 8px 10px;
    color: var(--slate-700);
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    overflow-wrap: anywhere;
}
.format-prompt-body textarea {
    width: 100%;
    min-height: 150px;
    resize: vertical;
}
.format-prompt-body #formatPromptInstructions {
    min-height: 240px;
}
.format-prompt-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}
.format-prompt-status {
    min-height: 18px;
    color: var(--success);
    font-size: 12px;
}

.calculator-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.calculator-formula-label {
    margin: 0;
    color: var(--slate-600);
    font-size: 12px;
}
.calculator-formula-label code {
    color: var(--slate-800);
    font-family: var(--font-mono);
}
.calculator-body .form-grid {
    gap: 14px;
}
.calculator-status {
    min-height: 18px;
    color: var(--success);
    font-size: 12px;
}
.calculator-status.error {
    color: var(--danger);
}
.calculator-actions {
    display: flex;
    justify-content: flex-end;
}



/* Bottom Floating Navigation Bar */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid var(--slate-200);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
    z-index: 90;
    padding: 12px 24px;
}

.bottom-container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bottom-left, .bottom-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.step-indicator-text {
    font-size: 13px;
    color: var(--slate-500);
    font-weight: 500;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 80px;
    right: 24px;
    background: var(--slate-900);
    color: #ffffff;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(12px);
    transition: all 0.25s ease;
    pointer-events: none;
}
.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* Modal for Preview / AI Prompt */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    place-items: center;
    padding: 20px;
}
.modal-overlay.open {
    display: grid;
}

.modal-content {
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 680px;
    overflow: hidden;
    animation: modalIn 0.2s ease;
}
.modal-content.large {
    max-width: 1280px;
    height: 90vh;
    display: flex;
    flex-direction: column;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--slate-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--slate-900);
}

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    color: var(--slate-400);
    cursor: pointer;
    line-height: 1;
}
.modal-close:hover {
    color: var(--slate-700);
}

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

.preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #e2e8f0;
}

.prompt-copy-box {
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--slate-800);
    white-space: pre-wrap;
    word-break: break-word;
    user-select: all;
    margin-bottom: 16px;
}

/* --- SECTION SHOW / HIDE VISIBILITY TOGGLES --- */
.section-head-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.section-visibility-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    background: var(--slate-50);
    border: 1px solid var(--slate-200);
    border-radius: 9999px;
    padding: 6px 14px 6px 8px;
    transition: all 0.2s ease;
}

.section-visibility-toggle:hover {
    background: #ffffff;
    border-color: var(--slate-300);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.section-toggle-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle-track {
    position: relative;
    width: 38px;
    height: 22px;
    background: var(--slate-300);
    border-radius: 9999px;
    transition: background 0.25s ease;
    display: inline-block;
    flex-shrink: 0;
}

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* Checked state */
.section-toggle-input:checked + .toggle-track {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
}

.section-toggle-input:checked + .toggle-track .toggle-thumb {
    transform: translateX(16px);
}

.toggle-label-text {
    font-size: 13px;
    font-weight: 600;
    color: var(--slate-700);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.section-toggle-input:checked ~ .toggle-label-text {
    color: var(--slate-900);
}

.section-toggle-input:not(:checked) ~ .toggle-label-text {
    color: var(--slate-400);
}

/* Dim the section card body when disabled */
.form-section.section-excluded .builder-card > *:not(.section-head):not(.section-excluded-banner) {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(0.5);
    transition: opacity 0.25s ease, filter 0.25s ease;
}

.form-section.section-excluded .section-head-title h2 {
    color: var(--slate-400);
}

.form-section.section-excluded .section-badge {
    background: var(--slate-300);
    color: var(--slate-600);
}

/* Excluded banner notice */
.section-excluded-banner {
    display: none;
    background: #fef2f2;
    border: 1px dashed #fca5a5;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 24px;
    font-size: 13.5px;
    color: #991b1b;
    align-items: center;
    gap: 10px;
}

.form-section.section-excluded .section-excluded-banner {
    display: flex;
}

/* Sidebar Excluded Badge */
.step-item.step-excluded {
    opacity: 0.55;
}

.step-item.step-excluded .step-number {
    background: var(--slate-200);
    color: var(--slate-400);
}

.step-excluded-badge {
    display: none;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: #ef4444;
    background: #fee2e2;
    padding: 1px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.step-item.step-excluded .step-excluded-badge {
    display: inline-block;
}

/* ==========================================================================
   Dynamic Repeaters: Section 9 (Challenges & Opps) & Section 10 (Action Plan)
   ========================================================================== */

/* Section 9: Dynamic Strategic Focus Area Cards */
.dynamic-card-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sec9-dynamic-card {
    background: #ffffff;
    border: 1px solid var(--slate-300);
    border-radius: var(--radius-md);
    padding: 16px;
    position: relative;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    border-left: 5px solid var(--primary);
    transition: all 0.2s ease;
}

.sec9-dynamic-card[data-type="good"] { border-left-color: #10b981; }
.sec9-dynamic-card[data-type="bad"] { border-left-color: #ef4444; }
.sec9-dynamic-card[data-type="watch"] { border-left-color: #f59e0b; }
.sec9-dynamic-card[data-type="opp"] { border-left-color: #6366f1; }

.sec9-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--slate-100);
    flex-wrap: wrap;
}

.sec9-card-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.sec9-card-index {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: var(--slate-100);
    color: var(--slate-700);
    font-weight: 700;
    font-size: 11px;
    display: grid;
    place-items: center;
}

.sec9-card-type-select {
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
    border-radius: var(--radius-sm);
    border: 1px solid var(--slate-300);
    background: #ffffff;
    cursor: pointer;
}

.btn-remove-dynamic {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-remove-dynamic:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #dc2626;
}

/* Section 10: Kanban Action Board Builder */
.kanban-builder-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

@media (max-width: 960px) {
    .kanban-builder-grid {
        grid-template-columns: 1fr;
    }
}

.kanban-builder-col {
    background: #f8fafc;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kanban-builder-col.col-completed { border-top: 4px solid #10b981; }
.kanban-builder-col.col-ongoing { border-top: 4px solid #4f46e5; }
.kanban-builder-col.col-planned { border-top: 4px solid #f59e0b; }

.kanban-col-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--slate-200);
}

.kanban-col-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: var(--slate-800);
}

.kanban-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
}
.dot-completed { background: #10b981; box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2); }
.dot-ongoing { background: #4f46e5; box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2); }
.dot-planned { background: #f59e0b; box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2); }

.kanban-count {
    background: var(--slate-200);
    color: var(--slate-700);
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 99px;
}

.kanban-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 20px;
}

.kanban-task-card {
    background: #ffffff;
    border: 1px solid var(--slate-300);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
    display: flex;
    flex-direction: column;
    gap: 8px;
    transition: all 0.15s ease;
}

.kanban-task-card:hover {
    border-color: var(--primary-border);
    box-shadow: 0 3px 8px rgba(15, 23, 42, 0.08);
}

.kanban-task-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.kanban-cat-input {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #4338ca;
    padding: 4px 8px;
    border: 1px solid #c7d2fe;
    border-radius: 4px;
    background: #eef2ff;
    width: 65%;
}

.btn-remove-task {
    background: transparent;
    border: none;
    color: var(--slate-400);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.btn-remove-task:hover {
    color: #ef4444;
    background: #fee2e2;
}

.btn-add-kanban-task {
    width: 100%;
    padding: 9px;
    border: 1.5px dashed var(--slate-300);
    background: #ffffff;
    border-radius: 6px;
    color: var(--slate-600);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-add-kanban-task:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.csv-toggle-link-wrap {
    text-align: right;
}

.btn-toggle-raw-csv {
    background: none;
    border: none;
    color: var(--slate-400);
    font-size: 11px;
    cursor: pointer;
    text-decoration: underline;
    transition: color 0.15s;
}

.btn-toggle-raw-csv:hover {
    color: var(--primary);
}

/* Section 10: Dynamic Targets & Priorities Lists */
.dynamic-target-list, .dynamic-priority-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sec10-target-row, .sec10-priority-row {
    background: #ffffff;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
}

.sec10-target-row .form-control, .sec10-priority-row .form-control {
    padding: 6px 8px;
    font-size: 12px;
}

.sec10-target-row input {
    margin: 0 !important;
}

/* Keep report entry and navigation within narrow screens. */
@media (max-width: 640px) {
    .header-container {
        padding: 12px 16px;
    }
    .brand-group, .brand-text {
        min-width: 0;
    }
    .brand-text h1 {
        flex-wrap: wrap;
    }
    .header-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }
    .header-actions > .btn {
        flex: 1 1 calc(50% - 8px);
    }
    .bottom-bar {
        padding: 10px 12px;
    }
    .bottom-container, .bottom-left, .bottom-right {
        flex-wrap: wrap;
        gap: 8px;
    }
    .bottom-left, .bottom-right {
        flex: 1 1 100%;
        justify-content: space-between;
    }
    .bottom-bar .btn {
        padding: 7px 9px;
        font-size: 11px;
    }
    .bottom-bar .step-indicator-text {
        font-size: 11px;
    }
    .builder-main {
        padding-bottom: 155px;
    }
}


/* ==========================================================================
   FURNISHED TABLE ARCHITECTURE (SPACIOUS MULTI-PART CELL DESIGN)
   ========================================================================== */
.bulk-visual-table.furnished-table {
    min-width: 100%;
    table-layout: auto;
}
.bulk-visual-table.furnished-table th {
    padding: 11px 14px;
    background: #f1f5f9;
    color: #1e293b;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #cbd5e1;
}
.bulk-visual-table.furnished-table td {
    padding: 10px 12px;
    vertical-align: top;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
}
.bulk-visual-table.furnished-table tr:hover td {
    background: #f8fafc;
}
.furnished-cell-stack {
    display: flex;
    flex-direction: column;
    gap: 7px;
    width: 100%;
}
.furnished-sub-input {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 3px 8px;
    width: 100%;
    box-sizing: border-box;
}
.furnished-sub-input .sub-input-prefix {
    font-size: 10.5px;
    font-weight: 700;
    color: #64748b;
    white-space: nowrap;
    user-select: none;
}
.furnished-sub-input .bulk-cell {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 3px 0 !important;
    font-size: 11.5px !important;
    min-width: 0 !important;
    flex: 1;
}
.furnished-rank-bar {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 8px;
    width: 100%;
    box-sizing: border-box;
}
.furnished-rank-input-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 0;
}
.furnished-rank-label {
    font-size: 9.5px;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.furnished-rank-input-wrap .bulk-cell {
    min-width: 0 !important;
    width: 100%;
    padding: 4px 6px !important;
    font-size: 12px;
    border-radius: 4px;
}
.furnished-rank-bar .rank-arrow {
    color: #94a3b8;
    font-weight: 700;
    font-size: 14px;
    line-height: 1;
    margin-top: 14px;
}
.bulk-cell-date {
    cursor: pointer;
    font-family: inherit;
    min-width: 130px;
}
.bulk-cell-date::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.15s;
}
.bulk-cell-date::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}
.bulk-rank-move {
    background: #f0fdf4 !important;
    color: #15803d !important;
    border-color: #bbf7d0 !important;
    font-weight: 800 !important;
}
.bulk-rank-move.down {
    background: #fef2f2 !important;
    color: #b91c1c !important;
    border-color: #fecaca !important;
}
.bulk-rank-move.new {
    background: #eff6ff !important;
    color: #1d4ed8 !important;
    border-color: #bfdbfe !important;
}
.bulk-rank-move.flat {
    background: #fffbeb !important;
    color: #b45309 !important;
    border-color: #fde68a !important;
}
.bulk-lead-change {
    background: #f0fdf4 !important;
    color: #15803d !important;
    border-color: #bbf7d0 !important;
    font-weight: 800 !important;
}
.bulk-lead-change.down {
    background: #fef2f2 !important;
    color: #b91c1c !important;
    border-color: #fecaca !important;
}
