/* =========================================================
   HatchMaster – Complete Responsive UI Stylesheet
   Final v26 – Batches Tabs & Responsive
   ========================================================= */

:root {
  --hm-bg: #ecebed;
  --hm-surface: #fbf9fc;
  --hm-surface-strong: #ffffff;
  --hm-surface-soft: #f3eff5;
  --hm-header: #b3afb8;

  --hm-text: #242329;
  --hm-muted: #79747f;
  --hm-border: #ded8e2;

  --hm-blue: #1598d5;
  --hm-blue-dark: #0b7fb8;

  --hm-orange: #ee8711;

  --hm-green: #45ad62;
  --hm-green-soft: #edf9f0;

  --hm-yellow: #f4c746;
  --hm-yellow-soft: #fff8df;

  --hm-red: #f14848;
  --hm-red-soft: #fff1f1;

  --hm-light: #f1b72b;
  --hm-light-soft: #fff7dd;

  --hm-oxygen: #40a6a1;
  --hm-oxygen-soft: #ecf8f7;

  --hm-tray: #ee9c0f;
  --hm-tray-soft: #fff8e6;

  --hm-shadow:
    0 6px 16px
    rgba(42, 36, 46, 0.11);

  --hm-shadow-soft:
    0 3px 9px
    rgba(42, 36, 46, 0.08);

  --hm-radius: 18px;
  --hm-radius-small: 13px;

  --hm-header-height: 74px;
  --hm-nav-height: 76px;

  --hm-safe-top:
    env(safe-area-inset-top, 0px);

  --hm-safe-bottom:
    env(safe-area-inset-bottom, 0px);
}


/* =========================================================
   RESET
   ========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
}


html {
  width: 100%;
  min-width: 0;
  min-height: 100%;

  background: var(--hm-bg);

  color-scheme: light;

  -webkit-text-size-adjust: 100%;
}


body {
  width: 100%;
  min-width: 0;
  min-height: 100dvh;

  margin: 0;

  overflow: hidden;

  color: var(--hm-text);
  background: var(--hm-bg);

  font-family:
    Inter,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;

  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}


button,
input,
select,
textarea {
  font: inherit;
}


button {
  cursor: pointer;

  -webkit-tap-highlight-color: transparent;
}


input,
button,
select,
.mode-btn,
.batch-tab {
  transition: 0.25s ease;
}


button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed !important;
}


img,
svg {
  display: block;
  max-width: 100%;
}


h1,
h2,
h3,
p {
  margin-top: 0;
}


.hidden {
  display: none !important;
}


.sr-only {
  position: absolute !important;

  width: 1px !important;
  height: 1px !important;

  padding: 0 !important;
  margin: -1px !important;

  overflow: hidden;

  clip: rect(0, 0, 0, 0);

  white-space: nowrap;

  border: 0;
}


.ambient {
  display: none;
}


.panel {
  background: var(--hm-surface);

  border:
    1px solid var(--hm-border);

  box-shadow:
    var(--hm-shadow);
}


/* =========================================================
   BUTTONS
   ========================================================= */

.primary-button,
.secondary-button,
.install-app-button,
.compact-back-button,
.modal-close-button,
.install-help-header button {
  appearance: none;
  border: 0;
  outline: none;
}


.primary-button {
  width: 100%;
  min-height: 56px;

  padding: 0 18px;

  border-radius: 15px;

  color: #fff;

  background:
    linear-gradient(
      180deg,
      #32afe7 0%,
      #188fcf 100%
    );

  font-weight: 900;
  letter-spacing: 0.035em;

  box-shadow:
    0 7px 16px
    rgba(21, 152, 213, 0.25);

  transition:
    transform 0.15s ease,
    filter 0.15s ease,
    opacity 0.15s ease;
}


.primary-button:active:not(:disabled) {
  transform: translateY(1px);
}


.primary-button:hover:not(:disabled) {
  filter: brightness(1.03);
}


.primary-button:disabled {
  opacity: 0.55;

  box-shadow: none;
}


.secondary-button {
  width: 100%;
  min-height: 42px;

  padding: 0 12px;

  border:
    1px solid #cec7d1;

  border-radius: 11px;

  color: var(--hm-text);
  background: #f5f2f6;

  font-weight: 800;
}


button:disabled {
  opacity: 0.55;
}


/* =========================================================
   STATUS
   ========================================================= */

.status-pill {
  display: inline-flex;

  align-items: center;
  justify-content: center;

  min-height: 36px;

  padding: 0 12px;

  border:
    1px solid currentColor;

  border-radius: 11px;

  font-size: 0.76rem;
  font-weight: 900;

  white-space: nowrap;
}


.status-pill.info {
  color: #118cc5;
  background: #eff9fd;
}


.status-pill.normal {
  color: #3b9c56;
  background: var(--hm-green-soft);
}


.status-pill.danger {
  color: #e34242;
  background: var(--hm-red-soft);
}


.status-pill.warning {
  color: #a36d00;
  background: var(--hm-yellow-soft);
}


.form-message {
  min-height: 18px;

  margin: 0;

  color: #df4545;

  font-size: 0.82rem;
  font-weight: 700;

  text-align: center;
}


.form-message.success {
  color: #32924d;
}


.eyebrow {
  margin: 0 0 5px;

  color: var(--hm-orange);

  font-size: 0.72rem;
  font-weight: 900;

  letter-spacing: 0.14em;

  text-transform: uppercase;
}


.page-heading {
  display: flex;

  align-items: flex-end;
  justify-content: space-between;

  gap: 12px;

  min-width: 0;

  margin: 0;
}


.page-heading > div {
  min-width: 0;
}


.page-heading h1 {
  margin: 0;

  color: #202026;

  font-size:
    clamp(
      1.65rem,
      7vw,
      2.25rem
    );

  line-height: 1.05;
}


/* =========================================================
   STARTUP — FULL-SCREEN SPLASH
   ========================================================= */

.startup-splash {
  position: fixed;
  inset: 0;
  z-index: 5000;

  width: 100%;
  height: 100%;
  height: 100dvh;

  display: grid;
  place-items: center;

  padding: 0;
  margin: 0;

  overflow: hidden;
  background: #eeeeef;

  opacity: 1;
  visibility: visible;

  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}


.startup-splash.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}


.startup-splash-content {
  position: relative;

  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;

  display: block;
  overflow: hidden;
}


.startup-splash-content svg {
  display: block;

  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;

  margin: 0;
}


/* Loader is now overlaid on top of the full-screen SVG. */

.startup-loader {
  position: absolute;
  left: 50%;
  bottom: max(72px, calc(var(--hm-safe-bottom) + 72px));
  transform: translateX(-50%);

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;

  z-index: 2;
}


.startup-loader span {
  width: 9px;
  height: 9px;

  border-radius: 50%;

  background: var(--hm-blue);

  animation:
    hm-loader 1.05s
    ease-in-out infinite;
}


.startup-loader span:nth-child(2) {
  animation-delay: 0.14s;
}


.startup-loader span:nth-child(3) {
  animation-delay: 0.28s;
}


.startup-splash p {
  position: absolute;
  left: 50%;
  bottom: max(40px, calc(var(--hm-safe-bottom) + 40px));
  transform: translateX(-50%);

  margin: 0;
  color: #4b5563;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;

  z-index: 2;
}


