/* ═══════════════════════════════════════════
   Business Panel – Main Stylesheet
   ═══════════════════════════════════════════ */

:root {
  --sidebar-w:   260px;
  --header-h:    64px;

  --grad-primary:  linear-gradient(135deg,#667eea 0%,#764ba2 100%);
  --grad-danger:   linear-gradient(135deg,#f5576c 0%,#f093fb 100%);
  --grad-success:  linear-gradient(135deg,#43e97b 0%,#38f9d7 100%);
  --grad-info:     linear-gradient(135deg,#4facfe 0%,#00f2fe 100%);
  --grad-warning:  linear-gradient(135deg,#f7971e 0%,#ffd200 100%);
  --grad-dark:     linear-gradient(135deg,#2c3e50 0%,#4ca1af 100%);

  --c-primary:     #667eea;
  --c-sidebar:     #0f172a;
  --c-bg:          #f1f5f9;
  --c-card:        #ffffff;
  --c-text:        #1e293b;
  --c-muted:       #64748b;
  --c-border:      #e2e8f0;
  --c-hover:       #f8fafc;

  --radius:  12px;
  --radius-s: 8px;
  --shadow:  0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.15);
}

/* ── Reset ─────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
}
a { text-decoration: none; }
img { max-width: 100%; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ── LOGIN ─────────────────────────────────── */
#login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--grad-primary);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
#login-view::before {
  content: '';
  position: absolute;
  top: -120px; right: -120px;
  width: 400px; height: 400px;
  background: rgba(255,255,255,.08);
  border-radius: 50%;
}
#login-view::after {
  content: '';
  position: absolute;
  bottom: -80px; left: -80px;
  width: 300px; height: 300px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
}
.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}
.login-logo {
  width: 64px; height: 64px;
  border-radius: 16px;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: #fff;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(102,126,234,.4);
  overflow: hidden;
}
.login-title {
  font-size: 22px; font-weight: 800;
  text-align: center; color: var(--c-text);
  margin-bottom: 4px;
}
.login-sub {
  text-align: center; color: var(--c-muted);
  font-size: 13px; margin-bottom: 28px;
}
.login-hint {
  text-align: center; margin-top: 20px;
  font-size: 12px; color: var(--c-muted);
  background: var(--c-hover); border-radius: 8px; padding: 10px;
}

/* ── APP SHELL ─────────────────────────────── */
#app-view { display: flex; min-height: 100vh; }

/* ── SIDEBAR ───────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--c-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform .3s ease;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff; flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(102,126,234,.5);
  overflow: hidden;
}
.brand-icon img, .login-logo img {
  width: 100%; height: 100%; object-fit: contain;
}
.brand-text { line-height: 1.2; }
.brand-name { color: #fff; font-size: 16px; font-weight: 700; letter-spacing: -.3px; }
.brand-tag  { color: rgba(255,255,255,.4); font-size: 11px; }

.sidebar-nav { padding: 16px 12px; flex: 1; }

.nav-label {
  color: rgba(255,255,255,.28);
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  padding: 14px 8px 6px;
  display: block;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px;
  border-radius: var(--radius-s);
  color: rgba(255,255,255,.65);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  margin-bottom: 2px;
  transition: all .18s ease;
  border: none; background: none; width: 100%; text-align: left;
  text-decoration: none;
}
.nav-item i { font-size: 17px; width: 18px; flex-shrink: 0; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(102,126,234,.45);
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-s);
  background: rgba(255,255,255,.06);
}
.user-chip-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.user-chip-name { color: #fff; font-size: 13px; font-weight: 600; }
.user-chip-role { color: rgba(255,255,255,.4); font-size: 11px; }
.btn-logout {
  margin-left: auto; padding: 4px 8px;
  background: rgba(255,255,255,.1); border: none;
  border-radius: 6px; color: rgba(255,255,255,.6);
  cursor: pointer; font-size: 16px;
  transition: all .15s;
}
.btn-logout:hover { background: rgba(245,87,108,.3); color: #f5576c; }

/* ── MAIN CONTENT ──────────────────────────── */
.main-wrap {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOP HEADER ────────────────────────────── */
.top-header {
  position: sticky; top: 0;
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  z-index: 100;
  box-shadow: 0 1px 8px rgba(0,0,0,.05);
}
.header-left { display: flex; align-items: center; gap: 14px; min-width: 0; }
.header-left h1 {
  font-size: 19px; font-weight: 700; color: var(--c-text);
  letter-spacing: -.3px;
}
.header-left p { font-size: 12px; color: var(--c-muted); }
.header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

/* Hidden on desktop — the sidebar is always visible there. */
.hamburger-btn {
  display: none;
  width: 38px; height: 38px; flex-shrink: 0;
  align-items: center; justify-content: center;
  border: 1px solid var(--c-border); background: #fff;
  border-radius: var(--radius-s);
  font-size: 19px; color: var(--c-text);
  cursor: pointer;
}
.hamburger-btn:hover { background: var(--c-hover); }

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  z-index: 190;
}
.sidebar-backdrop.show { display: block; }

.header-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px;
  background: var(--c-hover); border: 1px solid var(--c-border);
  font-size: 13px; color: var(--c-muted); font-weight: 500;
}
.header-badge i { color: var(--c-primary); }

/* ── CONTENT AREA ──────────────────────────── */
.content { padding: 24px 28px; flex: 1; }
.page-section { display: none; }
.page-section.active { display: block; }

/* ── STAT CARDS ────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}
.stats-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat-card {
  border-radius: var(--radius);
  padding: 24px 22px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
}
.stat-card::after {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 120px; height: 120px;
  background: rgba(255,255,255,.1);
  border-radius: 50%;
}
.stat-card::before {
  content: '';
  position: absolute;
  bottom: -40px; left: 20px;
  width: 90px; height: 90px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
}
.stat-card.c1 { background: var(--grad-primary); }
.stat-card.c2 { background: var(--grad-danger);  }
.stat-card.c3 { background: var(--grad-info);    }
.stat-card.c4 { background: var(--grad-success); }
.stat-card.c5 { background: var(--grad-warning); }
.stat-icon  { font-size: 30px; opacity: .9; margin-bottom: 14px; position: relative; z-index: 1; }
.stat-val   { font-size: 26px; font-weight: 800; margin-bottom: 2px; position: relative; z-index: 1; letter-spacing: -.5px; }
.stat-label { font-size: 12.5px; opacity: .85; position: relative; z-index: 1; font-weight: 500; }

/* ── CARD ──────────────────────────────────── */
.card {
  background: var(--c-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 24px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--c-border);
}
.card-head h2 { font-size: 16px; font-weight: 700; color: var(--c-text); }
.card-head p  { font-size: 12px; color: var(--c-muted); margin-top: 2px; }
.card-body  { padding: 22px; }
.card-actions { display: flex; gap: 10px; align-items: center; }

/* ── TABLE ─────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: #f8fafc;
  padding: 11px 16px;
  text-align: left;
  font-size: 11.5px; font-weight: 700;
  color: var(--c-muted);
  text-transform: uppercase; letter-spacing: .6px;
  border-bottom: 1px solid var(--c-border);
  white-space: nowrap;
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--c-border);
  color: var(--c-text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--c-hover); }
.td-actions { display: flex; gap: 6px; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ── BUTTONS ───────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 18px;
  border-radius: var(--radius-s);
  border: none; cursor: pointer;
  font-size: 13.5px; font-weight: 600;
  transition: all .2s ease;
  white-space: nowrap;
  line-height: 1;
}
.btn i { font-size: 15px; }

.btn-primary { background: var(--grad-primary); color: #fff; box-shadow: 0 4px 12px rgba(102,126,234,.35); }
.btn-primary:hover { box-shadow: 0 6px 18px rgba(102,126,234,.5); transform: translateY(-1px); }

.btn-success { background: var(--grad-success); color: #fff; box-shadow: 0 4px 12px rgba(67,233,123,.3); }
.btn-success:hover { box-shadow: 0 6px 18px rgba(67,233,123,.45); transform: translateY(-1px); }

.btn-danger  { background: var(--grad-danger);  color: #fff; box-shadow: 0 4px 12px rgba(245,87,108,.3); }
.btn-danger:hover  { box-shadow: 0 6px 18px rgba(245,87,108,.45); transform: translateY(-1px); }

.btn-info    { background: var(--grad-info);    color: #fff; box-shadow: 0 4px 12px rgba(79,172,254,.3); }
.btn-info:hover    { box-shadow: 0 6px 18px rgba(79,172,254,.45); transform: translateY(-1px); }

.btn-warning { background: var(--grad-warning); color: #fff; box-shadow: 0 4px 12px rgba(247,151,30,.3); }
.btn-warning:hover { box-shadow: 0 6px 18px rgba(247,151,30,.45); transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--c-border);
  color: var(--c-muted);
}
.btn-outline:hover { background: var(--c-hover); color: var(--c-text); }

.btn-ghost {
  background: transparent; border: none; color: var(--c-muted); padding: 8px 10px;
}
.btn-ghost:hover { color: var(--c-text); background: var(--c-hover); border-radius: var(--radius-s); }

.btn-sm  { padding: 5px 12px; font-size: 12.5px; }
.btn-lg  { padding: 12px 28px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon {
  width: 32px; height: 32px;
  padding: 0; justify-content: center; align-items: center;
  border-radius: var(--radius-s);
}
.btn-icon.btn-sm { width: 28px; height: 28px; }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none !important; }

/* ── FORM ──────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12.5px; font-weight: 700;
  color: var(--c-text); margin-bottom: 6px;
  letter-spacing: .2px;
}
.form-label .req { color: #f5576c; margin-left: 2px; }

.form-control {
  width: 100%;
  padding: 9px 13px;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-s);
  color: var(--c-text);
  background: #fff;
  transition: border-color .18s, box-shadow .18s;
  outline: none;
  appearance: none;
}
.form-control:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(102,126,234,.15);
}
.form-control[readonly] { background: var(--c-hover); }
.form-control.error { border-color: #f5576c; box-shadow: 0 0 0 3px rgba(245,87,108,.12); }

.input-group { display: flex; gap: 0; }
.input-group .form-control { border-radius: var(--radius-s) 0 0 var(--radius-s); }
.input-group .btn { border-radius: 0 var(--radius-s) var(--radius-s) 0; padding-left: 14px; padding-right: 14px; }

.form-hint { font-size: 12px; color: var(--c-muted); margin-top: 5px; }

.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* Pairs of full settings cards side by side (Settings page) — each card
   keeps its own height, so a taller neighbor doesn't stretch a shorter one. */
.settings-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; align-items: start; }

