/* Newton Group Inventory Portal */
:root {
  --ng-navy: #0f2a4a;
  --ng-navy-2: #16365c;
  --ng-teal: #0d9e9e;
  --ng-teal-soft: #e6f6f6;
  --ng-bg: #f4f6fa;
  --ng-border: #e3e8ef;
  --ng-text: #1e293b;
  --ng-muted: #64748b;
  --bs-primary: #0f2a4a;
  --bs-primary-rgb: 15, 42, 74;
  --bs-link-color: #0b7d7d;
  --bs-link-hover-color: #075f5f;
  --bs-body-font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: var(--ng-text);
  --bs-border-color: var(--ng-border);
  --sidebar-w: 252px;
}
body { background: var(--ng-bg); font-size: .925rem; }
.btn-primary { --bs-btn-bg: var(--ng-navy); --bs-btn-border-color: var(--ng-navy); --bs-btn-hover-bg: var(--ng-navy-2); --bs-btn-hover-border-color: var(--ng-navy-2); --bs-btn-active-bg: #0a1f38; --bs-btn-disabled-bg: var(--ng-navy); }
.btn-teal { --bs-btn-color: #fff; --bs-btn-bg: var(--ng-teal); --bs-btn-border-color: var(--ng-teal); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #0a8585; --bs-btn-hover-border-color: #0a8585; --bs-btn-active-bg: #087373; --bs-btn-active-color:#fff; }
.text-bg-primary { background-color: var(--ng-navy) !important; }
.form-control:focus, .form-select:focus { border-color: #5fc4c4; box-shadow: 0 0 0 .2rem rgba(13,158,158,.18); }
a { text-decoration: none; }

/* shell */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--ng-navy) !important; color: #cbd5e1; display: flex; flex-direction: column; }
@media (min-width: 992px) { .sidebar { position: sticky; top: 0; height: 100vh; flex-shrink: 0; } }
@media (max-width: 991.98px) { .sidebar.offcanvas-lg { --bs-offcanvas-width: 270px; background: var(--ng-navy); } }
.sidebar-brand { display: flex; align-items: center; gap: .7rem; padding: 1.15rem 1.15rem 1rem; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand-name { color: #fff; font-weight: 700; letter-spacing: .01em; line-height: 1.1; }
.brand-sub { color: #7dd3d3; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.sidebar-nav { padding: .6rem .6rem 1rem; overflow-y: auto; flex: 1; }
.sidebar-nav a { display: flex; align-items: center; gap: .7rem; color: #cbd5e1; padding: .55rem .75rem; border-radius: .5rem; margin-bottom: 2px; font-size: .9rem; }
.sidebar-nav a i { font-size: 1.05rem; opacity: .85; width: 1.1rem; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: rgba(13,158,158,.18); color: #fff; box-shadow: inset 3px 0 0 var(--ng-teal); }
.nav-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #6b84a3; padding: 1rem .75rem .35rem; }
.sidebar-foot { font-size: .72rem; color: #6b84a3; padding: .75rem 1.15rem; border-top: 1px solid rgba(255,255,255,.07); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem; background: rgba(255,255,255,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--ng-border); padding: .55rem 1.25rem; }
.btn-icon { font-size: 1.4rem; padding: .1rem .4rem; border: 0; }
.scope-chip { display: inline-flex; align-items: center; gap: .45rem; background: var(--ng-teal-soft); color: #0a6f6f; border-radius: 999px; padding: .3rem .8rem; font-size: .8rem; font-weight: 600; }
.user-btn { display: flex; align-items: center; gap: .6rem; border: 0; padding: .25rem .4rem; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--ng-navy); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }
.content { padding: 1.5rem; max-width: 1500px; width: 100%; }
@media (max-width: 575.98px) { .content { padding: 1rem .75rem; } .kpi .kpi-value { font-size: 1.3rem; } .kpi .kpi-icon { width: 32px; height: 32px; font-size: 1rem; } .page-header h1 { font-size: 1.25rem; } }

/* headers */
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.45rem; font-weight: 700; margin: 0; color: var(--ng-navy); }
.page-sub { color: var(--ng-muted); margin: .25rem 0 0; }
.crumb { font-size: .8rem; color: var(--ng-muted); margin-bottom: .2rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }

/* cards */
.card { border: 1px solid var(--ng-border); border-radius: .85rem; box-shadow: 0 1px 2px rgba(15,42,74,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--ng-border); padding: .85rem 1.1rem; font-weight: 600; border-radius: .85rem .85rem 0 0 !important; display:flex; align-items:center; gap:.5rem; }
.card-body { padding: 1.1rem; }
.kpi { position: relative; padding: 1.05rem 1.1rem; height: 100%; }
.kpi .kpi-label { color: var(--ng-muted); font-size: .8rem; font-weight: 500; }
.kpi .kpi-value { font-size: 1.65rem; font-weight: 700; color: var(--ng-navy); line-height: 1.2; margin-top: .2rem; }
.kpi .kpi-foot { font-size: .78rem; color: var(--ng-muted); margin-top: .2rem; }
.kpi .kpi-icon { position: absolute; right: 1rem; top: 1rem; width: 40px; height: 40px; border-radius: .7rem; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.ic-navy { background: #e8eef6; color: var(--ng-navy); } .ic-teal { background: var(--ng-teal-soft); color: #0a7f7f; }
.ic-amber { background: #fff4e0; color: #b45309; } .ic-red { background: #fde8e8; color: #b91c1c; } .ic-violet { background:#efeafd; color:#5b3fc4; }
a.kpi-link { color: inherit; display: block; height: 100%; } a.kpi-link:hover .card { border-color: #9fd9d9; }

/* tables */
.table-card .table { margin: 0; }
.table > :not(caption) > * > * { padding: .6rem .75rem; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ng-muted); font-weight: 600; background: #f8fafc; border-bottom-width: 1px; white-space: nowrap; }
.table tbody td { vertical-align: middle; }
.table-hover tbody tr:hover { --bs-table-hover-bg: #f6fbfb; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82rem; background: #f1f5f9; padding: .1rem .4rem; border-radius: .3rem; color: #334155; white-space: nowrap; }
.qty-pill { display: inline-block; min-width: 2.6rem; text-align: center; font-weight: 600; border-radius: .4rem; padding: .1rem .45rem; }
.qty-ok { background: #e7f6ee; color: #166534; } .qty-low { background: #fff4e0; color: #9a5b05; } .qty-out { background: #fde8e8; color: #b91c1c; }

/* filters */
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .85rem 1.1rem; border-bottom: 1px solid var(--ng-border); background: #fff; border-radius: .85rem .85rem 0 0; }
.filter-bar .form-control, .filter-bar .form-select { width: auto; min-width: 150px; }
.filter-bar .search { min-width: 220px; flex: 1 1 220px; max-width: 360px; }
@media (max-width: 575.98px) { .filter-bar .form-control, .filter-bar .form-select { flex: 1 1 100%; max-width: none; } }

/* status tabs */
.nav-pills-sm .nav-link { padding: .35rem .8rem; font-size: .85rem; color: var(--ng-muted); border-radius: 999px; }
.nav-pills-sm .nav-link.active { background: var(--ng-navy); color: #fff; }

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

.form-label { font-weight: 500; font-size: .85rem; color: #334155; }
.form-text { font-size: .78rem; }
.required::after { content: " *"; color: #dc2626; }
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ng-muted); font-weight: 600; margin: 1.25rem 0 .6rem; }

.alert-bar { display: flex; align-items: center; gap: .75rem; padding: .7rem .9rem; border-radius: .6rem; background: #fff; border: 1px solid var(--ng-border); margin-bottom: .5rem; }
.alert-bar .dot { width: .6rem; height: .6rem; border-radius: 50%; flex-shrink: 0; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.4rem; border-left: 2px solid var(--ng-border); margin-left: .4rem; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--ng-teal); border: 2px solid #fff; }
.timeline li:last-child { border-left-color: transparent; }

/* auth */
.auth-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(1200px 600px at 10% -10%, #1d4677 0%, transparent 60%), linear-gradient(160deg, #0f2a4a 0%, #0b2240 55%, #0b3b4a 100%); padding: 1rem; }
.auth-card { width: 100%; max-width: 410px; background: #fff; border-radius: 1rem; box-shadow: 0 20px 60px rgba(0,0,0,.35); overflow: hidden; }
.auth-head { padding: 1.7rem 1.8rem 1rem; text-align: center; }
.auth-head h1 { font-size: 1.25rem; font-weight: 700; color: var(--ng-navy); margin: .75rem 0 .2rem; }
.auth-body .auth-form { padding: .5rem 1.8rem 1.8rem; }
.auth-flash { position: fixed; top: 1rem; left: 50%; transform: translateX(-50%); z-index: 10; min-width: 300px; }
.error-page { text-align: center; padding: 4rem 1rem; max-width: 520px; margin: 0 auto; }
.error-code { font-size: 4.5rem; font-weight: 800; color: #cbd5e1; line-height: 1; }

.chart-wrap { position: relative; height: 280px; }
.line-row td { vertical-align: top; }
.small-muted { font-size: .8rem; color: var(--ng-muted); }
@media print { .sidebar, .topbar, .page-actions, .filter-bar, .no-print { display: none !important; } .content { padding: 0; } }