@keyframes hm-loader {

  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.42;
  }

  40% {
    transform: translateY(-7px);
    opacity: 1;
  }
}


/* =========================================================
   AUTH
   ========================================================= */

.auth-view {
  width: 100%;
  height: 100dvh;

  min-height: 0;

  display: grid;

  place-items: center;

  overflow-x: hidden;
  overflow-y: auto;

  padding:
    max(18px, var(--hm-safe-top))
    14px
    max(18px, var(--hm-safe-bottom));

  background: var(--hm-bg);
}


.auth-card {
  width: min(100%, 420px);

  margin: auto;

  padding:
    26px
    20px
    24px;

  border-radius: 28px;

  background: var(--hm-surface);
}


.auth-logo {
  width: min(100%, 300px);

  height: auto;

  margin: 0 auto 8px;

  object-fit: contain;
}


.auth-kicker {
  margin: 0 0 19px;

  color: #77727d;

  font-size: 0.72rem;
  font-weight: 900;

  letter-spacing: 0.18em;

  text-align: center;

  text-transform: uppercase;
}


.auth-tabs {
  display: none !important;
}


.auth-form {
  display: grid;

  gap: 15px;
}


.auth-form label,
.batch-form label {
  min-width: 0;

  display: grid;

  gap: 8px;
}


.auth-form label > span,
.batch-form label > span {
  color: #27252b;

  font-size: 0.8rem;
  font-weight: 900;

  letter-spacing: 0.035em;

  text-transform: uppercase;
}


input,
select {
  width: 100%;

  min-width: 0;
  min-height: 56px;

  border:
    1px solid #c9c2cd;

  border-radius: 15px;

  outline: none;

  color: var(--hm-text);
  background: #fff;

  padding: 0 15px;
}


input:focus,
select:focus {
  border-color: var(--hm-blue);

  box-shadow:
    0 0 0 3px
    rgba(21, 152, 213, 0.12);
}


input::placeholder {
  color: #aaa4ae;
}


input:disabled,
select:disabled {
  background: #ececec;

  color: #777;
}


.password-wrap {
  position: relative;

  min-width: 0;
}


.password-wrap input {
  padding-right: 68px;
}


.password-toggle {
  position: absolute;

  top: 8px;
  right: 9px;

  min-width: 50px;
  height: 40px;

  display: inline-flex;

  align-items: center;
  justify-content: center;

  padding: 0 8px;

  border: 0;

  border-radius: 8px;

  color: #1e86ba;
  background: transparent;

  font-size: 0.76rem;

  font-weight: 900;
}


.password-toggle:hover,
.password-toggle.is-visible {
  background: #edf6fb;
}


.auth-switch,
.auth-recovery-link {
  display: none !important;
}


.install-app-button {
  min-height: 52px;

  display: flex;

  align-items: center;
  justify-content: center;

  gap: 8px;

  padding: 0 14px;

  border:
    1px solid #2ea45a;

  border-radius: 15px;

  color: #278a49;

  background: #f1fbf4;

  font-weight: 900;
}


.auth-install-button {
  width: 100%;

  margin: 18px 0 0;
}


#login-form .auth-install-button {
  width: 100%;

  min-height: 50px;

  margin: 4px 0 0;

  border-radius: 14px;

  font-size: 0.82rem;
}


/* =========================================================
   APP SHELL
   ========================================================= */

.app-shell {
  width: 100%;

  height: 100dvh !important;

  min-height: 0 !important;

  display: grid !important;

  grid-template-columns:
    minmax(0, 1fr) !important;

  grid-template-rows:
    auto
    minmax(0, 1fr)
    auto !important;

  overflow: hidden !important;

  background: var(--hm-bg);
}


.topbar {
  grid-column: 1;
  grid-row: 1;

  position: relative !important;

  inset: auto !important;

  z-index: 40;

  min-width: 0;

  min-height:
    calc(
      var(--hm-header-height)
      +
      var(--hm-safe-top)
    );

  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 8px;

  padding:
    max(8px, var(--hm-safe-top))
    12px
    8px !important;

  border-bottom:
    1px solid rgba(0, 0, 0, 0.08);

  background: var(--hm-header);

  box-shadow:
    0 2px 12px
    rgba(0, 0, 0, 0.07);
}


.header-brand {
  min-width: 0;

  height: 54px;

  flex: 1 1 auto;

  display: flex;

  align-items: center;

  justify-content: flex-start;

  overflow: hidden;

  border: 0;

  padding: 0;

  background: transparent;
}


.header-brand img {
  display: block;

  max-width:
    min(
      48vw,
      245px
    ) !important;

  height: auto;

  object-fit: contain;

  object-position: left center;
}


.topbar-actions {
  min-width: 0;

  flex: 0 0 auto;

  display: flex;

  align-items: center;

  justify-content: flex-end;

  gap: 7px;
}


.realtime-status {
  min-width: 118px;

  max-width: 42vw;

  height: 42px;

  display: flex;

  align-items: center;
  justify-content: center;

  gap: 7px;

  padding: 0 11px;

  overflow: hidden;

  border:
    1px solid #ee5656;

  border-radius: 999px;

  color: #d43d3d;

  background: #fff8f8;

  font-size: 0.73rem;

  font-weight: 900;

  white-space: nowrap;
}


.realtime-status i {
  width: 9px;
  height: 9px;

  flex: 0 0 auto;

  border-radius: 50%;

  background: currentColor;
}


.realtime-status b {
  overflow: hidden;

  text-overflow: ellipsis;
}


.realtime-status.live {
  color: #31944d;

  border-color: #58b973;

  background: #f2fbf4;
}


.realtime-status.stale,
.realtime-status.connecting {
  color: #a8750d;

  border-color: #e0b33b;

  background: #fff9e8;
}


.realtime-status.offline {
  color: #dc4040;

  border-color: #ef5a5a;

  background: #fff6f6;
}


.profile-menu-wrap {
  position: relative;

  flex: 0 0 auto;
}


.header-action-button,
.profile-button {
  width: 42px;
  height: 42px;

  display: grid;

  place-items: center;

  border: 0;

  border-radius: 50%;

  color: #2d2b31;

  background: transparent;
}


.vertical-dots {
  display: block;

  transform: rotate(90deg);

  font-size: 1.58rem;

  font-weight: 900;

  line-height: 1;
}


.profile-menu {
  position: absolute;

  top: calc(100% + 9px);

  right: 0;

  z-index: 80;

  width: min(84vw, 270px);

  display: grid;

  gap: 9px;

  padding: 14px;

  border-radius: 16px;

  background: var(--hm-surface);
}


.profile-menu strong {
  font-size: 0.95rem;
}


.profile-menu small {
  margin-top: -5px;

  color: var(--hm-muted);

  font-size: 0.72rem;
}


.profile-menu-user {
  display: grid;

  gap: 4px;

  padding-bottom: 4px;
}


.profile-device-section {
  display: grid;

  gap: 3px;

  padding: 10px;

  border:
    1px solid #e1dbe4;

  border-radius: 12px;

  background: #f7f4f8;
}


.profile-menu-label {
  color: #8a838e;

  font-size: 0.62rem;

  font-weight: 900;

  letter-spacing: 0.08em;
}


#current-device-name {
  color: #108ec8;

  font-size: 0.88rem;

  font-weight: 900;
}


