:root {
  --forest: #009A44;
  --forest-mid: #0B8B41;
  --forest-soft: #e6f5eb;
  --cream: #ffffff; /* Fresh pure white */
  --cream-2: #f8fafc; /* Subtle fresh white/blue tint */
  --surface: #ffffff;
  --surface-muted: #f8f9fa; 
  --text: #1c1917;
  --muted: #6b7280;
  --border: #e2e8f0; 
  --accent: #B2D235;
  --danger: #E31E24;
  --ok: #009A44;
  --brand-red: #E31E24;
  --brand-lime: #B2D235;
  --app-shadow: 0 16px 36px rgba(0, 154, 68, 0.06);
  --app-radius: 22px;
  --app-vh: 1vh;
  --font-size-body: 14px;
  --font-size-ui: 13px;
  --font-size-small: 12px;
  --font-size-table: 13px;
  --font-size-badge: 11px;
  --font-size-btn: 13px;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--cream); }
html,
body {
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--forest); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.45); }
* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.25) var(--forest); }

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: var(--font-size-body);
  line-height: 1.5;
  min-height: 100vh;
  min-height: calc(var(--app-vh, 1vh) * 100);
  background: #ffffff;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 {
  font-family: inherit;
  font-weight: 700;
  line-height: 1.3;
  margin-top: 0;
}

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

.app-shell {
  display: flex;
  min-height: 100vh;
  min-height: calc(var(--app-vh, 1vh) * 100);
}

.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #0a7d3c 0%, #076732 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand h1 { margin: 0; font-size: 24px; }
.brand p { margin: 4px 0 16px; opacity: .7; font-size: 13px; }

.mobile-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 8px 18px rgba(12, 154, 71, 0.16);
  padding: 4px;
}

nav { display: flex; flex-direction: column; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  margin: 2px 8px;
  border-radius: 8px;
  color: rgba(255,255,255,.65);
  font-weight: 600;
  font-size: 13.5px;
  transition: all 0.15s;
}

.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.14); color: #fff; }

.nav-item i {
  width: 16px;
  height: 16px;
}

.nav-group.has-children {
  margin-bottom: 4px;
}

.nav-submenu {
  display: grid;
  gap: 2px;
  margin: 4px 0 0 42px;
  padding: 4px 0 2px 10px;
  border-left: 1px solid rgba(255,255,255,.14);
}

.nav-subitem {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.56);
  font-size: 12.5px;
  font-weight: 600;
  transition: all 0.15s;
}

.nav-subitem:hover {
  color: #fff;
  background: rgba(255,255,255,.06);
}

.nav-subitem.active {
  color: #fff;
  background: rgba(255,255,255,.12);
}

.nav-subitem i {
  width: 14px;
  height: 14px;
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,.15);
  padding-top: 12px;
}

.user-info .name { font-size: 14px; font-weight: 800; }
.user-info .role { font-size: 12px; opacity: .7; margin-bottom: 8px; }

.main-content {
  flex: 1;
  padding: 24px;
  width: 100%;
}

.auth-content {
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 6px 18px rgba(28, 25, 23, 0.03);
}

.grid {
  display: grid;
  gap: 12px;
}

.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.kpi { border: 1px solid var(--border); border-radius: 12px; background: #fff; padding: 14px; }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: none; }
.kpi .value { font-size: 24px; font-weight: 900; margin-top: 8px; }

label { display: block; font-size: var(--font-size-ui); text-transform: none; letter-spacing: normal; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  font: inherit;
  font-size: var(--font-size-body);
}

textarea { min-height: 84px; }

.table-wrap,
.module-matrix-wrap,
.bil-preview-table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-table);
}

th, td {
  border-bottom: 1px solid var(--border);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--cream-2);
  font-size: var(--font-size-small);
  text-transform: none;
  letter-spacing: normal;
  color: var(--muted);
  font-weight: 700;
}

table.table-mobile-ready tbody td {
  position: relative;
}

table.table-mobile-ready tbody td[data-cell-type="full"] {
  text-align: center;
}

.badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: var(--font-size-badge);
  font-weight: 800;
}
.badge-ok { background: #dcfce7; color: var(--ok); }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: var(--danger); }
.badge-info { background: #dbeafe; color: #1d4ed8; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: var(--font-size-btn);
  line-height: 1.2;
  font-weight: 800;
  cursor: pointer;
}

.btn-primary { background: var(--forest); color: #fff; }
.btn-primary:hover { background: var(--forest-mid); }
.btn-secondary { background: var(--cream-2); color: var(--text); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: #fff; }

.w-full { width: 100%; }
.actions { display: flex; gap: 8px; align-items: center; }

.flash-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1600;
  display: grid;
  gap: 12px;
  width: min(420px, calc(100vw - 24px));
  pointer-events: none;
}

.flash {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  border-radius: 16px;
  font-weight: 700;
  border: 1px solid transparent;
  box-shadow: 0 18px 38px rgba(28, 25, 23, 0.16);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  animation: flash-slide-in .22s ease-out;
}

.flash.is-dismissing {
  animation: flash-slide-out .18s ease-in forwards;
}

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

.flash-title {
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.flash-message {
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.flash-close {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 2px 4px;
  margin: -2px -2px 0 0;
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
  opacity: .7;
}

.flash-close:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.3);
}

.flash-success {
  background: rgba(220, 252, 231, 0.97);
  border-color: #86efac;
  color: #14532d;
}

.flash-error {
  background: rgba(254, 226, 226, 0.98);
  border-color: #fca5a5;
  color: #7f1d1d;
}

body.modal-open {
  overflow: hidden;
}

.app-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(28, 25, 23, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.app-modal-overlay.open {
  display: flex;
}

.app-modal {
  width: min(var(--app-modal-width, 760px), 100%);
  max-height: min(90vh, 940px);
  overflow: auto;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  padding: var(--app-modal-padding, 24px);
  animation: app-modal-in .2s ease-out;
}

.app-modal--sm { --app-modal-width: 460px; }
.app-modal--md { --app-modal-width: 640px; }
.app-modal--lg { --app-modal-width: 860px; }
.app-modal--xl { --app-modal-width: 1100px; }

.app-modal--flush {
  padding: 0;
  overflow: hidden;
}

.app-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.app-modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: var(--forest);
}

.app-modal-subtle {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.app-modal-close {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  border-radius: 12px;
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}

.app-modal-close:hover {
  background: var(--cream-2);
  color: var(--text);
  border-color: #d8d4cb;
}

.app-modal-body {
  min-height: 120px;
}

.app-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

@keyframes app-modal-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.ajax-modal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(28, 25, 23, 0.5);
}

.ajax-modal.open {
  display: flex;
}

.ajax-modal-dialog {
  width: min(1120px, 100%);
  max-height: min(90vh, 940px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}

.ajax-modal-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fffdf9 0%, #ffffff 100%);
}

.ajax-modal-title {
  font-size: 14px;
  font-weight: 800;
  color: var(--forest);
}

.ajax-modal-close {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}

.ajax-modal-body {
  overflow: auto;
  padding: 22px;
  min-height: 200px;
}

.ajax-modal-loading,
.ajax-modal-error {
  padding: 28px;
  font-weight: 700;
}

.ajax-modal-error {
  color: var(--danger);
}

@keyframes flash-slide-in {
  from {
    opacity: 0;
    transform: translate3d(12px, -10px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes flash-slide-out {
  from {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
  to {
    opacity: 0;
    transform: translate3d(12px, -8px, 0);
  }
}

@media (max-width: 720px) {
  .flash-stack {
    top: max(12px, env(safe-area-inset-top));
    right: 12px;
    left: 12px;
    width: auto;
  }

  .flash {
    border-radius: 14px;
    padding: 13px 13px 13px 14px;
  }

  .flash-message {
    font-size: 13px;
  }
}

.auth-title { text-align: center; margin: 14px 0 22px; }
.auth-title img {
  width: min(280px, 70vw);
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto 16px;
}
.small { font-size: var(--font-size-small); color: var(--muted); }

.mobile-header { display: none; }
.sidebar-overlay { display: none; }
.sidebar-close { display: none; }
.mobile-nav { display: none; }
.mobile-nav-fab-slot { display: none; }
.mobile-header-group {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.mobile-header-subtitle {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mobile-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid rgba(12, 154, 71, 0.12);
  background: rgba(12, 154, 71, 0.1);
  color: var(--forest);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.mobile-install-btn i {
  width: 14px;
  height: 14px;
}
body.is-standalone .mobile-install-btn,
body.is-pwa-installed .mobile-install-btn,
.mobile-install-btn[hidden] {
  display: none !important;
}

body.is-standalone {
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

body.is-standalone input,
body.is-standalone textarea,
body.is-standalone select,
body.is-standalone [contenteditable="true"] {
  user-select: text;
  -webkit-user-select: text;
}

.fab-btn {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 56px;
  height: 56px;
  background: var(--forest);
  color: #fff;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 28px rgba(27,67,50,0.28);
  z-index: 998;
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.fab-btn:hover {
  transform: translateY(-2px) scale(1.04);
  background: var(--forest-mid);
  box-shadow: 0 16px 32px rgba(27,67,50,0.32);
}

.fab-btn i {
  width: 26px;
  height: 26px;
}

.service-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
  grid-auto-flow: row dense;
}

.service-card {
  min-height: 104px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 14px 12px;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 8px 20px rgba(28, 25, 23, 0.04);
}

.service-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 154, 68, 0.08);
  border-color: var(--forest-soft);
  background: linear-gradient(180deg, #ffffff 0%, #f4fdf8 100%);
}

.service-card-icon {
  width: 28px;
  height: 28px;
}

.service-card-title {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.35;
  max-width: 10ch;
  margin: 0 auto;
}

.mobile-metrics-grid {
  display: grid;
  gap: 12px;
}

.sidebar-user-panel {
  margin-top: 14px;
  padding: 10px;
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
}

.sidebar-user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sidebar-user-toggle {
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.sidebar-user-toggle .sidebar-user-chevron {
  transition: transform 0.2s ease, color 0.2s ease;
}

.sidebar-user-panel.is-open .sidebar-user-chevron {
  transform: rotate(180deg);
  color: rgba(255,255,255,0.85) !important;
}

.sidebar-account-actions {
  display: none;
  gap: 8px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-user-panel.is-open .sidebar-account-actions {
  display: grid;
}

.sidebar-account-actions[hidden] {
  display: none !important;
}

.sidebar-account-action {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 6px 2px;
  border-radius: 0;
  background: transparent;
  color: rgba(255,255,255,0.88);
  border: none;
  font-size: 12.5px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
  appearance: none;
  box-shadow: none;
}

.sidebar-account-action:hover {
  background: transparent;
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sidebar-account-action i {
  width: 14px;
  height: 14px;
  color: rgba(255,255,255,0.7);
}

@media (max-width: 960px) {
  :root {
    --font-size-body: 14px;
    --font-size-ui: 13px;
    --font-size-small: 11px;
    --font-size-table: 12.5px;
    --font-size-badge: 10.5px;
    --font-size-btn: 13px;
  }

  .app-shell { display: block; }
  
  body.is-authenticated {
    background:
      linear-gradient(180deg, rgba(12, 154, 71, 0.08) 0%, rgba(12, 154, 71, 0) 140px),
      linear-gradient(180deg, #fffef8 0%, #f1efe2 100%);
  }
  
  body.sidebar-open {
    overflow: hidden;
  }
  
  body.is-standalone .app-shell {
    min-height: calc(var(--app-vh, 1vh) * 100);
  }
  
  .mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 190;
    margin: -14px -14px 16px;
    padding: calc(12px + env(safe-area-inset-top)) 14px 13px;
    background: rgba(255, 254, 248, 0.9);
    backdrop-filter: blur(20px) saturate(1.15);
    -webkit-backdrop-filter: blur(20px) saturate(1.15);
    border-bottom: 1px solid rgba(231, 227, 220, 0.9);
  }
  
  .menu-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid rgba(12, 154, 71, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.72);
    padding: 0;
    cursor: pointer;
    color: var(--forest);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 14px rgba(28, 25, 23, 0.04);
  }
  
  .sidebar-close {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    padding: 6px;
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
  }
  .sidebar-close:hover {
    background: rgba(255, 255, 255, 0.2);
  }
  
  .brand-title {
    font-family: inherit;
    font-weight: 800;
    font-size: 17px;
    color: var(--forest);
    line-height: 1.1;
  }

  .sidebar { 
    position: fixed; 
    top: 0;
    left: 0;
    width: min(86vw, 320px); 
    height: 100vh;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 10px 0 36px rgba(0,0,0,0.16);
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
  
  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }

  body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .main-content { 
    padding: 14px 14px calc(118px + env(safe-area-inset-bottom)) 14px; 
  }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  
  .mobile-nav {
    display: grid;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.92);
    border-top: 1px solid rgba(231, 227, 220, 0.85);
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
    z-index: 180;
    box-shadow: 0 -10px 30px rgba(0,0,0,0.08);
    backdrop-filter: blur(20px) saturate(1.08);
    -webkit-backdrop-filter: blur(20px) saturate(1.08);
    align-items: end;
    gap: 4px;
  }

  .mobile-nav.has-fab {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .mobile-nav:not(.has-fab) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    justify-content: center;
    min-height: 54px;
    padding: 4px 0 0;
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
    border-radius: 18px;
    transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
  }

  .mobile-nav-item.active {
    color: var(--forest);
    background: rgba(45, 106, 79, 0.1);
  }
  
  .mobile-nav-item i {
    width: 20px;
    height: 20px;
  }

  .mobile-nav-fab-slot {
    display: block;
    min-height: 54px;
  }

  .fab-btn {
    left: 50%;
    right: auto;
    bottom: calc(42px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    width: 64px;
    height: 64px;
    border: 5px solid #f4eee4;
    box-shadow: 0 18px 32px rgba(27,67,50,0.28);
  }

  .fab-btn:hover {
    transform: translateX(-50%) translateY(-2px) scale(1.03);
  }

  .service-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .mobile-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar-user-panel {
    padding: 12px;
  }

  .card {
    border-radius: var(--app-radius);
    box-shadow: var(--app-shadow);
  }

  input, select, textarea, .btn, .btn-secondary, .btn-primary {
    min-height: 46px;
  }
}

@media (max-width: 760px) {
  .app-modal-overlay {
    padding:
      max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
  }

  .app-modal {
    width: 100%;
    max-height: 92vh;
    border-radius: 18px;
    padding: var(--app-modal-padding-mobile, 18px);
  }

  .app-modal-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .app-modal-actions .btn,
  .app-modal-actions button,
  .app-modal-actions a {
    width: 100%;
    justify-content: center;
  }

  .ajax-modal {
    padding: 10px;
  }

  .ajax-modal-dialog {
    width: 100%;
    max-height: 92vh;
    border-radius: 18px;
  }

  .ajax-modal-topbar {
    padding: 12px 14px;
  }

  .ajax-modal-body {
    padding: 14px;
  }

  .table-wrap.table-wrap-mobile-ready,
  .module-matrix-wrap.table-wrap-mobile-ready,
  .bil-preview-table-wrap.table-wrap-mobile-ready {
    overflow: visible;
  }

  table.table-mobile-ready {
    min-width: 0 !important;
    border-collapse: separate;
    border-spacing: 0;
  }

  table.table-mobile-ready thead {
    display: none;
  }

  table.table-mobile-ready,
  table.table-mobile-ready tbody,
  table.table-mobile-ready tr,
  table.table-mobile-ready td {
    display: block;
    width: 100%;
  }

  table.table-mobile-ready tbody {
    display: grid;
    gap: 14px;
  }

  table.table-mobile-ready tbody tr {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #fcfaf6 100%);
    box-shadow: 0 12px 28px rgba(28, 25, 23, 0.07);
  }

  table.table-mobile-ready tbody td {
    display: grid;
    grid-template-columns: minmax(104px, 0.92fr) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    padding: 0;
    border: 0;
    white-space: normal;
  }

  table.table-mobile-ready tbody td + td {
    margin-top: 12px;
  }

  table.table-mobile-ready tbody td input,
  table.table-mobile-ready tbody td select,
  table.table-mobile-ready tbody td textarea,
  table.table-mobile-ready tbody td button {
    width: 100%;
    max-width: 100%;
  }

  table.table-mobile-ready tbody td .badge {
    justify-self: start;
  }

  table.table-mobile-ready tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--muted);
    text-transform: none;
    letter-spacing: normal;
  }

  table.table-mobile-ready tbody td[data-cell-type="full"] {
    display: block;
    padding: 2px 0;
  }

  table.table-mobile-ready tbody td[data-cell-type="full"]::before,
  table.table-mobile-ready tbody td[data-label=""]::before {
    display: none;
  }

  table.table-mobile-ready tbody td[data-label-key="action"],
  table.table-mobile-ready tbody td[data-label-key="actions"],
  table.table-mobile-ready tbody td[data-label-key="change-status"] {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding-top: 10px;
    border-top: 1px solid rgba(231, 227, 220, 0.85);
  }

  table.table-mobile-ready tbody td[data-label-key="action"] > div,
  table.table-mobile-ready tbody td[data-label-key="actions"] > div,
  table.table-mobile-ready tbody td[data-label-key="change-status"] > div,
  table.table-mobile-ready tbody td[data-label-key="action"] > form,
  table.table-mobile-ready tbody td[data-label-key="actions"] > form,
  table.table-mobile-ready tbody td[data-label-key="change-status"] > form {
    width: 100%;
    display: grid !important;
    gap: 8px;
    align-items: stretch !important;
  }

  table.table-mobile-ready tbody td[data-label-key="action"] > div,
  table.table-mobile-ready tbody td[data-label-key="actions"] > div,
  table.table-mobile-ready tbody td[data-label-key="action"] > form,
  table.table-mobile-ready tbody td[data-label-key="actions"] > form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  table.table-mobile-ready tbody td[data-label-key="change-status"] > form {
    grid-template-columns: minmax(0, 1.2fr) minmax(104px, 0.8fr);
  }

  table.table-mobile-ready tbody td[data-label-key="action"] > div > form,
  table.table-mobile-ready tbody td[data-label-key="actions"] > div > form {
    width: 100%;
    margin: 0 !important;
  }

  table.table-mobile-ready tbody td[data-label-key="action"] .btn,
  table.table-mobile-ready tbody td[data-label-key="actions"] .btn,
  table.table-mobile-ready tbody td[data-label-key="change-status"] .btn,
  table.table-mobile-ready tbody td[data-label-key="change-status"] select {
    width: 100%;
  }

  table.table-mobile-ready tbody td[data-label-key="action"] .btn,
  table.table-mobile-ready tbody td[data-label-key="actions"] .btn,
  table.table-mobile-ready tbody td[data-label-key="change-status"] .btn {
    justify-content: center;
    text-align: center;
  }
}

@media (max-width: 520px) {
  .main-content {
    padding-left: 12px;
    padding-right: 12px;
  }

  .service-card {
    min-height: 94px;
    padding: 12px 10px;
    gap: 8px;
  }

  .service-card-icon {
    width: 26px;
    height: 26px;
  }

  .service-card-title {
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .fab-btn {
    width: 58px;
    height: 58px;
  }
}

/* --- Orders Create Page Styles --- */
.orders-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.orders-page-header h2 {
  margin-bottom: 4px;
}

.orders-overview-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.orders-overview-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(135deg, #ffffff 0%, #f4fdf8 100%);
  padding: 16px 18px;
}

.orders-overview-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
  text-transform: none;
  letter-spacing: normal;
  margin-bottom: 8px;
}

.orders-overview-value {
  font-family: inherit;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
}

.orders-overview-note {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

.orders-layout {
  display: block;
}

.orders-section-card {
  padding: 20px;
}

.orders-section-title {
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--forest);
  margin-bottom: 14px;
}

.orders-detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.orders-detail-grid .span-2 {
  grid-column: span 3;
}

.orders-context-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.9fr);
  gap: 16px;
  align-items: stretch;
  margin-top: 16px;
}

.orders-remarks-card,
.orders-credit-strip {
  background: linear-gradient(90deg, #fffaf2 0%, #f6efe5 55%, #fffaf2 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  box-shadow: 0 10px 24px rgba(28, 25, 23, 0.05);
}

.orders-remarks-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.orders-remarks-meta {
  display: grid;
  gap: 8px;
}

.orders-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.orders-card-kicker {
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 6px;
}

.orders-card-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--forest);
  margin-bottom: 4px;
}

.orders-card-copy {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.orders-remarks-input {
  min-height: 164px;
  border: 1px solid #e6d6bf;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 1px 2px rgba(28, 25, 23, 0.04);
  resize: vertical;
}

.orders-remarks-readonly {
  border: 1px solid #e6d6bf;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: inset 0 1px 2px rgba(28, 25, 23, 0.04);
  padding: 14px 16px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}

.orders-credit-strip {
  display: grid;
  gap: 14px;
  align-items: start;
}

.orders-credit-party {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.orders-credit-party strong {
  color: var(--text);
  font-size: 13px;
}

.orders-credit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.orders-credit-metric {
  min-width: 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(234, 220, 200, 0.95);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.orders-credit-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
  text-transform: none;
  letter-spacing: normal;
  margin-bottom: 8px;
}

.orders-credit-value {
  font-family: inherit;
  font-size: 17px;
  font-weight: 900;
  color: var(--text);
  line-height: 1.2;
}

.orders-credit-value.is-used,
.orders-credit-utilization-value.is-medium {
  color: var(--accent);
}

.orders-credit-value.is-available,
.orders-credit-value.is-overdue-zero,
.orders-credit-utilization-value.is-low {
  color: var(--forest-mid);
}

.orders-credit-value.is-overdue-high,
.orders-credit-utilization-value.is-high {
  color: var(--danger);
}

.orders-credit-utilization {
  min-width: 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(234, 220, 200, 0.95);
  background: rgba(255, 255, 255, 0.76);
}

.orders-credit-progress {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #efe6da;
}

.orders-credit-progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width .2s ease, background-color .2s ease;
}

.orders-credit-progress-fill.is-low { background: var(--forest-mid); }
.orders-credit-progress-fill.is-medium { background: var(--accent); }
.orders-credit-progress-fill.is-high { background: var(--danger); }

.orders-credit-utilization-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.orders-credit-warning {
  margin-top: 2px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(120, 113, 108, 0.12);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
}

.orders-credit-warning.is-safe {
  color: var(--forest-mid);
  border-color: rgba(21, 128, 61, 0.18);
  background: rgba(236, 253, 245, 0.7);
}

.orders-credit-warning.is-caution {
  color: var(--accent);
  border-color: rgba(217, 119, 6, 0.18);
  background: rgba(255, 251, 235, 0.82);
}

.orders-credit-warning.is-danger {
  color: var(--danger);
  border-color: rgba(220, 38, 38, 0.18);
  background: rgba(254, 242, 242, 0.86);
}

.orders-products-header,
.orders-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.orders-table-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.orders-search-shell {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(90deg, #ffffff 0%, #f4fdf8 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 14px;
  min-width: 320px;
}

.orders-search-shell input {
  border: 0;
  background: transparent;
  padding: 0;
  outline: none;
}

.orders-search-shell kbd {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.7);
  border-radius: 10px;
  padding: 4px 7px;
  color: var(--muted);
  font-size: 11px;
  font-family: inherit;
  font-weight: 700;
}

.orders-filter-select {
  min-width: 180px;
}

.orders-inline-note {
  font-size: 12px;
  color: var(--muted);
}

.orders-items-table td,
.orders-items-table th {
  white-space: nowrap;
}

.orders-items-table td:first-child,
.orders-items-table th:first-child {
  white-space: normal;
  min-width: 240px;
}

.orders-items-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.searchable-combobox {
  position: relative;
  min-width: 260px;
}

.searchable-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: .01;
  pointer-events: none;
}

.searchable-search-input {
  width: 100%;
  min-width: 0;
  padding-right: 42px;
  background:
    linear-gradient(45deg, transparent 50%, var(--forest) 50%) calc(100% - 22px) 50% / 7px 7px no-repeat,
    linear-gradient(135deg, var(--forest) 50%, transparent 50%) calc(100% - 17px) 50% / 7px 7px no-repeat,
    #fff;
  cursor: text;
}

.searchable-search-list {
  display: none;
  position: fixed;
  z-index: 1200;
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid rgba(12, 154, 71, 0.18);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 42px rgba(28, 25, 23, 0.16);
  padding: 6px;
}

.searchable-combobox.is-open .searchable-search-list {
  display: grid;
  gap: 3px;
}

.searchable-search-option {
  width: 100%;
  appearance: none;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1.35;
  padding: 10px 12px;
  text-align: left;
  white-space: normal;
}

.searchable-search-option:hover,
.searchable-search-option:focus,
.searchable-search-option.is-selected {
  background: rgba(12, 154, 71, 0.1);
  color: var(--forest);
  outline: none;
}

.searchable-search-empty {
  padding: 14px 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.orders-line-total {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--forest);
}

.orders-form-footer {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 16px;
}

.orders-summary-inline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 6px;
}

.orders-summary-inline-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #f4fdf8 100%);
  padding: 6px 8px;
  min-width: 0;
}

.orders-summary-inline-card span {
  display: block;
  font-size: 9px;
  color: var(--muted);
  font-weight: normal;
  margin-bottom: 2px;
}

.orders-summary-inline-card strong {
  display: block;
  font-family: inherit;
  font-size: 11px;
  font-weight: normal;
  color: var(--text);
  line-height: 1.2;
}

.orders-summary-inline-card.is-highlight {
  background: linear-gradient(135deg, #ffffff 0%, #f4fdf8 100%);
  border-color: #eadcc8;
}

.orders-summary-inline-card.is-highlight strong {
  font-size: 12px;
  font-weight: normal;
  color: var(--forest);
}

.orders-actions-row {
  margin-top: 0;
  justify-content: flex-end;
}

.orders-record-table td:first-child {
  min-width: 150px;
}

.orders-record-party {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.orders-record-code {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.orders-status-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.orders-empty-state {
  padding: 26px 0;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .orders-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .orders-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .orders-context-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .orders-overview-grid {
    grid-template-columns: 1fr;
  }

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

  .orders-detail-grid .span-2 {
    grid-column: span 1;
  }

  .orders-credit-strip {
    gap: 12px;
    padding: 16px;
  }

  .orders-credit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .orders-credit-metric {
    padding: 14px;
    min-height: 108px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
  }

  .orders-credit-value {
    font-size: 15px;
    line-height: 1.25;
    word-break: break-word;
  }

  .orders-actions-row {
    justify-content: stretch;
  }

  .orders-actions-row .btn {
    width: 100%;
  }

  .orders-credit-utilization {
    width: 100%;
  }

  .orders-items-wrap {
    overflow: visible;
  }

  .searchable-combobox {
    min-width: 0;
    width: 100%;
  }

  .searchable-search-list {
    position: absolute;
    top: calc(100% + 6px);
    left: 0 !important;
    right: 0;
    width: auto !important;
    max-height: min(360px, 58vh);
    border-radius: 18px;
  }

  .searchable-search-option {
    min-height: 48px;
    padding: 12px 14px;
    font-size: 14px;
  }

  .orders-items-wrap .orders-items-table td:first-child,
  .orders-items-wrap .orders-items-table th:first-child {
    min-width: 0;
  }

  .orders-items-wrap .orders-items-table tbody tr {
    padding: 16px;
    border-radius: 22px;
    background:
      radial-gradient(circle at top right, rgba(212, 114, 26, 0.08), transparent 34%),
      linear-gradient(180deg, #ffffff 0%, #f4fdf8 100%);
  }

  .orders-items-wrap .orders-items-table tbody td[data-label-key="product"],
  .orders-items-wrap .orders-items-table tbody td[data-label-key="qty"],
  .orders-items-wrap .orders-items-table tbody td[data-label-key="line-total"],
  .orders-items-wrap .orders-items-table tbody td[data-label-key="action"] {
    grid-template-columns: 1fr;
  }

  .orders-items-wrap .orders-items-table tbody td[data-label-key="product"] select,
  .orders-items-wrap .orders-items-table tbody td[data-label-key="qty"] input,
  .orders-items-wrap .orders-items-table tbody td[data-label-key="mrp"] input,
  .orders-items-wrap .orders-items-table tbody td[data-label-key="pricing-discount"] input,
  .orders-items-wrap .orders-items-table tbody td[data-label-key="gst"] input {
    border-radius: 16px;
    min-height: 52px;
  }

  .orders-items-wrap .orders-items-table tbody td[data-label-key="qty"] .order-qty-stepper {
    display: grid;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    grid-template-columns: 58px minmax(82px, 1fr) 58px;
    border: 1px solid rgba(12, 154, 71, 0.24);
    border-radius: 18px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 8px 18px rgba(12, 154, 71, 0.08);
  }

  .orders-items-wrap .orders-items-table tbody td[data-label-key="qty"] .order-qty-stepper-btn {
    appearance: none;
    border: 0;
    min-height: 56px;
    background: var(--forest);
    color: #fff;
    font-size: 26px;
    font-weight: 900;
    line-height: 1;
    cursor: pointer;
    touch-action: manipulation;
  }

  .orders-items-wrap .orders-items-table tbody td[data-label-key="qty"] .order-qty-stepper-btn:active {
    background: var(--forest-mid);
  }

  .orders-items-wrap .orders-items-table tbody td[data-label-key="qty"] .order-qty-stepper-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
  }

  .orders-items-wrap .orders-items-table tbody td[data-label-key="qty"] .order-qty-stepper input {
    width: 100%;
    min-width: 0;
    min-height: 56px;
    border: 0;
    border-radius: 0;
    text-align: center;
    font-size: 18px;
    font-weight: 900;
    background: #fff;
    color: var(--text);
    appearance: textfield;
    -moz-appearance: textfield;
  }

  .orders-items-wrap .orders-items-table tbody td[data-label-key="qty"] .order-qty-stepper input::-webkit-outer-spin-button,
  .orders-items-wrap .orders-items-table tbody td[data-label-key="qty"] .order-qty-stepper input::-webkit-inner-spin-button {
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
  }

  .orders-items-wrap .orders-items-table tbody td[data-label-key="qty"] > input.order-item-qty {
    width: 100%;
    font-size: 18px;
    font-weight: 800;
    text-align: center;
    border-radius: 0;
  }

  .orders-items-wrap .orders-items-table tbody td[data-label-key="line-total"] {
    padding-top: 10px;
    border-top: 1px solid rgba(234, 220, 200, 0.95);
  }

  .orders-items-wrap .orders-items-table tbody td[data-label-key="line-total"] .orders-line-total {
    font-size: 24px;
    font-weight: 900;
  }

  .orders-items-wrap .orders-items-table tbody td[data-label-key="action"] .btn {
    width: 100%;
    border-radius: 16px;
  }

  .orders-summary-inline {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
  }

  .orders-summary-inline-card {
    padding: 4px 6px;
  }
}

@media (max-width: 420px) {
  .orders-credit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .orders-credit-metric {
    min-height: 96px;
    padding: 12px;
  }

  .orders-credit-label {
    font-size: 10px;
    margin-bottom: 6px;
  }

  .orders-credit-value {
    font-size: 13px;
  }
}

/* --- Extracted from pages\billing\create.php --- */

.bilcr-header { display:flex; justify-content:space-between; align-items:flex-end; flex-wrap:wrap; gap:14px; margin-bottom:20px; }
.bilcr-tab-bar { display:flex; gap:2px; background:var(--cream-2,#F5F0E8); border-radius:10px; padding:3px; }
.bilcr-tab { padding:7px 18px; border-radius:8px; font-size:13px; font-weight:700; color:var(--muted,#78716C); text-decoration:none; transition:all .15s; }
.bilcr-tab.active { background:#fff; color:var(--text,#1C1917); box-shadow:0 1px 4px rgba(0,0,0,0.08); }
.bilcr-layout { display:grid; grid-template-columns:minmax(0,1fr) 340px; gap:18px; align-items:start; }
.bilcr-card { padding:22px; }
.bilcr-form-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.bilcr-rules { background:var(--cream,#FEFDF8); border:1px solid var(--border); border-radius:12px; padding:16px; margin-top:18px; }
.bilcr-rule { display:flex; gap:10px; align-items:flex-start; font-size:12px; color:var(--muted); margin-bottom:12px; }
.bilcr-rule:last-child { margin-bottom:0; }
.bilcr-rule-icon { width:28px; height:28px; border-radius:8px; background:var(--cream-2); display:inline-flex; align-items:center; justify-content:center; flex-shrink:0; color:var(--forest); }
.bilcr-order-meta { background:var(--cream-2,#F5F0E8); border-radius:12px; padding:14px 16px; margin-top:14px; display:none; }
.bilcr-order-meta.visible { display:block; }
@media(max-width:900px) { .bilcr-layout { grid-template-columns:1fr; } .bilcr-form-grid { grid-template-columns:1fr; } }

/* --- Extracted from pages\billing\index.php --- */

.bil-header { display:flex; justify-content:space-between; align-items:flex-end; flex-wrap:wrap; gap:14px; margin-bottom:24px; }
.bil-tab-bar { display:flex; gap:2px; background:var(--cream-2,#F5F0E8); border-radius:10px; padding:3px; }
.bil-tab { padding:7px 18px; border-radius:8px; font-size:13px; font-weight:700; color:var(--muted,#78716C); text-decoration:none; transition:all .15s; }
.bil-tab.active { background:#fff; color:var(--text,#1C1917); box-shadow:0 1px 4px rgba(0,0,0,0.08); }
.bil-kpi-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:16px; margin-bottom:24px; }
.bil-kpi { border:1px solid var(--border); border-radius:14px; background:#fff; padding:18px 20px; transition:all .15s; }
.bil-kpi-label { font-size:11px; font-weight:800; color:var(--muted); margin-bottom:8px; }
.bil-kpi-value { font-size:24px; font-weight:900; font-family:inherit; color:var(--text); line-height:1.1; }
.bil-filter-bar { display:flex; gap:12px; align-items:center; flex-wrap:nowrap; margin-bottom:24px; background:#fff; border:1px solid var(--border); border-radius:14px; padding:14px 18px; }
.bil-filter-form { display:flex; align-items:center; gap:12px; width:100%; flex-wrap:nowrap; }
.bil-filter-select { min-width:0; flex-shrink:0; height:44px; background:#fff; border-color:var(--border); }
.bil-filter-party { width:180px; }
.bil-filter-type { width:130px; }
.bil-filter-submit { flex-shrink:0; white-space:nowrap; height:44px; padding:0 22px; background:var(--forest,#1B4332); border-color:var(--forest); font-weight:800; }
.bil-filter-clear { flex-shrink:0; white-space:nowrap; height:44px; display:inline-flex; align-items:center; border-color:var(--border); }
.bil-filter-note { margin:-10px 0 18px; padding:12px 14px; border:1px solid #FDE68A; border-radius:12px; background:#FFFBEB; color:#92400E; font-size:12px; font-weight:700; }
.bil-filter-search { display:flex; align-items:center; gap:8px; background:var(--cream,#FEFDF8); border:1px solid var(--border); border-radius:12px; padding:10px 14px; flex:1; min-width:0; }
.bil-filter-search input { border:none; background:none; outline:none; font-family:inherit; font-size:13px; width:100%; color:var(--text); }
.bil-party-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; margin-bottom:24px; }
.bil-party-card { border:1px solid var(--border); border-radius:16px; background:linear-gradient(135deg,#fff 0%,#f9fbf9 100%); padding:18px; box-shadow:0 1px 3px rgba(0,0,0,0.02); min-width:0; }
.bil-party-name { font-weight:900; font-size:15px; margin-bottom:2px; color:var(--text); }
.bil-party-code { font-size:11px; color:var(--muted); font-weight:700; margin-bottom:14px; text-transform:uppercase; letter-spacing:0.02em; }
.bil-party-total { font-size:22px; font-weight:900; font-family:inherit; color:var(--text); margin-bottom:12px; }
.bil-party-meta { display:grid; grid-template-columns:1fr 1fr; gap:16px; font-size:11px; }
.bil-party-meta .lbl { color:var(--muted); font-weight:800; margin-bottom:4px; text-transform:none; }
.bil-party-meta .val { font-weight:900; color:var(--text); font-size:12px; }
.bil-inv-table { width:100%; border-collapse:collapse; }
.bil-inv-table th { background:var(--cream-2,#F5F0E8); font-size:11px; font-weight:700; color:var(--muted); padding:10px 14px; text-align:left; border-bottom:1px solid var(--border); white-space:nowrap; }
.bil-inv-table td { padding:12px 14px; font-size:13px; border-bottom:1px solid var(--border); vertical-align:middle; }
.bil-inv-table tr:last-child td { border-bottom:none; }
.bil-inv-table tr:hover td { background:var(--cream-2,#F5F0E8); }
.bil-inv-table tr.is-selected td { background:#eef7f1; }
.bil-action-group { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:6px; align-items:stretch; }
.bil-action-group > form { margin:0; width:100%; }
.bil-action-btn { display:inline-flex; align-items:center; justify-content:center; gap:4px; width:100%; padding:7px 8px; font-size:12px; font-weight:700; border-radius:10px; border:1.5px solid var(--border); background:#fff; color:var(--text); text-decoration:none; cursor:pointer; transition:all .15s; white-space:nowrap; min-height:36px; }
.bil-action-btn:hover { background:var(--cream-2); border-color:#ccc; }
.bil-action-btn.pdf { border-color:#1D4ED8; color:#1D4ED8; }
.bil-action-btn.pdf:hover { background:#EFF6FF; }
.bil-action-btn.whatsapp { border-color:#25D366; color:#128C7E; }
.bil-action-btn.whatsapp:hover { background:#F0FFF4; }
.bil-action-btn.email { border-color:var(--accent); color:var(--accent); }
.bil-action-btn.email:hover { background:#FFF7ED; }
.bil-action-btn.cancel { border-color:var(--danger); color:var(--danger); }
.bil-action-btn.cancel:hover { background:#FEF2F2; }
.bil-action-btn:disabled, .bil-action-btn.disabled { opacity:.45; cursor:not-allowed; pointer-events:none; }
.bil-preview-shell { display:grid; gap:0; }
.bil-preview-header { padding:18px 20px; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:flex-start; flex-wrap:wrap; gap:12px; }
.bil-preview-kicker { font-size:11px; font-weight:800; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; margin-bottom:4px; }
.bil-preview-title { font-size:16px; font-weight:800; color:var(--text); margin-bottom:4px; }
.bil-preview-meta { font-size:12px; color:var(--muted); line-height:1.45; }
.bil-preview-table-wrap { overflow-x:auto; }
.bil-preview-totals { display:flex; gap:24px; padding:16px 20px; border-top:1px solid var(--border); flex-wrap:wrap; }
.bil-preview-total-label { font-size:10.5px; font-weight:800; color:var(--muted); }
.bil-preview-total-value { font-size:18px; font-weight:800; font-family:inherit; }
.bil-preview-total-main { margin-left:auto; }
.bil-preview-total-amount { font-size:28px; font-weight:900; font-family:inherit; color:var(--forest); }
.bil-preview-dialog { --app-modal-width: 1100px; --app-modal-padding: 0; max-height:min(88vh, 900px); overflow:hidden; display:grid; grid-template-rows:auto 1fr; }
.bil-preview-topbar { padding:14px 18px; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; gap:10px; background:linear-gradient(180deg,#fffdf9 0%,#ffffff 100%); }
.bil-preview-topbar strong { font-size:14px; color:var(--forest); }
.bil-preview-body { overflow:auto; min-height:180px; }
.bil-preview-loading,
.bil-preview-error { padding:28px; font-weight:700; }
.bil-preview-error { color:var(--danger); }
.bil-preview-close { border:1px solid var(--border); background:#fff; border-radius:10px; padding:8px 12px; font-weight:700; cursor:pointer; }
.bil-email-dialog { --app-modal-width: 420px; --app-modal-padding: 28px; }
.bil-email-dialog h3 { margin-bottom:14px; }
@media(max-width:900px) {
  .bil-kpi-grid { grid-template-columns:1fr 1fr; }
  .bil-party-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .bil-action-group { grid-template-columns:repeat(3, minmax(0, 1fr)); }
  .bil-filter-bar,
  .bil-filter-form {
    flex-wrap:wrap;
  }
  .bil-filter-search,
  .bil-filter-select,
  .bil-filter-submit,
  .bil-filter-clear {
    width:100%;
  }
}
@media(max-width:720px) {
  .bil-preview-dialog { max-height:92vh; }
  .bil-preview-header,
  .bil-preview-totals { padding:14px; }
  .bil-preview-total-main { margin-left:0; }
  .bil-party-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); gap:12px; }
  .bil-party-card { padding:15px; border-radius:18px; }
  .bil-party-name { font-size:14px; line-height:1.3; }
  .bil-party-total { font-size:18px; margin-bottom:10px; word-break:break-word; }
  .bil-party-meta { gap:10px; }
  .bil-action-group { grid-template-columns:repeat(3, minmax(0, 1fr)); width:100%; gap:8px; }
  .bil-action-group > :last-child { grid-column:auto; }
  .bil-action-btn { min-height:34px; padding:6px 8px; border-radius:10px; font-size:12px; }
}
@media(max-width:420px) {
  .bil-kpi-grid { grid-template-columns:1fr; }
  .bil-party-grid { gap:10px; }
  .bil-party-card { padding:14px; }
  .bil-party-meta { grid-template-columns:repeat(2, minmax(0, 1fr)); gap:8px; }
  .bil-email-dialog { --app-modal-padding: 18px; }
  .bil-party-meta .val { font-size:11px; }
  .bil-action-group { grid-template-columns:repeat(2, minmax(0, 1fr)); }
  .bil-action-btn { font-size:11px; min-height:34px; }
}

/* --- Extracted from pages\dashboard.php --- */

.dashboard-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.dashboard-hero-copy h2 {
  margin-bottom: 4px;
}

.dashboard-overview-grid,
.dashboard-summary-grid {
  display: grid;
  gap: 16px;
  margin-top: 12px;
}

.dashboard-overview-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.dashboard-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-kpi-card,
.dashboard-summary-card,
.dashboard-chart-card,
.dashboard-table-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(135deg, #ffffff 0%, #f4fdf8 100%);
  box-shadow: 0 6px 18px rgba(28, 25, 23, 0.03);
}

.dashboard-kpi-card {
  padding: 14px 16px 12px;
}

.dashboard-kpi-card.is-warm,
.dashboard-summary-card.is-warm {
  background: linear-gradient(135deg, #ffffff 0%, #f4fdf8 100%);
  border-color: #eadcc8;
}

.dashboard-kpi-card.is-danger,
.dashboard-summary-card.is-danger {
  background: linear-gradient(135deg, #fff7f7 0%, #ffffff 100%);
  border-color: #fecaca;
}

.dashboard-kpi-label,
.dashboard-summary-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 10px;
}

.dashboard-kpi-value {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.1;
  color: var(--text);
}

.dashboard-kpi-note,
.dashboard-summary-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.dashboard-summary-card {
  padding: 20px;
  display: grid;
  gap: 10px;
}

.dashboard-summary-title {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
  margin: 0;
}

.dashboard-summary-value {
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
  color: var(--forest);
  margin: 0;
}

.dashboard-summary-value.is-danger {
  color: var(--danger);
}

.dashboard-summary-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-summary-stat {
  border: 1px solid rgba(231, 227, 220, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.82);
  padding: 10px 12px;
}

.dashboard-summary-stat .label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 4px;
}

.dashboard-summary-stat .value {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}

.dashboard-summary-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.dashboard-summary-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.dashboard-chart-card,
.dashboard-table-card {
  padding: 18px;
}

.dashboard-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.dashboard-chart-head h3,
.dashboard-table-card h3 {
  margin: 0;
}

.dashboard-chart-copy {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.dashboard-chart-canvas {
  position: relative;
  min-height: 280px;
}

.dashboard-credit-card {
  background: linear-gradient(135deg, #ffffff 0%, #f4fdf8 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 18px;
}
.dashboard-credit-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}
.dashboard-credit-metric .label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 6px;
}
.dashboard-credit-metric .value {
  font-family: inherit;
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
}
.dashboard-credit-metric .value.is-used { color: var(--accent); }
.dashboard-credit-metric .value.is-available { color: var(--forest-mid); }
.dashboard-credit-metric .value.is-overdue { color: var(--danger); }

.dashboard-credit-utilization {
  margin-top: 20px;
}
.dashboard-credit-util-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}
.dashboard-credit-progress {
  height: 8px;
  border-radius: 999px;
  background: #efe6da;
  overflow: hidden;
}
.dashboard-credit-progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
  background: var(--forest-mid);
}
.dashboard-credit-progress-fill.is-medium { background: var(--accent); }
.dashboard-credit-progress-fill.is-high { background: var(--danger); }

@media (max-width: 720px) {
  .dashboard-credit-grid {
    grid-template-columns: 1fr 1fr;
  }
}
.dashboard-overdue-banner {
  background: linear-gradient(135deg, #fff7ed 0%, #ffffff 100%);
  border: 1px solid #fed7aa;
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 18px;
}
.dashboard-overdue-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.dashboard-overdue-metric {
  border-radius: 12px;
  background: rgba(255,255,255,0.9);
  border: 1px solid #fed7aa;
  padding: 12px 14px;
}

.dashboard-overdue-metric .label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 6px;
}

.dashboard-overdue-metric .value {
  font-size: 22px;
  font-weight: 900;
  line-height: 1.1;
}
.dashboard-overdue-modal-card {
  --app-modal-width: 720px;
  --app-modal-padding: 22px;
}
@media (max-width: 720px) {
  .dashboard-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-summary-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-summary-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-summary-actions .btn {
    width: 100%;
  }

  .dashboard-summary-meta {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-overdue-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-header-actions {
    width: 100%;
  }

  .dashboard-header-actions.btn {
    justify-content: center;
  }

  .dashboard-chart-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-chart-canvas {
    min-height: 240px;
  }
}

@media (max-width: 420px) {
  .dashboard-summary-meta,
  .dashboard-summary-actions {
    grid-template-columns: 1fr;
  }

  .dashboard-overview-grid,
  .dashboard-overdue-grid,
  .dashboard-credit-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .dashboard-kpi-card,
  .dashboard-summary-card,
  .dashboard-chart-card,
  .dashboard-table-card {
    padding: 16px;
  }

  .dashboard-kpi-value,
  .dashboard-overdue-metric .value,
  .dashboard-credit-metric .value {
    font-size: 20px;
  }
}

/* --- Extracted from pages\farmers\index.php --- */

.farmers-page-header { display:flex; justify-content:space-between; align-items:flex-end; flex-wrap:wrap; gap:14px; margin-bottom:20px; }
.farmers-filter-card, .farmers-list-card, .farmers-stats-strip { border:1px solid var(--border,#E7E3DC); border-radius:16px; background:#fff; }
.farmers-stats-strip { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); overflow:hidden; margin-bottom:18px; }
.farmers-stat { padding:16px 18px; border-right:1px solid var(--border,#E7E3DC); }
.farmers-stat:last-child { border-right:none; }
.farmers-stat-label { font-size:11px; color:var(--muted,#78716C); font-weight:700; margin-bottom:6px; }
.farmers-stat-value { font-size:24px; font-weight:900; color:var(--text,#1C1917); line-height:1.1; }
.farmers-filter-card { padding:18px; margin-bottom:18px; background:linear-gradient(135deg,#fff 0%,#fdf8f1 100%); }
.farmers-filter-grid { display:grid; grid-template-columns: minmax(0,1.5fr) repeat(3, minmax(0,1fr)); gap:12px; align-items:end; }
.farmers-list-card { overflow:hidden; }
.farmers-list-head { padding:16px 18px; border-bottom:1px solid var(--border,#E7E3DC); display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; }
.farmers-table { width:100%; border-collapse:collapse; }
.farmers-table th { background:var(--cream-2,#F5F0E8); font-size:11px; font-weight:700; color:var(--muted,#78716C); padding:10px 12px; text-align:left; }
.farmers-table td { padding:12px; border-top:1px solid var(--border,#E7E3DC); vertical-align:top; font-size:13px; }
.farmers-table tr:hover td { background:var(--cream,#FEFDF8); }
.farmers-name { font-weight:800; color:var(--text,#1C1917); }
.farmers-subtle { font-size:11px; color:var(--muted,#78716C); margin-top:3px; }
.farmers-badge { display:inline-flex; align-items:center; gap:5px; padding:4px 8px; border-radius:999px; font-size:11px; font-weight:700; }
.farmers-badge.is-active { background:#DCFCE7; color:#15803D; }
.farmers-badge.is-inactive { background:#F5F0E8; color:#78716C; }
.farmers-badge.is-overdue { background:#FEE2E2; color:#DC2626; }
.farmers-badge.is-open { background:#FEF3C7; color:#92400E; }
.farmers-empty { padding:34px 18px; text-align:center; color:var(--muted,#78716C); }
.farmers-modal { --app-modal-width: 860px; --app-modal-padding: 24px 26px; }
.farmers-form-grid { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:14px; }
.farmers-form-grid .span-3 { grid-column:span 3; }
.farmers-helper { font-size:12px; color:var(--muted,#78716C); line-height:1.55; }
@media (max-width: 980px) {
  .farmers-filter-grid, .farmers-form-grid, .farmers-stats-strip { grid-template-columns:1fr 1fr; }
  .farmers-form-grid .span-3 { grid-column:span 2; }
}
@media (max-width: 720px) {
  .farmers-filter-grid, .farmers-form-grid { grid-template-columns:1fr; }
  .farmers-stats-strip { grid-template-columns:repeat(2, minmax(0,1fr)); }
  .farmers-form-grid .span-3 { grid-column:span 1; }
  .farmers-stat {
    border-right:1px solid var(--border,#E7E3DC);
    border-bottom:1px solid var(--border,#E7E3DC);
    min-height:120px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
  }
  .farmers-stat:nth-child(2n) {
    border-right:none;
  }
  .farmers-stat:nth-last-child(-n + 2) {
    border-bottom:none;
  }
}
@media (max-width: 420px) {
  .farmers-stats-strip {
    gap:0;
  }
  .farmers-stat {
    padding:14px 16px;
    min-height:108px;
  }
  .farmers-stat-value {
    font-size:22px;
  }
}

/* --- Extracted from pages\farmers\view.php --- */

.farmer-view-header { display:flex; justify-content:space-between; align-items:flex-end; gap:16px; flex-wrap:wrap; margin-bottom:20px; }
.farmer-header-actions { display:flex; gap:8px; flex-wrap:wrap; }
.farmer-card { border:1px solid var(--border); border-radius:24px; background:linear-gradient(180deg,#ffffff 0%,#fffdf8 100%); overflow:hidden; box-shadow:0 12px 30px rgba(28,25,23,0.06); }
.farmer-card-body { padding:20px; }
.farmer-title { font-size:22px; font-weight:900; color:var(--text,#1C1917); margin-bottom:4px; }
.farmer-subtle { font-size:12px; color:var(--muted,#78716C); line-height:1.55; }
.farmer-summary-strip { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:12px; margin-bottom:18px; }
.farmer-summary-item { border:1px solid var(--border); border-radius:20px; padding:16px 18px; background:radial-gradient(circle at top right, rgba(190,242,204,0.22), transparent 34%), linear-gradient(135deg,#fff 0%,#fdf8f1 100%); box-shadow:0 10px 22px rgba(28,25,23,0.04); }
.farmer-summary-item .label { font-size:11px; color:#667085; font-weight:800; margin-bottom:10px; }
.farmer-summary-item .value { font-size:16px; font-weight:900; color:var(--text,#1C1917); line-height:1.25; }
.farmer-badge { display:inline-flex; align-items:center; gap:6px; padding:5px 9px; border-radius:999px; font-size:11px; font-weight:700; }
.farmer-badge.is-active { background:#DCFCE7; color:#15803D; }
.farmer-badge.is-inactive { background:#F5F0E8; color:#78716C; }
.farmer-badge.is-open { background:#FEF3C7; color:#92400E; }
.farmer-badge.is-completed { background:#DCFCE7; color:#15803D; }
.farmer-badge.is-cancelled { background:#FEE2E2; color:#DC2626; }
.farmer-profile-grid { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:14px; }
.farmer-profile-field { border:1px solid var(--border); border-radius:18px; padding:15px 16px; background:linear-gradient(135deg,#fff 0%,#fdf8f1 100%); }
.farmer-profile-field .label { font-size:11px; color:var(--muted,#78716C); font-weight:800; margin-bottom:8px; }
.farmer-profile-field .value { font-size:14px; font-weight:700; color:var(--text,#1C1917); line-height:1.45; word-break:break-word; }
.farmer-profile-field.is-contact { background:radial-gradient(circle at top right, rgba(12,154,71,0.1), transparent 34%), linear-gradient(135deg,#fff 0%,#fdf8f1 100%); }
.farmer-profile-field.is-contact.is-whatsapp { background:radial-gradient(circle at top right, rgba(34,197,94,0.12), transparent 34%), linear-gradient(135deg,#fff 0%,#fdf8f1 100%); }
.farmer-contact-value-row { display:flex; align-items:center; gap:10px; justify-content:space-between; flex-wrap:wrap; }
.farmer-contact-icon { width:40px; height:40px; border-radius:14px; display:inline-flex; align-items:center; justify-content:center; background:#ECFDF3; color:#15803D; flex-shrink:0; }
.farmer-contact-icon.is-whatsapp { background:#DCFCE7; color:#16A34A; }
.farmer-contact-text { flex:1; min-width:0; }
.farmer-contact-text .value { margin:0; }
.farmer-contact-actions { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }
.farmer-contact-action { display:inline-flex; align-items:center; gap:6px; padding:8px 12px; border-radius:12px; border:1px solid var(--border); background:#fff; font-size:12px; font-weight:800; color:var(--text,#1C1917); text-decoration:none; }
.farmer-contact-action.is-whatsapp { background:#ECFDF3; border-color:#BBF7D0; color:#15803D; }
.farmer-activity-list { display:grid; gap:12px; }
.farmer-activity-item { border:1px solid var(--border); border-radius:20px; padding:16px 18px; background:linear-gradient(180deg,#ffffff 0%,#fffdfa 100%); box-shadow:0 10px 24px rgba(28,25,23,0.04); }
.farmer-activity-head { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; flex-wrap:wrap; margin-bottom:10px; }
.farmer-activity-meta { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.farmer-activity-launch-card { border:1px dashed rgba(45,106,79,0.24); border-radius:20px; padding:18px; background:linear-gradient(135deg,#fff 0%,#f6fbf8 100%); display:flex; justify-content:space-between; align-items:center; gap:14px; flex-wrap:wrap; }
.farmer-activity-launch-copy { max-width:680px; }
.farmer-activity-modal { --app-modal-width: 860px; --app-modal-padding: 24px; }
.farmer-activity-modal-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; flex-wrap:wrap; margin-bottom:16px; }
.farmer-activity-modal-grid { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:14px; }
.farmer-activity-modal-grid .span-3 { grid-column:span 3; }
.farmer-activity-modal input,
.farmer-activity-modal select,
.farmer-activity-modal textarea {
  min-height:52px;
  border-radius:16px;
}
.farmer-activity-modal textarea {
  min-height:110px;
}
.farmer-activity-modal-actions { margin-top:18px; justify-content:flex-end; }
@media (max-width: 980px) {
  .farmer-summary-strip,
  .farmer-profile-grid,
  .farmer-activity-modal-grid { grid-template-columns:1fr 1fr; }
  .farmer-activity-modal-grid .span-3 { grid-column:span 2; }
}
@media (max-width: 720px) {
  .farmer-view-header { align-items:flex-start; }
  .farmer-header-actions {
    width:100%;
    display:grid;
    grid-template-columns:repeat(2, minmax(0,1fr));
    gap:10px;
  }
  .farmer-header-actions .btn {
    width:100%;
    min-height:52px;
    border-radius:16px;
    justify-content:center;
  }
  .farmer-title {
    font-size:24px;
    line-height:1.15;
  }
  .farmer-summary-strip,
  .farmer-profile-grid,
  .farmer-activity-modal-grid { grid-template-columns:repeat(2, minmax(0,1fr)); }
  .farmer-activity-modal-grid .span-3 { grid-column:span 2; }
  .farmer-card-body { padding:18px; }
  .farmer-summary-item,
  .farmer-profile-field {
    min-height:118px;
    padding:16px;
    border-radius:20px;
    display:flex;
    flex-direction:column;
    justify-content:space-between;
  }
  .farmer-summary-item .label,
  .farmer-profile-field .label {
    font-size:11px;
    margin-bottom:10px;
  }
  .farmer-summary-item .value {
    font-size:17px;
  }
  .farmer-contact-value-row {
    align-items:flex-start;
    gap:12px;
  }
  .farmer-contact-icon {
    width:42px;
    height:42px;
    border-radius:15px;
  }
  .farmer-contact-actions {
    margin-top:14px;
  }
  .farmer-contact-action {
    width:100%;
    justify-content:center;
    min-height:42px;
    border-radius:14px;
  }
  .farmer-activity-item {
    border-radius:22px;
    padding:18px;
  }
  .farmer-activity-launch-card {
    padding:16px;
    border-radius:18px;
  }
  .farmer-activity-launch-card .btn {
    width:100%;
    justify-content:center;
  }
  .farmer-activity-modal-actions { justify-content:stretch; }
  .farmer-activity-modal-actions .btn { width:100%; }
}

@media (max-width: 420px) {
  .farmer-card {
    border-radius:22px;
  }
  .farmer-card-body {
    padding:16px;
  }
  .farmer-summary-strip,
  .farmer-profile-grid,
  .farmer-activity-modal-grid {
    gap:12px;
  }
  .farmer-summary-item,
  .farmer-profile-field {
    min-height:108px;
    padding:14px;
  }
  .farmer-summary-item .label,
  .farmer-profile-field .label {
    font-size:10px;
  }
  .farmer-summary-item .value,
  .farmer-profile-field .value {
    font-size:13px;
  }
  .farmer-badge {
    font-size:10px;
    padding:5px 8px;
  }
  .farmer-contact-action {
    font-size:11px;
    padding:8px 10px;
  }
}

/* --- Extracted from pages\orders\index.php --- */

.orders-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  padding: 18px 18px 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(135deg, #ffffff 0%, #f0fbf4 100%);
  box-shadow: 0 10px 24px rgba(28, 25, 23, 0.04);
}

.orders-page-header-copy {
  display: grid;
  gap: 4px;
}

.orders-page-header h2 {
  margin: 0;
}

.orders-page-eyebrow {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .02em;
  color: var(--forest-mid);
  text-transform: uppercase;
}

.orders-page-tabs {
  display:flex;
  gap:6px;
  background:rgba(255,255,255,0.72);
  border:1px solid rgba(228,230,213,0.95);
  border-radius:18px;
  padding:6px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

.orders-page-tab {
  min-height:44px;
  padding:9px 16px;
  border-radius:14px;
  font-size:13px;
  font-weight:800;
  color:var(--muted,#78716C);
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  transition:all .15s;
}

.orders-page-tab:hover {
  color: var(--text);
}

.orders-page-tab.is-active {
  background:#fff;
  color:var(--text,#1C1917);
  box-shadow:0 6px 14px rgba(28,25,23,0.08);
}

.orders-overview-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
  grid-auto-flow: row dense;
}

.orders-overview-card {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(135deg, #ffffff 0%, #f4fdf8 100%);
  padding: 16px 16px 14px;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(28, 25, 23, 0.04);
}

.orders-overview-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 800;
  text-transform: none;
  letter-spacing: normal;
  margin-bottom: 8px;
}

.orders-overview-value {
  font-family: inherit;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
}

.orders-overview-note {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

.orders-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.orders-section-card {
  padding: 20px;
}

.orders-section-title {
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  color: var(--forest);
  margin-bottom: 14px;
}

.orders-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.orders-detail-grid .span-2 {
  grid-column: span 2;
}

.orders-credit-strip {
  background: linear-gradient(90deg, #fffaf2 0%, #f6efe5 55%, #fffaf2 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 18px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 14px;
}

.orders-credit-metric {
  min-width: 95px;
}

.orders-credit-label {
  font-size: 10.5px;
  color: var(--muted);
  font-weight: 800;
  text-transform: none;
  letter-spacing: normal;
  margin-bottom: 5px;
}

.orders-credit-value {
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.orders-credit-value.is-used,
.orders-credit-utilization-value.is-medium {
  color: var(--accent);
}

.orders-credit-value.is-available,
.orders-credit-value.is-overdue-zero,
.orders-credit-utilization-value.is-low {
  color: var(--forest-mid);
}

.orders-credit-value.is-overdue-high,
.orders-credit-utilization-value.is-high {
  color: var(--danger);
}

.orders-credit-utilization {
  margin-left: auto;
  min-width: 140px;
}

.orders-credit-progress {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: #efe6da;
}

.orders-credit-progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width .2s ease, background-color .2s ease;
}

.orders-credit-progress-fill.is-low { background: var(--forest-mid); }
.orders-credit-progress-fill.is-medium { background: var(--accent); }
.orders-credit-progress-fill.is-high { background: var(--danger); }

.orders-credit-utilization-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.orders-credit-warning {
  width: 100%;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(120, 113, 108, 0.18);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.orders-credit-warning.is-safe {
  color: var(--forest-mid);
}

.orders-credit-warning.is-caution {
  color: var(--accent);
}

.orders-credit-warning.is-danger {
  color: var(--danger);
}

.orders-products-header,
.orders-table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.orders-table-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.orders-search-shell {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(90deg, #ffffff 0%, #f4fdf8 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 14px;
  min-width: 320px;
}

.orders-search-shell input {
  border: 0;
  background: transparent;
  padding: 0;
  outline: none;
}

.orders-search-shell kbd {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.7);
  border-radius: 10px;
  padding: 4px 7px;
  color: var(--muted);
  font-size: 11px;
  font-family: inherit;
  font-weight: 700;
}

.orders-filter-select {
  min-width: 180px;
}

.orders-inline-note {
  font-size: 12px;
  color: var(--muted);
}

.orders-list-toolbar {
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  margin-bottom:14px;
  flex-wrap:nowrap;
}

.orders-list-heading {
  display:flex;
  align-items:center;
  gap:16px;
  min-width:0;
}

.orders-list-controls {
  display:flex;
  gap:10px;
  align-items:center;
  flex-shrink:0;
}

.orders-items-table td,
.orders-items-table th {
  white-space: nowrap;
}

.orders-items-table td:first-child,
.orders-items-table th:first-child {
  white-space: normal;
  min-width: 240px;
}

.orders-line-total {
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--forest);
}

.orders-summary-card {
  position: sticky;
  top: 24px;
}

.orders-summary-top {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}

.orders-summary-top .eyebrow {
  font-size: 11px;
  color: var(--muted);
  text-transform: none;
  font-weight: 800;
  letter-spacing: normal;
  margin-bottom: 6px;
}

.orders-summary-party-name {
  font-family: inherit;
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 4px;
}

.orders-summary-party-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.orders-summary-rows {
  display: grid;
  gap: 10px;
}

.orders-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.orders-summary-row span:first-child {
  color: var(--muted);
  font-weight: 700;
}

.orders-summary-row span:last-child {
  font-family: inherit;
  font-weight: 800;
}

.orders-summary-total {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.orders-summary-total-label {
  font-size: 14px;
  font-weight: 800;
}

.orders-summary-total-value {
  font-family: inherit;
  font-size: 24px;
  font-weight: 900;
  color: var(--forest);
}

.orders-rules-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.orders-rule-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 12px;
  color: var(--muted);
}

.orders-rule-icon {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--cream-2);
  color: var(--forest);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.orders-record-table td:first-child {
  min-width: 150px;
}

.orders-record-party {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.orders-record-code {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.orders-status-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.orders-empty-state {
  padding: 26px 0;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .orders-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .orders-layout {
    grid-template-columns: 1fr;
  }

  .orders-summary-card {
    position: static;
  }
}

@media (max-width: 720px) {
  .orders-page-header {
    padding: 16px 14px 14px;
    border-radius: 22px;
  }

  .orders-page-header-copy,
  .orders-page-tabs {
    width: 100%;
  }

  .orders-page-tabs {
    gap: 6px;
  }

  .orders-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .orders-detail-grid .span-2 {
    grid-column: span 1;
  }

  .orders-credit-utilization {
    margin-left: 0;
    width: 100%;
  }

  .orders-page-tabs {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .orders-page-tab {
    text-align: center;
    justify-content: center;
  }

  .orders-overview-card:last-child {
    grid-column: span 2;
  }

  .orders-list-toolbar,
  .orders-list-heading,
  .orders-list-controls {
    width:100%;
    flex-wrap:wrap;
  }

  .orders-search-shell,
  .orders-filter-select {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 420px) {
  .orders-overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .orders-overview-card {
    min-height: 108px;
    padding: 14px 12px;
    border-radius: 20px;
  }

  .orders-overview-value {
    font-size: 20px;
  }

  .orders-overview-note {
    font-size: 10px;
    margin-top: 5px;
  }

  .orders-overview-card:last-child {
    grid-column: span 2;
  }
}

/* --- Extracted from pages\parties\index.php --- */

.party-page-header { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:12px; margin-bottom:20px; }
.party-tab-bar { display:flex; gap:2px; background:var(--cream-2,#F5F0E8); border-radius:10px; padding:3px; }
.party-tab-item { padding:7px 18px; border-radius:8px; font-size:13px; font-weight:700; cursor:pointer; color:var(--muted,#78716C); text-decoration:none; transition:all .15s; }
.party-tab-item.active { background:#fff; color:var(--text,#1C1917); box-shadow:0 1px 4px rgba(0,0,0,0.08); }
.data-table { width:100%; border-collapse:collapse; }
.data-table th { background:var(--cream-2,#F5F0E8); font-size:11px; font-weight:700; letter-spacing:normal; color:var(--muted,#78716C); text-transform:none; padding:10px 14px; text-align:left; border-bottom:1px solid var(--border,#E7E3DC); }
.data-table td { padding:12px 14px; font-size:13.5px; border-bottom:1px solid var(--border,#E7E3DC); vertical-align:middle; }
.data-table tr:last-child td { border-bottom:none; }
.data-table tr:hover td { background:var(--cream-2,#F5F0E8); }
.party-avatar { width:36px; height:36px; border-radius:50%; background:#D8F3DC; color:#1B4332; display:flex; align-items:center; justify-content:center; font-size:12px; font-weight:800; flex-shrink:0; }
.stats-strip { display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:0; border:1px solid var(--border,#E7E3DC); border-radius:12px; overflow:hidden; margin-bottom:18px; background:#fff; }
.stats-strip-item { min-width:0; padding:14px 18px; border-right:1px solid var(--border,#E7E3DC); }
.stats-strip-item:last-child { border-right:none; }
.stats-strip-label { font-size:10.5px; font-weight:700; color:var(--muted,#78716C); text-transform:none; letter-spacing:normal; margin-bottom:4px; }
.stats-strip-value { font-family:inherit; font-size:20px; font-weight:800; }
.field-label { font-size:11px; font-weight:700; color:var(--muted,#78716C); text-transform:none; letter-spacing:normal; margin-bottom:5px; }
.field-input { width:100%; border:1.5px solid var(--border,#E7E3DC); border-radius:10px; padding:10px 12px; font-family:inherit; font-size:13.5px; color:var(--text,#1C1917); background:var(--cream,#FEFDF8); outline:none; transition:border-color .15s; }
.field-input:focus { border-color:#2D6A4F; background:#fff; }
.form-grid-3 { display:grid; grid-template-columns:1fr 1fr 1fr; gap:14px; }
.form-grid-2 { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
@media(max-width:768px) {
  .form-grid-3,
  .form-grid-2 { grid-template-columns:1fr; }
  .party-page-header { flex-direction:column; align-items:flex-start; }
  .stats-strip {
    grid-template-columns:repeat(2, minmax(0,1fr));
  }
  .stats-strip-item {
    min-height:118px;
    padding:16px;
    border-right:1px solid var(--border,#E7E3DC);
    border-bottom:1px solid var(--border,#E7E3DC);
    display:flex;
    flex-direction:column;
    justify-content:space-between;
  }
  .stats-strip-item:nth-child(2n) {
    border-right:none;
  }
  .stats-strip-item:nth-last-child(-n + 2) {
    border-bottom:none;
  }
  .stats-strip-label {
    font-size:11px;
    margin-bottom:10px;
  }
  .stats-strip-value {
    font-size:18px;
    line-height:1.2;
    word-break:break-word;
  }
}

@media(max-width:420px) {
  .stats-strip-item {
    min-height:104px;
    padding:14px;
  }
  .stats-strip-label {
    font-size:10px;
  }
  .stats-strip-value {
    font-size:16px;
  }
}
.badge-green { background:#DCFCE7; color:#15803D; }
.badge-amber { background:#FEF3C7; color:#92400E; }
.badge-red { background:#FEE2E2; color:#DC2626; }
.badge-grey { background:#F5F0E8; color:#78716C; }
.badge-blue { background:#EFF6FF; color:#1D4ED8; }
.badge { display:inline-flex; align-items:center; gap:4px; padding:3px 8px; border-radius:6px; font-size:11px; font-weight:700; }
.party-modal { --app-modal-width: 720px; --app-modal-padding: 28px 30px; }
.import-template-panel {
  background:linear-gradient(135deg,#f0fbf4 0%, #ffffff 100%);
  border:1px solid var(--border,#E7E3DC);
  border-radius:14px;
  padding:14px 16px;
  margin-bottom:14px;
}
.import-template-actions {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:10px;
}
.import-template-chip {
  display:inline-flex;
  align-items:center;
  gap:6px;
  text-decoration:none;
  font-size:12px;
  font-weight:700;
}
.sort-link {
  display:inline-flex;
  align-items:center;
  gap:6px;
  color:inherit;
  text-decoration:none;
  white-space:nowrap;
}
.sort-link.is-active { color:var(--forest,#1B4332); }
.sort-caret {
  display:inline-flex;
  flex-direction:column;
  gap:2px;
  min-width:8px;
}
.sort-caret span {
  width:0;
  height:0;
  border-left:4px solid transparent;
  border-right:4px solid transparent;
  opacity:.28;
}
.sort-caret .up { border-bottom:5px solid currentColor; }
.sort-caret .down { border-top:5px solid currentColor; }
.sort-link.is-active .sort-caret span { opacity:.38; }
.sort-link.is-active .sort-caret span.active { opacity:1; }

/* --- Extracted from pages\payments\index.php --- */

/* Header */
.pay-header { display:flex; justify-content:space-between; align-items:flex-end; gap:16px; flex-wrap:wrap; margin-bottom:18px; padding:18px 18px 16px; border:1px solid var(--border); border-radius:24px; background:linear-gradient(135deg,#ffffff 0%, #f0fbf4 100%); box-shadow:0 10px 24px rgba(28,25,23,0.04); }
.pay-header-copy { display:grid; gap:4px; }
.pay-header-copy h2 { margin:0; }
.pay-header-eyebrow { font-size:11px; font-weight:800; letter-spacing:.02em; color:var(--forest-mid); text-transform:uppercase; }

/* Tab Bar */
.pay-tab-bar { display:flex; gap:6px; background:rgba(255,255,255,0.72); border:1px solid rgba(228,230,213,0.95); border-radius:18px; padding:6px; box-shadow:inset 0 1px 0 rgba(255,255,255,0.8); }
.pay-tab { min-height:44px; padding:9px 16px; border-radius:14px; font-size:13px; font-weight:800; color:var(--muted,#78716C); text-decoration:none; transition:all .15s; display:inline-flex; align-items:center; justify-content:center; gap:6px; }
.pay-tab:hover { color:var(--text,#1C1917); }
.pay-tab.active { background:#fff; color:var(--text,#1C1917); box-shadow:0 6px 14px rgba(28,25,23,0.08); }
.pay-tab .count { font-size:11px; font-weight:800; background:var(--forest,#1B4332); color:#fff; border-radius:999px; padding:2px 7px; line-height:1.35; }

/* KPI Cards */
.pay-kpi-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; margin-bottom:18px; }
.pay-kpi { border:1px solid var(--border); border-radius:22px; background:linear-gradient(135deg,#fff 0%,#f6fbf8 100%); padding:16px 16px 14px; min-height:118px; display:flex; flex-direction:column; justify-content:center; box-shadow:0 8px 20px rgba(28,25,23,0.04); }
.pay-kpi-label { font-size:10.5px; font-weight:800; color:var(--muted); margin-bottom:6px; text-transform:none; letter-spacing:normal; }
.pay-kpi-value { font-size:24px; font-weight:900; font-family:inherit; color:var(--forest,#1B4332); line-height:1.1; }

/* Tab Content */
.pay-tab-content { display:none; }
.pay-tab-content.active { display:block; }

/* Payments List Table */
.pay-table { width:100%; border-collapse:collapse; }
.pay-table th { background:var(--cream-2,#F5F0E8); font-size:11px; font-weight:700; color:var(--muted); padding:10px 14px; text-align:left; border-bottom:1px solid var(--border); white-space:nowrap; }
.pay-table td { padding:12px 14px; font-size:13px; border-bottom:1px solid var(--border); vertical-align:middle; }
.pay-table tr:last-child td { border-bottom:none; }
.pay-table tr:hover td { background:var(--cream-2,#F5F0E8); }

/* Ledger Cards */
.pay-ledger-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:14px; }
.pay-ledger-card { border:1px solid var(--border); border-radius:14px; background:linear-gradient(135deg,#fff 0%,#fdf8f1 100%); padding:16px 18px; }
.pay-ledger-top { display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:10px; }
.pay-ledger-name { font-weight:800; font-size:14px; }
.pay-ledger-code { font-size:11px; color:var(--muted); font-weight:700; }
.pay-ledger-stats { display:grid; grid-template-columns:repeat(3,1fr); gap:10px; margin-top:10px; }
.pay-ledger-stats .lbl { font-size:10px; color:var(--muted); font-weight:800; margin-bottom:4px; }
.pay-ledger-stats .val { font-family:inherit; font-size:16px; font-weight:800; }

/* Record Form */
.pay-form-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:12px; }
.pay-form-grid .span-2 { grid-column:span 2; }

/* Filter Bar */
.pay-filter-bar { display:flex; gap:10px; align-items:center; flex-wrap:nowrap; margin-bottom:14px; }
.pay-filter-search { display:flex; align-items:center; gap:8px; background:var(--cream,#FEFDF8); border:1px solid var(--border); border-radius:12px; padding:10px 14px; flex:1; min-width:0; }
.pay-filter-search input { border:none; background:none; outline:none; font-family:inherit; font-size:13px; width:100%; color:var(--text); }
.pay-toolbar { display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; flex-wrap:wrap; gap:10px; }
.pay-search-shell { display:flex; align-items:center; gap:8px; background:var(--cream-2,#F5F0E8); border:1px solid var(--border,#E7E3DC); border-radius:10px; padding:7px 12px; min-width:0; }
.pay-search-shell input { background:none; border:none; outline:none; font-family:inherit; font-size:13px; color:var(--text,#1C1917); width:180px; max-width:100%; }
.pay-pagination { margin-top:14px; padding-top:14px; border-top:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.pay-pagination-actions { display:flex; gap:8px; align-items:center; }

/* Responsive */
@media (max-width: 1024px) {
  .pay-kpi-grid { grid-template-columns:repeat(2,1fr); }
  .pay-ledger-grid { grid-template-columns:1fr; }
}
@media (max-width: 720px) {
  .pay-header {
    padding:16px 14px 14px;
    border-radius:22px;
  }

  .pay-header-copy {
    width:100%;
  }

  .pay-tab-bar { flex-wrap:wrap; width:100%; }
  .pay-kpi-grid { grid-template-columns:repeat(2,1fr); }
  .pay-form-grid { grid-template-columns:1fr; }
  .pay-form-grid .span-2 { grid-column:span 1; }
  .pay-tab { flex:1 1 calc(50% - 6px); justify-content:center; }
  .pay-filter-bar { flex-wrap:wrap; }
  .pay-search-shell {
    width:100%;
  }
  .pay-search-shell input {
    width:100%;
  }
  .pay-pagination,
  .pay-pagination-actions {
    width:100%;
  }
  .pay-pagination-actions .btn,
  .pay-pagination-actions span {
    flex:1 1 0;
    text-align:center;
    justify-content:center;
  }
}
@media (max-width: 420px) {
  .pay-kpi-grid { grid-template-columns:repeat(2,1fr); gap:10px; }
  .pay-kpi { min-height:110px; padding:14px 12px; border-radius:20px; }
  .pay-kpi-label { font-size:10px; }
  .pay-kpi-value { font-size:20px; }
}
@media (max-width: 340px) {
  .pay-kpi-grid { grid-template-columns:1fr; }
}

/* --- Extracted from pages\products\index.php --- */

.pricebook-grid { display:grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap:16px; margin-bottom:18px; }
.pricebook-card { padding:20px; }
.pricebook-kpis { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:12px; margin-top:14px; }
.pricebook-kpi { border:1px solid var(--border,#E7E3DC); border-radius:12px; padding:12px 14px; background:linear-gradient(135deg,#fff 0%,#fdf8f1 100%); }
.pricebook-kpi-label { font-size:11px; color:var(--muted,#78716C); font-weight:700; margin-bottom:4px; }
.pricebook-kpi-value { font-size:20px; font-weight:800; color:var(--forest,#1B4332); }
.pricebook-table td,.pricebook-table th { white-space:nowrap; }
.pricebook-table td:nth-child(2), .pricebook-table th:nth-child(2) { white-space:normal; min-width:220px; }
@media (max-width: 980px) {
  .pricebook-grid { grid-template-columns:1fr; }
  .pricebook-kpis { grid-template-columns:repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .pricebook-kpis { grid-template-columns:1fr; }
}
.prod-modal { --app-modal-width: 720px; --app-modal-padding: 0; overflow:hidden; }
.prod-modal-header { padding:22px 28px; border-bottom:1px solid var(--border,#E7E3DC); display:flex; justify-content:space-between; align-items:center; }
.prod-modal-body { padding:28px; }
@media (max-width: 760px) {
  .prod-modal-header { padding:18px; }
  .prod-modal-body { padding:18px; }
}

/* --- Extracted from pages\products\price_book_view.php --- */

.pricebook-kpis { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:12px; margin-bottom:24px; }
.pricebook-kpi { border:1px solid var(--border,#E7E3DC); border-radius:12px; padding:16px; background:linear-gradient(135deg,#fff 0%,#fdf8f1 100%); }
.pricebook-kpi-label { font-size:11px; color:var(--muted,#78716C); font-weight:700; margin-bottom:6px; text-transform:uppercase; letter-spacing:0.05em; }
.pricebook-kpi-value { font-size:24px; font-weight:800; color:var(--forest,#1B4332); }
.pricebook-table td, .pricebook-table th { white-space:nowrap; }
.pricebook-table td:nth-child(2), .pricebook-table th:nth-child(2) { white-space:normal; min-width:220px; }

.action-bar { display:flex; justify-content:space-between; align-items:center; margin-bottom:24px; gap:16px; flex-wrap:wrap; }
.action-group { display:flex; gap:12px; }

.modal-content { --app-modal-width: 500px; --app-modal-padding: 32px; }

/* --- Extracted from pages\reports\index.php --- */

.rpt-page-header { display:flex; justify-content:space-between; align-items:flex-end; gap:16px; flex-wrap:wrap; margin-bottom:18px; }
.rpt-title { margin-bottom:4px; }
.rpt-subtitle { max-width:720px; color:var(--muted,#6B7280); }
.rpt-scope-badge { display:inline-flex; align-items:center; gap:6px; background:#DCFCE7; color:#15803D; border-radius:999px; padding:5px 12px; font-size:11px; font-weight:700; }
.rpt-scope-badge.limited { background:#FEF3C7; color:#92400E; }

.rpt-filter-bar { display:grid; gap:12px; background:var(--cream,#FEFDF8); border:1px solid var(--border,#E7E3DC); border-radius:14px; padding:16px 18px; margin-bottom:18px; }
.rpt-filter-head { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.rpt-filter-label { font-size:12px; font-weight:700; color:var(--muted,#6B7280); }
.rpt-filter-form { display:grid; grid-template-columns:repeat(auto-fit, minmax(180px, 1fr)); gap:12px; align-items:end; }
.rpt-filter-field { min-width:0; }
.rpt-filter-field select,
.rpt-filter-field input[type="date"] { width:100%; min-width:0; }
.rpt-filter-actions { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.rpt-filter-summary { font-size:12px; color:var(--muted,#6B7280); }
.rpt-filter-summary strong { color:var(--text,#1C1917); }

.rpt-kpi-grid { display:grid; grid-template-columns:repeat(4, minmax(0, 1fr)); gap:14px; margin-bottom:18px; }
.rpt-kpi { border:1px solid var(--border,#E7E3DC); border-radius:14px; background:linear-gradient(135deg,#fff 0%,#f6fbf8 100%); padding:16px 18px; }
.rpt-kpi-label { font-size:10.5px; font-weight:800; color:var(--muted,#6B7280); margin-bottom:6px; }
.rpt-kpi-value { font-size:24px; font-weight:900; color:var(--forest,#0C9A47); line-height:1.1; }
.rpt-kpi-sub { font-size:11px; color:var(--muted,#6B7280); margin-top:5px; }
.rpt-kpi-grid.is-compact .rpt-kpi { padding:14px 16px; background:linear-gradient(135deg,#fff 0%,#fdf8f1 100%); }
.rpt-kpi-grid.is-compact .rpt-kpi-value { font-size:20px; }

.rpt-table { width:100%; border-collapse:collapse; }
.rpt-table th { background:var(--cream-2,#F5F0E8); font-size:11px; font-weight:700; color:var(--muted,#6B7280); padding:10px 14px; text-align:left; border-bottom:1px solid var(--border,#E7E3DC); white-space:nowrap; }
.rpt-table td { padding:12px 14px; font-size:13px; border-bottom:1px solid var(--border,#E7E3DC); vertical-align:middle; }
.rpt-table tr:last-child td { border-bottom:none; }
.rpt-table tr:hover td { background:var(--cream-2,#F5F0E8); }

.rpt-section-head { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:10px; margin-bottom:14px; }
.rpt-section-title { font-size:16px; font-weight:700; color:var(--forest,#0C9A47); }

.rpt-search-box { display:flex; align-items:center; gap:6px; background:var(--cream-2,#F5F0E8); border:1px solid var(--border,#E7E3DC); border-radius:8px; padding:6px 10px; }
.rpt-search-box input { border:none; background:none; outline:none; font-family:inherit; font-size:13px; width:210px; padding:0; }
.rpt-import-note { font-size:12px; color:var(--muted,#6B7280); line-height:1.55; }
.rpt-party-avatar { width:32px; height:32px; border-radius:50%; background:#D8F3DC; color:#1B4332; display:flex; align-items:center; justify-content:center; font-size:11px; font-weight:800; flex-shrink:0; }

@media (max-width: 960px) {
  .rpt-kpi-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .rpt-filter-actions { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); width:100%; }
  .rpt-filter-actions .btn { width:100%; justify-content:center; }
  .rpt-section-head > div:last-child { width:100%; flex-wrap:wrap; }
  .rpt-search-box,
  .rpt-search-box input { width:100%; }
}

@media (max-width: 520px) {
  .rpt-kpi-grid { grid-template-columns:1fr; }
  .rpt-filter-form { grid-template-columns:1fr; }
}

/* --- Extracted from pages\returns\index.php --- */

.ret-hero { display:flex; justify-content:space-between; align-items:flex-end; gap:16px; flex-wrap:wrap; margin-bottom:20px; }
.ret-grid { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:16px; margin-bottom:18px; }
.ret-kpi { background:#fff; border:1px solid var(--border); border-radius:16px; padding:18px 20px; }
.ret-kpi .label { font-size:11px; font-weight:800; color:var(--muted); margin-bottom:8px; }
.ret-kpi .value { font-size:28px; font-weight:900; color:var(--text); line-height:1; }
.ret-note { background:#FFF7E8; color:#8A5A00; padding:12px 14px; border:1px solid #F3D6A2; border-radius:12px; margin-bottom:18px; font-size:13px; }
.ret-form-card { background:#fff; border:1px solid var(--border); border-radius:18px; padding:22px; margin-bottom:22px; }
.ret-form-card h3 { margin-bottom:8px; }
.ret-inline-meta { font-size:12px; color:var(--muted); margin-top:6px; }
.ret-items-wrap { margin-top:16px; border:1px solid var(--border); border-radius:16px; overflow:hidden; }
.ret-items-header { padding:14px 16px; background:var(--cream-2,#F5F0E8); border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; }
.ret-items-empty { padding:22px 16px; color:var(--muted); font-size:13px; text-align:center; }
.ret-items-table { width:100%; border-collapse:collapse; }
.ret-items-table th, .ret-items-table td { padding:12px 14px; border-bottom:1px solid var(--border); text-align:left; vertical-align:middle; }
.ret-items-table th { font-size:11px; font-weight:800; color:var(--muted); background:#fff; }
.ret-items-table td { font-size:13px; }
.ret-qty-input { width:94px; }
.ret-qty-input.invalid { border-color:#DC2626; background:#FEF2F2; }
.ret-remaining.safe { color:#166534; font-weight:800; }
.ret-remaining.warn { color:#B45309; font-weight:800; }
.ret-remaining.danger { color:#B91C1C; font-weight:800; }
.ret-summary-strip { display:flex; gap:12px; flex-wrap:wrap; margin-top:14px; }
.ret-summary-pill { background:var(--cream,#FEFDF8); border:1px solid var(--border); border-radius:999px; padding:8px 12px; font-size:12px; font-weight:700; color:var(--text); }
.ret-credit-badge { display:inline-flex; align-items:center; gap:6px; background:#ECFDF5; color:#166534; border:1px solid #A7F3D0; border-radius:999px; padding:5px 10px; font-size:11px; font-weight:800; }
@media (max-width: 900px) {
  .ret-grid { grid-template-columns:repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .ret-grid { grid-template-columns:1fr; }
}

/* --- Extracted from pages\settings\index.php --- */

.settings-page-header {
  display:flex;
  justify-content:space-between;
  align-items:flex-end;
  gap:16px;
  flex-wrap:wrap;
  padding:18px 18px 16px;
  border:1px solid var(--border);
  border-radius:24px;
  background:linear-gradient(135deg,#ffffff 0%, #f0fbf4 100%);
  box-shadow:0 10px 24px rgba(28,25,23,0.04);
  margin-bottom:16px;
}

.settings-page-copy {
  display:grid;
  gap:4px;
}

.settings-page-copy h2 {
  margin:0;
}

.settings-page-eyebrow {
  font-size:11px;
  font-weight:800;
  letter-spacing:.02em;
  color:var(--forest-mid);
  text-transform:uppercase;
}

.settings-page-chip {
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height:42px;
  padding:9px 14px;
  border-radius:999px;
  background:rgba(255,255,255,0.76);
  border:1px solid rgba(228,230,213,0.95);
  color:var(--forest);
  font-size:12px;
  font-weight:800;
}

.settings-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.settings-metrics-grid .kpi {
  border-radius: 22px;
  background: linear-gradient(135deg, #ffffff 0%, #f4fdf8 100%);
  padding: 16px 16px 14px;
  min-height: 116px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(28, 25, 23, 0.04);
}

.settings-metrics-grid .kpi .label {
  font-size: 10.5px;
  font-weight: 800;
  margin-bottom: 6px;
}

.settings-metrics-grid .kpi .value {
  font-size: 24px;
  line-height: 1.1;
  margin-top: 0;
}

@media (max-width: 960px) {
  .settings-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 420px) {
  .settings-page-header {
    padding:16px 14px 14px;
    border-radius:22px;
  }

  .settings-page-copy,
  .settings-page-chip {
    width:100%;
  }

  .settings-page-chip {
    justify-content:center;
  }

  .settings-metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .settings-metrics-grid .kpi {
    min-height: 108px;
    padding: 14px 12px;
    border-radius: 20px;
  }

  .settings-metrics-grid .kpi .value {
    font-size: 20px;
  }
}

@media (max-width: 340px) {
  .settings-metrics-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Extracted from pages\settings\module_access.php --- */

.module-access-hero { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:14px; margin-bottom:18px; }
.module-access-note { background:linear-gradient(135deg,#f0fbf4 0%, #ffffff 100%); border:1px solid var(--border,#E7E3DC); border-radius:18px; padding:18px; }
.module-access-note h3 { margin-bottom:6px; }
.module-access-note p { margin:0; }
.module-matrix-wrap { overflow:auto; }
.module-matrix-table { width:100%; border-collapse:collapse; min-width:980px; }
.module-matrix-table th, .module-matrix-table td { padding:10px 12px; border-bottom:1px solid var(--border,#E7E3DC); vertical-align:middle; }
.module-matrix-table th { background:var(--cream-2,#F5F0E8); font-size:12px; font-weight:700; }
.module-matrix-role { min-width:150px; }
.module-matrix-role small { display:block; color:var(--muted,#78716C); margin-top:4px; font-weight:600; }
.module-matrix-select { min-width:108px; }

/* --- Extracted from pages\users\assignments.php --- */

.assignments-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.assignments-page-header h2 {
  margin-bottom: 4px;
}

.assignment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.assignment-card {
  border: 1px solid var(--border, #E7E3DC);
  border-radius: 16px;
  background: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.assignment-card-header {
  padding: 16px 20px;
  background: linear-gradient(135deg, #ffffff 0%, #f4fdf8 100%);
  border-bottom: 1px solid var(--border, #E7E3DC);
}

.assignment-card h4 {
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--forest);
}

.assignment-meta {
  color: var(--muted, #78716C);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.assignment-card-body {
  padding: 16px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.assignment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 8px;
  margin-bottom: 16px;
}

.assignment-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: background-color 0.15s ease;
  cursor: pointer;
}

.assignment-item:hover {
  background-color: var(--cream-2, #F5F0E8);
}

.assignment-item input[type="checkbox"] {
  margin-top: 4px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.assignment-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.assignment-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.assignment-item-code {
  font-size: 12px;
  color: var(--muted);
}

.assignment-empty {
  color: var(--muted, #78716C);
  font-size: 14px;
  padding: 24px 0;
  text-align: center;
  background: var(--cream, #FDFCFB);
  border-radius: 8px;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.assignment-card-footer {
  padding: 16px 20px;
  background: var(--cream, #FDFCFB);
  border-top: 1px solid var(--border, #E7E3DC);
  margin-top: auto;
}

/* Custom scrollbar for the lists */
.assignment-list::-webkit-scrollbar {
  width: 6px;
}
.assignment-list::-webkit-scrollbar-track {
  background: transparent;
}
.assignment-list::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 10px;
}

/* --- Extracted from pages\users\index.php --- */

.user-modal { --app-modal-width: 580px; --app-modal-padding: 28px 30px; }
.user-import-note { font-size:12px; color:var(--muted,#78716C); line-height:1.55; }
.import-template-panel {
  background:linear-gradient(135deg,#f0fbf4 0%, #ffffff 100%);
  border:1px solid var(--border,#E7E3DC);
  border-radius:14px;
  padding:14px 16px;
  margin-bottom:14px;
}
.import-template-actions {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin-top:10px;
}
.import-template-chip {
  display:inline-flex;
  align-items:center;
  gap:6px;
  text-decoration:none;
  font-size:12px;
  font-weight:700;
}
.party-access-trigger {
  appearance:none;
  border:none;
  cursor:pointer;
  font-family:inherit;
  transition:transform .15s ease, box-shadow .15s ease;
}
.party-access-trigger:hover,
.party-access-trigger:focus-visible {
  transform:translateY(-1px);
  box-shadow:0 8px 18px rgba(37, 99, 235, 0.14);
}
.party-access-static {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  opacity:.9;
}
.party-access-static.party-access-inactive {
  background:#FEE2E2;
  color:#B91C1C;
}
.party-access-modal { --app-modal-width: 720px; --app-modal-padding: 26px 28px; }
.party-access-modal-headline { display:flex; justify-content:space-between; gap:14px; align-items:flex-start; margin-bottom:16px; flex-wrap:wrap; }
.party-access-user-meta { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.party-access-search {
  display:flex;
  align-items:center;
  gap:8px;
  background:var(--cream-2,#F5F0E8);
  border:1px solid var(--border,#E7E3DC);
  border-radius:12px;
  padding:9px 12px;
  margin-bottom:12px;
}
.party-access-search input {
  background:none;
  border:none;
  outline:none;
  width:100%;
  font:inherit;
  color:var(--text,#1C1917);
}
.party-access-list {
  display:flex;
  flex-direction:column;
  gap:8px;
  max-height:360px;
  overflow-y:auto;
  padding-right:6px;
}
.party-access-item {
  display:flex;
  align-items:flex-start;
  gap:12px;
  padding:10px 12px;
  border-radius:10px;
  cursor:pointer;
  transition:background-color .15s ease;
}
.party-access-item:hover { background:var(--cream-2,#F5F0E8); }
.party-access-item input[type="checkbox"] {
  width:16px;
  height:16px;
  margin-top:3px;
  flex-shrink:0;
}
.party-access-item-text { display:flex; flex-direction:column; gap:2px; }
.party-access-item-name { font-size:14px; font-weight:600; color:var(--text,#1C1917); line-height:1.35; }
.party-access-item-code { font-size:12px; color:var(--muted,#78716C); }
.party-access-empty {
  text-align:center;
  padding:28px 16px;
  background:var(--cream,#FDFCFB);
  border:1px dashed var(--border,#E7E3DC);
  border-radius:14px;
  color:var(--muted,#78716C);
}
.party-access-result-empty {
  display:none;
  text-align:center;
  padding:16px;
  color:var(--muted,#78716C);
}
.sort-link {
  display:inline-flex;
  align-items:center;
  gap:6px;
  color:inherit;
  text-decoration:none;
  white-space:nowrap;
}
.sort-link.is-active { color:var(--forest,#1B4332); }
.sort-caret {
  display:inline-flex;
  flex-direction:column;
  gap:2px;
  min-width:8px;
}
.sort-caret span {
  width:0;
  height:0;
  border-left:4px solid transparent;
  border-right:4px solid transparent;
  opacity:.28;
}
.sort-caret .up { border-bottom:5px solid currentColor; }
.sort-caret .down { border-top:5px solid currentColor; }
.sort-link.is-active .sort-caret span { opacity:.38; }
.sort-link.is-active .sort-caret span.active { opacity:1; }
.users-pagination { margin-top:14px; padding-top:14px; border-top:1px solid var(--border,#E7E3DC); display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; }
.users-pagination-actions { display:flex; gap:8px; align-items:center; }

/* --- Extracted from partials\farmer_profile_preview.php --- */

.farmer-profile-preview { display:grid; gap:18px; }
.farmer-profile-preview-head { display:flex; justify-content:space-between; align-items:flex-start; gap:12px; flex-wrap:wrap; }
.farmer-profile-preview-title { font-size:22px; font-weight:900; color:var(--text,#1C1917); margin-bottom:4px; }
.farmer-profile-preview-subtle { font-size:12px; color:var(--muted,#78716C); line-height:1.55; }
.farmer-profile-preview-grid { display:grid; grid-template-columns:repeat(3, minmax(0,1fr)); gap:14px; }
.farmer-profile-preview-grid .span-3 { grid-column:span 3; }
.farmer-profile-preview input,
.farmer-profile-preview select,
.farmer-profile-preview textarea { min-height:48px; border-radius:14px; }
.farmer-profile-preview textarea { min-height:100px; }
@media (max-width: 820px) {
  .farmer-profile-preview-grid { grid-template-columns:1fr 1fr; }
  .farmer-profile-preview-grid .span-3 { grid-column:span 2; }
}
@media (max-width: 620px) {
  .farmer-profile-preview-grid { grid-template-columns:1fr; }
  .farmer-profile-preview-grid .span-3 { grid-column:span 1; }
}

/* --- Extracted from partials\order_preview.php --- */

.order-view-header { display:flex; justify-content:space-between; align-items:flex-start; flex-wrap:wrap; gap:16px; margin-bottom:22px; }
.order-view-meta-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin-bottom:22px; }
.order-view-meta-card { background:var(--cream,#FEFDF8); border:1px solid var(--border,#E7E3DC); border-radius:12px; padding:14px 16px; }
.order-view-meta-label { font-size:10.5px; font-weight:800; color:var(--muted,#78716C); margin-bottom:5px; }
.order-view-meta-value { font-size:15px; font-weight:800; color:var(--text,#1C1917); }
.order-items-table { width:100%; border-collapse:collapse; }
.order-items-table th { background:var(--cream-2,#F5F0E8); font-size:11px; font-weight:700; color:var(--muted,#78716C); padding:10px 14px; text-align:left; border-bottom:1px solid var(--border,#E7E3DC); }
.order-items-table td { padding:13px 14px; font-size:13.5px; border-bottom:1px solid var(--border,#E7E3DC); vertical-align:middle; }
.order-items-table tr:last-child td { border-bottom:none; }
.order-summary-box { background:linear-gradient(135deg,#f4fdf8 0%, #ffffff 100%); border: 1px solid var(--border); border-radius:14px; padding:18px 20px; margin-top:18px; display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:16px; }
.order-summary-figure { text-align:right; }
.order-summary-figure .label { font-size:11px; color:var(--muted,#78716C); font-weight:700; }
.order-summary-figure .value { font-size:13px; font-weight:700; }
.order-summary-total-value { font-size:28px; font-weight:900; color:var(--forest,#1B4332); font-family:inherit; }
.order-status-form { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
@media(max-width:768px) { .order-view-meta-grid { grid-template-columns:1fr 1fr; } }


/* --- Premium Orders Table Styles --- */
.orders-record-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 8px;
}
.orders-record-table th {
  background: var(--cream-2);
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  padding: 12px 16px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.orders-record-table td {
  padding: 14px 16px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  background: var(--surface);
  transition: background-color 0.15s ease;
}
.order-record-row:hover td {
  background-color: var(--surface-muted);
}
.orders-record-table tr:last-child td {
  border-bottom: none;
}
.orders-status-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: nowrap !important;
}
.orders-status-form select {
  min-width: 140px;
  height: 36px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-size: 13px;
  background-color: var(--cream);
}
.orders-status-form .btn {
  padding: 6px 14px;
  height: 36px;
  font-size: 12px;
  border-radius: 8px;
  white-space: nowrap;
}
.orders-record-table .actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
}
.orders-record-table .btn {
  padding: 6px 12px;
  height: 32px;
  font-size: 12px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.orders-record-party {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.orders-record-code {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}


/* --- KPI Background Icons --- */
.kpi-bg-icon {
  position: absolute;
  right: -10px;
  bottom: -15px;
  width: 84px;
  height: 84px;
  opacity: 0.04;
  color: var(--text);
  pointer-events: none;
  transform: rotate(-10deg);
  z-index: 0;
}
.orders-overview-card, .bil-kpi, .pay-kpi, .pricebook-kpi, .rpt-kpi, .dashboard-overdue-metric, .service-card {
  position: relative;
  overflow: hidden;
}
.orders-overview-card > *:not(.kpi-bg-icon), 
.bil-kpi > *:not(.kpi-bg-icon), 
.pay-kpi > *:not(.kpi-bg-icon), 
.pricebook-kpi > *:not(.kpi-bg-icon), 
.rpt-kpi > *:not(.kpi-bg-icon), 
.dashboard-overdue-metric > *:not(.kpi-bg-icon), 
.service-card > *:not(.kpi-bg-icon) {
  position: relative;
  z-index: 2;
}


/* --- Premium Service Card Backgrounds --- */
.card.service-card.sc-create-order { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); border-color: #bbf7d0; }
.card.service-card.sc-create-order:hover { background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%); border-color: #86efac; box-shadow: 0 12px 24px rgba(34, 197, 94, 0.12); }

.card.service-card.sc-record-payment { background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%); border-color: #bfdbfe; }
.card.service-card.sc-record-payment:hover { background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%); border-color: #93c5fd; box-shadow: 0 12px 24px rgba(59, 130, 246, 0.12); }

.card.service-card.sc-farmer-followup { background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%); border-color: #99f6e4; }
.card.service-card.sc-farmer-followup:hover { background: linear-gradient(135deg, #ccfbf1 0%, #99f6e4 100%); border-color: #5eead4; box-shadow: 0 12px 24px rgba(20, 184, 166, 0.12); }

.card.service-card.sc-check-stock { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); border-color: #fde68a; }
.card.service-card.sc-check-stock:hover { background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%); border-color: #fcd34d; box-shadow: 0 12px 24px rgba(245, 158, 11, 0.12); }


/* --- Reusable Pastel Backgrounds for KPI Cards --- */
.bg-pastel-green { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%) !important; border-color: #bbf7d0 !important; }
.bg-pastel-green:hover { box-shadow: 0 12px 24px rgba(34, 197, 94, 0.12) !important; border-color: #86efac !important; }

.bg-pastel-blue { background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important; border-color: #bfdbfe !important; }
.bg-pastel-blue:hover { box-shadow: 0 12px 24px rgba(59, 130, 246, 0.12) !important; border-color: #93c5fd !important; }

.bg-pastel-purple { background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%) !important; border-color: #e9d5ff !important; }
.bg-pastel-purple:hover { box-shadow: 0 12px 24px rgba(168, 85, 247, 0.12) !important; border-color: #d8b4fe !important; }

.bg-pastel-amber { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%) !important; border-color: #fde68a !important; }
.bg-pastel-amber:hover { box-shadow: 0 12px 24px rgba(245, 158, 11, 0.12) !important; border-color: #fcd34d !important; }

.bg-pastel-rose { background: linear-gradient(135deg, #fff1f2 0%, #ffe4e6 100%) !important; border-color: #fecdd3 !important; }
.bg-pastel-rose:hover { box-shadow: 0 12px 24px rgba(244, 63, 94, 0.12) !important; border-color: #fda4af !important; }

.bg-pastel-teal { background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%) !important; border-color: #99f6e4 !important; }
.bg-pastel-teal:hover { box-shadow: 0 12px 24px rgba(20, 184, 166, 0.12) !important; border-color: #5eead4 !important; }
