*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #f3f6f3;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 0;
  background: #f3f6f3;
  color: #1f2a22;
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea,
.select2-container {
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

::selection {
  background: rgba(58, 170, 52, 0.22);
  color: #1f2a22;
}

a {
  color: #2d8f28;
  transition: color 0.18s ease;
}
a:hover, a:focus {
  color: #236f20;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: #1f2a22;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.text-muted,
.text-black-50 {
  color: #667269 !important;
}

.btn {
  min-height: 42px;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-weight: 600;
  box-shadow: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease, border-color 0.16s ease;
}
.btn:hover:not(:disabled), .btn:focus:not(:disabled) {
  transform: translateY(-1px);
}
.btn:focus, .btn.focus {
  box-shadow: 0 0 0 3px rgba(58, 170, 52, 0.2) !important;
}

.btn-primary,
.btn-dark {
  border-color: #3aaa34;
  background-color: #3aaa34;
  color: #ffffff;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active, .btn-primary:not(:disabled):not(.disabled):active, .btn-primary:not(:disabled):not(.disabled).active,
.btn-dark:hover,
.btn-dark:focus,
.btn-dark:active,
.btn-dark:not(:disabled):not(.disabled):active,
.btn-dark:not(:disabled):not(.disabled).active {
  border-color: #2d8f28;
  background-color: #2d8f28;
  color: #ffffff;
  box-shadow: 0 7px 18px rgba(45, 143, 40, 0.22);
}
.btn-primary:disabled, .btn-primary.disabled,
.btn-dark:disabled,
.btn-dark.disabled {
  border-color: #3aaa34;
  background-color: #3aaa34;
  color: #ffffff;
  opacity: 0.7;
  box-shadow: none;
}

.btn-urgent {
  border: 1px solid rgba(58, 170, 52, 0.28);
  background: #eaf7e9;
  color: #236f20;
}
.btn-urgent:hover, .btn-urgent:focus {
  border-color: #3aaa34;
  background: #3aaa34;
  color: #ffffff;
}

.form-control,
.custom-select,
.select2-container .select2-selection--multiple,
.select2-container .select2-selection--single {
  min-height: 44px;
  border: 1px solid #dbe4dc;
  border-radius: 8px;
  background-color: #ffffff;
  color: #1f2a22;
  box-shadow: 0 1px 2px rgba(31, 42, 34, 0.02);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.form-control:focus,
.custom-select:focus,
.select2-container .select2-selection--multiple:focus,
.select2-container .select2-selection--single:focus {
  border-color: #3aaa34;
  box-shadow: 0 0 0 3px rgba(58, 170, 52, 0.14);
}

.form-control::placeholder {
  color: #98a29a;
}

label,
.form-label {
  margin-bottom: 0.4rem;
  color: #445047;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.015em;
}

input[type=checkbox] {
  accent-color: #3aaa34;
}

.select2-container {
  color: #1f2a22 !important;
}
.select2-container .select2-selection--multiple {
  padding: 3px 6px;
}
.select2-container .select2-selection__choice {
  margin-top: 4px !important;
  border: 1px solid rgba(58, 170, 52, 0.22) !important;
  border-radius: 6px !important;
  background: #eaf7e9 !important;
  color: #236f20 !important;
  font-size: 0.86rem;
}
.select2-container .select2-selection__choice__remove {
  color: #2d8f28 !important;
}
.select2-container.select2-container--focus .select2-selection--multiple, .select2-container.select2-container--open .select2-selection--multiple {
  border-color: #3aaa34;
  box-shadow: 0 0 0 3px rgba(58, 170, 52, 0.14);
}

.select2-dropdown {
  overflow: hidden;
  border: 1px solid #dbe4dc !important;
  border-radius: 8px !important;
  box-shadow: 0 14px 36px rgba(31, 42, 34, 0.11);
}

.select2-results__option--highlighted[aria-selected] {
  background: #3aaa34 !important;
}

.card {
  overflow: hidden;
  border: 1px solid rgba(219, 228, 220, 0.9);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(31, 42, 34, 0.07);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card .card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #dbe4dc;
  background: #f4fbf3;
  color: #1f2a22;
  font-weight: 700;
}
.card .card-body {
  padding: 1.35rem;
}
.card img {
  max-width: 100%;
}

.alert {
  border: 0;
  border-left: 4px solid currentColor;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(31, 42, 34, 0.07);
}

.alert-info {
  background: #edf7fb;
  color: #2779a7;
}

.alert-danger {
  background: #fdf0f0;
  color: #d94b4b;
}

.alert-warning {
  background: #fff7e9;
  color: #d79522;
}

.progress {
  overflow: hidden;
  border-radius: 999px;
  background: #e9eee9;
}

.progress-bar {
  background-color: #3aaa34;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-heading .page-eyebrow {
  display: block;
  margin-bottom: 0.3rem;
  color: #2d8f28;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.page-heading h1 {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.25rem);
}
.page-heading p {
  max-width: 650px;
  margin: 0.35rem 0 0;
  color: #667269;
}

body.authenticated .app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(219, 228, 220, 0.9);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 4px 20px rgba(31, 42, 34, 0.06);
  backdrop-filter: blur(10px);
}
body.authenticated .app-navbar {
  display: flex;
  min-height: 70px;
  align-items: center;
  gap: 1.4rem;
  padding: 0.65rem 2rem;
}
body.authenticated .app-brand {
  display: flex;
  min-width: max-content;
  align-items: center;
  gap: 0.75rem;
  color: #1f2a22;
  text-decoration: none;
}
body.authenticated .app-brand:hover, body.authenticated .app-brand:focus {
  color: #1f2a22;
  text-decoration: none;
}
body.authenticated .app-brand-mark {
  display: inline-flex;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #3aaa34;
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  box-shadow: 0 7px 16px rgba(58, 170, 52, 0.24);
}
body.authenticated .app-brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
body.authenticated .app-brand-copy strong {
  font-size: 0.96rem;
}
body.authenticated .app-brand-copy small {
  color: #667269;
  font-size: 0.69rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
body.authenticated .app-navigation {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
body.authenticated .app-navigation a {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border-radius: 8px;
  color: #526056;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
body.authenticated .app-navigation a:hover, body.authenticated .app-navigation a:focus {
  background: #f4fbf3;
  color: #236f20;
}
body.authenticated .app-navigation a.active {
  background: #eaf7e9;
  color: #236f20;
  box-shadow: inset 0 0 0 1px rgba(58, 170, 52, 0.12);
}
body.authenticated .app-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
body.authenticated .app-actions .custom-select {
  flex: 0 0 auto;
  min-height: 38px;
  height: 38px;
  padding: 0.3rem 2rem 0.3rem 0.75rem;
  border-color: #dbe4dc;
  background-color: #f4fbf3;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.45;
}
body.authenticated .app-actions #language-select {
  width: 112px;
  min-width: 112px;
}
body.authenticated .app-actions #currency-select {
  width: 78px;
  min-width: 78px;
}
body.authenticated .app-main {
  width: 100%;
  max-width: 1800px;
  margin: 0 auto;
  padding: 2rem;
}

body.guest {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 15% 20%, rgba(58, 170, 52, 0.14), transparent 30%), radial-gradient(circle at 85% 80%, rgba(58, 170, 52, 0.08), transparent 28%), linear-gradient(135deg, #f7faf7 0%, #edf4ed 100%);
}
body.guest .guest-main {
  width: 100%;
  padding: 2rem 1rem;
}
body.guest .login-shell {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
}
body.guest .login-card {
  overflow: hidden;
  border: 1px solid rgba(219, 228, 220, 0.95);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 14px 36px rgba(31, 42, 34, 0.11);
}
body.guest .login-accent {
  height: 6px;
  background: #3aaa34;
}
body.guest .login-content {
  padding: 2.1rem 2.25rem 1.65rem;
}
body.guest .login-brand {
  margin-bottom: 1.6rem;
  text-align: center;
}
body.guest .login-brand img {
  width: auto;
  max-width: 220px;
  max-height: 72px;
  margin-bottom: 0.8rem;
  object-fit: contain;
}
body.guest .login-brand .login-product {
  margin: 0;
  color: #2d8f28;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
body.guest .login-brand h1 {
  margin: 0.25rem 0 0;
  font-size: 1.75rem;
}
body.guest .login-brand p {
  margin: 0.4rem 0 0;
  color: #667269;
}
body.guest .login-footer {
  margin: 1.35rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid #dbe4dc;
  color: #667269;
  font-size: 0.75rem;
  text-align: center;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 420px));
  gap: 1.25rem;
}

.feature-card {
  min-height: 100%;
}
.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 36px rgba(31, 42, 34, 0.11);
}
.feature-card .feature-visual {
  display: inline-flex;
  width: 74px;
  height: 74px;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
  border-radius: 18px;
  background: #eaf7e9;
}
.feature-card .feature-visual img {
  width: 46px;
  height: 46px;
  object-fit: contain;
}
.feature-card h2 {
  margin-bottom: 0.65rem;
  font-size: 1.25rem;
}
.feature-card p {
  color: #667269;
}

.report .report-filter {
  overflow: visible;
  margin-bottom: 1.75rem;
  padding: 1.35rem;
  border: 1px solid #dbe4dc;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(31, 42, 34, 0.07);
  color: #1f2a22;
}
.report .filter-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid #dbe4dc;
}
.report .filter-heading h2 {
  margin: 0;
  font-size: 1.05rem;
}
.report .filter-heading p {
  margin: 0;
  color: #667269;
  font-size: 0.82rem;
}
.report .filter-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 0.6rem;
}
.report .filter-checkbox {
  display: flex;
  min-height: 44px;
  align-items: center;
}
.report #report-results {
  min-height: 40px;
}
.report #charts {
  text-align: center;
}
.report #charts > [class*=col-] > .card {
  height: calc(100% - 2rem);
}
.report #charts canvas {
  max-height: 420px;
}
.report #tables > [class*=col-] {
  min-width: 0;
}
.report #tables .report-table-card {
  height: calc(100% - 2rem);
}
.report #tables .card-body {
  min-width: 0;
}

