:root {
  --erp-bg: #eef2f3;
  --erp-panel: #ffffff;
  --erp-panel-soft: #f7fafb;
  --erp-sidebar: #17324f;
  --erp-accent: #d97a29;
  --erp-accent-soft: #fff3e8;
  --erp-success: #247251;
  --erp-border: #d7e0e6;
  --erp-text: #183243;
  --erp-muted: #657786;
  --erp-shadow: 0 18px 45px rgba(17, 45, 70, 0.08);
}

html {
  font-size: 15px;
}

body.erp-body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(217, 122, 41, 0.12), transparent 22rem),
    linear-gradient(180deg, #f8fbfc 0%, var(--erp-bg) 100%);
  color: var(--erp-text);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: 280px;
  background: linear-gradient(180deg, #17324f 0%, #11283f 100%);
  color: #fff;
  padding: 1.5rem 1.1rem;
  display: flex;
  flex-direction: column;
  transition: width 0.2s ease, padding 0.2s ease;
}

.sidebar-topbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.65rem;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.6rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-copy,
.nav-section-label,
.nav-label,
.brand-subtitle,
.brand-title {
  transition: opacity 0.15s ease;
}

.brand-mark {
  width: 50px;
  height: 50px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: linear-gradient(135deg, #f3b875, var(--erp-accent));
  color: #40210a;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.brand-subtitle {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.68);
}

.sidebar-nav {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}

.sidebar-nav-main {
  display: block;
}

.sidebar-nav-bottom {
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.nav-section {
  margin: 1.25rem 0 0.55rem;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.56);
}

.nav-link {
  display: block;
  margin-bottom: 0.3rem;
  padding: 0.68rem 0.85rem;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.35;
  transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.nav-link:hover,
.nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(217, 122, 41, 0.18), rgba(255, 255, 255, 0.08));
  transform: translateX(2px);
}

.erp-combobox {
  position: relative;
  display: grid;
  gap: 0.35rem;
}

.erp-combobox-trigger {
  width: 100%;
  min-height: 38px;
  border-radius: 14px;
  border: 1px solid #ccdae4;
  background: #fff;
  color: var(--erp-text);
  padding: 0.55rem 2.4rem 0.55rem 0.9rem;
  text-align: left;
  line-height: 1.25;
  box-shadow: inset 0 1px 2px rgba(19, 42, 64, 0.03);
  position: relative;
}

.erp-combobox-trigger::after {
  content: "";
  position: absolute;
  right: 0.9rem;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid rgba(24, 50, 67, 0.6);
  transform: translateY(-30%);
}

.erp-combobox-trigger:focus {
  outline: none;
  border-color: #2f6fa0;
  box-shadow: 0 0 0 0.24rem rgba(47, 111, 160, 0.16);
}

.erp-combobox-trigger:disabled {
  background: #f2f5f7;
  color: rgba(24, 50, 67, 0.65);
}

.erp-combobox-menu {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  border: 1px solid rgba(21, 44, 66, 0.14);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(17, 45, 70, 0.18);
  padding: 0.55rem;
}

.erp-combobox-search {
  border-radius: 12px;
}

.erp-combobox-options {
  margin-top: 0.5rem;
  max-height: 260px;
  overflow: auto;
  border-radius: 12px;
  border: 1px solid rgba(21, 44, 66, 0.08);
}

.erp-combobox-option {
  width: 100%;
  display: block;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--erp-text);
  border-bottom: 1px solid rgba(21, 44, 66, 0.06);
}

.erp-combobox-option:last-child {
  border-bottom: none;
}

.erp-combobox-option[aria-selected="true"] {
  background: rgba(217, 122, 41, 0.12);
  font-weight: 600;
}

.erp-combobox-option:hover:not(:disabled) {
  background: rgba(23, 50, 79, 0.06);
}

.erp-combobox-option:disabled {
  color: rgba(24, 50, 67, 0.45);
}

