/* ============================================================
   STOCKIFY – Main Stylesheet  (v4)
   Full mobile-first responsive design
   ============================================================ */

/* ---------- Google Font (loaded in header) ---------- */
:root {
   --sidebar-w: 260px;
   --top-h: 60px;
   --brand: #0f4c81;
   --brand-light: #1a6bbf;
   --accent: #f59e0b;
   --accent-light: #fbbf24;
   --success: #10b981;
   --danger: #ef4444;
   --warning: #f97316;
   --info: #3b82f6;
   --purple: #8b5cf6;
   --teal: #14b8a6;
   --bg: #f0f4f8;
   --surface: #ffffff;
   --surface2: #f8fafc;
   --border: #e2e8f0;
   --text: #0f172a;
   --text-muted: #64748b;
   --text-light: #94a3b8;
   --placeholder: #94a3b8;
   --sb-bg: #0a2d4f;
   --sb-text: #cbd5e1;
   --sb-active: rgba(245, 158, 11, 0.15);
   --sb-hover: rgba(255, 255, 255, 0.07);
   --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
   --shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
   --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.14);
   --radius: 12px;
   --radius-sm: 8px;
   --radius-xs: 6px;
}

/* Dark mode */
body.dark-mode {
   --bg: #0f172a;
   --surface: #1e293b;
   --surface2: #162032;
   --border: #334155;
   --text: #f1f5f9;
   --text-muted: #94a3b8;
   --text-light: #64748b;
   --placeholder: #64748b;
   --sb-bg: #0b1a2e;
   --shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* Base */
*,
*::before,
*::after {
   box-sizing: border-box;
}

html,
body {
   margin: 0;
   padding: 0;
   font-family: 'Plus Jakarta Sans', sans-serif;
   background: var(--bg);
   color: var(--text);
   font-size: 14px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
   font-family: 'Plus Jakarta Sans', sans-serif;
   font-weight: 800;
}

a {
   color: var(--brand-light);
   text-decoration: none;
}

img {
   max-width: 100%;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
   position: fixed;
   top: 0;
   left: 0;
   width: var(--sidebar-w);
   height: 100vh;
   background: var(--sb-bg);
   display: flex;
   flex-direction: column;
   z-index: 1000;
   overflow-y: auto;
   overflow-x: hidden;
   transition: transform 0.3s cubic-bezier(.4, 0, .2, 1);
}

.sidebar::-webkit-scrollbar {
   width: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
   background: rgba(255, 255, 255, 0.15);
   border-radius: 4px;
}

.sidebar-brand {
   display: flex;
   align-items: center;
   gap: 12px;
   padding: 18px 18px 14px;
   border-bottom: 1px solid rgba(255, 255, 255, 0.08);
   flex-shrink: 0;
}

.brand-icon {
   width: 38px;
   height: 38px;
   background: var(--accent);
   border-radius: 10px;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 18px;
   color: #fff;
   flex-shrink: 0;
}

.brand-name {
   font-size: 17px;
   font-weight: 800;
   color: #fff;
   letter-spacing: 0.5px;
   line-height: 1.2;
}

.brand-tagline {
   font-size: 9px;
   color: var(--accent);
   font-weight: 600;
   letter-spacing: 0.5px;
}

.sidebar-nav {
   list-style: none;
   padding: 8px 0;
   margin: 0;
   flex: 1;
}

.nav-section-label {
   font-size: 9px;
   font-weight: 700;
   color: rgba(255, 255, 255, 0.3);
   text-transform: uppercase;
   letter-spacing: 1.5px;
   padding: 14px 18px 4px;
}

.nav-item .nav-link-item {
   display: flex;
   align-items: center;
   gap: 10px;
   padding: 9px 18px;
   color: var(--sb-text);
   transition: all 0.15s;
   font-weight: 500;
   font-size: 13px;
}

.nav-item .nav-link-item i {
   font-size: 15px;
   flex-shrink: 0;
   width: 18px;
   text-align: center;
}

.nav-item .nav-link-item:hover {
   background: var(--sb-hover);
   color: #fff;
}

.nav-item.active .nav-link-item {
   background: var(--sb-active);
   color: var(--accent);
   border-right: 3px solid var(--accent);
   font-weight: 700;
}

.nav-item .badge {
   font-size: 10px;
   padding: 2px 6px;
   border-radius: 10px;
   margin-left: auto;
}

/* Sidebar footer */
.sidebar-footer {
   padding: 10px 14px;
   border-top: 1px solid rgba(255, 255, 255, 0.08);
   display: flex;
   align-items: center;
   gap: 8px;
   flex-shrink: 0;
}

.user-avatar {
   width: 30px;
   height: 30px;
   background: var(--accent);
   border-radius: 50%;
   display: flex;
   align-items: center;
   justify-content: center;
   font-weight: 800;
   font-size: 13px;
   color: #fff;
   flex-shrink: 0;
}

.user-avatar-img {
   width: 30px;
   height: 30px;
   border-radius: 50%;
   object-fit: cover;
   border: 2px solid var(--accent);
   flex-shrink: 0;
}

.user-mini-link {
   display: flex;
   align-items: center;
   flex-shrink: 0;
}

.user-mini {
   flex: 1;
   overflow: hidden;
   min-width: 0;
}

.user-mini-name {
   font-size: 12px;
   font-weight: 700;
   color: #fff;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
}

.user-mini-role {
   font-size: 10px;
   color: var(--sb-text);
}

.btn-dark-toggle,
.btn-logout {
   background: rgba(255, 255, 255, 0.08);
   border: none;
   border-radius: 7px;
   width: 30px;
   height: 30px;
   display: flex;
   align-items: center;
   justify-content: center;
   color: var(--sb-text);
   cursor: pointer;
   transition: all 0.2s;
   flex-shrink: 0;
   font-size: 13px;
}

.btn-dark-toggle:hover,
.btn-logout:hover {
   background: rgba(255, 255, 255, 0.18);
   color: #fff;
}

/* ============================================================
   MAIN WRAPPER
   ============================================================ */
.main-wrapper {
   margin-left: var(--sidebar-w);
   min-height: 100vh;
   display: flex;
   flex-direction: column;
   transition: margin-left 0.3s;
}

/* ============================================================
   TOP NAVBAR
   ============================================================ */
.top-navbar {
   position: sticky;
   top: 0;
   z-index: 100;
   background: var(--surface);
   border-bottom: 1px solid var(--border);
   height: var(--top-h);
   display: flex;
   align-items: center;
   padding: 0 16px;
   gap: 12px;
   box-shadow: var(--shadow-sm);
}

.sidebar-toggle {
   background: none;
   border: none;
   font-size: 22px;
   color: var(--text-muted);
   cursor: pointer;
   padding: 4px;
   display: none;
   line-height: 1;
}

.navbar-title {
   font-size: 15px;
   font-weight: 800;
   color: var(--text);
   flex: 1;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
}

.navbar-right {
   display: flex;
   align-items: center;
   gap: 10px;
   flex-shrink: 0;
}

.live-indicator {
   display: flex;
   align-items: center;
   gap: 5px;
   font-size: 10px;
   font-weight: 700;
   color: var(--success);
   text-transform: uppercase;
   letter-spacing: 0.5px;
}

.live-dot {
   width: 6px;
   height: 6px;
   background: var(--success);
   border-radius: 50%;
   animation: pulse 1.5s infinite;
}

@keyframes pulse {

   0%,
   100% {
      opacity: 1;
      transform: scale(1)
   }

   50% {
      opacity: 0.5;
      transform: scale(1.4)
   }
}

.navbar-clock {
   font-size: 11px;
   color: var(--text-muted);
   font-weight: 600;
   display: none;
}

/* Navbar alert bell */
.navbar-alert-btn {
   position: relative;
   background: none;
   border: none;
   color: var(--text-muted);
   font-size: 18px;
   cursor: pointer;
   padding: 4px 6px;
   border-radius: 8px;
   transition: all 0.2s;
}

.navbar-alert-btn:hover {
   background: var(--surface2);
   color: var(--text);
}

.navbar-alert-dot {
   position: absolute;
   top: 2px;
   right: 2px;
   width: 8px;
   height: 8px;
   background: var(--danger);
   border-radius: 50%;
   border: 2px solid var(--surface);
}

/* Navbar profile */
.navbar-profile-btn {
   display: flex;
   align-items: center;
   text-decoration: none;
}

.navbar-avatar-img {
   width: 30px;
   height: 30px;
   border-radius: 50%;
   object-fit: cover;
   border: 2px solid var(--accent);
}

.navbar-avatar-initials {
   width: 30px;
   height: 30px;
   border-radius: 50%;
   background: var(--brand);
   display: flex;
   align-items: center;
   justify-content: center;
   font-weight: 800;
   font-size: 13px;
   color: #fff;
}

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
   padding: 16px;
   flex: 1;
}