/* Narrower filter fields so the Clear Filters button fits on the same row */
.filter-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.filter-row .form-group { flex: 1 1 170px; max-width: 200px; margin-bottom: 16px; }
.filter-row-actions { flex: 0 0 auto; max-width: none; }

/* Toggle switch */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.toggle-info h4 { font-size: 14px; font-weight: 600; color: var(--c-text); }
.toggle-info p  { font-size: 12px; color: var(--c-muted); }

.toggle { position: relative; width: 46px; height: 24px; flex-shrink: 0; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #cbd5e0;
  border-radius: 24px;
  transition: background .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px; top: 3px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 2px 4px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-slider { background: var(--c-primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(22px); }

/* Settings sections */
.settings-section {
  background: #f8fafc;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-s);
  padding: 18px;
  margin-bottom: 18px;
}
.settings-section h3 {
  font-size: 13px; font-weight: 700; color: var(--c-text);
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 7px;
}
.settings-section h3 i { color: var(--c-primary); font-size: 15px; }

/* ── BADGES ────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px; font-weight: 700;
  white-space: nowrap;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-purple  { background: #ede9fe; color: #5b21b6; }
.badge-gray    { background: #f1f5f9; color: #475569; }

/* ── MODAL ─────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
  padding: 20px;
  opacity: 0; visibility: hidden;
  transition: opacity .25s, visibility .25s;
}
.modal-overlay.show { opacity: 1; visibility: visible; }

.modal-box {
  background: #fff;
  border-radius: var(--radius);
  width: 100%; max-width: 540px;
  max-height: 88vh; overflow-y: auto;
  transform: scale(.93) translateY(16px);
  transition: transform .25s ease;
  box-shadow: var(--shadow-lg);
}
.modal-overlay.show .modal-box { transform: scale(1) translateY(0); }
.modal-box.modal-lg { max-width: 720px; }
.modal-box.modal-xl { max-width: 960px; }
.modal-box.modal-sm { max-width: 400px; }

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--c-border);
  position: sticky; top: 0; background: #fff; z-index: 1;
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-head h3 { font-size: 17px; font-weight: 700; color: var(--c-text); }
.modal-close {
  width: 30px; height: 30px; border-radius: 8px;
  border: none; background: var(--c-hover);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--c-muted); line-height: 1;
  transition: all .15s;
}
.modal-close:hover { background: #fee2e2; color: #991b1b; }
.modal-body { padding: 24px; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--c-border);
  background: var(--c-hover);
  border-radius: 0 0 var(--radius) var(--radius);
}

/* ── ALERTS / TOASTS ───────────────────────── */
.alert {
  padding: 11px 16px; border-radius: var(--radius-s);
  margin-bottom: 16px; font-size: 13.5px;
  display: flex; align-items: flex-start; gap: 8px;
}
.alert i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999; display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px;
  border-radius: 10px;
  font-size: 13.5px; font-weight: 500;
  color: #fff; min-width: 220px;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
  animation: slideUp .3s ease;
  pointer-events: all;
}
.toast i { font-size: 18px; flex-shrink: 0; }
.toast-success { background: linear-gradient(135deg,#22c55e,#16a34a); }
.toast-danger  { background: linear-gradient(135deg,#ef4444,#dc2626); }
.toast-info    { background: linear-gradient(135deg,#3b82f6,#2563eb); }
.toast-warning { background: linear-gradient(135deg,#f59e0b,#d97706); }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── SPINNER ───────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ───────────────────────────── */
.empty-state {
  text-align: center; padding: 60px 20px;
  color: var(--c-muted);
}
.empty-state i {
  font-size: 48px; display: block;
  margin-bottom: 12px; opacity: .35;
}
.empty-state p { font-size: 14px; }

/* ── DETAIL ROWS (reports) ─────────────────── */
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 14px; margin-bottom: 20px;
}
.detail-item label {
  font-size: 11px; color: var(--c-muted);
  font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  display: block; margin-bottom: 3px;
}
.detail-item span {
  font-size: 15px; font-weight: 600; color: var(--c-text);
}

/* ── PUNCH-IN CARD ─────────────────────────── */
.business-punch-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  transition: box-shadow .2s;
}
.business-punch-card:hover { box-shadow: 0 6px 24px rgba(0,0,0,.1); }
.bpc-left { flex: 1; }
.bpc-name  { font-size: 15px; font-weight: 700; margin-bottom: 3px; }
.bpc-meta  { font-size: 12.5px; color: var(--c-muted); display: flex; gap: 14px; flex-wrap: wrap; }
.bpc-meta i { font-size: 13px; color: var(--c-primary); }
.bpc-outstanding {
  text-align: right; flex-shrink: 0;
}
.bpc-amount { font-size: 20px; font-weight: 800; color: #ef4444; }
.bpc-amount-label { font-size: 11px; color: var(--c-muted); }

/* ── MAP LINK ──────────────────────────────── */
.map-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--c-primary);
  text-decoration: none;
}
.map-link:hover { text-decoration: underline; }

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

.password-input-wrap { position: relative; }
.password-input-wrap .form-control { padding-right: 40px; }
.password-toggle-btn {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--c-muted);
  padding: 6px; display: flex; align-items: center; border-radius: var(--radius-s);
}
.password-toggle-btn:hover { color: var(--c-text); background: var(--c-hover); }

/* ── UTILITIES ─────────────────────────────── */
.d-flex  { display: flex; }
.gap-10  { gap: 10px; }
.gap-14  { gap: 14px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.text-muted  { color: var(--c-muted); }
.text-danger { color: #ef4444; }
.text-success { color: #22c55e; }
.text-warning { color: #d97706; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 13px; }
.fs-24 { font-size: 24px; font-weight: 800; }

/* ── RESPONSIVE ────────────────────────────── */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .hamburger-btn { display: flex; }
  .settings-pair { grid-template-columns: 1fr; }

  .invoice-header { flex-direction: column; align-items: flex-start; }
  .invoice-meta { text-align: left; }
  .invoice-summary { margin-left: 0; }
}
@media (max-width: 600px) {
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .filter-row .form-group { flex-basis: 100%; max-width: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  #rd-summary.stats-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 14px 12px; }
  .stat-icon { font-size: 22px; margin-bottom: 8px; }
  .stat-val { font-size: 16px; word-break: break-word; overflow-wrap: anywhere; }
  .stat-label { font-size: 10.5px; }
  .content { padding: 14px; }
  .top-header { padding: 0 14px; }
  .header-left h1 { font-size: 16px; }
  .header-left p { display: none; }
  .header-badge span:not(.bi) { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  .card-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .card-actions { width: 100%; }
  .card-actions .btn { flex: 1; justify-content: center; }
  .card-body { padding: 16px; }
  .modal-body { padding: 16px; }
  .modal-head { padding: 14px 16px; }
  .modal-foot { padding: 12px 16px; flex-wrap: wrap; }
  .modal-foot .btn { flex: 1; justify-content: center; }

  .business-punch-card { flex-direction: column; align-items: stretch; text-align: left; }
  .bpc-outstanding { text-align: left; }
  .business-punch-card .btn { width: 100%; justify-content: center; }

  .detail-grid { grid-template-columns: 1fr; }
  .report-tabs { flex-wrap: wrap; }
  .report-tab { flex: 1 1 auto; min-width: 0; text-align: center; padding: 10px 8px; white-space: normal; }

  .login-card { padding: 30px 22px; }

  #toast-container { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; width: 100%; }

  /* Card-style tables: rows become stacked cards instead of a
     horizontally-scrolling table. Opt in per table via the
     `cards-mobile` class on its .tbl-wrap; rows need a data-label
     attribute per <td> (added where the JS builds the row HTML). */
  .tbl-wrap.cards-mobile { overflow-x: visible; }
  .tbl-wrap.cards-mobile table { border-collapse: separate; border-spacing: 0; }
  .tbl-wrap.cards-mobile thead { display: none; }
  .tbl-wrap.cards-mobile tbody,
  .tbl-wrap.cards-mobile tr { display: block; width: 100%; }

  .tbl-wrap.cards-mobile tbody tr {
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-s);
    margin-bottom: 12px;
    padding: 0 14px;
  }
  .tbl-wrap.cards-mobile tbody tr:last-child { margin-bottom: 0; }

  .tbl-wrap.cards-mobile td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--c-border);
    text-align: right;
    white-space: normal;
  }
  .tbl-wrap.cards-mobile td:last-child { border-bottom: none; }
  .tbl-wrap.cards-mobile td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 11px;
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: .3px;
    text-align: left;
    flex-shrink: 0;
  }
  .tbl-wrap.cards-mobile td[colspan] {
    display: block; text-align: left; padding: 0;
  }
  .tbl-wrap.cards-mobile td[colspan]::before { content: none; }

  .tbl-wrap.cards-mobile td.td-card-title {
    font-size: 15px; font-weight: 700;
    padding-top: 14px;
  }
  .tbl-wrap.cards-mobile td.td-card-title::before { content: none; }
  .tbl-wrap.cards-mobile td.hide-mobile { display: none; }
  .tbl-wrap.cards-mobile td.td-actions-cell {
    justify-content: flex-end;
    padding-bottom: 14px;
  }
  .tbl-wrap.cards-mobile td.td-actions-cell::before { content: none; }
  .tbl-wrap.cards-mobile td.td-actions-cell .td-actions { justify-content: flex-end; flex-wrap: wrap; }
}

/* ── OFFLINE QUEUE WIDGET ─────────────────────── */
#offline-widget {
  position: fixed; right: 16px; bottom: 16px; z-index: 500;
  font-size: 13px;
}
#offline-widget-badge {
  display: flex; align-items: center; gap: 8px;
  background: var(--c-card); color: var(--c-text);
  border: 1px solid var(--c-border); border-radius: 999px;
  padding: 9px 16px 9px 12px; box-shadow: var(--shadow);
  cursor: pointer; font-weight: 600;
}
#offline-widget-badge .spin { animation: offline-spin 1s linear infinite; }
@keyframes offline-spin { to { transform: rotate(360deg); } }
#offline-widget-panel {
  display: none; position: absolute; bottom: calc(100% + 10px); right: 0;
  width: 300px; max-height: 320px; overflow-y: auto;
  background: var(--c-card); border: 1px solid var(--c-border);
  border-radius: var(--radius-s); box-shadow: var(--shadow-lg);
  padding: 10px;
}
#offline-widget.open #offline-widget-panel { display: block; }
.offline-item {
  padding: 9px 8px; border-bottom: 1px solid var(--c-border);
  display: flex; flex-direction: column; gap: 4px;
}
.offline-item:last-child { border-bottom: none; }
.offline-item .oi-label { font-weight: 600; color: var(--c-text); }
.offline-item .oi-meta  { color: var(--c-muted); font-size: 11.5px; }
.offline-item .oi-error { color: #ef4444; font-size: 11.5px; }
.offline-item .oi-actions { display: flex; gap: 6px; margin-top: 2px; }
.offline-item .oi-actions button {
  font-size: 11.5px; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--c-border);
  background: var(--c-hover); cursor: pointer; color: var(--c-text);
}

/* ── PWA INSTALL BAR ───────────────────────── */
#pwa-install-bar {
  position: fixed; left: 16px; bottom: 16px; z-index: 500;
  display: flex; align-items: center; gap: 10px;
  background: var(--c-card); color: var(--c-text);
  border: 1px solid var(--c-border); border-radius: 999px;
  padding: 10px 10px 10px 16px; box-shadow: var(--shadow);
  font-size: 13px; max-width: calc(100vw - 32px);
}
#pwa-install-bar i.bi-download { color: var(--c-primary); font-size: 16px; }
#pwa-install-bar span { white-space: nowrap; }
#pwa-install-bar button:not(.pwa-install-dismiss) {
  background: var(--c-primary); color: #fff; border: none; border-radius: 999px;
  padding: 7px 14px; font-weight: 600; font-size: 12.5px; cursor: pointer; white-space: nowrap;
}
#pwa-install-bar .pwa-install-dismiss {
  background: none; border: none; color: var(--c-muted); font-size: 18px; line-height: 1;
  cursor: pointer; padding: 2px 4px;
}
@media (max-width: 480px) {
  #pwa-install-bar span { display: none; }
}

