/* =============================================================
   KEMERA WALE CRM — Complete Stylesheet
   Freeze The Moment Forever | kemerawale.in
   ============================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* =============================================================
   CSS CUSTOM PROPERTIES
   ============================================================= */
:root {
  --primary:            #F5A623;
  --primary-dark:       #D4891A;
  --primary-light:      rgba(245, 166, 35, 0.15);
  --blue:               #29ABE2;
  --blue-dark:          #1A8BBF;
  --blue-light:         rgba(41, 171, 226, 0.15);
  --green:              #7CB518;
  --green-dark:         #5E8A12;
  --green-light:        rgba(124, 181, 24, 0.15);
  --red:                #E63946;
  --red-dark:           #C42E3A;
  --red-light:          rgba(230, 57, 70, 0.15);
  --dark:               #1C1C1E;
  --dark-2:             #2C2C2E;
  --dark-3:             #3A3A3C;
  --sidebar-text:       #A8A8B3;
  --sidebar-active-bg:  rgba(245, 166, 35, 0.12);
  --body-bg:            #F4F6FA;
  --card-bg:            #FFFFFF;
  --text-primary:       #1C1C1E;
  --text-secondary:     #6B7280;
  --border:             #E5E7EB;
  --shadow-sm:          0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow:             0 4px 16px rgba(0, 0, 0, 0.08);
  --shadow-lg:          0 8px 32px rgba(0, 0, 0, 0.12);
  --radius:             12px;
  --radius-sm:          8px;
  --sidebar-width:      260px;
  --topbar-height:      65px;
  --font:               'Inter', sans-serif;
}

/* =============================================================
   BASE & RESET
   ============================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
  background-color: var(--body-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  text-decoration: none;
  color: inherit;
}

img {
  max-width: 100%;
  height: auto;
}

ul, ol {
  list-style: none;
}

button, input, select, textarea {
  font-family: var(--font);
}

/* =============================================================
   WRAPPER LAYOUT
   ============================================================= */
.wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* =============================================================
   SIDEBAR
   ============================================================= */
.sidebar {
  position: fixed;
  left: 0;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--dark);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--dark-3) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background-color: var(--dark-3);
  border-radius: 4px;
}

/* Sidebar Brand */
.sidebar-brand {
  padding: 20px;
  border-bottom: 1px solid var(--dark-3);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sidebar-brand img {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: var(--dark);
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.sidebar-brand-text h6 {
  color: #FFFFFF;
  font-weight: 700;
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.sidebar-brand-text small {
  color: var(--primary);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
  display: block;
  margin-top: 2px;
}

/* Sidebar Navigation */
.sidebar-nav {
  padding: 16px 0;
  flex: 1;
}

.nav-label {
  color: #636366;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 16px 20px 8px;
  font-weight: 600;
  display: block;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 0;
  transition: all 0.2s ease;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  position: relative;
}

.sidebar-link:hover {
  color: #FFFFFF;
  background-color: rgba(255, 255, 255, 0.06);
  text-decoration: none;
}

.sidebar-link.active {
  color: var(--primary);
  background-color: var(--sidebar-active-bg);
  border-left-color: var(--primary);
}

.sidebar-link i {
  width: 20px;
  margin-right: 10px;
  font-size: 15px;
  text-align: center;
  flex-shrink: 0;
}

.sidebar-link .badge-count {
  margin-left: auto;
  background-color: var(--primary);
  color: var(--dark);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  line-height: 1.4;
}

.sidebar-divider {
  height: 1px;
  background-color: var(--dark-3);
  margin: 12px 20px;
}

/* Sidebar User Footer */
.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid var(--dark-3);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--dark);
  flex-shrink: 0;
}

.sidebar-user .user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user .user-info .user-name {
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 600;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user .user-info .user-role {
  color: var(--sidebar-text);
  font-size: 11px;
  display: block;
  margin-top: 1px;
}

.sidebar-user .user-logout {
  color: var(--sidebar-text);
  font-size: 14px;
  cursor: pointer;
  transition: color 0.2s;
  flex-shrink: 0;
}

.sidebar-user .user-logout:hover {
  color: var(--red);
}

/* =============================================================
   MAIN CONTENT
   ============================================================= */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  background-color: var(--body-bg);
  display: flex;
  flex-direction: column;
}

.content-area {
  padding: 24px;
  flex: 1;
}

/* =============================================================
   TOPBAR
   ============================================================= */
.topbar {
  height: var(--topbar-height);
  background-color: #FFFFFF;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-title h5 {
  margin: 0;
  font-weight: 700;
  color: var(--text-primary);
  font-size: 18px;
  line-height: 1.2;
}

.topbar-title small {
  color: var(--text-secondary);
  font-size: 12px;
  display: block;
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.btn-icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  color: var(--text-secondary);
  font-size: 15px;
}

.btn-icon:hover {
  background-color: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

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

/* Topbar User */
.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: all 0.2s;
}

.topbar-user:hover {
  background-color: var(--primary-light);
  border-color: var(--primary);
}

.topbar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--dark);
}

.topbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

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

.page-header-left h4 {
  font-weight: 700;
  font-size: 22px;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.2;
}

.page-header-left p {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 4px 0 0;
}

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

/* Legacy support */
.page-header h4 {
  font-weight: 700;
  font-size: 22px;
  color: var(--text-primary);
  margin: 0;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 4px 0 0;
}

/* =============================================================
   STAT CARDS
   ============================================================= */
.stat-card {
  background: #FFFFFF;
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid transparent;
  transition: all 0.2s ease;
  overflow: hidden;
  position: relative;
}

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

.stat-card.orange { border-left-color: var(--primary); }
.stat-card.blue   { border-left-color: var(--blue); }
.stat-card.green  { border-left-color: var(--green); }
.stat-card.red    { border-left-color: var(--red); }

.stat-info {
  flex: 1;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 6px;
  display: block;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  display: block;
}

.stat-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  display: block;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon.orange { background-color: var(--primary-light); color: var(--primary); }
.stat-icon.blue   { background-color: var(--blue-light);    color: var(--blue); }
.stat-icon.green  { background-color: var(--green-light);   color: var(--green); }
.stat-icon.red    { background-color: var(--red-light);     color: var(--red); }

/* =============================================================
   CARDS (card-kw)
   ============================================================= */
.card-kw {
  background: #FFFFFF;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: none;
  overflow: hidden;
}

