/* IHMS — ERP workspace theme */

:root {
  --ihms-ink: #15252c;
  --ihms-ink-soft: #2c4550;
  --ihms-primary: #0b6b6f;
  --ihms-primary-dark: #085456;
  --ihms-accent: #12848d;
  --ihms-mist: #e6f0f1;
  --ihms-surface: #eef2f4;
  --ihms-card: #ffffff;
  --ihms-line: #c9d5da;
  --ihms-muted: #4d646c;
  --ihms-success: #1f7a4d;
  --ihms-warning: #b7791f;
  --ihms-danger: #b42318;
  --ihms-sidebar: #14343a;
  --ihms-sidebar-deep: #0f2a2f;
  --ihms-sidebar-line: rgba(255, 255, 255, 0.1);
  --ihms-sidebar-text: #d7e6e8;
  --ihms-sidebar-muted: #9bb4b8;
  --ihms-sidebar-hover: rgba(255, 255, 255, 0.08);
  --ihms-sidebar-active: #1f9aa1;
  --ihms-sidebar-width: 272px;
  --ihms-topbar-height: 3.35rem;
  --ihms-radius: 0.45rem;
  --ihms-shadow: 0 0.2rem 0.75rem rgba(15, 42, 51, 0.07);
  --ihms-font: "Outfit", "Segoe UI", sans-serif;
  --bs-primary: #0b6b6f;
  --bs-primary-rgb: 11, 107, 111;
  --bs-link-color: #0b6b6f;
  --bs-link-hover-color: #085456;
  --bs-body-font-family: var(--ihms-font);
  --bs-body-color: var(--ihms-ink);
  --bs-border-color: var(--ihms-line);
  --bs-focus-ring-color: rgba(11, 107, 111, 0.35);
}

html {
  font-size: 15px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 15.5px;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--ihms-ink);
  font-family: var(--ihms-font);
  background: var(--ihms-surface);
}

body.erp-sidebar-lock {
  overflow: hidden;
}

body > .app-shell {
  flex: 1 0 auto;
  display: flex;
  min-width: 0;
  min-height: 100vh;
}

.app-shell--simple {
  flex-direction: column;
}

.app-shell--erp {
  flex-direction: row;
  align-items: stretch;
}

.erp-workspace {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

@media (min-width: 992px) {
  .app-main {
    padding: 1.15rem 1.35rem 2.25rem;
  }
}

/* Brand */
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none !important;
  min-width: 0;
}

.brand-mark__badge {
  display: inline-grid;
  place-items: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.45rem;
  background: linear-gradient(145deg, var(--ihms-accent), var(--ihms-primary-dark));
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.03em;
  flex: 0 0 auto;
}

.brand-mark__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.brand-mark__name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ihms-ink);
  letter-spacing: 0.02em;
}

.brand-mark__tag {
  font-size: 0.68rem;
  color: var(--ihms-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 12rem;
}

.brand-mark--compact .brand-mark__name {
  color: var(--ihms-ink);
}

/* ERP sidebar */
.erp-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1040;
  width: var(--ihms-sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--ihms-sidebar) 0%, var(--ihms-sidebar-deep) 100%);
  color: var(--ihms-sidebar-text);
  border-right: 1px solid var(--ihms-sidebar-line);
  transform: translateX(-105%);
  transition: transform 0.2s ease;
}

.app-shell--erp.is-sidebar-open .erp-sidebar {
  transform: translateX(0);
  box-shadow: 0.5rem 0 1.5rem rgba(0, 0, 0, 0.28);
}

.erp-sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1035;
  background: rgba(10, 24, 28, 0.45);
}

@media (min-width: 992px) {
  .erp-sidebar {
    position: sticky;
    transform: none;
    flex: 0 0 var(--ihms-sidebar-width);
    height: 100vh;
  }

  .app-shell--erp.is-sidebar-open .erp-sidebar {
    box-shadow: none;
  }

  .erp-sidebar-backdrop {
    display: none !important;
  }
}

.erp-sidebar__brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--ihms-sidebar-line);
  min-height: var(--ihms-topbar-height);
}

.erp-sidebar__brand .brand-mark__name {
  color: #fff;
}

.erp-sidebar__brand .brand-mark__tag {
  color: var(--ihms-sidebar-muted);
}