.erp-combobox-native {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.page-header-block {
  display: flex;
  align-items: center;
}

.sidebar-toggle {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  border-color: rgba(243, 184, 117, 0.55);
  background: rgba(255, 255, 255, 0.14);
}

.sidebar-toggle-lines {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-toggle-lines span {
  display: block;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: #fff;
}

body.sidebar-collapsed .app-sidebar {
  width: 88px;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
}

body.sidebar-collapsed .brand-block {
  justify-content: center;
}

body.sidebar-collapsed .brand-copy,
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .nav-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
}

body.sidebar-collapsed .nav-section {
  margin-top: 0.9rem;
  display: flex;
  justify-content: center;
}

body.sidebar-collapsed .nav-link {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 44px;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

body.sidebar-collapsed .nav-link:hover,
body.sidebar-collapsed .nav-link.active {
  transform: none;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 2rem 0;
}

.page-caption {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--erp-muted);
}

.page-title {
  margin: 0.2rem 0 0;
  font-size: 1.85rem;
  font-weight: 700;
}

.header-status {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.status-pill {
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--erp-border);
  padding: 0.45rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--erp-muted);
}

.app-content {
  padding: 1.5rem 2rem 2rem;
}

.erp-alert {
  border-radius: 14px;
  border: none;
  box-shadow: var(--erp-shadow);
}

.erp-card {
  background: var(--erp-panel);
  border: 1px solid var(--erp-border);
  border-radius: 20px;
  box-shadow: var(--erp-shadow);
  padding: 1.25rem;
}

.card-topline {
  color: var(--erp-muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.55rem;
}

.page-grid {
  display: grid;
  gap: 1.25rem;
}

.stats-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: auto -30px -30px auto;
  width: 100px;
  height: 100px;
  border-radius: 999px;
  background: rgba(217, 122, 41, 0.1);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
}