#current-device-type {
  margin: 0;

  color: #77717c;

  font-size: 0.66rem;

  font-weight: 700;
}


.profile-menu-action {
  min-height: 46px;

  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 8px;

  padding: 0 12px;

  border:
    1px solid #ddd7e0;

  border-radius: 12px;

  color: #29272e;

  background: #fff;

  font-size: 0.76rem;

  font-weight: 900;

  text-align: left;
}


.profile-menu-action:hover {
  border-color: #b8dced;

  background: #f4fbfe;
}


.profile-menu-arrow {
  color: #158fc9;

  font-size: 1.25rem;
}


.profile-logout-button {
  margin-top: 2px;
}


/* =========================================================
   DEVICE SWITCH
   ========================================================= */

.device-switch-panel {
  display: grid;

  gap: 9px;

  padding: 10px;

  border:
    1px solid #ddd7e1;

  border-radius: 13px;

  background: #f8f5fa;
}


.device-switch-heading {
  display: grid;

  gap: 2px;
}


.device-switch-heading strong {
  font-size: 0.78rem;
}


.device-switch-heading small {
  margin: 0;

  color: #7d7681;

  font-size: 0.64rem;

  line-height: 1.35;
}


.device-switch-list {
  display: grid;

  gap: 6px;

  max-height: 230px;

  overflow-x: hidden;
  overflow-y: auto;
}


.device-switch-option {
  width: 100%;

  min-width: 0;

  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 8px;

  padding: 9px 10px;

  border:
    1px solid #e0dae3;

  border-radius: 11px;

  color: #302d35;

  background: #fff;

  text-align: left;
}


.device-switch-option:hover {
  border-color: #b9dfef;

  background: #f3fbfe;
}


.device-switch-option.active {
  border-color: #56b2db;

  background: #edf9fd;
}


.device-switch-option-main {
  min-width: 0;

  display: grid;

  gap: 2px;
}


.device-switch-option-main strong {
  overflow: hidden;

  color: #158dc5;

  font-size: 0.76rem;

  text-overflow: ellipsis;

  white-space: nowrap;
}


.device-switch-option-main small {
  margin: 0;

  overflow: hidden;

  color: #77717b;

  font-size: 0.62rem;

  line-height: 1.25;

  text-overflow: ellipsis;

  white-space: nowrap;
}


.device-switch-check {
  width: 22px;

  height: 22px;

  flex: 0 0 auto;

  display: grid;

  place-items: center;

  border-radius: 50%;

  color: #fff;

  background: #32a65a;

  font-size: 0.72rem;

  font-weight: 900;
}


.device-switch-empty {
  padding: 10px;

  border:
    1px dashed #cbc4d0;

  border-radius: 10px;

  color: #77717d;

  background: #fff;

  font-size: 0.68rem;

  text-align: center;
}


/* =========================================================
   MAIN
   ========================================================= */

.sidebar {
  display: none !important;
}


.content {
  grid-column: 1;

  grid-row: 2;

  min-width: 0;

  min-height: 0;

  height: auto !important;

  overflow: hidden !important;

  padding:
    14px
    14px
    0 !important;

  background: var(--hm-bg);
}


.page {
  width: 100%;

  height: 100%;

  min-width: 0;

  min-height: 0;

  display: none;

  overflow: hidden;
}


.page.active-page {
  display: block;
}


.page-scroll {
  width: 100%;

  height: 100%;

  min-width: 0;

  min-height: 0;

  overflow-x: hidden;

  overflow-y: auto;

  overscroll-behavior: contain;

  scrollbar-gutter: stable;

  padding-bottom: 10px;
}


/* =========================================================
   MOBILE NAV
   ========================================================= */

.mobile-nav {
  grid-column: 1;

  grid-row: 3;

  position: relative !important;

  inset: auto !important;

  transform: none !important;

  z-index: 35;

  width: 100% !important;

  min-height:
    calc(
      var(--hm-nav-height)
      +
      var(--hm-safe-bottom)
    );

  display: grid;

  grid-template-columns:
    repeat(
      4,
      minmax(0, 1fr)
    );

  gap: 4px;

  padding:
    6px
    8px
    var(--hm-safe-bottom) !important;

  border-top:
    1px solid #e1dce4;

  background: #fff;

  box-shadow:
    0 -5px 16px
    rgba(0, 0, 0, 0.05);
}


.mobile-nav-item {
  min-width: 0;

  min-height: 62px;

  display: grid;

  place-items: center;

  align-content: center;

  gap: 5px;

  border: 0;

  border-radius: 15px;

  color: #77727d;

  background: transparent;
}


.mobile-nav-item span {
  font-size: 1.25rem;

  font-weight: 900;
}


.mobile-nav-item small {
  font-size: 0.64rem;

  font-weight: 900;
}


.mobile-nav-item.active {
  color: #168fc9;

  background: #eaf6fb;
}


/* =========================================================
   DASHBOARD
   ========================================================= */

#page-dashboard.active-page {
  display: grid;

  grid-template-rows:
    minmax(0, 1fr)
    auto;

  gap: 0;

  overflow: hidden;
}


#page-dashboard .reference-dashboard {
  width: 100%;

  height: 100%;

  min-height: 0;

  margin: 0 auto;

  display: grid;

  grid-template-columns:
    minmax(0, 1fr);

  gap: 10px;

  align-content: start;

  overflow-x: hidden;

  overflow-y: auto;

  padding: 0 0 10px;
}


.reference-metric-card,
.reference-status-card {
  min-width: 0;

  border:
    1px solid #e7e1ea;

  background: var(--hm-surface);

  box-shadow:
    var(--hm-shadow-soft);
}


.reference-metric-card {
  min-height: 170px;

  display: grid;

  grid-template-columns:
    78px
    minmax(0, 1fr);

  overflow: hidden;

  border-radius: 16px;
}


.reference-icon-column {
  min-width: 0;

  display: grid;

  place-items: center;

  padding: 10px;

  border-right:
    1px solid #e7e2e9;
}


.reference-svg {
  width: 60px;

  height: 60px;

  overflow: visible;
}


/* -------------------------
   Temperature
   ------------------------- */

.thermometer-svg {
  fill: #eff2f3;

  stroke: #929a9e;

  stroke-width: 2.1;
}


.thermometer-svg .icon-fill {
  fill: #ee2f3c;

  stroke: #ee2f3c;
}


/* -------------------------
   Humidity
   ------------------------- */

.droplet-svg {
  fill: #128fc9;

  stroke: #128fc9;

  stroke-width: 4;

  stroke-linecap: round;
}


.droplet-svg path:nth-child(2) {
  fill: none;
}


/* -------------------------
   Oxygen
   ------------------------- */

.oxygen-color {
  color: var(--hm-oxygen);
}


.oxygen-svg {
  fill: none;

  stroke: var(--hm-oxygen);

  stroke-width: 7;
}


.oxygen-svg .oxygen-inner {
  fill: var(--hm-oxygen-soft);

  stroke: var(--hm-oxygen);
}


.oxygen-card {
  border-color: #cde5e3;

  background:
    linear-gradient(
      180deg,
      #ffffff 0%,
      var(--hm-oxygen-soft) 100%
    );
}


/* -------------------------
   Tray
   ------------------------- */

.tray-color {
  color: var(--hm-tray);
}


.fan-color {
  color: var(--hm-blue);
}


