/* ═══════════════════════════════════════════════
   Product Performance CSS — Canifa AI System
   Uses CSS variables from lab.css
   ═══════════════════════════════════════════════ */

body{font-family:'Outfit',sans-serif;background:var(--bg);color:var(--t);min-height:100vh;display:flex}

/* ═══ SIDEBAR ═══ */
.sidebar{width:240px;background:var(--s);display:flex;flex-direction:column;position:fixed;top:0;left:0;bottom:0;overflow-y:auto;z-index:100;border-right:1px solid var(--b)}
.sb-logo{padding:18px 20px;font-family:'Fraunces',serif;font-size:20px;font-weight:600;border-bottom:1px solid var(--b);display:flex;align-items:center;gap:8px}
.sb-logo span{color:var(--gold)}
.sb-live{display:flex;align-items:center;gap:6px;margin-left:auto;font-size:10px;font-weight:700;color:#16A34A}
.sb-live-dot{width:6px;height:6px;border-radius:50%;background:#16A34A;animation:pulse 2s infinite}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.3}}
.sb-section{padding:12px 14px 6px;font-size:9px;font-weight:700;text-transform:uppercase;letter-spacing:1px;color:var(--f)}
.sb-nav{padding:4px 10px}
.sb-link{display:flex;align-items:center;gap:10px;padding:9px 12px;border-radius:var(--rs);color:var(--m);text-decoration:none;font-size:13px;font-weight:500;transition:all .15s;cursor:pointer;margin-bottom:1px}
.sb-link:hover{background:var(--bg);color:var(--t)}
.sb-link.active{background:var(--gold-l);color:var(--gold);font-weight:700;border-left:3px solid var(--gold)}
.sb-link-icon{font-size:16px;width:20px;text-align:center}
.sb-footer{margin-top:auto;padding:14px;border-top:1px solid var(--b);font-size:10px;color:var(--f)}

/* ═══ MAIN ═══ */
.main{margin-left:240px;flex:1;display:flex;flex-direction:column;min-height:100vh}
.topbar{background:var(--s);border-bottom:1px solid var(--b);padding:0 24px;height:56px;display:flex;align-items:center;gap:14px;position:sticky;top:0;z-index:50}
.page-title{font-weight:700;font-size:16px;display:flex;align-items:center;gap:8px}
.content{padding:24px;flex:1}
.card{background:var(--s);border:1px solid var(--b);border-radius:var(--r);padding:18px;margin-bottom:16px}
.card-title{font-size:14px;font-weight:700;margin-bottom:14px;display:flex;align-items:center;gap:8px}
.card-sub{font-size:11px;color:var(--m);margin-left:auto;font-weight:400}

/* ═══ KPI ═══ */
.kpi-row{display:grid;grid-template-columns:repeat(6,1fr);gap:12px;margin-bottom:20px}
.kpi{background:var(--s);border:1px solid var(--b);border-radius:var(--r);padding:16px;text-align:center;transition:all .2s}
.kpi:hover{border-color:var(--gold);transform:translateY(-2px);box-shadow:0 4px 12px rgba(0,0,0,.06)}
.kpi-val{font-family:'Fraunces',serif;font-size:26px;font-weight:700}
.kpi-label{font-size:10px;color:var(--m);font-weight:600;margin-top:2px}
.kpi-sub{font-size:9px;color:var(--f);margin-top:2px}

/* ═══ TOOLBAR ═══ */
.toolbar{display:flex;align-items:center;gap:10px;margin-bottom:16px;flex-wrap:wrap}
.toolbar-search{flex:1;min-width:200px;padding:8px 14px;background:var(--s);border:1px solid var(--b);border-radius:var(--rs);font-family:inherit;font-size:12px;color:var(--t);transition:all .2s}
.toolbar-search:focus{outline:none;border-color:var(--gold);box-shadow:0 0 0 3px rgba(180,83,9,.1)}
.toolbar-select{padding:8px 12px;background:var(--s);border:1px solid var(--b);border-radius:var(--rs);font-family:inherit;font-size:12px;color:var(--t);cursor:pointer}
.toolbar-select:focus{outline:none;border-color:var(--gold)}
.chip{padding:5px 12px;border-radius:20px;border:1px solid var(--b);background:transparent;color:var(--m);font-family:inherit;font-size:11px;font-weight:600;cursor:pointer;transition:all .15s}
.chip:hover{border-color:var(--gold);color:var(--t)}
.chip.active{background:var(--gold-l);color:var(--gold);border-color:var(--gold-b)}
.refresh-btn{padding:6px 14px;border-radius:var(--rs);border:1px solid var(--b);background:var(--s);color:var(--m);font-family:inherit;font-size:11px;font-weight:600;cursor:pointer;transition:all .15s;display:flex;align-items:center;gap:4px}
.refresh-btn:hover{border-color:var(--gold);color:var(--t)}

/* ═══ GRID ═══ */
.grid-2{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:16px}
.grid-3-2{display:grid;grid-template-columns:3fr 2fr;gap:16px;margin-bottom:16px}

/* ═══ TABLE ═══ */
table{width:100%;border-collapse:collapse}
th{text-align:left;font-size:10px;font-weight:700;color:var(--m);text-transform:uppercase;letter-spacing:.5px;padding:8px 10px;border-bottom:2px solid var(--b)}
td{padding:14px 10px;border-bottom:1px solid var(--b);font-size:12px}
tr{transition:background .1s}
tr:hover{background:var(--bg)}
.td-product{display:flex;align-items:center;gap:10px}
.td-thumb{width:52px;height:52px;border-radius:10px;object-fit:cover;background:var(--bg);flex-shrink:0;border:1px solid var(--b)}
.td-swatch{width:52px;height:52px;border-radius:10px;display:flex;align-items:center;justify-content:center;font-size:16px;flex-shrink:0}
.td-name{font-weight:800;font-size:14px;color:var(--t);letter-spacing:-.2px}
.td-sku{font-size:11px;color:var(--m);font-family:'JetBrains Mono',monospace;font-weight:600;margin-top:2px}
.td-badge{display:inline-block;padding:2px 8px;border-radius:10px;font-size:9px;font-weight:700}
.td-bar-wrap{width:60px;height:6px;background:var(--bg);border-radius:3px;display:inline-block;vertical-align:middle;margin-right:4px}
.td-bar{height:100%;border-radius:3px;transition:width .5s}
.td-link{color:var(--blue);text-decoration:none;font-size:10px;font-weight:600}
.td-link:hover{text-decoration:underline}

/* ═══ CROSS-SELL ═══ */
.cs-pair{display:flex;align-items:center;gap:6px;padding:10px;border:1px solid var(--b);border-radius:var(--rs);margin-bottom:6px;font-size:11px;cursor:default;transition:all .15s}
.cs-pair:hover{background:var(--bg);border-color:var(--gold)}
.cs-sp{padding:4px 10px;background:var(--bg);border-radius:6px;font-weight:700;font-size:10px}
.cs-arrow{color:var(--gold);font-weight:700}
.cs-rate{margin-left:auto;font-family:'Fraunces',serif;font-size:14px;font-weight:700}

/* ═══ OOS ═══ */
.oos{display:flex;align-items:center;gap:8px;padding:8px;border-bottom:1px solid var(--b);font-size:11px}
.oos:last-child{border-bottom:none}
.oos-tag{font-size:8px;font-weight:700;padding:2px 6px;border-radius:4px}
.oos-name{flex:1;font-weight:600}
.oos-count{font-family:'JetBrains Mono',monospace;font-size:10px;font-weight:700}

/* ═══ BREAKDOWN ═══ */
.bd-item{display:flex;justify-content:space-between;align-items:center;padding:8px 0;border-bottom:1px solid var(--b);font-size:11px}
.bd-item:last-child{border-bottom:none}
.bd-name{font-weight:600}
.bd-val{font-family:'JetBrains Mono',monospace;font-size:10px;font-weight:700;color:var(--gold)}

/* ═══ PAGINATION ═══ */
.pager{display:flex;justify-content:space-between;align-items:center;padding:12px 0;font-size:11px;color:var(--m)}
.pager-btns{display:flex;gap:6px}
.pager-btn{padding:5px 12px;background:var(--s);border:1px solid var(--b);border-radius:var(--rs);font-family:inherit;font-size:11px;cursor:pointer;color:var(--t);transition:all .15s}
.pager-btn:hover:not(:disabled){border-color:var(--gold);background:var(--gold-l)}
.pager-btn:disabled{opacity:.3;cursor:not-allowed}

/* ═══ LOADING ═══ */
.loading{text-align:center;padding:40px;color:var(--m);font-size:12px}
.loading .spinner{width:28px;height:28px;border:3px solid var(--b);border-top-color:var(--gold);border-radius:50%;animation:spin .6s linear infinite;margin:0 auto 10px}
@keyframes spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}
.empty{text-align:center;padding:40px;color:var(--f);font-size:12px}

/* ═══ SCROLLBAR ═══ */
::-webkit-scrollbar{width:5px}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--b);border-radius:3px}
::-webkit-scrollbar-thumb:hover{background:var(--m)}

/* ═══ RESPONSIVE ═══ */
@media(max-width:900px){
    .kpi-row{grid-template-columns:repeat(3,1fr)}
    .grid-2,.grid-3-2{grid-template-columns:1fr}
    .sidebar{display:none}
    .main{margin-left:0}
}

/* ═══ IFRAME MODE: hide sidebar when embedded ═══ */
html.in-iframe .sidebar{display:none!important}
html.in-iframe .main{margin-left:0!important}