.card-kw .card-header {
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-kw .card-header h6 {
  margin: 0;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.card-kw .card-header .card-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.card-kw .card-body {
  padding: 20px;
}

.card-kw .card-footer {
  background: #FAFAFA;
  border-top: 1px solid var(--border);
  padding: 14px 20px;
}

/* =============================================================
   BUTTONS
   ============================================================= */
.btn-primary-kw {
  background-color: var(--primary);
  color: #1C1C1E;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary-kw:hover {
  background-color: var(--primary-dark);
  color: #1C1C1E;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(245, 166, 35, 0.4);
  text-decoration: none;
}

.btn-primary-kw:active {
  transform: translateY(0);
}

.btn-outline-kw {
  background-color: transparent;
  color: var(--primary);
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}

.btn-outline-kw:hover {
  background-color: var(--primary);
  color: #1C1C1E;
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-blue-kw {
  background-color: var(--blue);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}

.btn-blue-kw:hover {
  background-color: var(--blue-dark);
  color: #FFFFFF;
  transform: translateY(-1px);
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(41, 171, 226, 0.4);
}

.btn-green-kw {
  background-color: var(--green);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}

.btn-green-kw:hover {
  background-color: var(--green-dark);
  color: #FFFFFF;
  transform: translateY(-1px);
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(124, 181, 24, 0.4);
}

.btn-red-kw {
  background-color: var(--red);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 18px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}

.btn-red-kw:hover {
  background-color: var(--red-dark);
  color: #FFFFFF;
  transform: translateY(-1px);
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4);
}

/* Small button size */
.btn-kw-sm {
  padding: 5px 12px;
  font-size: 12px;
}

/* =============================================================
   TABLES
   ============================================================= */
.table-kw {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-kw thead th {
  background-color: #F8F9FA;
  color: var(--text-secondary);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.table-kw thead th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.table-kw thead th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

.table-kw tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

.table-kw tbody tr:hover td {
  background-color: #FAFAFA;
}

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

.table-kw .action-btns {
  display: flex;
  gap: 6px;
  align-items: center;
}

.table-kw .action-btns a,
.table-kw .action-btns button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-action-view   { background: var(--blue-light);    color: var(--blue); }
.btn-action-edit   { background: var(--primary-light); color: var(--primary); }
.btn-action-delete { background: var(--red-light);     color: var(--red); }
.btn-action-pay    { background: var(--green-light);   color: var(--green); }

.btn-action-view:hover   { background: var(--blue);    color: #fff; }
.btn-action-edit:hover   { background: var(--primary); color: var(--dark); }
.btn-action-delete:hover { background: var(--red);     color: #fff; }
.btn-action-pay:hover    { background: var(--green);   color: #fff; }

/* =============================================================
   STATUS BADGES
   ============================================================= */
.badge-kw {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.badge-confirmed   { background: rgba(41, 171, 226, 0.12);  color: #1A7FA3; }
.badge-inprogress  { background: rgba(245, 166, 35, 0.12);  color: #B8780F; }
.badge-completed   { background: rgba(124, 181, 24, 0.12);  color: #5A8510; }
.badge-cancelled   { background: rgba(230, 57, 70, 0.12);   color: #B52A34; }
.badge-pending     { background: rgba(230, 57, 70, 0.12);   color: #B52A34; }
.badge-pending-pay { background: rgba(230, 57, 70, 0.12);   color: #B52A34; }
.badge-paid        { background: rgba(124, 181, 24, 0.12);  color: #5A8510; }
.badge-partial     { background: rgba(245, 166, 35, 0.12);  color: #B8780F; }
.badge-enquiry     { background: rgba(106, 90, 205, 0.12);  color: #5A4A9B; }

/* Dot indicator inside badge */
.badge-kw .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
  flex-shrink: 0;
}

/* =============================================================
   FORMS
   ============================================================= */
.form-label-kw {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: block;
}

.form-control-kw {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  background-color: #FFFFFF;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  line-height: 1.5;
}

.form-control-kw:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control-kw::placeholder {
  color: #9CA3AF;
}

.form-control-kw:disabled {
  background-color: #F3F4F6;
  color: var(--text-secondary);
  cursor: not-allowed;
}

select.form-control-kw {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
  cursor: pointer;
}

textarea.form-control-kw {
  resize: vertical;
  min-height: 90px;
}

.form-group-kw {
  margin-bottom: 16px;
}

.form-section {
  background-color: #F8F9FA;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.form-section-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section-title i {
  color: var(--primary);
}

.input-group-kw {
  position: relative;
}

.input-group-kw .input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 14px;
  pointer-events: none;
}

.input-group-kw .form-control-kw {
  padding-left: 40px;
}

.input-group-kw .input-icon-right {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
}

.form-text-kw {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  display: block;
}

.form-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 4px;
  display: block;
}

/* =============================================================
   MODALS
   ============================================================= */
.modal-kw .modal-content {
  border-radius: var(--radius);
  border: none;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.modal-kw .modal-header {
  border-bottom: 1px solid var(--border);
  padding: 18px 24px;
  background-color: #FFFFFF;
}

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

.modal-kw .modal-header .btn-close {
  opacity: 0.5;
  transition: opacity 0.2s;
}

.modal-kw .modal-header .btn-close:hover {
  opacity: 1;
}

.modal-kw .modal-body {
  padding: 24px;
  background-color: #FFFFFF;
}

.modal-kw .modal-footer {
  border-top: 1px solid var(--border);
  padding: 16px 24px;
  background-color: #FAFAFA;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* =============================================================
   LOGIN PAGE
   ============================================================= */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(135deg, #1C1C1E 0%, #2C2C2E 50%, #1C1C1E 100%);
  background-size: 400% 400%;
  animation: gradientShift 12s ease infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* Decorative background blobs */
.login-wrapper::before {
  content: '';
  position: absolute;
  top: -20%;
  right: -10%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 166, 35, 0.08) 0%, transparent 70%);
  pointer-events: none;
}

.login-wrapper::after {
  content: '';
  position: absolute;
  bottom: -20%;
  left: -10%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(41, 171, 226, 0.06) 0%, transparent 70%);
  pointer-events: none;
}

@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.login-card {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
  position: relative;
  z-index: 1;
  animation: cardAppear 0.5s ease forwards;
}

@keyframes cardAppear {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.login-logo img {
  height: 64px;
  width: auto;
  object-fit: contain;
}

.login-logo-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 800;
  color: var(--dark);
  letter-spacing: -1px;
  box-shadow: 0 8px 24px rgba(245, 166, 35, 0.4);
}

.login-title {
  text-align: center;
  color: #FFFFFF;
  font-weight: 700;
  font-size: 24px;
  margin-bottom: 6px;
}

.login-sub {
  text-align: center;
  color: rgba(255, 255, 255, 0.5);
  font-size: 14px;
  margin-bottom: 32px;
}

.login-form-group {
  margin-bottom: 18px;
}

.login-form-label {
  display: block;
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0.2px;
}

.login-input-wrap {
  position: relative;
}

.login-input-wrap .login-input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
  pointer-events: none;
  z-index: 1;
}

.login-input-wrap .login-input-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
  cursor: pointer;
  z-index: 1;
  background: none;
  border: none;
  padding: 0;
  transition: color 0.2s;
}

.login-input-wrap .login-input-toggle:hover {
  color: rgba(255, 255, 255, 0.8);
}

.login-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
  border-radius: var(--radius-sm);
  padding: 12px 16px 12px 42px;
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: all 0.2s ease;
  line-height: 1.5;
}

.login-input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.login-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.2);
  background: rgba(255, 255, 255, 0.1);
}

.login-input.has-toggle {
  padding-right: 42px;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  cursor: pointer;
}

.login-remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.login-remember span {
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
}

.login-btn {
  width: 100%;
  background: var(--primary);
  color: #1C1C1E;
  font-weight: 700;
  font-size: 15px;
  padding: 13px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0.2px;
}

.login-btn:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 20px rgba(245, 166, 35, 0.5);
  transform: translateY(-1px);
}

.login-btn:active {
  transform: translateY(0);
}

.login-error {
  background: rgba(230, 57, 70, 0.15);
  border: 1px solid rgba(230, 57, 70, 0.3);
  color: #FF8B94;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.login-footer {
  text-align: center;
  margin-top: 32px;
  color: rgba(255, 255, 255, 0.3);
  font-size: 12px;
  line-height: 1.6;
}

.login-footer a {
  color: var(--primary);
  text-decoration: none;
}

.login-footer a:hover {
  text-decoration: underline;
}

/* =============================================================
   FLASH MESSAGES
   ============================================================= */
.flash-message {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.flash-success {
  background: var(--green-light);
  color: var(--green-dark);
  border: 1px solid rgba(124, 181, 24, 0.3);
}

.flash-error {
  background: var(--red-light);
  color: var(--red-dark);
  border: 1px solid rgba(230, 57, 70, 0.3);
}

.flash-info {
  background: var(--blue-light);
  color: var(--blue-dark);
  border: 1px solid rgba(41, 171, 226, 0.3);
}

.flash-warning {
  background: var(--primary-light);
  color: var(--primary-dark);
  border: 1px solid rgba(245, 166, 35, 0.3);
}

/* =============================================================
   TIMELINE (payment history)
   ============================================================= */
.timeline {
  position: relative;
  padding-left: 24px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  margin-bottom: 16px;
  padding-left: 16px;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -20px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid #FFFFFF;
  box-shadow: 0 0 0 2px var(--primary);
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-card {
  background: #FFFFFF;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  transition: box-shadow 0.2s;
}

.timeline-card:hover {
  box-shadow: var(--shadow-sm);
}

.timeline-card .timeline-date {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.timeline-card .timeline-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--green);
}

.timeline-card .timeline-method {
  font-size: 12px;
  color: var(--text-secondary);
}

/* =============================================================
   FINANCIAL SUMMARY BOX
   ============================================================= */
.finance-box {
  background: #FFFFFF;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.finance-box-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.finance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.finance-row:last-child {
  border-bottom: none;
}

.finance-row .label {
  color: var(--text-secondary);
}

.finance-row .value {
  font-weight: 600;
  color: var(--text-primary);
}

.finance-row.total {
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
}

.finance-row.total .label,
.finance-row.total .value {
  color: var(--primary);
}

.finance-row.profit .label,
.finance-row.profit .value {
  color: var(--green);
  font-weight: 700;
}

.finance-row.pending .label,
.finance-row.pending .value {
  color: var(--red);
}

/* Progress bar for payment */
.payment-progress {
  margin-top: 12px;
}

.payment-progress-bar-wrap {
  background: var(--border);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
  margin-top: 6px;
}

.payment-progress-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--green), #9ED73A);
  transition: width 0.6s ease;
}

.payment-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* =============================================================
   INVOICE STYLES
   ============================================================= */
.invoice-page {
  max-width: 800px;
  margin: 0 auto;
  background: #FFFFFF;
  padding: 40px 48px;
  box-shadow: var(--shadow-lg);
  border-radius: var(--radius);
}

.invoice-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--primary);
}

.invoice-company h3 {
  font-size: 22px;
  font-weight: 800;
  color: var(--dark);
  margin: 0 0 6px;
  line-height: 1.2;
}

.invoice-company p {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 3px 0;
  line-height: 1.5;
}

.invoice-meta {
  text-align: right;
}

.invoice-number {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  display: block;
}

.invoice-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}

.invoice-meta .invoice-date {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 8px;
}

.invoice-client-section {
  display: flex;
  gap: 40px;
  margin-bottom: 32px;
}

.invoice-client-box {
  flex: 1;
}

.invoice-client-box h6 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-weight: 600;
}

.invoice-client-box .client-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 4px;
}

.invoice-client-box p {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 2px 0;
}

.invoice-table {
  width: 100%;
  margin: 20px 0;
  border-collapse: collapse;
}

.invoice-table thead th {
  background: var(--dark);
  color: #FFFFFF;
  padding: 12px 16px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
  text-align: left;
}

.invoice-table thead th:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.invoice-table thead th:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; text-align: right; }

.invoice-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-primary);
  vertical-align: middle;
}