.egg-tray-svg {
  width: 60px;

  height: 60px;

  fill: #d7a06f;

  stroke: #9a6d48;

  stroke-width: 2;
}


.egg-tray-svg .basket {
  fill: #bf854e;
}


.egg-tray-svg .basket-lines {
  fill: none;

  stroke: #f0c599;
}


/* -------------------------
   Metric content
   ------------------------- */

.reference-card-content {
  min-width: 0;

  align-self: center;

  padding:
    16px
    15px;

  overflow: hidden;
}


.reference-card-content h2 {
  max-width: 100%;

  margin: 0 0 8px;

  overflow: hidden;

  font-size:
    clamp(
      0.82rem,
      3.2vw,
      1.08rem
    );

  font-weight: 900;

  line-height: 1.1;

  text-overflow: ellipsis;

  white-space: nowrap;
}


.reference-card-content strong {
  display: block;

  max-width: 100%;

  margin: 0 0 7px;

  overflow: hidden;

  color: #183b8d;

  font-size:
    clamp(
      1.25rem,
      5vw,
      1.65rem
    );

  line-height: 1.1;

  text-overflow: ellipsis;

  white-space: nowrap;
}


.reference-card-content p {
  max-width: 100%;

  margin: 0;

  overflow: hidden;

  color: #333137;

  font-size:
    clamp(
      0.64rem,
      2.6vw,
      0.82rem
    );

  text-overflow: ellipsis;

  white-space: nowrap;
}


/* =========================================================
   DASHBOARD STATUS 2 × 2
   ========================================================= */

#page-dashboard .reference-status-list {
  grid-column: 1 / -1;

  min-width: 0;

  display: grid;

  grid-template-columns:
    repeat(
      2,
      minmax(0, 1fr)
    );

  gap: 11px;
}


#page-dashboard .reference-status-card {
  min-width: 0;

  min-height: 95px;

  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 8px;

  padding:
    16px
    12px;

  border-radius: 15px;
}


#page-dashboard .status-name {
  min-width: 0;

  display: flex;

  align-items: center;

  gap: 6px;
}


#page-dashboard .status-device-icon {
  width: 28px;

  flex: 0 0 auto;

  display: grid;

  place-items: center;

  font-size: 1.42rem;
}


#page-dashboard .status-name strong {
  min-width: 0;

  overflow: hidden;

  color: #29272d;

  font-size:
    clamp(
      0.64rem,
      2.5vw,
      0.82rem
    );

  font-weight: 800;

  text-overflow: ellipsis;

  white-space: nowrap;
}


#page-dashboard .reference-state-chip {
  min-width: 72px;

  min-height: 44px;

  flex: 0 0 auto;

  display: inline-flex;

  align-items: center;

  justify-content: center;

  gap: 6px;

  padding-inline: 10px;

  border:
    1px solid #51b46a;

  border-radius: 11px;

  color: #3d9d56;

  background: #f2fbf4;

  font-size: 0.74rem;

  font-weight: 900;
}


#page-dashboard .reference-state-chip i {
  width: 8px;

  height: 8px;

  flex: 0 0 auto;

  border-radius: 50%;

  background: currentColor;
}


#page-dashboard .reference-state-chip.off {
  color: #ed4545;

  border-color: #ef6262;

  background: #fff7f7;
}


#page-dashboard .tray-status-card .reference-state-chip,
#page-dashboard .tray-state {
  color: #a66f00;

  border-color: #e4be61;

  background: var(--hm-tray-soft);
}


#page-dashboard .reference-state-chip.unknown {
  border-color: #aaa4af !important;

  background: #f1eef3 !important;

  color: #6e6872 !important;
}


#page-dashboard .reference-state-chip.unknown i {
  background: #8e8793 !important;
}


.reference-last-updated {
  width: 100%;

  min-height: 44px;

  display: flex;

  align-items: center;

  justify-content: center;

  gap: 3px;

  padding: 8px 10px;

  border:
    1px solid #2d2d2d;

  border-radius:
    10px
    10px
    0
    0;

  color: #fff;

  background:
    linear-gradient(
      180deg,
      #111 0%,
      #383838 100%
    );

  font-size: 0.7rem;

  text-align: center;
}


/* =========================================================
   CONTROLS
   ========================================================= */

#page-controls.active-page {
  display: block;
}


.controls-layout {
  width: min(100%, 980px);

  margin: 0 auto;

  display: grid;

  grid-template-columns:
    minmax(0, 1fr);

  gap: 12px;

  align-content: start;
}


.simple-mode-panel {
  width: min(100%, 520px);

  justify-self: center;

  padding: 8px;

  border-radius: 15px;
}


.mode-toggle {
  display: grid;

  grid-template-columns:
    repeat(
      2,
      minmax(0, 1fr)
    );

  gap: 3px;

  width: 100%;

  padding: 3px;

  border:
    1px solid #d9d2dd;

  border-radius: 14px;

  background: #efebf1;
}


.mode-btn {
  min-width: 0;

  min-height: 44px;

  display: flex;

  align-items: center;

  justify-content: center;

  gap: 7px;

  border: 0;

  border-radius: 11px;

  background: transparent;

  color: #74707a;

  font-size: 0.84rem;

  font-weight: 900;
}


.mode-btn:hover {
  transform: translateY(-1px);
}


.mode-btn.active:first-child {
  color: #fff;

  background: var(--hm-green);

  box-shadow:
    var(--hm-shadow-soft);
}


.mode-btn.active:last-child {
  color: #5c4b10;

  background: var(--hm-yellow);

  box-shadow:
    var(--hm-shadow-soft);
}


/* =========================================================
   AUTO / MANUAL VISIBILITY
   ========================================================= */

#autoControls {
  display: grid;

  gap: 14px;
}


#manualControls {
  display: grid;

  gap: 14px;
}


body.hm-mode-auto #autoControls {
  display: grid;
}


body.hm-mode-auto #manualControls {
  display: none !important;
}


body.hm-mode-manual #autoControls {
  display: none !important;
}


body.hm-mode-manual #manualControls {
  display: grid !important;
}


#autoControls.hidden {
  display: none !important;
}


#manualControls.hidden {
  display: none !important;
}


/* =========================================================
   CONTROL PANELS
   ========================================================= */

.simple-control-panel {
  min-width: 0;

  display: grid;

  gap: 12px;

  padding: 14px;

  border-radius: 15px;

  border:
    1px solid #e7e1ea;

  background: var(--hm-surface);

  box-shadow:
    var(--hm-shadow-soft);
}


.simple-panel-heading {
  display: flex;

  align-items: flex-start;

  justify-content: space-between;

  gap: 10px;
}


.simple-panel-heading h2 {
  margin:
    0
    0
    2px;

  color: #25242a;

  font-size: 1.08rem;

  font-weight: 900;
}


.simple-panel-heading small,
.simple-panel-heading p {
  display: block;

  margin: 0;

  color: var(--hm-muted);

  font-size: 0.74rem;
}


/* =========================================================
   AUTO SETPOINTS
   ========================================================= */

.simple-setpoint-grid {
  min-width: 0;

  display: grid !important;

  grid-template-columns:
    repeat(
      2,
      minmax(0, 1fr)
    ) !important;

  gap: 12px !important;
}