/* ── REPORT TABS ───────────────────────────── */
.report-tabs { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid var(--c-border); }
.report-tab {
  padding: 10px 18px; border: none; background: none; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--c-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.report-tab:hover { color: var(--c-text); }
.report-tab.active { color: var(--c-primary); border-bottom-color: var(--c-primary); }

/* ── INVOICE ───────────────────────────────── */
.invoice-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; padding-bottom: 20px; margin-bottom: 20px;
  border-bottom: 2px solid var(--c-border);
}
.invoice-brand { display: flex; align-items: center; gap: 14px; }
.invoice-brand-name { font-size: 18px; font-weight: 800; }
.invoice-meta { text-align: right; }
.invoice-title { font-size: 22px; font-weight: 800; letter-spacing: 1px; color: var(--c-primary); }
.invoice-bill-to { margin-bottom: 20px; }
.invoice-summary {
  max-width: 320px; margin-left: auto; margin-bottom: 8px;
  border: 1px solid var(--c-border); border-radius: var(--radius-s); padding: 14px 16px;
}
.invoice-summary-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13.5px; }
.invoice-footer { text-align: center; margin-top: 24px; }

/* Printing only the invoice content, not the surrounding app chrome. */
@media print {
  body * { visibility: hidden; }
  #invoice-print-area, #invoice-print-area * { visibility: visible; }
  #invoice-print-area {
    position: absolute; top: 0; left: 0; width: 100%; padding: 20px;
  }
}
