:root {
  --bg: #f7faf8;
  --surface: #ffffff;
  --surface-soft: #f1f6f3;
  --text: #0f1f19;
  --muted: #64736d;
  --line: #dfe8e3;
  --green-900: #003f25;
  --green-800: #005b31;
  --green-700: #087a3a;
  --green-600: #10923f;
  --green-100: #e7f7ed;
  --red: #ed3346;
  --red-soft: #ffe8ec;
  --amber: #f49a16;
  --amber-soft: #fff2d8;
  --blue: #2f82d8;
  --blue-soft: #e7f1ff;
  --shadow: 0 18px 50px rgba(16, 32, 24, .08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  margin: 0;
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.login-page {
  background:
    radial-gradient(circle at 20% 20%, rgba(16, 146, 63, .08), transparent 24rem),
    linear-gradient(135deg, #ffffff 0%, #f5faf7 52%, #edf6f0 100%);
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-card {
  width: min(420px, 100%);
  min-height: 620px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 44px 38px;
  background: rgba(255, 255, 255, .88);
  border: 1px solid rgba(14, 95, 47, .18);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.login-card-wide {
  width: min(760px, 100%);
  min-height: auto;
  justify-content: flex-start;
  padding: 34px 36px;
}

.brand-lockup,
.side-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--green-900);
  text-decoration: none;
}

.brand-lockup {
  justify-content: center;
  margin-bottom: 44px;
  font-size: 28px;
  font-weight: 760;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  color: var(--green-700);
}

.brand-mark svg {
  width: 44px;
  height: 44px;
  stroke-width: 1.8;
}

.login-card h1 {
  margin: 0 0 24px;
  text-align: center;
  font-size: 25px;
  line-height: 1.2;
}

.login-form {
  display: grid;
  gap: 15px;
}

.register-form {
  gap: 16px;
}

.register-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  background: #fff;
  border: 1px solid #d8e3dd;
  border-radius: 7px;
  color: #60716b;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.field:focus-within {
  border-color: rgba(16, 146, 63, .7);
  box-shadow: 0 0 0 4px rgba(16, 146, 63, .1);
}

.field input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 14px;
}

.password-field {
  padding-right: 7px;
}

.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #53655f;
}

.icon-button:hover {
  background: var(--surface-soft);
  color: var(--green-800);
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 3px 0 10px;
  color: #34443e;
  font-size: 14px;
}

.terms-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid #d8e3dd;
  border-radius: 7px;
  background: #fff;
  color: #34443e;
  font-size: 13px;
  line-height: 1.4;
}

.terms-row input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex: 0 0 auto;
  accent-color: var(--green-700);
}

.remember-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--green-700);
}

.primary-button,
.add-button,
.secondary-button {
  min-height: 40px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-weight: 720;
  font-size: 13px;
}

