@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@300;400;500;600&display=swap');

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

:root {
  --navy: #B3261E;
  --navy-light: #D24B40;
  --red: #D24B40;
  --red-hover: #be3e34;
  --green: #4F9D6E;
  --orange: #C98A2E;
  --danger: #C0564C;
  --blue: #5B7DA8;
  --bg: #F6F5F1;
  --card: #ffffff;
  --text: #2C3242;
  --text-muted: #8A8F9C;
  --border: #ECEAE3;
  --border-strong: #DFDCD2;
  --sidebar-w: 248px;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(179,38,30,0.04);
  --shadow-lg: 0 12px 40px rgba(179,38,30,0.10);
}

body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); line-height: 1.55; -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4,h5 { font-family: 'Fraunces', serif; font-weight: 500; letter-spacing: -0.01em; }

/* ── LOGIN ── */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: radial-gradient(140% 120% at 50% -10%, #D24B40 0%, var(--navy) 60%); }
.login-card { background: var(--card); border-radius: 20px; padding: 52px 44px; width: 100%; max-width: 410px; box-shadow: var(--shadow-lg); }
.login-logo { text-align: center; margin-bottom: 36px; }
.login-logo .brand-name { font-family: 'Fraunces', serif; font-size: 30px; font-weight: 600; color: var(--navy); letter-spacing: -0.02em; }
.login-logo .brand-sub { font-size: 11px; color: var(--text-muted); letter-spacing: 2.5px; text-transform: uppercase; margin-top: 8px; }
.login-logo .logo-icon { width: 54px; height: 54px; background: var(--navy); border-radius: 16px; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }
.login-logo .logo-icon svg { color: white; }
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 8px; letter-spacing: 0.02em; }
.form-group input { width: 100%; padding: 13px 16px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 14px; font-family: 'Inter', sans-serif; transition: border-color .2s, box-shadow .2s; outline: none; background: #FCFBF9; }
.form-group input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(179,38,30,0.08); background: #fff; }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; font-family: 'Inter', sans-serif; cursor: pointer; border: 1px solid transparent; transition: all .18s ease; white-space: nowrap; letter-spacing: 0.01em; }
.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--navy-light); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--bg); border-color: var(--text-muted); }
.btn-navy { background: var(--navy); color: white; }
.btn-navy:hover { background: var(--navy-light); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 7px 13px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { filter: brightness(0.95); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: var(--red-hover); }
.error-msg { color: var(--danger); font-size: 13px; margin-bottom: 16px; padding: 11px 14px; background: #FBF1F0; border-radius: var(--radius-sm); border: 1px solid #F0DAD7; display: none; }
.error-msg.show { display: block; }

/* ── LAYOUT ── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar { width: var(--sidebar-w); background: var(--navy); min-height: 100vh; display: flex; flex-direction: column; position: fixed; left: 0; top: 0; z-index: 100; transition: width .3s; overflow: hidden; }
.sidebar-logo { padding: 26px 22px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo .brand { font-family: 'Fraunces', serif; font-size: 19px; font-weight: 600; color: white; letter-spacing: -0.01em; }
.sidebar-logo .brand span { color: var(--red); }
.sidebar-logo .season { font-size: 10px; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 2px; margin-top: 4px; }
.sidebar-nav { flex: 1; padding: 18px 14px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; margin-bottom: 2px; border-radius: var(--radius-sm); color: rgba(255,255,255,0.62); font-size: 13.5px; font-weight: 500; text-decoration: none; transition: all .18s; cursor: pointer; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.nav-item.active { background: rgba(255,255,255,0.10); color: white; }
.nav-item svg { flex-shrink: 0; opacity: 0.9; }
.sidebar-footer { padding: 16px 18px; border-top: 1px solid rgba(255,255,255,0.08); }
.user-info { display: flex; align-items: center; gap: 11px; }
.user-avatar { width: 36px; height: 36px; background: rgba(255,255,255,0.10); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 600; color: white; font-size: 13px; font-family: 'Inter', sans-serif; flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 600; color: white; }
.user-role { font-size: 10.5px; color: rgba(255,255,255,0.45); text-transform: uppercase; letter-spacing: 0.6px; }

.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { background: rgba(246,245,241,0.85); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); padding: 0 32px; height: 64px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; }
.topbar-title { font-family: 'Fraunces', serif; font-size: 19px; font-weight: 600; color: var(--navy); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.role-badge { padding: 4px 11px; border-radius: 20px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; }
.role-badge.admin { background: rgba(210,75,64,0.10); color: var(--red); }
.role-badge.viewer { background: rgba(91,125,168,0.12); color: var(--blue); }

.page-content { flex: 1; padding: 32px; max-width: 1400px; width: 100%; margin: 0 auto; }
.page-header { margin-bottom: 28px; }
.page-header h1 { font-size: 28px; color: var(--navy); font-weight: 600; }
.page-header p { color: var(--text-muted); font-size: 14px; margin-top: 6px; }

/* ── KPI CARDS ── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 28px; }
.kpi-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; transition: border-color .2s; }
.kpi-card:hover { border-color: var(--border-strong); }
.kpi-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-icon.navy { background: rgba(179,38,30,0.07); color: var(--navy); }
.kpi-icon.red { background: rgba(210,75,64,0.10); color: var(--red); }
.kpi-icon.green { background: rgba(79,157,110,0.12); color: var(--green); }
.kpi-icon.orange { background: rgba(201,138,46,0.12); color: var(--orange); }
.kpi-val { font-family: 'Fraunces', serif; font-size: 30px; font-weight: 600; color: var(--navy); line-height: 1; }
.kpi-label { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.7px; }

/* ── SEASON CARDS ── */
.season-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 18px; }
.season-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.season-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.season-card-head { font-family: 'Fraunces', serif; font-size: 16px; font-weight: 600; color: var(--navy); }
.season-tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.season-tag { font-size: 10px; font-weight: 600; letter-spacing: 0.5px; color: var(--text-muted); background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; }
.season-card-st { display: flex; align-items: baseline; gap: 6px; margin: 10px 0 8px; }
.season-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.season-split-col { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; background: var(--bg); }
.season-split-col.season-split-e { border-left: 3px solid var(--orange, #C98A2E); }
.season-split-col.season-split-h { border-left: 3px solid var(--blue, #5B7DA8); }
.season-split-coll { font-size: 11px; font-weight: 700; color: var(--text); }
.season-split-kind { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.season-split-stock { font-size: 18px; font-weight: 700; color: var(--text); line-height: 1.1; margin-top: 6px; }
.season-split-cap { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.season-split-sold { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.season-st-val { font-size: 26px; font-weight: 700; color: var(--text); line-height: 1; }
.season-st-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.season-bar { height: 7px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.season-bar-fill { height: 100%; border-radius: 4px; transition: width .3s; }
.season-card-foot { display: flex; justify-content: space-between; margin-top: 12px; font-size: 12px; color: var(--text-muted); }
.season-card-foot strong { color: var(--text); }

/* ── COLLECTION SHARE BAR (analytics by-group breakdown) ── */
.coll-share { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.coll-share-bar { flex: 1; height: 7px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.coll-share-fill { height: 100%; border-radius: 4px; }
.coll-share-pct { font-size: 12px; color: var(--text-muted); min-width: 40px; text-align: right; }

/* ── CARDS ── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.card-title { font-size: 16px; font-weight: 600; color: var(--navy); margin-bottom: 22px; font-family: 'Fraunces', serif; }
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.chart-full { grid-column: 1 / -1; }

/* ── FILTERS ── */
.filter-bar { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 20px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-bar select, .filter-bar input[type=text] { padding: 9px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 13px; font-family: 'Inter', sans-serif; outline: none; background: #FCFBF9; transition: border-color .2s, box-shadow .2s; min-width: 150px; color: var(--text); }
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(179,38,30,0.07); background: #fff; }
.filter-bar input[type=text] { flex: 1; min-width: 200px; }
.toggle-group { display: flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.toggle-btn { padding: 8px 16px; font-size: 13px; font-weight: 500; cursor: pointer; background: white; border: none; font-family: 'Inter', sans-serif; transition: all .18s; color: var(--text-muted); }
.toggle-btn.active { background: var(--navy); color: white; }

/* ── PRODUCT GRID ── */
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 22px; align-items: start; }
.product-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; transition: transform .2s, box-shadow .2s, border-color .2s; }
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.product-img { width: 100%; height: 200px; background: #F6F5F1; display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.product-img img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }
.product-img .placeholder { text-align: center; color: var(--text-muted); }
.product-img .placeholder .barcode-txt { font-size: 11px; font-weight: 600; color: var(--navy); margin-top: 8px; font-family: 'Inter', sans-serif; }
.set-badge { position: absolute; top: 10px; right: 10px; padding: 4px 10px; border-radius: 20px; font-size: 10px; font-weight: 700; letter-spacing: 0.3px; backdrop-filter: blur(4px); white-space: nowrap; color: #fff; }
.set-badge.complete { background: rgba(79,157,110,0.92); }
.set-badge.missing { background: rgba(201,138,46,0.92); }
.set-badge.missing-bad { background: rgba(192,86,76,0.92); }
.set-badge.single { background: rgba(91,125,168,0.92); }
.set-badge.soldout { background: rgba(71,77,92,0.92); }
.rec-badge { position: absolute; top: 10px; left: 10px; background: var(--orange); color: white; font-size: 10px; font-weight: 600; padding: 4px 9px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.4px; }
.product-info { display: flex; flex-direction: column; gap: 9px; padding: 14px 16px 16px; flex: 1; }
.prod-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-color { font-size: 10px; font-weight: 700; color: #fff; background: var(--navy); padding: 3px 10px; border-radius: 12px; flex-shrink: 0; text-transform: uppercase; letter-spacing: 0.3px; }
.card-meta { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta strong { font-weight: 600; color: var(--text); }
.set-status-bar { font-size: 10.5px; font-weight: 700; padding: 6px 10px; border-radius: 8px; letter-spacing: 0.3px; text-transform: uppercase; text-align: center; color: #fff; }
.set-status-bar.complete { background: var(--green); }
.set-status-bar.missing { background: var(--orange); }
.set-status-bar.missing-bad { background: #c0564c; }
.set-status-bar.single { background: var(--blue); }
.set-status-bar.soldout { background: #474d5c; }
.card-stats { display: flex; align-items: center; justify-content: space-between; gap: 4px; background: var(--bg); border-radius: 10px; padding: 10px 8px; }
.stat-box { text-align: center; flex: 1; min-width: 0; }
.stat-value { font-family: 'Fraunces', serif; font-size: 19px; font-weight: 600; color: var(--navy); line-height: 1; }
.stat-value.good { color: #2f7350; }
.stat-value.warn { color: #875517; }
.stat-value.bad { color: #9e362d; }
.stat-box.pct .stat-value { font-size: 16px; }
.stat-label { font-size: 9.5px; color: var(--text-muted); margin-top: 4px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.3px; }
.stat-divider { width: 1px; height: 30px; background: var(--border-strong); flex-shrink: 0; }
.sg-section-totals { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; background: var(--bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px 18px; margin-bottom: 10px; }
.sg-section-totals .stat-box { flex: 0 0 auto; }
.sg-totals-st { min-width: 150px; }
.sg-totals-st .stat-label { margin: 0 0 5px; }
.sg-totals-sets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-left: auto; }
.sell-row { display: flex; flex-direction: column; gap: 5px; }
.sell-row-head { display: flex; align-items: center; justify-content: space-between; font-size: 11px; color: var(--text-muted); font-weight: 500; }
.sell-row-head .sell-pct { font-weight: 700; color: var(--navy); font-size: 12px; }
.sell-bar { height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.sell-bar-fill { height: 100%; border-radius: 3px; transition: width .4s ease; }
.sell-bar-fill.good { background: var(--green); }
.sell-bar-fill.warn { background: var(--orange); }
.sell-bar-fill.bad { background: var(--danger); }
.card-action { margin-top: auto; padding-top: 2px; }
.btn-suggest { width: 100%; padding: 9px; border: 2px solid var(--navy); background: transparent; color: var(--navy); border-radius: 9px; font-size: 12px; font-weight: 700; font-family: 'Inter', sans-serif; cursor: pointer; transition: all .15s; letter-spacing: 0.4px; }
.btn-suggest:hover { background: var(--navy); color: #fff; }
.product-ref { font-family: 'Fraunces', serif; font-size: 16px; font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.product-name { font-size: 11.5px; color: var(--text-muted); margin-bottom: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-badges { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.badge { padding: 3px 9px; border-radius: 20px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.badge-color { background: rgba(179,38,30,0.06); color: var(--navy); }
.badge-size { background: rgba(91,125,168,0.12); color: var(--blue); }
.badge-subgroup { background: rgba(201,138,46,0.12); color: #8a5e1c; }
.badge-theme { background: var(--bg); color: var(--text-muted); font-size: 10px; }
.product-theme { font-size: 11px; color: var(--text-muted); margin-bottom: 10px; }
.stock-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.stock-box { padding: 5px 12px; border-radius: var(--radius-sm); font-family: 'Fraunces', serif; font-weight: 600; font-size: 20px; min-width: 50px; text-align: center; }
.stock-box.good { background: rgba(79,157,110,0.12); color: #2f7350; }
.stock-box.warn { background: rgba(201,138,46,0.14); color: #875517; }
.stock-box.bad { background: rgba(192,86,76,0.10); color: #9e362d; }
.stock-meta { font-size: 11px; color: var(--text-muted); text-align: right; }
.stock-meta strong { color: var(--text); }
.sell-through-row { margin-bottom: 12px; }
.sell-through-label { display: flex; justify-content: space-between; font-size: 11px; margin-bottom: 5px; }
.progress-bar { height: 5px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width .4s; }
.progress-fill.good { background: var(--green); }
.progress-fill.warn { background: var(--orange); }
.progress-fill.bad { background: var(--danger); }
.set-status { font-size: 10px; font-weight: 600; padding: 4px 9px; border-radius: 20px; margin-bottom: 12px; display: inline-block; letter-spacing: 0.3px; }
.set-status.complete { background: rgba(79,157,110,0.12); color: #2f7350; }
.set-status.missing { background: rgba(201,138,46,0.12); color: #875517; }
.set-status.single { background: rgba(138,143,156,0.12); color: #6b7280; }

/* ── TABLE ── */
.table-container { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; background: var(--card); }
thead th { background: #FBFAF7; color: var(--navy); padding: 14px 16px; font-size: 11.5px; font-weight: 600; text-align: left; font-family: 'Inter', sans-serif; white-space: nowrap; cursor: pointer; user-select: none; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border-strong); transition: background .15s; }
thead th:hover { background: #F3F1EB; }
thead th.sorted { color: var(--red); }
tbody tr { border-bottom: 1px solid var(--border); transition: background .15s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #FBFAF7; }
tbody td { padding: 12px 16px; font-size: 13px; }
.table-img { width: 42px; height: 42px; object-fit: cover; border-radius: 8px; background: var(--bg); }
.table-placeholder { width: 42px; height: 42px; background: var(--bg); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 9px; color: var(--text-muted); text-align: center; font-weight: 600; }

/* ── PAGINATION ── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 28px; flex-wrap: wrap; }
.page-btn { padding: 8px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; cursor: pointer; background: var(--card); transition: all .18s; color: var(--text); }
.page-btn:hover:not(:disabled) { border-color: var(--navy); color: var(--navy); }
.page-btn.active { background: var(--navy); color: white; border-color: var(--navy); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { font-size: 13px; color: var(--text-muted); }

/* ── TABS ── */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border-strong); margin-bottom: 26px; }
.tab-btn { padding: 11px 18px; border: none; background: none; font-size: 13.5px; font-weight: 600; font-family: 'Inter', sans-serif; color: var(--text-muted); cursor: pointer; position: relative; transition: color .2s; }
.tab-btn:hover { color: var(--navy); }
.tab-btn.active { color: var(--navy); }
.tab-btn.active::after { content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--red); border-radius: 2px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(179,38,30,0.35); backdrop-filter: blur(3px); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--card); border-radius: 18px; padding: 32px; width: 100%; max-width: 480px; box-shadow: var(--shadow-lg); transform: scale(0.96); transition: transform .2s; }
.modal-overlay.open .modal { transform: scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.modal-title { font-family: 'Fraunces', serif; font-size: 19px; font-weight: 600; color: var(--navy); }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 22px; line-height: 1; padding: 4px; transition: color .2s; }
.modal-close:hover { color: var(--text); }
.modal-product-preview { display: flex; align-items: center; gap: 14px; background: var(--bg); border-radius: 12px; padding: 14px; margin-bottom: 22px; }
.modal-product-preview img, .modal-product-preview .placeholder-sm { width: 60px; height: 60px; object-fit: contain; border-radius: 10px; background: var(--border); display: flex; align-items: center; justify-content: center; font-size: 10px; color: var(--text-muted); }
.modal-product-info .ref { font-weight: 600; font-family: 'Fraunces', serif; color: var(--navy); font-size: 16px; }
.modal-product-info .meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
select.form-control, textarea.form-control { width: 100%; padding: 11px 14px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 14px; font-family: 'Inter', sans-serif; outline: none; transition: border-color .2s, box-shadow .2s; background: #FCFBF9; }
select.form-control:focus, textarea.form-control:focus { border-color: var(--navy); box-shadow: 0 0 0 3px rgba(179,38,30,0.07); background: #fff; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-label { font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 7px; display: block; }
.form-field { margin-bottom: 16px; }

/* ── TOAST ── */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 14px 18px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 500; min-width: 250px; border-left: 3px solid var(--green); animation: slideIn .3s ease; }
.toast.error { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--orange); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── SKELETON ── */
.skeleton { background: linear-gradient(90deg, #F1EFE9 25%, #E6E3DA 50%, #F1EFE9 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { height: 320px; border-radius: var(--radius); }
.skeleton-row { height: 50px; border-radius: 8px; margin-bottom: 8px; }

/* ── UPLOAD ── */
.drop-zone { border: 1.5px dashed var(--border-strong); border-radius: var(--radius); padding: 44px; text-align: center; transition: all .2s; cursor: pointer; background: #FBFAF7; }
.drop-zone:hover, .drop-zone.dragover { border-color: var(--navy); background: rgba(179,38,30,0.03); }
.drop-zone .drop-icon { font-size: 40px; margin-bottom: 12px; }
.drop-zone p { color: var(--text-muted); font-size: 14px; }
.drop-zone strong { color: var(--navy); }

/* ── STAT CHIPS ── */
.stat-chips { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.stat-chip { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; display: flex; flex-direction: column; gap: 5px; box-shadow: var(--shadow); min-width: 120px; }
.stat-chip-val { font-family: 'Fraunces', serif; font-size: 24px; font-weight: 600; color: var(--navy); }
.stat-chip-label { font-size: 11px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.6px; }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { width: 64px; }
  .sidebar .brand, .sidebar .season, .nav-item span, .sidebar-footer .user-name, .sidebar-footer .user-role { display: none; }
  .main-content { margin-left: 64px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page-content { padding: 18px; }
}
@media (min-width: 1600px) {
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}
@media (max-width: 1100px) {
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
}
@media (max-width: 700px) {
  .products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-img { height: 220px; }
}

/* ── MISC ── */
.text-muted { color: var(--text-muted); }
.text-green { color: var(--green); }
.text-orange { color: var(--orange); }
.text-red { color: var(--danger); }
.text-blue { color: var(--blue); }
.fw-bold { font-weight: 700; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.justify-between { justify-content: space-between; }
.empty-state { text-align: center; padding: 72px 20px; color: var(--text-muted); }
.empty-state h3 { font-family: 'Fraunces', serif; font-size: 20px; font-weight: 600; color: var(--navy); margin-bottom: 8px; }
.sortable { cursor: pointer; }
.sortable:hover { background: rgba(255,255,255,0.1); }

/* ── PASSWORD RULES ── */
.pw-rules { list-style: none; margin: 6px 0 18px; padding: 14px 16px; background: #FBFAF7; border: 1px solid var(--border); border-radius: var(--radius-sm); display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
.pw-rules li { font-size: 11.5px; color: var(--text-muted); position: relative; padding-left: 20px; }
.pw-rules li::before { content: '○'; position: absolute; left: 0; color: var(--text-muted); }
.pw-rules li.ok { color: #2f7350; }
.pw-rules li.ok::before { content: '✓'; color: var(--green); font-weight: 700; }

/* ── KPI 5-col ── */
.kpi-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }

/* ── BREADCRUMB ── */
.breadcrumb { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.breadcrumb a { color: var(--navy); text-decoration: none; cursor: pointer; font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: var(--border-strong); }

/* ── STOCK LAYOUT (tree + content) ── */
.stock-layout { display: grid; grid-template-columns: 230px 1fr; gap: 20px; align-items: start; }
.tree-sidebar { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; position: sticky; top: 80px; max-height: calc(100vh - 110px); overflow-y: auto; }
.tree-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-muted); padding: 4px 8px 10px; }
.tree-node { font-size: 13px; }
.tree-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px; border-radius: var(--radius-sm); cursor: pointer; transition: background .15s; color: var(--text); }
.tree-row:hover { background: var(--bg); }
.tree-row.active { background: rgba(179,38,30,0.08); color: var(--navy); font-weight: 600; }
.tree-row .tw-label { display: flex; align-items: center; gap: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row .tw-count { font-size: 10.5px; color: var(--text-muted); background: var(--bg); padding: 1px 7px; border-radius: 20px; flex-shrink: 0; }
.tree-row .caret { transition: transform .15s; display: inline-block; font-size: 9px; color: var(--text-muted); width: 10px; }
.tree-row.open .caret { transform: rotate(90deg); }
.tree-cat > .tree-children { margin-left: 12px; display: none; }
.tree-cat.open > .tree-children { display: block; }
.tree-group > .tree-children { margin-left: 14px; display: none; }
.tree-group.open > .tree-children { display: block; }
.tree-sub .tree-row { font-size: 12.5px; color: var(--text-muted); }

/* ── SIZE TILES ── */
.size-tiles { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.size-tile { min-width: 38px; padding: 5px 7px; border-radius: 8px; text-align: center; font-size: 10px; border: 1px solid var(--border); background: var(--bg); }
.size-tile .sz { font-weight: 600; color: var(--text); font-size: 10.5px; }
.size-tile .qty { font-family: 'Fraunces', serif; font-weight: 600; font-size: 13px; margin-top: 1px; }
.size-tile.good { background: rgba(79,157,110,0.10); border-color: rgba(79,157,110,0.30); }
.size-tile.good .qty { color: #2f7350; }
.size-tile.warn { background: rgba(201,138,46,0.10); border-color: rgba(201,138,46,0.30); }
.size-tile.warn .qty { color: #875517; }
.size-tile.bad { background: rgba(192,86,76,0.08); border-color: rgba(192,86,76,0.25); }
.size-tile.bad .qty { color: #9e362d; }

/* set-status extra variants */
.set-status.missing-bad { background: rgba(192,86,76,0.12); color: #9e362d; }
.set-status.soldout { background: rgba(44,50,66,0.10); color: #2C3242; }

.pack-actions { display: flex; gap: 8px; margin-top: 4px; }
.pack-actions .btn { flex: 1; justify-content: center; }

/* ── IMPORT PANELS ── */
.import-panels { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.import-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; }
.import-card h3 { font-size: 15px; color: var(--navy); margin-bottom: 4px; }
.import-card .desc { font-size: 12px; color: var(--text-muted); margin-bottom: 14px; min-height: 48px; }
.import-card .cols { font-size: 11px; color: var(--text-muted); background: var(--bg); border-radius: 8px; padding: 8px 10px; margin-bottom: 14px; font-family: monospace; }
.import-card .file-name { font-size: 11.5px; color: var(--text); margin: 8px 0; min-height: 16px; }

/* ── ADMIN SUBNAV ── */
.subnav { display: flex; gap: 6px; margin-bottom: 24px; flex-wrap: wrap; }
.subnav .pill { padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 500; cursor: pointer; background: var(--card); border: 1px solid var(--border-strong); color: var(--text-muted); transition: all .15s; }
.subnav .pill.active { background: var(--navy); color: white; border-color: var(--navy); }

/* ── STATUS BADGES (tables) ── */
.tag { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.tag.green { background: rgba(79,157,110,0.12); color: #2f7350; }
.tag.red { background: rgba(192,86,76,0.10); color: #9e362d; }
.tag.gray { background: rgba(138,143,156,0.12); color: #6b7280; }
.tag.orange { background: rgba(201,138,46,0.12); color: #875517; }
.tag.blue { background: rgba(91,125,168,0.12); color: var(--blue); }

/* ── EXPANDABLE ANALYTICS ROWS ── */
tbody tr.expandable { cursor: pointer; }
tbody tr.detail-row > td { background: #FBFAF7; padding: 0; }
.detail-inner { padding: 14px 18px; }
.detail-inner table { background: transparent; }
.detail-inner thead th { background: transparent; }
.caret-cell { width: 22px; color: var(--text-muted); }

/* ── SUMMARY BANNER ── */
.summary-banner { display: flex; flex-wrap: wrap; gap: 22px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 24px; margin-bottom: 22px; }
.summary-banner .sb-item { display: flex; flex-direction: column; gap: 3px; }
.summary-banner .sb-val { font-family: 'Fraunces', serif; font-size: 22px; font-weight: 600; color: var(--navy); }
.summary-banner .sb-label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; }

/* ── REC LIST ── */
.rec-list { display: flex; flex-direction: column; gap: 12px; }
.rec-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; display: flex; align-items: center; gap: 16px; }
.rec-item .rec-img, .rec-item .rec-img img { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--bg); flex-shrink: 0; }
.rec-item .rec-body { flex: 1; min-width: 0; }
.rec-item .rec-ref { font-weight: 600; color: var(--navy); font-family: 'Fraunces', serif; }
.rec-item .rec-note { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }
.rec-item .rec-meta { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.rec-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* responsive */
@media (max-width: 1100px) {
  .stock-layout { grid-template-columns: 1fr; }
  .tree-sidebar { position: static; max-height: 320px; }
  .import-panels { grid-template-columns: 1fr; }
  .kpi-grid.cols-5 { grid-template-columns: repeat(2, 1fr); }
}

/* ── v2 additions: admin import/images, file-drop, misc ── */
.kpi-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.admin-panel { animation: fadeIn .2s ease; }

.import-card-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.import-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; }
.import-dot.navy { background: var(--navy); }
.import-dot.red { background: var(--red); }
.import-dot.green { background: var(--green); }
.import-title { font-weight: 600; font-size: 14.5px; color: var(--text); }
.import-desc { font-size: 12px; color: var(--text-muted); line-height: 1.4; margin-top: 2px; }

.file-drop { display: block; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 20px 14px; text-align: center; cursor: pointer; transition: all .15s; margin-bottom: 12px; background: var(--bg); }
.file-drop:hover { border-color: var(--navy); background: rgba(179,38,30,0.03); }
.file-drop.has-file { border-color: var(--green); border-style: solid; background: rgba(79,157,110,0.05); }
.fd-icon { font-size: 22px; color: var(--text-muted); margin-bottom: 4px; }
.file-drop.has-file .fd-icon { color: var(--green); }
.fd-text { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.fd-name { font-size: 12px; color: var(--navy); font-weight: 600; margin-top: 6px; word-break: break-all; }

.import-result { font-size: 12.5px; margin-top: 10px; min-height: 16px; font-weight: 500; }
.import-result.success { color: #2f7350; }
.import-result.error { color: #9e362d; }

.row-muted { opacity: 0.55; }
.stat-bar { width: 100%; height: 4px; border-radius: 4px; margin-top: 10px; }
.stat-bar.green { background: var(--green); }
.stat-bar.orange { background: var(--orange); }
.stat-bar.navy { background: var(--navy); }
.stat-bar.red { background: var(--red); }

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

/* Analytics — Sub-Group per Group drill-down */
.sg-detail-grid { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
.sg-donut-card { padding: 14px 16px; }
.sg-donut-card .card-title { margin-bottom: 8px; }
.sg-themes { min-width: 0; overflow-x: auto; }
.products-grid-compact { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.products-grid-compact .product-card { font-size: 13px; }
.products-grid-compact .product-img { aspect-ratio: auto; height: 170px; }
.products-grid-compact .product-info { padding: 12px; }
.pack-drill-inner { padding: 14px 18px; background: var(--bg, #faf7f6); }
@media (max-width: 900px) { .sg-detail-grid { grid-template-columns: 1fr; } }

/* Analytics pack card photo */
.analytics-card-photo { width: 100%; height: 180px; overflow: hidden; border-radius: 10px 10px 0 0; background: #f5f0eb; flex-shrink: 0; position: relative; }
.analytics-card-photo img { width: 100%; height: 180px; max-height: 180px; min-height: 180px; object-fit: cover; object-position: center top; display: block; }

/* ── EQUAL HEIGHT CARDS ──────────────────────────────── */
/* Make every card in a row the same height; size tiles scroll if too many. */
.products-grid { align-items: stretch !important; }
.product-card { height: 100% !important; }
/* .product-info already has flex:1; .card-action already has margin-top:auto */

/* Size tiles — fixed area, scrollable when a pack has many sizes */
.product-card .size-tiles {
  max-height: 96px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  flex-shrink: 0 !important;
  scrollbar-width: thin !important;
  scrollbar-color: #d0c8c0 transparent !important;
}
.product-card .size-tiles::-webkit-scrollbar { width: 4px; }
.product-card .size-tiles::-webkit-scrollbar-track { background: transparent; }
.product-card .size-tiles::-webkit-scrollbar-thumb { background: #d0c8c0; border-radius: 2px; }
