/* ─── S.A. Sales — Cash Collection System ──────────────────── */
:root {
  --primary:      #1b3a6b;
  --primary-dk:   #0f2347;
  --primary-lt:   #2a5298;
  --accent:       #38bdf8;
  --accent-dk:    #0ea5e9;
  --accent-lt:    #e0f2fe;
  --sidebar-bg:   #0f2347;
  --sidebar-txt:  #94c8e8;
  --sidebar-act:  #38bdf8;
  --body-bg:      #f0f4f8;
  --card-bg:      #ffffff;
  --border:       #dce6f0;
  --border-dk:    #b8cfe0;
  --text:         #1e293b;
  --text-muted:   #64748b;
  --success:      #16a34a;
  --success-lt:   #dcfce7;
  --danger:       #dc2626;
  --danger-lt:    #fee2e2;
  --warning:      #d97706;
  --warning-lt:   #fef3c7;
  --info:         #2563eb;
  --info-lt:      #dbeafe;
  --shadow-sm:    0 1px 4px rgba(15,35,71,.08);
  --shadow:       0 2px 12px rgba(15,35,71,.10);
  --shadow-lg:    0 8px 30px rgba(15,35,71,.15);
  --radius:       10px;
  --radius-sm:    6px;
  --transition:   .18s ease;
  --sidebar-w:    252px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--body-bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-dk); text-decoration: none; }
a:hover { color: var(--primary); }

