:root {
  --office-navy: #1a3a4a;
  --office-accent: #26b99a;
  --office-surface: #f4f7f9;
  --office-panel: #ffffff;
  --office-ink: #2a3f54;
  --office-nav-h: 52px;
}

body.office-shell {
  background: linear-gradient(160deg, #e8eef2 0%, #f7fafc 45%, #eef5f2 100%);
  color: var(--office-ink);
  min-height: 100vh;
}

/* —— Top menu (compact, icon-first like legacy) —— */
.office-navbar {
  background: #fff;
  border-bottom: 1px solid #dfe5ea;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .04);
  min-height: var(--office-nav-h);
  padding-top: 0;
  padding-bottom: 0;
}

.office-navbar-inner {
  min-height: var(--office-nav-h);
  gap: .25rem;
}

.office-brand {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .25rem .4rem .25rem 0;
  margin-right: .35rem;
  color: var(--office-navy) !important;
  text-decoration: none;
  line-height: 1;
  flex: 0 0 auto;
}

.office-brand .brand-logo {
  height: 38px;
  width: auto;
  max-width: 140px;
  object-fit: contain;
  display: block;
}

.office-brand .brand-mark {
  font-weight: 800;
  font-style: italic;
  font-size: 1.35rem;
  letter-spacing: -1px;
  background: linear-gradient(135deg, #c62828 0%, #8e0000 45%, #37474f 46%, #263238 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.office-brand .brand-text {
  font-weight: 600;
  font-size: .95rem;
  color: var(--office-navy);
}

.office-toggler {
  border: 1px solid #cfd8dc;
  padding: .25rem .5rem;
}

.office-toggler .navbar-toggler-icon {
  width: 1.1rem;
  height: 1.1rem;
}

.office-menu-scroll {
  flex: 1 1 auto;
  min-width: 0;
  overflow: visible;
}

.office-menu-search {
  flex: 0 0 auto;
  width: 200px;
  max-width: 100%;
  margin: 0 .4rem 0 .25rem;
  align-self: center;
}

.office-menu-search .select2-container {
  width: 100% !important;
}

.office-menu-search .select2-container--bootstrap-5 .select2-selection {
  min-height: 32px;
  font-size: .8125rem;
}

.office-menu-search .select2-container--bootstrap-5 .select2-selection--single {
  padding-top: .15rem;
  padding-bottom: .15rem;
}

.office-menu-search .select2-container--bootstrap-5 .select2-selection__rendered {
  line-height: 1.4;
  padding-left: .5rem;
}

.select2-container--bootstrap-5 .select2-results__group {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: #6c757d;
  padding: .4rem .65rem .15rem;
}

.office-navbar,
.office-navbar .navbar-collapse,
.office-navbar-inner {
  overflow: visible;
}

.office-menu {
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  margin: 0;
  padding: 0;
  gap: .2rem;
}

.office-menu > .nav-item {
  flex: 0 0 auto;
  margin: 0;
}

.office-menu .office-menu-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .2rem;
  padding: .35rem .35rem !important;
  color: var(--office-ink) !important;
  line-height: 1;
  white-space: nowrap;
}

.office-menu .office-menu-link:hover,
.office-menu .office-menu-link:focus,
.office-menu .nav-item.show > .office-menu-link {
  background: transparent;
  color: var(--office-accent) !important;
}

.office-menu .img-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.office-menu .menu-fa-icon {
  font-size: 1.2rem;
  line-height: 1;
  width: 26px;
  text-align: center;
  color: var(--office-navy);
}

/* Desktop: icon + tiny caret only; name lives in title= tooltip */
@media (min-width: 992px) {
  .office-menu-scroll {
    overflow: visible;
    flex: 1 1 auto;
    min-width: 0;
  }

  .office-navbar-inner {
    flex-wrap: nowrap;
    overflow: visible;
  }

  #officeNav.navbar-collapse {
    flex-wrap: nowrap !important;
    overflow: visible;
  }

  /* display:none — avoid position:absolute overlays that block clicks */
  .office-menu .menu-label,
  .office-user-nav .profile-name {
    display: none !important;
  }

  .office-menu .dropdown-toggle::after {
    margin-left: .12rem;
    vertical-align: .14em;
    border-top-width: .28em;
    border-right-width: .28em;
    border-left-width: .28em;
    opacity: .45;
  }

  .office-menu .dropdown-menu {
    z-index: 1050;
  }

  .office-user-nav {
    padding-left: .15rem;
    margin-left: .25rem !important;
  }

  .office-profile-toggle {
    padding: .25rem .4rem !important;
  }
}