.primary-button,
.add-button {
  color: #fff;
  background: linear-gradient(180deg, #0e9442 0%, #007834 100%);
  box-shadow: 0 12px 24px rgba(0, 120, 52, .22);
}

.primary-button {
  min-height: 52px;
}

.primary-button:hover,
.add-button:hover {
  background: linear-gradient(180deg, #119d48 0%, #006f30 100%);
}

.secondary-button {
  padding: 0 14px;
  color: #24342e;
  background: #fff;
  border-color: #dce6e1;
}

.secondary-button:hover {
  border-color: #bdd2c7;
  background: #f6faf8;
}

.login-error {
  margin: -8px 0 16px;
  padding: 12px 14px;
  border-radius: 7px;
  background: var(--red-soft);
  color: #9d1f2d;
  font-size: 13px;
  font-weight: 650;
}

.login-success {
  margin: -8px 0 16px;
  padding: 12px 14px;
  border-radius: 7px;
  background: var(--green-100);
  color: #087237;
  font-size: 13px;
  font-weight: 650;
}

.form-hint,
.auth-switch {
  margin: 0;
  color: #6f7e78;
  font-size: 13px;
  line-height: 1.45;
}

.form-hint {
  padding: 0 2px;
}

.auth-switch {
  margin-top: 18px;
  text-align: center;
}

.auth-switch.compact {
  margin-top: 8px;
}

.auth-switch a {
  color: var(--green-800);
  font-weight: 760;
  text-decoration: none;
}

.auth-switch a:hover {
  text-decoration: underline;
}

.login-foot {
  margin: 42px 0 0;
  text-align: center;
  color: #9aa6a1;
  font-size: 12px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 10;
  width: 252px;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 14px;
  overflow-y: auto;
  color: #e4f4ea;
  background:
    linear-gradient(180deg, rgba(0, 107, 50, .9), rgba(0, 61, 36, .98)),
    var(--green-900);
}

.side-brand {
  margin: 0 12px 30px;
  color: #fff;
  font-size: 19px;
}

.side-brand .brand-mark {
  width: 36px;
  height: 36px;
  color: #79d596;
}

.side-brand .brand-mark svg {
  width: 34px;
  height: 34px;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-nav a {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 17px;
  color: #e6f5ed;
  text-decoration: none;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 720;
}

.side-nav a:hover,
.side-nav a.active {
  color: #fff;
  background: rgba(22, 177, 74, .88);
}

.collapse-button {
  margin: auto 12px 10px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  border: 0;
  color: #fff;
  background: transparent;
  font-weight: 710;
}

.collapse-button span:first-child {
  font-size: 30px;
  line-height: 1;
}

.workspace {
  min-width: 0;
  margin-left: 252px;
  padding: 27px 24px 34px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.topbar h1 {
  margin: 0;
  font-size: 23px;
  line-height: 1.2;
}

.topbar-sub {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.menu-button {
  display: none;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
}

.top-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.notification-button span {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}

.operator {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
  background: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 720;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.metric-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 31, 25, .04);
}

.metric-card {
  position: relative;
  min-height: 148px;
  padding: 22px 20px 18px 68px;
}

.metric-icon {
  position: absolute;
  left: 20px;
  top: 24px;
  color: var(--green-900);
  font-size: 27px;
}

.metric-card span {
  color: #40514b;
  font-size: 13px;
  font-weight: 650;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: 30px;
  line-height: 1;
}

.metric-card small {
  font-size: 13px;
}

.metric-card p {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 18px 0 0;
  color: #50635c;
  font-size: 12px;
}

.metric-card code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11px;
  color: #34443e;
}

.metric-card em {
  color: var(--green-700);
  font-style: normal;
  font-weight: 760;
}

.green-text {
  color: var(--green-700);
}

.dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  flex: 0 0 auto;
  border-radius: 999px;
}

.dot.ok {
  background: var(--green-600);
}

.dot.bad {
  background: var(--red);
}

.main-grid,
.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, .95fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  min-width: 0;
  padding: 17px;
}

.panel-heading {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.3;
}

.segmented {
  display: flex;
  gap: 8px;
}

.segmented button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #40514b;
  font-size: 12px;
  font-weight: 720;
}

.segmented button.active {
  color: var(--green-800);
  background: var(--green-100);
  border-color: #badfc7;
}

.chart-wrap {
  height: 270px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.chart-wrap svg {
  width: 100%;
  height: 220px;
  stroke-width: 0;
}

.chart-grid {
  stroke: #dbe6e0;
  stroke-width: 1;
  stroke-dasharray: 4 5;
  fill: none;
}

.chart-fill {
  fill: url(#energyFill);
}

.chart-line {
  fill: none;
  stroke: var(--green-700);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  padding: 0 2px;
  color: #65766f;
  font-size: 12px;
}

.relay-list {
  display: grid;
  gap: 10px;
}

.relay-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto auto auto;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid #e4ece7;
  border-radius: 7px;
}

.relay-row > span {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 660;
}

.switch {
  width: 49px;
  height: 28px;
  padding: 3px;
  border: 0;
  border-radius: 999px;
  background: #cfd8d4;
  transition: background .18s ease;
}

.switch span {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(0, 0, 0, .18);
  transition: transform .18s ease;
}

.switch.is-on {
  background: linear-gradient(180deg, #0fa347, #007832);
}

.switch.is-on span {
  transform: translateX(21px);
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.table-search {
  width: 190px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  outline: 0;
  color: var(--text);
  font-size: 13px;
}

.table-search:focus {
  border-color: rgba(16, 146, 63, .7);
  box-shadow: 0 0 0 4px rgba(16, 146, 63, .1);
}

.add-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
}

.primary-button.compact {
  min-height: 40px;
  padding: 0 14px;
  box-shadow: 0 8px 18px rgba(0, 120, 52, .16);
}

.panel-message,
.panel-note {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.45;
}

.panel-message.error {
  padding: 10px 12px;
  border-radius: 7px;
  color: #9d1f2d;
  background: var(--red-soft);
  font-weight: 680;
}

.panel-note {
  color: var(--muted);
}

.panel-note code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  color: #263832;
}

.device-add-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
  gap: 10px;
  margin-bottom: 10px;
}