/* ─── Layout ─────────────────────────────────────────────────── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ─── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--transition);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.sidebar-brand {
  padding: 18px 16px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 64px;
}
.sidebar-brand img {
  width: 36px; height: 36px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
  background: rgba(56,189,248,.1);
}
.sidebar-brand-name { color: #fff; font-weight: 700; font-size: 14px; line-height: 1.2; }
.sidebar-brand-sub  { color: var(--sidebar-txt); font-size: 10px; font-weight: 400; margin-top: 1px; }

.sidebar-nav { padding: 10px 0; flex: 1; }
.nav-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: rgba(148,200,232,.4);
  padding: 14px 16px 4px;
}
.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 16px;
  color: var(--sidebar-txt);
  font-size: 13px;
  border-left: 3px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}
.nav-link:hover { background: rgba(56,189,248,.08); color: #fff; }
.nav-link.active { background: rgba(56,189,248,.13); color: var(--sidebar-act); border-left-color: var(--sidebar-act); font-weight: 600; }
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .85; }
.nav-link.active svg { opacity: 1; }
.nav-badge {
  margin-left: auto; background: var(--danger);
  color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 20px; min-width: 18px; text-align: center;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.sidebar-user { display: flex; align-items: center; gap: 9px; }
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.sidebar-user-name { color: #fff; font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { color: var(--sidebar-txt); font-size: 10px; }
.logout-btn {
  margin-left: auto; color: var(--sidebar-txt);
  background: none; border: none; cursor: pointer;
  padding: 5px; border-radius: 5px;
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.logout-btn:hover { color: #fff; background: var(--danger); }

/* ─── Overlay ────────────────────────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 999;
}
.sidebar-overlay.open { display: block; }

/* ─── Main Content ───────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* ─── Topbar ─────────────────────────────────────────────────── */
.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 22px;
  height: 56px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.topbar-left  { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.menu-toggle  { display: none; background: none; border: none; cursor: pointer; padding: 6px; border-radius: 6px; color: var(--text); }
.menu-toggle:hover { background: var(--body-bg); }
.page-title   { font-size: 16px; font-weight: 700; color: var(--primary); }

/* ─── Content Area ───────────────────────────────────────────── */
.content-area { padding: 22px; flex: 1; }

/* ─── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
}
.card-title { font-size: 14px; font-weight: 700; color: var(--primary); }
.card-body  { padding: 20px; }

/* ─── Stat Cards ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px,1fr));
  gap: 15px; margin-bottom: 22px;
}
.stat-card {
  background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid var(--border);
  padding: 16px 18px; display: flex; align-items: center; gap: 14px;
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 21px; height: 21px; }
.si-blue   { background: var(--info-lt);    color: #1d4ed8; }
.si-green  { background: var(--success-lt); color: #15803d; }
.si-orange { background: var(--warning-lt); color: #b45309; }
.si-cyan   { background: var(--accent-lt);  color: #0369a1; }
.si-red    { background: var(--danger-lt);  color: #b91c1c; }
.si-purple { background: #ede9fe;           color: #6d28d9; }
.si-navy   { background: var(--info-lt);    color: var(--primary); }
.stat-value { font-size: 20px; font-weight: 700; color: var(--primary); line-height: 1.1; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ─── Tables ─────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 500px; }
thead th {
  background: #f8fafc; color: var(--primary);
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 10px 14px; border-bottom: 2px solid var(--border); white-space: nowrap;
}
tbody tr { border-bottom: 1px solid #f1f5f9; transition: background var(--transition); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }
tbody tr.credit-exceeded { background: #fffbeb; }
tbody tr.credit-exceeded:hover { background: #fef3c7; }
td { padding: 10px 14px; font-size: 13px; vertical-align: middle; }
.text-right  { text-align: right !important; }
.text-center { text-align: center !important; }

/* ─── Badges ─────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge-warning   { background: var(--warning-lt); color: #92400e; }
.badge-success   { background: var(--success-lt); color: #166534; }
.badge-danger    { background: var(--danger-lt);  color: #991b1b; }
.badge-info      { background: var(--info-lt);    color: #1e40af; }
.badge-secondary { background: #f1f5f9;           color: #475569; }
.badge-wa        { background: #dcfce7; color: #166534; }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: 1.5px solid transparent;
  transition: all var(--transition); white-space: nowrap;
  text-decoration: none; line-height: 1.4;
  font-family: inherit;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-dk); color: #fff; border-color: var(--primary-dk); }
.btn-accent  { background: var(--accent); color: var(--primary); border-color: var(--accent); }
.btn-accent:hover:not(:disabled)  { background: var(--accent-dk); color: #fff; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover:not(:disabled) { background: #15803d; color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled)  { background: #b91c1c; color: #fff; }
.btn-warning { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.btn-warning:hover:not(:disabled) { background: var(--warning); color: #fff; }
.btn-outline { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover:not(:disabled) { background: var(--primary); color: #fff; }
.btn-whatsapp { background: #25d366; color: #fff; border-color: #25d366; }
.btn-whatsapp:hover:not(:disabled) { background: #1ebe5c; color: #fff; }
.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-xs  { padding: 4px 9px;  font-size: 11px; }
.btn-icon{ padding: 6px; border-radius: 6px; }

/* ─── Forms ──────────────────────────────────────────────────── */
.form-group  { margin-bottom: 16px; }
.form-label  { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.required    { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13.5px; color: var(--text); background: #fff;
  transition: border-color var(--transition), box-shadow var(--transition);
  font-family: inherit; appearance: none;
}
.form-control:focus { outline: none; border-color: var(--accent-dk); box-shadow: 0 0 0 3px rgba(56,189,248,.15); }
.form-control.is-invalid { border-color: var(--danger); }
.form-control:disabled, .form-control[readonly] { background: #f8fafc; color: var(--text-muted); cursor: not-allowed; }
select.form-control { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%2364748b' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-error { font-size: 11.5px; color: var(--danger); margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.form-hint  { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

.form-row   { display: grid; grid-template-columns: repeat(auto-fit,minmax(200px,1fr)); gap: 14px; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* Error list box */
.error-box {
  background: var(--danger-lt); border: 1.5px solid #fca5a5;
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 18px;
}
.error-box p { color: #991b1b; font-size: 13px; margin: 2px 0; }

/* ─── Amount Breakdown ───────────────────────────────────────── */
.amount-box {
  background: #f8fafc; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 4px;
}
.amount-box .ab-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.amount-box .ab-row:last-child { font-weight: 700; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; margin-bottom: 0; }
.amount-box.match   { border-color: var(--success); }
.amount-box.mismatch{ border-color: var(--danger); }

/* ─── Credit Warning ─────────────────────────────────────────── */
.credit-warn {
  background: #fffbeb; border: 1.5px solid #f59e0b;
  border-radius: var(--radius-sm); padding: 10px 13px;
  display: flex; align-items: flex-start; gap: 9px; margin-top: 8px;
}
.credit-warn-icon { color: #d97706; flex-shrink: 0; margin-top: 1px; }
.credit-warn-text strong { display: block; color: #92400e; font-size: 13px; }
.credit-warn-text span   { color: #78350f; font-size: 12px; }

/* ─── Filter Bar ─────────────────────────────────────────────── */
.filter-bar { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.filter-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.fg { display: flex; flex-direction: column; gap: 3px; min-width: 148px; }
.fg label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.fg .form-control { padding: 7px 10px; font-size: 12.5px; }

/* ─── Pagination ─────────────────────────────────────────────── */
.pg-wrap { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); }
.pg-info { font-size: 12px; color: var(--text-muted); }
.pagination { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.page-btn {
  padding: 5px 10px; border: 1.5px solid var(--border);
  border-radius: 5px; font-size: 12.5px; font-weight: 500;
  color: var(--primary); background: #fff; cursor: pointer;
  transition: all var(--transition); text-decoration: none; line-height: 1.4;
}
.page-btn:hover      { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn.active     { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }
.page-btn.disabled   { opacity: .38; pointer-events: none; }

/* ─── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.52);
  z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  opacity: 0; visibility: hidden;
  transition: opacity var(--transition), visibility var(--transition);
}
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal {
  background: #fff; border-radius: var(--radius);
  width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(.94) translateY(-12px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 14px; font-weight: 700; color: var(--primary); }
.modal-close { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; border-radius: 4px; font-size: 16px; }
.modal-close:hover { color: var(--danger); background: var(--danger-lt); }
.modal-body   { padding: 18px; }
.modal-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ─── Toast ──────────────────────────────────────────────────── */
#toast-container { position: fixed; top: 18px; right: 18px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 11px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px;
  min-width: 240px; max-width: 360px;
  animation: toastIn .28s ease;
}
@keyframes toastIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-success { background: #f0fdf4; color: #166534; border-left: 4px solid var(--success); }
.toast-error   { background: #fef2f2; color: #991b1b; border-left: 4px solid var(--danger); }
.toast-warning { background: #fffbeb; color: #92400e; border-left: 4px solid #f59e0b; }
.toast-info    { background: #eff6ff; color: #1e40af; border-left: 4px solid var(--info); }
.toast-icon    { font-size: 15px; flex-shrink: 0; }

/* ─── Alert Banner ───────────────────────────────────────────── */
.alert { border-radius: var(--radius-sm); padding: 12px 15px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; font-size: 13px; }
.alert-warning { background: #fffbeb; border: 1.5px solid #f59e0b; color: #92400e; }
.alert-info    { background: #eff6ff; border: 1.5px solid #93c5fd; color: #1e40af; }
.alert-success { background: #f0fdf4; border: 1.5px solid #86efac; color: #166534; }
.alert-danger  { background: var(--danger-lt); border: 1.5px solid #fca5a5; color: #991b1b; }

/* ─── Info Sections (View detail) ───────────────────────────── */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.info-item label { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 3px; }
.info-item span  { font-size: 13.5px; font-weight: 600; color: var(--text); display: block; }

/* ─── Amount summary box ─────────────────────────────────────── */
.amt-summary { background: #f8fafc; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; }
.amt-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.amt-row.total { border-top: 1px solid var(--border); padding-top: 8px; margin-top: 4px; font-weight: 700; font-size: 14px; color: var(--primary); }

/* ─── Receipt Page ───────────────────────────────────────────── */
.receipt-wrapper { max-width: 660px; margin: 0 auto; padding: 24px 16px; }
.receipt-card { background: #fff; border-radius: 14px; box-shadow: 0 4px 30px rgba(0,0,0,.12); overflow: hidden; }
.receipt-head { background: var(--primary); color: #fff; padding: 22px 28px; display: flex; align-items: center; gap: 16px; }
.receipt-head img { width: 54px; height: 54px; border-radius: 8px; object-fit: contain; background: rgba(255,255,255,.1); padding: 4px; flex-shrink: 0; }
.receipt-firm   { font-size: 19px; font-weight: 800; color: #fff; }
.receipt-tagline{ font-size: 11px; color: var(--accent); margin-top: 2px; }
.receipt-addr   { font-size: 11px; color: rgba(255,255,255,.7); margin-top: 4px; line-height: 1.5; }
.receipt-body { padding: 24px 28px; }
.receipt-memo-row { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 16px; border-bottom: 2px dashed var(--border); margin-bottom: 18px; }
.receipt-memo-no  { font-size: 18px; font-weight: 800; color: var(--primary); }
.receipt-meta     { font-size: 12px; color: var(--text-muted); text-align: right; }
.receipt-amt-box  { background: var(--primary); border-radius: 10px; padding: 16px; text-align: center; margin-bottom: 20px; }
.receipt-amt-lbl  { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 700; }
.receipt-amt-val  { font-size: 32px; font-weight: 800; color: var(--accent); line-height: 1.1; }
.receipt-amt-mode { font-size: 11px; color: rgba(255,255,255,.7); margin-top: 4px; }
.receipt-section-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: 8px; margin-top: 16px; }
.receipt-breakdown { background: #f8fafc; border-radius: 8px; padding: 12px 16px; margin-bottom: 4px; }
.receipt-br-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.receipt-br-row.total { font-weight: 700; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; }
.receipt-foot { background: #f8fafc; padding: 14px 28px; text-align: center; border-top: 1px solid var(--border); }
.receipt-foot p { font-size: 11px; color: var(--text-muted); }

/* ─── Login Page ─────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; background: linear-gradient(145deg, var(--primary) 0%, #0f2347 55%, #061425 100%); display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box  { background: #fff; border-radius: 16px; padding: 38px 34px; width: 100%; max-width: 400px; box-shadow: 0 24px 64px rgba(0,0,0,.45); }
.login-logo { text-align: center; margin-bottom: 26px; }
.login-logo img { width: 64px; height: 64px; border-radius: 12px; object-fit: contain; }
.login-logo h1  { font-size: 20px; font-weight: 800; color: var(--primary); margin-top: 10px; }
.login-logo p   { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ─── Empty State ────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 44px 20px; color: var(--text-muted); }
.empty-state svg { width: 44px; height: 44px; margin: 0 auto 12px; opacity: .25; display: block; }
.empty-state p { font-size: 14px; }

/* ─── Utilities ──────────────────────────────────────────────── */
.d-flex    { display: flex; }
.ai-center { align-items: center; }
.gap-8     { gap: 8px; }
.gap-12    { gap: 12px; }
.mt-3      { margin-top: 12px; }
.mt-4      { margin-top: 16px; }
.mb-3      { margin-bottom: 12px; }
.mb-4      { margin-bottom: 16px; }
.fw-bold   { font-weight: 700; }
.fw-600    { font-weight: 600; }
.fs-12     { font-size: 12px; }
.fs-13     { font-size: 13px; }
.text-danger  { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-accent  { color: var(--accent-dk) !important; }
.w-100 { width: 100%; }

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-content { margin-left: 0; }
  .menu-toggle { display: flex; }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .content-area { padding: 14px; }
  .filter-row { flex-direction: column; }
  .fg { min-width: 100%; }
  td, th { padding: 8px 10px; }
  .card-header { flex-direction: column; align-items: flex-start; }
  .receipt-body { padding: 18px; }
  .receipt-head { padding: 18px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-box  { padding: 26px 18px; }
  .form-row   { grid-template-columns: 1fr; }
  .receipt-memo-row { flex-direction: column; gap: 8px; }
  .receipt-meta { text-align: left; }
}

/* ─── Print Styles ───────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .no-print, #toast-container { display: none !important; }
  .main-content { margin-left: 0 !important; }
  body { background: #fff !important; }
  .receipt-card { box-shadow: none !important; border: 1px solid #ddd; }
  .content-area { padding: 0 !important; }
}

/* ============================================================
   ADDITIONAL STYLES — Payment views, Receipt, Users, Settings
   ============================================================ */

/* Summary Strip */
.summary-strip {
    display: flex;
    gap: 1rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.summary-item { display: flex; flex-direction: column; gap: 0.15rem; }
.summary-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.summary-value { font-size: 1rem; font-weight: 700; color: var(--text-primary); }

/* Mode badges */
.mode-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: .03em;
}
.mode-cash   { background: #dcfce7; color: #166534; }
.mode-upi    { background: #ede9fe; color: #5b21b6; }
.mode-mixed  { background: #fef9c3; color: #713f12; }

/* Memo link */
.memo-link { font-weight: 600; color: var(--primary); text-decoration: none; font-family: monospace; }
.memo-link:hover { text-decoration: underline; }

/* Mode selector */
.mode-selector { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.mode-option { cursor: pointer; }
.mode-option input[type=radio] { display: none; }
.mode-label {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.5rem 1.1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
    transition: all .15s;
    cursor: pointer;
}
.mode-option input:checked + .mode-label {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

/* Customer info strip */
.customer-info-strip {
    display: flex;
    gap: 1.5rem;
    background: var(--bg-light);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}
.info-item { display: flex; flex-direction: column; gap: 0.1rem; }
.info-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; }
.info-value { font-size: 0.95rem; font-weight: 600; }

/* Credit warning */
.credit-warning {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: #fef9c3;
    border: 1px solid #fde047;
    border-radius: 8px;
    padding: 0.85rem 1rem;
    margin-top: 0.75rem;
    color: #713f12;
}
.credit-warning svg { flex-shrink: 0; margin-top: 2px; }
.credit-warning p { margin: 0.25rem 0 0; font-size: 0.88rem; }

/* Amount breakdown */
.amount-breakdown {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    margin-top: 0.5rem;
}
.breakdown-row {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.breakdown-total { border-top: 1px dashed var(--border); margin-top: 0.25rem; padding-top: 0.4rem; font-weight: 600; }
.breakdown-entered { font-weight: 600; color: var(--text-primary); }
.amount-match-msg { margin-top: 0.4rem; font-size: 0.85rem; font-weight: 600; }
.amount-match-msg.match { color: #166534; }
.amount-match-msg.mismatch { color: #b91c1c; }

/* Detail layout */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.25rem;
    align-items: start;
}
@media (max-width: 900px) { .detail-layout { grid-template-columns: 1fr; } }

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}
.detail-item { display: flex; flex-direction: column; gap: 0.25rem; }
.detail-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.detail-value { font-size: 0.95rem; color: var(--text-primary); font-weight: 500; }
.detail-value.mono { font-family: monospace; }

/* Amount detail box */
.amount-detail-box {
    background: linear-gradient(135deg, var(--primary-light) 0%, #f0f9ff 100%);
    border: 1px solid var(--primary);
    border-radius: 10px;
    padding: 1rem;
}
.amount-detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    font-size: 0.92rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(56,189,248,.2);
}
.amount-detail-row:last-child { border-bottom: none; }
.amount-detail-row.total-row { padding-top: 0.6rem; font-size: 1.05rem; color: var(--primary); }
.amount-detail-row.sub-row { padding-left: 1rem; }

/* Remarks box */
.remarks-box { background: var(--bg-light); border-radius: 8px; padding: 0.75rem 1rem; }
.remarks-text { margin: 0.3rem 0 0; color: var(--text-secondary); font-size: 0.92rem; }

/* Status banner */
.status-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.1rem;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid var(--border);
}
.status-banner-text { font-size: 0.92rem; color: var(--text-secondary); }
.status-banner.status-approved     { background: #dcfce7; border-color: #86efac; }
.status-banner.status-rejected     { background: #fee2e2; border-color: #fca5a5; }
.status-banner.status-pending_approval { background: #fef9c3; border-color: #fde047; }
.status-banner.status-modified     { background: #ede9fe; border-color: #c4b5fd; }

/* Tab bar */
.tab-bar { display: flex; gap: 0.25rem; border-bottom: 2px solid var(--border); }
.tab-btn {
    padding: 0.65rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    display: flex; align-items: center; gap: 0.4rem;
    transition: all .15s;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--border);
    color: var(--text-secondary);
}
.tab-badge.badge-danger { background: #fee2e2; color: #b91c1c; }

/* Receipt public view */
.receipt-body { padding: 1.5rem 2rem; }
.receipt-header {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}
.receipt-logo { max-height: 64px; object-fit: contain; }
.receipt-firm h1 { font-size: 1.3rem; color: var(--navy); margin: 0 0 0.25rem; }
.receipt-firm p { margin: 0.1rem 0; font-size: 0.82rem; color: var(--text-secondary); }
.receipt-divider { border: none; border-top: 1.5px solid var(--border); margin: 1rem 0; }
.receipt-title-row { display: flex; justify-content: space-between; align-items: flex-start; }
.receipt-title { font-size: 1.25rem; font-weight: 800; color: var(--navy); margin: 0 0 0.25rem; letter-spacing: .05em; }
.receipt-memo { font-family: monospace; color: var(--primary); font-size: 0.95rem; margin: 0; }
.receipt-status-block { text-align: right; }
.receipt-date { font-size: 0.88rem; color: var(--text-muted); margin: 0.3rem 0 0; }
.receipt-section-title { font-size: 0.75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); margin: 0 0 0.6rem; font-weight: 600; }
.receipt-customer { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.receipt-field { display: flex; flex-direction: column; gap: 0.1rem; }
.receipt-label { font-size: 0.72rem; color: var(--text-muted); }
.receipt-val { font-size: 0.92rem; font-weight: 500; color: var(--text-primary); }
.receipt-total-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--primary);
    color: #fff;
    border-radius: 10px;
    padding: 1rem 1.5rem;
    margin: 1rem 0;
}
.receipt-total-label { font-size: 0.88rem; opacity: .85; }
.receipt-total-value { font-size: 1.5rem; font-weight: 800; }
.receipt-footer { display: flex; justify-content: space-between; align-items: flex-end; margin: 1.25rem 0 0; }
.receipt-qr { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.receipt-qr img { max-height: 80px; }
.receipt-qr small { font-size: 0.7rem; color: var(--text-muted); }
.receipt-sign { text-align: right; }
.receipt-sign-line { border-top: 1.5px solid var(--text-muted); width: 140px; margin: 0 0 0.3rem auto; }
.receipt-sign p { margin: 0.1rem 0; font-size: 0.8rem; color: var(--text-secondary); }
.receipt-note { text-align: center; margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--border); }
.receipt-note small { color: var(--text-muted); font-size: 0.75rem; }

/* Role badges */
.role-badge {
    display: inline-block;
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}
.role-super_admin { background: #fef9c3; color: #713f12; }
.role-admin       { background: #e0f2fe; color: #075985; }
.role-manager     { background: #ede9fe; color: #5b21b6; }
.role-cashier     { background: #dcfce7; color: #166534; }

/* User avatar cell */
.user-avatar-cell { display: flex; align-items: center; gap: 0.6rem; }
.avatar-circle {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.82rem; }
.text-cyan { color: var(--primary); }

/* Role info grid */
.role-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}
.role-info-item { background: var(--bg-light); border-radius: 8px; padding: 0.75rem; }
.role-info-item p { margin: 0.3rem 0 0; font-size: 0.82rem; color: var(--text-secondary); }

/* Activity log */
.log-action { font-family: monospace; font-size: 0.85rem; background: var(--bg-light); padding: 0.15rem 0.5rem; border-radius: 4px; color: var(--text-primary); }

/* Receipt link box */
.receipt-link-box input { font-family: monospace; font-size: 0.8rem; }

/* WhatsApp button */
.btn-whatsapp {
    display: inline-flex; align-items: center; gap: 0.4rem;
    background: #25d366;
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
    text-decoration: none;
}
.btn-whatsapp:hover { background: #1ebe5d; color: #fff; }

/* Totals row in table */
.totals-row td {
    background: var(--primary-light);
    font-weight: 600;
    border-top: 2px solid var(--primary);
}

/* Inactive row */
.row-inactive td { opacity: .6; }

/* Stat icon colors for reports */
.stat-icon-red    { background: #fee2e2; color: #b91c1c; }
.stat-icon-cyan   { background: var(--primary-light); color: var(--primary); }
.stat-icon-navy   { background: #e0f2fe; color: var(--navy); }

/* current image preview */
.current-image { display: inline-block; }
.d-block { display: block !important; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }

/* form-layout */
.form-layout { max-width: 860px; }

/* Alert styles */
.alert {
    display: flex; align-items: flex-start; gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    border-radius: 10px;
    font-size: 0.92rem;
}
.alert-warning { background: #fef9c3; border: 1px solid #fde047; color: #713f12; }
.alert-danger  { background: #fee2e2; border: 1px solid #fca5a5; color: #b91c1c; }
.alert-info    { background: #e0f2fe; border: 1px solid #7dd3fc; color: #075985; }
.alert p       { margin: 0.25rem 0 0; font-size: 0.88rem; }


/* ─── FIXES — v1.1 ─────────────────────────────────────────── */

/* Missing CSS variables used in extra styles */
:root {
  --primary-light: #e0f2fe;
  --primary-dk:    #0f2347;
  --navy:          #1b3a6b;
  --bg-light:      #f8fafc;
  --text-primary:  #1e293b;
  --text-secondary:#475569;
  --stat-icon-purple: #ede9fe;
}
.si-purple { background: #ede9fe; color: #6d28d9; }

/* Sidebar open state — critical for mobile menu */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .menu-toggle { display: flex !important; align-items: center; justify-content: center; }
}
@media (min-width: 769px) {
  .menu-toggle { display: none !important; }
  .sidebar-overlay { display: none !important; }
}

/* Detail cols responsive */
.detail-cols { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
@media (max-width: 900px) { .detail-cols { grid-template-columns: 1fr !important; } }

/* btn-whatsapp */
.btn-whatsapp { background: #25d366; color: #fff; border-color: #25d366; }
.btn-whatsapp:hover { background: #1ebe5d; color: #fff; }

/* Alert */
.alert { border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 14px; font-size: 13px; display: flex; align-items: flex-start; gap: 8px; }
.alert-warning { background: #fffbeb; border: 1.5px solid #f59e0b; color: #92400e; }
.alert-info    { background: #eff6ff; border: 1.5px solid #93c5fd; color: #1e40af; }
.alert-success { background: #f0fdf4; border: 1.5px solid #86efac; color: #166534; }
.alert-danger  { background: #fee2e2; border: 1.5px solid #fca5a5; color: #991b1b; }

/* Modal open = flex */
.modal-overlay.open { display: flex !important; }
.modal-overlay { display: none; }

/* flex utilities */
.flex-wrap { flex-wrap: wrap; }
