:root {
  --iv-blue: #0d6efd;
  --iv-blue-dark: #0a58ca;
  --iv-bg: #f3f6fb;
  --iv-sidebar-bg: #ffffff;
  --iv-border: #e5eaf2;
  --iv-text: #172033;
  --iv-muted: #667085;
  --iv-sidebar-width: 280px;
  --iv-topbar-height: 58px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body.app-body, body { min-height: 100vh; background: var(--iv-bg); color: var(--iv-text); }
body.app-body { overflow-x: hidden; }
a { text-underline-offset: .18em; }
.navbar-brand { letter-spacing: -0.025em; }
.card { border-radius: 1rem; border: 1px solid var(--iv-border) !important; }
.btn { border-radius: .7rem; }
.form-control, .form-select { border-radius: .65rem; }
.table > :not(caption) > * > * { vertical-align: middle; }
.table td, .table th { white-space: normal; }
.preview-img { width: 90px; height: 90px; object-fit: contain; background: #fff; border: 1px solid #e5e7eb; border-radius: .75rem; padding: .35rem; }
.login-shell { min-height: calc(100vh - 60px); display: grid; place-items: center; }
.stat-card { background: linear-gradient(135deg, #fff, #f8fbff); border: 1px solid #e7eef9; }
.copy-url { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .85rem; overflow-wrap: anywhere; }

.nav-icon { width: 1.2rem; margin-right: .35rem; opacity: .85; text-align: center; }
.language-flag { font-size: 1.5rem; line-height: 1; }
.language-card { transition: transform .12s ease, box-shadow .12s ease; }
.language-card:hover { transform: translateY(-1px); box-shadow: 0 .75rem 1.5rem rgba(13, 110, 253, .12); }
.step-icon { width: 1.1rem; margin-right: .35rem; text-align: center; }

.app-topbar {
  min-height: var(--iv-topbar-height);
  z-index: 1040;
  border-bottom: 1px solid rgba(255,255,255,.18);
}
.app-topbar .navbar-brand { display: inline-flex; align-items: center; }

.app-sidebar {
  position: fixed !important;
  top: var(--iv-topbar-height) !important;
  bottom: 0 !important;
  left: 0 !important;
  width: var(--iv-sidebar-width) !important;
  background: var(--iv-sidebar-bg) !important;
  border-right: 1px solid var(--iv-border) !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  z-index: 1025 !important;
  box-shadow: .25rem 0 1.5rem rgba(16, 24, 40, .035);
}
.sidebar-inner { padding: 1rem .85rem 1.25rem; }
.sidebar-section { margin-bottom: .85rem; }
.sidebar-heading {
  color: #8a95a6;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 800;
  padding: .35rem .78rem;
}
.sidebar-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  background: transparent;
  color: #596579;
  font-weight: 800;
  padding: .58rem .78rem;
  border-radius: .8rem;
  text-align: left;
  line-height: 1.2;
}
.sidebar-group span { display: inline-flex; align-items: center; min-width: 0; }
.sidebar-group:hover { background: #f3f7ff; color: var(--iv-blue); }
.sidebar-group[aria-expanded="true"] .fa-chevron-down { transform: rotate(180deg); }
.sidebar-group .fa-chevron-down { transition: transform .16s ease; }
.sidebar-link {
  display: flex !important;
  align-items: center;
  gap: .58rem;
  padding: .62rem .78rem;
  margin: .12rem 0;
  color: #475467;
  text-decoration: none;
  border-radius: .82rem;
  font-size: .95rem;
  line-height: 1.2;
}
.sidebar-link:hover { background: #f3f7ff; color: var(--iv-blue); text-decoration: none; }
.sidebar-link.active { background: #eaf2ff; color: var(--iv-blue); font-weight: 800; box-shadow: inset 3px 0 0 var(--iv-blue); }
.sidebar-icon { width: 1.25rem; min-width: 1.25rem; text-align: center; opacity: .92; }

.app-main {
  margin-left: var(--iv-sidebar-width) !important;
  padding: calc(var(--iv-topbar-height) + 1.4rem) 1.65rem 2.2rem !important;
  min-height: 100vh;
}
.offcanvas .sidebar-inner { padding-top: .5rem; }
.offcanvas .sidebar-heading { padding-left: .95rem; }

.ajax-loading #app-main-content { opacity: .55; transition: opacity .12s ease; }
.ajax-progress-bar {
  position: fixed;
  top: var(--iv-topbar-height);
  left: var(--iv-sidebar-width);
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--iv-blue), #66a3ff);
  transform-origin: left center;
  animation: ivAjaxLoading .8s ease-in-out infinite alternate;
  z-index: 1041;
  display: none;
}
.ajax-loading .ajax-progress-bar { display: block; }
@keyframes ivAjaxLoading { from { transform: scaleX(.22); opacity: .65; } to { transform: scaleX(.85); opacity: 1; } }

.install-log { min-height: 240px; max-height: 360px; overflow: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: .9rem; }
.qr-box { min-height: 220px; display: grid; place-items: center; background: #fff; border: 1px solid #e5e7eb; border-radius: 1rem; padding: 1rem; }
.qr-box canvas, .qr-box img { max-width: 220px; height: auto; }
.format-help { font-size: .9rem; color: #6b7280; }

@media (max-width: 991.98px) {
  .app-main { margin-left: 0 !important; padding: calc(var(--iv-topbar-height) + 1rem) 1rem 1.5rem !important; }
  .ajax-progress-bar { left: 0; }
}

@media (min-width: 992px) {
  .app-sidebar.d-lg-block { display: block !important; }
}

/* v16 refinements */
.card-title { line-height: 1.25; margin-bottom: .65rem; }
.card-title + .text-secondary { margin-top: -.15rem; }
.dashboard-empty-text { margin-top: .25rem; }
#app-main-content > .d-flex:first-child h1 { letter-spacing: -.02em; }
.sidebar-section:empty { display: none; }
.btn + .btn, .btn + form, form + .btn, form + form { margin-left: .25rem; }

.product-image-toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.card-body > form:first-child { margin-top: .25rem; }
.card-body > .table-responsive:first-child { margin-top: .25rem; }

/* v17 modal-based catalog UI */
.table-actions { white-space: nowrap; }
.table-actions .btn, .table-actions form { margin-bottom: .25rem; }
.empty-state { border: 1px dashed #d6deea; border-radius: 1rem; background: #fbfdff; }
.empty-state-icon { width: 3rem; height: 3rem; display: inline-grid; place-items: center; border-radius: 1rem; background: #eaf2ff; color: var(--iv-blue); font-size: 1.35rem; margin-bottom: .75rem; }
.product-image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; }
.product-image-card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--iv-border); border-radius: 1rem; overflow: hidden; box-shadow: 0 .4rem 1rem rgba(15, 23, 42, .04); }
.product-image-preview { display: grid; place-items: center; min-height: 190px; background: linear-gradient(135deg, #f8fbff, #eef4ff); border-bottom: 1px solid var(--iv-border); }
.product-image-preview img { max-width: 100%; max-height: 180px; object-fit: contain; padding: .75rem; }
.product-image-body { padding: 1rem; flex: 1; min-width: 0; }
.product-image-actions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; padding: .8rem 1rem 1rem; border-top: 1px solid var(--iv-border); }
.product-image-actions form { margin: 0; }
.exif-pre { max-height: 460px; overflow: auto; }
.progress-bar.progress-bar-striped { transition: width .2s ease; }
.modal-content { border: 0; border-radius: 1rem; box-shadow: 0 1.25rem 3rem rgba(15, 23, 42, .18); }
.modal-header, .modal-footer { border-color: var(--iv-border); }
.modal-title { letter-spacing: -.015em; }
@media (max-width: 575.98px) {
  .product-image-grid { grid-template-columns: 1fr; }
  .table-actions { white-space: normal; }
}

/* v20 upload and image details refinements */
.product-image-preview {
  width: 100%;
  border: 0;
  padding: 0;
  cursor: zoom-in;
  position: relative;
}
.preview-zoom-badge {
  position: absolute;
  right: .75rem;
  bottom: .75rem;
  background: rgba(15, 23, 42, .78);
  color: #fff;
  border-radius: 999px;
  padding: .35rem .65rem;
  font-size: .78rem;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .15s ease, transform .15s ease;
}
.product-image-preview:hover .preview-zoom-badge { opacity: 1; transform: translateY(0); }
.image-preview-modal-body {
  background: #f8fafc;
  display: grid;
  place-items: center;
  min-height: 55vh;
}
.image-preview-modal-body img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
}
.upload-progress-list { display: grid; gap: .85rem; max-height: 58vh; overflow: auto; padding-right: .2rem; }
.upload-progress-item {
  border: 1px solid var(--iv-border);
  border-radius: .9rem;
  padding: .85rem;
  background: #fff;
}
.upload-progress-item .progress { height: .6rem; border-radius: 999px; }
.upload-file-name { max-width: 520px; }
.details-preview {
  display: grid;
  place-items: center;
  min-height: 240px;
  background: linear-gradient(135deg, #f8fbff, #eef4ff);
  border: 1px solid var(--iv-border);
  border-radius: 1rem;
  padding: 1rem;
}
.details-preview img { max-width: 100%; max-height: 320px; object-fit: contain; }
.image-details-dl dt { color: var(--iv-muted); font-weight: 700; }
.image-details-dl dd { margin-bottom: .55rem; }
.min-w-0 { min-width: 0; }

/* v21 refinements */
.filter-check-menu {
  min-width: min(520px, 90vw);
  max-height: 360px;
  overflow: hidden;
}
.filter-check-list {
  max-height: 260px;
  overflow: auto;
  padding-right: .25rem;
}
.filter-check-list .form-check {
  padding-top: .25rem;
  padding-bottom: .25rem;
}
.d-none-by-brand {
  display: none !important;
}
.upload-progress-list {
  max-height: 440px;
  overflow: auto;
  padding-right: .25rem;
}
.upload-progress-item {
  border: 1px solid var(--bs-border-color);
  border-radius: 1rem;
  padding: .9rem;
  background: #fff;
  margin-bottom: .75rem;
}
