/* =====================================================================
   Naiscorp – theme
   Palette
     Deep violet backgrounds   #2E104E → #4C1D6F, glow #8A2BE2 / #B530BA
     Gradient buttons/accents  #7C4DFF / #803BFF → #E040FB / #EC4899
     Surfaces                  #FFFFFF with soft light-purple shadows
     Icon tiles                #F3E8FF
     Text                      #1E152A (headings), #6B7280 (body/secondary)
   ===================================================================== */

:root {
    --nc-deep-1: #2E104E;
    --nc-deep-2: #4C1D6F;
    --nc-glow-1: #8A2BE2;
    --nc-glow-2: #B530BA;
    --nc-grad-1: #7C4DFF;
    --nc-grad-1b: #803BFF;
    --nc-grad-2: #E040FB;
    --nc-grad-2b: #EC4899;
    --nc-tint: #F3E8FF;
    --nc-ink: #1E152A;
    --nc-muted: #6B7280;
    --nc-line: #ECE6F5;
    --nc-bg: #FAF7FE;

    --nc-gradient: linear-gradient(90deg, var(--nc-grad-1) 0%, var(--nc-grad-1b) 30%, var(--nc-grad-2) 75%, var(--nc-grad-2b) 100%);
    --nc-deep-gradient: linear-gradient(160deg, var(--nc-deep-1) 0%, var(--nc-deep-2) 100%);
    --nc-shadow-sm: 0 2px 8px rgba(124, 77, 255, .08);
    --nc-shadow: 0 10px 30px rgba(124, 77, 255, .12);
    --nc-shadow-lg: 0 20px 50px rgba(76, 29, 111, .18);
    --nc-radius: 16px;
    --nc-sidebar-w: 268px;
    --nc-safe-bottom: env(safe-area-inset-bottom, 0px);

    /* Bootstrap overrides */
    --bs-primary: #7C4DFF;
    --bs-primary-rgb: 124, 77, 255;
    --bs-link-color: #6D3BF5;
    --bs-link-color-rgb: 109, 59, 245;
    --bs-link-hover-color: #B530BA;
    --bs-link-hover-color-rgb: 181, 48, 186;
    --bs-body-color: var(--nc-muted);
    --bs-body-font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --bs-heading-color: var(--nc-ink);
    --bs-border-color: var(--nc-line);
    --bs-border-radius: 10px;
    --bs-border-radius-lg: 14px;
    --bs-focus-ring-color: rgba(124, 77, 255, .3);
}

html { scroll-behavior: smooth; }
body { background: var(--nc-bg); color: var(--nc-muted); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: var(--nc-ink); font-weight: 700; letter-spacing: -.01em; }
strong, b, dt, .fw-semibold { color: var(--nc-ink); }
a { text-decoration-thickness: 1px; text-underline-offset: 2px; }
:focus-visible { outline: 3px solid rgba(124, 77, 255, .45); outline-offset: 2px; }
.min-w-0 { min-width: 0; }