.stat-label {
  color: var(--erp-muted);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-head h2,
.section-head h3 {
  margin: 0;
}

.section-subtitle {
  color: var(--erp-muted);
  margin: 0.35rem 0 0;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.action-card {
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--erp-border);
  border-radius: 18px;
  padding: 1rem;
  background: linear-gradient(180deg, #fff, var(--erp-panel-soft));
}

.action-card:hover {
  border-color: var(--erp-accent);
}

.action-card-title {
  font-weight: 700;
}

.action-card-copy {
  margin-top: 0.45rem;
  color: var(--erp-muted);
}

.erp-table-wrap {
  overflow-x: auto;
}

.erp-table-wrap--no-scroll {
  overflow-y: visible;
  max-height: none;
}

.erp-table {
  width: 100%;
  margin: 0;
}

.erp-table thead th {
  background: #f1f6f8;
  color: #31536b;
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom-width: 1px;
}

.erp-table td,
.erp-table th {
  vertical-align: middle;
  white-space: nowrap;
}

.row-index,
.row-index-head {
  width: 48px;
  text-align: center;
  color: var(--erp-muted);
}

.production-entry-page .erp-combobox-options {
  max-height: none;
  overflow: visible;
}

.production-entry-page .erp-card,
.production-entry-page .erp-card .erp-card,
.production-entry-page .erp-table-wrap,
.production-entry-page .erp-table-wrap--no-scroll {
  max-height: none;
  overflow: visible;
}

.customer-orders-page .erp-combobox-options,
.purchase-orders-page .erp-combobox-options {
  max-height: none;
  overflow: visible;
}

.customer-orders-page .erp-card,
.customer-orders-page .erp-card .erp-card,
.customer-orders-page .erp-table-wrap,
.customer-orders-page .erp-table-wrap--no-scroll,
.purchase-orders-page .erp-card,
.purchase-orders-page .erp-card .erp-card,
.purchase-orders-page .erp-table-wrap,
.purchase-orders-page .erp-table-wrap--no-scroll {
  max-height: none;
  overflow: visible;
}

.grid-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.grid-toolbar .form-control {
  min-width: 220px;
}

.grid-pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.summary-strip {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.summary-box {
  background: var(--erp-panel-soft);
  border-radius: 14px;
  border: 1px solid var(--erp-border);
  padding: 0.85rem 1rem;
}

.summary-label {
  color: var(--erp-muted);
  font-size: 0.82rem;
}

.summary-value {
  font-weight: 700;
  font-size: 1.15rem;
}

.page-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: stretch;
}

.table-row-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75rem;
}

.row-count-note {
  margin-left: 0.75rem;
  align-self: center;
  color: var(--erp-muted);
  font-weight: 600;
}

.table-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.table-stacked-lines {
  display: grid;
  gap: 0.25rem;
  min-width: 180px;
}

.inline-form {
  margin: 0;
}

.form-card {
  display: grid;
  gap: 1rem;
}

.form-header-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.how-card {
  background: linear-gradient(180deg, #fff9f3, #ffffff);
}

.example-box {
  border-radius: 14px;
  background: var(--erp-accent-soft);
  color: #6a3b13;
  padding: 0.9rem 1rem;
  font-weight: 600;
}

.badge-soft {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  background: #eef7f2;
  color: var(--erp-success);
  font-size: 0.8rem;
  font-weight: 700;
}

.list-note {
  color: var(--erp-muted);
  margin: 0;
}

.variant-head {
  margin-top: 1rem;
}

.variant-summary-value {
  font-size: 1rem;
}

.variant-row .form-select {
  min-width: 180px;
}

.legacy-import-summary {
  margin-top: 1rem;
}

.legacy-import-note {
  margin-top: 1rem;
}

.auth-body {
  padding: 0;
  background:
    radial-gradient(circle at top left, rgba(42, 89, 129, 0.2), transparent 24rem),
    radial-gradient(circle at bottom right, rgba(217, 122, 41, 0.14), transparent 24rem),
    linear-gradient(135deg, #eef3f7 0%, #f7f9fb 46%, #fbfcfd 100%);
}

.auth-shell {
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.auth-card {
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1.1fr) minmax(360px, 0.9fr);
}

.auth-insight-panel {
  position: relative;
  display: grid;
  align-content: space-between;
  gap: 2rem;
  padding: 3rem 3.25rem;
  color: #f7fbff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 28%),
    linear-gradient(135deg, #17324f 0%, #163859 42%, #214d77 100%);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.auth-insight-panel::before,
.auth-insight-panel::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
}

.auth-insight-panel::before {
  width: 22rem;
  height: 22rem;
  top: -8rem;
  right: -7rem;
  background: rgba(255, 255, 255, 0.06);
}

.auth-insight-panel::after {
  width: 16rem;
  height: 16rem;
  bottom: -5rem;
  left: -5rem;
  background: rgba(217, 122, 41, 0.16);
}

.auth-brand,
.auth-copy,
.auth-highlights,
.auth-trust-strip {
  position: relative;
  z-index: 1;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.auth-brand-mark {
  width: 62px;
  height: 62px;
  border-radius: 18px;
  box-shadow: 0 14px 30px rgba(15, 28, 45, 0.28);
}

.auth-brand-title {
  font-size: 1.32rem;
  color: #ffffff;
}

.auth-brand-subtitle {
  color: rgba(240, 246, 252, 0.72);
}

.auth-copy {
  display: grid;
  gap: 0.95rem;
  max-width: 38rem;
}

.auth-kicker {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(232, 240, 247, 0.72);
}

.auth-headline {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.auth-description {
  margin: 0;
  max-width: 34rem;
  font-size: 1.03rem;
  line-height: 1.7;
  color: rgba(234, 241, 247, 0.82);
}

.auth-highlights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.auth-highlight-card {
  min-height: 150px;
  padding: 1.2rem 1.15rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
  backdrop-filter: blur(6px);
}

.auth-highlight-title {
  margin-bottom: 0.55rem;
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
}

.auth-highlight-copy {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.6;
  color: rgba(230, 239, 247, 0.78);
}

.auth-trust-strip {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.auth-trust-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(242, 247, 251, 0.9);
  font-size: 0.84rem;
  font-weight: 600;
}

.auth-login-stage {
  display: grid;
  align-content: center;
  gap: 1.1rem;
  min-height: 100vh;
  padding: 2rem 2.5rem;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.auth-panel {
  width: 100%;
  max-width: 32rem;
  justify-self: center;
  padding: 2.4rem 2.35rem;
  border-radius: 28px;
  border: 1px solid rgba(23, 50, 79, 0.1);
  box-shadow: 0 28px 60px rgba(18, 38, 58, 0.1);
}

.auth-panel-topline {
  margin-bottom: 0.75rem;
  color: #5b7081;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-panel-title {
  margin: 0;
  font-size: 2.1rem;
  letter-spacing: -0.03em;
}

.auth-panel-subtitle {
  margin-top: 0.5rem;
}

.auth-form {
  gap: 1.2rem;
}

.auth-validation {
  margin: 0;
  border-radius: 16px;
  box-shadow: none;
}

.auth-validation:empty {
  display: none;
}

.auth-form-label {
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #28455d;
}

.auth-form-control {
  min-height: 50px;
  border-radius: 14px;
  border: 1px solid #ccdae4;
  background: #fdfefe;
  box-shadow: inset 0 1px 2px rgba(19, 42, 64, 0.03);
}

.auth-form-control:focus {
  border-color: #2f6fa0;
  box-shadow: 0 0 0 0.24rem rgba(47, 111, 160, 0.16);
}

.auth-submit-row {
  padding-top: 0.35rem;
}

.auth-submit-button {
  width: 100%;
  min-height: 50px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #1d5079 0%, #275f8d 55%, #2e6d9f 100%);
  box-shadow: 0 14px 28px rgba(31, 83, 125, 0.2);
  font-weight: 700;
  letter-spacing: 0.01em;
}

.auth-submit-button:hover,
.auth-submit-button:focus {
  background: linear-gradient(135deg, #214f75 0%, #2a638f 55%, #3376aa 100%);
}

.auth-credit {
  margin-top: 1.1rem;
  text-align: center;
  color: #5d7283;
  font-size: 0.93rem;
}

.auth-credit-label {
  margin-right: 0.35rem;
}

.auth-credit-link,
.auth-credit-url {
  color: #1f5f92;
  font-weight: 600;
  text-decoration: none;
}

.auth-credit-url {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.88rem;
  font-weight: 500;
}

.auth-credit-link:hover,
.auth-credit-link:focus,
.auth-credit-url:hover,
.auth-credit-url:focus {
  color: #17486f;
  text-decoration: underline;
}

.header-logout-form {
  margin: 0;
}

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

@media (max-width: 992px) {
  .app-shell {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    transition: none;
  }

  body.sidebar-collapsed .app-sidebar {
    width: 100%;
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }

  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .nav-section-label,
  body.sidebar-collapsed .nav-label {
    opacity: 1;
    width: auto;
    overflow: visible;
    pointer-events: auto;
  }

  body.sidebar-collapsed .nav-link {
    display: block;
    min-height: 0;
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  body.sidebar-collapsed .nav-section,
  body.sidebar-collapsed .brand-block {
    justify-content: flex-start;
  }

  .sidebar-nav-bottom {
    margin-top: 1.25rem;
    padding-top: 0;
    border-top: none;
  }

  .app-header {
    padding: 1.2rem 1rem 0;
  }

  .section-head {
    align-items: flex-start;
  }

  .page-header-block {
    width: 100%;
  }

  .app-content {
    padding: 1rem;
  }

  .auth-card {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .auth-insight-panel,
  .auth-login-stage {
    padding: 2rem 1.25rem;
    min-height: auto;
    overflow: visible;
  }

  .auth-highlights {
    grid-template-columns: 1fr;
  }

  .auth-panel {
    max-width: 100%;
  }
}

@media (max-width: 576px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .app-sidebar {
    padding: 1rem 0.8rem;
  }

  .brand-block {
    gap: 0.7rem;
  }

  .brand-title {
    font-size: 0.98rem;
  }

  .brand-subtitle {
    font-size: 0.78rem;
  }

  .page-header-block {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .section-head > .btn,
  .section-head > a.btn,
  .section-head > form,
  .page-actions > .btn,
  .page-actions > a.btn,
  .page-actions > form,
  .table-row-actions > .btn,
  .table-row-actions > a.btn,
  .table-row-actions > form,
  .table-actions > .btn,
  .table-actions > a.btn,
  .table-actions > form {
    width: 100%;
  }

  .header-status {
    width: 100%;
  }

  .status-pill {
    max-width: 100%;
    white-space: normal;
  }

  .auth-insight-panel {
    gap: 1.5rem;
    padding: 1.5rem 1rem;
  }

  .auth-login-stage {
    padding: 0 1rem 1.5rem;
  }

  .auth-panel {
    padding: 1.5rem 1.1rem;
    border-radius: 22px;
  }

  .auth-headline {
    font-size: 1.9rem;
  }
}