.invoice-table tbody td:last-child { text-align: right; }
.invoice-table tbody tr:last-child td { border-bottom: none; }

.invoice-totals {
  width: 300px;
  margin-left: auto;
  margin-top: 20px;
}

.invoice-totals table {
  width: 100%;
  border-collapse: collapse;
}

.invoice-totals td {
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-secondary);
  vertical-align: middle;
}

.invoice-totals td:last-child {
  text-align: right;
  font-weight: 600;
  color: var(--text-primary);
}

.invoice-totals tr.divider td {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.invoice-totals .grand-total td {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  border-top: 2px solid var(--primary);
  padding-top: 12px;
}

.invoice-paid-stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
  border: 4px solid var(--green);
  color: var(--green);
  font-size: 48px;
  font-weight: 900;
  padding: 8px 20px;
  border-radius: 8px;
  opacity: 0.15;
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 4px;
  white-space: nowrap;
}

.invoice-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.8;
}

.invoice-footer strong {
  color: var(--primary);
}

/* Invoice status badge large */
.invoice-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* =============================================================
   CHARTS
   ============================================================= */
.chart-container {
  position: relative;
  height: 280px;
  width: 100%;
}

.chart-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
  justify-content: center;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* =============================================================
   EMPTY STATE
   ============================================================= */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.empty-state-icon {
  font-size: 56px;
  color: var(--border);
  margin-bottom: 16px;
  display: block;
}

