/* =====================================================================
   REZZAG Stock — UI theme
   Identity tokens come from Settings (white-label) as --rz-* variables.
   ===================================================================== */
:root {
  --rz-sidebar-w: 268px;
  --rz-topbar-h: 64px;
  --rz-muted: #6b7280;
  --rz-soft: #eff4ff;
  --rz-card-radius: calc(var(--rz-radius) + 4px);
  --rz-shadow: 0 1px 2px rgba(11, 18, 32, .04), 0 4px 16px rgba(11, 18, 32, .04);
  --bs-body-font-family: var(--rz-font);
  --bs-body-color: var(--rz-text);
  --bs-body-bg: var(--rz-bg);
  --bs-border-color: var(--rz-border);
  --bs-secondary-color: var(--rz-muted);
  --bs-focus-ring-color: rgba(var(--rz-primary-rgb), .2);
}

html, body { font-family: var(--rz-font); }
body {
  background:
    radial-gradient(700px 420px at 85% -10%, rgba(var(--rz-primary-rgb), .08), transparent 70%),
    radial-gradient(600px 400px at 0% 0%, rgba(var(--rz-primary-rgb), .05), transparent 70%),
    var(--rz-bg);
  background-attachment: fixed;
  color: var(--rz-text);
  font-size: .925rem;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--rz-ink); font-weight: 700; letter-spacing: -.01em; }
a { color: var(--rz-primary); text-decoration: none; }
a:hover { color: var(--rz-primary-dark); }
.text-muted, .text-secondary { color: var(--rz-muted) !important; }
.text-primary { color: var(--rz-primary) !important; }
.bg-soft { background: var(--rz-soft) !important; }
.fw-semibold { font-weight: 600 !important; }
.ltr { direction: ltr; unicode-bidi: embed; }
[dir=rtl] .ltr-num { direction: ltr; display: inline-block; }