.office-menu .dropdown-menu {
  border: 0;
  border-radius: .5rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  min-width: 14rem;
  max-height: min(70vh, 420px);
  overflow-y: auto;
  padding-top: .35rem;
}

.office-menu .office-menu-dropdown-search {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  border-bottom: 1px solid #eef2f5;
  margin-bottom: .25rem;
}

.office-menu .office-submenu-filter {
  font-size: .8125rem;
  min-height: 30px;
}

.office-menu .office-menu-dropdown-empty {
  list-style: none;
}

.office-menu .dropdown-item {
  font-size: .9rem;
  padding: .55rem 1rem;
  color: #3949ab;
}

.office-menu .dropdown-item:hover,
.office-menu .dropdown-item:focus {
  background: #4949b5;
  color: #fff;
}

.office-user-nav {
  flex-direction: row;
  align-items: center;
  flex: 0 0 auto;
  margin: 0;
  padding-left: 0;
}

.office-profile-toggle {
  display: inline-flex !important;
  align-items: center;
  gap: .4rem;
  padding: .25rem .45rem !important;
  background: #e8e4e4;
  border-radius: .65rem;
  color: var(--office-ink) !important;
}

.office-profile-toggle::after {
  margin-left: .2rem;
  opacity: .5;
}

.office-profile-toggle .profile-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border-radius: 50%;
}

/* Mobile / tablet collapsed: show names as titles beside icons */
@media (max-width: 991.98px) {
  .office-menu-search {
    width: 100%;
    margin: .5rem 0;
  }

  .office-menu {
    flex-direction: column;
    align-items: stretch;
    flex-wrap: wrap;
    width: 100%;
    padding: .5rem 0;
  }

  .office-menu .office-menu-link {
    justify-content: flex-start;
    padding: .55rem .75rem !important;
    border-radius: .4rem;
  }

  .office-menu .menu-label {
    display: inline;
    font-size: 1rem;
    font-weight: 600;
    color: #3949ab;
  }

  .office-menu .img-icon {
    width: 24px;
    height: 24px;
  }

  .office-menu .dropdown-menu {
    position: static !important;
    transform: none !important;
    box-shadow: none;
    border: 0;
    max-height: none;
    padding-left: 1.5rem;
    background: transparent;
  }

  .office-user-nav {
    width: 100%;
    border-top: 1px solid #e6ecef;
    padding: .75rem 0 .25rem;
  }

  .office-profile-toggle {
    width: 100%;
  }

  .office-user-nav .profile-name {
    display: inline;
    font-size: .9rem;
  }
}

.right_col {
  padding: 1.25rem 1.5rem 3rem;
  min-height: calc(100vh - 120px);
}

.x_panel {
  background: var(--office-panel);
  border-radius: .75rem;
  box-shadow: 0 8px 24px rgba(26, 58, 74, .06);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.x_title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  border-bottom: 1px solid #e6ecef;
  padding-bottom: .65rem;
  margin-bottom: .85rem;
  min-height: 2.25rem;
}

.x_title h2 {
  font-size: 1.2rem;
  margin: 0;
  font-weight: 600;
  line-height: 1.3;
  flex: 1 1 auto;
  min-width: 0;
}

.x_title > .btn,
.x_title > a.btn {
  flex: 0 0 auto;
  align-self: center;
}

/* Search / Add stay blue; Save / Update (btn-success) solid green */
.btn-primary {
  --bs-btn-bg: #0d6efd;
  --bs-btn-border-color: #0d6efd;
  --bs-btn-hover-bg: #0b5ed7;
  --bs-btn-hover-border-color: #0a58ca;
  --bs-btn-active-bg: #0a58ca;
  --bs-btn-active-border-color: #0a53be;
  --bs-btn-disabled-bg: #0d6efd;
  --bs-btn-disabled-border-color: #0d6efd;
  background-color: #0d6efd !important;
  border-color: #0d6efd !important;
}