.empty-state h5 {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}

/* =============================================================
   SEARCH & FILTER BAR
   ============================================================= */
.filter-bar {
  background: #FFFFFF;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-bar .search-wrap {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.filter-bar .search-wrap i {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  font-size: 14px;
}

.filter-bar .search-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px 9px 36px;
  font-size: 14px;
  font-family: var(--font);
  outline: none;
  transition: border-color 0.2s;
  color: var(--text-primary);
}

.filter-bar .search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.filter-bar .filter-select {
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 32px 9px 12px;
  font-size: 13px;
  font-family: var(--font);
  outline: none;
  background-color: #FFFFFF;
  color: var(--text-primary);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236B7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px;
  min-width: 140px;
  transition: border-color 0.2s;
}

.filter-bar .filter-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

/* =============================================================
   DETAIL SECTIONS (project-detail page)
   ============================================================= */
.detail-info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 20px;
}

.detail-info-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.detail-info-item:nth-last-child(-n+2) {
  border-bottom: none;
}

.detail-info-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
}

.detail-info-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  display: block;
}

/* =============================================================
   UTILITY CLASSES
   ============================================================= */
.text-primary-kw { color: var(--primary) !important; }
.text-blue-kw    { color: var(--blue)    !important; }
.text-green-kw   { color: var(--green)   !important; }
.text-red-kw     { color: var(--red)     !important; }
.text-dark-kw    { color: var(--dark)    !important; }
.text-muted-kw   { color: var(--text-secondary) !important; }

.bg-primary-kw { background-color: var(--primary)      !important; }
.bg-blue-kw    { background-color: var(--blue)         !important; }
.bg-green-kw   { background-color: var(--green)        !important; }
.bg-red-kw     { background-color: var(--red)          !important; }
.bg-dark-kw    { background-color: var(--dark)         !important; }
.bg-light-kw   { background-color: var(--primary-light)!important; }

.fw-400 { font-weight: 400 !important; }
.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.fw-800 { font-weight: 800 !important; }

.fs-11 { font-size: 11px !important; }
.fs-12 { font-size: 12px !important; }
.fs-13 { font-size: 13px !important; }
.fs-15 { font-size: 15px !important; }
.fs-16 { font-size: 16px !important; }

.gap-6  { gap: 6px  !important; }
.gap-8  { gap: 8px  !important; }
.gap-10 { gap: 10px !important; }
.gap-12 { gap: 12px !important; }

.rounded-kw { border-radius: var(--radius) !important; }
.rounded-sm-kw { border-radius: var(--radius-sm) !important; }