.simple-setpoint-card {
  min-width: 0;

  display: grid;

  grid-template-columns:
    42px
    minmax(0, 1fr);

  align-items: center;

  gap: 9px;

  padding: 11px;

  border:
    1px solid #ddd7e0;

  border-radius: 15px;

  background: #fff;
}


.simple-setpoint-icon {
  width: 38px;

  height: 38px;

  display: grid;

  place-items: center;

  border-radius: 50%;

  background: #f2eef4;

  font-size: 1rem;
}


.simple-setpoint-card > span:last-child {
  min-width: 0;

  display: grid;

  gap: 4px;
}


.simple-setpoint-card small {
  overflow: hidden;

  color: #736e77;

  font-size: 0.72rem;

  text-overflow: ellipsis;

  white-space: nowrap;
}


.simple-input-line {
  min-width: 0;

  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    auto;

  align-items: center;

  gap: 5px;
}


.simple-input-line input {
  min-height: 49px;

  width: 100%;

  padding: 0 7px;

  border-radius: 12px;

  font-size: 1rem;

  font-weight: 900;

  text-align: center;
}


.simple-input-line strong {
  font-size: 0.82rem;
}


.simple-apply-button {
  min-height: 56px;
}


#apply-setpoints:disabled {
  background: #9fb9c8;

  box-shadow: none;
}


/* =========================================================
   CONTROLS EQUIPMENT
   ========================================================= */

#page-controls .simple-equipment-grid {
  width: 100%;

  display: grid !important;

  grid-template-columns:
    minmax(0, 1fr) !important;

  gap: 12px !important;
}


#page-controls .simple-equipment-card {
  width: 100%;

  min-width: 0;

  min-height: 90px !important;

  display: flex;

  flex-direction: row;

  align-items: center;

  justify-content: space-between;

  gap: 14px;

  padding:
    14px
    16px;

  border:
    1px solid #ddd7e0;

  border-radius: 16px;

  background: #fff;

  box-shadow: none;
}


#page-controls .heater-equipment,
#page-controls .humidifier-equipment {
  display: none !important;
}


.light-full-row,
.tray-full-row {
  width: 100% !important;

  grid-column: 1 / -1 !important;

  min-height: 90px !important;

  display: flex !important;

  flex-direction: row !important;

  align-items: center !important;

  justify-content: space-between !important;

  gap: 14px !important;
}


.simple-equipment-name {
  min-width: 0;

  display: flex;

  align-items: center;

  gap: 10px;
}


.equipment-icon {
  width: 34px;

  height: 34px;

  flex: 0 0 auto;

  display: grid;

  place-items: center;

  font-size: 1.25rem;
}


.simple-equipment-name > span:last-child {
  min-width: 0;

  display: grid;

  gap: 1px;
}


.simple-equipment-name small {
  overflow: hidden;

  color: #88828c;

  font-size: 0.67rem;

  letter-spacing: 0.04em;

  text-overflow: ellipsis;

  white-space: nowrap;
}


.simple-equipment-name strong {
  overflow: hidden;

  color: #27262c;

  font-size: 0.98rem;

  text-overflow: ellipsis;

  white-space: nowrap;
}


.simple-equipment-action {
  min-width: 0;

  display: flex;

  align-items: center;

  justify-content: flex-end;

  gap: 10px;

  margin-top: 0;
}


.simple-equipment-action b {
  min-width: 30px;

  color: #e44747;

  font-size: 0.76rem;

  font-weight: 900;

  text-align: right;
}


.simple-equipment-action b.equipment-on {
  color: #379a53;
}


.simple-equipment-action b.equipment-off {
  color: #e44747;
}


.light-equipment {
  border-color:
    #efd98b !important;

  background:
    #fffdf4 !important;
}


.tray-equipment {
  border-color:
    #e8d29b !important;

  background:
    #fffdf7 !important;
}


#page-controls .tray-equipment .simple-equipment-action {
  width: min(180px, 44%);

  flex: 0 0 auto;
}


#page-controls .tray-equipment select,
#page-controls #trayPos {
  width: 100%;

  min-width: 130px;

  min-height: 44px;

  padding: 0 12px;

  border:
    1px solid #d8d2da;

  border-radius: 11px;

  color: #353139;

  background: #fff;

  font-size: 0.82rem;

  font-weight: 800;
}


#page-controls #trayPos:disabled {
  color: #88828c;

  background: #f1eef2;
}


/* =========================================================
   TOGGLE
   ========================================================= */

.switch {
  position: relative;

  width: 60px;

  height: 34px;

  flex: 0 0 auto;
}


.switch input {
  position: absolute;

  opacity: 0;

  width: 0;

  height: 0;
}


.slider {
  position: absolute;

  inset: 0;

  border:
    1px solid #cac5ce;

  border-radius: 999px;

  background: #d5d2d8;
}


.slider::before {
  content: "";

  position: absolute;

  top: 3px;

  left: 3px;

  width: 26px;

  height: 26px;

  border-radius: 50%;

  background: #e8f3f9;

  box-shadow:
    0 2px 6px
    rgba(0, 0, 0, 0.16);
}


.switch input:checked + .slider {
  border-color: #49ab63;

  background: #55b66d;
}


.switch input:checked + .slider::before {
  transform: translateX(26px);

  background: #fff;
}


.switch input:disabled + .slider {
  opacity: 0.45;
}


/* =========================================================
   ALARMS
   ========================================================= */

.alarms-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}


.simple-page-heading {
  padding: 2px 1px;
}


.simple-alarm-help {
  min-height: 70px;

  display: flex;

  align-items: center;

  gap: 12px;

  padding: 12px;

  border-radius: 17px;

  margin-bottom: 0;
}


.simple-help-icon {
  width: 45px;

  height: 45px;

  flex: 0 0 auto;

  display: grid;

  place-items: center;

  border-radius: 50%;

  color: #fff;

  background: #ef4b4b;

  font-size: 1.25rem;

  font-weight: 900;
}


.simple-alarm-help > div {
  min-width: 0;

  display: grid;

  gap: 3px;
}


.simple-alarm-help strong {
  font-size: 0.9rem;
}


.simple-alarm-help small {
  color: var(--hm-muted);

  font-size: 0.72rem;
}


.alarm-list,
.simple-alarm-list {
  min-width: 0;

  display: grid;

  gap: 20px;
}


.simple-alarm-card {
  min-width: 0;

  display: grid;

  grid-template-columns:
    46px
    minmax(0, 1fr);

  align-items: start;

  gap: 24px;

  padding: 13px;

  border:
    1px solid #ddd7e0;

  border-left:
    5px solid #ef4b4b;

  border-radius: 15px;

  background: #fff;

  box-shadow:
    var(--hm-shadow-soft);
}


.simple-alarm-card.acknowledged {
  border-left-color: #e2aa2d;

  background: #fffdf6;
}


.simple-alarm-icon {
  width: 42px;

  height: 42px;

  display: grid;

  place-items: center;

  border-radius: 50%;

  color: #d83939;

  background: #ffeded;

  font-size: 1.1rem;

  font-weight: 900;
}


.simple-alarm-card.acknowledged
.simple-alarm-icon {
  color: #986d0b;

  background: #fff5cf;
}


.simple-alarm-content {
  min-width: 0;

  display: grid;

  gap: 5px;
}


.simple-alarm-title-row {
  min-width: 0;

  display: flex;

  align-items: flex-start;

  justify-content: space-between;

  gap: 8px;
}