/* ---------- Buttons (REZZAG style: 12px radius, solid blue) ---------- */
.btn { border-radius: var(--rz-radius); font-weight: 600; padding: .5rem 1rem; }
.btn-sm { border-radius: calc(var(--rz-radius) - 3px); padding: .3rem .7rem; font-size: .82rem; }
.btn-primary { --bs-btn-bg: var(--rz-primary); --bs-btn-border-color: var(--rz-primary); --bs-btn-hover-bg: var(--rz-primary-dark); --bs-btn-hover-border-color: var(--rz-primary-dark); --bs-btn-active-bg: var(--rz-primary-dark); --bs-btn-active-border-color: var(--rz-primary-dark); --bs-btn-disabled-bg: var(--rz-primary); --bs-btn-disabled-border-color: var(--rz-primary); box-shadow: 0 6px 16px rgba(var(--rz-primary-rgb), .22); }
.btn-outline-primary { --bs-btn-color: var(--rz-primary); --bs-btn-border-color: var(--rz-primary); --bs-btn-hover-bg: var(--rz-primary); --bs-btn-hover-border-color: var(--rz-primary); --bs-btn-active-bg: var(--rz-primary); }
.btn-soft { background: var(--rz-soft); color: var(--rz-primary); border: 1px solid transparent; }
.btn-soft:hover { background: rgba(var(--rz-primary-rgb), .14); color: var(--rz-primary-dark); }
.btn-light { background: #fff; border: 1px solid var(--rz-border); color: var(--rz-text); }
.btn-light:hover { background: #f3f4f6; border-color: #d1d5db; }
.btn-icon { width: 38px; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--rz-radius); background: transparent; border: 0; }
.btn-icon:hover { background: var(--rz-soft); color: var(--rz-primary); }

/* ---------- Forms ---------- */
.form-control, .form-select { border-radius: calc(var(--rz-radius) - 2px); border-color: var(--rz-border); padding: .55rem .8rem; background-color: #fff; }
.form-control:focus, .form-select:focus { border-color: var(--rz-primary); box-shadow: 0 0 0 .2rem rgba(var(--rz-primary-rgb), .15); }
.form-label { font-weight: 600; font-size: .83rem; color: var(--rz-ink); margin-bottom: .35rem; }
.form-check-input:checked { background-color: var(--rz-primary); border-color: var(--rz-primary); }
.input-group-text { background: #f8fafc; border-color: var(--rz-border); }

/* ---------- Layout ---------- */
.rz-sidebar {
  position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--rz-sidebar-w); z-index: 1040;
  background: #fff; border-inline-end: 1px solid var(--rz-border); display: flex; flex-direction: column;
  transition: transform .25s ease;
}
.rz-brand { display: flex; align-items: center; gap: .75rem; padding: 1.1rem 1.25rem; color: var(--rz-ink); border-bottom: 1px solid var(--rz-border); min-height: var(--rz-topbar-h); }
.rz-brand:hover { color: var(--rz-ink); }
.rz-brand-mark { width: 42px; height: 42px; object-fit: contain; flex-shrink: 0; }
.rz-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.rz-brand-text strong { font-size: 1.02rem; font-weight: 700; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rz-brand-text small { font-size: .72rem; color: var(--rz-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rz-nav { flex: 1; overflow-y: auto; padding: .75rem .75rem 1rem; scrollbar-width: thin; }
.rz-nav-group { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: #9ca3af; padding: 1rem .75rem .4rem; }
[dir=rtl] .rz-nav-group { letter-spacing: 0; font-size: .75rem; }
.rz-nav-link { display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; margin: 1px 0; border-radius: 10px; color: #374151; font-weight: 500; }
.rz-nav-link i { font-size: 1.05rem; color: #6b7280; width: 1.2rem; text-align: center; }
.rz-nav-link:hover { background: #f3f6fd; color: var(--rz-primary); }
.rz-nav-link:hover i { color: var(--rz-primary); }
.rz-nav-link.active { background: var(--rz-soft); color: var(--rz-primary); font-weight: 600; }
.rz-nav-link.active i { color: var(--rz-primary); }
.rz-powered { padding: .8rem 1.25rem; border-top: 1px solid var(--rz-border); font-size: .74rem; color: var(--rz-muted); }
.rz-powered a { font-weight: 700; letter-spacing: .03em; }

.rz-main { min-height: 100vh; display: flex; flex-direction: column; }
.has-sidebar .rz-main { margin-inline-start: var(--rz-sidebar-w); }
.rz-topbar {
  position: sticky; top: 0; z-index: 1030; height: var(--rz-topbar-h); display: flex; align-items: center; gap: 1rem;
  padding: 0 1.5rem; background: rgba(255, 255, 255, .86); backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid var(--rz-border);
}
.rz-search { position: relative; flex: 1; max-width: 520px; }
.rz-search i { position: absolute; top: 50%; inset-inline-start: .85rem; transform: translateY(-50%); color: #9ca3af; }
.rz-search .form-control { padding-inline-start: 2.4rem; background: #f8fafc; border-color: transparent; }
.rz-search .form-control:focus { background: #fff; }
.rz-lang { display: inline-flex; background: #f3f4f6; border-radius: 10px; padding: 3px; gap: 2px; }
.rz-lang a { padding: .2rem .55rem; border-radius: 8px; font-size: .75rem; font-weight: 700; color: #4b5563; }
.rz-lang a.active { background: #fff; color: var(--rz-primary); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.rz-user { display: flex; align-items: center; gap: .6rem; border: 0; padding: .3rem .5rem; }
.rz-user:hover { background: #f3f4f6; }
.rz-user strong { display: block; font-size: .85rem; line-height: 1.1; color: var(--rz-ink); }
.rz-user small { display: block; font-size: .72rem; color: var(--rz-muted); font-weight: 400; }
.rz-avatar { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--rz-primary); color: #fff; font-weight: 700; }
.rz-content { flex: 1; padding: 1.5rem; max-width: 1600px; width: 100%; }
.rz-footer { padding: 1rem 1.5rem; font-size: .78rem; color: var(--rz-muted); }
.rz-backdrop { display: none; }

@media (max-width: 991.98px) {
  .rz-sidebar { transform: translateX(-100%); }
  [dir=rtl] .rz-sidebar { transform: translateX(100%); }
  body.sidebar-open .rz-sidebar { transform: none; box-shadow: 0 10px 40px rgba(0,0,0,.15); }
  body.sidebar-open .rz-backdrop { display: block; position: fixed; inset: 0; background: rgba(11,18,32,.35); z-index: 1035; }
  .has-sidebar .rz-main { margin-inline-start: 0; }
  .rz-content { padding: 1rem; }
  .rz-topbar { padding: 0 1rem; }
}

/* ---------- Page header ---------- */
.rz-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.rz-page-head h1 { font-size: 1.5rem; margin: 0; }
.rz-page-head .rz-sub { color: var(--rz-muted); margin: .25rem 0 0; font-size: .9rem; }
.rz-breadcrumb { font-size: .8rem; color: var(--rz-muted); margin-bottom: .3rem; }
.rz-breadcrumb a { color: var(--rz-muted); }
.rz-breadcrumb a:hover { color: var(--rz-primary); }

/* ---------- Cards ---------- */
.card { border: 1px solid var(--rz-border); border-radius: var(--rz-card-radius); box-shadow: var(--rz-shadow); background: #fff; }
.card-header { background: transparent; border-bottom: 1px solid var(--rz-border); padding: .9rem 1.15rem; font-weight: 700; color: var(--rz-ink); display: flex; align-items: center; gap: .5rem; }
.card-header:first-child { border-radius: var(--rz-card-radius) var(--rz-card-radius) 0 0; }
.card-body { padding: 1.15rem; }
.card-footer { background: #fafbfc; border-top: 1px solid var(--rz-border); }

.rz-kpi .min-w-0, .min-w-0 { min-width: 0; }
.rz-kpi { display: flex; gap: .9rem; align-items: center; padding: 1.1rem 1.15rem; height: 100%; }
.rz-kpi .rz-kpi-icon { width: 46px; height: 46px; border-radius: 13px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.rz-kpi .rz-kpi-label { font-size: .78rem; color: var(--rz-muted); font-weight: 500; }
.rz-kpi .rz-kpi-value { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: clamp(1.1rem, 1.6vw, 1.45rem); font-weight: 700; color: var(--rz-ink); line-height: 1.2; }
.rz-kpi .rz-kpi-note { font-size: .74rem; color: var(--rz-muted); }
.tone-primary { background: var(--rz-soft); color: var(--rz-primary); }
.tone-success { background: #e8f5ec; color: var(--rz-success); }
.tone-warning { background: #fef6e7; color: #b7791f; }
.tone-danger  { background: #fdecea; color: var(--rz-danger); }
.tone-ink     { background: #eef0f4; color: var(--rz-ink); }
a.card-link-wrap { color: inherit; display: block; height: 100%; }
a.card-link-wrap:hover .card { border-color: rgba(var(--rz-primary-rgb), .4); }

.chart-box { position: relative; height: 290px; }
.chart-box.sm { height: 230px; }

/* ---------- Tables / DataTables ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; vertical-align: middle; }
.table > thead th { font-size: .74rem; font-weight: 700; color: var(--rz-muted); text-transform: uppercase; letter-spacing: .04em; background: #f9fafb; border-bottom: 1px solid var(--rz-border); white-space: nowrap; padding: .7rem .75rem; }
[dir=rtl] .table > thead th { letter-spacing: 0; font-size: .8rem; }
.table > tbody td { padding: .65rem .75rem; border-color: #f1f3f5; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #f8faff; }
div.dt-container { font-size: .875rem; }
div.dt-container .dt-search input, div.dt-container .dt-length select { border-radius: 10px; }
div.dt-container .dt-paging .page-link { border-radius: 9px !important; margin: 0 2px; border: 0; color: var(--rz-text); }
div.dt-container .dt-paging .page-item.active .page-link { background: var(--rz-primary); color: #fff; }
div.dt-processing > div:last-child > div { background: var(--rz-primary) !important; }
.dt-container .row:first-child { margin-bottom: .5rem; }
table.dataTable > tbody > tr.selected > * { box-shadow: inset 0 0 0 9999px rgba(var(--rz-primary-rgb), .08); color: inherit; }
.table-card .card-body { padding: .5rem 1rem 1rem; }
.rz-thumb { width: 38px; height: 38px; border-radius: 10px; object-fit: cover; background: #f3f4f6; display: inline-flex; align-items: center; justify-content: center; color: #9ca3af; flex-shrink: 0; }
.rz-item-cell { display: flex; align-items: center; gap: .65rem; min-width: 220px; }
.rz-item-cell .t { font-weight: 600; color: var(--rz-ink); }
.rz-item-cell .s { font-size: .76rem; color: var(--rz-muted); }

/* ---------- Badges ---------- */
.badge { font-weight: 600; padding: .38em .7em; }
.text-bg-primary { background-color: var(--rz-primary) !important; }
.text-bg-soft { background: var(--rz-soft); color: var(--rz-primary); }
.rz-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #f3f4f6; color: #374151; }
.rz-chip .dot { width: 8px; height: 8px; border-radius: 50%; }
.rz-core { white-space: nowrap; display: inline-block; vertical-align: middle; font-size: .66rem; padding: .15rem .45rem; border-radius: 6px; background: var(--rz-ink); color: #fff; font-weight: 700; letter-spacing: .03em; }

/* ---------- Tabs / pills ---------- */
.nav-pills .nav-link { border-radius: 10px; color: #4b5563; font-weight: 600; }
.nav-pills .nav-link.active { background: var(--rz-soft); color: var(--rz-primary); }
.nav-tabs { border-color: var(--rz-border); }
.nav-tabs .nav-link { color: #4b5563; font-weight: 600; border: 0; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link.active { color: var(--rz-primary); border-bottom-color: var(--rz-primary); background: transparent; }

/* ---------- GHS pictograms ---------- */
.ghs-grid { display: flex; flex-wrap: wrap; gap: .5rem; }
.ghs-pick { position: relative; cursor: pointer; text-align: center; width: 84px; }
.ghs-pick input { position: absolute; opacity: 0; }
.ghs-pick img { width: 60px; height: 60px; padding: 4px; border-radius: 12px; border: 2px solid var(--rz-border); background: #fff; transition: all .15s; filter: grayscale(.85) opacity(.55); }
.ghs-pick span { display: block; font-size: .68rem; line-height: 1.15; margin-top: .25rem; color: var(--rz-muted); }
.ghs-pick input:checked + img { border-color: var(--rz-danger); filter: none; box-shadow: 0 4px 12px rgba(184, 33, 5, .18); }
.ghs-pick input:focus-visible + img { outline: 3px solid rgba(var(--rz-primary-rgb), .4); }
.ghs-icons img { width: 44px; height: 44px; }
.signal-danger { color: #fff; background: var(--rz-danger); }
.signal-warning { color: #3b2400; background: var(--rz-warning); }

/* ---------- Category cards ---------- */
.rz-cat-icon { width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; color: #fff; flex-shrink: 0; }

/* ---------- Detail lists ---------- */
.rz-dl { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: .5rem 1rem; margin: 0; }
.rz-dl dt { color: var(--rz-muted); font-weight: 500; font-size: .83rem; }
.rz-dl dd { margin: 0; font-weight: 500; color: var(--rz-ink); word-break: break-word; }
.rz-stat { padding: .8rem 1rem; border-radius: var(--rz-radius); background: #f8fafc; border: 1px solid var(--rz-border); }
.rz-stat .v { white-space: nowrap; font-size: 1.1rem; font-weight: 700; color: var(--rz-ink); }
.rz-stat .l { font-size: .76rem; color: var(--rz-muted); }
.rz-photo { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: var(--rz-card-radius); background: #f8fafc; border: 1px solid var(--rz-border); }
.rz-photo-empty { display: flex; align-items: center; justify-content: center; font-size: 3rem; color: #cbd5e1; }

/* ---------- Alerts / empty states ---------- */
.rz-alert { border-radius: var(--rz-radius); border: 0; box-shadow: var(--rz-shadow); }
.alert-success { background: #e8f5ec; color: #0f4d24; }
.alert-danger { background: #fdecea; color: #7f1704; }
.alert-warning { background: #fef6e7; color: #6b4400; }
.alert-info { background: var(--rz-soft); color: #1e3a8a; }
.rz-empty { text-align: center; padding: 2.5rem 1rem; color: var(--rz-muted); }
.rz-empty i { font-size: 2.4rem; color: #cbd5e1; display: block; margin-bottom: .5rem; }

.rz-list-item { display: flex; align-items: center; gap: .75rem; padding: .65rem 0; border-bottom: 1px solid #f1f3f5; }
.rz-list-item:last-child { border-bottom: 0; }

/* ---------- Login ---------- */
.guest .rz-content { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; max-width: none; }
.rz-login { width: 100%; max-width: 980px; display: grid; grid-template-columns: 1.05fr 1fr; background: #fff; border-radius: 24px; overflow: hidden; box-shadow: 0 30px 80px rgba(11, 18, 32, .12); border: 1px solid var(--rz-border); }
.rz-login-side { background: linear-gradient(150deg, var(--rz-primary) 0%, var(--rz-primary-dark) 55%, var(--rz-ink) 100%); color: #fff; padding: 2.75rem; position: relative; overflow: hidden; display: flex; flex-direction: column; }
.rz-login-side::after { content: ''; position: absolute; width: 420px; height: 420px; border-radius: 50%; border: 46px dashed rgba(255,255,255,.08); inset-inline-end: -140px; bottom: -150px; }
.rz-login-side h2 { color: #fff; font-size: 1.85rem; line-height: 1.3; margin: 2rem 0 1rem; }
.rz-login-side p { color: rgba(255,255,255,.82); }
.rz-login-side ul { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.rz-login-side li { display: flex; gap: .6rem; align-items: center; margin-bottom: .65rem; color: rgba(255,255,255,.9); }
.rz-login-form { padding: 2.75rem; }
@media (max-width: 767.98px) { .rz-login { grid-template-columns: 1fr; } .rz-login-side { display: none; } .rz-login-form { padding: 2rem 1.5rem; } }

/* ---------- Misc ---------- */
.select-sm { max-width: 220px; }
.rz-filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.rz-filters .form-select, .rz-filters .form-control { width: auto; min-width: 170px; padding-block: .4rem; }
.color-input { width: 56px; padding: .25rem; height: 40px; }
.progress { height: 6px; border-radius: 6px; background: #eef0f4; }
.progress-bar { background: var(--rz-primary); }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { position: relative; padding-inline-start: 1.5rem; padding-bottom: 1rem; }
.timeline li::before { content: ''; position: absolute; inset-inline-start: 5px; top: 6px; bottom: -6px; width: 2px; background: var(--rz-border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ''; position: absolute; inset-inline-start: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--rz-primary); }
.kbd-hint { font-size: .72rem; color: var(--rz-muted); }
@media print { .rz-sidebar, .rz-topbar, .rz-footer, .btn, .dt-search, .dt-length, .dt-paging { display: none !important; } .has-sidebar .rz-main { margin: 0; } }

/* ---------- Notifications ---------- */
.rz-bell-badge { position: absolute; top: 2px; inset-inline-end: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--rz-danger); color: #fff; font-size: .66rem; font-weight: 700; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px #fff; }
.rz-notif { width: 380px; max-width: calc(100vw - 24px); border-radius: 16px; border: 1px solid var(--rz-border); overflow: hidden; }
.rz-notif-top { display: flex; justify-content: space-between; align-items: center; padding: .8rem 1rem; border-bottom: 1px solid var(--rz-border); }
.rz-notif-body { max-height: 70vh; overflow-y: auto; }
.rz-notif-sec { padding: .5rem 0; border-bottom: 1px solid #f1f3f5; }
.rz-notif-sec:last-child { border-bottom: 0; }
.rz-notif-head { display: flex; align-items: center; gap: .5rem; padding: .25rem 1rem .4rem; font-weight: 700; font-size: .82rem; color: var(--rz-ink); }
.rz-notif-head .rz-kpi-icon { width: 26px; height: 26px; border-radius: 8px; font-size: .85rem; display: inline-flex; align-items: center; justify-content: center; }
.rz-notif-item { display: block; padding: .4rem 1rem .4rem calc(1rem + 34px); color: var(--rz-text); }
.rz-notif-item:hover { background: #f8faff; color: var(--rz-text); }
.rz-notif-item .t { display: block; font-weight: 600; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rz-notif-item .s { display: block; font-size: .74rem; color: var(--rz-muted); }
.rz-notif-more { display: block; padding: .2rem 1rem .3rem calc(1rem + 34px); font-size: .76rem; font-weight: 600; }
@media (max-width: 575.98px) { .rz-lang { display: none; } }

/* bulk actions */
.rz-bulk { background: rgba(var(--rz-primary-rgb), .06); border: 1px solid rgba(var(--rz-primary-rgb), .25); border-radius: 12px; padding: .5rem .75rem; margin-bottom: .75rem; position: sticky; top: 72px; z-index: 5; }
.rz-bulk-field:not(.d-none) { display: flex; gap: .5rem; flex-wrap: wrap; }
.rz-bulk-field .form-control, .rz-bulk-field .form-select { min-width: 180px; }
table .rz-bulk-check, table .rz-bulk-all { cursor: pointer; }