.report-table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid #e5ebe5;
  border-radius: 8px;
  scrollbar-color: rgba(58, 170, 52, 0.65) #e9eee9;
  scrollbar-width: thin;
}
.report-table-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
.report-table-scroll::-webkit-scrollbar-track {
  border-radius: 999px;
  background: #e9eee9;
}
.report-table-scroll::-webkit-scrollbar-thumb {
  border: 2px solid #e9eee9;
  border-radius: 999px;
  background: rgba(58, 170, 52, 0.65);
}
.report-table-scroll .table {
  margin-bottom: 0;
  border: 0;
}

.report-table-card-wide .report-table-scroll {
  max-height: 430px;
  overflow: auto;
}
.report-table-card-wide thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: inset 0 -1px 0 rgba(58, 170, 52, 0.28);
}

.stock-aging-table {
  min-width: 1360px;
  table-layout: auto;
}
.stock-aging-table th,
.stock-aging-table td {
  word-break: normal;
  overflow-wrap: normal;
}
.stock-aging-table th:nth-child(1),
.stock-aging-table td:nth-child(1) {
  min-width: 125px;
}
.stock-aging-table th:nth-child(2),
.stock-aging-table td:nth-child(2) {
  min-width: 155px;
}
.stock-aging-table th:nth-child(n+3):nth-child(-n+6),
.stock-aging-table td:nth-child(n+3):nth-child(-n+6) {
  min-width: 86px;
}
.stock-aging-table th:nth-child(7),
.stock-aging-table td:nth-child(7) {
  min-width: 115px;
  white-space: nowrap;
}
.stock-aging-table th:nth-child(8),
.stock-aging-table td:nth-child(8) {
  min-width: 165px;
  white-space: nowrap;
}
.stock-aging-table th:nth-child(9),
.stock-aging-table td:nth-child(9) {
  min-width: 300px;
  white-space: normal;
}
.stock-aging-table th:nth-child(10),
.stock-aging-table td:nth-child(10) {
  min-width: 140px;
  text-align: right;
  white-space: nowrap;
}