.simple-alarm-title-row h3 {
  min-width: 0;

  margin: 0;

  overflow: hidden;

  font-size: 0.9rem;

  text-overflow: ellipsis;
}


.simple-alarm-status {
  flex: 0 0 auto;

  padding: 4px 7px;

  border-radius: 8px;

  color: #cd3434;

  background: #ffe9e9;

  font-size: 0.58rem;

  font-weight: 900;
}


.simple-alarm-status.acknowledged {
  color: #976d08;

  background: #fff3c6;
}


.simple-alarm-content p {
  margin: 0;

  color: #68636d;

  font-size: 0.72rem;

  line-height: 1.4;
}


.simple-alarm-details {
  display: flex;

  flex-wrap: wrap;

  justify-content: space-between;

  gap: 8px;

  color: #7b7680;

  font-size: 0.64rem;
}


.simple-alarm-actions {
  display: flex;

  flex-wrap: wrap;

  gap: 7px;

  margin-top: 7px;
}


.simple-alarm-actions button {
  min-height: 34px;

  border:
    1px solid #c8c1cd;

  border-radius: 9px;

  background: #fff;

  color: #343139;

  padding: 0 11px;

  font-size: 0.62rem;

  font-weight: 900;
}


.simple-alarm-actions button[data-acknowledge-alarm] {
  color: #986d08;

  border-color: #e5c36a;

  background: #fff9e8;
}


.simple-alarm-actions button[data-clear-alarm] {
  color: #c73939;

  border-color: #e8aaaa;

  background: #fff7f7;
}


.simple-alarm-empty,
.empty-state {
  min-height: 175px;

  display: grid;

  place-items: center;

  align-content: center;

  gap: 10px;

  padding: 24px;

  border:
    1px dashed #cbc5ce;

  border-radius: 17px;

  color: #66616a;

  text-align: center;
}


/* =========================================================
   BATCHES
   ========================================================= */

#page-batches {
  width: min(100%, 980px);

  margin: 0 auto;

  display: grid;

  grid-template-columns:
    minmax(0, 1fr);

  grid-template-rows:
    auto
    minmax(0, 1fr)
    auto;

  gap: 12px;

  padding-bottom: 10px;
}


#page-batches.active-page {
  display: grid;
}


.batches-page-heading {
  padding: 2px 1px;
}


/* =========================================================
   BATCH SCROLL AREA
   ========================================================= */

#page-batches .batches-scroll-area {
  min-width: 0;

  min-height: 0;

  overflow-x: hidden;

  overflow-y: auto;

  overscroll-behavior: contain;

  padding-bottom: 6px;
}


/* =========================================================
   BATCH SECTION
   ========================================================= */

.batch-section {
  width: 100%;

  min-width: 0;

  display: grid;

  gap: 10px;
}


.batch-section.hidden {
  display: none !important;
}


.batch-section-heading {
  min-width: 0;

  display: flex;

  align-items: center;

  justify-content: space-between;

  gap: 10px;

  padding:
    2px
    1px;
}


.batch-section-heading h2 {
  margin: 0;

  color: #28262c;

  font-size: 1rem;

  font-weight: 900;
}


.batch-section-heading .status-pill {
  min-width: 34px;

  min-height: 30px;

  padding-inline: 9px;

  font-size: 0.68rem;
}


/* =========================================================
   BATCH LIST
   ========================================================= */

.batch-list,
.batches-page-list {
  min-width: 0;

  display: grid;

  gap: 12px;
}


.batch-card {
  min-width: 0;

  padding: 15px;

  border:
    1px solid #dfd9e2;

  border-radius: 18px;

  background: var(--hm-surface);

  box-shadow:
    var(--hm-shadow);
}


.batch-card.running {
  border-left:
    5px solid var(--hm-green);
}


.batch-card.completed {
  border-left:
    5px solid #a6a0aa;

  background: #f8f6f9;
}


.batch-card-top {
  min-width: 0;

  display: flex;

  align-items: flex-start;

  justify-content: space-between;

  gap: 10px;
}


.batch-card-top > div {
  min-width: 0;
}


.batch-card h3 {
  margin:
    0
    0
    5px;

  overflow: hidden;

  font-size: 1.05rem;

  text-overflow: ellipsis;

  white-space: nowrap;
}


.batch-card p {
  margin: 0;

  color: var(--hm-muted);

  font-size: 0.72rem;
}


.batch-stats {
  display: grid;

  grid-template-columns:
    repeat(
      3,
      minmax(0, 1fr)
    );

  gap: 8px;

  margin-top: 13px;

  padding-top: 12px;

  border-top:
    1px solid #e4dfe6;
}


.batch-stats div {
  min-width: 0;

  display: grid;

  gap: 4px;
}


.batch-stats span {
  overflow: hidden;

  color: #82919b;

  font-size: 0.61rem;

  text-overflow: ellipsis;

  white-space: nowrap;
}


.batch-stats strong {
  overflow: hidden;

  font-size: 0.84rem;

  text-overflow: ellipsis;

  white-space: nowrap;
}


.batch-duration {
  margin-top: 10px;

  color: var(--hm-muted);

  font-size: 0.64rem;

  line-height: 1.4;
}


.batch-empty {
  min-height: 130px;

  display: grid;

  place-items: center;

  padding: 20px;

  border:
    1px dashed #cbc5ce;

  border-radius: 14px;

  color: #716b75;

  background: #faf8fb;

  text-align: center;

  font-size: 0.75rem;
}


#page-batches .add-batch-button {
  height: 52px !important;

  max-height: 52px !important;

  width: 100% !important;

  margin:
    10px
    0 !important;
}


/* =========================================================
   CREATE BATCH
   ========================================================= */

.compact-back-button {
  min-height: 38px;

  padding: 0 12px;

  border:
    1px solid #b9b1bd;

  border-radius: 10px;

  color: #56515b;

  background: #f7f4f8;

  font-size: 0.72rem;

  font-weight: 900;
}


.batch-form {

  margin-top: 40px;

  min-width: 0;

  display: grid;

  gap: 15px;

  padding: 16px;

  border-radius:
    var(--hm-radius);
}


.trolley-quantity-fields {
  display: grid;

  gap: 12px;
}


.trolley-entry {
  display: grid;

  gap: 6px;
}


/* =========================================================
   TOAST
   ========================================================= */

.toast {
  position: fixed;

  left: 50%;

  bottom:
    calc(
      var(--hm-nav-height)
      +
      var(--hm-safe-bottom)
      +
      14px
    );

  z-index: 3000;

  max-width:
    min(
      88vw,
      430px
    );

  transform:
    translate(
      -50%,
      16px
    );

  opacity: 0;

  pointer-events: none;

  padding:
    11px
    14px;

  border-radius: 12px;

  color: #fff;

  background:
    rgba(
      32,
      31,
      36,
      0.94
    );

  box-shadow:
    0 8px 20px
    rgba(0, 0, 0, 0.22);

  font-size: 0.78rem;

  font-weight: 700;

  text-align: center;

  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}


.toast.show {
  opacity: 1;

  transform:
    translate(
      -50%,
      0
    );
}


/* =========================================================
   PAGE SCROLL
   ========================================================= */