.shadow-kw    { box-shadow: var(--shadow)    !important; }
.shadow-sm-kw { box-shadow: var(--shadow-sm) !important; }
.shadow-lg-kw { box-shadow: var(--shadow-lg) !important; }

.border-kw { border: 1px solid var(--border) !important; }

.cursor-pointer { cursor: pointer; }

.d-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Amount display */
.amount-positive { color: var(--green); font-weight: 600; }
.amount-negative { color: var(--red);   font-weight: 600; }
.amount-pending  { color: var(--red);   font-weight: 600; }

/* =============================================================
   DIVIDER
   ============================================================= */
.divider {
  height: 1px;
  background-color: var(--border);
  margin: 20px 0;
}

/* =============================================================
   BACK BUTTON / BREADCRUMB
   ============================================================= */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  padding: 6px 0;
  transition: color 0.2s;
  margin-bottom: 20px;
}

.back-btn:hover {
  color: var(--primary);
  text-decoration: none;
}

.breadcrumb-kw {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.breadcrumb-kw a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.breadcrumb-kw a:hover {
  color: var(--primary);
}

.breadcrumb-kw .sep {
  color: var(--border);
}

.breadcrumb-kw .current {
  color: var(--text-primary);
  font-weight: 600;
}

/* =============================================================
   PAGINATION
   ============================================================= */
.pagination-kw {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 0;
}

.pagination-kw .page-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: #FFFFFF;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  text-decoration: none;
}

.pagination-kw .page-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.pagination-kw .page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--dark);
}

/* =============================================================
   TOOLTIP
   ============================================================= */
