:root {
  --erp-sidebar-width: 232px;
  --erp-sidebar-collapsed-width: 68px;
}

body.erp-has-sidebar {
  padding-left: var(--erp-sidebar-width);
  transition: padding-left .22s ease;
}

body.erp-sidebar-initializing,
body.erp-sidebar-initializing .erp-global-sidebar {
  transition: none !important;
}

body:not(.erp-has-sidebar) .erp-global-sidebar,
body:not(.erp-has-sidebar) .erp-mobile-nav-trigger {
  visibility: hidden;
  pointer-events: none;
}

.app-shell.app-shell-no-sidebar {
  grid-template-columns: minmax(0, 1fr);
}

.erp-global-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  width: var(--erp-sidebar-width);
  overflow: visible;
  color: #53617a;
  background: #ffffff;
  border-right: 1px solid #d8e1ee;
  box-shadow: none;
  transition: width .22s ease, transform .22s ease;
}

.erp-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 104px;
  padding: 28px 24px 18px;
  overflow: hidden;
  white-space: nowrap;
}

.erp-sidebar-logo {
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  color: #fff;
  font-size: 21px;
  place-items: center;
  border-radius: 8px;
  background: #155eef;
  box-shadow: none;
}

.erp-sidebar-brand-text {
  color: #172033;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: .01em;
}

.erp-global-side-nav {
  display: grid;
  gap: 5px;
  padding: 10px 14px;
  overflow-y: auto;
}

.erp-global-side-link {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 48px;
  padding: 0 13px;
  overflow: hidden;
  color: #5d6a82;
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  border-radius: 13px;
  transition: color .16s ease, background .16s ease, transform .16s ease;
}

.erp-global-side-link i {
  flex: 0 0 22px;
  width: 22px;
  font-size: 23px;
  text-align: center;
}

.erp-global-side-link:hover {
  color: #155eef;
  background: #f4f8ff;
  transform: none;
}

.erp-global-side-link.active {
  color: #155eef;
  background: #eaf2ff;
}

.erp-global-side-link.active i { color: #155eef; }

.erp-global-side-footer {
  margin-top: auto;
  padding: 15px 14px 20px;
  border-top: 1px solid #edf0f5;
}

.erp-sidebar-toggle,
.erp-mobile-nav-trigger {
  display: inline-grid;
  width: 32px;
  height: 32px;
  padding: 0;
  color: #53617a;
  cursor: pointer;
  place-items: center;
  border: 1px solid #d8e1ee;
  border-radius: 50%;
  background: #fff;
  box-shadow: none;
}

.erp-sidebar-toggle {
  position: absolute;
  top: 50%;
  right: -16px;
  z-index: 2;
  transform: translateY(-50%);
}

.erp-sidebar-toggle:hover,
.erp-mobile-nav-trigger:hover {
  color: #155eef;
  border-color: #9abaff;
  background: #f5f8ff;
}

.erp-sidebar-backdrop,
.erp-mobile-nav-trigger { display: none; }

body.erp-sidebar-collapsed { padding-left: var(--erp-sidebar-collapsed-width); }
body.erp-sidebar-collapsed .erp-global-sidebar { width: var(--erp-sidebar-collapsed-width); }
body.erp-sidebar-collapsed .erp-sidebar-brand { padding-right: 16px; padding-left: 16px; }
body.erp-sidebar-collapsed .erp-global-side-nav,
body.erp-sidebar-collapsed .erp-global-side-footer { padding-right: 10px; padding-left: 10px; }
body.erp-sidebar-collapsed .erp-global-side-link { justify-content: center; padding: 0; }
body.erp-sidebar-collapsed .erp-global-side-link:hover { transform: none; }
body.erp-sidebar-collapsed .erp-sidebar-brand-text,
body.erp-sidebar-collapsed .erp-nav-label { display: none; }
body.erp-sidebar-collapsed .erp-sidebar-toggle i { transform: rotate(180deg); }

@media (max-width: 920px) {
  body.erp-has-sidebar,
  body.erp-sidebar-collapsed { padding-left: 0; }

  .erp-global-sidebar {
    width: min(250px, calc(100vw - 46px));
    transform: translateX(-100%);
    box-shadow: 12px 0 30px rgba(18, 31, 53, .2);
  }

  body.erp-sidebar-mobile-open { overflow: hidden; }
  body.erp-sidebar-mobile-open .erp-global-sidebar { transform: translateX(0); }
  body.erp-sidebar-mobile-open .erp-sidebar-backdrop { display: block; }

  .erp-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1190;
    background: rgba(12, 23, 43, .35);
  }

  .erp-sidebar-toggle {
    top: 50%;
    right: -43px;
    width: 34px;
    height: 34px;
  }

  .erp-mobile-nav-trigger {
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1180;
    display: inline-grid;
    width: 40px;
    height: 40px;
  }

body.erp-sidebar-mobile-open .erp-mobile-nav-trigger { display: none; }
}