@media (min-width:768px) {
   .page-content {
      padding: 20px 24px;
   }
}

/* ============================================================
   KPI CARDS
   ============================================================ */
.kpi-card {
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: var(--radius);
   padding: 14px 16px;
   display: flex;
   flex-direction: column;
   position: relative;
   overflow: hidden;
   transition: transform 0.2s, box-shadow 0.2s;
   box-shadow: var(--shadow-sm);
   height: 100%;
}

.kpi-card:hover {
   transform: translateY(-2px);
   box-shadow: var(--shadow);
}

.kpi-link {
   text-decoration: none !important;
   display: block;
}

.kpi-clickable {
   cursor: pointer;
}

.kpi-clickable:hover {
   transform: translateY(-3px);
   box-shadow: var(--shadow-lg);
}

/* Coloured top bar */
.kpi-card::before {
   content: '';
   position: absolute;
   top: 0;
   left: 0;
   right: 0;
   height: 3px;
}

.kpi-card.blue::before {
   background: var(--info);
}

.kpi-card.green::before {
   background: var(--success);
}

.kpi-card.amber::before {
   background: var(--accent);
}

.kpi-card.red::before {
   background: var(--danger);
}

.kpi-card.purple::before {
   background: var(--purple);
}

.kpi-card.teal::before {
   background: var(--teal);
}