#page-controls .page-scroll,
#page-alarms .page-scroll,
#page-create-batch .page-scroll {
  padding-top: 10px;
  padding-bottom: 12px;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 650px) {

  #page-dashboard .reference-status-list {
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      ) !important;
  }


  .simple-setpoint-grid {
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      ) !important;
  }


  #page-controls .simple-equipment-grid {
    grid-template-columns:
      minmax(0, 1fr) !important;
  }


  #page-controls .simple-equipment-card {
    min-height: 88px !important;

    flex-direction: row !important;

    align-items: center !important;
  }


  .batch-section-heading h2 {
    font-size: 0.92rem;
  }
}


@media (max-width: 430px) {

  #page-dashboard .reference-status-card {
    min-height: 78px;

    padding:
      13px
      9px;
  }


  #page-dashboard .reference-state-chip {
    min-width: 60px;

    min-height: 38px;
  }


  #page-dashboard .status-device-icon {
    width: 22px;

    font-size: 1.1rem;
  }


  #page-dashboard .status-name strong {
    font-size: 0.58rem;
  }


  .simple-mode-panel {
    width: 100%;
  }


  .simple-setpoint-grid {
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      ) !important;
  }


  .simple-setpoint-card {
    grid-template-columns:
      34px
      minmax(0, 1fr);

    gap: 7px;

    padding: 9px;
  }


  .simple-setpoint-icon {
    width: 32px;

    height: 32px;
  }


  .simple-input-line input {
    min-height: 45px;

    font-size: 0.9rem;
  }


  .simple-setpoint-card small {
    font-size: 0.64rem;
  }


  .simple-input-line strong {
    font-size: 0.72rem;
  }


  #page-controls .simple-equipment-card {
    min-height: 84px !important;

    padding:
      11px
      10px;
  }


  #page-controls .tray-equipment .simple-equipment-action {
    width: 42%;
  }


  #page-controls .tray-equipment select,
  #page-controls #trayPos {
    min-width: 0;
  }


  .simple-alarm-details {
    justify-content: flex-start;
  }


  .batch-section-heading h2 {
    font-size: 0.88rem;
  }
}


@media (max-width: 359px) {

  :root {
    --hm-header-height: 68px;
    --hm-nav-height: 72px;
  }


  .content {
    padding-inline: 10px !important;
  }


  .header-brand img {
    max-width: 128px !important;
  }


  .realtime-status {
    min-width: 86px !important;

    max-width: 35vw;

    padding-inline: 8px;

    font-size: 0.62rem;
  }


  #page-dashboard .reference-status-list {
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      ) !important;
  }


  .simple-setpoint-grid {
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      ) !important;
  }


  .reference-metric-card {
    min-height: 126px !important;
  }


  #page-controls .simple-equipment-card {
    min-height: 80px !important;
  }


  #page-controls .switch {
    width: 54px;
  }


  #page-controls
  .switch input:checked
  + .slider::before {
    transform: translateX(20px);
  }


  .batch-stats {
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      );
  }
}


@media (min-width: 360px) and (max-width: 599px) {

  #page-dashboard .reference-dashboard {
    gap: 9px;
  }


  .reference-metric-card {
    min-height:
      clamp(
        132px,
        20vh,
        160px
      );
  }


  #page-dashboard .reference-status-list {
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      ) !important;
  }


  .simple-setpoint-grid {
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      ) !important;
  }
}


@media (max-width: 520px) {

  .sync-status {
    top:
      calc(
        var(--hm-header-height, 74px)
        +
        env(safe-area-inset-top, 0px)
        +
        5px
      );

    max-width: 94vw;

    font-size: 0.66rem;
  }
}


@media (max-height: 680px) and (max-width: 599px) {

  :root {
    --hm-header-height: 66px;
    --hm-nav-height: 68px;
  }


  .topbar {
    min-height:
      calc(
        66px
        +
        var(--hm-safe-top)
      );
  }


  .header-brand {
    height: 46px;
  }


  .header-brand img {
    max-height: 43px;
  }


  .mobile-nav-item {
    min-height: 55px;
  }


  .content {
    padding-top: 9px !important;
  }


  .reference-metric-card {
    min-height: 112px;
  }


  #page-dashboard .reference-status-card {
    min-height: 68px;
  }


  .reference-last-updated {
    min-height: 38px;
  }


  .simple-control-panel,
  .simple-mode-panel {
    padding: 10px;
  }


  #page-controls .simple-equipment-card {
    min-height: 76px !important;
  }
}


@media (min-width: 600px) {

  :root {
    --hm-header-height: 82px;
  }


  .topbar {
    min-height:
      calc(
        82px
        +
        var(--hm-safe-top)
      );

    padding-inline: 20px !important;
  }


  .header-brand img {
    width:
      min(
        100%,
        315px
      );

    max-height: 57px;
  }


  .realtime-status {
    min-width: 150px;

    max-width: 280px;

    font-size: 0.84rem;
  }


  .content {
    padding: 18px !important;
  }


  #page-dashboard .reference-dashboard,
  .controls-layout,
  .alarms-layout,
  .create-batch-layout,
  #page-batches {
    width:
      min(
        100%,
        980px
      );

    margin-inline: auto;
  }


  .reference-metric-card {
    min-height: 176px;

    grid-template-columns:
      95px
      minmax(0, 1fr);
  }


  #page-dashboard .reference-status-list {
    grid-template-columns:
      repeat(
        2,
        minmax(0, 1fr)
      );
  }


  #page-controls .simple-equipment-card {
    min-height: 94px !important;
  }
}


@media (min-width: 980px) {

  :root {
    --hm-header-height: 84px;
  }


  .app-shell {
    grid-template-columns:
      230px
      minmax(0, 1fr) !important;

    grid-template-rows:
      auto
      minmax(0, 1fr) !important;
  }


  .topbar {
    grid-column: 1 / -1;

    grid-row: 1;
  }


  .sidebar {
    display: flex !important;

    grid-column: 1;

    grid-row: 2;

    min-width: 0;

    min-height: 0;

    flex-direction: column;

    justify-content: space-between;

    overflow: hidden;

    border: 0;

    border-right:
      1px solid #ded8e1;

    border-radius: 0;

    background: #f8f6f9;

    box-shadow: none;
  }


  .desktop-nav {
    display: grid;

    gap: 8px;

    padding:
      18px
      12px;
  }


  .nav-item {
    min-height: 52px;

    display: flex;

    align-items: center;

    gap: 11px;

    border: 0;

    border-radius: 13px;

    color: #6d6872;

    background: transparent;

    padding: 0 14px;

    font-weight: 900;

    text-align: left;
  }


  .nav-icon {
    width: 25px;

    display: grid;

    place-items: center;

    font-size: 1.2rem;
  }


  .nav-item.active {
    color: #108ec8;

    background: #e8f5fa;
  }


  .sidebar-footer {
    padding: 14px;

    border-top:
      1px solid #ded8e1;
  }


  .user-mini {
    min-width: 0;

    display: flex;

    align-items: center;

    gap: 10px;
  }


  .avatar {
    width: 38px;

    height: 38px;

    flex: 0 0 auto;

    display: grid;

    place-items: center;

    border-radius: 50%;

    color: #fff;

    background: var(--hm-blue);

    font-weight: 900;
  }


  .user-mini > div:last-child {
    min-width: 0;

    display: grid;

    gap: 2px;
  }


  .user-mini strong,
  .user-mini small {
    overflow: hidden;

    text-overflow: ellipsis;

    white-space: nowrap;
  }


  .user-mini small {
    color: var(--hm-muted);

    font-size: 0.68rem;
  }


  .content {
    grid-column: 2;

    grid-row: 2;

    padding: 20px !important;
  }


  .mobile-nav {
    display: none !important;
  }


  .toast {
    bottom: 24px;
  }
}


