/* Gate Pass Entry — light glassmorphism theme */
:root {
  --gp-bg: #f3f5fa;
  --gp-ink: #1e2433;
  --gp-muted: #6b7489;
  --gp-primary: #4f46e5;
  --gp-primary-600: #4338ca;
  --gp-primary-soft: #eef0ff;
  --gp-teal: #0d9488;
  --gp-teal-soft: #e6f6f4;
  --gp-amber: #b45309;
  --gp-amber-soft: #fff4e5;
  --gp-rose: #be123c;
  --gp-rose-soft: #ffeef2;
  --gp-glass: rgba(255, 255, 255, 0.72);
  --gp-glass-strong: rgba(255, 255, 255, 0.86);
  --gp-glass-border: rgba(255, 255, 255, 0.75);
  --gp-line: #e4e7ef;
  --gp-shadow: 0 1px 2px rgba(30, 36, 51, .04), 0 8px 24px rgba(30, 36, 51, .06);
  --gp-radius: 16px;
  --sidebar-w: 256px;
  --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --bs-body-color: var(--gp-ink);
  --bs-primary: var(--gp-primary);
  --bs-primary-rgb: 79, 70, 229;
  --bs-link-color: var(--gp-primary);
  --bs-link-color-rgb: 79, 70, 229;
  --bs-border-color: var(--gp-line);
}

body { background: var(--gp-bg); color: var(--gp-ink); font-size: .935rem; min-height: 100vh; }

/* soft background colour fields behind the glass */
.bg-blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.bg-blobs span { position: absolute; border-radius: 50%; filter: blur(80px); opacity: .45; }
.bg-blobs span:nth-child(1) { width: 520px; height: 520px; background: #c7d2fe; top: -160px; right: -120px; }
.bg-blobs span:nth-child(2) { width: 460px; height: 460px; background: #ccfbf1; bottom: -180px; left: 120px; }
.bg-blobs span:nth-child(3) { width: 360px; height: 360px; background: #e0e7ff; top: 40%; left: 45%; opacity: .3; }

/* ---------- glass surfaces ---------- */
.glass-card, .card {
  background: var(--gp-glass);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid var(--gp-glass-border);
  border-radius: var(--gp-radius);
  box-shadow: var(--gp-shadow);
}
.card-header { background: transparent; border-bottom: 1px solid var(--gp-line); padding: 1rem 1.25rem; font-weight: 600; }
.card-body { padding: 1.25rem; }
.glass-modal { background: var(--gp-glass-strong); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border: 1px solid var(--gp-glass-border); border-radius: var(--gp-radius); }

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w); z-index: 1040;
  background: rgba(255,255,255,.78); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--gp-line); padding: 1rem .75rem; overflow-y: auto;
  transition: transform .2s ease, width .2s ease;
}
.brand { display: flex; align-items: center; gap: .65rem; padding: .25rem .5rem 1rem; }
.brand-mark { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--gp-primary); color: #fff; font-size: 1.15rem; flex-shrink: 0; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--gp-muted); padding: 1rem .75rem .35rem; font-weight: 600; }
.sidebar .nav-link { display: flex; align-items: center; gap: .7rem; color: #3d4559; border-radius: 10px; padding: .55rem .75rem; font-weight: 500; font-size: .9rem; }
.sidebar .nav-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; color: var(--gp-muted); }
.sidebar .nav-link:hover { background: rgba(79,70,229,.06); color: var(--gp-primary); }
.sidebar .nav-link:hover i { color: var(--gp-primary); }
.sidebar .nav-link.active { background: var(--gp-primary-soft); color: var(--gp-primary-600); font-weight: 600; }
.sidebar .nav-link.active i { color: var(--gp-primary); }
.sidebar .nav-link:focus-visible { outline: 2px solid var(--gp-primary); outline-offset: 1px; }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin .2s ease; }
.main-full { margin-left: 0; }
.content { padding: 1.5rem; flex: 1; max-width: 1500px; width: 100%; }
.app-footer { padding: .75rem 1.5rem 1.25rem; }

