*, *::before, *::after { box-sizing: border-box; }

:root {
    --color-background-primary: #ffffff;
    --color-background-secondary: #f8f9fa;
    --color-text-primary: #212529;
    --color-text-secondary: #6c757d;
    --color-text-info: #0c447c;
    --color-text-success: #27500a;
    --color-border-tertiary: rgba(0,0,0,0.1);
    --border-radius-md: 8px;
    --border-radius-lg: 12px;
}
body {
    background: #f0f2f5;
    color: #212529;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ── Cross-browser resets ── */
button, input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), select, textarea {
    font-family: inherit;
    font-size: inherit;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

/* ── App shell ── */
#app-header {
    background: linear-gradient(135deg, #0f2044 0%, #1a3a6b 50%, #1e5799 100%);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.18);
    position: sticky;
    top: 0;
    z-index: 100;
}
#app-header .brand {
    display: flex;
    align-items: center;
    gap: 12px;
}
#app-header .brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #4a90d9, #6f42c1);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(74,144,217,0.4);
}
#app-header .brand-name {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
}
#app-header .brand-tagline {
    font-size: 11px;
    color: rgba(255,255,255,0.55);
    font-weight: 400;
    margin-top: 1px;
}
#app-header .header-badge {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 11px;
    color: rgba(255,255,255,0.75);
    display: flex;
    align-items: center;
    gap: 5px;
}
#app-header .header-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #4cda64;
    display: inline-block;
}

#chat-container {
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    padding: 0 32px 32px;
    flex: 1;
    box-sizing: border-box;
}

/* ── Ask Your Docs ── */
.doc-chat-wrap {
    max-width: 820px;
    margin: 24px auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.doc-chat-header {
    background: #fff;
    border-radius: 16px 16px 0 0;
    padding: 28px 28px 20px;
    border: 1px solid #e2e8f0;
    border-bottom: none;
}
.doc-chat-title-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}
.doc-chat-title {
    font-size: 20px;
    font-weight: 700;
    color: #0f2044;
}
.doc-chat-subtitle {
    font-size: 13px;
    color: #64748b;
    margin-top: 2px;
}
.doc-chat-upload-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.doc-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #f1f5f9;
    border: 1.5px solid #cbd5e1;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.doc-upload-btn:hover { background: #e2e8f0; border-color: #94a3b8; }
.doc-upload-name {
    font-size: 12px;
    color: #64748b;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.doc-send-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: linear-gradient(135deg, #1a3a6b, #1e5799);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .15s;
}
.doc-send-upload-btn:hover { opacity: .88; }

#messages {
    display: none;
    flex-direction: column;
    gap: 12px;
    padding: 20px 28px;
    background: #f8fafc;
    border-left: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
    max-height: 480px;
    overflow-y: auto;
}
.doc-empty-state {
    text-align: center;
    padding: 48px 28px;
    background: #f8fafc;
    border-left: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
}
.user {
    display: flex;
    justify-content: flex-end;
}
.assistant {
    display: flex;
    justify-content: flex-start;
}
.bubble {
    padding: 10px 14px;
    border-radius: 12px;
    max-width: 75%;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}
.user .bubble {
    background: linear-gradient(135deg, #1a3a6b, #1e5799);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.assistant .bubble {
    background: #fff;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

#input-area {
    display: flex;
    gap: 0;
    border: 1px solid #e2e8f0;
    border-radius: 0 0 16px 16px;
    overflow: hidden;
    background: #fff;
}
#message-input {
    flex: 1;
    padding: 14px 18px;
    font-size: 14px;
    border: none;
    outline: none;
    background: transparent;
    color: #1e293b;
}
#message-input::placeholder { color: #94a3b8; }
#input-area button {
    padding: 12px 20px;
    background: linear-gradient(135deg, #1a3a6b, #1e5799);
    color: #fff;
    border: none;
    font-size: 16px;
    cursor: pointer;
    transition: opacity .15s;
    display: flex;
    align-items: center;
}
#input-area button:hover { opacity: .88; }

button {
    font-family: inherit;
    cursor: pointer;
}

#top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

#upload-form {
    display: flex;
    gap: 10px;
}
/* ── Tabs ── */
#tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 16px 0 0;
    margin-bottom: 24px;
    border-bottom: 2px solid #e2e8f0;
    background: transparent;
}
.tab-btn {
    padding: 10px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
    position: relative;
    transition: color .18s, background .18s;
    white-space: nowrap;
}
.tab-btn:hover {
    color: #1e3a6b;
    background: rgba(30,58,107,0.06);
}
.tab-btn.active {
    color: #1e3a6b;
    font-weight: 700;
    background: #fff;
    box-shadow: 0 -1px 0 0 #e2e8f0 inset, 2px 0 0 0 #e2e8f0 inset, -2px 0 0 0 #e2e8f0 inset;
}
.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #4a90d9, #6f42c1);
    border-radius: 2px 2px 0 0;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Progress bar ── */
#progress-container,
.csv-progress {
    width: 100%;
    height: 4px;
    background-color: #e0e0e0;
    overflow: hidden;
    display: none;
}
#progress-bar,
.csv-progress-bar {
    width: 50%;
    height: 100%;
    background-color: #007bff;
    animation: indeterminate 1.5s infinite linear;
}
@keyframes indeterminate {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(200%);  }
}

/* ── CSV top bar / upload hero ── */
#csv-top-bar {
    padding: 8px 0 4px;
}

#upload-hero {
    border: 2px dashed #b8cdf0;
    border-radius: 16px;
    padding: 36px 24px 28px;
    text-align: center;
    cursor: pointer;
    background: linear-gradient(135deg, #f8faff 0%, #eef3fc 100%);
    transition: border-color .2s, background .2s, transform .15s;
    user-select: none;
}
#upload-hero:hover, #upload-hero.has-file {
    border-color: #4a90d9;
    background: linear-gradient(135deg, #eef4ff 0%, #e4ecfc 100%);
    transform: translateY(-1px);
}
.upload-hero-icon { font-size: 40px; margin-bottom: 10px; }
.upload-hero-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e3a6b;
    margin-bottom: 6px;
}
.upload-link { color: #4a90d9; text-decoration: underline; }
.upload-hero-sub { font-size: 12px; color: #94a3b8; }
.upload-filename {
    margin-top: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #4a90d9;
}

#upload-btn {
    background: linear-gradient(135deg, #1e3a6b, #4a90d9);
    color: #fff;
    border: none;
    border-radius: 9px;
    padding: 10px 32px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .2s, transform .15s;
    box-shadow: 0 4px 14px rgba(74,144,217,0.35);
}
#upload-btn:not([disabled]):hover {
    opacity: .9;
    transform: translateY(-1px);
}

/* ── CSV body ── */
#csv-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* ── Sample table ── */
#sample-section  { display: none; margin-bottom: 24px; }
#columns-section { display: none; margin-bottom: 24px; }
#sample-section h3,
#columns-section h3,
#result-section h3 {
    margin-bottom: 8px;
    color: #343a40;
}
.sample-table-wrap { overflow-x: auto; }
.sample-table {
    border-collapse: collapse;
    font-size: 12px;
    min-width: 100%;
}
.sample-table th {
    background: #343a40;
    color: #fff;
    padding: 6px 10px;
    text-align: left;
    white-space: nowrap;
}
.sample-table td {
    padding: 5px 10px;
    border-bottom: 1px solid #dee2e6;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #212529;
    background: #ffffff;
}
.sample-table tr:nth-child(even) td { background: #f8f9fa; color: #212529; }

/* ── Column cards ── */
#columns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    align-items: start;
}
.col-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.col-card h4 {
    margin: 0 0 6px;
    font-size: 14px;
    color: #212529;
    display: flex;
    align-items: center;
    gap: 6px;
}
.col-type-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    background: #e9ecef;
    color: #495057;
    font-weight: normal;
}
.col-type-select {
    font-size: 11px;
    padding: 2px 6px;
    border: 1px solid #b8cdf0;
    border-radius: 6px;
    background: #eef3fc;
    color: #1a3c72;
    font-weight: 600;
    cursor: pointer;
    outline: none;
    flex: 1;
    min-width: 0;
}
.col-type-select:focus { border-color: #4a90d9; }
.conf-badge { font-size: 10px; opacity: 0.75; }
.col-samples {
    font-size: 11px;
    color: #6c757d;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.col-card label {
    font-size: 12px;
    color: #495057;
    display: block;
    margin-bottom: 3px;
}
.col-card select,
.col-card input[type="text"] {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 6px;
    box-sizing: border-box;
}
.col-actions-list {
    font-size: 11px;
    color: #0056b3;
    margin-bottom: 4px;
}
.action-badge {
    background: #d4edda;
    color: #155724;
    padding: 1px 6px;
    border-radius: 3px;
    margin-right: 3px;
    font-size: 10px;
}
.override-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
}
.override-row input[type="checkbox"] { margin: 0; }
.override-row label {
    margin: 0;
    font-size: 11px;
    color: #495057;
}

/* ── Process button ── */
#process-btn-wrap {
    display: none;
    text-align: center;
    margin: 8px 0 20px;
}
#process-btn {
    padding: 10px 36px;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    cursor: pointer;
}
#process-btn:hover { background: #1e7e34; }
#process-btn:disabled {
    background: #94d3a2;
    cursor: not-allowed;
}

/* ── Result section ── */
#result-section { display: none; }
.result-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.stat-pill {
    background: #e9ecef;
    border-radius: 20px;
    padding: 4px 14px;
    font-size: 12px;
    color: #495057;
}
.stat-pill.green { background: #d4edda; color: #155724; }
.stat-pill.red   { background: #f8d7da; color: #721c24; }
#download-btn {
    padding: 8px 20px;
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 14px;
}
#download-btn:hover { background: #0056b3; }
/* ── About Us page ── */
.about-content {
    max-width: 100%;
    margin: 32px auto;
    padding: 48px;
    background: #ffffff;
    color: #212529;
    border-radius: 16px;
    box-shadow: 0 25px 70px rgba(0,0,0,0.15);
}

/* make headings feel more premium */
.about-content h1 {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.about-content h2 {
    font-size: 18px;
    font-weight: 600;
    margin-top: 30px;
    margin-bottom: 12px;
    color: #212529;
}

/* first hero block (your top centered section) */
.about-content > div:first-child {
    padding: 2.5rem 1rem 3rem;
}

/* TOP badge (pill) */
.about-content div[style*="inline-flex"] {
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
}

/* check icons */
.about-content .ti-check {
    color: #22c55e;
    font-weight: bold;
}

/* subtle global text improvement */
.about-content p {
    line-height: 1.7;
    font-size: 14.5px;
}
.about-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 30px;
}

.about-card {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 14px;
    padding: 18px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.06);
    transition: all 0.25s ease;
}

.about-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(0,0,0,0.12);
}
.about-hero {
    text-align: center;
    margin-bottom: 30px;
}

.about-hero h1 {
    font-size: 34px;
    margin-bottom: 10px;
    font-weight: 600;
}

.about-hero p {
    font-size: 16px;
    color: #6c757d;
    max-width: 650px;
    margin: auto;
}
/* ── Site Footer ── */
#site-footer {
    background: linear-gradient(135deg, #0f2044 0%, #1a3a6b 60%, #1e5799 100%);
    margin-top: auto;
    padding: 0;
    flex-shrink: 0;
}
.site-footer-inner {
    max-width: 1440px;
    margin: 0 auto;
    padding: 20px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}
.site-footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}
.site-footer-built {
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
}
.site-footer-built strong {
    color: #fff;
}
.site-footer-built a {
    color: #93c5fd;
    text-decoration: none;
    font-weight: 600;
}
.site-footer-built a:hover {
    color: #fff;
    text-decoration: underline;
}
.site-footer-copy {
    font-size: 11px;
    color: rgba(255,255,255,0.4);
}

