﻿[v-cloak] {
  display: none;
}

.bg-light {
  background-color: #e9ecef !important;
}

.bg-amber {
  background-color: #ffecb3 !important;
}

.group-cell {
    font-weight: bold;
    background-color: #e9ecef!important;
}

.group-footer-cell {
    font-weight: bold;
    background-color: #69cefb!important;
}

span,
label {
  min-width: 0;
}

label {
  white-space: normal;
}

.erp-nowrap {
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
  overflow: hidden !important;
}

@media all and (min-width: 992px) {
  .dropdown-menu li {
    position: relative;
  }

  .nav-item .submenu {
    display: none;
    position: absolute;
    left: 100%;
    top: -7px;
  }

  .nav-item .submenu-left {
    right: 100%;
    left: auto;
  }

  .dropdown-menu > li:hover {
    background-color: #f1f1f1;
  }

  .dropdown-menu > li:hover > .submenu {
    display: block;
  }
}

@media (max-width: 991px) {
  .dropdown-menu .dropdown-menu {
    margin-left: 0.7rem;
    margin-right: 0.7rem;
    margin-bottom: 0.5rem;
  }
}

.dropdown-menu li:has(.submenu) > .dropdown-item::after {
  display: inline-block;
  margin-left: 0.255em;
  vertical-align: 0.255em;
  content: "";
  border-top: 0.3em solid transparent;
  border-left: 0.3em solid;
  border-bottom: 0.3em solid transparent;
  border-right: 0;
}

.navbar-nav .nav-item {
  background-color: rgb(156 163 175);
}

.navbar-nav .nav-item:first-child {
  border-top-left-radius: 0.5em;
  border-bottom-left-radius: 0.5em;
}

.navbar-nav .nav-item:last-child {
  border-top-right-radius: 0.5em;
  border-bottom-right-radius: 0.5em;
}

.navbar-nav .nav-item li:nth-of-type(odd) {
  background-color: rgba(0, 0, 0, 0.05);
}

/* selected datagrid row */
.dx-datagrid-rowsview .dx-datagrid-table .dx-row {
  cursor: pointer;
  user-select: none;
}

.dx-datagrid-rowsview .dx-datagrid-table .dx-row.selected {
  background-color: rgba(3, 169, 244, .04);
}

/* tab */
.nav-link:not(.active) {
  background-color: #f1f1f1;
}

/* list */
.dx-treeview-item-without-checkbox.dx-state-selected > .dx-treeview-item {
  background-color: inherit !important;
}

/* .dx-treeview-item.dx-state-hover {
  padding-left: 10px;
} */

li.dx-treeview-node.dx-treeview-node-is-leaf {
  padding-left: 0px;
}

li.dx-treeview-node.dx-treeview-node-is-leaf a {
  padding-left: 10px;
}

.dx-drawer-panel-content {
  height: 100vh !important;
  padding-top: var(--erp-header-height) !important;
}
.dx-drawer-panel-content .dx-treeview {
  position: sticky;
  top: var(--erp-header-height);
  padding-bottom: var(--erp-footer-height) !important;
}

.flatpickr-current-month {
  padding: 0 !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
}

.dx-cell-readonly {
  background-color: #e9e9e9 !important;
}

.dx-command-edit-with-icons {
  display: flex !important;
  flex-direction: row !important;
}

.text-material-blue {
  color: #03a9f4
}

:root {
  --erp-header-height: 56px;
  --erp-footer-height: 42px;
  --erp-sidebar-width: 250px;
  --erp-page-bg: whitesmoke;
}

html,
body {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--erp-page-bg);
}

body.dx-viewport {
  min-height: 100vh;
}

.erp-header {
  z-index: 1035;
  min-height: var(--erp-header-height);
}

.erp-shell,
#drawer,
.dx-drawer,
.dx-drawer-wrapper,
.dx-drawer-content {
  min-width: 0;
  max-width: 100%;
}

.erp-content {
  background-color: var(--erp-page-bg);
  min-height: calc(100vh - var(--erp-footer-height));
  padding-top: calc(var(--erp-header-height) + .75rem) !important;
}

.erp-main {
  min-width: 0;
  padding-bottom: calc(var(--erp-footer-height) + 18px) !important;
}

.erp-footer {
  z-index: 1030;
  min-height: var(--erp-footer-height);
}

#toolbar {
  min-width: 0;
}

#toolbar .dx-toolbar {
  min-height: 40px;
}

#toolbar .dx-toolbar-items-container {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}

#toolbar .dx-toolbar-before,
#toolbar .dx-toolbar-after {
  position: static;
  display: flex;
  align-items: center;
  min-width: 0;
}

#toolbar .dx-toolbar-before {
  flex: 0 1 auto;
}

#toolbar .dx-toolbar-after {
  flex: 1 1 auto;
  justify-content: flex-end;
  margin-left: auto;
  padding-left: .5rem;
}