[data-tooltip] {
  position: relative;
  cursor: pointer;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: #FFFFFF;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 9999;
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* =============================================================
   LOADING SPINNER
   ============================================================= */
.spinner-kw {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* =============================================================
   RESPONSIVE — MOBILE
   ============================================================= */
@media (max-width: 992px) {
  :root {
    --sidebar-width: 260px;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 1050;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    backdrop-filter: blur(4px);
  }

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

  .main-content {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: flex;
  }
}

@media (max-width: 768px) {
  .content-area {
    padding: 16px;
  }

  .stat-value {
    font-size: 20px;
  }

  .page-header {
    flex-direction: column;
    gap: 12px;
  }

  .page-header-right {
    width: 100%;
    flex-wrap: wrap;
  }

  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-bar .filter-select {
    width: 100%;
  }

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

  .invoice-header {
    flex-direction: column;
    gap: 20px;
  }

  .invoice-meta {
    text-align: left;
  }

  .invoice-client-section {
    flex-direction: column;
    gap: 20px;
  }

  .login-card {
    padding: 32px 24px;
  }

  .detail-info-grid {
    grid-template-columns: 1fr;
  }

  .detail-info-item:nth-last-child(-n+2) {
    border-bottom: 1px solid var(--border);
  }

  .detail-info-item:last-child {
    border-bottom: none;
  }

  .topbar {
    padding: 0 16px;
  }
}

@media (max-width: 576px) {
  .stat-card {
    padding: 16px 18px;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .table-kw thead th,
  .table-kw tbody td {
    padding: 10px 12px;
  }

  .invoice-totals {
    width: 100%;
  }
}

/* =============================================================
   PRINT STYLES
   ============================================================= */
@media print {
  .sidebar        { display: none !important; }
  .topbar         { display: none !important; }
  .main-content   { margin-left: 0 !important; }
  .no-print       { display: none !important; }
  .page-header    { display: none !important; }
  .content-area   { padding: 0 !important; }

  body {
    background: #FFFFFF !important;
    font-size: 12px;
  }

  .invoice-page {
    box-shadow: none !important;
    padding: 0 !important;
    border-radius: 0 !important;
    max-width: 100% !important;
  }


  .btn-primary-kw,
  .btn-outline-kw,
  .btn-blue-kw,
  .btn-green-kw,
  .btn-red-kw {
    display: none !important;
  }

  a {
    text-decoration: none !important;
  }

  @page {
    margin: 20mm;
    size: A4;
  }
}

/* =============================================================
   FIX BLOCK — Aliases & missing classes
   ============================================================= */

/* action-btn: used as .action-btn.view / .action-btn.edit / .action-btn.delete */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  background: none;
}
.action-btn.view   { background: var(--blue-light);    color: var(--blue); }
.action-btn.edit   { background: var(--primary-light); color: var(--primary); }
.action-btn.delete { background: var(--red-light);     color: var(--red); }
.action-btn.pay    { background: var(--green-light);   color: var(--green); }
.action-btn.view:hover   { background: var(--blue);    color: #fff; }
.action-btn.edit:hover   { background: var(--primary); color: var(--dark); }
.action-btn.delete:hover { background: var(--red);     color: #fff; }
.action-btn.pay:hover    { background: var(--green);   color: #fff; }

/* Sidebar footer wrapper */
.sidebar-footer {
  flex-shrink: 0;
  margin-top: auto;
}

/* Sidebar overlay — always present but hidden on desktop */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  backdrop-filter: blur(4px);
}
.sidebar-overlay.active,
.sidebar-overlay.show {
  display: block;
}

/* Nav divider inside sidebar */
.nav-divider {
  height: 1px;
  background: var(--dark-3);
  margin: 12px 20px;
  list-style: none;
}

/* User email in sidebar footer */
.user-email {
  color: var(--sidebar-text);
  font-size: 11px;
  display: block;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Finance row variants — missing in original */
.finance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-primary);
}
.finance-row:last-child { border-bottom: none; }
.finance-row.total   { font-weight: 700; font-size: 16px; color: var(--primary); }
.finance-row.profit  { color: var(--green); font-weight: 700; }
.finance-row.pending { color: var(--red); }

/* Utility text colours */
.text-primary-kw { color: var(--primary)  !important; }
.text-blue-kw    { color: var(--blue)     !important; }
.text-green-kw   { color: var(--green)    !important; }
.text-red-kw     { color: var(--red)      !important; }

/* Utility bg colours */
.bg-primary-kw { background-color: var(--primary-light) !important; }
.bg-blue-kw    { background-color: var(--blue-light)    !important; }
.bg-green-kw   { background-color: var(--green-light)   !important; }
.bg-red-kw     { background-color: var(--red-light)     !important; }

/* Font weight utilities */
.fw-500 { font-weight: 500 !important; }
.fw-600 { font-weight: 600 !important; }
.fw-700 { font-weight: 700 !important; }
.fw-800 { font-weight: 800 !important; }

/* Font size utilities */
.fs-11 { font-size: 11px !important; }
.fs-12 { font-size: 12px !important; }
.fs-13 { font-size: 13px !important; }
.fs-14 { font-size: 14px !important; }

/* Override Bootstrap nav-link inside sidebar — safety net */
.sidebar .nav-link {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  transition: all 0.2s;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  gap: 10px;
}
.sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.06);
}
.sidebar .nav-link.active {
  color: var(--primary);
  background: var(--sidebar-active-bg);
  border-left-color: var(--primary);
}

/* Empty state icon fix — CSS defines .empty-state but HTML uses i inside it */
.empty-state i {
  font-size: 40px;
  color: var(--border);
  display: block;
  margin-bottom: 12px;
}

/* =============================================================
   MEGA PATCH — All missing classes from all pages
   ============================================================= */

/* ── STAT CARD VARIANTS (payments.php / expenses.php style) ── */
.stat-card-orange { border-left-color: var(--primary)  !important; }
.stat-card-blue   { border-left-color: var(--blue)     !important; }
.stat-card-green  { border-left-color: var(--green)    !important; }
.stat-card-red    { border-left-color: var(--red)      !important; }

.stat-card-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: var(--primary-light); color: var(--primary);
  flex-shrink: 0;
}
.stat-card-orange .stat-card-icon { background: var(--primary-light); color: var(--primary); }
.stat-card-blue   .stat-card-icon { background: var(--blue-light);    color: var(--blue); }
.stat-card-green  .stat-card-icon { background: var(--green-light);   color: var(--green); }
.stat-card-red    .stat-card-icon { background: var(--red-light);     color: var(--red); }

.stat-card-body { flex: 1; }
.stat-card-value {
  font-size: 22px; font-weight: 700;
  color: var(--text-primary); line-height: 1.2;
}
.stat-card-label {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.4px; color: var(--text-secondary); margin-top: 4px;
}

/* ── HEADER / TOPBAR MISSING CLASSES ── */
.hamburger-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-primary); font-size: 20px; padding: 4px 8px;
  border-radius: var(--radius-sm); transition: all 0.2s;
  line-height: 1; display: flex; align-items: center; justify-content: center;
}
.hamburger-btn:hover { background: var(--primary-light); color: var(--primary); }

.page-title-wrap { line-height: 1.3; }
.page-title {
  font-size: 18px; font-weight: 700; color: var(--text-primary);
  margin: 0; line-height: 1.2;
}
.page-date {
  font-size: 12px; color: var(--text-secondary); display: block; margin-top: 2px;
}
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