.ti {
    font-size: 20px;
    color: #0c447c;
    display: inline-block;
}
.action-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 6px;
}
.action-checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.action-checkbox-row input[type="checkbox"] {
    margin-top: 3px;
    flex-shrink: 0;
}
.action-checkbox-row label {
    font-size: 12px;
    color: var(--color-text-primary, #212529);
    margin: 0;
    line-height: 1.4;
    cursor: pointer;
}
.preview-box {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.preview-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    background: var(--color-background-secondary, #f8f9fa);
    padding: 4px 8px;
    border-radius: 4px;
}
.preview-before {
    color: var(--color-text-secondary, #6c757d);
    text-decoration: line-through;
}
.preview-arrow {
    color: var(--color-text-secondary, #6c757d);
}
.preview-after {
    color: var(--color-text-success, #155724);
    font-weight: 500;
}

/* ── Column name in card header ── */
.col-name-input {
    font-weight: 600;
    color: #212529;
    font-size: inherit;
    font-family: inherit;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    padding: 1px 4px;
    min-width: 0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: text;
    transition: border-color 0.15s, background 0.15s;
}
.col-name-input:hover {
    border-color: #ced4da;
    background: #f8f9fa;
}
.col-name-input:focus {
    outline: none;
    border-color: #4a90d9;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(74,144,217,0.15);
}
.col-null-pct {
    font-size: 10px;
    color: #6c757d;
    margin-left: auto;
}
.col-null-pct.null-warn {
    color: #dc3545;
    font-weight: 600;
}

/* ── Distribution / frequency stats bar ── */
.col-stats-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 6px 0 4px;
    padding: 6px 8px;
    background: #f0f4ff;
    border-radius: 6px;
    border-left: 3px solid #4a6fa5;
}
.stat-item {
    font-size: 10px;
    color: #3a3a5c;
    background: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid #d0d8f0;
    font-family: monospace;
}
.stat-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    background: #e9ecef;
    color: #495057;
}
.stat-badge.stat-ok   { background: #d4edda; color: #155724; }
.stat-badge.stat-warn { background: #fff3cd; color: #856404; }

/* ── Value frequency row ── */
.col-freq-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 3px 0 6px;
}
.freq-val {
    font-size: 10px;
    background: #e9ecef;
    color: #343a40;
    padding: 2px 7px;
    border-radius: 10px;
}
.freq-val em {
    font-style: normal;
    color: #6c757d;
    margin-left: 3px;
}

/* ── Column format options panel ── */
.fmt-options-panel {
    background: #eef4ff;
    border: 1px solid #c5d8f8;
    border-radius: 6px;
    padding: 8px 10px;
    margin: 8px 0 4px;
}
.fmt-options-title {
    font-size: 10px;
    font-weight: 700;
    color: #3a5a99;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 6px;
}
.fmt-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}
.fmt-row:last-child { margin-bottom: 0; }
.fmt-label {
    font-size: 11px;
    color: #495057;
    min-width: 85px;
    flex-shrink: 0;
}
.fmt-select {
    flex: 1;
    padding: 3px 6px;
    border: 1px solid #b8cdf0;
    border-radius: 4px;
    font-size: 11px;
    color: #212529;
    background: #fff;
}

/* ── Action groups inside the card ── */
.action-group {
    margin-top: 8px;
}
.action-group-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    margin-bottom: 4px;
    padding-bottom: 2px;
    border-bottom: 1px solid #e9ecef;
}

/* ── Card header row (title + target toggle) ── */
.card-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}
.card-header-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.card-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}
.card-type-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.type-label {
    font-size: 10px;
    color: #6c757d;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Target label radio ── */
.target-label-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    white-space: nowrap;
    margin: 0;
    font-size: 11px;
    color: #6c757d;
    padding: 3px 8px;
    border: 1px dashed #ced4da;
    border-radius: 12px;
    flex-shrink: 0;
    transition: all 0.15s;
}
.target-label-toggle:has(input:checked) {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
    font-weight: 600;
}
.target-label-toggle input { margin: 0; accent-color: #ffc107; }
.target-label-text { pointer-events: none; }

/* ── Collapsible sections (value map, validation) ── */
.section-toggle {
    font-size: 11px;
    color: #0056b3;
    cursor: pointer;
    margin-top: 10px;
    user-select: none;
    padding: 3px 0;
}
.section-toggle:hover { color: #003d82; }

/* Advanced options toggle */
.advanced-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #6c757d;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, color 0.15s;
}
.advanced-toggle::after {
    content: '▸';
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.2s;
}
.advanced-toggle:hover {
    background: #e9ecef;
    color: #495057;
}
.advanced-toggle-open::after {
    transform: rotate(90deg);
}
.advanced-panel {
    border: 1px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 6px 6px;
    padding: 10px 12px;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}
.adv-section-label {
    font-size: 11px;
    font-weight: 600;
    color: #495057;
    margin-top: 8px;
    display: block;
}
.section-hint { color: #adb5bd; font-weight: normal; }
.collapsible-section {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 4px;
}

/* ── Value map editor ── */
.valuemap-hint {
    font-size: 10px;
    color: #6c757d;
    margin-bottom: 6px;
}
.vm-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
}
.vm-from, .vm-to {
    flex: 1;
    min-width: 0;
    width: 0;
    padding: 4px 7px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 11px;
    color: #212529;
    background: #fff;
}
.vm-arrow { font-size: 12px; color: #6c757d; }
.vm-add-btn {
    font-size: 11px;
    background: none;
    border: 1px dashed #0056b3;
    color: #0056b3;
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    margin-top: 4px;
}
.vm-add-btn:hover { background: #e7f0ff; }
.vm-remove-btn {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 13px;
    cursor: pointer;
    padding: 0 3px;
    line-height: 1;
}

/* ── Validation rule inputs ── */
.valrule-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
    min-width: 0;
}
.valrule-label {
    font-size: 11px;
    color: #495057;
    width: 80px;
    flex-shrink: 0;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.valrule-input {
    flex: 1;
    min-width: 0;
    width: 0;          /* forces flex to shrink instead of overflow */
    padding: 3px 6px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 11px;
    color: #212529;
    background: #fff;
}

/* ── Fill-missing strategy sub-panel ── */
.fill-strategy-panel {
    margin: 4px 0 6px 22px;
    padding: 8px 10px;
    background: #f0f4ff;
    border: 1px solid #c8d6f0;
    border-radius: 5px;
    min-width: 0;
    overflow: hidden;
}
.fill-strategy-title {
    font-size: 10px;
    font-weight: 700;
    color: #3d5a99;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.fill-strategy-options {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.fill-strategy-options label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: #343a40;
    cursor: pointer;
    font-weight: normal;
    white-space: nowrap;
    flex-wrap: nowrap;
    min-width: 0;
}
.fill-strat-hint {
    color: #6c757d;
    font-size: 10px;
    font-style: italic;
}
.fill-strat-const-row {
    flex-wrap: nowrap !important;
}
.fill-const-input {
    flex: 1;
    min-width: 0;
    width: 60px;
    max-width: 120px;
    padding: 2px 5px;
    border: 1px solid #ced4da;
    border-radius: 3px;
    font-size: 11px;
    color: #212529;
    background: #fff;
}

/* ── Target column highlight in table ── */
.target-col-header { background: #fff3cd !important; color: #856404 !important; }
.target-col-cell   { background: #fffdf0 !important; color: #212529 !important; }

/* ── Quality verdict panel ── */
.quality-verdict {
    display: flex;
    align-items: center;
    gap: 14px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-left: 5px solid #28a745;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 12px 0;
}
.quality-score-circle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    flex-shrink: 0;
}
.quality-score-num   { font-size: 20px; font-weight: 700; line-height: 1; }
.quality-score-grade { font-size: 13px; font-weight: 600; }
.quality-verdict-text strong { font-size: 14px; color: #212529; display: block; }
.quality-warning { font-size: 11px; color: #856404; margin-top: 3px; }

/* ── Per-column quality bars ── */
/* Quality section card — white background so dark body doesn't bleed through */
#quality-cols-section {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 8px 0;
    color: #212529;
}
.quality-section-title {
    font-size: 13px;
    color: #212529;
    margin: 0 0 10px;
    font-weight: 600;
}
.col-quality-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 12px;
    color: #212529;
}
.col-quality-name {
    min-width: 120px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #212529;
}
.col-quality-bar-wrap {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}
.col-quality-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}
.col-quality-score {
    min-width: 50px;
    font-weight: 700;
    font-size: 12px;
    color: #212529;
}
.quality-issue {
    font-size: 10px;
    color: #856404;
    background: #fff3cd;
    padding: 1px 6px;
    border-radius: 8px;
}

/* ── Validation results ── */
#validation-section {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 8px 0;
}
.val-col-row {
    font-size: 12px;
    color: #212529;
    padding: 4px 0;
    border-bottom: 1px solid #f1f3f5;
}
.val-col-row:last-child { border-bottom: none; }
.val-failures {
    margin: 3px 0 3px 20px;
    padding: 0;
    color: #721c24;
    font-size: 11px;
}

/* ══════════════════════════════════════════════════════
   Data Chat Tab
══════════════════════════════════════════════════════ */

/* Send to AI button (result section) */
.send-ai-btn {
    background: linear-gradient(135deg, #6f42c1, #4a90d9);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-bottom: 14px;
}
.send-ai-btn:hover  { opacity: 0.88; }
.send-ai-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.embed-status {
    font-size: 12px;
    color: #495057;
}

/* Data Chat tab layout */
#tab-datachat.active { padding: 0; display: flex; flex-direction: column; height: 100%; }
#datachat-body {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    padding: 12px 16px;
    gap: 10px;
}

/* Banner */
.dc-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #e8f4fd;
    border: 1px solid #b8d9f5;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 13px;
    color: #1a5c8a;
    flex-shrink: 0;
}
.dc-reset-btn {
    background: none;
    border: 1px solid #b8d9f5;
    border-radius: 5px;
    padding: 3px 10px;
    font-size: 12px;
    color: #1a5c8a;
    cursor: pointer;
    transition: background 0.15s;
}
.dc-reset-btn:hover { background: #d0eaf8; }

/* Message list */
.dc-messages {
    flex: 1;
    overflow-y: auto;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 0;
}
.dc-msg { display: flex; flex-direction: column; max-width: 80%; }
.dc-msg-user  { align-self: flex-end; }
.dc-msg-assistant { align-self: flex-start; }
.dc-bubble {
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
}
.dc-msg-user .dc-bubble {
    background: #4a90d9;
    color: #fff;
    border-bottom-right-radius: 4px;
}
.dc-msg-assistant .dc-bubble {
    background: #fff;
    color: #212529;
    border: 1px solid #dee2e6;
    border-bottom-left-radius: 4px;
}
.dc-thinking .dc-bubble { color: #6c757d; font-style: italic; }
.dc-raw { font-size: 12px; overflow-x: auto; }
.dc-sources { margin-top: 4px; font-size: 12px; color: #495057; overflow-x: auto; }

/* Input row */
.dc-input-row {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.dc-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #b8cdf0;
    border-radius: 8px;
    font-size: 13px;
    color: #212529;
    background: #fff;
    outline: none;
}
.dc-input:focus { border-color: #4a90d9; box-shadow: 0 0 0 2px rgba(74,144,217,.15); }
.dc-send-btn {
    background: #4a90d9;
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.dc-send-btn:hover { opacity: 0.88; }

/* Generate panel */
.dc-generate-panel {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 12px 14px;
    flex-shrink: 0;
}
.dc-generate-title {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}
.dc-generate-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.dc-gen-n {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid #b8cdf0;
    border-radius: 6px;
    font-size: 13px;
    color: #212529;
    background: #fff;
}
.dc-gen-hint {
    flex: 1;
    min-width: 160px;
    padding: 6px 10px;
    border: 1px solid #b8cdf0;
    border-radius: 6px;
    font-size: 13px;
    color: #212529;
    background: #fff;
}
.dc-gen-btn {
    background: linear-gradient(135deg, #6f42c1, #4a90d9);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.dc-gen-btn:hover { opacity: 0.88; }
.dc-gen-status {
    font-size: 12px;
    color: #495057;
    margin-top: 6px;
}
#dc-gen-result {
    margin-top: 8px;
    overflow-x: auto;
    font-size: 12px;
}

/* ══════════════════════════════════════════════════════
   Model Training Tab
══════════════════════════════════════════════════════ */

#tab-model.active { display: block; }
#model-body { max-width: 860px; margin: 0 auto; padding: 20px 16px; }

.model-config-panel {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 20px 24px;
    margin-bottom: 20px;
    color: #212529;
}
.model-section-title {
    font-size: 15px;
    font-weight: 700;
    color: #212529;
    margin: 0 0 16px;
}
.model-config-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 18px;
}
.model-config-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}
.model-label {
    font-size: 12px;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.model-radio-group { display: flex; gap: 14px; }
.model-radio {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: #212529;
    cursor: pointer;
}
.model-select {
    padding: 6px 10px;
    border: 1px solid #b8cdf0;
    border-radius: 6px;
    font-size: 13px;
    color: #212529;
    background: #fff;
    cursor: pointer;
}
.model-slider-row { display: flex; align-items: center; gap: 10px; }
.model-slider-row input[type=range] { flex: 1; accent-color: #4a90d9; }
.model-split-val { font-size: 13px; font-weight: 600; color: #212529; min-width: 36px; }
.model-train-row { display: flex; align-items: center; gap: 14px; }
.model-train-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 9px 24px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .2s;
}
.model-train-btn:hover    { opacity: .88; }
.model-train-btn:disabled { opacity: .5; cursor: not-allowed; }
.model-train-status { font-size: 13px; color: #495057; }

/* Score card */
.model-score-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 16px;
    color: #212529;
}
.model-score-label { font-size: 13px; font-weight: 600; color: #6c757d; min-width: 80px; }
.model-score-circle {
    width: 80px; height: 80px;
    border-radius: 50%;
    border: 4px solid #28a745;
    display: flex;
    align-items: center;
    justify-content: center;
}
.model-score-num { font-size: 22px; font-weight: 700; }
.model-score-sub { font-size: 12px; color: #6c757d; }

/* Feature importance */
.model-results-section {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 16px;
    color: #212529;
}
.feat-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 7px;
    font-size: 12px;
}
.feat-name { min-width: 130px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #212529; }
.feat-bar-wrap { flex: 1; height: 10px; background: #e9ecef; border-radius: 5px; overflow: hidden; }
.feat-bar { height: 100%; background: linear-gradient(90deg, #4a90d9, #6f42c1); border-radius: 5px; transition: width .4s; }
.feat-val { min-width: 50px; font-weight: 600; color: #212529; text-align: right; }

/* Confusion matrix */
.cm-table { border-collapse: collapse; font-size: 12px; }
.cm-table th, .cm-table td { border: 1px solid #dee2e6; padding: 6px 12px; text-align: center; color: #212529; }
.cm-table thead th { background: #f1f3f5; font-weight: 600; }
.cm-correct { background: #d4edda; color: #155724; font-weight: 700; }
.cm-wrong   { background: #f8d7da; color: #721c24; }

/* Download row */
.model-download-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 4px;
    padding: 12px 0;
}
.model-download-btn {
    background: #007bff;
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 9px 22px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s;
}
.model-download-btn:hover { opacity: .88; }
.model-hint { font-size: 12px; color: #6c757d; }
.model-hint code { background: #f1f3f5; padding: 1px 5px; border-radius: 3px; font-size: 11px; }
/* Prediction panel */
.predict-hint { font-size: 12px; color: #6c757d; margin: 0 0 12px; }
.predict-inputs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.predict-field { display: flex; flex-direction: column; gap: 4px; }
.predict-label { font-size: 11px; font-weight: 600; color: #6c757d; text-transform: uppercase; }
.predict-input {
    padding: 6px 10px;
    border: 1px solid #b8cdf0;
    border-radius: 6px;
    font-size: 13px;
    color: #212529;
    background: #fff;
}
.predict-input:focus { outline: none; border-color: #4a90d9; }
.predict-action-row { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.predict-btn {
    background: linear-gradient(135deg, #6f42c1, #4a90d9);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 8px 22px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .2s;
    white-space: nowrap;
}
.predict-btn:hover { opacity: .88; }
.predict-result { flex: 1; }
.predict-value {
    font-size: 22px;
    font-weight: 700;
    color: #1a7a31;
}
.predict-probas { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.proba-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.proba-label { min-width: 90px; color: #212529; }
.proba-bar-wrap { flex: 1; height: 8px; background: #e9ecef; border-radius: 4px; overflow: hidden; }
.proba-bar { height: 100%; background: linear-gradient(90deg, #4a90d9, #6f42c1); border-radius: 4px; }
.proba-pct { min-width: 36px; font-weight: 600; color: #212529; text-align: right; }

.model-warning {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
    font-size: 12px;
    padding: 8px 12px;
    border-radius: 0 6px 6px 0;
    margin-bottom: 8px;
}

/* ── AI Suggestions ── */
.section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}
.section-header-row h3 {
    margin: 0;
    flex: 1;
}
.ai-suggest-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: linear-gradient(135deg, #6f42c1, #4a90d9);
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.2s, transform 0.1s;
    flex-shrink: 0;
}
.ai-suggest-btn:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
.ai-suggest-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.ai-suggest-status {
    padding: 9px 14px;
    border-radius: 7px;
    font-size: 13px;
    margin-bottom: 12px;
}
.ai-suggest-status.loading {
    background: #f0f4ff;
    border: 1px solid #c8d6f0;
    color: #3a5ba8;
}
.ai-suggest-status.success {
    background: #eafaf1;
    border: 1px solid #a3d9b5;
    color: #1a7a31;
}
.ai-suggest-status.error {
    background: #fff0f0;
    border: 1px solid #f0b8b8;
    color: #b03a2e;
}

/* Per-card AI suggestion panel */
.ai-suggest-panel {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 7px;
    font-size: 12px;
    color: #212529;
}
.ai-panel-ok {
    background: #eafaf1;
    border: 1px solid #a3d9b5;
}
.ai-panel-ok .ai-panel-title { color: #1a7a31; }
.ai-panel-issue {
    background: #fff0f0;
    border: 1px solid #f0b8b8;
}
.ai-panel-issue .ai-panel-title { color: #b03a2e; }
.ai-panel-header {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 6px;
}
.ai-panel-title {
    font-weight: 700;
    font-size: 12px;
    color: #4a2c91;
    flex: 1;
}
.ai-priority-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}
.priority-high   { background: #fde8e8; color: #c0392b; border: 1px solid #f0b8b8; }
.priority-medium { background: #fff3cd; color: #7d6608; border: 1px solid #fce181; }
.priority-low    { background: #eafaf1; color: #1a7a31; border: 1px solid #a3d9b5; }
.ai-panel-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    font-size: 13px;
    padding: 0 2px;
    line-height: 1;
}
.ai-panel-close:hover { color: #333; }
.ai-panel-type-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px;
}
.ai-panel-label { color: #6c757d; }
.ai-panel-type-badge {
    background: #6f42c1;
    color: #fff;
    padding: 1px 7px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
}
.ai-panel-reasoning {
    color: #444;
    font-size: 12px;
    margin-bottom: 6px;
    line-height: 1.45;
}
.ai-panel-actions-label {
    font-weight: 600;
    font-size: 11px;
    color: #6c757d;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ai-panel-actions {
    margin: 0 0 8px 16px;
    padding: 0;
    list-style: disc;
}
.ai-panel-actions li {
    color: #333;
    margin-bottom: 2px;
    font-size: 12px;
}
.ai-panel-apply-btn {
    display: inline-block;
    margin-top: 4px;
    padding: 5px 12px;
    background: #6f42c1;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}
.ai-panel-apply-btn:hover:not(:disabled) { opacity: 0.85; }
.ai-panel-apply-btn:disabled { opacity: 0.5; cursor: default; }
/* ══════════════════════════════════════
   User Guide Tab
══════════════════════════════════════ */
.guide-wrap {
    max-width: 860px;
    margin: 0 auto;
    padding: 0 16px 60px;
    font-size: 14px;
    color: #212529;
}

/* Hero */
.guide-hero {
    text-align: center;
    padding: 36px 0 28px;
    border-bottom: 1px solid #e9ecef;
    margin-bottom: 36px;
}
.guide-hero-title { font-size: 26px; font-weight: 700; margin: 0 0 8px; }
.guide-hero-sub   { font-size: 15px; color: #6c757d; margin: 0 0 20px; }
.guide-steps-nav  { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 24px; }

/* ── Guide inner tabs ── */
.guide-inner-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 28px;
}
.guide-itab {
    padding: 9px 20px;
    font-size: 13px;
    font-weight: 500;
    border: none;
    background: none;
    color: #6b7280;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    border-radius: 4px 4px 0 0;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.guide-itab:hover  { color: #3b82f6; background: #f0f7ff; }
.guide-itab.active { color: #1d4ed8; border-bottom-color: #3b82f6; font-weight: 600; }
.guide-section     { animation: fadein 0.2s ease; }

/* ── About tab sections ── */
.about-tab-sec {
    padding-top: 2rem;
    animation: fadein 0.18s ease;
}
.about-tab-sec > h2:first-child {
    font-size: 20px !important;
    font-weight: 700 !important;
    letter-spacing: -0.2px;
    margin: 0 0 1.5rem !important;
    padding-bottom: 0.6rem !important;
    border-bottom: 2px solid var(--color-border-secondary) !important;
}
.gm-input-mock {
    background: #f9fafb;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 12px;
    color: #374151;
}
.guide-nav-pill   {
    padding: 5px 13px;
    background: #f0f4ff;
    border: 1px solid #c8d6f0;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #3a5ba8;
    text-decoration: none;
    transition: background 0.15s;
}
.guide-nav-pill:hover { background: #dce6ff; }

/* Step blocks */
.guide-step {
    margin-bottom: 52px;
    scroll-margin-top: 16px;
}
.guide-step-badge {
    display: inline-block;
    padding: 3px 12px;
    background: linear-gradient(135deg, #6f42c1, #4a90d9);
    color: #fff;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 8px;
}
.guide-step-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 8px;
}
.guide-step-desc {
    font-size: 14px;
    line-height: 1.7;
    color: #444;
    margin: 0 0 18px;
}

/* Mock screenshot frame */
.guide-screen {
    border: 1px solid #dee2e6;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
}
.guide-screen-bar {
    background: #e9ecef;
    padding: 7px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6c757d;
    font-weight: 600;
}
.guide-screen-title { margin-left: 6px; }
.guide-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.guide-dot.r { background: #ff5f57; }
.guide-dot.y { background: #ffbd2e; }
.guide-dot.g { background: #28c840; }
.guide-screen-body {
    background: #f8f9fa;
    padding: 16px;
}

/* Tips & callouts */
.guide-tips    { display: flex; flex-direction: column; gap: 6px; margin-top: 14px; }
.guide-tip     { font-size: 13px; color: #555; background: #f8f9fa; border-left: 3px solid #4a90d9; padding: 7px 12px; border-radius: 0 5px 5px 0; }
.guide-callout { background: #f0f4ff; border: 1px solid #c8d6f0; border-radius: 7px; padding: 12px 14px; margin-bottom: 12px; font-size: 13px; color: #333; }
.guide-badge-legend { margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: #555; }

.guide-footer {
    text-align: center;
    font-size: 12px;
    color: #6c757d;
    padding-top: 24px;
    border-top: 1px solid #e9ecef;
}

/* ── Mock UI elements inside screenshots ── */
.gm-upload-zone {
    border: 2px dashed #adb5bd;
    border-radius: 10px;
    padding: 28px;
    text-align: center;
    background: #fff;
}
.gm-upload-icon  { font-size: 32px; margin-bottom: 8px; }
.gm-upload-label { font-size: 14px; font-weight: 600; color: #333; margin-bottom: 4px; }
.gm-upload-sub   { font-size: 12px; color: #888; margin-bottom: 12px; }
.gm-upload-btn   { display: inline-block; padding: 7px 18px; background: #4a90d9; color: #fff; border-radius: 6px; font-size: 13px; font-weight: 600; }

.gm-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 10px 12px;
    min-width: 180px;
    flex: 1;
    font-size: 12px;
}
.gm-card-top     { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.gm-card-name    { font-weight: 700; font-size: 13px; flex: 1; }
.gm-card-badge   { padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 700; }
.gm-badge-text   { background: #e9ecef; color: #495057; }
.gm-badge-num    { background: #d4edda; color: #155724; }
.gm-badge-date   { background: #fff3cd; color: #856404; }
.gm-badge-cat    { background: #cce5ff; color: #004085; }
.gm-badge-bank   { background: #e2d9f3; color: #4a2c91; }
.gm-card-null    { color: #666; margin-bottom: 3px; }
.gm-card-samples { color: #888; font-style: italic; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gm-card-stat    { color: #555; }

.gm-cb-row    { display: flex; align-items: flex-start; gap: 7px; margin-bottom: 6px; font-size: 12px; color: #333; }
.gm-cb        { width: 13px; height: 13px; border: 1px solid #adb5bd; border-radius: 3px; margin-top: 1px; flex-shrink: 0; background: #fff; }
.gm-cb.checked { background: #4a90d9; border-color: #4a90d9; }
.gm-sub-panel { margin-left: 6px; margin-top: 4px; background: #f0f4ff; border: 1px solid #c8d6f0; border-radius: 4px; padding: 3px 8px; font-size: 11px; color: #3a5ba8; }
.gm-preview-row { margin-top: 8px; font-size: 12px; color: #555; background: #f8f9fa; padding: 5px 8px; border-radius: 4px; }

.gm-ai-btn      { display: inline-block; padding: 6px 13px; background: linear-gradient(135deg,#6f42c1,#4a90d9); color:#fff; border-radius:6px; font-size:12px; font-weight:600; }
.gm-ai-status   { padding: 7px 12px; border-radius: 6px; font-size: 12px; }
.gm-ai-status.ok { background:#eafaf1; border:1px solid #a3d9b5; color:#1a7a31; }
.gm-ai-panel    { flex: 1; min-width: 200px; padding: 10px; border-radius: 7px; font-size: 12px; }
.gm-ai-ok       { background: #eafaf1; border: 1px solid #a3d9b5; }
.gm-ai-issue    { background: #fff0f0; border: 1px solid #f0b8b8; }
.gm-ai-panel-hdr { display:flex; justify-content:space-between; align-items:center; font-weight:700; margin-bottom:5px; }
.gm-ai-type-row { margin-bottom:5px; color:#555; }
.gm-ai-reason   { color:#444; line-height:1.4; margin-bottom:7px; }
.gm-apply-btn   { display:inline-block; padding:4px 10px; background:#6f42c1; color:#fff; border-radius:5px; font-size:11px; font-weight:600; }
.gm-pri         { padding:2px 7px; border-radius:9px; font-size:11px; font-weight:700; }
.gm-pri.high    { background:#fde8e8; color:#c0392b; }
.gm-pri.low     { background:#eafaf1; color:#1a7a31; }

.gm-process-btn { display:inline-block; padding:7px 14px; background:#1a7a31; color:#fff; border-radius:6px; font-size:12px; font-weight:600; }
.gm-dl-btn      { display:inline-block; padding:7px 14px; background:#4a90d9; color:#fff; border-radius:6px; font-size:12px; font-weight:600; }
.gm-score       { font-size:13px; color:#333; margin-left:auto; }

.gm-table       { width:100%; border-collapse:collapse; font-size:12px; background:#fff; border-radius:6px; overflow:hidden; }
.gm-table th    { background:#e9ecef; padding:6px 10px; text-align:left; font-weight:600; color:#333; }
.gm-table td    { padding:5px 10px; border-top:1px solid #f0f0f0; color:#444; }
.gm-table tr:hover td { background:#f8f9fa; }

.gm-ai-big-btn  { display:inline-block; padding:10px 22px; background:linear-gradient(135deg,#6f42c1,#4a90d9); color:#fff; border-radius:8px; font-size:14px; font-weight:700; }
.gm-embed-step  { padding:4px 0; font-size:12px; color:#1a7a31; }
.gm-embed-success { margin-top:10px; font-weight:600; color:#1a7a31; font-size:13px; }
.gm-chat-btn    { display:inline-block; padding:7px 14px; background:#6f42c1; color:#fff; border-radius:6px; font-size:12px; font-weight:600; }
.gm-train-btn   { display:inline-block; padding:7px 14px; background:#4a90d9; color:#fff; border-radius:6px; font-size:12px; font-weight:600; }

.gm-chat-window { background:#fff; border:1px solid #dee2e6; border-radius:8px; padding:12px; margin-bottom:10px; display:flex; flex-direction:column; gap:8px; }
.gm-chat-msg    { max-width:85%; padding:8px 12px; border-radius:10px; font-size:12px; line-height:1.5; }
.gm-chat-msg.ai   { background:#f0f4ff; color:#333; align-self:flex-start; border-bottom-left-radius:3px; }
.gm-chat-msg.user { background:#4a90d9; color:#fff; align-self:flex-end; border-bottom-right-radius:3px; }
.gm-chat-input-row { display:flex; gap:8px; }
.gm-chat-input  { flex:1; padding:7px 12px; border:1px solid #dee2e6; border-radius:6px; font-size:12px; background:#fff; color:#aaa; }
.gm-send-btn    { padding:7px 14px; background:#4a90d9; color:#fff; border-radius:6px; font-size:12px; font-weight:600; }

.gm-form-row    { display:flex; flex-direction:column; gap:4px; }
.gm-label       { font-size:11px; font-weight:600; color:#6c757d; text-transform:uppercase; letter-spacing:.04em; }
.gm-select-mock { padding:6px 10px; background:#fff; border:1px solid #dee2e6; border-radius:5px; font-size:12px; color:#333; }
.gm-train-btn-big { display:block; text-align:center; padding:9px; background:linear-gradient(135deg,#1a7a31,#28c840); color:#fff; border-radius:7px; font-size:13px; font-weight:700; margin-bottom:4px; }
.gm-metrics-row { display:flex; gap:10px; }
.gm-metric      { flex:1; background:#fff; border:1px solid #dee2e6; border-radius:7px; padding:8px; text-align:center; }
.gm-metric-val  { font-size:18px; font-weight:700; color:#1a7a31; }
.gm-metric-lbl  { font-size:10px; color:#6c757d; margin-top:2px; }

/* ══════════════════════════════════════════════════
   BOS — Business Operating System UI
══════════════════════════════════════════════════ */

/* Layout */
.bos-layout        { display:flex; height:calc(100vh - 110px); overflow:hidden; gap:0; }
.bos-sidebar       { width:220px; min-width:180px; background:#fff; border-right:1px solid #dee2e6; display:flex; flex-direction:column; flex-shrink:0; }
.bos-sidebar-header{ display:flex; align-items:center; justify-content:space-between; padding:14px 14px 10px; border-bottom:1px solid #dee2e6; }
.bos-sidebar-title { font-weight:600; font-size:14px; color:#212529; }
.bos-entity-list   { flex:1; overflow-y:auto; padding:8px 0; }
.bos-sidebar-empty { padding:20px 14px; font-size:13px; color:#6c757d; line-height:1.5; }
.bos-entity-item   { display:flex; align-items:center; gap:8px; padding:9px 14px; cursor:pointer; font-size:13px; color:#212529; border-left:3px solid transparent; transition:background 0.15s; }
.bos-entity-item:hover  { background:#f0f4ff; }
.bos-entity-item.active { background:#e8f0fe; border-left-color:#1a56db; font-weight:600; }
.bos-ent-icon      { font-size:15px; }
.bos-ent-name      { flex:1; }
.bos-ent-badge     { font-size:10px; color:#6c757d; background:#f0f2f5; border-radius:4px; padding:1px 5px; font-family:monospace; }

/* Main area */
.bos-main          { flex:1; display:flex; flex-direction:column; overflow:hidden; background:#f8f9fa; }

/* ── Loading progress bar ── */
.bos-progress-bar  { position:relative; height:3px; background:#e9ecef; overflow:hidden; flex-shrink:0; }
.bos-progress-fill {
  position:absolute; top:0; left:-40%; width:40%; height:100%;
  background:linear-gradient(90deg,transparent,#4f46e5,#7c3aed,transparent);
  animation:bos-progress-slide 1.2s ease-in-out infinite;
}
@keyframes bos-progress-slide { 0%{left:-40%} 100%{left:100%} }
.bos-loading-status {
  padding:5px 16px; font-size:12px; color:#6b7280; background:#fff;
  border-bottom:1px solid #f3f4f6; display:flex; align-items:center; gap:8px; flex-shrink:0;
}
.bos-loading-status::before {
  content:''; display:inline-block; width:10px; height:10px; border-radius:50%;
  border:2px solid #d1d5db; border-top-color:#4f46e5;
  animation:bos-spin 0.7s linear infinite; flex-shrink:0;
}
@keyframes bos-spin { to{transform:rotate(360deg)} }
.bos-table-loading { color:#9ca3af; font-size:13px; }
.bos-table-loading td { text-align:center; padding:40px 0; }

.bos-subbar        { display:flex; align-items:center; gap:8px; padding:10px 16px; background:#fff; border-bottom:1px solid #dee2e6; }
.bos-sub-btn       { padding:5px 14px; border:1px solid #dee2e6; border-radius:6px; background:#fff; font-size:13px; cursor:pointer; color:#6c757d; transition:all 0.15s; }
.bos-sub-btn.active{ background:#1a56db; color:#fff; border-color:#1a56db; font-weight:600; }
.bos-entity-badge  { margin-left:8px; font-size:13px; font-weight:600; color:#1a56db; }

/* Views */
.bos-view          { flex:1; overflow:auto; padding:16px; display:flex; flex-direction:column; gap:12px; }
.bos-placeholder   { display:flex; align-items:center; justify-content:center; height:100%; font-size:15px; color:#6c757d; }

/* Toolbar */
.bos-toolbar       { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.bos-toolbar-sep   { width:1px; height:22px; background:#e5e7eb; margin:0 2px; }
.bos-nlbar         { display:flex; gap:8px; align-items:center; background:#fff; border:1px solid #dee2e6; border-radius:8px; padding:8px 12px; }
.bos-nl-icon       { font-size:18px; }

/* ── Import CSV modal ── */
.bos-import-dropzone {
    border: 2px dashed #93c5fd;
    border-radius: 10px;
    padding: 28px 20px;
    text-align: center;
    background: #f0f7ff;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.bos-import-dropzone.drag-over {
    background: #dbeafe;
    border-color: #3b82f6;
}
.bos-import-info {
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    border-radius: 6px;
    padding: 6px 12px;
    margin-bottom: 4px;
}
.bos-import-map-wrap {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}
.bos-import-map-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.bos-import-map-table th {
    background: #f9fafb;
    padding: 6px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
}
.bos-import-map-table td {
    padding: 5px 10px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
.bos-import-err-row {
    font-size: 12px;
    color: #991b1b;
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 5px;
    padding: 5px 10px;
    margin-bottom: 4px;
}
.bos-import-stat     { text-align: center; }
.bos-import-stat-val { font-size: 28px; font-weight: 700; line-height: 1.1; }
.bos-import-stat-lbl { font-size: 11px; color: #6b7280; margin-top: 2px; }

/* ── Create Entity from CSV — step indicators ── */
.bos-ce-step-ind {
    font-size: 12px;
    padding: 4px 14px 8px;
    color: #9ca3af;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.bos-ce-step-ind.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    font-weight: 700;
}
.bos-ce-step-sep {
    font-size: 12px;
    color: #d1d5db;
    padding: 0 2px 8px;
}
/* field rows in create-from-csv editor */
.bos-ce-field-row td {
    padding: 4px 8px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
.bos-ce-field-row input[type="text"],
.bos-ce-field-row select {
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 3px 6px;
    font-size: 12px;
    background: var(--color-bg, #fff);
    color: var(--color-text, #111);
    width: 100%;
    box-sizing: border-box;
}
.bos-ce-field-row input[type="checkbox"] { width: auto; }
.bos-ce-type-badge {
    display: inline-block;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 600;
    text-transform: uppercase;
}
.bos-ce-stat-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}
.bos-ce-stat-card {
    text-align: center;
    background: var(--color-bg-secondary, #f9fafb);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 14px 8px;
}
.bos-ce-stat-card .val { font-size: 30px; font-weight: 700; }
.bos-ce-stat-card .lbl { font-size: 11px; color: #6b7280; margin-top: 2px; }

/* Buttons */
.bos-btn-primary   { padding:7px 16px; background:#1a56db; color:#fff; border:none; border-radius:6px; font-size:13px; font-weight:600; cursor:pointer; white-space:nowrap; }
.bos-btn-primary:hover  { background:#1648c0; }
.bos-btn-secondary { padding:7px 14px; background:#fff; color:#212529; border:1px solid #dee2e6; border-radius:6px; font-size:13px; cursor:pointer; white-space:nowrap; }
.bos-btn-secondary:hover{ background:#f0f2f5; }
.bos-btn-ai        { padding:7px 14px; background:linear-gradient(135deg,#6f42c1,#9b59b6); color:#fff; border:none; border-radius:6px; font-size:13px; font-weight:600; cursor:pointer; white-space:nowrap; }
.bos-btn-ai:hover  { opacity:0.9; }
.bos-btn-danger    { padding:7px 14px; background:#dc2626; color:#fff; border:none; border-radius:6px; font-size:13px; font-weight:600; cursor:pointer; white-space:nowrap; }
.bos-btn-danger:hover { background:#b91c1c; }
.bos-btn-icon      { background:none; border:none; font-size:18px; cursor:pointer; color:#6c757d; padding:2px 6px; border-radius:4px; line-height:1; }
.bos-btn-icon:hover{ background:#f0f2f5; }

/* Analytics result card */
.bos-analytics-card    { background:linear-gradient(135deg,#eff6ff,#f0fdf4); border:1px solid #bfdbfe; border-radius:10px; padding:16px 18px; margin:8px 0; }
.bos-analytics-header  { display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin-bottom:10px; }
.bos-analytics-icon    { font-size:18px; }
.bos-analytics-label   { font-size:12px; font-weight:700; color:#1d4ed8; background:#dbeafe; padding:2px 8px; border-radius:10px; }
.bos-analytics-filter  { font-size:11px; background:#d1fae5; color:#065f46; border-radius:8px; padding:2px 8px; font-weight:600; }
.bos-analytics-q       { font-size:12px; color:#6b7280; font-style:italic; margin-left:auto; }
.bos-analytics-answer  { font-size:15px; color:#1e293b; line-height:1.6; }
.bos-analytics-answer strong { color:#1d4ed8; }

/* Formula row in Designer */
.bos-formula-row td          { border-top: none !important; }
.bos-formula-result          { font-size:12px; font-family:monospace; max-width:300px;
                                overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* Input */
.bos-input         { padding:6px 10px; border:1px solid #dee2e6; border-radius:6px; font-size:13px; background:#fff; color:#212529; width:100%; }
.bos-input:focus   { outline:none; border-color:#1a56db; box-shadow:0 0 0 2px rgba(26,86,219,0.15); }

/* Records table */
.bos-table-wrap    { overflow:auto; border-radius:8px; border:1px solid #dee2e6; background:#fff; }
.bos-table         { width:100%; border-collapse:collapse; font-size:13px; }
.bos-table thead th{ background:#f0f4ff; color:#1a56db; font-weight:600; padding:9px 12px; text-align:left; border-bottom:2px solid #dee2e6; white-space:nowrap; }
.bos-table tbody tr{ border-bottom:1px solid #f0f2f5; transition:background 0.1s; }
.bos-table tbody tr:hover { background:#f8faff; }
.bos-table td      { padding:8px 12px; color:#212529; max-width:180px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bos-actions-cell  { white-space:nowrap; }
.bos-act-btn       { background:none; border:none; cursor:pointer; font-size:14px; padding:2px 5px; border-radius:4px; }
.bos-act-btn:hover { background:#f0f2f5; }
.bos-act-del:hover { background:#fde8e8; }

/* Pagination */
.bos-pagination    { display:flex; align-items:center; gap:8px; padding:4px 0; }
.bos-total         { margin-left:auto; font-size:12px; color:#6c757d; }

/* Designer */
.bos-designer-wrap       { background:#fff; border-radius:10px; border:1px solid #dee2e6; padding:20px; max-width:960px; }
.bos-designer-title      { font-size:16px; font-weight:600; margin:0 0 16px; color:#212529; }
.bos-form-row            { display:flex; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.bos-form-group          { flex:1; min-width:150px; display:flex; flex-direction:column; gap:4px; }
.bos-form-group label    { font-size:12px; font-weight:600; color:#495057; }
.bos-req                 { color:#dc3545; }
.bos-fields-header       { display:flex; align-items:center; justify-content:space-between; margin:16px 0 8px; font-size:13px; font-weight:600; color:#212529; }
.bos-fields-table        { width:100%; border-collapse:collapse; font-size:12px; margin-bottom:16px; }
.bos-fields-table th     { background:#f0f4ff; padding:7px 8px; text-align:left; font-weight:600; color:#1a56db; border-bottom:1px solid #dee2e6; }
.bos-fields-table td     { padding:5px 6px; border-bottom:1px solid #f0f2f5; }
.bos-fields-table .bos-input { padding:4px 7px; font-size:12px; }
.bos-json-preview-label  { font-size:12px; font-weight:600; color:#495057; margin-bottom:6px; display:flex; align-items:center; }
.bos-json-preview        { background:#1e1e2e; color:#cdd6f4; border-radius:8px; padding:14px; font-size:12px; font-family:monospace; white-space:pre; overflow:auto; max-height:260px; min-height:80px; width:100%; box-sizing:border-box; border:2px solid transparent; resize:vertical; outline:none; line-height:1.5; }
.bos-json-preview:focus  { border-color:#4f8ef7; }
.bos-json-preview.edited { border-color:#f59e0b; }
.bos-designer-actions    { display:flex; align-items:center; gap:10px; margin-top:12px; }
.bos-msg                 { font-size:13px; margin-left:8px; }

/* Record Modal */
.bos-modal-overlay       { position:fixed; inset:0; background:rgba(0,0,0,0.45); display:flex; align-items:center; justify-content:center; z-index:9999; }
.bos-modal               { background:#fff; border-radius:12px; width:min(560px,95vw); max-height:80vh; display:flex; flex-direction:column; box-shadow:0 20px 60px rgba(0,0,0,0.25); }
.bos-modal-header        { display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid #dee2e6; font-weight:600; font-size:15px; }
.bos-modal-body          { flex:1; overflow-y:auto; padding:16px 20px; display:flex; flex-direction:column; gap:10px; }
.bos-modal-footer        { padding:14px 20px; border-top:1px solid #dee2e6; display:flex; align-items:center; gap:10px; }

/* BOS sidebar entity action buttons */
.bos-ent-actions       { display:none; gap:2px; margin-left:auto; }
.bos-entity-item:hover .bos-ent-actions  { display:flex; }
.bos-entity-item.active .bos-ent-actions { display:flex; }
.bos-ent-act-btn       { background:none; border:none; cursor:pointer; font-size:12px; padding:2px 4px; border-radius:3px; line-height:1; opacity:0.7; }
.bos-ent-act-btn:hover { background:rgba(0,0,0,0.08); opacity:1; }
.bos-ent-del-btn:hover { background:#fde8e8; }

/* Stats bar */
.bos-stats-bar          { background:#f8faff; border:1px solid #dce8ff; border-radius:8px; padding:12px 14px; margin-bottom:12px; }
.bos-stats-header       { display:flex; align-items:center; gap:12px; margin-bottom:10px; }
.bos-stats-total        { font-size:13px; font-weight:600; color:#1a56db; }
.bos-stats-cards        { display:flex; flex-wrap:wrap; gap:12px; }
.bos-stat-card          { background:#fff; border:1px solid #dee2e6; border-radius:6px; padding:10px 12px; min-width:160px; flex:1; max-width:240px; }
.bos-stat-field         { font-size:11px; font-weight:700; color:#495057; text-transform:uppercase; letter-spacing:.5px; margin-bottom:7px; }
.bos-stat-dist-row      { display:flex; align-items:center; gap:6px; margin-bottom:4px; }
.bos-stat-dist-label    { font-size:11px; width:80px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; color:#495057; }
.bos-stat-dist-bar-wrap { flex:1; background:#e9ecef; border-radius:3px; height:7px; }
.bos-stat-dist-bar      { height:7px; background:#1a56db; border-radius:3px; min-width:2px; transition:width .3s; }
.bos-stat-dist-count    { font-size:11px; color:#6c757d; width:22px; text-align:right; }
.bos-stat-nums          { display:flex; flex-wrap:wrap; gap:8px; }
.bos-stat-num           { display:flex; flex-direction:column; align-items:center; }
.bos-stat-num label     { font-size:9px; color:#6c757d; text-transform:uppercase; letter-spacing:.5px; font-weight:600; }
.bos-stat-num           { font-size:12px; font-weight:600; color:#212529; }

/* Smart filter panel */
.bos-filter-panel       { background:#fffbf0; border:1px solid #f0d080; border-radius:8px; padding:12px 14px; margin-bottom:12px; }
.bos-filter-fields      { display:flex; flex-wrap:wrap; gap:10px; margin-bottom:10px; }
.bos-filter-field       { display:flex; flex-direction:column; gap:4px; min-width:140px; flex:1; max-width:200px; }
.bos-filter-label       { font-size:11px; font-weight:600; color:#856404; }
.bos-filter-input       { font-size:12px; padding:5px 8px; }
.bos-filter-actions     { display:flex; gap:8px; }

/* FK select in record modal */
.bos-fk-select-wrap     { display:flex; align-items:center; gap:6px; }
.bos-fk-select-icon     { font-size:14px; flex-shrink:0; }
.bos-fk-select          { flex:1; border-color:#93c5fd !important; background:#f0f7ff !important; }
.bos-fk-select-hint     { font-size:11px; color:#1e40af; white-space:nowrap; font-weight:500; }

/* FK indicators */
.bos-fk-link            { color:#1a56db; text-decoration:none; font-size:12px; white-space:nowrap; background:#e8f0fe; padding:2px 6px; border-radius:4px; border:1px solid #c3d4f8; }
.bos-fk-link:hover      { background:#d0e2ff; text-decoration:none; }
.bos-th-fk              { font-size:12px; opacity:0.8; }
.bos-fk-badge           { font-size:13px; cursor:default; }
/* FK field row in Designer — highlight fk fields */
.bos-fk-dropdowns               { display:flex; flex-direction:column; gap:3px; }
.bos-field-fk-entity            { border-color:#93c5fd !important; background:#f0f7ff !important; color:#1e40af; font-size:11px; }
.bos-field-fk-field             { border-color:#bfdbfe !important; background:#f8fbff !important; color:#1e40af; font-size:11px; }
.bos-fields-table tr:has(.bos-field-fk-entity option:checked:not([value=""])) { background:#f5f8ff; }

/* FK popup */
.bos-fk-popup           { position:absolute; background:#fff; border:1px solid #dee2e6; border-radius:10px; box-shadow:0 8px 30px rgba(0,0,0,0.15); width:310px; z-index:8000; }
.bos-fk-popup-header    { display:flex; align-items:center; justify-content:space-between; padding:10px 14px; border-bottom:1px solid #dee2e6; font-weight:600; font-size:13px; background:#f8faff; border-radius:10px 10px 0 0; }
.bos-fk-popup-body      { padding:12px 14px; max-height:260px; overflow-y:auto; }
.bos-fk-row             { display:flex; gap:8px; padding:4px 0; border-bottom:1px solid #f0f2f5; font-size:12px; }
.bos-fk-key             { color:#6c757d; min-width:100px; font-weight:500; }
.bos-fk-val             { color:#212529; word-break:break-all; }

/* ERD Diagram */
.bos-diagram-toolbar    { display:flex; align-items:center; justify-content:space-between; padding:8px 4px 12px; }
.bos-diagram-canvas     { flex:1; overflow:auto; background:#f0f4f8; border:1px solid #dee2e6; border-radius:8px; padding:16px; min-height:400px; display:flex; align-items:flex-start; justify-content:flex-start; }
.bos-diagram-hint       { font-size:11px; color:#9ca3af; }

/* FK Link confirm popup */
.bos-fk-link-popup      { position:fixed; background:#fff; border:1px solid #dee2e6; border-radius:10px; box-shadow:0 8px 30px rgba(0,0,0,0.18); width:300px; padding:14px 16px; z-index:9000; }
.bos-fk-link-title      { font-size:13px; font-weight:700; color:#1e40af; margin-bottom:10px; }
.bos-fk-link-row        { display:flex; align-items:center; gap:6px; }
.bos-fk-link-entity     { background:#dbeafe; color:#1e40af; font-size:12px; font-weight:600; padding:3px 8px; border-radius:5px; font-family:monospace; }
.bos-fk-link-arrow      { color:#6b7280; font-size:16px; }
.bos-fk-link-actions    { display:flex; gap:8px; margin-top:12px; }

/* ── Contact Us ───────────────────────────────────────────────────────────── */
.contact-msg {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 1.25rem;
}
.contact-msg--ok  { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.contact-msg--err { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; }

/* ── AI Test Automation ───────────────────────────────────────────────────── */
#tab-ata { padding: 0; overflow: hidden; }

.ata-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    height: calc(100vh - 56px);
    overflow: hidden;
}

/* Sidebar */
.ata-sidebar {
    border-right: 1px solid var(--color-border-secondary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-background-secondary);
}
.ata-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border-bottom: 1px solid var(--color-border-secondary);
    flex-shrink: 0;
}
.ata-suite-list    { flex: 1; overflow-y: auto; padding: 6px; }
.ata-suite-item    { padding: 8px 10px; border-radius: 6px; cursor: pointer; margin-bottom: 3px; transition: background .12s; }
.ata-suite-item:hover  { background: var(--color-background-primary); }
.ata-suite-item.active { background: var(--color-background-primary); box-shadow: inset 2px 0 0 var(--color-text-info); }
.ata-suite-item-name   { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ata-suite-item-meta   { display: flex; align-items: center; gap: 6px; margin-top: 3px; }

/* Main */
.ata-main { display: flex; flex-direction: column; overflow: hidden; position: relative; }
.ata-empty-state {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 8px;
}

/* Suite editor */
#ata-suite-editor { display: flex; flex-direction: column; height: 100%; overflow: hidden; }

.ata-suite-header {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--color-border-secondary);
    flex-shrink: 0;
    background: var(--color-background-secondary);
}
.ata-suite-name-input {
    background: none; border: none; outline: none;
    font-size: 15px; font-weight: 600;
    color: var(--color-text-primary);
    min-width: 0; flex: 1;
}
.ata-suite-name-input::placeholder { color: var(--color-text-tertiary); }

.ata-config-panel {
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border-secondary);
    background: var(--color-background-secondary);
    flex-shrink: 0;
}

/* Body: tc list + editor side by side */
.ata-body {
    display: grid;
    grid-template-columns: 240px 1fr;
    flex: 1;
    overflow: hidden;
}
.ata-tc-list-pane {
    border-right: 1px solid var(--color-border-secondary);
    display: flex; flex-direction: column; overflow: hidden;
}
.ata-tc-list-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 1px solid var(--color-border-secondary);
    flex-shrink: 0;
}
#ata-tc-list { flex: 1; overflow-y: auto; padding: 4px; }

.ata-tc-item {
    display: flex; align-items: center; justify-content: space-between;
    padding: 7px 8px; border-radius: 5px; cursor: pointer;
    margin-bottom: 2px; gap: 6px; min-width: 0;
    transition: background .1s;
}
.ata-tc-item:hover  { background: var(--color-background-secondary); }
.ata-tc-item.active { background: var(--color-background-secondary); box-shadow: inset 2px 0 0 var(--color-text-info); }
.ata-tc-item.passed { border-left: 2px solid #22c55e; }
.ata-tc-item.failed { border-left: 2px solid #ef4444; }
.ata-tc-item-name   { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* TC editor pane */
.ata-tc-editor-pane { display: flex; flex-direction: column; overflow: hidden; }
.ata-tc-empty       { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#ata-tc-form        { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.ata-tc-form-header {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border-secondary);
    flex-shrink: 0;
}
.ata-tc-name-input {
    flex: 1; background: none; border: none; outline: none;
    font-size: 14px; font-weight: 600; color: var(--color-text-primary);
}
.ata-tc-form-body { flex: 1; overflow-y: auto; padding: 12px; }

/* Inner tabs */
.ata-inner-tabs { display: flex; gap: 2px; margin-bottom: 8px; border-bottom: 1px solid var(--color-border-secondary); }
.ata-inner-tab  {
    background: none; border: none; cursor: pointer;
    padding: 5px 10px; font-size: 12px; font-weight: 500;
    color: var(--color-text-secondary);
    border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.ata-inner-tab.active { color: var(--color-text-info); border-bottom-color: var(--color-text-info); }

/* Assertions */
.ata-assertion-row {
    display: flex; align-items: center; gap: 6px;
    padding: 4px 0; margin-bottom: 4px; flex-wrap: nowrap;
}
.ata-assert-type { font-size: 11px !important; }

/* Results panel */
.ata-results-panel {
    flex-direction: column;
    border-top: 2px solid var(--color-border-secondary);
    max-height: 340px; min-height: 160px;
    overflow: hidden;
    flex-shrink: 0;
}
.ata-results-header {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; flex-shrink: 0;
    border-bottom: 1px solid var(--color-border-secondary);
    background: var(--color-background-secondary);
}
.ata-results-summary { display: flex; gap: 6px; margin-left: 4px; }
.ata-results-body    { flex: 1; overflow-y: auto; padding: 8px; }

.ata-result-row         { border-radius: 6px; margin-bottom: 6px; overflow: hidden; border: 1px solid var(--color-border-secondary); }
.ata-result-row.pass    { border-color: #86efac; }
.ata-result-row.fail    { border-color: #fca5a5; }
.ata-result-row-header  { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; font-size: 13px; }
.ata-result-row.pass .ata-result-row-header { background: #f0fdf4; }
.ata-result-row.fail .ata-result-row-header { background: #fef2f2; }
.ata-result-icon { font-size: 14px; font-weight: 700; flex-shrink: 0; }
.ata-result-row.pass .ata-result-icon { color: #16a34a; }
.ata-result-row.fail .ata-result-icon { color: #dc2626; }
.ata-result-name        { font-weight: 600; flex: 1; }
.ata-result-meta        { font-size: 11px; color: var(--color-text-tertiary); }
.ata-result-detail      { display: none; padding: 8px 10px; background: var(--color-background-primary); border-top: 1px solid var(--color-border-secondary); }
.ata-result-detail.open { display: block; }
.ata-result-error       { color: #dc2626; font-size: 12px; margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.ata-assert-result      { display: flex; gap: 8px; font-size: 12px; padding: 3px 0; align-items: flex-start; }
.ata-assert-result.pass { color: #16a34a; }
.ata-assert-result.fail { color: #dc2626; }
.ata-assert-msg         { color: var(--color-text-secondary); font-size: 11px; }
.ata-result-body-label  { font-size: 11px; font-weight: 600; color: var(--color-text-tertiary); margin: 8px 0 4px; }
.ata-result-body-pre    { font-size: 11px; background: #1e1e2e; color: #cdd6f4; border-radius: 5px; padding: 8px; max-height: 160px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; margin: 0; }

.ata-result-dot         { font-size: 12px; font-weight: 700; }
.ata-result-dot.pass    { color: #16a34a; }
.ata-result-dot.fail    { color: #dc2626; }

/* Shared atoms */
.ata-input {
    padding: 6px 9px;
    border: 1px solid var(--color-border-secondary);
    border-radius: var(--border-radius-sm);
    background: var(--color-background-primary);
    color: var(--color-text-primary);
    font-size: 12px;
    outline: none;
    box-sizing: border-box;
}
.ata-input:focus { border-color: var(--color-text-info); }

.ata-code-input {
    width: 100%; font-family: monospace; font-size: 12px;
    padding: 8px 10px; border-radius: 6px;
    border: 1px solid var(--color-border-secondary);
    background: var(--color-background-primary);
    color: var(--color-text-primary);
    resize: vertical; outline: none; box-sizing: border-box;
}
.ata-code-input:focus { border-color: var(--color-text-info); }

.ata-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 11px; border-radius: var(--border-radius-sm);
    font-size: 12px; font-weight: 600; border: none; cursor: pointer;
    white-space: nowrap; transition: opacity .15s;
}
.ata-btn:hover  { opacity: .85; }
.ata-btn-primary { background: var(--color-text-info); color: #fff; }
.ata-btn-success { background: #16a34a; color: #fff; }
.ata-btn-ghost   {
    background: var(--color-background-secondary);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border-secondary);
}
.ata-icon-btn {
    background: none; border: none; cursor: pointer;
    padding: 4px 5px; border-radius: 4px;
    color: var(--color-text-secondary); font-size: 15px;
    display: inline-flex; align-items: center; transition: background .1s;
}
.ata-icon-btn:hover { background: var(--color-background-secondary); color: var(--color-text-primary); }

.ata-connector-badge {
    background: #dbeafe; color: #1d4ed8;
    font-size: 10px; font-weight: 700; letter-spacing: .5px;
    padding: 2px 7px; border-radius: 4px;
}
.ata-badge      { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.ata-badge.pass { background: #dcfce7; color: #166534; }
.ata-badge.fail { background: #fee2e2; color: #991b1b; }
.ata-badge.neutral { background: var(--color-background-secondary); color: var(--color-text-secondary); }

.ata-method-pill      { font-size: 9px; font-weight: 800; padding: 1px 5px; border-radius: 3px; letter-spacing: .3px; flex-shrink: 0; }
.ata-method-get       { background: #dcfce7; color: #166534; }
.ata-method-post      { background: #dbeafe; color: #1d4ed8; }
.ata-method-patch     { background: #fef9c3; color: #854d0e; }
.ata-method-put       { background: #ede9fe; color: #5b21b6; }
.ata-method-delete    { background: #fee2e2; color: #991b1b; }

.ata-method-select {
    font-size: 12px; font-weight: 700; width: 90px;
    padding: 6px 8px; border-radius: var(--border-radius-sm);
    border: 1px solid var(--color-border-secondary);
    background: var(--color-background-primary);
    color: var(--color-text-info); cursor: pointer; outline: none;
}

.ata-section-title {
    font-size: 11px; font-weight: 700; letter-spacing: .5px;
    color: var(--color-text-tertiary); text-transform: uppercase;
    margin-bottom: 6px; display: flex; align-items: center;
}
.ata-empty-hint { font-size: 12px; color: var(--color-text-tertiary); line-height: 1.6; }

/* ── ATA AI elements ──────────────────────────────────────────────── */

/* AI Generate bar in TC list pane */
.ata-ai-bar {
    padding: 8px 10px;
    border-bottom: 1px solid var(--color-border-secondary);
    background: color-mix(in srgb, #a855f7 6%, var(--color-background-secondary));
    flex-shrink: 0;
}

/* Primary AI action button (inside bar) */
.ata-ai-btn {
    display: flex; align-items: center; gap: 6px;
    width: 100%; margin-top: 6px;
    padding: 6px 10px;
    background: #a855f7; color: #fff;
    border: none; border-radius: 5px;
    font-size: 12px; font-weight: 600; cursor: pointer;
    transition: opacity .15s;
}
.ata-ai-btn:hover   { opacity: .85; }
.ata-ai-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Method selector pills in AI generate bar */
.ata-method-pill-btn {
    padding: 2px 9px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 10px; font-weight: 700; cursor: pointer;
    transition: background .12s, color .12s;
}
.ata-method-pill-btn:hover { background: var(--color-bg-hover); }

/* Small inline AI button (next to section titles / in body tab) */
.ata-ai-mini-btn {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px;
    background: color-mix(in srgb, #a855f7 12%, transparent);
    color: #a855f7;
    border: 1px solid color-mix(in srgb, #a855f7 30%, transparent);
    border-radius: 4px;
    font-size: 11px; font-weight: 600; cursor: pointer;
    transition: background .12s;
    white-space: nowrap;
}
.ata-ai-mini-btn:hover   { background: color-mix(in srgb, #a855f7 20%, transparent); }
.ata-ai-mini-btn:disabled { opacity: .5; cursor: not-allowed; }

/* Anomaly panel at top of results */
.ata-anomaly-panel {
    display: flex; align-items: flex-start; gap: 8px;
    padding: 8px 12px;
    background: color-mix(in srgb, #a855f7 8%, var(--color-background-secondary));
    border-bottom: 1px solid color-mix(in srgb, #a855f7 25%, transparent);
    flex-shrink: 0;
}

/* Inline explanation text under a failed result row */
.ata-ai-explain {
    color: #a855f7;
    font-size: 12px;
    line-height: 1.5;
    padding: 4px 0 6px;
    display: none;
}

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

/* ── AI Entity Designer ───────────────────────────────────────────────────── */

@keyframes bosSpinPulse {
    0%,100% { opacity: 1; transform: scale(1) rotate(0deg); }
    50%      { opacity: 0.5; transform: scale(1.2) rotate(180deg); }
}

.bos-ai-field-card {
    background: var(--color-background-secondary, #f8f9fa);
    border: 1px solid var(--color-border, #dee2e6);
    border-radius: 10px;
    padding: 12px 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: box-shadow 0.15s, border-color 0.15s;
}
.bos-ai-field-card:hover {
    border-color: #7c3aed44;
    box-shadow: 0 2px 10px #7c3aed18;
}
.bos-ai-field-card-top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}
.bos-ai-field-sem {
    font-size: 16px;
    line-height: 1;
}
.bos-ai-field-type {
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-mono, monospace);
    background: color-mix(in srgb, currentColor 10%, transparent);
    border-radius: 4px;
    padding: 1px 5px;
}
.bos-ai-field-req {
    font-size: 9px;
    font-weight: 600;
    color: #dc3545;
    background: #dc354512;
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: auto;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.bos-ai-field-name .bos-input,
.bos-ai-field-label-row .bos-input {
    padding: 3px 6px;
    border-radius: 5px;
    width: 100%;
    box-sizing: border-box;
}
.bos-ai-field-example {
    font-size: 11px;
    color: #9ca3af;
    font-family: var(--font-mono, monospace);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}


/* ══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE  —  max-width: 768px
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Global ─────────────────────────────────────────────── */
  body { font-size: 14px; }

  /* ── Header ─────────────────────────────────────────────── */
  #app-header {
    padding: 0 12px;
    height: 52px;
  }
  #app-header .brand-tagline,
  #app-header .header-badge { display: none; }
  #app-header .brand-name   { font-size: 14px; }
  #app-header .brand-icon   { width: 30px; height: 30px; font-size: 15px; }

  /* ── Tab bar — horizontal scroll ────────────────────────── */
  #tab-bar {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 10px 0 0;
    margin-bottom: 0;
    gap: 2px;
  }
  #tab-bar::-webkit-scrollbar { display: none; }
  .tab-btn {
    padding: 8px 12px;
    font-size: 12px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* ── Tab panels ─────────────────────────────────────────── */
  .tab-panel.active { padding: 0; }

  /* ── CSV / Data Prep tab ─────────────────────────────────── */
  #csv-top-bar  { padding: 12px; }
  #columns-grid { grid-template-columns: 1fr; }

  .action-bar,
  .pipeline-actions { flex-wrap: wrap; gap: 6px; }

  /* ── BOS layout — sidebar becomes top strip ──────────────── */
  .bos-layout {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 100px);
    overflow: visible;
  }
  .bos-sidebar {
    width: 100%;
    min-width: unset;
    height: auto;
    max-height: 150px;
    border-right: none;
    border-bottom: 1px solid #dee2e6;
    flex-direction: column;
    flex-shrink: 0;
  }
  .bos-sidebar-header { padding: 8px 12px; }
  .bos-entity-list {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 6px 8px;
    gap: 6px;
    scrollbar-width: none;
  }
  .bos-entity-list::-webkit-scrollbar { display: none; }
  .bos-entity-item {
    flex-shrink: 0;
    border-radius: 20px;
    padding: 5px 12px;
    border: 1px solid #dee2e6;
    white-space: nowrap;
    font-size: 12px;
  }
  .bos-entity-item.active {
    background: #eff6ff;
    border-color: #93c5fd;
  }
  .bos-ent-actions { display: none; } /* hide edit/delete icons in pill mode */

  /* BOS main panel */
  .bos-main { width: 100%; overflow: visible; min-height: 0; }

  /* BOS sub-bar — horizontal scroll */
  .bos-subbar {
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 8px 10px;
    gap: 5px;
  }
  .bos-subbar::-webkit-scrollbar { display: none; }
  .bos-sub-btn { padding: 5px 10px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }

  /* BOS toolbar */
  .bos-toolbar { flex-wrap: wrap; gap: 5px; padding: 8px 10px; }
  .bos-toolbar-sep { display: none; }

  /* BOS explorer content */
  #bos-explorer-content { padding: 0 8px 8px; }
  .bos-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .bos-table { min-width: 500px; font-size: 12px; }

  /* BOS stats bar */
  .bos-stats-bar   { padding: 8px 10px; margin-bottom: 8px; }
  .bos-stats-cards { gap: 6px; }
  .bos-stat-card   { padding: 6px 10px; font-size: 11px; }

  /* BOS designer */
  .bos-designer-wrap { padding: 12px; max-width: 100%; }
  .bos-field-row th,
  .bos-field-row td  { padding: 5px 6px; font-size: 11px; }

  /* BOS designer stats grid (3 cols → 1) */
  .bos-ce-stat-grid { grid-template-columns: 1fr 1fr !important; }

  /* BOS modals — already 95vw, just ensure scroll */
  .bos-modal { max-height: 92vh; }
  .bos-modal-body { padding: 12px 14px; }

  /* BOS page controls */
  #bos-page-controls { flex-wrap: wrap; gap: 6px; padding: 6px 8px; }

  /* Cross-entity two-panel — stack vertically */
  #bos-xq-outer,
  [id*="xq"][style*="display:flex"],
  .bos-xq-panels { flex-direction: column !important; }

  #bos-xq-dashboard {
    width: 100% !important;
    max-height: 200px;
    border-left: none !important;
    border-top: 1px solid #dee2e6;
  }

  /* ── ATA layout — sidebar on top ────────────────────────── */
  .ata-layout {
    grid-template-columns: 1fr !important;
    grid-template-rows: auto 1fr;
  }
  .ata-sidebar {
    width: 100%;
    max-height: 180px;
    overflow-y: auto;
    border-right: none;
    border-bottom: 1px solid #dee2e6;
  }
  .ata-body { overflow: visible; }
  .ata-tc-form-header { flex-wrap: wrap; gap: 6px; }
  .ata-inner-tab { font-size: 12px; padding: 5px 10px; }

  /* ATA results panel — full width below */
  .ata-results-panel {
    width: 100% !important;
    border-left: none !important;
    border-top: 1px solid #dee2e6;
    max-height: 300px;
  }

  /* ── About / Guide tabs ──────────────────────────────────── */
  .about-content { padding: 16px 12px; }
  .about-content > div[style*="grid-template-columns: 1fr 1fr"],
  #about-sec-bos > div[style*="grid"],
  #about-sec-ata > div[style*="grid"],
  #about-sec-why > div[style*="grid"] {
    grid-template-columns: 1fr !important;
  }
  .about-card-grid { grid-template-columns: 1fr; gap: 10px; }

  .guide-steps-nav { gap: 5px; }
  .guide-nav-pill  { font-size: 12px; padding: 5px 10px; }
  .guide-screen    { margin: 12px 0; }
  .guide-screen-body { padding: 10px; overflow-x: auto; }
  .guide-step      { padding: 16px 12px; }
  .guide-tip       { font-size: 12px; padding: 8px 10px; }

  /* Guide inner tabs (BOS/ATA section switcher) */
  .guide-itabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .guide-itabs::-webkit-scrollbar { display: none; }
  .guide-itab  { font-size: 12px; padding: 6px 12px; white-space: nowrap; flex-shrink: 0; }

  /* Mock tables inside guide screens — allow scroll */
  .gm-table    { font-size: 10px; }

  /* ── Modals (global) ─────────────────────────────────────── */
  .bos-modal-overlay { align-items: flex-end; }
  .bos-modal {
    border-radius: 16px 16px 0 0;
    width: 100% !important;
    max-width: 100%;
    max-height: 90vh;
  }

  /* ── Doc chat tab ────────────────────────────────────────── */
  .doc-chat-upload-row { flex-wrap: wrap; gap: 6px; }

} /* end @media 768px */


/* ══════════════════════════════════════════════════════════════
   SMALL PHONES  —  max-width: 480px
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {

  #app-header .brand-name { font-size: 13px; }
  .tab-btn { padding: 7px 10px; font-size: 11px; }

  .bos-sidebar  { max-height: 120px; }
  .bos-sub-btn  { padding: 4px 8px; font-size: 11px; }
  .bos-table    { font-size: 11px; min-width: 380px; }

  .guide-hero-title { font-size: 22px; }
  .about-content h1 { font-size: 22px; }
  .about-content h2 { font-size: 18px; }

  #bos-xq-dashboard { max-height: 160px; }

} /* end @media 480px */

/* Cross-entity outer panel — override inline flex-direction:row */
@media (max-width: 768px) {
  .bos-xq-outer {
    flex-direction: column !important;
    overflow: visible !important;
    height: auto !important;
  }
  .bos-xq-outer > div:first-child {
    overflow: visible !important;
    min-height: 0 !important;
  }
  /* Dashboard panel: full width, fixed height strip */
  .bos-xq-outer > div:last-child {
    width: 100% !important;
    flex-shrink: 0 !important;
    max-height: 220px !important;
    border-left: none !important;
    border-top: 1px solid var(--color-border) !important;
  }
  /* Divider between panels — hide on mobile */
  .bos-xq-outer > div[style*="width:1px"] {
    width: 100% !important;
    height: 1px !important;
  }
  /* BOS layout height fix — remove the calc(100vh - 110px) lock */
  .bos-layout { height: auto !important; }
}

/* ── Mobile hamburger nav ───────────────────────────────────── */
.mob-tab-btn {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.85);
    font-size: 15px;
    text-align: left;
    cursor: pointer;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    transition: background 0.15s;
}
.mob-tab-btn:hover,
.mob-tab-btn.active {
    background: rgba(74,144,217,0.25);
    color: #fff;
}

@media (max-width: 768px) {
    #tab-bar        { display: none !important; }
    #mob-menu-btn   { display: inline-flex !important; }
    .header-right-info { display: none; }
}
@media (min-width: 769px) {
    #mob-menu       { display: none !important; }
    #mob-menu-btn   { display: none !important; }
}

/* ── Mobile: entity list → 2-column grid (no horizontal scroll) ── */
@media (max-width: 768px) {
  .bos-entity-list {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    overflow-x: hidden !important;
    overflow-y: auto;
    max-height: 160px;
    padding: 6px 8px;
    gap: 4px;
    flex-direction: unset;
    flex-wrap: unset;
  }
  .bos-entity-item {
    border-radius: 8px !important;
    padding: 6px 8px !important;
    font-size: 12px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    border: 1px solid #dee2e6 !important;
    flex-shrink: unset;
  }

  /* ── Mobile: guide inner tabs → wrap to multiple rows ── */
  .guide-itabs {
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    gap: 5px !important;
    padding: 8px 12px;
  }
  .guide-itab {
    flex-shrink: 1 !important;
    font-size: 11px !important;
    padding: 6px 10px !important;
    white-space: nowrap;
  }
}

/* ══════════════════════════════════════════════════════════════
   MOBILE TARGETED FIXES  (override previous mobile rules)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── 1. Guide / About inner tabs → 2-col pill grid ──────── */
  .guide-inner-tabs {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 5px !important;
    border-bottom: none !important;
    margin-bottom: 14px !important;
    overflow: visible !important;
  }
  .guide-itab {
    padding: 9px 6px !important;
    font-size: 12px !important;
    border: 1px solid #e5e7eb !important;
    border-bottom: 1px solid #e5e7eb !important;
    border-radius: 8px !important;
    margin-bottom: 0 !important;
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex-shrink: unset !important;
  }
  .guide-itab.active {
    background: #eff6ff !important;
    border-color: #3b82f6 !important;
    color: #1d4ed8 !important;
  }

  /* ── 2. About Us — fix massive padding ──────────────────── */
  .about-content {
    padding: 16px 12px !important;
    margin: 6px !important;
    border-radius: 10px !important;
    box-shadow: none !important;
  }
  .about-content > div:first-child { padding: 1rem 0 1.5rem !important; }
  .about-content h1 { font-size: 20px !important; }
  .about-content h2 { font-size: 16px !important; margin-top: 16px !important; }
  .about-content p  { font-size: 13px !important; }

  /* About Us feature card rows — force single column */
  .about-tab-sec > div { grid-template-columns: 1fr !important; }

  /* ── 3. ERD Diagram — ensure scrollable canvas ──────────── */
  #bos-view-diagram {
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .bos-diagram-canvas {
    flex: none !important;
    min-height: 500px !important;
    min-width: 700px !important;   /* enough room for entity cards */
    overflow: visible !important;
    position: relative !important;
    touch-action: pan-x pan-y;
  }
  /* wrapper div scrolls, canvas itself is wide */
  #bos-view-diagram > div:last-child {
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
  }
}

/* ERD scroll container refinement */
@media (max-width: 768px) {
  #bos-view-diagram {
    flex-direction: column !important;
    overflow: hidden !important;    /* outer clips */
  }
  #bos-diagram-canvas {
    flex: 1 !important;
    overflow: auto !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    min-width: 0 !important;        /* let it fill the column */
    min-height: 420px !important;
    /* content inside uses absolute positions — canvas grows to fit */
    position: relative !important;
  }
}

/* ══════════════════════════════════════
   Language Switcher Buttons
══════════════════════════════════════ */
/* Legacy button selectors kept for backward compat */
.lang-btn {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.7);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1.6;
}
.lang-btn:hover  { background: rgba(255,255,255,0.22); color: #fff; }
.lang-btn.active { background: rgba(255,255,255,0.28); border-color: rgba(255,255,255,0.5); color: #fff; }

/* Language select dropdown */
#lang-select {
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 22px 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath fill='rgba(255,255,255,0.6)' d='M0 0l4 5 4-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
  transition: background 0.15s, border-color 0.15s;
}
#lang-select:hover  { background-color: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.45); }
#lang-select:focus  { border-color: rgba(255,255,255,0.55); background-color: rgba(255,255,255,0.22); }
#lang-select option { background: #0f2044; color: #fff; font-size: 13px; }

#lang-flag { font-size: 18px; line-height: 1; user-select: none; }

@media (max-width: 480px) {
  #lang-switcher { gap: 4px; }
  #lang-select   { font-size: 11px; padding: 3px 18px 3px 6px; }
  #lang-flag     { font-size: 15px; }
}

/* ══════════════════════════════════════
   RTL / Arabic Layout Fixes
   Applied when <html dir="rtl">
══════════════════════════════════════ */
[dir="rtl"] body {
  font-family: 'Cairo', sans-serif;
}

/* Flip flex rows */
[dir="rtl"] .brand,
[dir="rtl"] #tab-bar,
[dir="rtl"] .doc-chat-upload-row,
[dir="rtl"] .dc-input-row,
[dir="rtl"] .model-config-grid,
[dir="rtl"] .model-train-row,
[dir="rtl"] .predict-action-row,
[dir="rtl"] .section-header-row,
[dir="rtl"] #download-bar {
  flex-direction: row-reverse;
}

/* Text alignment */
[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] select {
  text-align: right;
}

/* BOS sidebar — flip from left to right */
[dir="rtl"] #bos-layout {
  flex-direction: row-reverse;
}

/* ATA layout flip */
[dir="rtl"] .ata-layout {
  flex-direction: row-reverse;
}

/* Tab bar — reverse order visually */
[dir="rtl"] #tab-bar {
  direction: rtl;
}

/* Card and panel text */
[dir="rtl"] .guide-step,
[dir="rtl"] .about-section,
[dir="rtl"] .bos-field-row,
[dir="rtl"] .ata-result-row {
  text-align: right;
}

/* Margins that should flip */
[dir="rtl"] .brand-icon {
  margin-right: 0;
  margin-left: 12px;
}

/* Guide nav pills */
[dir="rtl"] .guide-steps-nav {
  direction: rtl;
}

/* Mobile menu RTL */
[dir="rtl"] #mob-menu > div {
  text-align: right;
}

/* ════════════════════════════════════════════════════════════
   CLM — Client Manager styles
════════════════════════════════════════════════════════════ */

/* Root container fills the tab panel */
#clm-root { height: calc(100vh - 130px); display: flex; flex-direction: column; }

/* ── Login ─────────────────────────────────────────────────── */
#clm-login {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0a1f44 0%, #1e3a6b 100%);
}
.clm-login-card {
  background: #fff; border-radius: 16px; padding: 40px 36px; width: 100%;
  max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.clm-login-logo { font-size: 40px; text-align: center; margin-bottom: 8px; }
.clm-login-title { font-size: 22px; font-weight: 700; color: #0a1f44; text-align: center; }
.clm-login-sub { font-size: 12px; color: #6b7280; text-align: center; margin-bottom: 28px; }
.clm-login-err { color: #ef4444; font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.clm-login-hint { font-size: 11px; color: #9ca3af; text-align: center; margin-top: 16px; }
.clm-login-hint code { background: #f3f4f6; padding: 2px 5px; border-radius: 4px; }

/* ── Shared form elements ──────────────────────────────────── */
.clm-form-group { margin-bottom: 14px; }
.clm-form-row { display: flex; gap: 10px; }
.clm-form-row .clm-form-group { flex: 1; }
.clm-label { font-size: 12px; font-weight: 600; color: #374151; display: block; margin-bottom: 5px; }
.clm-input {
  width: 100%; padding: 9px 12px; border: 1.5px solid #d1d5db; border-radius: 8px;
  font-size: 13.5px; color: #1f2937; background: #fff; box-sizing: border-box;
  transition: border-color .15s;
}
.clm-input:focus { outline: none; border-color: #1e5fbb; box-shadow: 0 0 0 3px rgba(30,95,187,.1); }
textarea.clm-input { resize: vertical; }
select.clm-input { cursor: pointer; }

/* ── Buttons ───────────────────────────────────────────────── */
.clm-btn-primary {
  background: #1e5fbb; color: #fff; border: none; border-radius: 8px;
  padding: 9px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background .15s;
}
.clm-btn-primary:hover { background: #1a52a3; }
.clm-btn-secondary {
  background: #f3f4f6; color: #374151; border: 1.5px solid #d1d5db; border-radius: 8px;
  padding: 8px 14px; font-size: 13px; font-weight: 500; cursor: pointer; display: inline-block;
}
.clm-btn-secondary:hover { background: #e5e7eb; }
.clm-btn-ghost {
  background: transparent; color: #6b7280; border: 1.5px solid #d1d5db; border-radius: 7px;
  padding: 7px 12px; font-size: 13px; cursor: pointer;
}
.clm-btn-ghost:hover { background: #f3f4f6; color: #374151; }
.clm-btn-danger {
  background: transparent; color: #ef4444; border: 1.5px solid #fca5a5; border-radius: 7px;
  padding: 5px 9px; font-size: 12px; cursor: pointer;
}
.clm-btn-danger:hover { background: #fef2f2; }
.clm-btn-full { width: 100%; text-align: center; }
.clm-btn-sm { padding: 5px 10px; font-size: 12px; }
.clm-btn-xs { padding: 3px 7px; font-size: 11px; }

/* ── Top bar ───────────────────────────────────────────────── */
#clm-app { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.clm-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: #0a1f44; color: #fff;
  border-radius: 10px 10px 0 0; flex-shrink: 0;
}
.clm-topbar-left { display: flex; align-items: center; gap: 10px; }
.clm-topbar-logo { font-size: 20px; }
.clm-topbar-title { font-size: 15px; font-weight: 700; }
.clm-topbar-right { display: flex; align-items: center; gap: 12px; }
.clm-user-name { font-size: 13px; color: #a8c0e0; }
.clm-topbar-right .clm-btn-ghost { color: #a8c0e0; border-color: #2d4a7a; font-size: 12px; padding: 5px 10px; }
.clm-topbar-right .clm-btn-ghost:hover { background: #1e3a6b; color: #fff; }

.clm-role-badge {
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; letter-spacing: .5px;
}
.clm-role-broker  { background: #1e5fbb; color: #fff; }
.clm-role-manager { background: #d97706; color: #fff; }
.clm-role-admin   { background: #dc2626; color: #fff; }

/* ── Layout ────────────────────────────────────────────────── */
.clm-layout {
  flex: 1; display: flex; overflow: hidden;
  border: 1.5px solid #e2e8f0; border-top: none;
  border-radius: 0 0 10px 10px;
}
.clm-sidebar {
  width: 260px; min-width: 220px; flex-shrink: 0;
  background: #f8fafc; border-right: 1.5px solid #e2e8f0;
  padding: 14px; display: flex; flex-direction: column; gap: 10px;
  overflow: hidden;
}
.clm-search-wrap { flex-shrink: 0; }
.clm-client-list { flex: 1; overflow-y: auto; }
.clm-list-empty { font-size: 12.5px; color: #9ca3af; text-align: center; padding: 20px 10px; line-height: 1.6; }

.clm-client-item {
  padding: 10px 12px; border-radius: 8px; cursor: pointer; margin-bottom: 4px;
  border: 1.5px solid transparent; position: relative; transition: background .12s;
}
.clm-client-item:hover   { background: #eff3fb; border-color: #bfdbfe; }
.clm-client-item.active  { background: #eff6ff; border-color: #1e5fbb; }
.clm-ci-name  { font-size: 13.5px; font-weight: 600; color: #1f2937; margin-bottom: 4px; padding-right: 18px; }
.clm-ci-meta  { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.clm-ci-docs  { font-size: 11px; color: #6b7280; }
.clm-ci-broker{ font-size: 11px; color: #9ca3af; }
.clm-status-dot {
  position: absolute; top: 12px; right: 10px; width: 8px; height: 8px; border-radius: 50%;
}
.clm-status-pending_documents { background: #f59e0b; }
.clm-status-under_review      { background: #3b82f6; }
.clm-status-approved          { background: #16a34a; }
.clm-status-rejected          { background: #dc2626; }
.clm-status-closed            { background: #9ca3af; }
.clm-status-archived          { background: #6b7280; }
/* legacy */
.clm-status-active  { background: #16a34a; }
.clm-status-pending { background: #f59e0b; }

.clm-type-tag {
  font-size: 10px; padding: 1px 6px; border-radius: 10px; font-weight: 600;
}
.clm-type-claim   { background: #fee2e2; color: #991b1b; }
.clm-type-policy  { background: #dbeafe; color: #1e40af; }
.clm-type-general { background: #f3f4f6; color: #374151; }

/* ── Main content area ─────────────────────────────────────── */
/* min-width:0 keeps wide tables scrolling INSIDE their own containers
   instead of blowing out the whole page (flexbox default min-width:auto) */
.clm-content { flex: 1; min-width: 0; overflow-y: auto; padding: 0; display: flex; flex-direction: column; }

.clm-welcome {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; color: #9ca3af; text-align: center; padding: 40px;
}
.clm-welcome-icon  { font-size: 52px; margin-bottom: 16px; }
.clm-welcome-title { font-size: 17px; font-weight: 600; color: #374151; margin-bottom: 8px; }
.clm-welcome-sub   { font-size: 13.5px; line-height: 1.7; color: #6b7280; }

/* ── Client header ─────────────────────────────────────────── */
.clm-client-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1.5px solid #e2e8f0; background: #fff; flex-shrink: 0;
}
.clm-client-name { font-size: 18px; font-weight: 700; color: #0a1f44; }
.clm-client-meta { font-size: 12.5px; color: #6b7280; margin-top: 3px; text-transform: capitalize; }
.clm-client-header-right { display: flex; align-items: center; gap: 8px; }
.clm-status-badge {
  font-size: 11px; padding: 3px 10px; border-radius: 20px; font-weight: 600; text-transform: capitalize;
}
.clm-status-pending_documents { background: #fef3c7; color: #92400e; }
.clm-status-under_review      { background: #dbeafe; color: #1d4ed8; }
.clm-status-approved          { background: #dcfce7; color: #15803d; }
.clm-status-rejected          { background: #fee2e2; color: #b91c1c; }
.clm-status-closed            { background: #f3f4f6; color: #6b7280; }
.clm-status-archived          { background: #e5e7eb; color: #374151; }
/* legacy */
.clm-status-active  { background: #dcfce7; color: #15803d; }
.clm-status-pending { background: #fef9c3; color: #92400e; }

/* ── Broker Dashboard ──────────────────────────────────────── */
.clm-broker-tab {
  background: #f1f5f9; border: 1px solid #e2e8f0; border-radius: 20px;
  padding: 4px 12px; font-size: 12px; font-weight: 600; color: #64748b;
  cursor: pointer; transition: all .15s;
}
.clm-broker-tab:hover  { background: #e2e8f0; }
.clm-broker-tab.active { background: #0a1f44; color: #fff; border-color: #0a1f44; }
.clm-btn-xs {
  padding: 3px 9px; font-size: 11px; border-radius: 5px; font-weight: 600;
  cursor: pointer; border: none;
}

/* ── Workflow action bar ───────────────────────────────────── */
.clm-wf-btn-success {
  background: #16a34a; color: #fff; border: none; border-radius: 6px;
  padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.clm-wf-btn-success:hover { background: #15803d; }
.clm-wf-btn-warning {
  background: #f59e0b; color: #fff; border: none; border-radius: 6px;
  padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
}
.clm-wf-btn-warning:hover { background: #d97706; }

/* ── Timeline ──────────────────────────────────────────────── */
.clm-timeline-item {
  display: flex; gap: 12px; margin-bottom: 18px; position: relative;
}
.clm-timeline-item:not(:last-child)::before {
  content: ''; position: absolute; left: 7px; top: 18px;
  width: 2px; bottom: -18px; background: #e2e8f0;
}
.clm-timeline-dot {
  width: 16px; height: 16px; border-radius: 50%; flex-shrink: 0;
  margin-top: 2px; border: 2px solid #fff; box-shadow: 0 0 0 2px currentColor;
}
.clm-timeline-body  { flex: 1; }
.clm-timeline-header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.clm-timeline-transition { font-size: 13px; }
.clm-timeline-meta  { font-size: 11px; color: #94a3b8; margin-top: 4px; }
.clm-timeline-reason {
  font-size: 12px; color: #374151; font-style: italic;
  background: #f8fafc; border-left: 3px solid #e2e8f0;
  padding: 6px 10px; border-radius: 0 4px 4px 0; margin: 6px 0;
}
.clm-timeline-badge {
  font-size: 10px; padding: 2px 7px; border-radius: 10px;
  background: #f3f4f6; color: #374151; font-weight: 600;
}
.clm-timeline-escalated { background: #fef3c7; color: #92400e; }

/* ── Rich activity timeline ────────────────────────────────── */
.clm-tl-track { display: flex; flex-direction: column; gap: 0; }
.clm-tl-item  {
  display: grid;
  grid-template-columns: 36px 20px 1fr;
  grid-template-rows: auto;
  column-gap: 10px;
  margin-bottom: 0;
  position: relative;
}
.clm-tl-icon {
  grid-column: 1; grid-row: 1;
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0; margin-top: 2px;
}
.clm-tl-line {
  grid-column: 2; grid-row: 1 / span 2;
  width: 2px; background: #e2e8f0;
  margin: 38px auto 0; min-height: 18px;
}
.clm-tl-line-last { background: transparent; }
.clm-tl-body {
  grid-column: 3; grid-row: 1;
  padding-bottom: 20px;
}
.clm-tl-title  { font-size: 13px; font-weight: 600; color: var(--color-text-primary); line-height: 1.4; }
.clm-tl-detail { font-size: 12px; color: #64748b; margin-top: 3px; line-height: 1.4; }
.clm-tl-meta   { display: flex; align-items: center; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.clm-tl-pill   {
  font-size: 10px; font-weight: 600; padding: 2px 8px;
  border-radius: 10px; background: #f1f5f9; color: #475569;
}
.clm-tl-pill-sys { background: #ede9fe; color: #6d28d9; }
.clm-tl-time   { font-size: 11px; color: #94a3b8; }

/* ── Sub-tabs ──────────────────────────────────────────────── */
.clm-subtabs {
  display: flex; gap: 0; border-bottom: 1.5px solid #e2e8f0;
  background: #f8fafc; flex-shrink: 0;
}
.clm-subtab {
  padding: 10px 18px; border: none; background: transparent; cursor: pointer;
  font-size: 13px; color: #6b7280; border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px;
}
.clm-subtab:hover { color: #1e5fbb; }
.clm-subtab.active { color: #1e5fbb; border-bottom-color: #1e5fbb; font-weight: 600; }

/* ── Report type tabs ──────────────────────────────────────── */
.clm-report-tab {
  padding: 6px 14px; border: 1.5px solid #e2e8f0; border-radius: 20px;
  background: #f8fafc; color: #64748b; font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all .15s;
}
.clm-report-tab:hover { border-color: #1e5fbb; color: #1e5fbb; }
.clm-report-tab.active {
  background: #1e5fbb; border-color: #1e5fbb; color: #fff; font-weight: 600;
}

/* ── Panels ────────────────────────────────────────────────── */
.clm-panel { padding: 18px 20px; }

/* ── Upload bar ────────────────────────────────────────────── */
.clm-upload-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px; background: #f8fafc; border: 1.5px dashed #cbd5e1;
  border-radius: 10px; margin-bottom: 16px;
}
.clm-upload-name { font-size: 12.5px; color: #6b7280; }
.clm-upload-hint { font-size: 11.5px; color: #9ca3af; margin-left: auto; }

/* ── Document cards ────────────────────────────────────────── */
.clm-doc-card {
  background: #fff; border: 1.5px solid #e2e8f0; border-radius: 10px;
  padding: 14px 16px; margin-bottom: 10px; transition: border-color .15s;
}
.clm-doc-card:hover { border-color: #93c5fd; }
.clm-doc-card-top { display: flex; align-items: flex-start; gap: 12px; }
.clm-doc-icon { font-size: 28px; flex-shrink: 0; }
.clm-doc-info { flex: 1; }
.clm-doc-name { font-size: 14px; font-weight: 600; color: #1f2937; margin-bottom: 5px; word-break: break-all; }
.clm-doc-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.clm-doc-size { font-size: 11px; color: #9ca3af; }
.clm-doc-date { font-size: 11px; color: #9ca3af; }

.clm-cat-badge {
  font-size: 10.5px; padding: 2px 8px; border-radius: 10px; font-weight: 600;
  background: #eff6ff; color: #1e40af;
}
.clm-cat-insurance-policy      { background: #dbeafe; color: #1e40af; }
.clm-cat-claim-document        { background: #fee2e2; color: #991b1b; }
.clm-cat-medical-report        { background: #d1fae5; color: #065f46; }
.clm-cat-legal---correspondence{ background: #fef3c7; color: #78350f; }
.clm-cat-invoice---financial   { background: #f3e8ff; color: #6d28d9; }
.clm-cat-identity-document     { background: #e0f2fe; color: #0369a1; }
.clm-cat-inspection---survey   { background: #fdf4ff; color: #86198f; }

.clm-proc-status { font-size: 11px; font-weight: 600; }
.clm-proc-pending     { color: #9ca3af; }
.clm-proc-processing  { color: #f59e0b; }
.clm-proc-done        { color: #16a34a; }
.clm-proc-failed      { color: #ef4444; }

.clm-doc-summary {
  font-size: 12.5px; color: #374151; line-height: 1.6;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid #f1f5f9;
}
.clm-doc-entities {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px;
}
.clm-entity-chip {
  font-size: 11px; background: #f8fafc; border: 1px solid #e2e8f0;
  padding: 2px 8px; border-radius: 6px; color: #374151;
}

/* ── Chat ──────────────────────────────────────────────────── */
.clm-chat-scope-banner {
  background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px;
  padding: 8px 14px; font-size: 12.5px; color: #1e40af; margin-bottom: 14px;
}
.clm-chat-messages {
  min-height: 280px; max-height: 380px; overflow-y: auto;
  border: 1.5px solid #e2e8f0; border-radius: 10px; padding: 16px;
  background: #f8fafc; margin-bottom: 12px;
}
.clm-chat-empty { font-size: 13px; color: #9ca3af; text-align: center; line-height: 2; }
#clm-suggested-qs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.clm-suggested-btn {
  background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 20px;
  padding: 6px 14px; font-size: 12px; color: #1e3a5f; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.clm-suggested-btn:hover { background: #dbeafe; border-color: #93c5fd; }
.clm-drop-zone {
  border: 2px dashed #cbd5e1; border-radius: 12px; padding: 22px 16px;
  text-align: center; background: #f8fafc; margin-bottom: 14px;
  transition: border-color .15s, background .15s; cursor: pointer;
}
.clm-drop-zone.clm-drop-active { border-color: #1e5fbb; background: #eff6ff; }
.clm-queue-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; background: #f8fafc; border-radius: 7px;
  margin-bottom: 5px; font-size: 12px;
}
.clm-queue-name { color: #374151; flex: 1; margin-right: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clm-queue-status { white-space: nowrap; }
.clm-assign-select {
  border: 1px solid #e2e8f0; border-radius: 6px; padding: 3px 6px;
  font-size: 12px; color: #1e3a5f; background: #f8fafc; cursor: pointer;
  max-width: 140px;
}
.clm-assign-select:hover { border-color: #93c5fd; background: #eff6ff; }
.clm-note-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 10px;
}
.clm-note-meta { display: flex; align-items: center; margin-bottom: 6px; font-size: 12px; }
.clm-note-body { font-size: 13px; color: #374151; line-height: 1.6; white-space: pre-wrap; }
.clm-chat-input-row { display: flex; gap: 10px; }
.clm-chat-input { flex: 1; }
.clm-msg { display: flex; margin-bottom: 12px; }
.clm-msg-user { justify-content: flex-end; }
.clm-msg-ai   { justify-content: flex-start; }
.clm-bubble {
  max-width: 80%; padding: 10px 14px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.6;
}
.clm-msg-user .clm-bubble { background: #1e5fbb; color: #fff; border-radius: 12px 12px 4px 12px; }
.clm-msg-ai   .clm-bubble { background: #fff; border: 1.5px solid #e2e8f0; border-radius: 12px 12px 12px 4px; color: #1f2937; }
.clm-bubble-thinking { color: #9ca3af; font-style: italic; }
.clm-dots span { animation: clm-dot 1.2s infinite; opacity: 0; }
.clm-dots span:nth-child(2) { animation-delay: .2s; }
.clm-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes clm-dot { 0%,80%,100%{opacity:0} 40%{opacity:1} }
.clm-cache-badge {
  font-size: 10px; background: #dcfce7; color: #15803d; padding: 2px 7px;
  border-radius: 10px; margin-bottom: 6px; display: inline-block;
}
.clm-sources { font-size: 11.5px; color: #6b7280; margin-top: 8px; border-top: 1px solid #f1f5f9; padding-top: 6px; }

/* ── Notes ─────────────────────────────────────────────────── */
.clm-notes-area {
  width: 100%; min-height: 280px; padding: 12px 14px; box-sizing: border-box;
  border: 1.5px solid #d1d5db; border-radius: 8px; font-size: 13.5px;
  color: #1f2937; line-height: 1.7; resize: vertical;
}
.clm-notes-area:focus { outline: none; border-color: #1e5fbb; }
.clm-notes-status { font-size: 12px; color: #16a34a; margin-top: 8px; height: 18px; }

/* ── Modal ─────────────────────────────────────────────────── */
.clm-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.clm-modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 540px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25); overflow: hidden;
}
.clm-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; background: #0a1f44; color: #fff;
  font-size: 15px; font-weight: 700;
}
.clm-modal-close { background: none; border: none; color: #fff; font-size: 18px; cursor: pointer; padding: 0 4px; }
.clm-modal-body  { padding: 20px; }
.clm-modal-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid #f1f5f9; }
.clm-modal-err { color: #ef4444; font-size: 12.5px; min-height: 18px; margin-top: 4px; }

/* ── Uploading state ───────────────────────────────────────── */
.clm-doc-uploading { opacity: .6; border-style: dashed; }

/* ── Manager Dashboard ─────────────────────────────────────── */
.clm-dash-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
@media (max-width: 900px) { .clm-dash-stats { grid-template-columns: repeat(3, 1fr); } }
.clm-stat-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 14px 12px; text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.clm-stat-icon  { font-size: 22px; margin-bottom: 4px; }
.clm-stat-value { font-size: 26px; font-weight: 800; line-height: 1.1; }
.clm-stat-label { font-size: 11px; color: #94a3b8; margin-top: 3px; font-weight: 500; text-transform: uppercase; letter-spacing: .4px; }
.clm-dash-table-wrap { overflow-x: auto; border-radius: 10px; border: 1px solid #e2e8f0; }
.clm-dash-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.clm-dash-table thead tr { background: #0a1f44; color: #fff; }
.clm-dash-table thead th { padding: 9px 12px; text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .3px; }
.clm-dash-row { cursor: pointer; transition: background .12s; }
.clm-dash-row:nth-child(even) { background: #f8fafc; }
.clm-dash-row:hover { background: #eff6ff; }
.clm-dash-row td { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.clm-deadline-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 11px 13px; margin-bottom: 9px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.clm-deadline-badge {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 10px; white-space: nowrap;
}
.clm-deadline-badge.overdue  { background: #fee2e2; color: #dc2626; }
.clm-deadline-badge.due-soon { background: #fef3c7; color: #d97706; }
.clm-deadline-badge.on-track { background: #d1fae5; color: #065f46; }
.clm-deadline-badge.no-date  { background: #f1f5f9; color: #94a3b8; }

/* ── Admin System Dashboard ────────────────────────────────── */
.clm-svc-card {
  border-radius: 12px; padding: 18px 20px;
  display: flex; flex-direction: column; gap: 8px;
}
.clm-svc-card.ok    { background: #f0fdf4; border: 1px solid #bbf7d0; }
.clm-svc-card.error { background: #fef2f2; border: 1px solid #fecaca; }
.clm-svc-dot-ok    { color: #16a34a; font-size: 16px; }
.clm-svc-dot-error { color: #dc2626; font-size: 16px; }
.clm-admin-stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 5px 0; border-bottom: 1px solid #f1f5f9; font-size: 12px;
}
.clm-admin-stat-row:last-child { border-bottom: none; }
.clm-admin-stat-label { color: #374151; }
.clm-admin-stat-val   { font-weight: 700; color: #0a1f44; }
.clm-admin-log-item {
  padding: 8px 0; border-bottom: 1px solid #f8fafc;
}
.clm-admin-log-item:last-child { border-bottom: none; }

/* ══════════════════════════════════════════════════════
   CLM — Data Files Tab
══════════════════════════════════════════════════════ */

/* Profiling cards grid */
.clm-df-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px;
  transition: box-shadow .15s;
}
.clm-df-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}

/* Inner tabs (Profile / Query / AI Chat) */
.clm-df-inner-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.clm-df-inner-tab:hover   { color: #1e3a5f; }
.clm-df-inner-tab.active  { color: #1e5fbb; border-bottom-color: #1e5fbb; }

/* Query results table */
#clm-df-query-results table th { font-size: 11px; }
#clm-df-query-results table td { font-size: 11px; }

/* ══════════════════════════════════════════════════════════
   INVESTMENT MODULE — Portfolio Manager styles
══════════════════════════════════════════════════════════ */

/* Stage filter pills in sidebar */
.inv-stage-pill {
  padding: 4px 10px; border: 1.5px solid #e2e8f0; border-radius: 14px;
  background: #f8fafc; color: #64748b; font-size: 11px; font-weight: 500;
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.inv-stage-pill:hover  { border-color: #0a3d2b; color: #0a3d2b; }
.inv-stage-pill.active { background: #0a3d2b; border-color: #0a3d2b; color: #fff; font-weight: 600; }

/* Sub-tabs inside company detail */
.inv-subtab {
  padding: 10px 16px; background: none; border: none; border-bottom: 2.5px solid transparent;
  font-size: 13px; font-weight: 500; color: #64748b; cursor: pointer; transition: all .15s;
}
.inv-subtab:hover  { color: #0a3d2b; }
.inv-subtab.active { color: #0a3d2b; border-bottom-color: #0a3d2b; font-weight: 700; }

/* Reports pills override to use green accent for investment */
#inv-panel-reports .clm-report-tab.active {
  background: #0a3d2b; border-color: #0a3d2b;
}
#inv-panel-reports .clm-report-tab:hover {
  border-color: #0a3d2b; color: #0a3d2b;
}

/* ── Workspace Command Center (radar) ─────────────────────────────────── */
@keyframes radarIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.radar-wrap   { width: 100%; max-width: 920px; padding: 28px 26px; text-align: left;
                overflow-y: auto; max-height: 100%; animation: radarIn .45s ease; }
.radar-hero   { background: linear-gradient(135deg, var(--brand-c1, #0a3d2b) 0%, var(--brand-c2, #166534) 100%);
                border-radius: 16px; padding: 22px 26px; color: #fff; margin-bottom: 18px;
                box-shadow: 0 10px 30px rgba(10, 61, 43, .25); position: relative; overflow: hidden; }
.radar-hero::after { content: '📡'; position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
                font-size: 64px; opacity: .15; }
.radar-title  { font-size: 20px; font-weight: 800; letter-spacing: .2px; }
.radar-sub    { font-size: 12px; color: #bbf7d0; margin-top: 3px; }
.radar-stats  { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.radar-stat   { flex: 1; min-width: 116px; background: #fff; border: 1px solid #e2e8f0;
                border-radius: 12px; padding: 12px 16px; border-top: 3px solid var(--rs, #64748b);
                box-shadow: 0 1px 3px rgba(15, 23, 42, .05); transition: transform .15s, box-shadow .15s; }
.radar-stat:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15, 23, 42, .1); }
.radar-stat b { display: block; font-size: 24px; color: #0f172a; line-height: 1.1; }
.radar-stat span { font-size: 11px; color: #64748b; font-weight: 600; letter-spacing: .3px; }
.radar-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .radar-grid { grid-template-columns: 1fr; } }
.radar-panel  { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 16px;
                box-shadow: 0 1px 3px rgba(15, 23, 42, .05); }
.radar-panel h4 { margin: 0 0 10px; font-size: 12px; font-weight: 800; color: #475569;
                letter-spacing: .6px; display: flex; align-items: center; gap: 6px; }
.radar-item   { display: flex; gap: 12px; align-items: center; padding: 8px 10px;
                border-radius: 10px; cursor: pointer; transition: background .12s, transform .12s; }
.radar-item:hover { background: #f8fafc; transform: translateX(2px); }
.radar-item + .radar-item { border-top: 1px solid #f8fafc; }
.radar-date   { min-width: 46px; text-align: center; background: #fffbeb; border: 1px solid #fde68a;
                border-radius: 10px; padding: 4px 2px; }
.radar-date b { display: block; font-size: 16px; color: #b45309; line-height: 1; }
.radar-date span { font-size: 9px; font-weight: 700; color: #d97706; text-transform: uppercase; }
.radar-date.overdue { background: #fef2f2; border-color: #fecaca; }
.radar-date.overdue b { color: #dc2626; } .radar-date.overdue span { color: #ef4444; }
.radar-line   { font-size: 12.5px; color: #0f172a; line-height: 1.35; }
.radar-meta   { font-size: 10.5px; color: #94a3b8; margin-top: 1px; }
.radar-sev    { font-size: 16px; min-width: 24px; text-align: center; }
.radar-empty  { font-size: 12px; color: #94a3b8; padding: 14px 10px; text-align: center; }