@media (min-width: 1280px) {

  .app-shell {
    grid-template-columns:
      250px
      minmax(0, 1fr) !important;
  }


  #page-dashboard .reference-dashboard,
  .controls-layout,
  .alarms-layout,
  .create-batch-layout,
  #page-batches {
    width:
      min(
        100%,
        1080px
      );
  }
}


@media (display-mode: standalone) {

  .topbar {
    padding-top:
      max(
        8px,
        var(--hm-safe-top)
      ) !important;
  }


  .mobile-nav {
    padding-bottom:
      var(--hm-safe-bottom) !important;
  }
}


@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;

    animation-duration:
      0.01ms !important;

    animation-iteration-count:
      1 !important;

    transition-duration:
      0.01ms !important;
  }
}


/* =========================================================
   ALARM ACKNOWLEDGED PATCH
   ========================================================= */

.simple-alarm-card.acknowledged {
  border-left-color: #e2aa2d;
  background: #fffdf6;
}


.simple-alarm-card.acknowledged
.simple-alarm-status {
  color: #976d08;
  background: #fff3c6;
}


.simple-alarm-card.acknowledged
.simple-alarm-icon {
  color: #986d0b;
  background: #fff5cf;
}


.simple-alarm-card.acknowledged
.simple-alarm-actions {
  margin-top: 4px;
}


/* =========================================================
   ALARM BLINKING REMINDER
   ========================================================= */

.simple-alarm-card.reminder-blink {
    animation: blinkRed 1.2s infinite;
    border-left-color: #ff0000 !important;
}

@keyframes blinkRed {
    0%   { background-color: #ffffff; }
    50%  { background-color: #ffe6e6; }
    100% { background-color: #ffffff; }
}

/* =========================================================
   BATCH TABS & SECTIONS
   ========================================================= */

.batch-tabs {
  display: flex;
  gap: 8px;
  margin: 6px 0 16px;
}

.batch-tab {
  min-height: 38px;
  padding: 0 18px;
  border: 1px solid #d0cad4;
  border-radius: 20px;
  background: transparent;
  color: #6f6974;
  font-weight: 800;
  font-size: 0.78rem;
  transition: 0.2s;
  cursor: pointer;
}

.batch-tab.active {
  background: #eaf6fb;
  border-color: #1598d5;
  color: #1598d5;
}

.batch-tab:hover {
  background: #f2f0f4;
}

.batch-section {
  display: block;
}

.batch-section.hidden {
  display: none !important;
}

@media (max-width: 430px) {
  .batch-tab {
    font-size: 0.7rem;
    padding: 0 12px;
    min-height: 32px;
  }
}


/* =========================================================
   DASHBOARD — FIT-TO-VIEWPORT (NO SCROLL)
   ========================================================= */

#page-dashboard.active-page {
  display: grid !important;
  grid-template-rows: minmax(0, 1fr) auto !important;
  gap: 0 !important;
  overflow: hidden !important;
}


#page-dashboard .reference-dashboard {
  width: 100% !important;
  height: 100% !important;
  min-height: 0 !important;
  margin: 0 auto !important;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  grid-template-rows:
    minmax(0, 0.82fr)
    minmax(0, 0.82fr)
    minmax(0, 0.82fr)
    minmax(0, 1.95fr) !important;
  gap: clamp(4px, 0.9vh, 10px) !important;
  align-content: stretch !important;
  overflow: hidden !important;
  padding: 0 0 clamp(4px, 0.9vh, 10px) !important;
}


#page-dashboard .reference-metric-card {
  min-height: 0 !important;
  height: auto !important;
  align-self: stretch !important;
  display: grid !important;
  grid-template-columns: clamp(44px, 12vw, 78px) minmax(0, 1fr) !important;
  overflow: hidden !important;
  border-radius: 14px !important;
}

#page-dashboard .reference-icon-column {
  min-width: 0 !important;
  display: grid !important;
  place-items: center !important;
  padding: clamp(4px, 1vh, 10px) !important;
  border-right: 1px solid #e7e2e9 !important;
}

#page-dashboard .reference-svg {
  width: clamp(26px, 6vh, 48px) !important;
  height: clamp(26px, 6vh, 48px) !important;
  overflow: visible !important;
}

#page-dashboard .reference-card-content {
  min-width: 0 !important;
  align-self: center !important;
  padding: clamp(4px, 1.2vh, 14px) clamp(8px, 2.2vw, 14px) !important;
  overflow: hidden !important;
}

#page-dashboard .reference-card-content h2 {
  max-width: 100% !important;
  margin: 0 0 clamp(1px, 0.4vh, 6px) !important;
  overflow: hidden !important;
  font-size: clamp(0.7rem, 2.9vw, 1.1rem) !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#page-dashboard .reference-card-content strong {
  display: block !important;
  max-width: 100% !important;
  margin: 0 0 clamp(1px, 0.4vh, 5px) !important;
  overflow: hidden !important;
  color: #183b8d !important;
  font-size: clamp(0.95rem, 4.2vw, 1.7rem) !important;
  line-height: 1.05 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#page-dashboard .reference-card-content p {
  max-width: 100% !important;
  margin: 0 !important;
  overflow: hidden !important;
  color: #333137 !important;
  font-size: clamp(0.58rem, 2.4vw, 0.85rem) !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}


#page-dashboard .reference-status-list {
  min-height: 0 !important;
  height: auto !important;
  align-self: stretch !important;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(3, minmax(0, 1fr)) !important;
  gap: clamp(4px, 0.9vh, 10px) !important;
}

#page-dashboard .reference-status-card {
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 6px !important;
  padding: clamp(4px, 1vh, 14px) clamp(8px, 2.2vw, 12px) !important;
  border-radius: 14px !important;
  overflow: hidden !important;
}

#page-dashboard .status-device-icon {
  width: clamp(16px, 4.5vw, 26px) !important;
  flex: 0 0 auto !important;
  display: grid !important;
  place-items: center !important;
  font-size: clamp(1rem, 3.2vw, 1.55rem) !important;
}

#page-dashboard .status-name strong {
  min-width: 0 !important;
  overflow: hidden !important;
  color: #29272d !important;
  font-size: clamp(0.54rem, 2.4vw, 0.88rem) !important;
  font-weight: 800 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#page-dashboard .reference-state-chip {
  min-width: clamp(44px, 13vw, 78px) !important;
  min-height: clamp(26px, 6vh, 48px) !important;
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  padding-inline: 8px !important;
  font-size: clamp(0.58rem, 2.3vw, 0.8rem) !important;
  font-weight: 900 !important;
}

#page-dashboard .reference-state-chip i {
  width: 8px !important;
  height: 8px !important;
  flex: 0 0 auto !important;
  border-radius: 50% !important;
  background: currentColor !important;
}

#page-dashboard .reference-state-chip.off {
  color: #ed4545 !important;
  border-color: #ef6262 !important;
  background: #fff7f7 !important;
}