.erp-sidebar__close {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.15rem 0.4rem;
  border-radius: 0.35rem;
}

.erp-sidebar__close:hover {
  background: var(--ihms-sidebar-hover);
}

.erp-sidebar__scroll {
  flex: 1 1 auto;
  overflow: auto;
  padding: 0.55rem 0.55rem 1.25rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

.erp-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.erp-nav-link {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ihms-sidebar-text);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.3;
  padding: 0.48rem 0.7rem;
  border-radius: 0.4rem;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.erp-nav-link:hover,
.erp-nav-link:focus {
  background: var(--ihms-sidebar-hover);
  color: #fff;
}

.erp-nav-link.is-active {
  background: rgba(31, 154, 161, 0.28);
  color: #fff;
  font-weight: 650;
  box-shadow: inset 3px 0 0 var(--ihms-sidebar-active);
}

.erp-nav-link--child {
  font-size: 0.86rem;
  font-weight: 450;
  padding: 0.38rem 0.65rem 0.38rem 1.05rem;
  color: var(--ihms-sidebar-muted);
}

.erp-nav-link--child:hover,
.erp-nav-link--child:focus {
  color: #fff;
}

.erp-nav-link--child.is-active {
  color: #fff;
}

.erp-nav-group {
  margin-top: 0.1rem;
}

.erp-nav-group__toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: #eaf4f5;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.55rem 0.7rem 0.4rem;
  border-radius: 0.4rem;
  cursor: pointer;
}

.erp-nav-group__toggle:hover {
  background: var(--ihms-sidebar-hover);
  color: #fff;
}

.erp-nav-group__chevron {
  width: 0.45rem;
  height: 0.45rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.15s ease;
  opacity: 0.75;
  flex: 0 0 auto;
}

.erp-nav-group.is-open .erp-nav-group__chevron {
  transform: rotate(45deg);
}

.erp-nav-group__items {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.1rem 0 0.35rem;
}

.erp-nav-label {
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ihms-sidebar-muted);
  padding: 0.45rem 0.7rem 0.15rem 1.05rem;
}

.erp-nav-divider {
  height: 1px;
  margin: 0.35rem 0.7rem;
  background: var(--ihms-sidebar-line);
}