.kpi-icon {
   width: 36px;
   height: 36px;
   border-radius: 9px;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 17px;
   margin-bottom: 10px;
}

.kpi-card.blue .kpi-icon {
   background: rgba(59, 130, 246, 0.12);
   color: var(--info);
}

.kpi-card.green .kpi-icon {
   background: rgba(16, 185, 129, 0.12);
   color: var(--success);
}

.kpi-card.amber .kpi-icon {
   background: rgba(245, 158, 11, 0.12);
   color: var(--accent);
}

.kpi-card.red .kpi-icon {
   background: rgba(239, 68, 68, 0.12);
   color: var(--danger);
}

.kpi-card.purple .kpi-icon {
   background: rgba(139, 92, 246, 0.12);
   color: var(--purple);
}

.kpi-card.teal .kpi-icon {
   background: rgba(20, 184, 166, 0.12);
   color: var(--teal);
}

.kpi-label {
   font-size: 10px;
   color: var(--text-muted);
   font-weight: 700;
   text-transform: uppercase;
   letter-spacing: 0.5px;
   margin-bottom: 2px;
}

.kpi-value {
   font-size: 20px;
   font-weight: 800;
   color: var(--text);
   line-height: 1.1;
   margin-bottom: 2px;
}

.kpi-value.small {
   font-size: 14px;
}

.kpi-sub {
   font-size: 10px;
   color: var(--text-light);
}

/* ============================================================
   CARDS / PANELS
   ============================================================ */
.card {
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: var(--radius);
   box-shadow: var(--shadow-sm);
   overflow: hidden;
}

.card-header {
   padding: 13px 16px;
   border-bottom: 1px solid var(--border);
   display: flex;
   align-items: center;
   justify-content: space-between;
   background: var(--surface);
   gap: 8px;
}

.card-title {
   font-size: 14px;
   font-weight: 800;
   color: var(--text);
   margin: 0;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
}

