:root {
  --brand: #187143;
  --brand-strong: #0f4d2f;
  --brand-soft: #eaf6ef;
  --accent: #f47b20;
  --accent-strong: #c85e0f;
  --accent-soft: #fff2e6;
  --bg: #f7f8f4;
  --surface: #ffffff;
  --surface-2: #fbfcf8;
  --surface-3: #eef3ec;
  --line: #dce4d9;
  --text: #18241f;
  --muted: #647067;
  --danger: #dc3545;
  --success: #187143;
  --shadow: 0 18px 44px rgba(24, 36, 31, .1);
  --shadow-soft: 0 10px 28px rgba(24, 36, 31, .07);
}

html,
body {
  min-height: 100%;
  background: var(--bg) !important;
  color: var(--text) !important;
  font-family: "Segoe UI", "Segoe UI Variable Text", system-ui, -apple-system, Roboto, Arial, sans-serif;
}

.app-main {
  padding: 5.35rem 1.25rem 1.75rem;
}

.app-navbar {
  min-height: 66px;
  background: linear-gradient(105deg, #f47b20 0%, #ef8a25 35%, #187143 100%) !important;
  border-bottom: 0;
  box-shadow: 0 12px 30px rgba(24, 36, 31, .18);
}

.btn-menu {
  width: 42px;
  height: 42px;
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, .38) !important;
  background: rgba(255, 255, 255, .14) !important;
  border-radius: 8px !important;
}

.btn-menu:hover {
  background: rgba(255, 255, 255, .22) !important;
}

.navbar-wordmark {
  gap: .7rem;
  min-width: 150px;
}

.navbar-wordmark-mark {
  width: 5px;
  height: 34px;
  overflow: hidden;
  color: transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
}

.navbar-wordmark-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.navbar-wordmark-copy strong {
  color: #fff;
  font-size: 1rem;
  font-weight: 650;
}

.navbar-wordmark-copy small {
  color: rgba(255, 255, 255, .82);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: 0;
}

.page-title-wrap {
  pointer-events: none;
}

.page-title {
  color: #fff;
  font-family: "Segoe UI", "Segoe UI Variable Display", system-ui, sans-serif;
  font-size: clamp(1.08rem, 1.55vw, 1.34rem);
  font-weight: 600;
  text-transform: uppercase;
}

.nav-user {
  max-width: 310px;
  padding: .54rem .76rem;
  color: #fff !important;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .35);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-navbar .btn-brand {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff !important;
  background: rgba(255, 255, 255, .14) !important;
  border: 1px solid rgba(255, 255, 255, .35) !important;
  box-shadow: none !important;
}

.app-navbar .btn-brand:hover {
  color: #4f5965 !important;
  background: #fff !important;
  border-color: #fff !important;
}

.nav-user span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-navbar .btn-outline-danger {
  color: #fff !important;
  border-color: rgba(255, 255, 255, .48) !important;
  background: rgba(255, 255, 255, .12) !important;
}

.app-navbar .btn-outline-danger:hover {
  color: #4f5965 !important;
  border-color: #fff !important;
  background: #fff !important;
}

