:root {
  --fx-navy: #07111F;
  --fx-navy-2: #0B1F36;
  --fx-navy-3: #122843;
  --fx-blue: #1B7CFF;
  --fx-blue-bright: #2F8CFF;
  --fx-blue-glow: rgba(47, 140, 255, 0.35);
  --fx-silver: #C8D0DC;
  --fx-metal: #9AA6B5;
  --fx-bg: #EEF1F5;
  --fx-surface: #FFFFFF;
  --fx-muted: #6B7785;
  --fx-border: #D7DEE8;
  --fx-danger: #C0392B;
  --fx-shadow: 0 10px 30px rgba(7, 17, 31, 0.08);
  --fx-radius: 14px;
  --fx-font: "Manrope", "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--fx-font);
  color: var(--fx-navy);
  background: var(--fx-bg);
}

a { color: var(--fx-blue); text-decoration: none; }
a:hover { color: var(--fx-blue-bright); }

.formex-input {
  background: #F4F6F9 !important;
  border: 1px solid transparent !important;
  border-radius: 10px !important;
  min-height: 48px;
  padding: 0.7rem 1rem;
  font-size: 0.95rem;
  color: var(--fx-navy);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.formex-input:focus {
  background: #fff !important;
  border-color: var(--fx-blue) !important;
  box-shadow: 0 0 0 3px var(--fx-blue-glow) !important;
  outline: none;
}

.formex-input[readonly] {
  opacity: 0.85;
  cursor: default;
}

.form-field {
  margin-bottom: 1.1rem;
}

.form-field label,
.form-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--fx-navy-2);
  margin-bottom: 0.45rem;
}

.field-error {
  display: block;
  color: var(--fx-danger);
  font-size: 0.8rem;
  margin-top: 0.3rem;
}

.password-wrap {
  position: relative;
}

.password-wrap .formex-input {
  padding-right: 2.8rem;
}

.toggle-password {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--fx-muted);
  cursor: pointer;
  padding: 0.25rem;
}

.toggle-password:hover { color: var(--fx-blue); }

.btn-signin {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(90deg, var(--fx-navy) 0%, var(--fx-blue) 100%);
  box-shadow: 0 10px 24px rgba(27, 124, 255, 0.28);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
  cursor: pointer;
}

.btn-signin:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 14px 28px rgba(27, 124, 255, 0.35);
  color: #fff;
}

.login-alert,
.validation-summary-errors {
  background: #FDECEC;
  color: var(--fx-danger);
  border: 1px solid #F5C6C2;
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.validation-summary-errors ul {
  margin: 0;
  padding-left: 1.1rem;
}

.formex-toast.success {
  background: #E8F6EE;
  color: #1E7A46;
  border: 1px solid #B7E0C5;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}

.page-panel {
  max-width: 960px;
}

.page-panel-wide {
  max-width: none;
  width: 100%;
}

.page-panel-header h1 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--fx-navy);
}

.page-panel-header p {
  margin: 0.35rem 0 1.25rem;
  color: var(--fx-muted);
}

.page-panel-card {
  background: var(--fx-surface);
  border: 1px solid var(--fx-border);
  border-radius: var(--fx-radius);
  box-shadow: var(--fx-shadow);
  padding: 1.5rem;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.4rem;
}

.btn-secondary-link {
  color: var(--fx-muted);
  font-weight: 600;
}

.btn-back-modules {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding: 0.7rem 1.2rem;
  border-radius: 10px;
  background: var(--fx-navy);
  color: #fff !important;
  font-weight: 700;
  transition: background .2s ease, transform .2s ease;
}

.btn-back-modules:hover {
  background: var(--fx-blue);
  transform: translateY(-1px);
}