#toolbar .erp-toolbar-user-item {
  margin-left: auto;
}

#toolbar .erp-toolbar-user-item .dx-toolbar-item-content {
  display: flex;
  justify-content: flex-end;
}

#toolbar .dx-toolbar-center {
  display: none;
}

#img-logo {
  max-width: min(170px, 40vw);
  object-fit: contain;
}

.erp-user-menu {
  min-width: 0;
}

.erp-user-menu .dropdown-toggle {
  max-width: min(260px, 42vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.erp-side-menu,
.dx-drawer-panel-content {
  width: var(--erp-sidebar-width) !important;
  max-width: calc(100vw - 48px);
}

#drawer.erp-drawer-closed.dx-drawer-shrink .dx-drawer-panel-content {
  flex: 0 0 0 !important;
  width: 0 !important;
  min-width: 0 !important;
  max-width: 0 !important;
  overflow: hidden !important;
}

#drawer.erp-drawer-closed.dx-drawer-shrink .dx-drawer-content {
  flex-basis: 100% !important;
}

.dx-drawer-panel-content {
  height: 100vh !important;
  padding-top: var(--erp-header-height) !important;
}

.dx-drawer-panel-content .dx-treeview {
  width: var(--erp-sidebar-width) !important;
  max-width: calc(100vw - 48px);
  height: calc(100vh - var(--erp-header-height));
  overflow-y: auto;
}

.dx-treeview-item a,
.dx-treeview-item span {
  min-width: 0;
  white-space: normal;
  line-height: 1.25;
}

.card,
.card-body,
fieldset,
form,
.row,
[class*="col-"] {
  min-width: 0;
}

form .row {
  row-gap: .5rem;
}

input,
select,
textarea,
.form-control,
.form-select,
.dx-widget {
  max-width: 100%;
}

.d-flex.flex-column > .btn[class*="col-"] {
  width: fit-content;
  min-width: 100px;
  max-width: 100%;
}

.dropdown-menu {
  max-width: min(92vw, 440px);
  overflow-x: hidden;
}

.dropdown-menu[style*="min-width"] {
  min-width: min(380px, calc(100vw - 1.5rem)) !important;
}

.modal-dialog {
  max-width: min(500px, calc(100vw - 1rem));
  margin-right: auto;
  margin-left: auto;
}

.dx-datagrid,
.dx-datagrid .dx-datagrid-headers,
.dx-datagrid .dx-datagrid-rowsview,
.dx-datagrid .dx-toolbar {
  max-width: 100%;
}

.dx-datagrid .dx-toolbar {
  overflow: visible;
}

.dx-datagrid .dx-scrollable,
.dx-datagrid .dx-scrollable-wrapper,
.dx-datagrid .dx-scrollable-container {
  min-width: 0;
}

.dx-datagrid-search-panel {
  max-width: 100%;
}

.dx-popup-wrapper .dx-overlay-content {
  max-width: calc(100vw - 16px) !important;
  max-height: calc(100vh - 16px) !important;
}

.dx-popup-content {
  min-width: 0;
  overflow: auto;
}

.erp-summary-footer {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: .75rem;
  flex-wrap: nowrap;
  min-width: 0;
}

.erp-summary-memo {
  flex: 1 1 auto;
  min-width: 0;
}

.erp-summary-table-wrap {
  flex: 0 0 500px;
  max-width: 500px;
  min-width: 0;
  overflow: visible;
}

.erp-summary-table {
  width: 500px !important;
  max-width: 100%;
  table-layout: fixed;
  border-spacing: 3px 5px;
  border-collapse: separate;
}

.erp-summary-table--compact {
  width: 360px !important;
  max-width: 100%;
}

.erp-summary-table td {
  min-width: 0;
  vertical-align: middle;
}

.erp-summary-table td:nth-child(1),
.erp-summary-table td:nth-child(3) {
  white-space: nowrap;
}

.erp-summary-table td:nth-child(2) {
  text-align: right;
}

.erp-summary-table td:nth-child(3) {
  text-align: right;
  padding-right: 2px;
}

.erp-summary-table td:nth-child(4) {
  text-align: right;
  padding-left: 2px;
  white-space: nowrap;
}

.erp-summary-table .form-control {
  min-width: 0;
}

/* Shared module heading and command layout. Keep module-specific content styling local. */
.erp-module-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem 1rem;
  margin-bottom: 1rem;
  min-width: 0;
}

.erp-module-heading {
  flex: 1 1 260px;
  min-width: 0;
}

.erp-module-title {
  margin: 0 0 .25rem;
  overflow-wrap: anywhere;
}

.erp-module-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35rem .5rem;
  min-height: 1.75rem;
  min-width: 0;
}

.erp-module-actions {
  display: flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .25rem;
  min-width: 0;
}