.card-body {
   padding: 16px;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive {
   overflow-x: auto;
   -webkit-overflow-scrolling: touch;
}

.data-table {
   width: 100%;
   border-collapse: collapse;
   font-size: 13px;
   min-width: 500px;
}

.data-table thead th {
   background: var(--surface2);
   color: var(--text-muted);
   font-size: 10px;
   font-weight: 700;
   text-transform: uppercase;
   letter-spacing: 0.5px;
   padding: 9px 12px;
   border-bottom: 2px solid var(--border);
   white-space: nowrap;
}

.data-table tbody td {
   padding: 10px 12px;
   border-bottom: 1px solid var(--border);
   color: var(--text);
   vertical-align: middle;
}

.data-table tbody tr {
   transition: background 0.12s;
}

.data-table tbody tr:hover {
   background: var(--surface2);
}

.data-table tbody tr:last-child td {
   border-bottom: none;
}

.product-row {
   cursor: pointer;
}

.alert-row {
   cursor: pointer;
}

.alert-row:hover {
   background: rgba(245, 158, 11, 0.05) !important;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
   display: inline-flex;
   align-items: center;
   gap: 3px;
   padding: 3px 8px;
   border-radius: 20px;
   font-size: 10px;
   font-weight: 700;
}

.badge-success {
   background: rgba(16, 185, 129, 0.12);
   color: var(--success);
}

.badge-danger {
   background: rgba(239, 68, 68, 0.12);
   color: var(--danger);
}

.badge-warn {
   background: rgba(245, 158, 11, 0.12);
   color: var(--accent);
}

.badge-info {
   background: rgba(59, 130, 246, 0.12);
   color: var(--info);
}

.badge-muted {
   background: var(--border);
   color: var(--text-muted);
}

/* ============================================================
   STOCK STATUS
   ============================================================ */
.stock-ok {
   color: var(--success);
   font-weight: 700;
}

.stock-low {
   color: var(--warning);
   font-weight: 700;
}

.stock-out {
   color: var(--danger);
   font-weight: 700;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary-custom {
   background: var(--brand);
   color: #fff;
   border: none;
   border-radius: var(--radius-sm);
   padding: 8px 16px;
   font-family: 'Plus Jakarta Sans', sans-serif;
   font-weight: 700;
   font-size: 13px;
   cursor: pointer;
   transition: all 0.2s;
   display: inline-flex;
   align-items: center;
   gap: 6px;
   white-space: nowrap;
}

.btn-primary-custom:hover {
   background: var(--brand-light);
   color: #fff;
   transform: translateY(-1px);
}

.btn-accent {
   background: var(--accent);
   color: #fff;
   border: none;
   border-radius: var(--radius-sm);
   padding: 8px 16px;
   font-family: 'Plus Jakarta Sans', sans-serif;
   font-weight: 700;
   font-size: 13px;
   cursor: pointer;
   transition: all 0.2s;
   display: inline-flex;
   align-items: center;
   gap: 6px;
   white-space: nowrap;
}

.btn-accent:hover {
   background: var(--accent-light);
   color: #fff;
   transform: translateY(-1px);
}

/* ============================================================
   FORMS — Placeholder always visible
   ============================================================ */
.form-label {
   font-size: 11px;
   font-weight: 700;
   color: var(--text-muted);
   text-transform: uppercase;
   letter-spacing: 0.3px;
   margin-bottom: 5px;
   display: block;
}

.form-control,
.form-select {
   background: var(--surface);
   border: 1.5px solid var(--border);
   border-radius: var(--radius-sm);
   color: var(--text);
   font-family: 'Plus Jakarta Sans', sans-serif;
   font-size: 13px;
   padding: 9px 12px;
   transition: border-color 0.2s, box-shadow 0.2s;
   width: 100%;
}

.form-control:focus,
.form-select:focus {
   border-color: var(--brand-light);
   box-shadow: 0 0 0 3px rgba(26, 107, 191, 0.12);
   background: var(--surface);
   color: var(--text);
   outline: none;
}

/* Placeholder — multiple prefixes to cover all browsers */
::placeholder {
   color: var(--placeholder) !important;
   opacity: 1 !important;
}

::-webkit-input-placeholder {
   color: var(--placeholder) !important;
   opacity: 1 !important;
}

::-moz-placeholder {
   color: var(--placeholder) !important;
   opacity: 1 !important;
}

:-ms-input-placeholder {
   color: var(--placeholder) !important;
}

:-moz-placeholder {
   color: var(--placeholder) !important;
   opacity: 1 !important;
}

/* Dark mode inputs */
body.dark-mode .form-control,
body.dark-mode .form-select {
   background: var(--surface2);
   border-color: var(--border);
   color: var(--text);
}

body.dark-mode ::placeholder {
   color: #64748b !important;
   opacity: 1 !important;
}

.form-control[readonly] {
   background: var(--surface2);
   cursor: not-allowed;
   opacity: 0.7;
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-content {
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: var(--radius);
   color: var(--text);
}

.modal-header {
   border-bottom: 1px solid var(--border);
   padding: 14px 18px;
}

.modal-footer {
   border-top: 1px solid var(--border) !important;
   padding: 12px 18px;
}

.modal-title {
   font-size: 16px;
   font-weight: 800;
   color: var(--text);
}

.btn-close {
   filter: none;
   /* No filter for light mode */
}

body.dark-mode .btn-close {
   filter: invert(1) brightness(2);
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
   position: fixed;
   top: 70px;
   right: 12px;
   z-index: 9999;
   display: flex;
   flex-direction: column;
   gap: 6px;
   max-width: calc(100vw - 24px);
}

.toast-msg {
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: var(--radius-sm);
   padding: 10px 14px;
   min-width: 240px;
   max-width: 340px;
   display: flex;
   align-items: flex-start;
   gap: 10px;
   box-shadow: var(--shadow-lg);
   animation: slideInRight 0.3s ease;
   font-size: 13px;
}

.toast-msg.toast-success {
   border-left: 4px solid var(--success);
}

.toast-msg.toast-error {
   border-left: 4px solid var(--danger);
}

.toast-msg.toast-warn {
   border-left: 4px solid var(--warning);
}

.toast-msg.toast-info {
   border-left: 4px solid var(--info);
}

@keyframes slideInRight {
   from {
      transform: translateX(110%);
      opacity: 0
   }

   to {
      transform: translateX(0);
      opacity: 1
   }
}

/* ============================================================
   ALERTS PANEL  (new — slide-in from right)
   ============================================================ */
.alerts-panel {
   position: fixed;
   top: 0;
   right: 0;
   bottom: 0;
   width: 320px;
   background: var(--surface);
   border-left: 1px solid var(--border);
   z-index: 1050;
   transform: translateX(100%);
   transition: transform 0.3s cubic-bezier(.4, 0, .2, 1);
   display: flex;
   flex-direction: column;
   box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
}

.alerts-panel.open {
   transform: translateX(0);
}

.alerts-panel-header {
   padding: 16px;
   border-bottom: 1px solid var(--border);
   display: flex;
   align-items: center;
   justify-content: space-between;
   flex-shrink: 0;
}

.alerts-panel-title {
   font-size: 16px;
   font-weight: 800;
   color: var(--text);
}

.alerts-panel-close {
   background: none;
   border: none;
   font-size: 20px;
   color: var(--text-muted);
   cursor: pointer;
   padding: 0;
   line-height: 1;
}

.alerts-panel-close:hover {
   color: var(--text);
}

.alerts-panel-body {
   flex: 1;
   overflow-y: auto;
   padding: 12px;
}

.alert-item {
   display: flex;
   align-items: flex-start;
   gap: 10px;
   padding: 10px 12px;
   border-radius: var(--radius-sm);
   margin-bottom: 8px;
   border: 1px solid var(--border);
   background: var(--surface2);
}

.alert-item-icon {
   font-size: 18px;
   flex-shrink: 0;
   margin-top: 1px;
}

.alert-item-body {
   flex: 1;
   min-width: 0;
}

.alert-item-title {
   font-size: 13px;
   font-weight: 700;
   color: var(--text);
}

.alert-item-sub {
   font-size: 11px;
   color: var(--text-muted);
   margin-top: 2px;
}

.alert-item.danger .alert-item-icon {
   color: var(--danger);
}

.alert-item.warn .alert-item-icon {
   color: var(--warning);
}

.alert-item.info .alert-item-icon {
   color: var(--info);
}

.alert-overlay {
   position: fixed;
   inset: 0;
   background: rgba(0, 0, 0, 0.3);
   z-index: 1049;
   display: none;
}

.alert-overlay.show {
   display: block;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
   display: flex;
   align-items: center;
   justify-content: space-between;
   margin-bottom: 16px;
   flex-wrap: wrap;
   gap: 10px;
}

.page-header-title {
   font-size: 20px;
   font-weight: 800;
   color: var(--text);
   margin: 0;
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
   display: flex;
   align-items: center;
   gap: 8px;
   flex-wrap: wrap;
}

.search-box {
   position: relative;
   flex: 1;
   min-width: 160px;
}

.search-box i {
   position: absolute;
   left: 10px;
   top: 50%;
   transform: translateY(-50%);
   color: var(--text-muted);
   font-size: 14px;
   pointer-events: none;
}

.search-box input {
   padding-left: 34px !important;
}

/* ============================================================
   CHART
   ============================================================ */
.chart-container {
   position: relative;
   height: 200px;
}

@media (min-width:768px) {
   .chart-container {
      height: 240px;
   }
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination-wrapper {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: 10px 14px;
   border-top: 1px solid var(--border);
   font-size: 11px;
   color: var(--text-muted);
   flex-wrap: wrap;
   gap: 8px;
}

.pagination {
   margin: 0;
   gap: 3px;
}

.page-link {
   background: var(--surface2);
   border: 1px solid var(--border);
   color: var(--text);
   border-radius: var(--radius-xs) !important;
   padding: 4px 9px;
   font-size: 11px;
}

.page-item.active .page-link {
   background: var(--brand);
   border-color: var(--brand);
   color: #fff;
}

.page-link:hover {
   background: var(--brand);
   color: #fff;
   border-color: var(--brand);
}

/* ============================================================
   REAL-TIME FLASH
   ============================================================ */
@keyframes flashUpdate {
   0% {
      background-color: rgba(245, 158, 11, 0.2)
   }

   100% {
      background-color: transparent
   }
}

.updated {
   animation: flashUpdate 1.2s ease;
}

/* ============================================================
   WELCOME BANNER
   ============================================================ */
.welcome-banner {
   background: linear-gradient(135deg, #0f4c81, #1a6bbf);
   border-radius: var(--radius);
   overflow: hidden;
   box-shadow: var(--shadow);
   margin-bottom: 16px;
}

.welcome-banner-inner {
   display: flex;
   align-items: center;
   gap: 14px;
   padding: 16px 20px;
   flex-wrap: wrap;
}

.welcome-icon {
   width: 44px;
   height: 44px;
   flex-shrink: 0;
   background: rgba(255, 255, 255, 0.15);
   border-radius: 11px;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 20px;
   color: #fff;
}

.welcome-text {
   flex: 1;
   min-width: 160px;
}

.welcome-title {
   font-size: 15px;
   font-weight: 800;
   color: #fff;
}

.welcome-sub {
   font-size: 11px;
   color: rgba(255, 255, 255, 0.78);
   margin-top: 2px;
}

/* ============================================================
   PROFILE PAGE
   ============================================================ */
.profile-avatar-wrap {
   width: 120px;
   height: 120px;
   margin: 0 auto 4px;
   border-radius: 50%;
   overflow: hidden;
   border: 4px solid var(--accent);
   background: var(--surface2);
   display: flex;
   align-items: center;
   justify-content: center;
}

.profile-avatar-img {
   width: 120px;
   height: 120px;
   object-fit: cover;
   border-radius: 50%;
}

.profile-avatar-initials {
   font-size: 44px;
   font-weight: 800;
   color: var(--brand);
}

.upload-label {
   display: inline-flex;
   align-items: center;
   gap: 6px;
   background: var(--surface2);
   border: 1.5px dashed var(--border);
   border-radius: var(--radius-sm);
   padding: 7px 16px;
   cursor: pointer;
   font-size: 12px;
   font-weight: 600;
   color: var(--brand-light);
   transition: all 0.2s;
   margin-top: 8px;
}

.upload-label:hover {
   border-color: var(--brand-light);
   background: rgba(26, 107, 191, 0.06);
}

/* ============================================================
   LOGIN / AUTH PAGES
   ============================================================ */
.login-page {
   min-height: 100vh;
   background: linear-gradient(135deg, #0a2d4f 0%, #0f4c81 60%, #1a6bbf 100%);
   display: flex;
   align-items: center;
   justify-content: center;
   padding: 20px 16px;
}

.login-card {
   background: var(--surface);
   border-radius: 16px;
   padding: 32px 28px;
   width: 100%;
   max-width: 420px;
   box-shadow: var(--shadow-lg);
}

.login-logo {
   text-align: center;
   margin-bottom: 24px;
}

.login-logo .brand-icon-lg {
   width: 56px;
   height: 56px;
   background: var(--accent);
   border-radius: 14px;
   display: inline-flex;
   align-items: center;
   justify-content: center;
   font-size: 26px;
   color: #fff;
   margin-bottom: 10px;
}

.login-logo h1 {
   font-size: 24px;
   font-weight: 800;
   color: var(--text);
   margin: 0;
}

.login-logo p {
   color: var(--text-muted);
   font-size: 12px;
   margin: 3px 0 0;
}

/* ============================================================
   CATEGORY CARDS (inline styles override insurance)
   ============================================================ */
.cat-card {
   background: var(--surface);
   border: 1px solid var(--border);
   border-radius: var(--radius);
   overflow: hidden;
   box-shadow: var(--shadow-sm);
   transition: transform 0.2s, box-shadow 0.2s;
   height: 100%;
   display: flex;
   flex-direction: column;
}

.cat-card:hover {
   transform: translateY(-2px);
   box-shadow: var(--shadow);
}

.cat-card-bar {
   height: 4px;
   flex-shrink: 0;
}

.cat-card-body {
   padding: 14px 14px 10px;
   flex: 1;
}

.cat-card-top {
   display: flex;
   align-items: flex-start;
   justify-content: space-between;
   margin-bottom: 10px;
}

.cat-icon {
   width: 38px;
   height: 38px;
   border-radius: 9px;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 17px;
   flex-shrink: 0;
}

.cat-badge {
   font-size: 10px;
   font-weight: 700;
   background: var(--surface2);
   border: 1px solid var(--border);
   color: var(--text-muted);
   padding: 3px 8px;
   border-radius: 20px;
   white-space: nowrap;
}

.cat-name {
   font-size: 14px;
   font-weight: 800;
   color: var(--text);
   margin-bottom: 3px;
   line-height: 1.3;
}

.cat-desc {
   font-size: 11px;
   color: var(--text-muted);
   margin-bottom: 6px;
   line-height: 1.4;
}

.cat-value {
   font-size: 11px;
   color: var(--text-muted);
}

.cat-card-footer {
   padding: 9px 14px;
   border-top: 1px solid var(--border);
   display: flex;
   gap: 7px;
   flex-shrink: 0;
}

.cat-btn-edit {
   flex: 1;
   background: transparent;
   border: 1.5px solid var(--brand-light);
   color: var(--brand-light);
   border-radius: 7px;
   padding: 5px 8px;
   font-size: 11px;
   font-weight: 600;
   cursor: pointer;
   transition: all 0.2s;
   font-family: 'Plus Jakarta Sans', sans-serif;
}

.cat-btn-edit:hover {
   background: var(--brand-light);
   color: #fff;
}

.cat-btn-delete {
   background: transparent;
   border: 1.5px solid var(--danger);
   color: var(--danger);
   border-radius: 7px;
   padding: 5px 10px;
   font-size: 12px;
   cursor: pointer;
   transition: all 0.2s;
}

.cat-btn-delete:hover {
   background: var(--danger);
   color: #fff;
}

/* ============================================================
   RESPONSIVE — Mobile first
   ============================================================ */
@media (max-width:767px) {
   :root {
      --sidebar-w: 0px;
   }

   .sidebar {
      width: 280px;
      transform: translateX(-100%);
   }

   .sidebar.open {
      transform: translateX(0);
      box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
   }

   .sidebar-toggle {
      display: block;
   }

   .main-wrapper {
      margin-left: 0 !important;
   }

   /* Navbar clock hidden on very small, shown on medium+ */
   .navbar-clock {
      display: none;
   }

   /* KPI cards — 2 per row on mobile */
   .kpi-row {
      --bs-gutter-x: 10px;
      --bs-gutter-y: 10px;
   }

   .kpi-value {
      font-size: 18px;
   }

   .kpi-value.small {
      font-size: 13px;
   }

   /* Tables scroll horizontally */
   .data-table {
      font-size: 12px;
   }

   .data-table thead th,
   .data-table tbody td {
      padding: 8px 10px;
   }

   /* Charts shorter on mobile */
   .chart-container {
      height: 170px;
   }

   /* Page header wraps */
   .page-header-title {
      font-size: 18px;
   }

   /* Alerts panel full-width on mobile */
   .alerts-panel {
      width: 100%;
   }

   /* Modal full-width on small screens */
   .modal-dialog {
      margin: 10px;
   }
}

@media (min-width:768px) {
   .navbar-clock {
      display: block;
   }

   .page-content {
      padding: 20px 24px;
   }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
   position: fixed;
   inset: 0;
   background: rgba(0, 0, 0, 0.4);
   z-index: 999;
   display: none;
}

.sidebar-overlay.show {
   display: block;
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {

   .sidebar,
   .top-navbar,
   .toast-container,
   .alerts-panel,
   .alert-overlay,
   .page-header .btn-accent,
   .page-header .btn-primary-custom,
   nav.pagination,
   .pagination-wrapper nav,
   #resetBtn,
   .filter-bar,
   .modal,
   .modal-backdrop,
   .sidebar-overlay {
      display: none !important;
   }

   body {
      background: #fff !important;
      color: #000 !important;
      font-size: 12px;
   }

   .main-wrapper {
      margin-left: 0 !important;
   }

   .card {
      box-shadow: none !important;
      border: 1px solid #ccc !important;
      page-break-inside: avoid;
   }
}

/* ============================================================
   DARK MODE EXTRA FIXES
   ============================================================ */

/* Modal close button visible in dark mode */
body.dark-mode .btn-close {
   filter: invert(1) brightness(2);
}

/* Bootstrap table override for dark mode */
body.dark-mode .table {
   color: var(--text);
}

body.dark-mode .table td,
body.dark-mode .table th {
   border-color: var(--border);
}

/* Select option text in dark mode (browser-dependent) */
body.dark-mode select option {
   background: var(--surface2);
   color: var(--text);
}

/* Alert items in alerts panel — explicit colors */
.alert-item {
   cursor: pointer;
}

.alert-item:hover {
   opacity: 0.9;
}

.alert-item.danger {
   border-left: 4px solid var(--danger);
}

.alert-item.warn {
   border-left: 4px solid var(--warning);
}

.alert-item.info {
   border-left: 4px solid var(--info);
}

/* KPI value 'small' class for long UGX amounts */
.kpi-value.small {
   font-size: 14px !important;
   font-weight: 800;
}

/* Mobile bottom safe area padding */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
   .sidebar {
      padding-bottom: env(safe-area-inset-bottom);
   }
}

/* Swipe hint for mobile tables */
@media (max-width: 767px) {
   .table-responsive::after {
      content: '← scroll →';
      display: block;
      text-align: center;
      font-size: 10px;
      color: var(--text-light);
      padding: 4px 0;
   }
}