/* ============================================================================
   Counter Vision Pro styles — namespaced cv- so nothing else in the CRM is
   affected. All classes prefixed cv-.
   ============================================================================ */
.cv-pro-tabbar { display: flex; gap: 4px; border-bottom: 2px solid #e2e8f0;
                 margin-bottom: 14px; flex-wrap: wrap; padding-top: 6px; }
.cv-tab { padding: 9px 14px; cursor: pointer; font-size: 13px; font-weight: 600;
          background: none; border: none; color: #64748b;
          border-bottom: 3px solid transparent; margin-bottom: -2px; }
.cv-tab:hover { color: #1e3a8a; }
.cv-tab.active { color: #1e3a8a; border-bottom-color: #f97316; }

.cv-pro-section { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
                  padding: 16px; margin-bottom: 14px; }
.cv-pro-section h3, .cv-pro-section h4 { color: #1e3a8a; margin-bottom: 6px; }
.cv-help { color: #64748b; font-size: 12px; margin-bottom: 10px; }
.cv-row { display: flex; gap: 8px; align-items: center; }

.cv-btn { padding: 8px 14px; border-radius: 6px; border: 1px solid #cbd5e1;
          background: #fff; cursor: pointer; font-weight: 600; font-size: 13px;
          color: #1e3a8a; }
.cv-btn:hover { background: #f1f5f9; }
.cv-btn.primary { background: #f97316; color: #fff; border-color: #f97316; }
.cv-btn.primary:hover { background: #ea580c; }
.cv-btn.small { padding: 5px 10px; font-size: 11px; }
.cv-btn.danger { color: #dc2626; border-color: #dc2626; }

.cv-page-entry { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px;
                 padding: 10px; margin-bottom: 8px; display: flex; gap: 12px;
                 align-items: center; }
.cv-page-entry.loaded { background: #f0fdf4; border-color: #16a34a; }
.cv-page-thumb { width: 50px; height: 38px; border-radius: 4px; background: #f1f5f9;
                 border: 1px solid #cbd5e1; display: flex; align-items: center;
                 justify-content: center; overflow: hidden; flex-shrink: 0; }
.cv-page-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cv-page-info { flex: 1; font-size: 13px; min-width: 0; }

.cv-asm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
               gap: 8px; }
.cv-asm-card { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 6px;
               padding: 10px; display: flex; flex-direction: column; gap: 4px; }
.cv-asm-card strong { font-size: 13px; color: #0f172a; }
.cv-asm-card button { margin-top: 6px; align-self: flex-start; }

/* ── 3D ─────────────────────────────────────────────────────────────────── */
.cv-pro-3d { display: flex; gap: 14px; min-height: 480px; }
.cv-pro-aside { width: 280px; background: #fff; border: 1px solid #e2e8f0;
                border-radius: 8px; padding: 14px; overflow-y: auto;
                max-height: 80vh; }
.cv-aside-section { margin-bottom: 16px; }
.cv-aside-title { font-size: 11px; text-transform: uppercase; color: #64748b;
                  font-weight: 700; letter-spacing: 0.5px; margin-bottom: 8px; }
.cv-aside-title .help { color: #94a3b8; font-weight: 400; text-transform: none;
                        letter-spacing: 0; font-size: 10px; }
.cv-3d-hint { position: absolute; bottom: 10px; right: 10px;
              background: rgba(15,23,42,.7); color: #94a3b8;
              padding: 5px 10px; border-radius: 5px; font-size: 11px; }
.cv-3d-empty { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
               color: #cbd5e1; font-size: 16px; text-align: center; }

.cv-swatch-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 6px; }
.cv-swatch { background: #f8fafc; border: 2px solid #e2e8f0; border-radius: 6px;
             padding: 6px; cursor: pointer; transition: all .15s; }
.cv-swatch:hover { border-color: #f97316; transform: translateY(-1px); }
.cv-swatch.active { border-color: #f97316; box-shadow: 0 0 0 2px rgba(249,115,22,.3); }
.cv-swatch-color { width: 100%; height: 42px; border-radius: 4px;
                   margin-bottom: 4px; position: relative; overflow: hidden; }
.cv-swatch-name { font-size: 11px; font-weight: 600; color: #0f172a; }
.cv-swatch-price { font-size: 10px; color: #64748b; font-family: monospace; }

.cv-edge-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 5px; }
.cv-edge-card { background: #f8fafc; border: 2px solid #e2e8f0; border-radius: 5px;
                padding: 5px; cursor: pointer; text-align: center; }
.cv-edge-card:hover { border-color: #f97316; }
.cv-edge-card.active { border-color: #f97316; background: #fff7ed; }
.cv-edge-card svg { width: 100%; height: 24px; }

.cv-pill-row { display: flex; gap: 4px; flex-wrap: wrap; }
.cv-pill { padding: 5px 10px; border: 1px solid #cbd5e1; background: #fff;
           border-radius: 5px; font-size: 11px; cursor: pointer; font-weight: 600;
           color: #475569; }
.cv-pill:hover { background: #f1f5f9; }
.cv-pill.active { background: #f97316; color: #fff; border-color: #f97316; }

.cv-app-btn { display: flex; align-items: center; gap: 8px; width: 100%;
              background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 5px;
              padding: 7px 9px; margin-bottom: 3px; cursor: pointer;
              font-size: 12px; color: #475569; }
.cv-app-btn:hover { background: #f1f5f9; }
.cv-app-btn.on { background: #f0fdf4; border-color: #16a34a; color: #15803d; }
.cv-app-btn span { margin-left: auto; color: #94a3b8; font-family: monospace;
                   font-size: 11px; }

/* ── BOM / Slab / Cut sheet ──────────────────────────────────────────────── */
.cv-stat-row { display: flex; gap: 10px; margin: 10px 0; }
.cv-stat { flex: 1; background: #f8fafc; border: 1px solid #e2e8f0;
           border-radius: 6px; padding: 8px 12px; }
.cv-stat span { display: block; font-size: 10px; color: #64748b;
                text-transform: uppercase; font-weight: 600; }
.cv-stat strong { font-size: 18px; color: #1e3a8a; font-family: monospace; }

.cv-bom { width: 100%; border-collapse: collapse; background: #fff;
          border: 1px solid #e2e8f0; border-radius: 6px; overflow: hidden; }
.cv-bom th { background: #1e3a8a; color: #fff; padding: 8px 10px; text-align: left;
             font-size: 11px; text-transform: uppercase; }
.cv-bom td { padding: 7px 10px; border-bottom: 1px solid #e2e8f0; font-size: 12px; }
.cv-bom .num { text-align: right; font-family: monospace; }
.cv-bom tr.sec td { background: #f1f5f9; color: #1e3a8a; font-weight: 700;
                    font-size: 11px; text-transform: uppercase; padding: 5px 10px; }
.cv-bom tfoot td { background: #fef3c7; font-weight: 700; font-size: 14px;
                   border: none; }
.cv-citations { margin-top: 12px; padding: 10px; background: #f8fafc;
                border-radius: 6px; font-size: 12px; color: #475569; }
.cv-citations a { color: #1e3a8a; }

.cv-cut-piece { background: #fff; border: 1px solid #e2e8f0; border-radius: 8px;
                padding: 14px; margin-bottom: 12px; display: grid;
                grid-template-columns: 280px 1fr; gap: 14px; }
.cv-cut-piece dl { margin: 0; }
.cv-cut-piece dt { font-size: 11px; color: #64748b; text-transform: uppercase;
                   font-weight: 600; margin-top: 6px; }
.cv-cut-piece dd { font-size: 13px; color: #0f172a; font-weight: 600;
                   font-family: monospace; }

.cv-empty { padding: 40px; text-align: center; color: #94a3b8; font-size: 14px;
            background: #f8fafc; border-radius: 8px; border: 1px dashed #cbd5e1; }

/* ── Calibration modal ──────────────────────────────────────────────────── */
.cv-modal { position: fixed; inset: 0; background: rgba(15,23,42,.6); z-index: 9999;
            display: flex; align-items: center; justify-content: center; }
.cv-modal-content { background: #fff; border-radius: 12px; padding: 18px;
                    max-height: 88vh; overflow: auto; width: 92vw; }
.cv-modal-head { display: flex; justify-content: space-between;
                 align-items: center; margin-bottom: 10px; }
.cv-modal-head button { background: none; border: none; font-size: 22px;
                        cursor: pointer; color: #64748b; }