.skip-link { position: absolute; top: 8px; left: 8px; z-index: 2000; background: #fff; padding: 8px 14px; border-radius: 8px; box-shadow: var(--nc-shadow); }

/* ---------- Buttons ---------- */
.btn { font-weight: 600; border-radius: 10px; }
.btn-pill { border-radius: 999px; padding-left: 1.4rem; padding-right: 1.4rem; }
.btn-gradient,
.btn-primary {
    color: #fff; border: 0; background: var(--nc-gradient); background-size: 140% 100%; background-position: 0 0;
    box-shadow: 0 6px 18px rgba(176, 64, 251, .28); transition: background-position .3s ease, box-shadow .2s ease, transform .1s ease;
}
.btn-gradient:hover, .btn-gradient:focus-visible, .btn-primary:hover { color: #fff; background-position: 100% 0; box-shadow: 0 10px 24px rgba(176, 64, 251, .38); }
.btn-gradient:active { transform: translateY(1px); color: #fff; }
.btn-gradient:disabled, .btn-gradient.disabled { color: #fff; opacity: .7; }
.btn-outline-primary { --bs-btn-color: #6D3BF5; --bs-btn-border-color: #C9B5FF; --bs-btn-hover-bg: var(--nc-tint); --bs-btn-hover-color: #5B2BE0; --bs-btn-hover-border-color: #B79CFF; --bs-btn-active-bg: #E9DAFF; --bs-btn-active-color: #5B2BE0; --bs-btn-active-border-color: #B79CFF; }
.btn-light { --bs-btn-bg: #F6F2FC; --bs-btn-border-color: #F6F2FC; --bs-btn-hover-bg: var(--nc-tint); --bs-btn-hover-border-color: var(--nc-tint); color: var(--nc-ink); }
.btn-icon { width: 38px; height: 38px; display: inline-grid; place-items: center; padding: 0; border-radius: 10px; color: var(--nc-ink); border: 0; background: transparent; }
.btn-icon:hover { background: var(--nc-tint); }
.btn-icon.btn-sm { width: 30px; height: 30px; }
.btn .spinner-border { width: 1rem; height: 1rem; border-width: .15em; vertical-align: -2px; }

/* ---------- Forms ---------- */
.form-label { color: var(--nc-ink); font-weight: 600; font-size: .9rem; }
.form-control, .form-select { border-color: #E2DAF0; color: var(--nc-ink); }
.form-control:focus, .form-select:focus { border-color: #A98BFF; box-shadow: 0 0 0 .25rem rgba(124, 77, 255, .15); }
.form-control::placeholder { color: #A8A1B5; }
.form-check-input:checked { background-color: var(--nc-grad-1); border-color: var(--nc-grad-1); }
.form-check-input:focus { box-shadow: 0 0 0 .25rem rgba(124, 77, 255, .2); border-color: #A98BFF; }
.was-validated .form-control:invalid, .form-control.is-invalid,
.was-validated .form-select:invalid, .form-select.is-invalid { border-color: #DC3545; background-color: #FFF8F8; }
.invalid-feedback { font-weight: 500; }
.form-narrow { max-width: 760px; }
.form-actions { display: flex; justify-content: flex-end; gap: .5rem; flex-wrap: wrap; }
.card-footer.form-actions { background: #FCFAFF; border-top: 1px solid var(--nc-line); padding: 1rem 1.5rem; }

.input-icon { position: relative; }
.input-icon .form-control { padding-left: 3.6rem; }
.input-icon-tile { position: absolute; left: 8px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px; border-radius: 10px; background: var(--nc-tint); color: var(--nc-grad-1); display: grid; place-items: center; z-index: 4; }
.input-icon .btn-reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--nc-muted); z-index: 4; }
.input-icon .form-control.is-invalid { background-image: none; }

.segmented { display: inline-flex; background: #F4EFFB; padding: 4px; border-radius: 12px; gap: 4px; }
.segmented .btn { border: 0; color: var(--nc-muted); border-radius: 9px; flex: 1; }
.segmented .btn-check:checked + .btn { background: #fff; color: var(--nc-ink); box-shadow: var(--nc-shadow-sm); }
.segmented .btn-check:focus-visible + .btn { outline: 3px solid rgba(124, 77, 255, .45); }

.divider-text { display: flex; align-items: center; gap: .75rem; color: var(--nc-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.divider-text::before, .divider-text::after { content: ""; flex: 1; height: 1px; background: var(--nc-line); }

/* ---------- Cards & UI bits ---------- */
.card-soft { border: 1px solid var(--nc-line); border-radius: var(--nc-radius); box-shadow: var(--nc-shadow-sm); background: #fff; overflow: hidden; }
.card-header-soft { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--nc-line); }
.icon-tile { width: 44px; height: 44px; border-radius: 12px; background: var(--nc-tint); color: var(--nc-grad-1); display: inline-grid; place-items: center; font-size: 1.25rem; flex-shrink: 0; }
.icon-tile-lg { width: 68px; height: 68px; border-radius: 18px; font-size: 1.9rem; }
.badge-tint { background: var(--nc-tint); color: #6D3BF5; font-weight: 600; }
.badge-status { font-weight: 600; letter-spacing: .01em; }
.text-bg-warning { color: #5C3B00 !important; }

.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--nc-gradient); color: #fff; font-weight: 700; font-size: .8rem; display: inline-grid; place-items: center; flex-shrink: 0; }
.avatar-sm { width: 30px; height: 30px; font-size: .72rem; }
.avatar-xl { width: 84px; height: 84px; font-size: 1.6rem; box-shadow: var(--nc-shadow); }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; }
.page-title { font-size: 1.5rem; margin: 0; display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.page-sub { margin: .25rem 0 0; }

.stat-card { display: flex; flex-direction: column; gap: .35rem; padding: 1.1rem; background: #fff; border: 1px solid var(--nc-line); border-radius: var(--nc-radius); text-decoration: none; height: 100%; box-shadow: var(--nc-shadow-sm); transition: transform .15s ease, box-shadow .15s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--nc-shadow); }
.stat-card.disabled { pointer-events: none; opacity: .7; }
.stat-value { font-size: 1.7rem; font-weight: 800; color: var(--nc-ink); line-height: 1.1; margin-top: .4rem; }
.stat-label { font-size: .82rem; color: var(--nc-muted); }

.welcome-banner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.5rem; border-radius: var(--nc-radius); background: var(--nc-deep-gradient); position: relative; overflow: hidden; box-shadow: var(--nc-shadow); }
.welcome-banner::after { content: ""; position: absolute; width: 320px; height: 320px; right: -80px; top: -140px; background: radial-gradient(circle, rgba(181, 48, 186, .55), transparent 65%); pointer-events: none; }
.welcome-banner > * { position: relative; z-index: 1; }

.progress-thin { height: 8px; background: #F1ECF8; border-radius: 99px; }
.progress-gradient { background: var(--nc-gradient); border-radius: 99px; }

.detail-list { margin: 0; }
.detail-list > div { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: .75rem; padding: .7rem 1.25rem; border-bottom: 1px solid var(--nc-line); }
.detail-list > div:last-child { border-bottom: 0; }
.spec-box { border: 1px solid var(--nc-line); border-radius: 14px; padding: 1rem 1.25rem 1.25rem; background: var(--nc-tint); }
.spec-box legend { font-size: 1rem; }
.detail-list dt { font-weight: 500; color: var(--nc-muted); font-size: .88rem; }
.detail-list dd { margin: 0; color: var(--nc-ink); font-weight: 500; word-break: break-word; }
.detail-list-compact > div { padding: .35rem 0; grid-template-columns: 100px 1fr; }

.empty-state { color: var(--nc-muted); }
.choice-card { display: block; padding: 1.25rem; background: #fff; border: 1px solid var(--nc-line); border-radius: var(--nc-radius); text-decoration: none; box-shadow: var(--nc-shadow-sm); transition: border-color .15s, transform .15s, box-shadow .15s; }
.choice-card:hover { border-color: #C9B5FF; transform: translateY(-2px); box-shadow: var(--nc-shadow); }
.approval-card { transition: box-shadow .15s, transform .15s; }
.approval-card:hover { box-shadow: var(--nc-shadow); transform: translateY(-2px); }
.nav-pills-soft .nav-link { color: var(--nc-muted); font-weight: 600; border-radius: 99px; }
.nav-pills-soft .nav-link.active { background: var(--nc-tint); color: #6D3BF5; }
.filter-bar .form-control, .filter-bar .form-select { background-color: #fff; }

/* Tables */
.table { --bs-table-color: var(--nc-ink); margin: 0; }
.table > thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--nc-muted); font-weight: 600; background: #FCFAFF; border-bottom-color: var(--nc-line); white-space: nowrap; }
.table > :not(caption) > * > * { padding: .85rem 1rem; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: #FBF8FF; }

/* CodeIgniter pager */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.pagination li a, .pagination li span { display: inline-grid; place-items: center; min-width: 38px; height: 38px; padding: 0 .6rem; border-radius: 10px; background: #fff; border: 1px solid var(--nc-line); color: var(--nc-ink); text-decoration: none; font-weight: 600; font-size: .9rem; }
.pagination li.active a, .pagination li.active span { background: var(--nc-gradient); color: #fff; border: 0; }
.pagination li a:hover { background: var(--nc-tint); }

/* Workflow progress & timeline */
.wf-steps { position: relative; }
.wf-step { display: flex; gap: .85rem; padding-bottom: 1.1rem; position: relative; }
.wf-step:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 34px; bottom: 2px; width: 2px; background: var(--nc-line); }
.wf-dot { width: 32px; height: 32px; flex-shrink: 0; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: .85rem; background: #F1ECF8; color: var(--nc-muted); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--nc-line); }
.wf-done .wf-dot { background: #16A34A; color: #fff; box-shadow: none; }
.wf-done:not(:last-child)::before { background: #16A34A; }
.wf-current .wf-dot { background: var(--nc-gradient); color: #fff; box-shadow: 0 0 0 4px rgba(124, 77, 255, .18); }
.decision-box { background: #FCFAFF; }

.timeline { padding: .5rem 1.25rem 1rem; }
.timeline li { display: flex; gap: .75rem; padding: .6rem 0; border-bottom: 1px dashed var(--nc-line); }
.timeline li:last-child { border-bottom: 0; }
.timeline-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: .85rem; }
.timeline-remark { margin: .35rem 0 0; padding: .5rem .75rem; background: #F8F5FD; border-left: 3px solid #C9B5FF; border-radius: 6px; font-size: .85rem; color: var(--nc-ink); }

/* Repeating rows (gate pass items, workflow steps, form fields) */
.repeat-rows { display: flex; flex-direction: column; gap: .75rem; counter-reset: row; }
.repeat-row { border: 1px solid var(--nc-line); border-radius: 12px; padding: .9rem; background: #FDFBFF; counter-increment: row; }
.numbered .step-badge::before { content: counter(row); }
.step-badge { width: 24px; height: 24px; border-radius: 50%; background: var(--nc-gradient); color: #fff; font-size: .75rem; font-weight: 700; display: inline-grid; place-items: center; }
.lookup-results { position: absolute; left: calc(var(--bs-gutter-x) * .5); right: calc(var(--bs-gutter-x) * .5); top: 100%; z-index: 30; max-height: 260px; overflow: auto; }
.lookup-results .list-group-item { cursor: pointer; font-size: .9rem; }
.perm-group-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: #6D3BF5; font-weight: 700; margin-bottom: .6rem; }

/* Alerts */
.alert { border-radius: 12px; border: 0; }
.alert-success { background: #ECFDF3; color: #14532D; }
.alert-danger { background: #FEF2F2; color: #7F1D1D; }
.alert-warning { background: #FFFBEB; color: #713F12; }
.alert-info { background: #F3E8FF; color: #4C1D6F; }
.flash-stack:empty { display: none; }

/* ---------- Loading states ---------- */
.page-loader { position: fixed; inset: 0; z-index: 3000; display: grid; place-items: center; background: rgba(255, 255, 255, .85); backdrop-filter: blur(2px); transition: opacity .25s ease, visibility .25s; }
.page-loader.is-hidden { opacity: 0; visibility: hidden; }
.loader-ring { width: 54px; height: 54px; border-radius: 50%; background: conic-gradient(from 0deg, var(--nc-grad-1), var(--nc-grad-2), transparent 70%); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px)); animation: nc-spin .8s linear infinite; }
.top-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--nc-gradient); z-index: 3001; transition: width .4s ease, opacity .3s; opacity: 0; }
.top-progress.is-active { opacity: 1; width: 70%; transition: width 6s cubic-bezier(.1, .7, .2, 1); }
@keyframes nc-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .loader-ring { animation-duration: 2s; } * { scroll-behavior: auto !important; } }

/* ---------- Cookie banner ---------- */
.cookie-banner { position: fixed; z-index: 2500; left: 1rem; right: 1rem; bottom: calc(1rem + var(--nc-safe-bottom)); max-width: 760px; margin: 0 auto; background: #fff; border: 1px solid var(--nc-line); border-radius: 16px; padding: 1rem 1.25rem; }
.cookie-icon { width: 40px; height: 40px; border-radius: 12px; background: var(--nc-tint); color: var(--nc-grad-1); display: grid; place-items: center; font-size: 1.2rem; }
body.has-bottom-nav .cookie-banner { bottom: calc(84px + var(--nc-safe-bottom)); }
body.has-mobile-cta .cookie-banner { bottom: calc(92px + var(--nc-safe-bottom)); }
@media (min-width: 992px) { body.has-bottom-nav .cookie-banner, body.has-mobile-cta .cookie-banner { bottom: 1.25rem; } }

/* =====================================================================
   Public layout
   ===================================================================== */
.public-header { background: var(--nc-deep-gradient); position: relative; overflow: hidden; color: rgba(255, 255, 255, .8); }
.public-header::before { content: ""; position: absolute; width: 640px; height: 640px; right: -180px; top: -220px; background: radial-gradient(circle, rgba(138, 43, 226, .55), transparent 60%); pointer-events: none; }
.public-header::after { content: ""; position: absolute; width: 520px; height: 520px; left: -200px; bottom: -300px; background: radial-gradient(circle, rgba(181, 48, 186, .45), transparent 60%); pointer-events: none; }
.public-header > * { position: relative; z-index: 1; }
/* Above the hero: its .row gutter (negative top margin) overlaps the bottom of the navbar and blocked clicks there. */
.public-header > .navbar { z-index: 2; }
.public-header .nav-link { color: rgba(255, 255, 255, .8); font-weight: 500; }
.public-header .nav-link:hover, .public-header .nav-link:focus { color: #fff; }
.public-header .navbar-collapse { background: transparent; }
@media (max-width: 991.98px) { .public-header .navbar-collapse { margin-top: .75rem; padding: .75rem; border-radius: 12px; background: rgba(20, 6, 38, .45); } }

.brand { display: inline-flex; align-items: center; gap: .6rem; }
.brand-name { font-weight: 800; font-size: 1.2rem; letter-spacing: -.01em; }
.brand-mark { height: 26px; width: auto; flex-shrink: 0; }
/* On dark backgrounds the mark sits on a white chip so its violet stays readable. */
.brand-light .brand-mark { box-sizing: content-box; padding: 5px 7px; background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); }
.brand-light .brand-name { color: #fff; }
.brand-dark .brand-name { color: var(--nc-ink); }

.hero { color: rgba(255, 255, 255, .8); padding-bottom: 3rem; }
.hero-eyebrow { display: inline-block; padding: .35rem .85rem; border-radius: 99px; background: rgba(255, 255, 255, .1); color: #fff; font-size: .82rem; font-weight: 600; margin-bottom: 1rem; }
.hero-title { color: #fff; font-size: clamp(2rem, 4.5vw, 3.3rem); font-weight: 800; line-height: 1.1; margin-bottom: 1rem; }
.hero-lead { font-size: 1.1rem; max-width: 540px; margin-bottom: 1.75rem; }
.hero-art { filter: drop-shadow(0 30px 50px rgba(10, 0, 30, .45)); }
.page-hero { padding: 2.5rem 0 3rem; }
.page-hero h1 { color: #fff; font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; }

.section { padding-top: 4rem; padding-bottom: 4rem; }
.section-tint { background: linear-gradient(180deg, #F7F1FF, #FDFBFF); }
.section-title { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 800; }
.feature-card, .step-card { background: #fff; border: 1px solid var(--nc-line); border-radius: var(--nc-radius); padding: 1.5rem; box-shadow: var(--nc-shadow-sm); transition: transform .15s, box-shadow .15s; }
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--nc-shadow); }
.step-no { width: 40px; height: 40px; border-radius: 12px; background: var(--nc-gradient); color: #fff; font-weight: 800; display: inline-grid; place-items: center; }
.cta-panel { background: var(--nc-deep-gradient); border-radius: 24px; padding: 3rem 1.5rem; position: relative; overflow: hidden; }
.cta-panel::after { content: ""; position: absolute; inset: auto -60px -160px auto; width: 360px; height: 360px; background: radial-gradient(circle, rgba(224, 64, 251, .45), transparent 65%); }
.cta-panel > * { position: relative; z-index: 1; }

.legal-content { max-width: 820px; }
.legal-content h2 { font-size: 1.2rem; margin-top: 2rem; }
.legal-content p, .legal-content li { line-height: 1.75; }

.status-page { max-width: 560px; }
.error-code { font-size: 5rem; font-weight: 800; line-height: 1; margin: 0 0 .5rem; background: var(--nc-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ref-chip { display: inline-block; padding: 1rem 2rem; border-radius: 16px; background: var(--nc-tint); }

.public-footer { background: #fff; border-top: 1px solid var(--nc-line); }
.public-footer a { color: var(--nc-muted); text-decoration: none; }
.public-footer a:hover { color: var(--nc-grad-1); }

/* Sticky mobile CTA (public pages) */
.mobile-cta { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040; padding: .75rem 1rem calc(.75rem + var(--nc-safe-bottom)); background: rgba(255, 255, 255, .96); backdrop-filter: blur(8px); box-shadow: 0 -8px 24px rgba(76, 29, 111, .12); }
body.has-mobile-cta { padding-bottom: calc(84px + var(--nc-safe-bottom)); }
@media (min-width: 992px) { body.has-mobile-cta { padding-bottom: 0; } }

/* =====================================================================
   Auth layout (split screen)
   ===================================================================== */
.auth-shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1fr; background: #fff; }
.auth-brand { position: relative; overflow: hidden; background: var(--nc-deep-gradient); color: #fff; padding: 1.25rem 1.5rem; }
.auth-waves { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-glow { position: absolute; width: 520px; height: 520px; right: -160px; top: 20%; background: radial-gradient(circle, rgba(181, 48, 186, .65), rgba(138, 43, 226, .3) 40%, transparent 70%); filter: blur(10px); pointer-events: none; }
.auth-brand-inner { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: space-between; height: 100%; gap: 2rem; }
.auth-title { color: #fff; font-size: clamp(2.2rem, 3.5vw, 3rem); font-weight: 800; margin-bottom: .5rem; }
.auth-lead { color: rgba(255, 255, 255, .75); font-size: 1.1rem; max-width: 420px; }
.auth-points li { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; color: rgba(255, 255, 255, .9); }
.auth-point-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: rgba(255, 255, 255, .12); color: #fff; }
.auth-main { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 2rem 1.25rem; background: #fff; }
.auth-card { width: 100%; max-width: 440px; padding: 2rem 1.5rem; border-radius: 20px; background: #fff; box-shadow: 0 20px 60px rgba(124, 77, 255, .14), 0 2px 6px rgba(124, 77, 255, .06); }
.auth-heading { color: var(--nc-ink); font-size: 1.6rem; font-weight: 800; margin-bottom: .4rem; }
.auth-legal { margin-top: 1.5rem; }
.auth-legal a { color: var(--nc-muted); }
@media (min-width: 992px) {
    .auth-shell { grid-template-columns: minmax(420px, 46%) 1fr; }
    .auth-brand { padding: 3rem; }
    .auth-card { padding: 2.75rem; }
}

/* =====================================================================
   App layout (sidebar + topbar + bottom nav)
   ===================================================================== */
.app-shell { min-height: 100vh; }
.app-sidebar { background: var(--nc-deep-gradient); color: rgba(255, 255, 255, .75); width: var(--nc-sidebar-w); display: flex; flex-direction: column; }
.app-sidebar.offcanvas-lg { --bs-offcanvas-width: var(--nc-sidebar-w); --bs-offcanvas-bg: transparent; }
.sidebar-head { padding: 1.25rem 1.25rem 1rem; }
/* The menu still scrolls (wheel, touch, keyboard) on short screens, without a visible scrollbar. */
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0 .75rem 1rem; scrollbar-width: none; -ms-overflow-style: none; }
.sidebar-nav::-webkit-scrollbar { display: none; }
.sidebar-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: rgba(255, 255, 255, .45); padding: .75rem .75rem .3rem; font-weight: 700; }
.sidebar-link { display: flex; align-items: center; gap: .75rem; padding: .5rem .75rem; border-radius: 10px; color: rgba(255, 255, 255, .8); text-decoration: none; font-weight: 500; font-size: .92rem; }
.sidebar-link i { font-size: 1.1rem; width: 20px; text-align: center; }
.sidebar-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.sidebar-link.active { background: var(--nc-gradient); color: #fff; box-shadow: 0 6px 18px rgba(224, 64, 251, .3); }
.sidebar-foot { padding: 1rem 1.5rem calc(1rem + var(--nc-safe-bottom)); border-top: 1px solid rgba(255, 255, 255, .08); }
.sidebar-foot a { color: rgba(255, 255, 255, .55); text-decoration: none; }

@media (max-width: 991.98px) {
    .app-sidebar.offcanvas-lg { background: var(--nc-deep-gradient); }
}
@media (min-width: 992px) {
    .app-sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 1030; }
    .app-main { margin-left: var(--nc-sidebar-w); }
}

.app-topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem; padding: .75rem 1.25rem; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--nc-line); min-height: 64px; }
.topbar-title { font-weight: 700; color: var(--nc-ink); }
.btn-user { display: inline-flex; align-items: center; gap: .5rem; border: 0; background: transparent; color: var(--nc-ink); font-weight: 600; }
.btn-user:hover, .btn-user:focus { background: var(--nc-tint); }
.app-content { padding: 1.5rem 1rem 2rem; max-width: 1400px; margin: 0 auto; }
@media (min-width: 768px) { .app-content { padding: 2rem 2rem 3rem; } }

/* Sticky bottom nav (mobile) */
body.has-bottom-nav { padding-bottom: calc(76px + var(--nc-safe-bottom)); }
@media (min-width: 992px) { body.has-bottom-nav { padding-bottom: 0; } }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1040; display: grid; grid-template-columns: repeat(5, 1fr); align-items: end; background: #fff; border-top: 1px solid var(--nc-line); box-shadow: 0 -8px 24px rgba(76, 29, 111, .1); padding: .35rem .25rem calc(.35rem + var(--nc-safe-bottom)); }
.bottom-nav > a, .bottom-nav > button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: .35rem 0; font-size: .7rem; font-weight: 600; color: var(--nc-muted); text-decoration: none; background: none; border: 0; }
.bottom-nav > a i, .bottom-nav > button i { font-size: 1.3rem; }
.bottom-nav > a.active { color: var(--nc-grad-1); }
.bottom-nav-cta { display: flex; justify-content: center; text-decoration: none; }
.cta-fab { width: 58px; height: 58px; border-radius: 50%; border: 4px solid #fff; background: var(--nc-gradient); color: #fff; font-size: 1.6rem; display: grid; place-items: center; margin-top: -26px; box-shadow: 0 10px 24px rgba(176, 64, 251, .45); }
.bottom-nav-cta { position: relative; }
.bottom-nav-cta .dropdown-menu-center { position: absolute; left: 50%; right: auto; top: auto; bottom: calc(100% + 10px); transform: translateX(-50%); min-width: 200px; }

/* Mobile table → stacked cards */
@media (max-width: 767.98px) {
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { padding: .75rem 1rem; border-bottom: 1px solid var(--nc-line); }
    .table-stack td { border: 0 !important; padding: .2rem 0 !important; display: flex; justify-content: space-between; gap: 1rem; text-align: right; }
    .table-stack td[data-label]::before { content: attr(data-label); font-weight: 600; color: var(--nc-muted); text-align: left; font-size: .8rem; }
    .table-stack td:not([data-label]) { justify-content: flex-end; padding-top: .5rem !important; }
    .table-stack td > div, .table-stack td > a { text-align: right; }
    .page-head .btn { flex: 1 1 auto; }
    .page-title { font-size: 1.3rem; }
}

/* =====================================================================
   Gate scanner
   ===================================================================== */
.scanner-page { max-width: 640px; }
.scan-input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .05em; text-transform: uppercase; }
.camera-box video, .camera-box #cameraFallback video { width: 100%; border-radius: 12px; background: #000; max-height: 60vh; object-fit: cover; }
.camera-frame { position: absolute; inset: 22% 12%; border: 3px solid rgba(255, 255, 255, .85); border-radius: 14px; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .25); pointer-events: none; }
.scan-result { border-radius: 18px; overflow: hidden; box-shadow: var(--nc-shadow-lg); background: #fff; animation: nc-pop .25s ease; }
.scan-result-head { display: flex; align-items: center; gap: 1rem; padding: 1.25rem; color: #fff; }
.scan-result-head > i { font-size: 2.6rem; }
.scan-result-title { font-size: 1.5rem; font-weight: 800; letter-spacing: .02em; }
.scan-result-msg { opacity: .92; }
.scan-result.is-ok .scan-result-head { background: linear-gradient(135deg, #16A34A, #22C55E); }
.scan-result.is-bad .scan-result-head { background: linear-gradient(135deg, #DC2626, #EF4444); }
.scan-result.is-warn .scan-result-head { background: linear-gradient(135deg, #D97706, #F59E0B); }
.scan-result.is-info .scan-result-head { background: var(--nc-deep-gradient); }
.scan-result-body { padding: 1rem 1.25rem; }
.scan-result-actions { padding: 0 1.25rem 1.25rem; display: grid; gap: .5rem; }
.scan-result-actions:empty { display: none; }
@keyframes nc-pop { from { transform: scale(.97); opacity: 0; } to { transform: none; opacity: 1; } }

/* =====================================================================
   Print
   ===================================================================== */
@media print {
    .app-sidebar, .app-topbar, .bottom-nav, .mobile-cta, .cookie-banner, .page-loader, .btn, form { display: none !important; }
    .app-main { margin: 0 !important; }
    body { background: #fff; padding: 0 !important; }
}

/* Compact cookie banner on phones */
@media (max-width: 575.98px) {
    .cookie-banner { left: .5rem; right: .5rem; padding: .75rem .9rem; border-radius: 14px; }
    .cookie-banner .cookie-icon { display: none; }
    .cookie-banner p { font-size: .8rem; }
    .cookie-banner .d-flex.gap-2 { width: 100%; }
    .cookie-banner .d-flex.gap-2 .btn { flex: 1; }
    .auth-card { box-shadow: none; padding: 1.25rem .25rem; }
    .auth-main { padding-top: 1.25rem; }
}

/* =====================================================================
   Inventory monitoring
   ===================================================================== */
.icon-tile-sm { width: 30px; height: 30px; border-radius: 9px; font-size: .95rem; }
.stat-card.stat-success .icon-tile { background: #DCFCE7; color: #15803D; }
.stat-card.stat-primary .icon-tile { background: var(--nc-tint); color: var(--nc-grad-1); }
.stat-card.stat-info .icon-tile { background: #E0F2FE; color: #0369A1; }
.stat-card.stat-danger .icon-tile { background: #FEE2E2; color: #B91C1C; }
.stat-card.stat-warning .icon-tile { background: #FEF3C7; color: #B45309; }

.inv-table tfoot td { background: #FCFAFF; border-top: 2px solid var(--nc-line); }
.inv-count { display: inline-grid; place-items: center; min-width: 34px; height: 28px; padding: 0 .5rem; border-radius: 99px; font-weight: 700; text-decoration: none; }
.inv-success { background: #DCFCE7; color: #15803D; }
.inv-primary { background: var(--nc-tint); color: #5B2BE0; }
.inv-info { background: #E0F2FE; color: #0369A1; }
.inv-danger { background: #FEE2E2; color: #B91C1C; }
.inv-warning { background: #FEF3C7; color: #B45309; }
.inv-count:hover { filter: brightness(.95); }

.holder-box { display: flex; gap: .75rem; align-items: flex-start; padding: .85rem; border-radius: 12px; background: #FBF8FF; border: 1px solid var(--nc-line); }
.tag-preview { padding: .6rem .8rem; border-radius: 10px; background: var(--nc-tint); color: var(--nc-ink); font-size: .9rem; word-break: break-word; }

.asset-timeline { padding: .5rem 1.25rem 1rem; position: relative; }
.asset-timeline li { display: flex; gap: .85rem; padding: .85rem 0; position: relative; }
.asset-timeline li:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 2.6rem; bottom: -.4rem; width: 2px; background: var(--nc-line); }
.asset-timeline .timeline-icon { position: relative; z-index: 1; }

/* Role permission grid */
.perm-grid th[scope="row"] { color: var(--nc-ink); white-space: nowrap; }
.perm-grid td { min-width: 180px; }
.perm-check { display: inline-flex; align-items: center; gap: .35rem; margin: .15rem 1rem .15rem 0; padding-left: 0; }
.perm-check .form-check-input { margin: 0; float: none; }
.perm-check .form-check-label { font-size: .88rem; color: var(--nc-ink); }
.perm-chip { display: inline-block; font-size: .85rem; margin-right: 1rem; }
@media (max-width: 767.98px) {
    .perm-grid thead { display: none; }
    .perm-grid, .perm-grid tbody, .perm-grid tr, .perm-grid th, .perm-grid td { display: block; width: 100%; }
    .perm-grid tr { padding: .75rem 1rem; border-bottom: 1px solid var(--nc-line); }
    .perm-grid th, .perm-grid td { border: 0 !important; padding: .25rem 0 !important; }
    .perm-grid td::before { content: attr(data-label); display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--nc-muted); font-weight: 700; }
}
.inv-table thead th { white-space: normal; vertical-align: bottom; }

/* ------------------------------------------------------------------
 * E-signatures
 * ------------------------------------------------------------------ */
.sig-canvas {
    display: block;
    width: 100%;
    max-width: 600px;
    aspect-ratio: 3 / 1;
    background: #fff repeating-linear-gradient(to bottom, transparent 0, transparent 74%, #E9DDFB 74%, #E9DDFB 75%, transparent 75%);
    border: 1.5px dashed #C4B5FD;
    border-radius: .75rem;
    touch-action: none;
    cursor: crosshair;
}
.sig-preview {
    display: block;
    max-width: 260px;
    max-height: 90px;
    padding: .5rem;
    background: #fff;
    border: 1px solid #EDE9FE;
    border-radius: .5rem;
    margin-bottom: .35rem;
}
.sig-thumb { max-width: 140px; max-height: 44px; background: #fff; }
.nav-sm .nav-link.active { background: linear-gradient(90deg, #7C4DFF, #E040FB); }
.settings-tabs .nav-link { color: #4C1D6F; }
.settings-tabs .nav-link.active { background: #F3E8FF; color: #2E104E; font-weight: 600; }

/* ------------------------------------------------------------------
 * Document template editor (Word-like page)
 * ------------------------------------------------------------------ */
.doc-toolbar-host { position: sticky; top: 0; z-index: 20; min-height: 96px; background: #fff; border-bottom: 1px solid #EDE9FE; }
.doc-toolbar-host::before { content: "Click the header, body or footer to show the formatting toolbar."; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #9CA3AF; font-size: .85rem; pointer-events: none; }
.doc-toolbar-host .tox-tinymce-inline { position: relative; z-index: 1; background: #fff; }
.doc-workspace { background: #ECEAF1; border-radius: 0 0 .75rem .75rem; padding: 0 1rem 2rem 2.75rem; overflow: auto; max-height: 78vh; }
.doc-ruler-h { position: sticky; top: 0; z-index: 5; height: 22px; margin: 0 auto; background: #fff; border-bottom: 1px solid #D1D5DB; user-select: none; }
.doc-ruler-v { position: absolute; left: -26px; top: 0; width: 20px; background: #fff; border-right: 1px solid #D1D5DB; user-select: none; }
.doc-ruler-h .doc-ruler-margin, .doc-ruler-v .doc-ruler-margin { position: absolute; background: #E5E7EB; }
.doc-ruler-tick { position: absolute; background: #9CA3AF; }
.doc-ruler-num { position: absolute; font-size: 9px; color: #6B7280; transform: translateX(-50%); line-height: 1; }
.doc-ruler-v .doc-ruler-num { transform: translateY(-50%); left: 2px; }
.doc-handle { position: absolute; width: 11px; height: 11px; background: #7C4DFF; border: 2px solid #fff; border-radius: 2px; box-shadow: 0 0 0 1px #7C4DFF; cursor: ew-resize; z-index: 2; }
.doc-ruler-h .doc-handle { top: 5px; margin-left: -5.5px; }
.doc-ruler-v .doc-handle { left: 4px; margin-top: -5.5px; cursor: ns-resize; }
.doc-page-wrap { position: relative; margin: 1.25rem auto 0; }
.doc-page { position: relative; background: #fff; box-shadow: 0 2px 12px rgba(46, 16, 78, .18); color: #000; font-family: "DejaVu Sans", Arial, sans-serif; line-height: 1.35; }
.doc-region { position: relative; outline: none; }
.doc-region:hover, .doc-region.mce-edit-focus { outline: 1px dashed #A78BFA !important; outline-offset: 0; }
.doc-region-label { position: absolute; right: 4px; font-size: 10px; color: #7C4DFF; background: #F3E8FF; padding: 0 6px; border-radius: 4px; pointer-events: none; z-index: 3; }
.doc-region-header .doc-region-label { bottom: 2px; }
.doc-region-footer .doc-region-label { top: 2px; }
.doc-region-header { border-bottom: 1px dashed #DDD6FE; }
.doc-region-footer { position: absolute; left: 0; right: 0; bottom: 0; border-top: 1px dashed #DDD6FE; }
.doc-page img { max-width: 100%; }
.doc-page table { border-collapse: collapse; }
.doc-token { background: #F3E8FF; color: #4C1D6F; border-radius: 3px; }
.doc-fields { max-height: 60vh; overflow: auto; }
.doc-fields code { color: #7C4DFF; cursor: pointer; }

/* Staging / test copy banner (APP_STAGE). Everything fixed or sticky moves down by its height. */
.stage-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 2050; height: 26px; display: flex; align-items: center; justify-content: center; gap: .4rem; background: repeating-linear-gradient(-45deg, #F59E0B 0 14px, #FBBF24 14px 28px); color: #1F1300; font-size: .78rem; letter-spacing: .02em; box-shadow: 0 1px 4px rgba(0, 0, 0, .2); }
body.is-staging { padding-top: 26px; }
body.is-staging .app-topbar, body.is-staging .doc-toolbar-host { top: 26px; }
body.is-staging .offcanvas, body.is-staging .offcanvas-lg { top: 26px; }
@media (min-width: 992px) { body.is-staging .app-sidebar { top: 26px; } }
@media print { .stage-banner { display: none; } body.is-staging { padding-top: 0; } }

/* =====================================================================
   Kinect side (body.side-kinect) – corporate blue
     Primary   #123B68   Secondary #1685C5   Accent #39A9D6
     Surface   #F3F6F9   Background #FFFFFF  Text   #263746
   ===================================================================== */
body.side-kinect {
    --nc-deep-1: #0D2C4F;
    --nc-deep-2: #123B68;
    --nc-glow-1: #1685C5;
    --nc-glow-2: #39A9D6;
    --nc-grad-1: #123B68;
    --nc-grad-1b: #1A5A91;
    --nc-grad-2: #1685C5;
    --nc-grad-2b: #39A9D6;
    --nc-tint: #E3F1FA;
    --nc-ink: #263746;
    --nc-muted: #5B6B7A;
    --nc-line: #DDE6EE;
    --nc-bg: #F3F6F9;
    --nc-shadow-sm: 0 2px 8px rgba(18, 59, 104, .08);
    --nc-shadow: 0 10px 30px rgba(18, 59, 104, .12);
    --nc-shadow-lg: 0 20px 50px rgba(13, 44, 79, .2);
    /* Re-declared: :root builds these from the colours above once, so they would stay purple otherwise. */
    --nc-gradient: linear-gradient(90deg, var(--nc-grad-1) 0%, var(--nc-grad-1b) 30%, var(--nc-grad-2) 75%, var(--nc-grad-2b) 100%);
    --nc-deep-gradient: linear-gradient(160deg, var(--nc-deep-1) 0%, var(--nc-deep-2) 100%);

    --bs-primary: #1685C5;
    --bs-primary-rgb: 22, 133, 197;
    --bs-link-color: #1685C5;
    --bs-link-color-rgb: 22, 133, 197;
    --bs-link-hover-color: #123B68;
    --bs-link-hover-color-rgb: 18, 59, 104;
    --bs-focus-ring-color: rgba(22, 133, 197, .3);
}
body.side-kinect :focus-visible { outline-color: rgba(22, 133, 197, .5); }
body.side-kinect .form-control:focus, body.side-kinect .form-select:focus { border-color: #39A9D6; box-shadow: 0 0 0 .25rem rgba(22, 133, 197, .15); }
body.side-kinect .form-check-input:focus { border-color: #39A9D6; box-shadow: 0 0 0 .25rem rgba(22, 133, 197, .2); }
body.side-kinect .form-check-input:checked { background-color: #1685C5; border-color: #1685C5; }
body.side-kinect .btn-outline-primary { --bs-btn-color: #1685C5; --bs-btn-border-color: #9FD0EC; --bs-btn-hover-color: #123B68; --bs-btn-active-color: #123B68; }
body.side-kinect .choice-card:hover { border-color: #9FD0EC; }
body.side-kinect .timeline-remark { background: #F3F8FC; border-left-color: #9FD0EC; }
body.side-kinect .wf-current .wf-dot { box-shadow: 0 0 0 4px rgba(22, 133, 197, .18); }
body.side-kinect .alert-info { background: #E3F1FA; color: #123B68; }
body.side-kinect .settings-tabs .nav-link { color: #123B68; }
body.side-kinect .settings-tabs .nav-link.active { background: #E3F1FA; color: #0D2C4F; }
body.side-kinect .nav-sm .nav-link.active { background: linear-gradient(90deg, #123B68, #1685C5); }
body.side-kinect .doc-token { background: #E3F1FA; color: #123B68; }
body.side-kinect .welcome-banner::after { background: radial-gradient(circle, rgba(57, 169, 214, .45), transparent 65%); }
/* Kinect landing page and sign-in screen */
body.side-kinect .public-header::before { background: radial-gradient(circle, rgba(22, 133, 197, .55), transparent 60%); }
body.side-kinect .public-header::after { background: radial-gradient(circle, rgba(57, 169, 214, .4), transparent 60%); }
body.side-kinect .cta-panel::after { background: radial-gradient(circle, rgba(57, 169, 214, .45), transparent 65%); }
body.side-kinect .section-tint { background: linear-gradient(180deg, #EEF6FC, #F9FCFE); }
body.side-kinect .auth-glow { background: radial-gradient(circle, rgba(22, 133, 197, .65), rgba(57, 169, 214, .3) 40%, transparent 70%); }
body.side-kinect .auth-card { box-shadow: 0 20px 60px rgba(18, 59, 104, .14), 0 2px 6px rgba(18, 59, 104, .06); }
body.side-kinect .hero-art { filter: drop-shadow(0 30px 50px rgba(0, 20, 40, .45)); }
/* Button and active-item glows (purple in the Naiscorp theme) */
body.side-kinect .btn-gradient, body.side-kinect .btn-primary { box-shadow: 0 6px 18px rgba(22, 133, 197, .28); }
body.side-kinect .btn-gradient:hover, body.side-kinect .btn-gradient:focus-visible, body.side-kinect .btn-primary:hover { box-shadow: 0 10px 24px rgba(22, 133, 197, .38); }
body.side-kinect .sidebar-link.active { box-shadow: 0 6px 18px rgba(22, 133, 197, .3); }
body.side-kinect .cta-fab { box-shadow: 0 10px 24px rgba(22, 133, 197, .45); }

/* Kinect logo (white lettering: used on dark backgrounds only) */
.brand-kinect .brand-logo { height: 34px; width: auto; display: block; }

/* Super admin side switcher (top bar) */
.side-switch { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--nc-tint); border: 1px solid var(--nc-line); }
.side-switch-btn { border: 0; background: transparent; color: var(--nc-ink); font-size: .82rem; font-weight: 600; padding: .3rem .85rem; border-radius: 999px; cursor: pointer; }
.side-switch-btn:hover:not(.active) { background: rgba(255, 255, 255, .7); }
.side-switch-btn.active { color: #fff; cursor: default; opacity: 1; }
.side-switch-naiscorp.active { background: linear-gradient(90deg, #7C4DFF, #E040FB); }
.side-switch-kinect.active { background: linear-gradient(90deg, #123B68, #1685C5); }
@media (max-width: 575.98px) { .side-switch-btn { padding: .3rem .6rem; font-size: .75rem; } }
