/* ===== PHERP Frontend Portal CSS — Production v4 (Enterprise) ===== */

/* ── Suppress all WordPress chrome ──────────────────────────── */
#wpadminbar{display:none!important}
html{margin-top:0!important;padding-top:0!important}
body.pherp-erp-shell,body.pherp-portal{
  margin:0!important;padding:0!important;
  background:#f0f4f8!important;
  font-family:'Segoe UI',system-ui,-apple-system,sans-serif!important;
}
body.pherp-erp-shell .wp-site-blocks,
body.pherp-erp-shell .wp-block-post-content,
body.pherp-erp-shell .is-layout-constrained,
body.pherp-erp-shell .has-global-padding,
body.pherp-erp-shell .entry-content{
  padding:0!important;margin:0!important;max-width:none!important;width:100%!important;
}
body.pherp-portal .site-header,
body.pherp-portal .site-footer,
body.pherp-portal .wp-site-blocks>header,
body.pherp-portal .wp-site-blocks>footer,
body.pherp-portal .site-navigation,
body.pherp-portal .page-title,
body.pherp-portal h1.wp-block-post-title{
  display:none!important;
}

/* ── Design Tokens ───────────────────────────────────────────── */
:root {
  /* Brand */
  --fe-navy:      #0b1f38;
  --fe-navy2:     #142844;
  --fe-teal:      #0d9488;
  --fe-teal2:     #0b8078;
  --fe-teal-pale: #f0fdfa;
  --fe-green:     #16a34a;
  --fe-red:       #dc2626;
  --fe-amber:     #d97706;
  --fe-blue:      #2563eb;
  --fe-purple:    #7c3aed;

  /* Layout */
  --fe-sidebar-w:   256px;
  --fe-sidebar-w-c: 64px;

  /* Surfaces */
  --fe-bg:           #f0f4f8;
  --fe-card-bg:      #ffffff;
  --fe-text:         #0f172a;
  --fe-text-soft:    #334155;
  --fe-muted:        #64748b;
  --fe-border:       #d1d9e0;
  --fe-border-light: #e8edf2;

  /* Geometry */
  --fe-radius:   10px;
  --fe-radius-lg:14px;

  /* Shadows */
  --fe-shadow:    0 1px 3px rgba(0,0,0,.08),0 0 0 1px rgba(0,0,0,.04);
  --fe-shadow-md: 0 4px 20px rgba(0,0,0,.10);
  --fe-shadow-lg: 0 8px 40px rgba(0,0,0,.14);
}

/* ── Reset ──────────────────────────────────────────────────── */
.pherp-portal *,.fe-app *{box-sizing:border-box}
.pherp-portal .site-content,.pherp-portal .entry-content,.pherp-portal .wp-block-post-content,.pherp-portal main.site-main{padding:0!important;margin:0!important;max-width:none!important;background:var(--fe-bg)}
.pherp-portal .site-header,.pherp-portal .site-footer,.pherp-portal .wp-site-blocks>header,.pherp-portal .wp-site-blocks>footer{display:none!important}
.pherp-portal .wp-site-blocks{padding:0!important}