/* Cached templates also load this file. Keep their page shell aligned with the process document center. */
body.erp-has-sidebar {
  background-color: #edf5ff !important;
  background-image:
    linear-gradient(rgba(135, 184, 242, .08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(135, 184, 242, .08) 1px, transparent 1px),
    radial-gradient(circle at 84% 0%, rgba(129, 178, 255, .22), transparent 30rem) !important;
  background-size: 40px 40px, 40px 40px, auto !important;
}

.topbar,
.header,
.tool-header {
  min-height: 92px;
  padding: 20px clamp(22px, 3vw, 44px) !important;
  color: #17233b !important;
  background: rgba(249, 252, 255, .96) !important;
  border-bottom: 1px solid #d8e5f6 !important;
  box-shadow: 0 5px 18px rgba(51, 91, 145, .07) !important;
}

.topbar h1,
.header h1,
.tool-header h1 {
  color: #17233b !important;
  font-size: 27px !important;
  font-weight: 800 !important;
  text-shadow: none !important;
}

.topbar .btn-home,
.topbar .btn-outline,
.tool-header .btn-home {
  color: #4b5d78 !important;
  background: #fff !important;
  border: 1px solid #d8e3f1 !important;
  box-shadow: 0 3px 10px rgba(59, 90, 132, .06);
}

.topbar .btn-primary,
.tool-header .btn-primary {
  color: #fff !important;
  background: linear-gradient(135deg, #2582f6, #155eef) !important;
  border: 1px solid #1d70f0 !important;
  box-shadow: 0 8px 18px rgba(21, 94, 239, .2);
}

.search-bar {
  width: min(calc(100% - 48px), 1540px);
  min-height: 72px;
  margin: 22px auto 0;
  padding: 14px 18px !important;
  background: rgba(255, 255, 255, .9) !important;
  border: 1px solid #d9e5f5 !important;
  border-radius: 18px !important;
  box-shadow: 0 12px 30px rgba(57, 91, 141, .08) !important;
}

.main,
.tool-main {
  width: min(100%, 1540px);
  margin: 0 auto;
  padding: 24px !important;
}

.stats-bar {
  width: min(calc(100% - 48px), 1540px);
  min-height: 76px;
  margin: 22px auto 0;
  padding: 12px 16px !important;
  background: rgba(255, 255, 255, .9) !important;
  border: 1px solid #dbe7f5 !important;
  border-radius: 18px !important;
  box-shadow: 0 12px 30px rgba(57, 91, 141, .08) !important;
}

.table-wrap {
  width: min(calc(100% - 48px), 1540px);
  margin: 22px auto 0;
  padding: 0 !important;
  overflow: hidden;
  background: rgba(255, 255, 255, .94);
  border: 1px solid #dbe7f5 !important;
  border-radius: 18px !important;
  box-shadow: 0 12px 30px rgba(57, 91, 141, .09) !important;
}

.schedule-tip {
  width: min(calc(100% - 48px), 1540px);
  margin-top: 14px !important;
  padding: 13px 16px !important;
  color: #5e7190 !important;
  background: rgba(248, 252, 255, .92) !important;
  border: 1px solid #dbe7f5 !important;
  border-radius: 14px !important;
  box-shadow: 0 10px 24px rgba(57, 91, 141, .06) !important;
}

.schedule-board {
  max-width: 1540px !important;
  padding: 18px 24px 30px !important;
}

.schedule-workspace,
.machine-col,
.product-card,
.mat-card,
.order-card,
.form-card,
.result-card,
.calc-panel,
.tool-card {
  border-color: #dbe7f5 !important;
  box-shadow: 0 12px 30px rgba(57, 91, 141, .09) !important;
}

.schedule-workspace,
.machine-col,
.product-card,
.mat-card,
.order-card,
.form-card,
.result-card,
.calc-panel,
.tool-card { background: rgba(255, 255, 255, .94) !important; }

.machine-col-header { background: linear-gradient(135deg, #2178d8, #155eef) !important; }
.schedule-category-tabs { background: #f5f9ff !important; }
.sch-card { background: #fbfdff !important; border-color: #dce7f4 !important; }

@media (max-width: 768px) {
  .topbar,
  .header,
  .tool-header { min-height: 64px; padding: 14px 16px !important; }
  .topbar h1,
  .header h1,
  .tool-header h1 { font-size: 20px !important; }
  .search-bar,
  .stats-bar,
  .schedule-tip,
  .table-wrap { width: calc(100% - 24px); margin-top: 12px; }
  .main,
  .tool-main,
  .schedule-board { padding: 12px !important; }
}