.dropdown-menu {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.user-email-text {
  max-width: 280px;
  white-space: normal;
  word-break: break-word;
  color: var(--text);
  font-weight: 700;
}

.dropdown-item.text-danger {
  color: var(--danger) !important;
}

a {
  color: var(--brand) !important;
}

a:hover {
  color: var(--brand-strong) !important;
}

.btn {
  border-radius: 8px !important;
  font-weight: 650;
}

.btn-brand,
.btn-warning {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  color: #fff !important;
}

.btn-brand:hover,
.btn-warning:hover {
  background: var(--accent-strong) !important;
  border-color: var(--accent-strong) !important;
  color: #fff !important;
}

.btn-secondary {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  color: #fff !important;
}

.btn-outline-danger {
  color: var(--danger) !important;
  border-color: rgba(220, 53, 69, .38) !important;
  background: #fff !important;
}

.btn-outline-danger:hover,
.btn-danger {
  background: var(--danger) !important;
  border-color: var(--danger) !important;
  color: #fff !important;
}

.card,
.card.bg-dark,
.modal-content {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  box-shadow: 0 14px 34px rgba(24, 36, 31, .08);
}

.toast {
  border: 0 !important;
  border-radius: 8px !important;
  box-shadow: var(--shadow);
}

.toast.text-bg-success {
  background: var(--success) !important;
  color: #fff !important;
}

.toast.text-bg-danger {
  background: var(--danger) !important;
  color: #fff !important;
}

.toast.app-toast-neutral {
  background: var(--text) !important;
  color: #fff !important;
}

.no-shadow-card {
  box-shadow: 0 10px 26px rgba(15, 23, 42, .06) !important;
}

.card-header,
.modal-header {
  background: var(--surface-2) !important;
  color: var(--text) !important;
  border-bottom: 1px solid var(--line) !important;
  padding: .95rem 1.1rem;
}

.card-header .fw-semibold,
.card-header h4,
.modal-title {
  color: var(--text) !important;
  font-weight: 650;
}

.card-body,
.modal-body,
.modal-footer {
  background: var(--surface) !important;
  color: var(--text) !important;
}

.text-white,
.text-light {
  color: var(--text) !important;
}

.text-secondary,
.text-muted {
  color: var(--muted) !important;
}

.app-main > .row.mb-3 {
  --bs-gutter-x: 1rem;
  --bs-gutter-y: 1rem;
  align-items: stretch;
}

.control-panel,
fieldset {
  height: 100%;
  min-height: 126px;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  padding: 14px 16px !important;
  background: var(--surface) !important;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
}

.control-panel legend,
fieldset legend,
legend {
  float: none;
  width: auto;
  padding: 0;
  margin-bottom: .72rem;
  color: var(--muted) !important;
  font-size: .76rem;
  font-weight: 650;
  text-transform: uppercase;
}

.control-panel .form-check,
fieldset .form-check {
  margin-bottom: .38rem;
}

.form-control,
.form-select {
  background: #fff !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 .22rem rgba(244, 123, 32, .18) !important;
}

.form-check-input {
  background-color: #fff !important;
  border-color: #b7c0cc !important;
}

.form-check-input:checked {
  background-color: var(--accent) !important;
  border-color: var(--accent) !important;
}

.form-check-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 .2rem rgba(244, 123, 32, .18) !important;
}

.form-range::-webkit-slider-thumb {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(244, 123, 32, .16);
}

.form-range::-moz-range-thumb {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(244, 123, 32, .16);
}

.form-range::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, var(--accent-soft), #f7d6b8);
}

