/* NEXGEN CRM - brand theme on Bootstrap 5.3 */
:root {
  --nx-navy: #1c3f94;
  --nx-navy-dark: #132c6b;
  --nx-orange: #f47b20;
  --nx-orange-dark: #d9650e;
  --nx-green: #7cb342;
  --nx-bg: #f3f5fa;
  --sidebar-w: 250px;
  --topbar-h: 60px;
  --bs-primary: #1c3f94;
  --bs-primary-rgb: 28, 63, 148;
  --bs-link-color: #1c3f94;
  --bs-link-color-rgb: 28, 63, 148;
  --bs-link-hover-color: #f47b20;
}
body { background: var(--nx-bg); font-size: .925rem; }
.btn-primary { --bs-btn-bg: var(--nx-navy); --bs-btn-border-color: var(--nx-navy); --bs-btn-hover-bg: var(--nx-navy-dark); --bs-btn-hover-border-color: var(--nx-navy-dark); --bs-btn-active-bg: var(--nx-navy-dark); --bs-btn-disabled-bg: var(--nx-navy); --bs-btn-disabled-border-color: var(--nx-navy); }
.btn-brand { --bs-btn-color: #fff; --bs-btn-bg: var(--nx-orange); --bs-btn-border-color: var(--nx-orange); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--nx-orange-dark); --bs-btn-hover-border-color: var(--nx-orange-dark); --bs-btn-active-bg: var(--nx-orange-dark); --bs-btn-active-color:#fff; --bs-btn-disabled-bg: var(--nx-orange); --bs-btn-disabled-color:#fff; }
.btn-outline-primary { --bs-btn-color: var(--nx-navy); --bs-btn-border-color: var(--nx-navy); --bs-btn-hover-bg: var(--nx-navy); --bs-btn-hover-border-color: var(--nx-navy); --bs-btn-active-bg: var(--nx-navy); }
.text-brand { color: var(--nx-orange) !important; }
.text-navy { color: var(--nx-navy) !important; }
.bg-navy { background: var(--nx-navy) !important; }
.form-control:focus, .form-select:focus { border-color: #8fa5d9; box-shadow: 0 0 0 .2rem rgba(28,63,148,.15); }
.form-check-input:checked { background-color: var(--nx-navy); border-color: var(--nx-navy); }
.nav-pills .nav-link.active { background: var(--nx-navy); }
.page-link { color: var(--nx-navy); }
.active > .page-link { background: var(--nx-navy); border-color: var(--nx-navy); }

/* Topbar + sidebar */
.app-topbar { height: var(--topbar-h); z-index: 1040; }
.brand-logo { height: 40px; width: auto; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--nx-orange); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.app-sidebar { background: #fff; }
@media (min-width: 992px) {
  .app-sidebar { position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w); border-right: 1px solid #e3e7ef; overflow-y: auto; }
  .app-main { margin-left: var(--sidebar-w); }
}
.app-main { padding-top: var(--topbar-h); min-height: 100vh; }
@media (max-width: 991.98px) { .app-main { padding-bottom: 76px; } .app-sidebar { --bs-offcanvas-width: 280px; } }
.menu-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #8a93a6; padding: .9rem 1.25rem .3rem; font-weight: 600; }
.menu-link { display: flex; align-items: center; gap: .75rem; padding: .55rem 1.25rem; color: #2b3445; text-decoration: none; border-left: 3px solid transparent; }
.menu-link i { font-size: 1.05rem; color: #6b7487; }
.menu-link:hover { background: #f4f6fb; color: var(--nx-navy); }
.menu-link.active { background: #eef2fb; color: var(--nx-navy); border-left-color: var(--nx-orange); font-weight: 600; }
.menu-link.active i { color: var(--nx-orange); }

/* Bottom nav (mobile app feel) */
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; background: #fff; border-top: 1px solid #e3e7ef; display: flex; padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { flex: 1; text-align: center; padding: .45rem 0 .4rem; color: #6b7487; text-decoration: none; font-size: .7rem; }
.bottom-nav a i { display: block; font-size: 1.3rem; line-height: 1.2; }
.bottom-nav a.active { color: var(--nx-orange); }

/* Cards & tables */
.card { border: 0; box-shadow: 0 1px 3px rgba(16,24,40,.06), 0 1px 2px rgba(16,24,40,.04); border-radius: .75rem; }
.card-header { background: #fff; border-bottom: 1px solid #eef0f5; font-weight: 600; border-radius: .75rem .75rem 0 0 !important; }
.page-head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.35rem; margin: 0; font-weight: 700; color: #1d2433; }
.table > :not(caption) > * > * { padding: .6rem .65rem; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: #6b7487; background: #f8f9fc; white-space: nowrap; }
.stat-card { border-left: 4px solid var(--nx-navy); }
.stat-card.orange { border-left-color: var(--nx-orange); }
.stat-card.green { border-left-color: var(--nx-green); }
.stat-card.red { border-left-color: #dc3545; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; color: #1d2433; line-height: 1.1; }
.stat-card .stat-label { color: #6b7487; font-size: .8rem; }
.stat-card .stat-icon { font-size: 1.8rem; opacity: .25; }
.filter-bar .form-control, .filter-bar .form-select { min-width: 140px; }
.media-thumb img { aspect-ratio: 1/1; object-fit: cover; width: 100%; }
.dl-grid { display: grid; grid-template-columns: 150px 1fr; gap: .35rem .75rem; }
.dl-grid dt { color: #6b7487; font-weight: 500; }
.dl-grid dd { margin: 0; }
@media (max-width: 575.98px) { .dl-grid { grid-template-columns: 1fr; } .dl-grid dt { margin-top: .4rem; } }

/* Mobile list cards (replace wide tables on phones) */
.m-card { background: #fff; border-radius: .75rem; padding: .85rem 1rem; margin-bottom: .6rem; box-shadow: 0 1px 2px rgba(16,24,40,.06); display: block; color: inherit; text-decoration: none; }
.m-card:hover { color: inherit; background: #fbfcfe; }

/* Field app */
.field-hero { background: linear-gradient(135deg, var(--nx-navy), #2f5bc4); color: #fff; border-radius: .9rem; }
.step-list { list-style: none; padding: 0; margin: 0; }
.step-list li { display: flex; align-items: center; gap: .6rem; padding: .4rem 0; color: #8a93a6; }
.step-list li .dot { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #cfd5e2; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; flex-shrink: 0; background: #fff; }
.step-list li.done { color: #1d2433; }
.step-list li.done .dot { background: var(--nx-green); border-color: var(--nx-green); color: #fff; }
.step-list li.current { color: var(--nx-orange); font-weight: 600; }
.step-list li.current .dot { border-color: var(--nx-orange); color: var(--nx-orange); }
.action-btn { padding: 1rem; font-size: 1.1rem; font-weight: 600; border-radius: .75rem; }
.selfie-preview { width: 100%; max-height: 260px; object-fit: cover; border-radius: .5rem; display: none; }

/* Calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid #e3e7ef; border-left: 1px solid #e3e7ef; }
.cal-grid .cal-h { background: #f8f9fc; font-size: .75rem; text-transform: uppercase; color: #6b7487; text-align: center; padding: .4rem; border-right: 1px solid #e3e7ef; border-bottom: 1px solid #e3e7ef; font-weight: 600; }
.cal-grid .cal-d { min-height: 110px; border-right: 1px solid #e3e7ef; border-bottom: 1px solid #e3e7ef; padding: .3rem; background: #fff; }
.cal-grid .cal-d.other { background: #fafbfd; color: #b5bccb; }
.cal-grid .cal-d.today { background: #fff7ef; }
.cal-grid .cal-d .num { font-size: .8rem; font-weight: 600; }
.cal-ev { display: block; font-size: .72rem; padding: .15rem .35rem; border-radius: .3rem; margin-top: .2rem; text-decoration: none; color: #fff; background: var(--nx-navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev.s-Completed, .cal-ev.s-Closed { background: var(--nx-green); }
.cal-ev.s-Travel-Started, .cal-ev.s-On-Site, .cal-ev.s-Work-Started { background: var(--nx-orange); }
.cal-ev.s-On-Hold, .cal-ev.s-Cancelled { background: #6c757d; }
.cal-ev.s-Draft, .cal-ev.s-Ready-for-Allocation { background: #8fa5d9; }
.cal-ev.p-Urgent { box-shadow: inset 3px 0 0 #dc3545; }
@media (max-width: 767.98px) { .cal-grid .cal-d { min-height: 64px; } .cal-ev { font-size: 0; height: 6px; padding: 0; margin-top: 3px; } }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, #eef2fb 0%, #fff 55%, #fff4ea 100%); padding: 1rem; }
.login-card { width: 100%; max-width: 410px; }

/* PWA install banner */
.pwa-install { position: fixed; left: 12px; right: 12px; bottom: 84px; z-index: 1050; background: #fff; border-radius: .75rem; padding: .7rem .8rem; display: flex; align-items: center; gap: .7rem; }
@media (min-width: 992px) { .pwa-install { left: auto; width: 360px; bottom: 20px; } }

.timeline { list-style: none; padding-left: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 .9rem 1.4rem; border-left: 2px solid #e3e7ef; margin-left: .4rem; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--nx-orange); }
.timeline li:last-child { border-left-color: transparent; }
.required::after { content: " *"; color: #dc3545; }
