:root {
  color-scheme: light;
  --primary: #348fca;
  --primary-button: #3494cd;
  --title: #5c5454;
  --muted: #717171;
  --bg: #ffffff;
  --side: #eeeeee;
  --content-big: #f6f6f6;
  --content-small: #eeeeee;
  --shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
  --radius: 10px;
  --font: "Acumin Pro", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: #000;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

.root {
  min-height: 100%;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid rgba(0, 0, 0, 0.12);
  border-top-color: rgba(0, 0, 0, 0.45);
  border-radius: 999px;
  animation: spin 900ms linear infinite;
  margin: 24px auto;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Login / Forgot */
.login-layout {
  min-height: 100vh;
  background: #fff;
  display: flex;
}

.login-panel {
  width: 100%;
  padding: 32px;
}

@media (min-width: 640px) {
  .login-panel {
    width: 520px;
  }
}

.login-title {
  font-weight: 700;
  font-size: 24px;
  margin: 16px 0 0;
}

.form-space {
  height: 56px;
}

.field {
  margin-top: 24px;
}

.label {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
}

.input-row {
  position: relative;
}

.input {
  width: 100%;
  border: none;
  border-bottom: 1px solid #d0d0d0;
  padding: 10px 0 8px;
  font-size: 12px;
  outline: none;
}

.input::placeholder {
  color: #a2a0a0;
}

.input-toggle {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
  padding: 6px;
}

.hint-link {
  display: inline-block;
  color: #3e4095;
  font-size: 14px;
  cursor: pointer;
}

.hint-right {
  margin-top: 16px;
  text-align: right;
}

.error-text {
  margin-top: 10px;
  color: #dc2626;
  font-size: 12px;
  font-weight: 600;
}

.btn-primary {
  width: 100%;
  border: none;
  background: var(--primary-button);
  color: #fff;
  border-radius: 5px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-transparent {
  width: 100%;
  border: none;
  background: transparent;
  color: #000;
  border-radius: 5px;
  padding: 10px 16px;
  font-size: 15px;
  cursor: pointer;
}

.store-row {
  display: none;
  margin-top: 48px;
  gap: 16px;
  justify-content: space-evenly;
  align-items: center;
}

@media (min-width: 640px) {
  .store-row {
    display: flex;
  }
}

.copyright {
  margin-top: auto;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
}

@media (min-width: 640px) {
  .copyright {
    font-size: 14px;
  }
}

.login-image {
  display: none;
  flex: 1;
  background: #fff;
}

@media (min-width: 640px) {
  .login-image {
    display: block;
  }
}

.login-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* App shell (RootContainer-like) */
.shell {
  min-height: 100vh;
  display: flex;
  background: #fff;
}

.sidebar {
  display: none;
  width: 240px;
  background: var(--side);
  padding: 64px 32px 0;
}

@media (min-width: 640px) {
  .sidebar {
    display: block;
  }
}

.menu {
  margin-top: 64px;
  display: grid;
  gap: 40px;
}

.menu-divider {
  height: 1px;
  background: #717171;
  margin: 20px 0;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  user-select: none;
  color: #717171;
}

.menu-item .material-icons-outlined {
  font-size: 28px;
  width: 28px;
  flex: 0 0 28px;
  overflow: hidden;
}

.menu-item .menu-label {
  font-size: 18px;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: #fff;
  padding: 0 16px;
  height: 80px;
  display: grid;
  align-content: center;
  gap: 6px;
}

@media (min-width: 640px) {
  .topbar {
    height: 64px;
    padding: 0 32px;
    grid-template-columns: 1fr auto;
    gap: 0;
    align-items: center;
  }
}

.topbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.topbar-title {
  color: var(--title);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

@media (min-width: 640px) {
  .topbar-title {
    font-size: 24px;
  }
}

.user-area {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
}

.logout {
  display: none;
  cursor: pointer;
  color: var(--primary);
}

@media (min-width: 640px) {
  .logout {
    display: inline-flex;
  }
}

.main {
  flex: 1;
  overflow: auto;
  background: var(--content-small);
  padding: 0 16px 92px;
}

@media (min-width: 640px) {
  .main {
    background: var(--content-big);
    padding: 0 32px 24px;
  }
}

.simple-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: none;
  padding: 16px;
  width: 100%;
}

.spacer-16 {
  height: 16px;
}

.filter-bar {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

@media (min-width: 640px) {
  .filter-bar {
    justify-content: flex-end;
  }
}

.focus-btn {
  width: 104px;
  padding: 6px 8px;
  border-radius: 5px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  color: #000;
}

.focus-btn--active {
  background: var(--primary);
  color: #fff;
}

.devices-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.devices-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.device-card {
  padding: 16px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: #000;
  cursor: pointer;
  user-select: none;
}

.device-card--maintenance {
  background: #ffcc00;
}

.device-card--offline {
  background: #a6a6a6;
}

.device-card--alert {
  background: #f8a6a6;
}

.device-card--ok {
  background: #3bda37;
}

.device-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 32px;
}

.device-name {
  font-size: 17px;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-desc {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40%;
}

.device-body {
  display: flex;
  align-items: flex-start;
  min-height: 56px;
}

.device-body > * {
  flex: 1 1 auto;
  min-width: 0;
}

.device-card--maintenance .device-body {
  align-items: center;
}

.dash-icons {
  display: flex;
  align-items: stretch;
  margin-top: 8px;
  flex-wrap: wrap;
}

.dash-item {
  flex: 1 1 25%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4px 6px;
  min-width: 0;
}

.flash {
  animation: flash-ring 850ms ease-out;
}

@keyframes flash-ring {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }

  20% {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.85);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
  }
}

.dash-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.dash-value {
  font-size: 18px;
  font-weight: 700;
}

.dash-label {
  font-size: 12px;
  font-weight: 700;
}

.maintenance-text {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.alerted {
  color: #ff0000;
}

.device-foot {
  min-height: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.meta-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta-left .material-icons-outlined {
  font-size: 16px;
}

.mini {
  font-size: 9px;
}

.battery {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

.rotate-90 {
  transform: rotate(90deg);
}

.signal {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.signal .label {
  margin: 0;
  font-size: 9px;
  font-weight: 700;
  color: #000;
}

.signal .value {
  font-size: 9px;
  color: #000;
}

/* Selector modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: grid;
  place-items: center;
  padding: 16px;
  z-index: 50;
}

.modal {
  width: min(380px, 100%);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}

.modal-header {
  padding: 14px 16px;
  font-weight: 700;
  color: var(--title);
}

.modal-option {
  width: 100%;
  border: none;
  background: #fff;
  text-align: left;
  padding: 14px 16px;
  cursor: pointer;
  font-size: 14px;
  border-top: 1px solid #f0f0f0;
}

/* Bottom navigation (mobile) */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(68px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: #fff;
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.16);
  display: flex;
  overflow: hidden;
}

@media (min-width: 640px) {
  .bottom-nav {
    display: none;
  }
}

.bottom-nav button {
  flex: 1;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #c4c4c4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.bottom-nav button.active {
  color: var(--primary);
}

.bottom-nav .material-icons-outlined {
  font-size: 26px;
}

.bottom-nav-label {
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  color: inherit;
}

@media (max-width: 520px) {
  .device-body {
    min-height: 120px;
  }

  .dash-item {
    flex: 1 1 50%;
    padding: 8px 6px;
  }

  .dash-value {
    font-size: 16px;
  }

  .dash-label {
    font-size: 11px;
  }
}

@media (max-width: 360px) {
  .device-body {
    min-height: 156px;
  }

  .dash-top {
    flex-direction: column;
    gap: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
    animation: none !important;
  }
}