.btn-primary:hover {
  background-color: #0b5ed7 !important;
  border-color: #0a58ca !important;
}

.btn-success {
  --bs-btn-bg: #198754;
  --bs-btn-border-color: #198754;
  --bs-btn-hover-bg: #157347;
  --bs-btn-hover-border-color: #146c43;
  --bs-btn-active-bg: #146c43;
  --bs-btn-active-border-color: #13653f;
  --bs-btn-disabled-bg: #198754;
  --bs-btn-disabled-border-color: #198754;
  background-color: #198754 !important;
  border-color: #198754 !important;
  color: #fff !important;
}

.btn-success:hover {
  background-color: #157347 !important;
  border-color: #146c43 !important;
  color: #fff !important;
}

/* Consistent solid button palette (non-icon) */
.btn-warning {
  background-color: #f0ad4e !important;
  border-color: #eea236 !important;
  color: #fff !important;
}
.btn-warning:hover {
  background-color: #ec971f !important;
  border-color: #d58512 !important;
  color: #fff !important;
}

.btn-danger {
  background-color: #d9534f !important;
  border-color: #d43f3a !important;
  color: #fff !important;
}
.btn-danger:hover {
  background-color: #c9302c !important;
  border-color: #ac2925 !important;
  color: #fff !important;
}

.btn-info {
  background-color: #5bc0de !important;
  border-color: #46b8da !important;
  color: #fff !important;
}
.btn-info:hover {
  background-color: #31b0d5 !important;
  border-color: #269abc !important;
  color: #fff !important;
}

.btn-outline-secondary {
  color: #5a6a76 !important;
  border-color: #c5ced6 !important;
  background: #fff !important;
}
.btn-outline-secondary:hover {
  color: #fff !important;
  background: #6c757d !important;
  border-color: #6c757d !important;
}

.table thead th {
  background: #f0f5f7;
  font-weight: 600;
  font-size: .85rem;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(38, 185, 154, .18), transparent 40%),
    radial-gradient(circle at 80% 0%, rgba(26, 58, 74, .2), transparent 35%),
    linear-gradient(160deg, #123040, #1a3a4a 55%, #0f2a36);
}

.login-card {
  width: min(420px, 92vw);
  background: #fff;
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
}