.form-range::-moz-range-track {
  background: linear-gradient(90deg, var(--accent-soft), #f7d6b8);
}

.form-check-label {
  color: var(--text);
}

textarea[readonly] {
  resize: none !important;
  background: var(--surface-2) !important;
  border-color: var(--line) !important;
  color: var(--text) !important;
}

.heartbeat {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
}

.heartbeat.online {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(25, 135, 84, .13);
}

.heartbeat.offline {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(220, 53, 69, .13);
}

.app-offcanvas {
  width: min(88vw, 326px) !important;
  background: #fffaf5 !important;
  border-right: 1px solid rgba(244, 123, 32, .22);
  box-shadow: 24px 0 60px rgba(160, 82, 24, .18);
}

.app-offcanvas .offcanvas-header {
  border-bottom: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  padding: 1rem 1.05rem;
}

.app-offcanvas .btn-close {
  filter: invert(1) grayscale(1) brightness(1.8);
  opacity: .9;
}

.app-offcanvas .offcanvas-title {
  color: #fff;
  font-size: 1.08rem;
  font-weight: 600;
  line-height: 1.05;
}

.menu-subtitle {
  color: rgba(255, 255, 255, .86);
  font-size: .8rem;
  line-height: 1.2;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .72rem;
  min-width: 0;
}

.sidebar-brand-logo {
  width: 62px;
  height: 50px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(123, 50, 8, .18);
}

.sidebar-brand-logo img {
  width: 52px;
  height: 42px;
  object-fit: contain;
}

.sidebar-brand-copy {
  min-width: 0;
}

.app-offcanvas .offcanvas-title i,
.app-menu i {
  color: var(--accent);
}

.app-menu {
  gap: .3rem;
}

.app-menu .list-group-item {
  display: flex;
  align-items: center;
  min-height: 45px;
  background: transparent !important;
  color: var(--text) !important;
  border: 0 !important;
  border-left: 3px solid transparent !important;
  border-radius: 8px !important;
  margin-bottom: 0;
  padding: .72rem .85rem;
  font-weight: 520;
}

.app-menu .list-group-item:hover {
  background: var(--accent-soft) !important;
}

.app-menu .list-group-item.active {
  background: var(--accent-soft) !important;
  border-left-color: var(--accent) !important;
  color: var(--accent-strong) !important;
}

.sidebar-logos {
  padding: .75rem .25rem .35rem;
}

.mixoby-logo {
  display: flex;
  justify-content: center;
  margin-bottom: .35rem;
}

.mixoby-logo img,
.logo-box img {
  display: block;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.mixoby-logo img {
  max-width: 150px;
  max-height: 58px;
  height: auto;
}

.table,
.table-dark {
  --bs-table-bg: var(--surface);
  --bs-table-striped-bg: var(--surface-2);
  --bs-table-color: var(--text);
  --bs-table-striped-color: var(--text);
  --bs-table-border-color: var(--line);
  color: var(--text) !important;
  border-color: var(--line) !important;
}

.table thead th,
.table-dark thead th {
  background: var(--surface-2) !important;
  color: var(--muted) !important;
  border-bottom-color: var(--line) !important;
  font-size: .78rem;
  font-weight: 650;
  text-transform: uppercase;
}

.pagination .page-link {
  background: var(--surface) !important;
  color: var(--brand) !important;
  border-color: var(--line) !important;
}

.pagination .page-link:hover {
  background: var(--surface-2) !important;
}

.plot-wrap {
  width: 100%;
  height: 100%;
  min-height: 300px;
  background: linear-gradient(180deg, #ffffff, #fffaf5);
  border: 1px solid rgba(244, 123, 32, .14);
  border-radius: 8px;
  box-shadow: 0 16px 32px rgba(160, 82, 24, .1);
  overflow: hidden;
}

.plot-skeleton-wrap,
.skel {
  height: 260px !important;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(90deg, #eef2f6 25%, #f8fafc 37%, #eef2f6 63%) !important;
  background-size: 400% 100% !important;
  animation: skeletonShimmer 1.35s ease-in-out infinite;
}

.plot-skeleton-wrap::before,
.skel-title,
.skel-line {
  background: rgba(104, 115, 134, .16) !important;
}

.plot-skeleton-wrap::after {
  background: rgba(104, 115, 134, .12) !important;
}

.skel {
  padding: 22px;
}

.skel-title,
.skel-line {
  display: block;
  height: 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.skel-title {
  width: 42%;
}

.skel-line.w90 {
  width: 90%;
}

.skel-line.w70 {
  width: 70%;
}

.skel-line.w50 {
  width: 50%;
}

.loading-badge {
  color: var(--muted) !important;
}

.loading-badge::before {
  border-color: rgba(104, 115, 134, .28) !important;
  border-top-color: var(--brand) !important;
}

input.ref-loading {
  color: var(--muted) !important;
}

.auth-page {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(135deg, rgba(24, 113, 67, .10) 0, rgba(24, 113, 67, 0) 32%),
    linear-gradient(315deg, rgba(244, 123, 32, .16) 0, rgba(244, 123, 32, 0) 34%),
    var(--bg) !important;
}

.auth-page::before {
  content: "";
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(56vw, 580px);
  aspect-ratio: 1408 / 2038;
  background: url("/static/iot/logo/ufms_logo_negativo_sem_caixa_rgb.f6b797a83029.png") center / contain no-repeat;
  opacity: .2;
  pointer-events: none;
  transform: translate(-50%, -47%);
}

.auth-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100svh;
  padding: 32px 16px;
}

.auth-card {
  position: relative;
  width: min(100%, 464px);
  max-width: calc(100vw - 28px);
  box-sizing: border-box;
  height: auto;
  min-height: 626px;
  overflow: visible;
  background: rgba(255, 255, 255, .46);
  backdrop-filter: blur(5px) saturate(1.1);
  border: 1px solid rgba(255, 255, 255, .58);
  border-top: 5px solid var(--accent);
  border-radius: 8px;
  box-shadow: 0 22px 54px rgba(24, 36, 31, .12);
}

.auth-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  z-index: 2;
}

.auth-card > * {
  position: relative;
  z-index: 1;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.auth-logo-main-wrap {
  width: 150px;
  height: 116px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-brand-main {
  display: block;
  width: 136px;
  height: 110px;
  max-width: 136px;
  max-height: 110px;
  margin-inline: auto;
  object-fit: contain;
  object-position: center;
}

.auth-partner-strip {
  width: 100%;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  align-items: center;
  padding: 9px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auth-logo-tile {
  height: 56px;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 7px 9px;
  background: #fff;
  border: 1px solid rgba(220, 228, 217, .8);
  border-radius: 7px;
}

.auth-logo-tile-dark {
  background: linear-gradient(135deg, #0f4d2f, #17673f);
  border-color: rgba(15, 77, 47, .52);
}

.auth-logo-tile img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 38px;
  margin: 0 auto;
  object-fit: contain;
  object-position: center;
}

.auth-title {
  color: var(--text);
  font-family: "Segoe UI", "Segoe UI Variable Display", system-ui, sans-serif;
  font-size: 1.48rem;
  font-weight: 650;
  text-transform: uppercase;
}

.auth-subtitle {
  color: var(--muted);
  font-size: .98rem;
  font-weight: 400;
}

.auth-feedback {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

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

.auth-feedback .alert {
  padding: .58rem .72rem;
  font-size: .9rem;
  line-height: 1.25;
  border-radius: 8px;
}

.auth-link {
  color: var(--accent-strong) !important;
  text-decoration: none;
  font-weight: 550;
}

.auth-link:hover {
  color: var(--accent) !important;
  text-decoration: underline;
}

.btn-soft {
  background: #fff !important;
  border-color: rgba(24, 113, 67, .42) !important;
  color: var(--brand-strong) !important;
}

.btn-soft:hover {
  background: var(--brand-soft) !important;
  border-color: var(--brand) !important;
}

@keyframes skeletonShimmer {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

@media (max-width: 768px) {
  .app-main {
    padding: 4.95rem .85rem 1.25rem;
  }

  .page-title {
    font-size: 1.08rem;
  }

  .btn-brand.me-3 {
    margin-right: .25rem !important;
  }

  .auth-partner-strip {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px;
  }

  .auth-card {
    width: min(300px, calc(100vw - 64px));
    max-width: calc(100vw - 64px);
    margin-inline: auto;
    height: auto;
    min-height: auto;
    max-height: none;
    overflow: visible;
  }

  .auth-logo-tile {
    height: 44px;
    padding: 6px 8px;
  }

  .auth-logo-tile img {
    max-height: 30px;
  }

  .auth-card .d-flex.justify-content-between {
    align-items: flex-start !important;
    flex-direction: column;
    gap: 2px;
  }

  .auth-title {
    font-size: 1.24rem;
  }

  .auth-page::before {
    width: min(102vw, 430px);
    opacity: .12;
    transform: translate(-50%, -48%);
  }
}

@media (max-height: 680px) {
  .auth-shell {
    align-items: flex-start !important;
    padding-block: 16px;
  }

  .auth-card {
    max-height: calc(100svh - 32px);
    height: auto;
    min-height: auto;
  }

  .auth-brand-main {
    width: 116px;
    height: 94px;
    max-height: 94px;
  }
}