/* collapsed (desktop) */
body.sb-collapsed { --sidebar-w: 76px; }
body.sb-collapsed .sidebar .nav-link span, body.sb-collapsed .brand-text, body.sb-collapsed .nav-section { display: none; }
body.sb-collapsed .sidebar .nav-link { justify-content: center; }
body.sb-collapsed .brand { justify-content: center; }

.topbar {
  position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1.5rem; background: rgba(243,245,250,.72); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(228,231,239,.7);
}
.page-title { font-size: 1.15rem; font-weight: 700; margin: 0; }
.btn-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: #fff; border: 1px solid var(--gp-line); }
.btn-user { display: flex; align-items: center; gap: .5rem; background: #fff; border: 1px solid var(--gp-line); border-radius: 999px; padding: .2rem .75rem .2rem .2rem; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--gp-primary-soft); color: var(--gp-primary-600); display: grid; place-items: center; font-weight: 700; font-size: .85rem; }

.sidebar-backdrop { display: none; }
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); --sidebar-w: 256px; width: 256px; }
  body.sb-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.15); }
  body.sb-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(30,36,51,.25); z-index: 1035; }
  .main { margin-left: 0; }
  .content { padding: 1rem; }
  .topbar { padding: .65rem 1rem; }
  body.sb-collapsed .sidebar .nav-link span, body.sb-collapsed .brand-text, body.sb-collapsed .nav-section { display: initial; }
}

