/* ===== Vision Studio CSS ===== */

.vs-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 16px;
}

/* Header */
.vs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
}
.vs-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}
.vs-logo {
    font-size: 36px;
    line-height: 1;
}
.vs-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 2px;
    color: #1e293b;
}
.vs-subtitle {
    font-size: 13px;
    color: #64748b;
    margin: 0;
}

/* Nav tabs */
.vs-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 0;
}
.vs-nav-btn {
    background: none;
    border: none;
    padding: 10px 16px;
    font-size: 14px;
    cursor: pointer;
    color: #64748b;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    border-radius: 0;
    transition: color 0.15s;
}
.vs-nav-btn:hover { color: #1e40af; }
.vs-nav-btn.active {
    color: #1e40af;
    border-bottom-color: #1e40af;
    font-weight: 600;
}

/* Buttons */
.vs-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: opacity 0.15s, transform 0.1s;
}
.vs-btn:active { transform: scale(0.97); }
.vs-btn-primary { background: #1e40af; color: #fff; }
.vs-btn-primary:hover { background: #1d3a9e; }
.vs-btn-secondary { background: #f1f5f9; color: #334155; }
.vs-btn-secondary:hover { background: #e2e8f0; }
.vs-btn-success { background: #22c55e; color: #fff; }
.vs-btn-warning { background: #f59e0b; color: #fff; }
.vs-btn-danger { background: #ef4444; color: #fff; }
.vs-btn-sm { padding: 6px 12px; font-size: 12px; }
.vs-btn-lg { padding: 12px 28px; font-size: 16px; }
.vs-btn-full { width: 100%; justify-content: center; margin-top: 12px; }
.vs-btn-link { background: none; border: none; color: #1e40af; cursor: pointer; font-size: 13px; padding: 0; text-decoration: underline; }

/* Task grid */
.vs-tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.vs-task-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px;
    transition: box-shadow 0.15s;
}
.vs-task-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }

.vs-task-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}
.vs-task-icon { font-size: 32px; line-height: 1; }
.vs-task-card-menu { display: flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.vs-task-card:hover .vs-task-card-menu { opacity: 1; }
.vs-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 14px;
    transition: background 0.1s;
}
.vs-icon-btn:hover { background: #f1f5f9; }
.vs-icon-btn-del:hover { background: #fee2e2; }

.vs-task-name {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 6px;
    color: #1e293b;
    line-height: 1.4;
}
.vs-task-desc {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 12px;
    line-height: 1.5;
}
.vs-task-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.vs-task-count { font-size: 12px; color: #94a3b8; }
.vs-task-trigger {
    font-size: 11px;
    background: #dbeafe;
    color: #1e40af;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 500;
}

.vs-task-card-new {
    border: 2px dashed #cbd5e1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    min-height: 160px;
    color: #94a3b8;
    transition: border-color 0.15s, color 0.15s;
}
.vs-task-card-new:hover { border-color: #1e40af; color: #1e40af; }
.vs-task-add-icon { font-size: 32px; margin-bottom: 8px; }

/* Empty state */
.vs-empty {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}
.vs-empty-icon { font-size: 48px; margin-bottom: 16px; }
.vs-empty h3 { font-size: 18px; font-weight: 600; margin: 0 0 8px; color: #334155; }
.vs-empty p { margin: 0 0 24px; line-height: 1.6; }

/* Examples */
.vs-examples { margin-top: 40px; }
.vs-examples-title { font-size: 13px; color: #94a3b8; margin-bottom: 12px; }
.vs-examples-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    max-width: 900px;
    margin: 0 auto;
}
.vs-example-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    text-align: left;
}
.vs-example-icon { font-size: 24px; display: block; margin-bottom: 6px; }
.vs-example-card strong { font-size: 13px; color: #1e293b; display: block; margin-bottom: 4px; }
.vs-example-card p { font-size: 12px; color: #64748b; margin: 0; line-height: 1.5; }

/* Modal */
.vs-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.vs-modal[style*="display:none"], .vs-modal[style*="display: none"] { display: none !important; }
.vs-modal-box {
    background: #fff;
    border-radius: 14px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.vs-modal-lg { max-width: 620px; }
.vs-modal-capture { max-width: 700px; }
.vs-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid #e2e8f0;
}
.vs-modal-header h3 { margin: 0; font-size: 16px; font-weight: 600; }
.vs-modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #64748b; padding: 4px; }
.vs-modal-close:hover { color: #ef4444; }
.vs-modal-body { padding: 20px; }
.vs-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #e2e8f0;
}

/* Form */
.vs-form-row { display: flex; gap: 12px; align-items: flex-start; }
.vs-form-icon { flex: 0 0 80px; }
.vs-form-title-group { flex: 1; }
.vs-form-group { margin-bottom: 14px; }
.vs-form-group label { display: block; font-size: 13px; font-weight: 500; color: #374151; margin-bottom: 5px; }
.vs-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.vs-input, .vs-textarea, .vs-select {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    color: #1e293b;
    background: #fff;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.vs-input:focus, .vs-textarea:focus, .vs-select:focus { outline: none; border-color: #1e40af; }
.vs-input-icon { text-align: center; font-size: 20px; padding: 6px; }
.vs-textarea { resize: vertical; }
.vs-textarea-prompt { font-family: monospace; font-size: 12px; }
.vs-info-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    color: #1e40af;
    line-height: 1.6;
}
.vs-info-box code { background: #dbeafe; padding: 1px 4px; border-radius: 3px; }
.vs-status-msg { font-size: 13px; color: #7c3aed; padding: 6px 0; }

/* Upload zone */
.vs-upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
.vs-upload-zone:hover, .vs-drag-over {
    border-color: #1e40af;
    background: #eff6ff;
}
#vs-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    pointer-events: none;
}
.vs-upload-icon { font-size: 36px; }
.vs-upload-hint { font-size: 15px; color: #334155; margin: 0; font-weight: 500; }
.vs-upload-hint-small { font-size: 12px; color: #94a3b8; margin: 0; }

/* Spinner */
.vs-spinner-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    gap: 12px;
    color: #64748b;
    font-size: 14px;
}
.vs-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: #1e40af;
    border-radius: 50%;
    animation: vs-spin 0.8s linear infinite;
}
@keyframes vs-spin { to { transform: rotate(360deg); } }

/* Analysis result */
.vs-result-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px;
    margin-bottom: 16px;
}
.vs-result-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin-bottom: 6px;
}
.vs-result-verdict { margin-bottom: 14px; }
.vs-result-text { font-size: 16px; font-weight: 600; color: #1e293b; margin: 0; }
.vs-result-details { margin-bottom: 14px; }
.vs-result-details p { font-size: 14px; color: #334155; margin: 0; line-height: 1.6; }
.vs-result-recs { margin-bottom: 14px; }
.vs-result-recs ul { margin: 0; padding-left: 20px; }
.vs-result-recs li { font-size: 14px; color: #334155; margin-bottom: 4px; line-height: 1.5; }
.vs-result-confidence {}
.vs-conf-bar-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 6px;
}
.vs-conf-bar-wrap > div:first-child {
    /* track */
    flex: 1;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.vs-conf-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}
.vs-conf-bar-wrap span { font-size: 14px; font-weight: 600; min-width: 40px; }

/* Feedback */
.vs-feedback-section { margin-top: 16px; border-top: 1px solid #e2e8f0; padding-top: 14px; }
.vs-feedback-label { font-size: 13px; color: #64748b; margin: 0 0 10px; }
.vs-feedback-btns { display: flex; gap: 8px; }
.vs-feedback-sent { font-size: 13px; color: #22c55e; }
.vs-feedback-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-top: 4px;
}
.vs-fb-correct { background: #dcfce7; color: #166534; }
.vs-fb-incorrect { background: #fee2e2; color: #991b1b; }
.vs-fb-partial { background: #fef9c3; color: #854d0e; }

/* Trigger banner */
.vs-trigger-banner {
    margin-top: 12px;
    padding: 10px 14px;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    font-size: 13px;
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* History */
.vs-history-list { display: flex; flex-direction: column; gap: 10px; }
.vs-history-row {
    display: flex;
    gap: 14px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    align-items: center;
}
.vs-history-thumb {
    width: 70px;
    height: 56px;
    border-radius: 6px;
    overflow: hidden;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.vs-history-thumb img { width: 100%; height: 100%; object-fit: cover; }
.vs-no-photo { font-size: 24px; }
.vs-history-body { flex: 1; min-width: 0; }
.vs-history-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.vs-history-task { font-size: 13px; font-weight: 500; color: #334155; }
.vs-history-date { font-size: 12px; color: #94a3b8; }
.vs-history-verdict { font-size: 14px; color: #1e293b; margin: 0 0 4px; }
.vs-confidence { font-size: 12px; background: #f1f5f9; padding: 2px 8px; border-radius: 20px; color: #64748b; }
.vs-history-actions { flex-shrink: 0; }

/* Analytics */
.vs-analytics { }
.vs-analytics-kpis {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 24px;
}
.vs-kpi-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px;
    text-align: center;
}
.vs-kpi-value { font-size: 28px; font-weight: 700; color: #1e40af; }
.vs-kpi-label { font-size: 12px; color: #64748b; margin-top: 4px; }
.vs-analytics-table-wrap { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; }
.vs-analytics-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.vs-analytics-table th { padding: 10px 14px; background: #f8fafc; text-align: left; font-size: 12px; color: #64748b; font-weight: 600; border-bottom: 1px solid #e2e8f0; }
.vs-analytics-table td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; color: #334155; }
.vs-analytics-table tr:last-child td { border-bottom: none; }
.vs-td-correct { color: #22c55e; font-weight: 600; }
.vs-td-incorrect { color: #ef4444; font-weight: 600; }
.vs-acc-bar-wrap { display: flex; align-items: center; gap: 8px; }
.vs-acc-bar-wrap > div:first-child { flex: 1; height: 6px; background: #e2e8f0; border-radius: 3px; }
.vs-acc-bar { height: 6px; border-radius: 3px; background: #22c55e; }

/* Loading/error */
.vs-loading { padding: 40px; text-align: center; color: #94a3b8; font-size: 14px; }
.vs-error { padding: 16px; background: #fee2e2; border-radius: 8px; color: #991b1b; font-size: 14px; }

/* Mobile */
@media (max-width: 600px) {
    .vs-header { flex-direction: column; align-items: flex-start; }
    .vs-tasks-grid { grid-template-columns: 1fr; }
    .vs-analytics-kpis { grid-template-columns: 1fr; }
    .vs-examples-grid { grid-template-columns: 1fr 1fr; }
    .vs-feedback-btns { flex-wrap: wrap; }
    .vs-history-row { flex-wrap: wrap; }
    .vs-analytics-table { font-size: 12px; }
    .vs-analytics-table th, .vs-analytics-table td { padding: 8px; }
}

/* Context selectors */
.vs-field-hint { font-size: 12px; color: #94a3b8; margin: 4px 0 0; }
.vs-doc-checkboxes { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow-y: auto; border: 1px solid #e2e8f0; border-radius: 8px; padding: 8px 12px; }
.vs-doc-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #334155; cursor: pointer; }
.vs-doc-check input { cursor: pointer; }
.vs-doc-type { font-size: 11px; background: #f1f5f9; color: #64748b; padding: 1px 6px; border-radius: 10px; }
.vs-ctx-badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px; margin-right: 4px; margin-bottom: 6px; }
.vs-ctx-sop { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.vs-ctx-doc { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* NCR section */
.vs-ncr-section { margin-top: 28px; }
.vs-section-title { font-size: 16px; font-weight: 600; color: #1e293b; margin: 0 0 4px; }
.vs-section-desc { font-size: 13px; color: #64748b; margin: 0 0 14px; }
.vs-ncr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.vs-ncr-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; }
.vs-ncr-photo { width: 100%; height: 100px; object-fit: cover; display: block; }
.vs-ncr-nophoto { height: 80px; display: flex; align-items: center; justify-content: center; font-size: 28px; background: #f8fafc; }
.vs-ncr-info { padding: 10px; }
.vs-ncr-info strong { font-size: 13px; display: block; margin-bottom: 4px; }
.vs-ncr-type { font-size: 11px; background: #fee2e2; color: #991b1b; padding: 1px 6px; border-radius: 10px; }
.vs-ncr-info p { font-size: 12px; color: #64748b; margin: 4px 0 0; }

/* Quiz section */
.vs-quiz-section { margin-top: 28px; }
.vs-quiz-task-list { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; }
.vs-quiz-task-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.vs-quiz-task-row:last-child { border-bottom: none; }
.vs-quiz-task-row > span:first-child { flex: 1; color: #1e293b; }
.vs-quiz-preview { display: flex; flex-direction: column; gap: 14px; }
.vs-quiz-q { background: #f8fafc; border-radius: 8px; padding: 14px; }
.vs-quiz-q strong { display: block; margin-bottom: 8px; color: #1e293b; }
.vs-quiz-answers { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.vs-quiz-answer { font-size: 13px; padding: 5px 10px; border-radius: 6px; }
.vs-quiz-correct { background: #dcfce7; color: #166534; }
.vs-quiz-wrong { background: #fee2e2; color: #991b1b; }
.vs-quiz-explain { font-size: 12px; color: #64748b; margin: 0; font-style: italic; }