/* Top bar */
.erp-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  min-height: var(--ihms-topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.45rem 0.85rem;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--ihms-line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.erp-topbar__start,
.erp-topbar__end {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.erp-topbar__end {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.erp-topbar__title {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}

.erp-topbar__page {
  font-weight: 650;
  font-size: 1rem;
  color: var(--ihms-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.erp-topbar__context {
  font-size: 0.75rem;
  color: var(--ihms-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 16rem;
}

.erp-topbar__link {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ihms-ink-soft);
  text-decoration: none;
  padding: 0.25rem 0.35rem;
  border-radius: 0.35rem;
}

.erp-topbar__link:hover {
  color: var(--ihms-primary);
  background: var(--ihms-mist);
}

.erp-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--ihms-line);
  border-radius: 0.4rem;
  background: #fff;
  color: var(--ihms-ink);
  padding: 0;
}

.erp-menu-btn:hover {
  border-color: var(--ihms-accent);
  color: var(--ihms-primary);
}

.erp-menu-btn__bars,
.erp-menu-btn__bars::before,
.erp-menu-btn__bars::after {
  display: block;
  width: 1rem;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  position: relative;
}

.erp-menu-btn__bars::before,
.erp-menu-btn__bars::after {
  content: "";
  position: absolute;
  left: 0;
}

.erp-menu-btn__bars::before { top: -5px; }
.erp-menu-btn__bars::after { top: 5px; }

@media (min-width: 992px) {
  .erp-menu-btn {
    display: none;
  }
}

/* Typography & surfaces */
h1, .h1, h2, .h2, h3, .h3 {
  color: var(--ihms-ink);
  letter-spacing: -0.01em;
}

.h3 {
  font-weight: 650;
}

main .table {
  background: var(--ihms-card);
  border: 1px solid var(--ihms-line);
  border-radius: var(--ihms-radius);
  overflow: hidden;
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(11, 107, 111, 0.04);
  --bs-table-hover-bg: rgba(11, 107, 111, 0.07);
}

main .table > :not(caption) > * > * {
  padding: 0.5rem 0.65rem;
  border-color: #dbe4e7;
}

main .table thead th {
  background: #e4eef0;
  color: var(--ihms-ink);
  font-weight: 650;
  font-size: 0.8rem;
  border-bottom: 1px solid var(--ihms-line);
  white-space: nowrap;
}

main .card {
  border: 1px solid var(--ihms-line);
  border-radius: var(--ihms-radius);
  box-shadow: var(--ihms-shadow);
  background: var(--ihms-card);
}

main .alert {
  border-radius: var(--ihms-radius);
}

main .form-control,
main .form-select {
  border-color: var(--ihms-line);
  border-radius: 0.4rem;
  background-color: #fff;
}

main .form-control:focus,
main .form-select:focus {
  border-color: var(--ihms-accent);
  box-shadow: 0 0 0 0.18rem rgba(11, 107, 111, 0.18);
}

.btn-primary {
  --bs-btn-bg: var(--ihms-primary);
  --bs-btn-border-color: var(--ihms-primary);
  --bs-btn-hover-bg: var(--ihms-primary-dark);
  --bs-btn-hover-border-color: var(--ihms-primary-dark);
  --bs-btn-active-bg: var(--ihms-primary-dark);
  --bs-btn-active-border-color: var(--ihms-primary-dark);
  --bs-btn-disabled-bg: var(--ihms-primary);
  --bs-btn-disabled-border-color: var(--ihms-primary);
}

.btn-outline-primary {
  --bs-btn-color: var(--ihms-primary);
  --bs-btn-border-color: var(--ihms-primary);
  --bs-btn-hover-bg: var(--ihms-primary);
  --bs-btn-hover-border-color: var(--ihms-primary);
  --bs-btn-active-bg: var(--ihms-primary-dark);
  --bs-btn-active-border-color: var(--ihms-primary-dark);
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.18rem rgba(11, 107, 111, 0.22);
}

.form-check-input:checked {
  background-color: var(--ihms-primary);
  border-color: var(--ihms-primary);
}

/* Footer */
.app-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--ihms-line);
  background: #f7fafb;
  color: var(--ihms-muted);
  font-size: 0.82rem;
  padding: 0.7rem 1rem;
}

.app-footer__inner {
  max-width: 1600px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  justify-content: space-between;
  align-items: center;
}

.app-footer strong {
  color: var(--ihms-ink-soft);
  font-weight: 600;
}

/* Login */
body.page-login {
  background:
    radial-gradient(900px 420px at 12% -8%, rgba(18, 132, 141, 0.16), transparent 55%),
    radial-gradient(700px 360px at 100% 0%, rgba(11, 107, 111, 0.12), transparent 50%),
    linear-gradient(180deg, #e8f1f2 0%, var(--ihms-surface) 45%, #f5f8f9 100%);
}

body.page-login .app-main {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 2rem;
  padding-bottom: 2rem;
}

.login-panel {
  width: min(100%, 26rem);
  background: #fff;
  border: 1px solid var(--ihms-line);
  border-radius: 0.75rem;
  box-shadow: var(--ihms-shadow);
  padding: 1.75rem 1.5rem 1.5rem;
}

.login-panel__brand {
  text-align: center;
  margin-bottom: 1.25rem;
}

.login-panel__brand .brand-mark {
  justify-content: center;
  margin-bottom: 0.75rem;
}

.login-panel__title {
  font-size: clamp(1.55rem, 4vw, 1.85rem);
  font-weight: 700;
  color: var(--ihms-ink);
  margin: 0 0 0.25rem;
}

.login-panel__subtitle {
  color: var(--ihms-muted);
  font-size: 0.92rem;
  margin: 0;
}

/* Dashboard */
.dash-hero {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 1rem;
  padding: 1rem 1.1rem;
  border-radius: var(--ihms-radius);
  border: 1px solid var(--ihms-line);
  background: linear-gradient(135deg, #ffffff 0%, #eaf4f5 100%);
  box-shadow: var(--ihms-shadow);
}

.dash-hero__eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ihms-primary);
  font-weight: 700;
  margin: 0;
}

.dash-hero__title {
  font-size: clamp(1.35rem, 2.6vw, 1.7rem);
  font-weight: 700;
  margin: 0;
}

.dash-hero__meta {
  color: var(--ihms-muted);
  margin: 0;
  font-size: 0.92rem;
}

.dash-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 0.65rem;
  color: var(--ihms-ink-soft);
}