/* Language switcher — shared (login + ERP header) */
.lang-form {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

.lang-segment {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: #F4F6F9;
  border: 1px solid var(--fx-border);
}

.lang-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 0 !important;
  outline: none;
  background: transparent !important;
  color: var(--fx-muted);
  font-weight: 600;
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0.38rem 0.9rem;
  border-radius: 999px;
  line-height: 1.2;
  min-height: 0;
  box-shadow: none !important;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.lang-btn.active {
  background: linear-gradient(90deg, var(--fx-navy) 0%, var(--fx-blue) 100%) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(27, 124, 255, 0.25) !important;
}

.lang-btn:hover:not(.active) {
  color: var(--fx-navy);
  background: rgba(255, 255, 255, 0.85) !important;
}

.lang-btn:focus-visible {
  box-shadow: 0 0 0 3px var(--fx-blue-glow) !important;
}

.lang-sep { display: none; }

.erp-header .lang-switcher {
  position: static;
}

/* ===== Purchasing / Suppliers ===== */
.fx-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  color: var(--fx-muted);
}
.fx-breadcrumb a { color: var(--fx-blue); font-weight: 600; }
.fx-bc-sep { opacity: 0.55; }

.fx-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.fx-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}
.fx-btn-inline {
  width: auto !important;
  padding: 0.65rem 1.2rem !important;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.fx-dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.fx-dash-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.35rem 0 0.85rem;
}
.fx-dash-section-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--fx-navy);
}
.fx-dash-section-head p {
  margin: 0;
  color: var(--fx-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

/* Premium KPI strip — full width */
.fx-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 0.5rem 0 1.5rem;
}
.fx-kpi {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 1.2rem 1.3rem 1.1rem;
  background: #fff;
  border: 1px solid var(--fx-border);
  box-shadow: 0 10px 28px rgba(7, 17, 31, 0.06);
  min-height: 148px;
  display: flex;
  flex-direction: column;
}
.fx-kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--fx-blue);
}
.fx-kpi-total::before { background: linear-gradient(180deg, #1B7CFF, #0B1F36); }
.fx-kpi-active::before { background: linear-gradient(180deg, #22C55E, #15803D); }
.fx-kpi-inactive::before { background: linear-gradient(180deg, #94A3B8, #64748B); }
.fx-kpi-month::before { background: linear-gradient(180deg, #38BDF8, #0369A1); }

.fx-kpi-top {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.65rem;
}
.fx-kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.fx-kpi-total .fx-kpi-icon { background: #EAF2FF; color: #1B7CFF; }
.fx-kpi-active .fx-kpi-icon { background: #E8F8EF; color: #15803D; }
.fx-kpi-inactive .fx-kpi-icon { background: #F1F5F9; color: #64748B; }
.fx-kpi-month .fx-kpi-icon { background: #E0F2FE; color: #0369A1; }

.fx-kpi-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fx-muted);
  line-height: 1.3;
}
.fx-kpi-value {
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--fx-navy);
  line-height: 1;
  margin: 0.15rem 0 auto;
}
.fx-kpi-meter {
  height: 6px;
  border-radius: 999px;
  background: #E8EEF5;
  margin: 0.85rem 0 0.55rem;
  overflow: hidden;
}
.fx-kpi-meter > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22C55E, #16A34A);
  min-width: 0;
  transition: width .35s ease;
}
.fx-kpi-foot {
  margin-top: 0.35rem;
}
.fx-kpi-hint {
  font-size: 0.78rem;
  color: var(--fx-muted);
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fx-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.fx-stat-card {
  background: linear-gradient(145deg, #0B1F36 0%, #122843 55%, #16355A 100%);
  color: #fff;
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  box-shadow: var(--fx-shadow);
  border: 1px solid rgba(200, 208, 220, 0.12);
  position: relative;
  overflow: hidden;
}
.fx-stat-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% auto;
  width: 120px;
  height: 120px;
  background: radial-gradient(circle, rgba(27,124,255,.35), transparent 70%);
}
.fx-stat-label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--fx-silver);
  margin-bottom: 0.35rem;
}
.fx-stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.fx-module-nav-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}
.fx-nav-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--fx-surface);
  border: 1px solid var(--fx-border);
  border-radius: 14px;
  padding: 1.2rem 1.25rem;
  box-shadow: var(--fx-shadow);
  min-height: 168px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  color: inherit;
}
.fx-nav-card-body { flex: 1; }
.fx-nav-card.is-active {
  border-color: rgba(27,124,255,.35);
  background: linear-gradient(180deg, #FFFFFF 0%, #F5F9FF 100%);
}
.fx-nav-card.is-active:hover {
  transform: translateY(-3px);
  border-color: rgba(27,124,255,.55);
  box-shadow: 0 14px 34px rgba(7,17,31,.12);
}
.fx-nav-card.is-soon {
  opacity: 0.78;
  background: #F7F9FC;
  cursor: not-allowed;
}
.fx-nav-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--fx-navy), var(--fx-blue));
  color: #fff;
  font-size: 1.2rem;
}
.fx-nav-card.is-soon .fx-nav-card-icon {
  background: linear-gradient(135deg, #6B7785, #9AA6B5);
}
.fx-nav-card h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--fx-navy);
}
.fx-nav-card p {
  margin: 0.25rem 0 0;
  color: var(--fx-muted);
  font-size: 0.88rem;
}
.fx-nav-card-action {
  margin-top: auto;
  font-weight: 700;
  color: var(--fx-blue);
  font-size: 0.88rem;
}

.fx-filter-card { margin-bottom: 1rem; }
.fx-filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
}
.fx-results-count {
  margin-inline-start: auto;
  color: var(--fx-muted);
  font-weight: 600;
  font-size: 0.9rem;
}