.device-add-form label {
  display: grid;
  gap: 6px;
  color: #40514b;
  font-size: 12px;
  font-weight: 760;
}

.device-add-form input,
.device-add-form select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  color: var(--text);
  background: #fff;
  outline: 0;
}

.device-add-form input:focus,
.device-add-form select:focus {
  border-color: rgba(16, 146, 63, .7);
  box-shadow: 0 0 0 4px rgba(16, 146, 63, .1);
}

.empty-cell {
  color: var(--muted);
  font-weight: 650;
  white-space: normal;
}

.automation-grid {
  display: grid;
  margin-bottom: 16px;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--green-800);
  background: var(--green-100);
  font-size: 12px;
  font-weight: 780;
}

.automation-form {
  display: grid;
  grid-template-columns: minmax(190px, 1.1fr) minmax(150px, .9fr) minmax(120px, .65fr) minmax(120px, .65fr) 110px;
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
}

.automation-form label {
  display: grid;
  gap: 6px;
  color: #40514b;
  font-size: 12px;
  font-weight: 760;
}

.automation-form input,
.automation-form select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 11px;
  color: var(--text);
  background: #fff;
  outline: 0;
}

.automation-form input:focus,
.automation-form select:focus {
  border-color: rgba(16, 146, 63, .7);
  box-shadow: 0 0 0 4px rgba(16, 146, 63, .1);
}

.days-checks {
  grid-column: 1 / -3;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.days-checks legend {
  width: 100%;
  margin-bottom: 2px;
  color: #40514b;
  font-size: 12px;
  font-weight: 760;
}

.days-checks label,
.enable-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #33443e;
  font-size: 12px;
  font-weight: 740;
}

.automation-form .enable-check {
  display: inline-flex;
}

.days-checks input,
.enable-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--green-700);
}

.automation-list {
  display: grid;
  gap: 9px;
}

.automation-empty,
.automation-row {
  border: 1px solid #e4ece7;
  border-radius: 7px;
  background: #fbfdfb;
}