/* ── App shell ──────────────────────────────────────────────── */
.fe-app{display:block;min-height:100vh;background:var(--fe-bg);font-family:'Segoe UI',system-ui,-apple-system,sans-serif;color:var(--fe-text);font-size:14px;line-height:1.5;position:relative;}
.fe-main{
  margin-left:var(--fe-sidebar-w);
  min-width:0;
  transition:margin-left .25s cubic-bezier(.4,0,.2,1);
  overflow-x:hidden;
  min-height:100vh;
}
/* ── Topbar ──────────────────────────────────────────────── */
.fe-topbar{
  display:flex;align-items:center;justify-content:space-between;
  padding:0 28px;height:64px;
  background:#fff;
  border-bottom:1px solid var(--fe-border-light);
  position:sticky;top:0;z-index:50;
  gap:12px;
  box-shadow:0 1px 8px rgba(0,0,0,.06);
}
.fe-page-title{font-size:17px;font-weight:700;margin:0;color:var(--fe-navy);letter-spacing:-.2px}
.fe-branch-tag{font-size:13px;font-weight:600;color:#64748b;letter-spacing:0;margin-left:2px}
.fe-topbar-right{display:flex;align-items:center;gap:10px}
/* ── Notification bell ─────────────────────────────────────── */
.fe-notif-wrap{position:relative}
.fe-notif-btn{
  position:relative;display:flex;align-items:center;justify-content:center;
  width:36px;height:36px;border-radius:50%;border:1.5px solid var(--fe-border-light);
  background:#fff;color:#475569;cursor:pointer;transition:background .15s,color .15s,border-color .15s;
}
.fe-notif-btn:hover{background:var(--fe-teal-pale);color:var(--fe-teal);border-color:var(--fe-teal)}
.fe-notif-count{
  position:absolute;top:-4px;right:-4px;min-width:17px;height:17px;padding:0 4px;
  border-radius:9px;background:var(--fe-red);color:#fff;font-size:10px;font-weight:800;
  line-height:17px;text-align:center;box-shadow:0 0 0 2px #fff;
}
.fe-notif-dropdown{
  position:absolute;top:calc(100% + 10px);right:0;width:330px;max-width:88vw;
  background:#fff;border:1px solid var(--fe-border-light);border-radius:10px;
  box-shadow:var(--fe-shadow-md);z-index:120;overflow:hidden;
}
.fe-notif-dropdown-head{
  padding:12px 16px;font-size:13px;font-weight:800;color:var(--fe-navy);
  border-bottom:1px solid var(--fe-border-light);background:#f8fafc;
}
.fe-notif-list{max-height:360px;overflow-y:auto}
.fe-notif-item{
  display:flex;align-items:flex-start;gap:10px;padding:11px 16px;
  border-bottom:1px solid var(--fe-border-light);text-decoration:none;
  color:var(--fe-text);font-size:12.5px;line-height:1.45;transition:background .12s;
}
.fe-notif-item:last-child{border-bottom:none}
.fe-notif-item:hover{background:#f8fafc}
.fe-notif-icon{font-size:16px;line-height:1;flex-shrink:0;margin-top:1px}
.fe-notif-item.fe-notif-danger .fe-notif-text{color:var(--fe-red);font-weight:600}
.fe-notif-item.fe-notif-warn .fe-notif-text{color:#b45309;font-weight:600}
.fe-notif-empty{padding:22px 16px;text-align:center;color:var(--fe-muted);font-size:13px}
@media(max-width:480px){.fe-notif-dropdown{position:fixed;top:64px;right:8px;left:8px;width:auto;max-width:none}}
.fe-username{
  font-size:12.5px;color:var(--fe-muted);font-weight:600;
  background:#f8fafc;border:1px solid var(--fe-border-light);
  padding:5px 12px;border-radius:20px;
}

/* ── Cards ──────────────────────────────────────────────── */
.fe-card{
  background:var(--fe-card-bg);
  border-radius:var(--fe-radius-lg);
  box-shadow:var(--fe-shadow);
  margin:20px 24px 0;
  overflow:hidden;
  border:1px solid var(--fe-border-light);
}
.fe-card-header{
  padding:15px 20px;
  font-weight:700;font-size:13.5px;
  border-bottom:1px solid var(--fe-border-light);
  color:var(--fe-navy);
  background:linear-gradient(to right,#fafbfc,#f7f9fb);
  display:flex;align-items:center;justify-content:space-between;
}

/* ── KPI grid ─────────────────────────────────────────────── */
.fe-kpi-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:16px;padding:24px 24px 6px}
.fe-kpi-card{
  background:var(--fe-card-bg);
  border-radius:var(--fe-radius-lg);
  padding:20px 22px 18px;
  box-shadow:var(--fe-shadow);
  border:1px solid var(--fe-border-light);
  border-top:3px solid var(--fe-teal);
  position:relative;
  transition:box-shadow .18s,transform .18s;
}
.fe-kpi-card:hover{box-shadow:var(--fe-shadow-md);transform:translateY(-2px)}
.fe-kpi-card.loading{opacity:.45}
.fe-kpi-card.fe-kpi-warn{border-top-color:var(--fe-amber)}
.fe-kpi-card.fe-kpi-danger{border-top-color:var(--fe-red)}
.fe-kpi-label{
  font-size:10.5px;color:var(--fe-muted);
  text-transform:uppercase;letter-spacing:.07em;
  margin-bottom:8px;font-weight:700;
}
.fe-kpi-value{
  font-size:28px;font-weight:800;
  color:var(--fe-navy);line-height:1.1;
  font-variant-numeric:tabular-nums;
}
.fe-kpi-value.fe-warn{color:#92400e}
.fe-kpi-value.fe-danger{color:var(--fe-red)}
/* ── Tabs ────────────────────────────────────────────────── */
.fe-tabs{
  display:flex;padding:0 24px;gap:2px;
  border-bottom:2px solid var(--fe-border-light);
  background:#fff;
}
.fe-tab{
  background:none;border:none;
  border-bottom:3px solid transparent;
  margin-bottom:-2px;
  padding:14px 20px;
  font-size:13px;font-weight:600;
  color:var(--fe-muted);cursor:pointer;
  transition:all .16s;white-space:nowrap;
  font-family:inherit;
}
.fe-tab:hover{color:var(--fe-teal)}
.fe-tab.fe-tab-active{
  color:var(--fe-teal);
  border-bottom-color:var(--fe-teal);
  background:rgba(13,148,136,.04);
}

/* ── Toolbar ─────────────────────────────────────────────── */
.fe-toolbar{
  display:flex;align-items:center;gap:10px;
  padding:14px 24px;
  border-bottom:1px solid var(--fe-border-light);
  flex-wrap:wrap;background:#fafcfd;
}
/* ── Period pills (quick date-range presets, e.g. Sales History) ── */
.fe-period-pills{display:flex;flex-wrap:wrap;gap:6px;padding:0 24px}
.fe-period-pill{
  padding:6px 14px;border-radius:20px;border:1.5px solid var(--fe-border);
  background:#fff;color:var(--fe-navy);font-size:12.5px;font-weight:600;
  cursor:pointer;transition:all .15s ease;
}
.fe-period-pill:hover{border-color:var(--fe-teal);color:var(--fe-teal)}
.fe-period-pill-active{background:var(--fe-teal);border-color:var(--fe-teal);color:#fff}
/* ── Pagination bar (Sales History, and any future paginated list) ── */
.fe-pagination-bar{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  padding:12px 20px;border-top:1px solid var(--fe-border-light);
  font-size:13px;color:var(--fe-muted);flex-wrap:wrap;
}
.fe-pagination-bar .fe-pagination-btns{display:flex;gap:6px}
.fe-pagination-bar button{
  padding:5px 12px;border-radius:6px;border:1px solid var(--fe-border);
  background:#fff;color:var(--fe-navy);font-size:13px;cursor:pointer;
}
.fe-pagination-bar button:disabled{opacity:.4;cursor:not-allowed}
.fe-pagination-bar button:not(:disabled):hover{border-color:var(--fe-teal);color:var(--fe-teal)}
.fe-loading-text{
  padding:32px;text-align:center;
  color:var(--fe-muted);font-size:14px;
  font-style:italic;
}
.fe-checkbox-label{
  display:flex;align-items:center;gap:6px;
  font-size:13.5px;color:var(--fe-text-soft);
  cursor:pointer;user-select:none;
}
.fe-checkbox-label input[type=checkbox]{width:15px;height:15px;cursor:pointer}
/* ── Sidebar ─────────────────────────────────────────────── */
.fe-sidebar{
  width:var(--fe-sidebar-w);
  background:var(--fe-navy);
  background:linear-gradient(180deg,var(--fe-navy2) 0%,#0a1528 100%);
  display:flex;flex-direction:column;
  position:fixed;top:0;left:0;bottom:0;
  z-index:200;
  overflow-y:auto;overflow-x:hidden;
  transition:width .25s cubic-bezier(.4,0,.2,1);
  box-shadow:3px 0 20px rgba(0,0,0,.22);
  scrollbar-width:none;
  flex-shrink:0;
}
.fe-sidebar::-webkit-scrollbar{display:none}
.fe-sidebar-brand{
  display:flex;align-items:center;gap:11px;
  padding:0 18px;
  border-bottom:1px solid rgba(255,255,255,.08);
  color:#fff;font-weight:800;font-size:14.5px;
  min-height:64px;
  background:rgba(0,0,0,.18);
  letter-spacing:-.2px;
  flex-shrink:0;
  overflow:hidden;
}
.fe-sidebar-icon{font-size:26px;flex-shrink:0}
.fe-sidebar-name{
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
  line-height:1.3;font-size:14px;
  transition:opacity .2s,width .25s;
}
/* ── Toggle button: pill pinned to the brand row, right edge of sidebar ──
   Anchored to the fixed-height brand bar (not top:50% of the sidebar) so it
   never drifts into the nav-link list on tall/scrollable pages. */
.fe-sidebar-toggle{
  position:absolute;
  top:32px;
  right:-15px;
  transform:translateY(-50%);
  width:30px;height:30px;
  background:#fff;
  border:2px solid #cbd5e1;
  box-shadow:0 2px 10px rgba(0,0,0,.20);
  border-radius:50%;
  cursor:pointer;
  z-index:301; /* above sidebar z:200 */
  display:flex;align-items:center;justify-content:center;
  color:#475569;
  padding:0;
  line-height:1;
  /* SVG transition */
  transition:background .15s,border-color .15s,color .15s;
}
.fe-sidebar-toggle svg{
  display:block;
  flex-shrink:0;
  transition:transform .25s cubic-bezier(.4,0,.2,1);
}
.fe-sidebar-toggle:hover{
  background:var(--fe-teal);
  border-color:var(--fe-teal);
  color:#fff;
}
/* When sidebar is collapsed, rotate arrow 180° to point right → */
.fe-sidebar-collapsed .fe-sidebar-toggle{
  transform:translateY(-50%); /* keep vertical centering */
}
.fe-sidebar-collapsed .fe-sidebar-toggle svg{
  transform:rotate(180deg);
}
.fe-sidebar-collapsed{width:var(--fe-sidebar-w-c)!important}
.fe-sidebar-collapsed .fe-sidebar-name,.fe-sidebar-collapsed .fe-nav-label{display:none!important;opacity:0}
.fe-sidebar-collapsed .fe-sidebar-brand{padding:0 12px;justify-content:center}
.fe-main-expanded{margin-left:var(--fe-sidebar-w-c)!important}
.fe-nav-list{list-style:none;margin:0;padding:6px 10px;flex:1;display:flex;flex-direction:column;gap:2px}
.fe-nav-link{
  display:flex;align-items:center;gap:11px;
  padding:10px 12px;
  color:rgba(255,255,255,.68);
  text-decoration:none;font-size:13px;font-weight:500;
  border-radius:8px;
  transition:all .15s;
}
.fe-nav-link:hover{
  color:#fff;
  background:rgba(255,255,255,.09);
}
.fe-nav-link.fe-active{
  color:#fff;
  background:rgba(13,148,136,.28);
  box-shadow:inset 2px 0 0 var(--fe-teal);
}
.fe-nav-icon{font-size:16px;flex-shrink:0;width:22px;text-align:center;opacity:.85}
.fe-nav-label{white-space:nowrap}

/* Nav group headers */
.fe-nav-group-label{
  font-size:9.5px;font-weight:800;
  text-transform:uppercase;letter-spacing:.1em;
  color:rgba(255,255,255,.28);
  padding:14px 14px 4px;
  list-style:none;
}
.fe-sidebar-collapsed .fe-nav-group-label{display:none}

/* Sidebar footer (logged-in user) */
.fe-sidebar-footer{
  display:flex;align-items:center;gap:9px;
  padding:14px 16px;
  border-top:1px solid rgba(255,255,255,.08);
  margin-top:auto;
  color:rgba(255,255,255,.55);
  font-size:12.5px;
}
.fe-sidebar-user-icon{font-size:16px;flex-shrink:0}
.fe-sidebar-user-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.fe-sidebar-collapsed .fe-sidebar-user-name{display:none}

/* Branch switcher (admin/owner/superadmin only) */
.fe-branch-switcher{
  display:flex;flex-direction:column;gap:4px;
  padding:12px 16px;
  border-top:1px solid rgba(255,255,255,.08);
  margin-top:8px;
}
/* The [hidden] attribute must always win over the class's display:flex above
   (same specificity as a plain class selector -- source order otherwise
   decides, and .fe-branch-switcher comes later). Without this override the
   switcher renders visibly-but-empty before JS populates + reveals it,
   which looks exactly like the page being stuck "loading". */
.fe-branch-switcher[hidden]{display:none!important}
.fe-branch-label{
  font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;
  color:rgba(255,255,255,.4);
}
.fe-branch-select{
  width:100%;
  padding:7px 10px;
  background:rgba(255,255,255,.08);
  border:1.5px solid rgba(255,255,255,.15);
  border-radius:6px;
  color:#fff;
  font-size:12.5px;
  font-weight:600;
  cursor:pointer;
  outline:none;
}
.fe-branch-select:focus{border-color:var(--fe-teal)}
.fe-branch-select option{color:#0f172a}
.fe-sidebar-collapsed .fe-branch-switcher{display:none}
.fe-field{display:flex;flex-direction:column;gap:5px;margin-bottom:14px;position:relative}
.fe-field label{font-size:12.5px;font-weight:700;color:var(--fe-text);text-transform:uppercase;letter-spacing:.04em}
/* ── Form inputs ─────────────────────────────────────────────── */
.fe-input{
  width:100%;padding:10px 13px;
  border:1.5px solid var(--fe-border);
  border-radius:8px;
  font-size:13.5px;
  background:#fff;color:var(--fe-text);
  outline:none;
  transition:border-color .16s,box-shadow .16s;
  font-family:inherit;
}
.fe-input:focus{
  border-color:var(--fe-teal);
  box-shadow:0 0 0 3px rgba(13,148,136,.14);
}
.fe-input::placeholder{color:#94a3b8}
.fe-input:disabled{background:#f8fafc;color:var(--fe-muted);cursor:not-allowed}
.fe-input-sm{padding:6px 10px;font-size:12.5px}
.fe-input-md{min-width:200px}
textarea.fe-input{resize:vertical;min-height:68px;line-height:1.5}
.fe-form-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 20px;padding:22px}
.fe-field-full{grid-column:1/-1}
.fe-subheader{
  font-size:10.5px;font-weight:800;
  color:var(--fe-teal);
  text-transform:uppercase;letter-spacing:.08em;
  padding:14px 0 6px;grid-column:1/-1;
  border-top:1.5px solid var(--fe-border-light);
  margin-top:8px;
}
.fe-req{color:var(--fe-red)}

/* ── Buttons ───────────────────────────────────────────────── */
.fe-btn{
  display:inline-flex;align-items:center;gap:6px;
  padding:9px 18px;
  border-radius:8px;
  font-size:13.5px;font-weight:600;
  cursor:pointer;border:none;
  transition:all .15s;
  text-decoration:none;white-space:nowrap;line-height:1.2;
  font-family:inherit;
}
.fe-btn:disabled{opacity:.5;cursor:not-allowed;transform:none!important;box-shadow:none!important}
.fe-btn:hover:not(:disabled){transform:translateY(-1px);box-shadow:0 4px 12px rgba(0,0,0,.15)}
.fe-btn-primary{background:var(--fe-teal);color:#fff;box-shadow:0 1px 4px rgba(13,148,136,.25)}
.fe-btn-primary:hover:not(:disabled){background:var(--fe-teal2)}
.fe-btn-success{background:var(--fe-green);color:#fff;box-shadow:0 1px 4px rgba(22,163,74,.2)}
.fe-btn-success:hover:not(:disabled){background:#15803d}
.fe-btn-info{background:var(--fe-blue);color:#fff}
.fe-btn-info:hover:not(:disabled){background:#1d4ed8}
.fe-btn-danger{background:var(--fe-red);color:#fff;box-shadow:0 1px 4px rgba(220,38,38,.2)}
.fe-btn-danger:hover:not(:disabled){background:#b91c1c}
.fe-btn-outline{background:#fff;color:var(--fe-teal);border:1.5px solid var(--fe-teal)}
.fe-btn-outline:hover:not(:disabled){background:var(--fe-teal-pale)}
.fe-btn-ghost{background:transparent;color:var(--fe-muted);border:1.5px solid var(--fe-border)}
.fe-btn-ghost:hover:not(:disabled){background:var(--fe-bg);color:var(--fe-text)}
.fe-btn-sm{padding:6px 12px;font-size:12.5px}
.fe-btn-xs{padding:3px 8px;font-size:11.5px}
.fe-btn-full{width:100%;justify-content:center;margin-top:4px}
.fe-btn-icon{background:none;border:none;cursor:pointer;color:var(--fe-muted);padding:4px 8px;font-size:15px;border-radius:6px;transition:all .15s}
.fe-btn-icon:hover{color:var(--fe-red);background:#fee2e2}
.fe-btn-del{background:#fef2f2;color:#991b1b;border:1.5px solid #fca5a5}
.fe-btn-del:hover{background:#fee2e2}
.fe-alert{padding:10px 14px;border-radius:6px;font-size:13.5px;margin-bottom:12px;font-weight:500}
.fe-alert-success{background:#dcfce7;color:#14532d;border:1px solid #86efac}
.fe-alert-error{background:#fee2e2;color:#7f1d1d;border:1px solid #fca5a5}
.fe-alert-info{background:#dbeafe;color:#1e3a5f;border:1px solid #93c5fd}
.fe-alert-warning{background:#fef3c7;color:#78350f;border:1px solid #fcd34d}
.fe-detail-grid p{margin:0 0 10px;font-size:13.5px;line-height:1.5;color:var(--fe-text)}
.fe-detail-grid p strong{display:inline-block;min-width:110px;color:#64748b}
.fe-pw-wrap{position:relative}
.fe-pw-toggle{position:absolute;right:10px;top:50%;transform:translateY(-50%);background:none;border:none;cursor:pointer;color:var(--fe-muted);font-size:15px;padding:2px}
.fe-spinner{width:16px;height:16px;border:2px solid rgba(255,255,255,.4);border-top-color:#fff;border-radius:50%;animation:fe-spin .7s linear infinite;display:inline-block}
@keyframes fe-spin{to{transform:rotate(360deg)}}
/* ── Tables ───────────────────────────────────────────────── */
.fe-table{width:100%;border-collapse:collapse;font-size:13.5px}
.fe-table th{
  background:#f4f7fa;
  padding:11px 15px;
  text-align:left;font-weight:700;font-size:11px;
  color:var(--fe-text-soft);
  border-bottom:2px solid var(--fe-border);
  white-space:nowrap;
  text-transform:uppercase;letter-spacing:.05em;
}
.fe-table td{
  padding:12px 15px;
  border-bottom:1px solid var(--fe-border-light);
  vertical-align:middle;color:var(--fe-text);
  line-height:1.4;
}
.fe-table tbody tr:last-child td{border-bottom:none}
.fe-table tbody tr:hover td{background:#f7fbfb}
/* Stock Transfers list: keep From/To branch columns from ballooning to fill
   all leftover width (which forced 2-line wraps on long branch names) and
   give Date/Status/Actions their natural, compact widths instead. */
#trf-table-wrap table{table-layout:fixed}
#trf-table-wrap th:nth-child(1),#trf-table-wrap td:nth-child(1){width:13%}
#trf-table-wrap th:nth-child(2),#trf-table-wrap td:nth-child(2){width:25%}
#trf-table-wrap th:nth-child(3),#trf-table-wrap td:nth-child(3){width:25%}
#trf-table-wrap th:nth-child(4),#trf-table-wrap td:nth-child(4){width:13%;white-space:nowrap}
#trf-table-wrap th:nth-child(5),#trf-table-wrap td:nth-child(5){width:11%}
#trf-table-wrap th:nth-child(6),#trf-table-wrap td:nth-child(6){width:13%;white-space:nowrap}
#trf-table-wrap td:nth-child(2),#trf-table-wrap td:nth-child(3){
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.fe-table .col-currency{
  text-align:right;
  font-variant-numeric:tabular-nums;
  font-weight:700;
  color:var(--fe-navy);
}
.fe-table td strong{color:var(--fe-navy);font-weight:700}
.fe-table small{color:var(--fe-muted);font-size:12px}
.fe-table-wrap{overflow-x:auto}
/* ── Badges ───────────────────────────────────────────────── */
.fe-badge{
  display:inline-block;
  padding:3px 10px;
  border-radius:20px;
  font-size:11px;font-weight:700;
  letter-spacing:.04em;
  vertical-align:middle;
}
.fe-badge-green{background:#dcfce7;color:#14532d}
.fe-badge-red{background:#fee2e2;color:#7f1d1d}
.fe-badge-amber{background:#fef3c7;color:#78350f}
.fe-badge-blue{background:#dbeafe;color:#1e3a8a}
.fe-badge-gray{background:#f1f5f9;color:#475569}
.fe-badge-purple{background:#ede9fe;color:#4c1d95}
/* ── Modals ───────────────────────────────────────────────── */
.fe-modal-overlay{
  position:fixed;inset:0;
  background:rgba(7,16,32,.65);
  backdrop-filter:blur(3px);
  z-index:999;
  display:flex;align-items:center;justify-content:center;
  padding:16px;
  animation:fe-overlay-in .18s ease;
}
@keyframes fe-overlay-in{from{opacity:0}to{opacity:1}}
.fe-modal{
  background:#fff;
  border-radius:var(--fe-radius-lg);
  max-height:90vh;overflow-y:auto;
  box-shadow:var(--fe-shadow-lg);
  width:100%;max-width:660px;
  border:1px solid var(--fe-border-light);
  animation:fe-modal-in .2s cubic-bezier(.34,1.56,.64,1);
}
@keyframes fe-modal-in{from{opacity:0;transform:scale(.94)translateY(8px)}to{opacity:1;transform:none}}
.fe-modal-lg{max-width:900px}
.fe-modal-sm{max-width:460px}
.fe-modal-xl{max-width:1100px}
.fe-modal-header{
  display:flex;align-items:center;justify-content:space-between;
  padding:17px 22px;
  border-bottom:1px solid var(--fe-border-light);
  background:linear-gradient(to right,#f8fafc,#f5f8fa);
}
.fe-modal-header h3{margin:0;font-size:16px;font-weight:800;color:var(--fe-navy)}
.fe-modal-close{
  background:none;border:none;font-size:20px;
  cursor:pointer;color:var(--fe-muted);
  padding:4px 8px;border-radius:6px;line-height:1;transition:.15s;
}
.fe-modal-close:hover{background:#fee2e2;color:var(--fe-red)}
.fe-modal-body{padding:22px}
/* Forms already carry their own 22px padding (used standalone inside
   .fe-card on Settings, etc). Nesting one inside .fe-modal-body, which ALSO
   pads 22px, was doubling the inset to 44px on every entry-form modal across
   Inventory, POS, Procurement, Patients, Staff, Debtors, Payouts, Layaways,
   Returns, Spoilage, Prescriptions, Payroll, Expenses and Transfers -- the
   single biggest visual "misaligned form" issue in the app. Zero it out in
   this context only so the modal's own padding is the sole inset. */
.fe-modal-body>.fe-form-grid,
.fe-modal-body>form.fe-form-grid{padding:0}
.fe-modal-footer{
  display:flex;justify-content:flex-end;gap:10px;
  padding:15px 22px;
  border-top:1px solid var(--fe-border-light);
  background:#f8fafc;
}
.fe-autocomplete-dropdown{position:absolute;top:100%;left:0;right:0;background:#fff;border:1.5px solid var(--fe-border);border-radius:6px;box-shadow:var(--fe-shadow-md);z-index:200;max-height:240px;overflow-y:auto}
.fe-dropdown-item{padding:9px 14px;cursor:pointer;font-size:13.5px;display:flex;justify-content:space-between;align-items:center;gap:8px;color:var(--fe-text);border-bottom:1px solid var(--fe-border-light)}
.fe-dropdown-item:last-child{border-bottom:none}
.fe-dropdown-item:hover{background:#f0fafa;color:var(--fe-teal)}
.fe-item-price{font-size:12px;color:var(--fe-muted);font-weight:600}
.fe-item-stock-low{color:var(--fe-red);font-size:11px;font-weight:700}
/* pherp-modal */
.pherp-modal{display:none;position:fixed;inset:0;z-index:1000;align-items:center;justify-content:center;padding:16px;overflow-y:auto}
.pherp-modal.pherp-modal-open{display:flex}
/* Defensive fallback: centering must work even if a modal is missing its
   .modal-overlay wrapper (root cause of the Settings/Users/Expenses forms
   rendering top-left instead of centered) -- .pherp-modal itself now also
   centers its .modal-box directly via flex, so future modals can't regress. */
.modal-overlay{position:absolute;inset:0;background:rgba(9,20,36,.6);display:flex;align-items:center;justify-content:center;padding:16px}
.modal-box{position:relative;background:#fff;border-radius:12px;max-height:92vh;overflow-y:auto;box-shadow:0 20px 60px rgba(0,0,0,.3);width:90vw;max-width:700px;z-index:1;border:1px solid var(--fe-border-light)}
.modal-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid var(--fe-border-light);background:#f8fafc}
.modal-header h3{margin:0;font-size:16px;font-weight:800;color:var(--fe-navy)}
.modal-close{background:none;border:none;font-size:22px;cursor:pointer;color:var(--fe-muted);padding:4px 8px;border-radius:4px;line-height:1;transition:.15s}
.modal-close:hover{background:var(--fe-border-light);color:var(--fe-red)}
.modal-body{padding:20px}
/* Same double-padding fix as .fe-modal-body above, for the parallel
   .pherp-modal system used by Expenses, Users and the Settings branch
   modal -- .fe-form-grid's own 22px padding was stacking on top of this
   modal-body's 20px, pushing every field inward unevenly. */
.modal-body>.fe-form-grid,
.modal-body>form.fe-form-grid{padding:0}
.modal-footer{display:flex;justify-content:flex-end;gap:10px;padding:14px 20px;border-top:1px solid var(--fe-border-light);background:#f8fafc}
.modal-sm .modal-box{max-width:460px}
.modal-lg .modal-box{max-width:700px}
.modal-xl .modal-box{max-width:980px}
/* === POS === */
.fe-pos-layout{display:flex;align-items:flex-start;padding:20px;gap:20px}
.fe-pos-cart-panel{flex:2;min-width:0}
.fe-pos-cart-panel .fe-card,.fe-pos-payment-panel .fe-card{margin:0}
.fe-pos-payment-panel{width:320px;flex-shrink:0;display:flex;flex-direction:column;gap:16px}
.fe-pos-totals{padding:12px 16px;border-top:1px solid var(--fe-border-light);background:#f8fafc}
.fe-pos-total-row{display:flex;justify-content:space-between;padding:5px 0;font-size:14px;color:var(--fe-text-soft)}
.fe-pos-grand-total{font-size:20px;font-weight:800;color:var(--fe-navy);border-top:2px solid var(--fe-border);padding-top:10px;margin-top:6px}
.fe-pos-change-row{display:flex;justify-content:space-between;padding:8px 12px;background:#f0fdf4;border-radius:6px;font-weight:700;color:var(--fe-green);margin-top:8px;font-size:16px;border:1px solid #86efac}
.fe-patient-badge{display:flex;align-items:center;gap:8px;padding:8px 12px;background:#f0fdf4;border-radius:6px;font-size:13.5px;border:1px solid #86efac;color:#14532d;font-weight:600}
.fe-recent-list{padding:0;max-height:220px;overflow-y:auto}
.fe-recent-item{display:flex;justify-content:space-between;padding:8px 14px;border-bottom:1px solid var(--fe-border-light);font-size:13px;color:var(--fe-text)}
.fe-recent-item:last-child{border-bottom:none}
.fe-recent-item:hover{background:#f8fafc}
.fe-quick-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:16px}
.fe-qa-btn{display:block;padding:10px 12px;background:#f0fafa;border-radius:8px;text-align:center;text-decoration:none;color:var(--fe-navy);font-size:13px;font-weight:700;transition:.15s;border:1.5px solid transparent}
.fe-qa-btn:hover{background:var(--fe-teal);color:#fff;border-color:var(--fe-teal)}
/* ═══════════════════════════════════════════════════════════════
   RECEIPT — screen + print
   ═══════════════════════════════════════════════════════════════ */
.fe-receipt{
  font-size:13px;line-height:1.7;
  font-family:'Courier New',Courier,monospace;
  color:#111;
  max-width:380px;
  margin:0 auto;
}
.fe-receipt-header{
  text-align:center;
  padding-bottom:12px;
  border-bottom:2px dashed #ccc;
  margin-bottom:12px;
}
.fe-receipt-header .rx-pharmacy-logo{
  max-height:56px;max-width:180px;
  object-fit:contain;
  margin:0 auto 6px;
  display:block;
}
.fe-receipt-header .rx-pharmacy-name{
  font-size:18px;font-weight:800;
  color:var(--fe-navy);
  letter-spacing:-.3px;
}
.fe-receipt-header .rx-pharmacy-address{
  font-size:11.5px;color:#555;
  line-height:1.5;
}
.fe-receipt-header .rx-pharmacy-phone{
  font-size:12px;color:#333;font-weight:600;
}
.fe-receipt-meta{
  display:flex;justify-content:space-between;
  font-size:12px;color:#555;
  padding:4px 0;
  border-bottom:1px dashed #ccc;
  margin-bottom:8px;
  gap:8px;
}
.fe-receipt-meta strong{color:#111}
.fe-receipt-divider{border:none;border-top:1px dashed #ccc;margin:10px 0}
.fe-receipt table{
  width:100%;border-collapse:collapse;
  margin:8px 0;font-size:12.5px;
}
.fe-receipt table thead th{
  font-size:11px;text-transform:uppercase;
  letter-spacing:.04em;color:#555;
  padding:4px 0;border-bottom:1px solid #ccc;
  text-align:left;font-weight:700;
}
.fe-receipt table thead th:last-child{text-align:right}
.fe-receipt table tbody td{
  padding:5px 0;
  border-bottom:1px dotted #eee;
  vertical-align:top;
}
.fe-receipt table tbody td:last-child{text-align:right;font-weight:600}
.fe-receipt-totals{
  margin-top:8px;
  border-top:2px dashed #ccc;
  padding-top:8px;
}
.fe-receipt-total-row{
  display:flex;justify-content:space-between;
  font-size:13px;padding:2px 0;
  color:#333;
}
.fe-receipt-total-row.grand{
  font-size:17px;font-weight:800;
  color:var(--fe-navy);
  padding:8px 0 4px;
  border-top:2px solid #ccc;
  margin-top:6px;
}
.fe-receipt-total-row.change{
  color:var(--fe-green);font-weight:700;
  font-size:14px;
}
.fe-receipt-footer{
  text-align:center;
  color:#666;font-size:11px;
  margin-top:14px;
  border-top:1px dashed #ccc;
  padding-top:10px;
  line-height:1.8;
}
.fe-receipt-footer .rx-thank-you{
  font-size:13px;font-weight:700;
  color:var(--fe-teal);
}
/* Print button */
.fe-receipt-print-btn{
  display:block;width:100%;
  margin-top:16px;
  padding:11px;
  background:var(--fe-navy);
  color:#fff;border:none;
  border-radius:8px;
  font-size:14px;font-weight:700;
  cursor:pointer;transition:.15s;
  font-family:inherit;
}
.fe-receipt-print-btn:hover{background:var(--fe-teal)}

@media print{
  /* On print: only show the receipt */
  body.pherp-erp-shell *:not(.fe-receipt-printable):not(.fe-receipt-printable *){
    visibility:hidden;
  }
  .fe-receipt-printable,.fe-receipt-printable *{
    visibility:visible;
  }
  .fe-receipt-printable{
    position:fixed;top:0;left:0;right:0;
    padding:20px;
  }
  .fe-receipt-print-btn{display:none!important}
}
/* ── Product import (Inventory) ───────────────────────────── */
.fe-import-help{font-size:12.5px;color:var(--fe-muted);line-height:1.6;margin:0 0 12px}
.fe-import-actions{margin-bottom:14px}
.fe-link{color:var(--fe-teal);font-size:13px;font-weight:600;text-decoration:none}
.fe-link:hover{text-decoration:underline}
.fe-import-dropzone{
  border:2px dashed var(--fe-border);border-radius:10px;padding:36px 20px;
  text-align:center;cursor:pointer;transition:border-color .15s,background .15s;background:#fafcff;
}
.fe-import-dropzone:hover,.fe-import-dropzone.fe-import-drag{border-color:var(--fe-teal);background:var(--fe-teal-pale)}
.fe-import-dropzone-icon{font-size:34px;line-height:1;margin-bottom:8px}
.fe-import-dropzone-text{font-size:14px;font-weight:600;color:var(--fe-navy)}
.fe-import-dropzone-hint{font-size:11.5px;color:var(--fe-muted);margin-top:4px}
.fe-import-summary{background:#f8fafc;border:1px solid var(--fe-border-light);border-radius:8px;padding:12px 16px;margin-bottom:14px;font-size:13px;line-height:1.9}
.fe-import-summary .fe-badge{margin:2px 3px 2px 0;display:inline-block}
.fe-import-error{color:var(--fe-red);font-size:13px;font-weight:600}
.fe-import-success{color:#166534;font-size:14px;font-weight:700}
.fe-import-error-list{margin:8px 0 0;padding-left:20px;font-size:12.5px;color:#b45309;max-height:180px;overflow-y:auto}
.fe-import-error-list li{margin-bottom:4px}
/* toast */
#fe-toast-container{position:fixed;bottom:24px;right:24px;z-index:9999;display:flex;flex-direction:column;gap:8px}
.fe-toast{padding:12px 18px;border-radius:8px;font-size:13.5px;font-weight:600;color:#fff;box-shadow:var(--fe-shadow-md);animation:fe-toast-in .3s ease;max-width:340px}
.fe-toast-success{background:var(--fe-green)}
.fe-toast-error{background:var(--fe-red)}
.fe-toast-info{background:var(--fe-blue)}
@keyframes fe-toast-in{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
/* utilities */
.fe-row{display:flex;align-items:flex-start;flex-wrap:wrap}
.fe-gap-lg{gap:20px}
.fe-warn{color:#92400e!important}
.fe-danger{color:var(--fe-red)!important}
.fe-success{color:var(--fe-green)!important}
.col-actions{white-space:nowrap}
.rep-output{padding:0 20px 20px}
.fe-card-footer{padding:14px 20px;border-top:1px solid var(--fe-border-light);display:flex;justify-content:flex-end;gap:10px}
/* KPI strip */
.fe-kpi-strip{display:flex;gap:12px;padding:0 0 16px;flex-wrap:wrap}
.fe-kpi-mini{display:flex;flex-direction:column;gap:2px;padding:10px 18px;background:#fff;border:1.5px solid var(--fe-border);border-radius:8px;min-width:120px}
.fe-kpi-mini.warn{border-color:var(--fe-amber);background:#fffbeb}
.fe-kpi-mini.danger{border-color:var(--fe-red);background:#fef2f2}
.fe-kpi-mini-label{font-size:11px;color:var(--fe-muted);font-weight:600;text-transform:uppercase;letter-spacing:.4px}
.fe-kpi-mini-val{font-size:22px;font-weight:800;color:var(--fe-navy)}
.fe-kpi-mini.warn .fe-kpi-mini-val{color:#92400e}
.fe-kpi-mini.danger .fe-kpi-mini-val{color:var(--fe-red)}
.fe-form-section-title{font-size:12px;font-weight:700;color:var(--fe-teal);text-transform:uppercase;letter-spacing:.6px;padding:8px 0 4px;border-bottom:1.5px solid var(--fe-border-light);margin:4px 0 2px}
/* btn aliases */
.btn{display:inline-flex;align-items:center;gap:6px;padding:8px 16px;border:none;border-radius:6px;font-size:14px;font-weight:600;cursor:pointer;transition:all .15s;text-decoration:none}
.btn-primary{background:var(--fe-teal);color:#fff}.btn-primary:hover{background:var(--fe-teal2)}
.btn-secondary{background:#f1f5f9;color:var(--fe-text);border:1.5px solid var(--fe-border)}.btn-secondary:hover{background:var(--fe-border-light)}
.btn-danger{background:var(--fe-red);color:#fff}.btn-danger:hover{background:#b91c1c}
.btn-success{background:var(--fe-green);color:#fff}
.btn-xs{padding:4px 10px;font-size:12px}
.btn-sm{padding:6px 12px;font-size:13px}
.form-grid-2{display:grid;grid-template-columns:1fr 1fr;gap:14px}
.form-group{display:flex;flex-direction:column;gap:5px}
.form-group label{font-size:12.5px;font-weight:700;color:var(--fe-text);text-transform:uppercase;letter-spacing:.04em}
.form-group input,.form-group select,.form-group textarea{padding:8px 12px;border:1.5px solid var(--fe-border);border-radius:6px;font-size:13.5px;outline:none;width:100%;background:#fff;color:var(--fe-text)}
.form-group input:focus,.form-group select:focus,.form-group textarea:focus{border-color:var(--fe-teal);box-shadow:0 0 0 3px rgba(14,165,160,.12)}
.req{color:var(--fe-red)}
.text-center{text-align:center}
/* User management */
.module-tabs{display:flex;gap:6px;padding:0 0 16px;border-bottom:2px solid var(--fe-border-light);margin-bottom:20px;flex-wrap:wrap}
.tab-btn{display:flex;align-items:center;gap:6px;padding:8px 18px;border:1.5px solid var(--fe-border);border-radius:6px;background:#fff;color:var(--fe-text-soft);font-size:13.5px;font-weight:600;cursor:pointer;transition:all .15s}
.tab-btn:hover{border-color:var(--fe-teal);color:var(--fe-teal)}
.tab-btn.active{border-color:var(--fe-teal);background:var(--fe-teal);color:#fff}
.tab-btn .tab-icon{font-size:16px}
.tab-pane{display:none}
.tab-pane.active{display:block}
.kpi-pill{display:inline-flex;align-items:center;gap:6px;padding:6px 14px;border-radius:20px;background:#e8f5e9;color:#1b5e20;font-size:13px;font-weight:600;border:1px solid #a7f3d0}
.kpi-pill.warn{background:#fff8e1;color:#e65100;border-color:#fde68a}
.kpi-pill.danger{background:#fce4ec;color:#b71c1c;border-color:#fca5a5}
.module-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px;flex-wrap:wrap}
.toolbar-left{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.toolbar-right{display:flex;align-items:center;gap:8px}
.search-input{padding:7px 12px;border:1.5px solid var(--fe-border);border-radius:6px;font-size:14px;min-width:200px;outline:none;background:#fff;color:var(--fe-text)}
.search-input:focus{border-color:var(--fe-teal)}
.info-text{font-size:13px;color:var(--fe-muted);font-style:italic}
.roles-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(320px,1fr));gap:16px}
.role-card{background:#fff;border:1.5px solid var(--fe-border);border-radius:10px;padding:18px;transition:box-shadow .18s}
.role-card:hover{box-shadow:var(--fe-shadow-md)}
.role-card-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:8px;gap:8px}
.role-card-name{font-size:15px;font-weight:800;color:var(--fe-navy)}
.role-badge{padding:3px 10px;border-radius:12px;font-size:11px;font-weight:700;letter-spacing:.5px}
.role-badge.system{background:#dbeafe;color:#1e3a8a}
.role-badge.custom{background:#ede9fe;color:#4c1d95}
.role-card-desc{font-size:13px;color:var(--fe-text-soft);margin-bottom:12px;line-height:1.5}
.role-card-mods{display:flex;flex-wrap:wrap;gap:4px;margin-bottom:12px}
.mod-tag{padding:2px 8px;border-radius:12px;font-size:11px;background:#f1f5f9;color:#334155;font-weight:600}
.role-card-actions{display:flex;gap:8px}
.role-user-count{font-size:12px;color:var(--fe-muted);margin-left:auto}
.perms-heading{font-size:15px;font-weight:700;color:var(--fe-navy);margin:20px 0 4px}
.perms-sub{font-size:13px;color:var(--fe-muted);margin-bottom:12px}
.perms-table-wrap{overflow-x:auto;border:1.5px solid var(--fe-border);border-radius:8px}
.perms-table{width:100%;border-collapse:collapse}
.perms-table th,.perms-table td{padding:10px 14px;border-bottom:1px solid var(--fe-border-light);text-align:left;font-size:13px}
.perms-table th{background:#f1f5f9;font-weight:700;color:var(--fe-navy);font-size:12px;text-transform:uppercase}
.perms-table td.mod-col{font-weight:600;color:var(--fe-text);min-width:160px}
.perms-table tr:last-child td{border-bottom:none}
.perms-table tr:hover td{background:#f8fafc}
.perms-table input[type=checkbox]{width:16px;height:16px;accent-color:var(--fe-teal);cursor:pointer}
.all-col-check{accent-color:var(--fe-amber)}
.form-full{grid-column:1/-1}
.input-pw-wrap{position:relative;display:flex}
.input-pw-wrap input{flex:1;padding-right:40px}
.toggle-pw{position:absolute;right:8px;top:50%;transform:translateY(-50%);background:none;border:none;cursor:pointer;font-size:16px;color:var(--fe-muted)}
.toggle-switch{display:inline-flex;align-items:center;cursor:pointer}
.toggle-switch input{opacity:0;width:0;height:0;position:absolute}
.slider{display:inline-block;width:44px;height:24px;background:#cbd5e1;border-radius:24px;position:relative;transition:background .2s}
.slider::before{content:'';position:absolute;width:18px;height:18px;left:3px;top:3px;background:#fff;border-radius:50%;transition:transform .2s;box-shadow:0 1px 3px rgba(0,0,0,.2)}
.toggle-switch input:checked+.slider{background:var(--fe-teal)}
.toggle-switch input:checked+.slider::before{transform:translateX(20px)}
.badge-active{background:#dcfce7;color:#14532d;padding:2px 10px;border-radius:12px;font-size:11px;font-weight:700}
.badge-inactive{background:#fef9c3;color:#713f12;padding:2px 10px;border-radius:12px;font-size:11px;font-weight:700}
.badge-locked{background:#fee2e2;color:#7f1d1d;padding:2px 10px;border-radius:12px;font-size:11px;font-weight:700}
.fe-row-active{background:#eff6ff!important;outline:2px solid var(--fe-blue);outline-offset:-2px}
.pay-run-row:hover{background:#f0fdf4;cursor:pointer}
/* DB Management */
.db-mgmt-card{border-color:#fca5a5!important}
.db-mgmt-header{display:flex;align-items:flex-start;gap:14px;padding:20px 20px 0}
.db-mgmt-icon{font-size:32px;flex-shrink:0;line-height:1}
.db-mgmt-title{margin:0 0 4px;font-size:17px;font-weight:800;color:#991b1b}
.db-mgmt-sub{margin:0;font-size:13px;color:var(--fe-muted)}
.db-mgmt-section{padding:20px}
.db-mgmt-section+.db-mgmt-section{border-top:1px solid var(--fe-border-light)}
.db-mgmt-section-title{margin:0 0 4px;font-size:14px;font-weight:700;color:var(--fe-navy)}
.db-mgmt-section-sub{margin:0 0 14px;font-size:13px;color:var(--fe-muted)}
.db-purge-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(340px,1fr));gap:8px}
.db-purge-item{display:flex;align-items:center;gap:10px;padding:10px 14px;background:#fff8f8;border:1px solid #fecaca;border-radius:8px}
.db-purge-icon{font-size:20px;flex-shrink:0;width:28px;text-align:center}
.db-purge-info{flex:1;min-width:0}
.db-purge-info strong{font-size:13px;color:var(--fe-text);font-weight:700}
.db-purge-info p{margin:2px 0 0;font-size:12px;color:var(--fe-muted);line-height:1.4}
.db-purge-btn{background:#fff!important;border:1.5px solid #fca5a5!important;color:#991b1b!important;white-space:nowrap}
.db-purge-btn:hover{background:#fef2f2!important}
.db-danger-zone{background:#fff5f5;border-radius:0 0 8px 8px}
.db-danger-grid{display:flex;flex-direction:column;gap:0}
.db-danger-item{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap}
.db-danger-item p{margin:4px 0 0;font-size:13px;color:#7f1d1d;line-height:1.5}
.db-danger-item strong{font-size:14px;color:#991b1b;font-weight:700}
.db-danger-btn{background:#dc2626!important;color:#fff!important;border:none!important;white-space:nowrap;flex-shrink:0}
.db-danger-btn:hover{background:#b91c1c!important}
.db-factory-btn{background:#7f1d1d!important}
.db-factory-btn:hover{background:#6b1a1a!important}
.db-confirm-warning{display:flex;align-items:flex-start;gap:12px;padding:12px 16px;background:#fff5f5;border:1.5px solid #fca5a5;border-radius:8px}
.db-confirm-icon{font-size:24px;flex-shrink:0}
.db-confirm-warning p{margin:0;font-size:14px;color:#7f1d1d;line-height:1.5;font-weight:500}
.db-confirm-execute{background:#dc2626!important;color:#fff!important;border:none!important}
.db-confirm-execute:disabled{opacity:.45;cursor:not-allowed}
/* === Additional production styles === */
.fe-kpi-value.fe-success{color:var(--fe-green)}
.fe-success{color:var(--fe-green)}
.fe-danger{color:var(--fe-red)}
.fe-warn{color:#92400e}
/* Debt balance display */
#debt-balance-display{font-weight:700;color:var(--fe-teal);font-size:15px}
/* Receipt inner styles */
.fe-receipt{font-family:'Courier New',monospace;font-size:13px;line-height:1.6;padding:8px}
.fe-receipt h4{text-align:center;font-size:15px;font-weight:800;margin:0 0 4px;font-family:inherit}
.fe-receipt .receipt-meta{text-align:center;color:#555;font-size:12px;margin:0 0 8px}
.fe-receipt table{width:100%;border-collapse:collapse;margin:8px 0}
.fe-receipt table th,.fe-receipt table td{padding:3px 4px;font-size:12px;border-bottom:1px dotted #ccc}
.fe-receipt .receipt-total{display:flex;justify-content:space-between;font-weight:700;font-size:14px;border-top:2px solid #000;margin-top:6px;padding-top:6px}
.fe-receipt .receipt-footer{text-align:center;font-size:11px;color:#777;margin-top:8px;border-top:1px dashed #ccc;padding-top:6px}
/* Payroll row active */
.fe-row-active{background:rgba(14,165,160,.08)!important;outline:2px solid var(--fe-teal);outline-offset:-2px}
.pay-run-row:hover{background:#f0fafa;cursor:pointer}
/* Proc view modal */
#proc-view-modal .fe-modal-body{max-height:60vh;overflow-y:auto}
/* Alert info style */
.fe-alert-info{background:#eff6ff;border:1px solid #bfdbfe;color:#1e40af;padding:10px 14px;border-radius:6px;font-size:13px}
/* fe-subheader */
.fe-subheader{font-weight:700;font-size:12px;text-transform:uppercase;letter-spacing:.06em;color:var(--fe-muted);padding:12px 0 6px;border-bottom:1px solid var(--fe-border-light);margin-bottom:12px}
/* Stock-info below autocomplete */
#spoil-stock-info{display:block;font-size:12px;color:var(--fe-muted);margin-top:4px}

/* ═══════════════════════════════════════════════════════════════
   LOGIN PAGE — lp-* namespace (v6 simple)
   Single centered card, fully responsive.
   ═══════════════════════════════════════════════════════════════ */

.lp-root{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:100vh;
  min-height:100dvh;
  width:100%;
  height:auto;
  overflow-y:auto;
  padding:24px;
  box-sizing:border-box;
  background:linear-gradient(160deg,#042210 0%,#063a1e 55%,#0a4a20 100%);
  font-family:'Segoe UI',system-ui,-apple-system,sans-serif;
}
.lp-root [hidden]{display:none!important}

/* ── Overlay mode: login form floats above the (locked) dashboard/page ──
   The dashboard renders underneath, dimmed + blurred, so the user sees
   "the system" (dashboard) with the login form on top of it. */
.lp-root.lp-overlay{
  position:fixed;
  inset:0;
  z-index:9999;
  background:rgba(6,20,12,.55);
  backdrop-filter:blur(6px) saturate(85%);
  -webkit-backdrop-filter:blur(6px) saturate(85%);
}
/*
 * `overflow:hidden` on <body> alone does NOT reliably block touch-scroll
 * gestures on iOS Safari and many mobile/tablet browsers -- the locked
 * dashboard underneath the login overlay can still be finger-swiped into
 * view, exposing its frozen/half-loaded state (spinners, "..." placeholders)
 * below the fold. That is the real cause of the login page looking "messy"
 * on tablets/phones. Freezing <body> itself with position:fixed is the
 * standard cross-browser-safe scroll lock: it works even where overflow
 * alone fails, and html,body's own overflow:hidden is kept as a fallback
 * for browsers where fixed-body scroll can still leak through.
 */
html.pherp-locked, body.pherp-locked{overflow:hidden!important; height:100%!important}
body.pherp-locked{position:fixed!important; width:100%!important; top:0!important; left:0!important; right:0!important}
body.pherp-locked .fe-app{
  filter:blur(3px) saturate(70%) brightness(.94);
  pointer-events:none;
  user-select:none;
}
@media(prefers-reduced-motion:reduce){
  body.pherp-locked .fe-app{filter:blur(1.5px)}
}

.lp-card{
  width:100%;
  max-width:400px;
  max-height:100%;
  background:#fff;
  border-radius:16px;
  padding:40px 36px 32px;
  box-shadow:0 8px 40px rgba(0,0,0,.25),0 0 0 1px rgba(0,0,0,.04);
  animation:lp-slide-up .35s cubic-bezier(.22,1,.36,1) both;
  box-sizing:border-box;
  margin:auto;
}
@keyframes lp-slide-up{
  from{opacity:0;transform:translateY(20px)}
  to{opacity:1;transform:none}
}

.lp-header{
  text-align:center;
  margin-bottom:28px;
}
.lp-header__icon{
  font-size:44px;
  line-height:1;
  margin-bottom:12px;
  filter:drop-shadow(0 4px 12px rgba(13,148,136,.35));
}
.lp-header__title{
  font-size:clamp(18px,4vw,22px);
  font-weight:800;
  color:var(--fe-navy);
  margin:0 0 6px;
  letter-spacing:-.3px;
  line-height:1.25;
}
.lp-header__sub{
  font-size:13px;
  color:var(--fe-muted);
  margin:0;
  line-height:1.5;
}

/* alert */
.lp-alert{
  padding:11px 14px;
  border-radius:8px;
  font-size:13.5px;
  font-weight:500;
  margin-bottom:18px;
  border-left:4px solid transparent;
  display:flex;
  align-items:flex-start;
  gap:8px;
  line-height:1.4;
}
.lp-alert.lp-err{
  background:#fef2f2;
  color:#7f1d1d;
  border-color:#f87171;
}
.lp-alert.lp-ok{
  background:#f0fdf4;
  color:#14532d;
  border-color:#4ade80;
}

/* form fields */
.lp-form{
  display:flex;
  flex-direction:column;
  gap:0;
}
.lp-field{
  display:flex;
  flex-direction:column;
  gap:5px;
  margin-bottom:18px;
}
.lp-label{
  font-size:11.5px;
  font-weight:700;
  color:var(--fe-text);
  text-transform:uppercase;
  letter-spacing:.07em;
}
.lp-req{color:var(--fe-red);margin-left:2px}

/* input */
.lp-input{
  width:100%;
  padding:11px 14px;
  border:1.5px solid var(--fe-border);
  border-radius:9px;
  font-size:14px;
  color:var(--fe-text);
  background:#fff;
  outline:none;
  font-family:inherit;
  transition:border-color .16s,box-shadow .16s,background .16s;
  box-sizing:border-box;
}
.lp-input:focus{
  border-color:#16a34a;
  box-shadow:0 0 0 3px rgba(22,163,74,.14);
  background:#f0fdf4;
}
.lp-input::placeholder{color:#b0bec5;font-size:13.5px}
.lp-input.lp-invalid{
  border-color:var(--fe-red);
  box-shadow:0 0 0 3px rgba(220,38,38,.11);
}

/* password eye */
.lp-pw-wrap{position:relative;display:flex;align-items:center}
.lp-pw-wrap .lp-input{padding-right:44px}
.lp-eye-btn{
  position:absolute;right:12px;
  top:50%;transform:translateY(-50%);
  background:none;border:none;
  cursor:pointer;color:var(--fe-muted);
  padding:4px;border-radius:6px;
  display:flex;align-items:center;justify-content:center;
  transition:color .15s,background .15s;
}
.lp-eye-btn:hover{color:#16a34a;background:rgba(22,163,74,.08)}
.lp-eye-show,.lp-eye-hide{width:18px;height:18px}

/* field-level error */
.lp-field-err{
  font-size:12px;
  color:var(--fe-red);
  font-weight:500;
  line-height:1.4;
}

/* remember me */
.lp-remember{
  display:flex;
  align-items:center;
  gap:10px;
  font-size:13px;
  color:var(--fe-text-soft);
  cursor:pointer;
  user-select:none;
  margin-bottom:22px;
  line-height:1.4;
}
.lp-checkbox{
  width:17px;height:17px;
  accent-color:var(--fe-teal);
  cursor:pointer;flex-shrink:0;
  margin:0;
}
.lp-check-mark{display:none}

/* submit button */
.lp-submit-btn{
  width:100%;
  padding:13px 20px;
  background:linear-gradient(135deg,#16a34a 0%,#15803d 100%);
  color:#fff;
  border:none;
  border-radius:9px;
  font-size:15px;
  font-weight:700;
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  font-family:inherit;
  letter-spacing:.01em;
  transition:opacity .18s,transform .15s,box-shadow .18s;
  box-shadow:0 4px 20px rgba(22,163,74,.35);
  margin-bottom:4px;
}
.lp-submit-btn:hover:not(:disabled){
  opacity:.92;
  transform:translateY(-1px);
  box-shadow:0 8px 28px rgba(22,163,74,.45);
}
.lp-submit-btn:active:not(:disabled){
  transform:translateY(0);
  box-shadow:0 2px 8px rgba(22,163,74,.3);
}
.lp-submit-btn:disabled{
  opacity:.5;cursor:not-allowed;transform:none;
}
.lp-submit-text{line-height:1}

/* spinner SVG */
.lp-submit-spinner{
  width:20px;height:20px;
  display:flex;align-items:center;justify-content:center;
  flex-shrink:0;
}
.lp-submit-spinner svg{
  width:20px;height:20px;
  animation:lp-spin .7s linear infinite;
}
@keyframes lp-spin{to{transform:rotate(360deg)}}

/* form footer */
.lp-footer{
  text-align:center;
  font-size:11.5px;
  color:var(--fe-muted);
  margin:20px 0 0;
  line-height:1.7;
}
.lp-footer strong{color:var(--fe-text-soft)}

/* ──────────────── RESPONSIVE ──────────────── */
@media(max-width:600px){
  .lp-root{padding:16px;align-items:flex-start}
  .lp-card{padding:28px 24px 20px;border-radius:12px;margin:16px auto}
  .lp-header{margin-bottom:20px}
  .lp-header__icon{font-size:36px;margin-bottom:8px}
  .lp-field{margin-bottom:14px}
  .lp-remember{margin-bottom:16px}
}
@media(max-width:360px){
  .lp-root{padding:10px}
  .lp-card{padding:20px 16px 16px}
  .lp-header{margin-bottom:16px}
  .lp-header__icon{font-size:30px;margin-bottom:6px}
  .lp-header__sub{font-size:12px}
  .lp-field{margin-bottom:12px}
  .lp-input{padding:9px 12px;font-size:13.5px}
  .lp-pw-wrap .lp-input{padding-right:40px}
  .lp-submit-btn{padding:11px 16px;font-size:14px}
  .lp-remember{margin-bottom:14px;font-size:12.5px}
  .lp-footer{margin-top:14px;font-size:11px}
}
/* Mini tablets in portrait (e.g. 7-8in, iPad mini-ish) — keep card modest, don't stretch full width */
@media(min-width:601px) and (max-width:820px){
  .lp-card{max-width:420px}
}
/* Short viewports (landscape phones, small tablets rotated) — the #1 "doesn't fit" case:
   shrink vertical rhythm so the whole card is visible without scrolling. */
@media(max-height:700px){
  .lp-root{align-items:flex-start;padding-top:16px;padding-bottom:16px}
  .lp-card{padding:22px 28px 18px}
  .lp-header{margin-bottom:14px}
  .lp-header__icon{font-size:28px;margin-bottom:4px}
  .lp-header__title{font-size:18px;margin-bottom:2px}
  .lp-header__sub{font-size:12px}
  .lp-field{margin-bottom:10px}
  .lp-input{padding:9px 12px}
  .lp-remember{margin-bottom:12px}
  .lp-footer{margin-top:10px}
}
@media(max-height:520px){
  .lp-card{padding:16px 22px 14px}
  .lp-header{margin-bottom:10px}
  .lp-header__icon{font-size:0;margin:0;height:0;overflow:hidden}
  .lp-header__title{font-size:16px}
  .lp-footer{display:none}
}

/* ERP media queries */
@media(max-width:768px){.fe-sidebar{width:var(--fe-sidebar-w-c)}.fe-sidebar-name,.fe-nav-label{display:none}.fe-main{margin-left:var(--fe-sidebar-w-c)}.fe-pos-layout{flex-direction:column}.fe-pos-payment-panel{width:100%}.fe-kpi-grid{grid-template-columns:1fr 1fr}.fe-form-grid{grid-template-columns:1fr}.form-grid-2{grid-template-columns:1fr}}
@media(max-width:480px){.fe-topbar{padding:0 12px}.fe-kpi-grid{grid-template-columns:1fr;padding:12px}.fe-card{margin:10px}}
@media print{.fe-sidebar,.fe-topbar,.fe-btn,.fe-modal-footer{display:none!important}.fe-main{margin-left:0!important}.fe-card{box-shadow:none;border:1px solid #ccc}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

/* ═══════════════════════════════════════════════════════════════
   ALFRED — floating AI assistant widget (present on every ERP page)
   ═══════════════════════════════════════════════════════════════ */
#alfred-widget{position:fixed;right:26px;bottom:26px;z-index:9500;font-family:'Segoe UI',system-ui,-apple-system,sans-serif}
#alfred-fab{
  width:58px;height:58px;border-radius:50%;border:none;cursor:pointer;
  background:linear-gradient(135deg,#0d9488 0%,#0b8078 100%);
  box-shadow:0 6px 24px rgba(13,148,136,.4);
  display:flex;align-items:center;justify-content:center;
  transition:transform .18s,box-shadow .18s;
}
#alfred-fab:hover{transform:translateY(-2px) scale(1.04);box-shadow:0 10px 30px rgba(13,148,136,.5)}
.alfred-fab-icon{font-size:28px;line-height:1}
#alfred-panel{
  position:absolute;right:0;bottom:74px;width:360px;max-width:calc(100vw - 40px);
  background:#fff;border-radius:14px;box-shadow:0 12px 48px rgba(0,0,0,.25),0 0 0 1px rgba(0,0,0,.04);
  display:flex;flex-direction:column;overflow:hidden;
  animation:alfred-in .2s cubic-bezier(.34,1.56,.64,1);
}
@keyframes alfred-in{from{opacity:0;transform:translateY(12px) scale(.97)}to{opacity:1;transform:none}}
#alfred-panel[hidden]{display:none!important}
.alfred-panel-header{
  display:flex;align-items:center;justify-content:space-between;
  padding:14px 16px;background:linear-gradient(135deg,#0d9488,#0b1f38);color:#fff;
  font-weight:800;font-size:14px;
}
.alfred-panel-header small{font-weight:500;font-size:11px;opacity:.75;margin-left:6px}
#alfred-close-btn{background:rgba(255,255,255,.15);border:none;color:#fff;width:26px;height:26px;border-radius:50%;cursor:pointer;font-size:13px;display:flex;align-items:center;justify-content:center}
#alfred-close-btn:hover{background:rgba(255,255,255,.3)}
.alfred-messages{flex:1;max-height:360px;min-height:160px;overflow-y:auto;padding:14px 16px;display:flex;flex-direction:column;gap:10px;background:#f8fafc}
.alfred-msg{font-size:13px;line-height:1.55;padding:9px 13px;border-radius:12px;max-width:88%;white-space:pre-line}
.alfred-msg-assistant{background:#fff;color:#0f172a;align-self:flex-start;border:1px solid var(--fe-border-light);border-bottom-left-radius:3px}
.alfred-msg-user{background:var(--fe-teal);color:#fff;align-self:flex-end;border-bottom-right-radius:3px}
.alfred-msg-thinking{color:var(--fe-muted);font-style:italic}
.alfred-form{display:flex;gap:8px;padding:12px;border-top:1px solid var(--fe-border-light);background:#fff}
.alfred-form .fe-input{flex:1}
@media(max-width:480px){#alfred-widget{right:14px;bottom:14px}#alfred-panel{width:calc(100vw - 28px);right:-8px}}