.erp-module-actions > .btn,
.erp-module-actions > .dropdown > .btn {
  white-space: nowrap;
}

@media (max-width: 991.98px) {
  :root {
    --erp-footer-height: 46px;
  }

  .erp-module-heading,
  .erp-module-actions {
    flex-basis: 100%;
    width: 100%;
  }

  .erp-module-actions {
    justify-content: flex-start;
  }

  .erp-main {
    padding: .75rem !important;
    padding-bottom: calc(var(--erp-footer-height) + 20px) !important;
  }

  .card-body {
    padding: .9rem;
  }

  .btn-group,
  .d-flex.flex-row {
    min-width: 0;
  }

  .btn-group:not(.erp-command-bar) {
    flex-wrap: wrap;
    gap: .25rem;
  }

  .btn-group:not(.erp-command-bar) > .btn,
  .btn-group:not(.erp-command-bar) > .dropdown > .btn {
    border-radius: .375rem !important;
  }

  .btn-group.erp-command-bar {
    flex-wrap: nowrap;
    gap: 0;
  }

  .dropdown-menu {
    max-height: min(70vh, 420px);
    overflow-y: auto;
  }

  .dx-drawer-panel-content {
    box-shadow: 0 .5rem 1.5rem rgba(15, 23, 42, .18);
  }

  #drawer.dx-drawer-overlap .dx-drawer-panel-content {
    position: fixed !important;
    top: var(--erp-header-height) !important;
    bottom: 0 !important;
    height: calc(100dvh - var(--erp-header-height)) !important;
    padding-top: 0 !important;
    overflow: hidden;
    z-index: 1034 !important;
  }

  #drawer.dx-drawer-overlap .dx-drawer-panel-content .dx-treeview {
    position: static;
    top: auto;
    height: 100%;
  }

  #drawer.dx-drawer-overlap .dx-drawer-panel-content > .dx-overlay-wrapper {
    top: 0 !important;
    left: 0 !important;
    height: 100% !important;
    transform: none !important;
  }

  #drawer.dx-drawer-overlap .dx-drawer-panel-content > .dx-overlay-wrapper > .dx-overlay-content {
    top: 0 !important;
    height: 100% !important;
    max-height: 100% !important;
  }

  .dx-datagrid .dx-toolbar-items-container {
    height: auto;
    min-height: 40px;
  }

  .dx-datagrid .dx-datagrid-group-panel .dx-group-panel-message {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dx-datagrid .dx-scrollable,
  .dx-datagrid .dx-scrollable-wrapper,
  .dx-datagrid .dx-scrollable-container,
  .dx-datagrid .dx-scrollable-content {
    touch-action: pan-x pan-y;
  }

  .dx-datagrid .dx-scrollable-wrapper,
  .dx-datagrid .dx-scrollable-container {
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .dx-datagrid .dx-scrollable-scrollbar.dx-scrollbar-horizontal {
    display: block !important;
    opacity: 1 !important;
    height: 12px;
  }

  .dx-datagrid .dx-scrollable-scrollbar.dx-scrollbar-horizontal .dx-scrollable-scroll {
    min-height: 7px;
    border-radius: 999px;
  }

  .erp-summary-footer {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    overflow-x: visible;
  }

  .erp-summary-memo {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
  }

  .erp-summary-table-wrap {
    flex: 0 1 auto;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
  }
}

@media (max-width: 575.98px) {
  :root {
    --erp-header-height: 52px;
    --erp-footer-height: 48px;
  }

  .erp-header {
    padding: .35rem .5rem !important;
  }

  .erp-main {
    padding: .5rem !important;
    padding-bottom: calc(var(--erp-footer-height) + 18px) !important;
  }

  .card {
    border-radius: .35rem;
  }

  .card-body {
    padding: .75rem;
  }

  h5 {
    font-size: 1rem;
  }

  #img-logo {
    max-width: 36vw;
    height: 34px;
  }

  .erp-user-menu .dropdown-toggle {
    max-width: 38vw;
    padding-right: .45rem;
    padding-left: .45rem;
  }

  .erp-footer .container {
    padding-right: .5rem;
    padding-left: .5rem;
  }

  .erp-footer span {
    display: block;
    white-space: normal;
    font-size: .76rem;
  }

  .dx-popup-content {
    padding: .75rem !important;
  }

  .dx-datagrid .dx-datagrid-group-panel {
    display: none;
  }

  .dx-datagrid .dx-toolbar-before,
  .dx-datagrid .dx-toolbar-after {
    float: none;
    width: 100%;
  }
}

.dx-datagrid .dx-datagrid-content .dx-row td {
    user-select: text !important;
    -webkit-user-select: text !important;
}

.dx-command-edit-with-icons {
    display: revert !important;
    flex-direction: revert !important;
}