.automation-empty {
  padding: 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.automation-row {
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(180px, 1.2fr) minmax(150px, .8fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
}

.automation-row strong,
.automation-row span,
.automation-row time {
  display: block;
}

.automation-row strong {
  color: #25352f;
  font-size: 13px;
}

.automation-row div > span,
.automation-row time {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.rule-actions {
  display: flex;
  gap: 4px;
}

.rule-actions form {
  margin: 0;
}

.table-icon.danger:hover {
  color: #9d1f2d;
  background: var(--red-soft);
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 940px;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid #edf2ef;
  text-align: left;
  font-size: 12px;
  white-space: nowrap;
}

th {
  color: #5b6d65;
  font-weight: 780;
}

td {
  color: #25352f;
  font-weight: 620;
}

td:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill-ok,
.pill-muted,
.pill-bad {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 780;
}

.pill-ok {
  color: #087237;
  background: var(--green-100);
}

.pill-muted {
  color: #697871;
  background: #eef2f0;
}

.pill-bad {
  color: #cd2638;
  background: var(--red-soft);
}

.table-icon {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 6px;
  color: #3f504a;
  background: transparent;
}

.table-icon:hover {
  background: #edf6f1;
  color: var(--green-800);
}

.device-link {
  color: #1a5f3d;
  font-weight: 780;
  text-decoration: none;
}

.device-link:hover {
  text-decoration: underline;
}

.device-command-actions {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  margin: 0;
}

.device-detail-panel {
  grid-column: 1 / -1;
}

.device-detail-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.device-detail-grid div {
  min-height: 72px;
  padding: 12px;
  border: 1px solid #edf2ef;
  border-radius: 7px;
  background: #fbfdfb;
}

.device-detail-grid span,
.history-row time {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
}

.device-detail-grid strong {
  display: block;
  margin-top: 5px;
  color: #23352e;
  font-size: 14px;
}

.detail-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.detail-columns h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: #263832;
}

.history-list {
  display: grid;
  gap: 8px;
}

.history-row {
  min-height: 54px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #edf2ef;
  border-radius: 7px;
}

.history-row strong {
  display: block;
  color: #263832;
  font-size: 13px;
}

.right-stack {
  display: grid;
  gap: 16px;
}

.ota-status {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px;
  border-radius: 7px;
  background: #f4faf6;
  color: var(--green-900);
}

.ota-status span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 7px;
  background: #fff;
  color: var(--green-700);
  border: 1px solid #d8e9df;
}

.ota-status strong {
  display: block;
  font-size: 14px;
}

.ota-status p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.ota-form {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #edf2ef;
}

.ota-form label {
  color: #40514b;
  font-size: 12px;
  font-weight: 740;
}

.ota-form input,
.ota-form select {
  min-height: 38px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
}

.ota-form input[type="file"] {
  padding: 8px 10px;
}

.ota-form input:focus,
.ota-form select:focus {
  outline: 0;
  border-color: rgba(16, 146, 63, .7);
  box-shadow: 0 0 0 4px rgba(16, 146, 63, .1);
}

.ota-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.firmware-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.firmware-row {
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #edf2ef;
  border-radius: 7px;
}

.firmware-row strong,
.firmware-row span {
  display: block;
}

.firmware-row strong {
  color: #263832;
  font-size: 13px;
}

.firmware-row span,
.firmware-row code {
  color: var(--muted);
  font-size: 11px;
}

.firmware-row code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.progress {
  height: 9px;
  overflow: hidden;
  margin-top: 14px;
  border-radius: 999px;
  background: #e6eee9;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0a7f37, #2ebf62);
}

.alert-list {
  display: grid;
}

.alert-row {
  min-height: 56px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid #edf2ef;
}

.alert-row:last-child {
  border-bottom: 0;
}

.alert-row span {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.alert-row.danger span {
  background: var(--red);
}

.alert-row.warning span {
  background: var(--amber);
}

.alert-row.info span {
  background: var(--blue);
}

.alert-row strong {
  overflow: hidden;
  color: #2d3f38;
  font-size: 13px;
  font-weight: 670;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert-row time {
  color: #6a7973;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  max-width: 320px;
  padding: 13px 16px;
  border-radius: 7px;
  background: var(--green-900);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow);
  transition: opacity .2s ease, transform .2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

body.menu-collapsed .sidebar {
  width: 86px;
}

body.menu-collapsed .workspace {
  margin-left: 86px;
}

body.menu-collapsed .side-brand strong,
body.menu-collapsed .side-nav span,
body.menu-collapsed .collapse-button span:last-child {
  display: none;
}

body.menu-collapsed .side-nav a {
  justify-content: center;
  padding: 0;
}

body.menu-collapsed .side-brand {
  justify-content: center;
}

@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .app-shell,
  body.menu-collapsed .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    inset: 0 auto 0 0;
    width: 270px;
    transform: translateX(-104%);
    transition: transform .2s ease;
  }

  .workspace,
  body.menu-collapsed .workspace {
    margin-left: 0;
  }

  body.mobile-menu-open .sidebar {
    transform: translateX(0);
  }

  .menu-button {
    display: grid;
  }

  .workspace {
    padding: 18px 14px 28px;
  }

  .topbar {
    align-items: flex-start;
  }

  .top-actions {
    gap: 6px;
  }

  .operator {
    padding: 0 10px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 130px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .heading-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .table-search,
  .add-button {
    width: 100%;
  }

  .device-add-form {
    grid-template-columns: 1fr;
  }

  .automation-form {
    grid-template-columns: 1fr;
  }

  .days-checks {
    grid-column: auto;
  }

  .automation-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .device-detail-grid,
  .detail-columns {
    grid-template-columns: 1fr;
  }

  .rule-actions {
    justify-content: flex-start;
  }

  .relay-row {
    grid-template-columns: 1fr auto;
  }

  .relay-row .secondary-button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .login-shell {
    padding: 16px;
  }

  .login-card {
    min-height: calc(100vh - 32px);
    padding: 34px 22px;
  }

  .login-card-wide {
    min-height: auto;
    padding: 28px 18px;
  }

  .register-grid {
    grid-template-columns: 1fr;
  }

  .brand-lockup {
    font-size: 24px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .chart-axis {
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
    animation-duration: .001ms !important;
  }
}