/* ---------- forms & buttons ---------- */
.form-control, .form-select { border-radius: 10px; border-color: #dde1ea; background-color: rgba(255,255,255,.9); padding: .5rem .75rem; }
.form-control:focus, .form-select:focus { border-color: #a5b4fc; box-shadow: 0 0 0 .2rem rgba(79,70,229,.15); }
.form-label { font-weight: 600; font-size: .83rem; color: #3d4559; margin-bottom: .3rem; }
.btn { border-radius: 10px; font-weight: 600; }
.btn-primary { --bs-btn-bg: var(--gp-primary); --bs-btn-border-color: var(--gp-primary); --bs-btn-hover-bg: var(--gp-primary-600); --bs-btn-hover-border-color: var(--gp-primary-600); --bs-btn-active-bg: #3730a3; --bs-btn-disabled-bg: #a5b4fc; --bs-btn-disabled-border-color: #a5b4fc; }
.btn-outline-primary { --bs-btn-color: var(--gp-primary); --bs-btn-border-color: #c7d2fe; --bs-btn-hover-bg: var(--gp-primary); --bs-btn-hover-border-color: var(--gp-primary); }
.btn-light { background: #fff; border-color: var(--gp-line); }
.btn-soft { background: var(--gp-primary-soft); color: var(--gp-primary-600); border: 0; }
.btn-soft:hover { background: #e0e4ff; color: var(--gp-primary-600); }
.ts-wrapper .ts-control { border-radius: 10px; border-color: #dde1ea; padding: .5rem .75rem; }
.ts-dropdown { border-radius: 10px; }
.form-check-input:checked { background-color: var(--gp-primary); border-color: var(--gp-primary); }
.req::after { content: " *"; color: var(--gp-rose); }

/* ---------- tables ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table > thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gp-muted); font-weight: 600; border-bottom-width: 1px; white-space: nowrap; background: rgba(248,249,252,.92); }
.table-sticky thead th { position: sticky; top: 0; z-index: 2; }
.table-wrap { max-height: 65vh; overflow: auto; border-radius: 0 0 var(--gp-radius) var(--gp-radius); }
.table td { vertical-align: middle; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: rgba(79,70,229,.035); }
.sort-link { color: inherit; text-decoration: none; }
.sort-link:hover { color: var(--gp-primary); }
.thumb { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; background: #f1f3f8; border: 1px solid var(--gp-line); display: inline-grid; place-items: center; color: #a0a8bb; flex-shrink: 0; }
.thumb-lg { width: 120px; height: 120px; }
.badge-soft.text-bg-success { background: #dcfce7 !important; color: #166534 !important; }
.badge-soft.text-bg-secondary { background: #eef0f4 !important; color: #4b5468 !important; }
.badge-soft.text-bg-danger { background: var(--gp-rose-soft) !important; color: var(--gp-rose) !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; }

.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }
.filter-bar > * { flex: 1 1 160px; }
.filter-bar .filter-actions { flex: 0 0 auto; display: flex; gap: .5rem; }

/* ---------- dashboard ---------- */
.stat { padding: 1.1rem 1.25rem; display: flex; gap: 1rem; align-items: center; height: 100%; }
.stat-icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-value { font-size: 1.55rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: .8rem; color: var(--gp-muted); font-weight: 500; }
.tone-indigo { background: var(--gp-primary-soft); color: var(--gp-primary); }
.tone-teal { background: var(--gp-teal-soft); color: var(--gp-teal); }
.tone-amber { background: var(--gp-amber-soft); color: var(--gp-amber); }
.tone-rose { background: var(--gp-rose-soft); color: var(--gp-rose); }
.shortcut { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; padding: 1rem .5rem; text-decoration: none; color: var(--gp-ink); font-weight: 600; font-size: .85rem; text-align: center; border-radius: 14px; transition: transform .12s ease, background .12s; }
.shortcut i { font-size: 1.4rem; }
.shortcut:hover { background: rgba(255,255,255,.9); transform: translateY(-1px); color: var(--gp-primary); }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--gp-muted); }
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: .5rem; color: #b8bfd0; }

/* ---------- gate pass builder ---------- */
.step-badge { width: 28px; height: 28px; border-radius: 50%; background: var(--gp-primary); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: .85rem; margin-right: .5rem; }
.client-info { background: rgba(238,240,255,.55); border-radius: 12px; padding: .9rem 1rem; }
.client-info dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gp-muted); font-weight: 600; }
.client-info dd { margin-bottom: .4rem; font-weight: 500; }
.product-row { border: 1px solid var(--gp-line); border-radius: 14px; background: rgba(255,255,255,.85); padding: 1rem; }
.product-row + .product-row { margin-top: .75rem; }
.size-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .5rem; }
.size-cell { border: 1px solid var(--gp-line); border-radius: 10px; padding: .4rem .5rem; background: #fff; }
.size-cell label { font-size: .75rem; font-weight: 700; color: var(--gp-muted); display: block; margin-bottom: .15rem; }
.size-cell input { border: 0; padding: 0; font-size: 1.05rem; font-weight: 600; width: 100%; background: transparent; font-variant-numeric: tabular-nums; }
.size-cell input:focus { outline: none; }
.size-cell:focus-within { border-color: #a5b4fc; box-shadow: 0 0 0 .2rem rgba(79,70,229,.12); }
.size-cell.has-qty { background: var(--gp-primary-soft); border-color: #c7d2fe; }
.row-total { font-variant-numeric: tabular-nums; }
.grand-total-bar { position: sticky; bottom: 0; z-index: 5; background: rgba(255,255,255,.9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--gp-line); border-radius: 0 0 var(--gp-radius) var(--gp-radius); }

/* ---------- toasts ---------- */
.app-toast { background: rgba(255,255,255,.95); backdrop-filter: blur(10px); border: 1px solid var(--gp-line); border-left-width: 4px; border-radius: 12px; box-shadow: var(--gp-shadow); }
.toast-success { border-left-color: #16a34a; } .toast-success i.bi { color: #16a34a; }
.toast-danger { border-left-color: var(--gp-rose); } .toast-danger i.bi { color: var(--gp-rose); }
.toast-warning { border-left-color: #d97706; } .toast-warning i.bi { color: #d97706; }
.toast-info { border-left-color: var(--gp-primary); } .toast-info i.bi { color: var(--gp-primary); }

/* ---------- auth pages ---------- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 420px; padding: 2rem; }

/* ---------- permissions grid ---------- */
.perm-module { border: 1px solid var(--gp-line); border-radius: 12px; padding: .85rem 1rem; background: rgba(255,255,255,.7); height: 100%; }
.perm-module h6 { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gp-muted); }

.loading-overlay { position: absolute; inset: 0; background: rgba(255,255,255,.6); display: grid; place-items: center; border-radius: inherit; z-index: 10; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- theme overrides for bootstrap components ---------- */
.nav-pills { --bs-nav-pills-link-active-bg: var(--gp-primary); --bs-nav-link-color: #3d4559; --bs-nav-link-hover-color: var(--gp-primary); }
.nav-pills .nav-link { border-radius: 10px; font-weight: 600; font-size: .88rem; border: 1px solid transparent; }
.nav-pills .nav-link.bg-white { border-color: var(--gp-line); }
.list-group { --bs-list-group-active-bg: var(--gp-primary-soft); --bs-list-group-active-color: var(--gp-primary-600); --bs-list-group-active-border-color: var(--gp-line); }
.page-link { --bs-pagination-color: var(--gp-primary); --bs-pagination-active-bg: var(--gp-primary); --bs-pagination-active-border-color: var(--gp-primary); }
.table a, .card-header a, .stat { text-decoration: none; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }
.min-w-0 { min-width: 0; }

/* ---------- billing status ---------- */
.bstat { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 700; white-space: nowrap; }
.bstat::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.bstat-amber { background: #fff4e5; color: #b45309; }
.bstat-blue  { background: #e8f0ff; color: #1d4ed8; }
.bstat-red   { background: #ffeef2; color: #be123c; }
.bstat-green { background: #dcfce7; color: #166534; }
.bstat-select { border-radius: 999px; font-size: .78rem; font-weight: 700; padding: .25rem 1.9rem .25rem .7rem; border-width: 1px; min-width: 150px; }
.bstat-select.s-pending { background-color: #fff4e5; color: #b45309; border-color: #fcd9a8; }
.bstat-select.s-draft   { background-color: #e8f0ff; color: #1d4ed8; border-color: #c3d4fb; }
.bstat-select.s-issue   { background-color: #ffeef2; color: #be123c; border-color: #fbc5d2; }
.bstat-select.s-done    { background-color: #dcfce7; color: #166534; border-color: #b6ebc8; }
.status-chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.status-chip { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .85rem; border-radius: 12px; background: rgba(255,255,255,.85); border: 1px solid var(--gp-line); text-decoration: none; color: var(--gp-ink); font-weight: 600; font-size: .85rem; }
.status-chip .n { font-variant-numeric: tabular-nums; color: var(--gp-muted); font-weight: 700; }
.status-chip.active { border-color: var(--gp-primary); box-shadow: 0 0 0 .15rem rgba(79,70,229,.15); }
.sp-rate { display: block; font-size: .7rem; color: var(--gp-muted); font-weight: 500; }

/* client price grid (Client Product Mapping) */
.price-grid { display: flex; flex-wrap: wrap; gap: .35rem .5rem; align-items: flex-end; }
.pg-cell { display: flex; flex-direction: column; margin: 0; width: 74px; }
.pg-cell > span { font-size: .72rem; font-weight: 600; color: var(--bs-secondary-color); line-height: 1.2; margin-bottom: 2px; }
.pg-cell .form-control { text-align: right; padding: .2rem .4rem; font-variant-numeric: tabular-nums; }
.pg-fill { font-size: .78rem; align-self: center; margin-top: 14px; }
.price-cell { min-width: 260px; }
.pg-hint { font-size: .75rem; margin-top: 2px; }
/* bill record lines */
.bill-lines td, .bill-lines th { vertical-align: middle; }
.bill-lines .sizes { color: var(--bs-secondary-color); font-size: .85rem; }
.rate-missing { color: #b45309; font-weight: 600; }