.table {
  margin-bottom: 0;
  color: #1f2a22;
  font-size: 0.84rem;
}
.table thead th {
  border-top: 0;
  border-bottom: 2px solid rgba(58, 170, 52, 0.28);
  background: #f4fbf3;
  color: #3e4b41;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
}
.table td,
.table th {
  padding: 0.65rem 0.75rem;
  border-color: #e5ebe5;
  vertical-align: middle;
}
.table.table-striped tbody tr:nth-of-type(odd) {
  background-color: rgba(58, 170, 52, 0.035);
}

table.table-max-300 {
  max-height: 300px;
  overflow-y: auto;
}

.swal2-popup {
  border-radius: 14px !important;
  font-family: "Open Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  box-shadow: 0 14px 36px rgba(31, 42, 34, 0.11) !important;
}

.swal2-title {
  color: #1f2a22 !important;
  font-weight: 700 !important;
}

.swal2-styled.swal2-confirm {
  border-radius: 8px !important;
  background-color: #3aaa34 !important;
}

@media (max-width: 991.98px) {
  body.authenticated .app-navbar {
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    padding: 0.65rem 1rem;
  }
  body.authenticated .app-navigation {
    order: 3;
    width: 100%;
    flex-basis: 100%;
    overflow-x: auto;
  }
  body.authenticated .app-actions {
    margin-left: auto;
  }
  body.authenticated .app-main {
    padding: 1.5rem 1rem;
  }
}
@media (max-width: 575.98px) {
  body.authenticated .app-brand-copy small {
    display: none;
  }
  body.authenticated .app-actions {
    gap: 0.35rem;
  }
  body.authenticated .app-actions #language-select {
    width: 106px;
    min-width: 106px;
  }
  body.authenticated .app-actions #currency-select {
    width: 72px;
    min-width: 72px;
  }
  body.authenticated .app-navigation a {
    padding: 0.5rem 0.65rem;
    font-size: 0.83rem;
  }
  body.guest .guest-main {
    padding: 1rem;
  }
  body.guest .login-content {
    padding: 1.6rem 1.35rem 1.25rem;
  }
  .page-heading {
    display: block;
  }
  .report .report-filter {
    padding: 1rem;
  }
}