.login-logo {
  height: 56px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

.office-footer {
  padding: 1rem 1.5rem;
  color: #6c7a86;
  font-size: .85rem;
}

.required:after {
  content: " *";
  color: #d9534f;
  font-weight: 700;
}

/* —— Master Add/Update form standard —— */
.office-form .form-section {
  border: 1px solid #e6ecef;
  border-radius: .65rem;
  background: linear-gradient(180deg, #fbfcfd 0%, #fff 48%);
  padding: 1.1rem 1.25rem 1.25rem;
  margin-bottom: 1.15rem;
}

.office-form .form-section-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0 0 .95rem;
  padding-bottom: .55rem;
  border-bottom: 1px solid #e8eef2;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--office-navy);
}

.office-form .form-section-title i {
  color: var(--office-accent);
  font-size: .95rem;
}

.office-form .form-label {
  font-size: .82rem;
  font-weight: 600;
  color: #3d5266;
  margin-bottom: .35rem;
}

.office-form .form-control,
.office-form .form-select {
  border-color: #d5dee5;
  border-radius: .45rem;
  min-height: calc(1.5em + .8rem + 2px);
}

.office-form .form-control:focus,
.office-form .form-select:focus {
  border-color: #7ec8b8;
  box-shadow: 0 0 0 .2rem rgba(38, 185, 154, .18);
}

.office-form .form-text {
  font-size: .75rem;
  color: #7a8a97;
}

.office-form .field-validation-error,
.office-form .text-danger.field-error,
.office-form span[data-valmsg-for].field-validation-error {
  display: block;
  margin-top: .3rem;
  font-size: .78rem;
  font-weight: 500;
}

.office-form .input-validation-error,
.office-form .form-control.is-invalid,
.office-form .form-select.is-invalid,
.office-form .select2-container.is-invalid .select2-selection,
.office-form .select2-container .selection.is-invalid .select2-selection {
  border-color: #dc3545 !important;
}

/* Suppress Bootstrap green valid ticks / padding — keep validation section/summary focused */
.office-form .form-control.is-valid,
.office-form .form-select.is-valid,
.office-form .was-validated .form-control:valid,
.office-form .was-validated .form-select:valid,
.office-form.was-validated .form-control:valid,
.office-form.was-validated .form-select:valid {
  border-color: #d5dee5 !important;
  background-image: none !important;
  padding-right: .75rem !important;
  box-shadow: none;
}

.office-form .form-control.is-valid:focus,
.office-form .form-select.is-valid:focus {
  border-color: #7ec8b8 !important;
  box-shadow: 0 0 0 .2rem rgba(38, 185, 154, .18);
}

.office-form .validation-summary-errors {
  border: 1px solid #f1c0c0;
  background: #fff5f5;
  border-radius: .5rem;
  padding: .75rem 1rem;
  margin-bottom: 1rem;
  color: #a94442;
}

/* Hide summary when valid (ASP.NET adds this class). Also covers pages that
   hard-coded validation-summary-errors so both classes end up on the div. */
.validation-summary-valid,
.validation-summary-errors.validation-summary-valid,
.office-form .validation-summary-valid,
.office-form .validation-summary-errors.validation-summary-valid {
  display: none !important;
}

/* Empty / no visible messages — do not show a blank red box */
.validation-summary-errors:has(ul:empty),
.validation-summary-errors:not(:has(li)),
.office-form .validation-summary-errors:has(ul:empty),
.office-form .validation-summary-errors:not(:has(li)) {
  display: none !important;
}

.office-form .form-check-panel {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: calc(1.5em + .8rem + 2px);
  margin-top: 1.7rem;
  padding: .55rem .85rem;
  border: 1px solid #e1e8ed;
  border-radius: .45rem;
  background: #f8fafb;
}

.office-form .form-check-panel .form-check-input {
  margin-top: 0;
  float: none;
}

.office-form .form-check-panel .form-check-label {
  margin: 0;
  font-weight: 600;
  color: #3d5266;
}

.office-form .form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
  margin-top: .25rem;
  padding-top: 1rem;
  border-top: 1px solid #e6ecef;
}

.office-form .form-actions .btn {
  min-width: 7.5rem;
  font-weight: 600;
}

.office-form .form-hint-bar {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  margin-bottom: 1rem;
  padding: .7rem .9rem;
  border-radius: .5rem;
  background: #f0f7f5;
  border: 1px solid #d5ebe5;
  color: #3d5c55;
  font-size: .82rem;
}

.office-form .form-hint-bar i {
  color: var(--office-accent);
  margin-top: .15rem;
}

/* Baseline form polish for all x_panel forms (consistency) */
.x_panel form .form-label {
  font-size: .82rem;
  font-weight: 600;
  color: #3d5266;
}

.x_panel form .form-control:focus,
.x_panel form .form-select:focus {
  border-color: #7ec8b8;
  box-shadow: 0 0 0 .2rem rgba(38, 185, 154, .18);
}

.x_panel form .mt-4:has(> .btn-success),
.x_panel form .form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem;
  margin-top: 1.15rem;
  padding-top: 1rem;
  border-top: 1px solid #e6ecef;
}

/* Select2 */
.select2-container {
  width: 100% !important;
}

.select2-container--bootstrap-5 .select2-selection {
  min-height: calc(1.5em + .75rem + 2px);
}

.office-form .select2-container {
  display: block;
  width: 100% !important;
}

.office-form .select2-container--bootstrap-5 .select2-selection {
  min-height: calc(1.5em + .8rem + 2px);
  border-color: #d5dee5;
  border-radius: .45rem;
}

.office-form .select2-container--bootstrap-5 .select2-selection--single {
  display: flex;
  align-items: center;
}

.office-form .select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
  line-height: 1.5;
  padding-left: .75rem;
  padding-right: 1.75rem;
}

.office-form .select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
  height: 100%;
}

.office-form input[readonly] {
  background-color: #f4f7f9;
  cursor: not-allowed;
}

.select2-container--open .select2-dropdown {
  min-width: 220px;
  z-index: 1060;
}