.surface-panel {
  background: var(--ihms-card);
  border: 1px solid var(--ihms-line);
  border-radius: var(--ihms-radius);
  padding: 0.95rem 1rem;
  box-shadow: var(--ihms-shadow);
  margin-bottom: 1rem;
}

.surface-panel dt {
  color: var(--ihms-muted);
  font-weight: 500;
  font-size: 0.86rem;
}

.surface-panel dd {
  font-weight: 600;
}

.quick-link-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.quick-link-grid .btn {
  font-weight: 500;
}

.notice-sidebar__img {
  max-height: 220px;
  object-fit: cover;
}

.notice-fullscreen__img {
  max-height: min(70vh, 640px);
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.notice-msg {
  border-left: 4px solid var(--bs-primary, #0d6efd);
}

/* Global floating notice dock */
.ihms-notice-dock {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 1025;
  width: min(22rem, calc(100vw - 1.5rem));
  max-height: min(70vh, 32rem);
  overflow: auto;
  background: var(--ihms-card, #fff);
  border: 1px solid var(--ihms-line, #ced4da);
  border-radius: 0.65rem;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.12);
  padding: 0.65rem 0.75rem 0.75rem;
}

.ihms-notice-dock.is-collapsed {
  max-height: none;
  overflow: hidden;
}

.ihms-notice-dock.is-collapsed .ihms-notice-dock__slides {
  display: none;
}

.ihms-notice-dock__chrome {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.ihms-notice-dock__label {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ihms-primary, #0d6efd);
}

.ihms-notice-dock__counter {
  font-size: 0.75rem;
  color: var(--ihms-muted, #6c757d);
  margin-right: auto;
}

.ihms-notice-dock__actions {
  display: flex;
  gap: 0.2rem;
}

.ihms-notice-slide__title {
  font-weight: 650;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.ihms-notice-slide__msg {
  font-size: 0.88rem;
  white-space: pre-wrap;
}

.ihms-notice-slide__img {
  display: block;
  width: 100%;
  max-height: 160px;
  object-fit: cover;
  border-radius: 0.4rem;
  margin: 0.4rem 0;
}

.ihms-notice-slide__img--lg {
  max-height: min(55vh, 480px);
  object-fit: contain;
}

.ihms-notice-slide__meta {
  font-size: 0.72rem;
}

@media (max-width: 575.98px) {
  .ihms-notice-dock {
    right: 0.5rem;
    left: 0.5rem;
    bottom: 0.5rem;
    width: auto;
  }

  .erp-topbar__context {
    display: none;
  }

  .ihms-inv-alert-badge__text {
    max-width: 8.5rem;
  }
}

.monitor-metric__label {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ihms-muted);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.monitor-metric__value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
}

.online-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 0.3rem;
  border: 1px solid var(--ihms-line);
  background: #f4f7f8;
  color: var(--ihms-ink-soft);
}

.online-badge--web {
  background: color-mix(in srgb, var(--ihms-primary) 14%, #fff);
  border-color: color-mix(in srgb, var(--ihms-primary) 35%, #fff);
  color: var(--ihms-primary-dark, var(--ihms-primary));
}

.online-badge--desktop {
  background: #eef2f6;
  color: #3d4a57;
}

.online-badge--unknown {
  background: #f7f7f7;
  color: var(--ihms-muted);
}

.online-branch-list__item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--ihms-line);
  font-size: 0.9rem;
}

.online-branch-list__item:last-child {
  border-bottom: 0;
}

.online-ago {
  font-weight: 600;
}

.monitor-advice-list {
  display: grid;
  gap: 0.55rem;
  max-height: 22rem;
  overflow: auto;
}

.monitor-advice {
  border: 1px solid var(--ihms-line);
  border-left-width: 4px;
  border-radius: 0.4rem;
  padding: 0.55rem 0.7rem;
  background: #fff;
}

.monitor-advice--critical {
  border-left-color: var(--ihms-danger);
  background: #fff5f5;
}

.monitor-advice--warning {
  border-left-color: var(--ihms-warning);
  background: #fffaf0;
}

.monitor-advice--info {
  border-left-color: var(--ihms-primary);
  background: #f7fbfc;
}

.monitor-advice__head {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.2rem;
}

.monitor-advice__sev {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.monitor-advice--critical .monitor-advice__sev { color: var(--ihms-danger); }
.monitor-advice--warning .monitor-advice__sev { color: #9a6700; }
.monitor-advice--info .monitor-advice__sev { color: var(--ihms-primary); }

.monitor-advice__area {
  font-size: 0.72rem;
  color: var(--ihms-muted);
  font-weight: 600;
}

.monitor-advice__msg {
  font-size: 0.9rem;
  font-weight: 600;
}

.monitor-advice__hint {
  font-size: 0.8rem;
  color: var(--ihms-muted);
  margin-top: 0.15rem;
}

.monitor-bar {
  margin-bottom: 0.35rem;
}

.monitor-bar__label {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.82rem;
  margin-bottom: 0.25rem;
}

.monitor-bar .progress {
  height: 0.55rem;
  background: #e6ecee;
}

.monitor-scroll-table {
  max-height: 18rem;
  overflow: auto;
  border: 1px solid var(--ihms-line);
  border-radius: 0.4rem;
}

.monitor-scroll-table .sticky-top {
  z-index: 1;
}

/* Permission settings */
.perm-matrix-wrap {
  max-height: min(70vh, 720px);
  overflow: auto;
  border: 1px solid var(--ihms-line);
  border-radius: var(--ihms-radius);
  background: var(--ihms-card);
}

.perm-matrix-wrap .sticky-top {
  z-index: 2;
  box-shadow: 0 1px 0 var(--ihms-line);
}

.perm-section td {
  background: #e6ecf8;
  color: #2d3748;
  font-weight: 700;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.perm-section__title {
  font-size: 0.92rem;
}

.perm-item td {
  vertical-align: middle;
}

/* Modals */
.modal-content {
  border: 1px solid var(--ihms-line);
  border-radius: 0.65rem;
}

.modal-header {
  background: var(--ihms-mist);
  border-bottom-color: var(--ihms-line);
}

#appPopupModal2 {
  z-index: 1065;
}

body.modal-open .modal-backdrop.show:nth-of-type(2) {
  z-index: 1060;
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.table-responsive {
  border-radius: var(--ihms-radius);
}

/* Inventory alert badge */
.ihms-inv-alert-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  text-decoration: none;
  border: 1px solid transparent;
  white-space: nowrap;
  max-width: min(20rem, 48vw);
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.ihms-inv-alert-badge__text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ihms-inv-alert-badge__dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  flex: 0 0 auto;
  background: currentColor;
}

.ihms-inv-alert-badge--ok {
  color: #1b5e20;
  background: #e8f5e8;
  border-color: #c8e6c9;
}

.ihms-inv-alert-badge--unknown,
.ihms-inv-alert-badge--snoozed {
  color: #5f6368;
  background: #f1f3f4;
  border-color: #dadce0;
}

.ihms-inv-alert-badge--warning {
  color: #5c3b00;
  background: #ffe496;
  border-color: #f0c040;
  animation: ihms-inv-alert-pulse-warn 0.98s ease-in-out infinite;
}

.ihms-inv-alert-badge--critical {
  color: #fff;
  background: #be2d28;
  border-color: #9a1f1b;
  animation: ihms-inv-alert-pulse-crit 0.48s ease-in-out infinite;
}

@keyframes ihms-inv-alert-pulse-warn {
  0%, 100% { background: #ffe496; color: #5c3b00; }
  50% { background: #fff4cc; color: #7a5200; }
}

@keyframes ihms-inv-alert-pulse-crit {
  0%, 100% { background: #be2d28; color: #fff; }
  50% { background: #fff3e0; color: #8a1f1a; }
}

.ihms-inv-alert-nav--active {
  font-weight: 650;
  color: #ffe08a !important;
}

.ihms-inv-alert-nav--critical {
  color: #ffb4b0 !important;
  animation: ihms-inv-alert-nav-flash 0.8s ease-in-out infinite;
}

@keyframes ihms-inv-alert-nav-flash {
  0%, 100% { background: transparent; }
  50% { background: rgba(190, 45, 40, 0.22); }
}

.ihms-inv-alert-dash {
  border-width: 1px;
  border-style: solid;
  border-radius: var(--ihms-radius);
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
}

.ihms-inv-alert-dash--warning {
  background: #fff8e1;
  border-color: #ffe082;
  animation: ihms-inv-alert-pulse-warn 0.98s ease-in-out infinite;
}

.ihms-inv-alert-dash--critical {
  background: #be2d28;
  border-color: #9a1f1b;
  color: #fff;
  animation: ihms-inv-alert-pulse-crit 0.48s ease-in-out infinite;
}

.ihms-inv-alert-dash--critical .btn {
  border-color: #fff;
  color: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .ihms-inv-alert-badge--warning,
  .ihms-inv-alert-badge--critical,
  .ihms-inv-alert-dash--warning,
  .ihms-inv-alert-dash--critical,
  .ihms-inv-alert-nav--critical,
  .erp-sidebar {
    animation: none;
    transition: none;
  }
}

/* Theme settings — live preview */
.theme-color-field {
  display: flex;
  gap: 0.45rem;
  align-items: center;
}

.theme-color-field .form-control-color {
  width: 2.75rem;
  height: 2.35rem;
  padding: 0.2rem;
  flex: 0 0 auto;
}

.theme-live-preview {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  min-height: 16rem;
  border: 1px solid var(--ihms-line);
  border-radius: var(--ihms-radius);
  overflow: hidden;
  background: var(--ihms-surface);
  box-shadow: var(--ihms-shadow);
}

.theme-live-preview.is-disabled {
  opacity: 0.72;
  filter: grayscale(0.15);
}

.theme-live-preview__sidebar {
  background: linear-gradient(180deg, var(--ihms-sidebar), var(--ihms-sidebar-deep));
  color: #e8f2f3;
  padding: 0.65rem 0.5rem;
}

.theme-live-preview__brand {
  display: flex;
  gap: 0.4rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.theme-live-preview__badge {
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 0.35rem;
  background: linear-gradient(145deg, var(--ihms-accent), var(--ihms-primary-dark));
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.theme-live-preview__name {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.15;
}

.theme-live-preview__tag {
  display: block;
  font-size: 0.55rem;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.2;
  max-width: 4.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.theme-live-preview__nav {
  display: grid;
  gap: 0.25rem;
  font-size: 0.68rem;
}

.theme-live-preview__nav span {
  padding: 0.28rem 0.4rem;
  border-radius: 0.3rem;
  color: rgba(255, 255, 255, 0.78);
}

.theme-live-preview__nav span.is-active {
  background: rgba(31, 154, 161, 0.28);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--ihms-sidebar-active);
}

.theme-live-preview__main {
  padding: 0.55rem;
  background: var(--ihms-surface);
}

.theme-live-preview__topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  background: #fff;
  border: 1px solid var(--ihms-line);
  border-radius: 0.35rem;
  padding: 0.4rem 0.55rem;
  margin-bottom: 0.55rem;
  font-size: 0.78rem;
}

.theme-live-preview__pill {
  font-size: 0.65rem;
  font-weight: 650;
  color: #1b5e20;
  background: #e8f5e8;
  border: 1px solid #c8e6c9;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
}

.theme-live-preview__card {
  background: #fff;
  border: 1px solid var(--ihms-line);
  border-radius: 0.4rem;
  padding: 0.7rem 0.75rem;
}

.theme-live-preview__title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
  color: var(--ihms-ink);
}

.theme-live-preview__btn {
  margin-right: 0.35rem;
}

@media (max-width: 575.98px) {
  .theme-live-preview {
    grid-template-columns: 1fr;
  }
}

.erp-sidebar__workspace {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--ihms-line);
  background: color-mix(in srgb, var(--ihms-primary) 8%, #fff);
}

.erp-sidebar__workspace-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ihms-ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.erp-sidebar__workspace-switch {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 650;
  color: var(--ihms-primary);
  text-decoration: none;
}

.erp-sidebar__workspace-switch:hover {
  text-decoration: underline;
}

/* Workspace chooser styles live in ~/css/workspace.css */
