/* PF CRM — style.css (Dark Navy Theme) */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

body {
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
}

/* ── Layout ── */
.app {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: 210px;
  background: #000930;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
}

.brand {
  padding: 18px 14px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.brand-text {
  color: #ffffff;
  font-weight: 700;
  font-size: 12px;
  line-height: 1.4;
}

.brand-sub {
  color: #a0aec0;
  font-size: 10px;
  margin-top: 1px;
}

.nav-section {
  padding: 10px 12px 3px;
  font-size: 10px;
  font-weight: 700;
  color: #90cdf4;
  letter-spacing: .08em;
  text-transform: uppercase;
}

nav {
  padding: 4px 8px;
  flex: 1;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  color: #ffffff;
  font-size: 13px;
  text-decoration: none;
  margin-bottom: 2px;
  border-left: 2px solid transparent;
  transition: background .15s, color .15s;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.nav-btn.active {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
  font-weight: 600;
  border-left-color: #38bdf8;
}

.sidebar-footer {
  padding: 10px 8px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  color: #ffffff;
  font-size: 12px;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.25);
}

/* ── Main ── */
.main {
  flex: 1;
  margin-left: 210px;
  padding: 22px 24px;
  overflow: auto;
}

/* ── Page header ── */
.page-title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}

.page-sub {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 2px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 10px;
}

/* ── Stat cards ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px 18px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  display: block;
  transition: box-shadow .15s;
}

.stat-card:hover {
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

.stat-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 14px 14px 0 0;
}

.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  margin-bottom: 10px;
}

.stat-val {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  color: #6b7280;
  font-weight: 600;
  margin-top: 4px;
}

/* ── Card / table wrapper ── */
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
}

.table-scroll {
  overflow-x: auto;
}

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

thead tr {
  background: #f9fafb;
}

th {
  padding: 9px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

td {
  padding: 9px 12px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
  color: #374151;
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover td {
  background: #f9fafb;
}

.tbl-foot {
  padding: 8px 14px;
  font-size: 11px;
  color: #9ca3af;
  border-top: 1px solid #f1f5f9;
  background: #f9fafb;
}

tr.editing td {
  background: #fffbeb !important;
}

/* ── Pill badges ── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── Document tags ── */
.doc-tag {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 12px;
  background: #bae6fd;
  color: #0369a1;
  font-size: 10px;
  font-weight: 600;
  margin: 1px;
  white-space: nowrap;
}

.doc-tag-more {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 12px;
  background: #f3f4f6;
  color: #6b7280;
  font-size: 10px;
  font-weight: 600;
  margin: 1px;
}

/* ── Avatar ── */
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.name-cell {
  display: flex;
  align-items: center;
  gap: 7px;
}

/* ── Action buttons ── */
.act-btns {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}

.ab {
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid;
  font-size: 11px;
  cursor: pointer;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.ab-save {
  border-color: #86efac;
  color: #166534;
}

.ab-save:hover {
  background: #dcfce7;
}

.ab-edit {
  border-color: #7dd3fc;
  color: #0369a1;
}

.ab-edit:hover {
  background: #e0f2fe;
}

.ab-print {
  border-color: #d1d5db;
  color: #6b7280;
}

.ab-print:hover {
  background: #f3f4f6;
}

/* ── Search bar ── */
.search-wrap {
  position: relative;
}

.search-wrap span {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: #9ca3af;
}

.search-input {
  padding: 7px 12px 7px 30px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  font-size: 13px;
  width: 240px;
}

/* ── Filter chips ── */
.filter-pills {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.chip {
  padding: 4px 13px;
  border-radius: 20px;
  border: 1px solid #e5e7eb;
  background: transparent;
  color: #6b7280;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}

.chip:hover {
  background: #f3f4f6;
}

.chip.active {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #7dd3fc;
  font-weight: 700;
}

/* ── Buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #0ea5e9, #0369a1);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fff;
  color: #6b7280;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}

/* ── Form ── */
.form-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group.full {
  grid-column: 1/-1;
}

.form-group label {
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #1f2937;
  font-size: 13px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 64px;
}

.docs-checklist {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  max-height: 140px;
  overflow-y: auto;
  background: #fafafa;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 5px 12px;
}

.docs-checklist label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
  color: #374151;
}

.docs-checklist input[type=checkbox] {
  width: 13px;
  height: 13px;
  accent-color: #0ea5e9;
  cursor: pointer;
}

.form-btns {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  justify-content: flex-end;
}

/* ── Inline edit inputs ── */
.ie {
  width: 100%;
  padding: 4px 7px;
  border: 1px solid #fbbf24;
  border-radius: 5px;
  font-size: 11px;
  background: #fffbeb;
  color: #1f2937;
}

/* ── Payment tiles ── */
.pay-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.pay-tile {
  border-radius: 14px;
  padding: 16px 18px;
  border: 1px solid #e5e7eb;
}

.pay-tile .plbl {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

.pay-tile .pval {
  font-size: 22px;
  font-weight: 800;
}

/* ── Reports grid ── */
.rep-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.rep-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
}

.rep-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
}

.rep-title {
  font-weight: 700;
  font-size: 13px;
}

/* ── Login page ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0ea5e9, #38bdf8, #7dd3fc);
}

.login-box {
  background: #fff;
  border-radius: 18px;
  padding: 44px 40px;
  width: 380px;
  box-shadow: 0 32px 100px rgba(0, 0, 0, 0.25);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo .icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin: 0 auto 12px;
}

.login-logo h1 {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.3;
}

.login-logo p {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 4px;
}

.login-field {
  margin-bottom: 14px;
}

.login-field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #6b7280;
  margin-bottom: 5px;
}

.login-field input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  font-size: 14px;
  color: #1f2937;
  background: #fff;
}

.login-field input:focus {
  outline: none;
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

.login-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #f7941d);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 4px;
}

.login-btn:hover {
  background: linear-gradient(135deg, #2563eb, #1e40af);
}

.login-error {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}

/* ── Dashboard grid ── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Responsive ── */
@media (max-width:768px) {
  .sidebar {
    width: 100%;
    position: relative;
  }

  .main {
    margin-left: 0;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .rep-grid,
  .dash-grid {
    grid-template-columns: 1fr;
  }
}