.topbar-right {
  display: flex; gap: 10px; align-items: center;
}
.topbar-action { position: relative; }

.btn-quick-add {
  background: var(--primary); color: var(--dark);
  border: none; border-radius: var(--radius-sm);
  padding: 7px 16px; font-weight: 600; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none; transition: all 0.2s; white-space: nowrap;
}
.btn-quick-add:hover {
  background: var(--primary-dark); color: var(--dark); text-decoration: none;
  transform: translateY(-1px); box-shadow: 0 4px 12px rgba(245,166,35,0.4);
}

.topbar-icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--border); background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s; color: var(--text-secondary);
  font-size: 16px; position: relative;
}
.topbar-icon-btn:hover {
  background: var(--primary-light); color: var(--primary); border-color: var(--primary);
}

.topbar-user-btn {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  font-size: 13px; font-weight: 600; color: var(--text-primary);
  transition: all 0.2s;
}
.topbar-user-btn:hover {
  background: var(--primary-light); border-color: var(--primary); color: var(--primary);
}

/* Notification badge */
.notif-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--red); color: white;
  font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 2px solid white;
}

.notif-dropdown {
  min-width: 300px; border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); padding: 0; overflow: hidden;
}
.notif-dropdown .dropdown-header {
  background: var(--body-bg); padding: 12px 16px;
  font-weight: 700; font-size: 13px; color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}
.notif-item { display: flex !important; align-items: center; gap: 10px; padding: 10px 16px !important; }
.notif-item:hover { background: var(--primary-light) !important; }
.notif-text { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.notif-sub   { font-size: 11px; color: var(--text-secondary); margin-top: 2px; }

/* Flash / Alert */
.flash-container {
  padding: 0 24px; position: sticky; top: var(--topbar-height); z-index: 99;
}
.flash-alert {
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  border-top: none; animation: slideDown 0.3s ease;
}
@keyframes slideDown {
  from { transform: translateY(-10px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ── TABLE HEADER VARIANTS ── */
.table-dark-header th {
  background: var(--dark); color: white !important;
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; padding: 12px 16px;
  border-bottom: none;
}
.table-foot-total td {
  background: var(--primary-light); font-weight: 700;
  border-top: 2px solid var(--primary) !important;
}

/* ── FILTER CARD ── */
.filter-card {
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-sm) !important;
}
.filter-card .card-body { background: white; }

/* ── COLOUR UTILITIES ── */
.text-primary-orange { color: var(--primary) !important; }
.text-primary-blue   { color: var(--blue)    !important; }
.text-primary-green  { color: var(--green)   !important; }
.text-primary-red    { color: var(--red)     !important; }

.bg-label-blue   { background: var(--blue-light);    color: var(--blue);    border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 600; }
.bg-label-orange { background: var(--primary-light); color: var(--primary); border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 600; }
.bg-label-green  { background: var(--green-light);   color: var(--green);   border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 600; }
.bg-label-red    { background: var(--red-light);     color: var(--red);     border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 600; }

/* ── REPORTS PAGE ── */
.report-tab-content { min-height: 400px; }
.no-print { /* handled in print media query */ }

/* ── Bootstrap overrides for consistency ── */
.card { border-radius: var(--radius) !important; box-shadow: var(--shadow-sm) !important; border: 1px solid var(--border) !important; }
.card-header { background: #fff !important; border-bottom: 1px solid var(--border) !important; font-weight: 600; }
.btn-primary  { background-color: var(--primary) !important; border-color: var(--primary) !important; color: var(--dark) !important; font-weight: 600 !important; }
.btn-primary:hover { background-color: var(--primary-dark) !important; border-color: var(--primary-dark) !important; }
.nav-tabs .nav-link { color: var(--text-secondary); font-weight: 500; }
.nav-tabs .nav-link.active { color: var(--primary); border-bottom-color: var(--primary) !important; font-weight: 700; }
.nav-tabs .nav-link:hover { color: var(--primary); }
.badge { font-size: 11px !important; font-weight: 600 !important; }
.table > :not(caption) > * > * { padding: 12px 14px; }
.table-hover > tbody > tr:hover > * { background-color: #FAFAFA; }

/* ── Page h1 title (used by payments, expenses, reports) ── */
h1.page-title {
  font-size: 22px; font-weight: 700;
  color: var(--text-primary); margin: 0; line-height: 1.2;
}

/* ── Responsive patch ── */
@media (max-width: 768px) {
  .flash-container { padding: 0 16px; }
  .btn-quick-add span { display: none; }
  .notif-dropdown { min-width: 260px; }
}