.fx-table-card { padding: 0; overflow: hidden; }
.fx-data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.fx-data-table th,
.fx-data-table td {
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--fx-border);
  vertical-align: middle;
  white-space: nowrap;
}
.fx-data-table th {
  background: #F4F7FB;
  color: var(--fx-navy);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.fx-data-table th a { color: inherit; }
.fx-data-table tbody tr:hover { background: #F8FBFF; }
.fx-code-link { font-weight: 700; color: var(--fx-blue); }
.fx-code-pill {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  background: #EAF2FF;
  color: var(--fx-blue);
  font-weight: 700;
  font-size: 0.85rem;
  margin-inline-end: 0.5rem;
}

.fx-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.fx-badge.active { background: #E6F7ED; color: #157347; }
.fx-badge.inactive { background: #F1F3F5; color: #6B7785; }
.fx-badge.soon { background: #EEF1F5; color: #6B7785; }
.fx-badge.primary { background: #EAF2FF; color: #1B7CFF; margin-inline-start: 0.35rem; }
.fx-badge.draft { background: #EEF1F5; color: #495057; }
.fx-badge.pending { background: #FFF4E5; color: #B76E00; }
.fx-badge.review { background: #EAF2FF; color: #1B7CFF; }
.fx-badge.danger { background: #FDECEC; color: #C62828; }
.fx-badge.closed { background: #E8EAF0; color: #455A64; }
.fx-badge.normal { background: #EEF1F5; color: #495057; }
.fx-badge.urgent { background: #FFF4E5; color: #B76E00; }
.fx-badge.very-urgent { background: #FDECEC; color: #C62828; }
.fx-total-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #E6E9EF;
  font-size: 1.05rem;
}
.fx-total-bar strong { color: #1B7CFF; font-size: 1.25rem; }
.fx-action-group { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.fx-section-head-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 0.75rem; }
.fx-span-2 { grid-column: span 2; }
.fx-form-actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 1.25rem; }
.fx-validation-summary {
  background: #FDECEC;
  border: 1px solid #F5C2C7;
  color: #842029;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}
.fx-validation-summary ul { margin: 0.35rem 0 0; padding-inline-start: 1.1rem; }

.fx-row-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.fx-row-actions a,
.fx-icon-btn {
  width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  border: 0;
  background: #F4F6F9;
  color: var(--fx-navy);
  cursor: pointer;
}
.fx-row-actions a:hover,
.fx-icon-btn:hover { background: #EAF2FF; color: var(--fx-blue); }
.fx-icon-btn.danger:hover { background: #FDECEC; color: var(--fx-danger); }

.fx-empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--fx-muted);
}
.fx-empty-state i {
  font-size: 2.4rem;
  color: var(--fx-metal);
  margin-bottom: 0.75rem;
}
.fx-empty-state h3 {
  color: var(--fx-navy);
  margin: 0.4rem 0;
}
.fx-empty-state p { margin-bottom: 1.25rem; }

.fx-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-top: 1px solid var(--fx-border);
}
.fx-pagination a.disabled {
  pointer-events: none;
  opacity: 0.4;
}

.fx-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.fx-section-title {
  font-size: 1rem;
  font-weight: 800;
  margin: 0 0 1rem;
  color: var(--fx-navy);
  padding-bottom: 0.55rem;
  border-bottom: 1px solid var(--fx-border);
}
.fx-dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1.25rem;
  margin: 0;
}
.fx-dl dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fx-muted);
  margin-bottom: 0.15rem;
}
.fx-dl dd {
  margin: 0;
  font-weight: 600;
  color: var(--fx-navy);
}
.fx-hint {
  display: block;
  margin-top: 0.25rem;
  color: var(--fx-muted);
  font-size: 0.8rem;
}
.fx-required { color: var(--fx-danger); }
.fx-check { margin-top: 1.6rem; }
.fx-muted { color: var(--fx-muted); }

@media (max-width: 1200px) {
  .fx-kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fx-module-nav-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .fx-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fx-module-nav-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .fx-kpi-strip,
  .fx-stat-grid,
  .fx-module-nav-grid,
  .fx-detail-grid,
  .fx-dl { grid-template-columns: 1fr; }
}

/* Supplier form extras */
.fx-form-section {
  margin: 1.25rem 0 0.35rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--fx-border);
  font-size: 1rem;
  font-weight: 800;
  color: var(--fx-navy);
}
.fx-select-with-add {
  display: flex;
  gap: 0.45rem;
  align-items: stretch;
}
.fx-select-with-add select { flex: 1; }
.fx-add-lookup-btn {
  width: 48px;
  border: 1px solid var(--fx-border);
  border-radius: 10px;
  background: #F4F6F9;
  color: var(--fx-navy);
  cursor: pointer;
}
.fx-add-lookup-btn:hover { background: #EAF2FF; color: var(--fx-blue); }
.fx-quick-add {
  margin-top: 0.65rem;
  padding: 0.85rem;
  border: 1px dashed var(--fx-border);
  border-radius: 12px;
  background: #F8FAFC;
}
.fx-quick-msg { display: block; margin-top: 0.35rem; font-weight: 600; font-size: 0.8rem; }
.fx-quick-msg.ok { color: #15803D; }
.fx-quick-msg.error { color: var(--fx-danger); }
.fx-activity-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.fx-activity-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--fx-border);
  background: #fff;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
  user-select: none;
}
.fx-activity-chip input { margin: 0; }
.fx-activity-chip:has(input:checked) {
  border-color: rgba(27,124,255,.45);
  background: #EAF2FF;
  color: var(--fx-blue);
}
.fx-activity-chip.static {
  cursor: default;
  background: #F4F7FB;
}
.fx-section-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--fx-border);
}
.fx-bank-card {
  border: 1px solid var(--fx-border);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.65rem;
  background: #FCFDFE;
}
.fx-bank-card-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.fx-bank-card .bank-title { margin-inline-end: 0.45rem; }
.fx-modal .modal-content {
  border: 0;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(7, 17, 31, 0.18);
}
.fx-modal .modal-header {
  border-bottom: 1px solid var(--fx-border);
  padding: 1rem 1.25rem;
}
.fx-modal .modal-title {
  font-weight: 800;
  color: var(--fx-navy);
}
.fx-modal .modal-body { padding: 1.25rem; }
.fx-modal .modal-footer {
  border-top: 1px solid var(--fx-border);
  padding: 0.9rem 1.25rem;
  gap: 0.75rem;
}
