:root {
  --sera-ink: #18231f;
  --sera-muted: #6c7771;
  --sera-line: #dfe5e1;
  --sera-bg: #f4f6f2;
  --sera-panel: #ffffff;
  --sera-green: #146c43;
  --sera-green-2: #269567;
  --sera-green-soft: #e8f5ee;
  --sera-lime: #b9d75d;
  --sera-amber: #e99a31;
  --sera-amber-soft: #fff2df;
  --sera-red: #c94f49;
  --sera-red-soft: #fce9e7;
  --sera-blue: #397bb6;
  --sera-blue-soft: #eaf2fb;
  --sidebar-width: 264px;
  --header-height: 76px;
  --shadow-sm: 0 2px 10px rgba(24, 35, 31, 0.05);
  --shadow-md: 0 16px 38px rgba(24, 35, 31, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--sera-bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--sera-ink);
  background:
    radial-gradient(circle at 92% 2%, rgba(185, 215, 93, 0.13), transparent 20rem),
    var(--sera-bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.925rem;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--sera-green);
  text-decoration: none;
}

a:hover {
  color: #0d5433;
}

button,
input,
select,
textarea {
  font: inherit;
}

.skip-link {
  position: fixed;
  top: -4rem;
  left: 1rem;
  z-index: 2000;
  padding: 0.65rem 1rem;
  color: #fff;
  background: var(--sera-ink);
  border-radius: 0.65rem;
}

.skip-link:focus {
  top: 1rem;
}

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1040;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 1.15rem 0.9rem;
  overflow-y: auto;
  color: #e9f4ee;
  background:
    radial-gradient(circle at 15% 0%, rgba(185, 215, 93, 0.16), transparent 16rem),
    #112a20;
  transition: transform 180ms ease;
}

.brand {
  display: flex;
  min-height: 48px;
  align-items: center;
  gap: 0.72rem;
  padding: 0.35rem 0.6rem 1.1rem;
  color: #fff;
}

.brand:hover {
  color: #fff;
}

.brand-logo-icon {
  display: block;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  object-fit: contain;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.18));
}

.brand-name {
  display: block;
  font-size: 1.08rem;
  font-weight: 750;
  letter-spacing: -0.025em;
}

.brand-subtitle {
  display: block;
  margin-top: -0.1rem;
  color: #9fbeae;
  font-size: 0.69rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.nav-section-title {
  padding: 0.9rem 0.7rem 0.35rem;
  color: #79988a;
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: grid;
  gap: 0.2rem;
}

.sidebar-nav a {
  position: relative;
  display: flex;
  min-height: 43px;
  align-items: center;
  gap: 0.72rem;
  padding: 0.68rem 0.78rem;
  color: #bed1c7;
  border-radius: 0.8rem;
  font-weight: 560;
  transition: color 140ms ease, background 140ms ease, transform 140ms ease;
}

.sidebar-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.065);
  transform: translateX(2px);
}

.sidebar-nav a.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(62, 161, 109, 0.35), rgba(62, 161, 109, 0.12));
}

.sidebar-nav a.active::before {
  position: absolute;
  inset: 10px auto 10px -0.9rem;
  width: 3px;
  content: "";
  background: var(--sera-lime);
  border-radius: 0 3px 3px 0;
}

.nav-symbol {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #92b5a3;
  font-size: 1rem;
  line-height: 1;
}

.active .nav-symbol {
  color: var(--sera-lime);
}

.nav-count {
  min-width: 22px;
  margin-left: auto;
  padding: 0.12rem 0.4rem;
  color: #fff;
  background: var(--sera-red);
  border-radius: 999px;
  font-size: 0.69rem;
  text-align: center;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 1rem;
}

.health-card {
  padding: 0.85rem;
  color: #cce0d6;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 0.9rem;
}

.health-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.health-value {
  color: #fff;
  font-weight: 700;
}

.health-track {
  height: 5px;
  margin-top: 0.65rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
}

.health-track span {
  display: block;
  width: 92%;
  height: 100%;
  background: linear-gradient(90deg, var(--sera-green-2), var(--sera-lime));
  border-radius: inherit;
}

.app-main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 2rem;
  background: rgba(244, 246, 242, 0.88);
  border-bottom: 1px solid rgba(215, 223, 217, 0.78);
  backdrop-filter: blur(12px);
}

.topbar-title {
  margin: 0;
  font-size: 1.14rem;
  font-weight: 760;
  letter-spacing: -0.025em;
}

.topbar-path {
  margin: 0.15rem 0 0;
  color: var(--sera-muted);
  font-size: 0.76rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.icon-button,
.mobile-menu {
  display: grid;
  width: 41px;
  height: 41px;
  place-items: center;
  color: var(--sera-ink);
  background: #fff;
  border: 1px solid var(--sera-line);
  border-radius: 0.76rem;
  box-shadow: var(--shadow-sm);
}

.icon-button {
  position: relative;
}

.icon-button .notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  background: var(--sera-red);
  border: 2px solid #fff;
  border-radius: 50%;
}

.mobile-menu {
  display: none;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.62rem;
  padding: 0.35rem 0.7rem 0.35rem 0.36rem;
  color: var(--sera-ink);
  background: #fff;
  border: 1px solid var(--sera-line);
  border-radius: 0.85rem;
  box-shadow: var(--shadow-sm);
}

.avatar {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--sera-green), var(--sera-green-2));
  border-radius: 0.65rem;
  font-size: 0.72rem;
  font-weight: 750;
}

.user-name {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
}

.user-role {
  display: block;
  color: var(--sera-muted);
  font-size: 0.66rem;
}

.page-content {
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
  padding: 1.55rem 2rem 2.5rem;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.35rem;
}

.eyebrow {
  margin-bottom: 0.22rem;
  color: var(--sera-green);
  font-size: 0.68rem;
  font-weight: 760;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2vw, 2.1rem);
  font-weight: 770;
  letter-spacing: -0.045em;
}

.page-heading p {
  max-width: 720px;
  margin: 0.35rem 0 0;
  color: var(--sera-muted);
}

.panel {
  background: var(--sera-panel);
  border: 1px solid rgba(219, 226, 221, 0.92);
  border-radius: 1rem;
  box-shadow: var(--shadow-sm);
}

.panel-header {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid #edf0ed;
}

.panel-title {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 730;
  letter-spacing: -0.015em;
}

.panel-subtitle {
  margin: 0.15rem 0 0;
  color: var(--sera-muted);
  font-size: 0.75rem;
}

.panel-body {
  padding: 1.15rem;
}

.panel-flush {
  overflow: hidden;
}

.stat-card {
  position: relative;
  min-height: 148px;
  padding: 1.1rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(219, 226, 221, 0.92);
  border-radius: 1rem;
  box-shadow: var(--shadow-sm);
}

.stat-card::after {
  position: absolute;
  top: -26px;
  right: -25px;
  width: 92px;
  height: 92px;
  content: "";
  background: var(--accent-soft, var(--sera-green-soft));
  border-radius: 50%;
}

.stat-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.stat-label {
  color: var(--sera-muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.stat-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--accent, var(--sera-green));
  background: var(--accent-soft, var(--sera-green-soft));
  border-radius: 0.8rem;
  font-size: 1.2rem;
}

.stat-value {
  margin-top: 0.65rem;
  font-size: 1.8rem;
  font-weight: 780;
  letter-spacing: -0.05em;
}

.stat-note {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.25rem;
  color: var(--sera-muted);
  font-size: 0.73rem;
}

.trend-up {
  color: var(--sera-green);
  font-weight: 700;
}

.trend-down {
  color: var(--sera-red);
  font-weight: 700;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 0.38rem;
  background: var(--status, var(--sera-green-2));
  border-radius: 50%;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status, var(--sera-green-2)) 15%, transparent);
}

.status-dot.is-offline {
  --status: #97a19c;
}

.status-dot.is-warning {
  --status: var(--sera-amber);
}

.status-dot.is-danger {
  --status: var(--sera-red);
}

.badge-soft {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.3rem 0.55rem;
  color: var(--badge-color, var(--sera-green));
  background: var(--badge-bg, var(--sera-green-soft));
  border: 1px solid color-mix(in srgb, var(--badge-color, var(--sera-green)) 15%, transparent);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge-soft.warning {
  --badge-color: #a96511;
  --badge-bg: var(--sera-amber-soft);
}

.badge-soft.danger {
  --badge-color: #a83d38;
  --badge-bg: var(--sera-red-soft);
}

.badge-soft.neutral {
  --badge-color: #65716b;
  --badge-bg: #eef1ef;
}

.badge-soft.info {
  --badge-color: #2f6fa7;
  --badge-bg: var(--sera-blue-soft);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.metric-tile {
  padding: 0.9rem;
  background: #f8faf8;
  border: 1px solid #e9eeea;
  border-radius: 0.85rem;
}

.metric-label {
  color: var(--sera-muted);
  font-size: 0.7rem;
}

.metric-value {
  margin-top: 0.18rem;
  font-size: 1.2rem;
  font-weight: 760;
  letter-spacing: -0.03em;
}

.metric-range {
  margin-top: 0.22rem;
  color: var(--sera-muted);
  font-size: 0.66rem;
}

.sparkline {
  display: block;
  width: 100%;
  height: 52px;
  margin-top: 0.55rem;
}

.sparkline path.area {
  fill: rgba(38, 149, 103, 0.1);
}

.sparkline polyline {
  fill: none;
  stroke: var(--sera-green-2);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.activity-list,
.alarm-list {
  display: grid;
  gap: 0;
}

.activity-item,
.alarm-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid #edf0ed;
}

.activity-item:last-child,
.alarm-item:last-child {
  border-bottom: 0;
}

.activity-mark {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  color: var(--sera-green);
  background: var(--sera-green-soft);
  border-radius: 0.7rem;
}

.activity-text {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 610;
}

.activity-time {
  margin-top: 0.18rem;
  color: var(--sera-muted);
  font-size: 0.68rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.search-field {
  position: relative;
  min-width: min(290px, 100%);
}

.search-field::before {
  position: absolute;
  top: 50%;
  left: 0.85rem;
  color: #87928c;
  content: "⌕";
  font-size: 1.2rem;
  transform: translateY(-54%);
}

.search-field input {
  min-height: 42px;
  padding-left: 2.35rem;
  background: #fff;
  border-color: var(--sera-line);
  border-radius: 0.75rem;
}

.form-control,
.form-select {
  min-height: 42px;
  border-color: var(--sera-line);
  border-radius: 0.7rem;
}

.form-control:focus,
.form-select:focus {
  border-color: #69ad89;
  box-shadow: 0 0 0 0.22rem rgba(38, 149, 103, 0.12);
}

.form-label {
  color: #39463f;
  font-size: 0.74rem;
  font-weight: 680;
}

.form-hint {
  margin-top: 0.3rem;
  color: var(--sera-muted);
  font-size: 0.68rem;
}

.btn {
  min-height: 40px;
  border-radius: 0.7rem;
  font-size: 0.78rem;
  font-weight: 680;
}

.btn-primary {
  --bs-btn-bg: var(--sera-green);
  --bs-btn-border-color: var(--sera-green);
  --bs-btn-hover-bg: #0f5937;
  --bs-btn-hover-border-color: #0f5937;
  --bs-btn-active-bg: #0c4b2f;
  --bs-btn-active-border-color: #0c4b2f;
}

.btn-outline-secondary {
  --bs-btn-color: #4f5b55;
  --bs-btn-border-color: #d8dfda;
  --bs-btn-hover-color: var(--sera-ink);
  --bs-btn-hover-bg: #eef2ef;
  --bs-btn-hover-border-color: #d8dfda;
}

.table {
  --bs-table-bg: transparent;
  margin: 0;
}

.table > :not(caption) > * > * {
  padding: 0.86rem 1rem;
  border-bottom-color: #edf0ed;
  vertical-align: middle;
}

.table thead th {
  color: var(--sera-muted);
  background: #f8faf8;
  border-bottom-width: 1px;
  font-size: 0.66rem;
  font-weight: 760;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
}

.table tbody tr {
  transition: background 120ms ease;
}

.table tbody tr:hover {
  background: #fbfcfb;
}

.table-primary-cell {
  font-weight: 680;
}

.table-secondary {
  display: block;
  margin-top: 0.14rem;
  color: var(--sera-muted);
  font-size: 0.68rem;
}

.table-link {
  color: var(--sera-ink);
}

.table-link:hover {
  color: var(--sera-green);
}

.empty-state {
  padding: 3rem 1rem;
  color: var(--sera-muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--sera-ink);
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  color: var(--sera-muted);
  border-top: 1px solid #edf0ed;
  font-size: 0.73rem;
}

.pagination-mini {
  display: flex;
  gap: 0.35rem;
}

.pagination-mini button {
  min-width: 34px;
  min-height: 34px;
  color: var(--sera-ink);
  background: #fff;
  border: 1px solid var(--sera-line);
  border-radius: 0.55rem;
}

.pagination-mini button.active {
  color: #fff;
  background: var(--sera-green);
  border-color: var(--sera-green);
}

.tree {
  padding: 0.3rem;
}

.tree ul {
  margin: 0;
  padding-left: 1.25rem;
  list-style: none;
}

.tree > ul {
  padding-left: 0;
}

.tree-branch {
  position: relative;
}

.tree-branch ul::before {
  position: absolute;
  top: 40px;
  bottom: 12px;
  left: 14px;
  content: "";
  border-left: 1px dashed #ccd7d0;
}

.tree-row {
  position: relative;
  display: flex;
  min-height: 43px;
  align-items: center;
  gap: 0.55rem;
  padding: 0.38rem 0.45rem;
  border-radius: 0.7rem;
}

.tree-row:hover,
.tree-row.is-selected {
  background: var(--sera-green-soft);
}

.tree-toggle {
  display: grid;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  place-items: center;
  color: #5d6b64;
  background: transparent;
  border: 0;
  border-radius: 0.4rem;
  transition: transform 140ms ease;
}

.tree-branch.is-collapsed > .tree-row .tree-toggle {
  transform: rotate(-90deg);
}

.tree-branch.is-collapsed > ul {
  display: none;
}

.tree-type-icon {
  display: grid;
  width: 31px;
  height: 31px;
  flex: 0 0 31px;
  place-items: center;
  color: var(--sera-green);
  background: #fff;
  border: 1px solid #dfe9e3;
  border-radius: 0.65rem;
}

.tree-label {
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 650;
}

.tree-meta {
  display: block;
  color: var(--sera-muted);
  font-size: 0.65rem;
  font-weight: 500;
}

.tree-tail {
  margin-left: auto;
}

.detail-list {
  display: grid;
  gap: 0.78rem;
  margin: 0;
}

.detail-list > div {
  display: grid;
  grid-template-columns: 115px minmax(0, 1fr);
  gap: 0.7rem;
  padding-bottom: 0.78rem;
  border-bottom: 1px solid #edf0ed;
}

.detail-list > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.detail-list dt {
  color: var(--sera-muted);
  font-size: 0.71rem;
  font-weight: 570;
}

.detail-list dd {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 650;
  word-break: break-word;
}

.device-summary {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.device-hero-icon {
  display: grid;
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  place-items: center;
  color: var(--sera-green);
  background: var(--sera-green-soft);
  border: 1px solid #d4e9dd;
  border-radius: 1rem;
  font-size: 1.4rem;
}

.device-summary h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 760;
  letter-spacing: -0.035em;
}

.device-summary p {
  margin: 0.2rem 0 0;
  color: var(--sera-muted);
  font-size: 0.75rem;
}

.live-pulse {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  color: var(--sera-green);
  font-size: 0.68rem;
  font-weight: 720;
}

.live-pulse::before {
  width: 8px;
  height: 8px;
  content: "";
  background: var(--sera-green-2);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(38, 149, 103, 0.35);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  65% { box-shadow: 0 0 0 7px rgba(38, 149, 103, 0); }
  100% { box-shadow: 0 0 0 0 rgba(38, 149, 103, 0); }
}

.chart-wrap {
  position: relative;
  min-height: 285px;
}

.chart-canvas {
  display: block;
  width: 100%;
  height: 285px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--sera-muted);
  font-size: 0.7rem;
}

.legend-key {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.legend-key::before {
  width: 14px;
  height: 3px;
  content: "";
  background: var(--key-color, var(--sera-green-2));
  border-radius: 3px;
}

.alarm-severity {
  width: 4px;
  align-self: stretch;
  background: var(--severity, var(--sera-amber));
  border-radius: 5px;
}

.alarm-content {
  min-width: 0;
  flex: 1;
}

.alarm-title {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 720;
}

.alarm-description {
  margin: 0.22rem 0 0;
  color: var(--sera-muted);
  font-size: 0.72rem;
}

.alarm-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  margin-top: 0.45rem;
  color: var(--sera-muted);
  font-size: 0.66rem;
}

.role-stack {
  display: flex;
  margin-left: 0.45rem;
}

.role-stack .avatar {
  width: 28px;
  height: 28px;
  margin-left: -0.45rem;
  border: 2px solid #fff;
  font-size: 0.61rem;
}

.settings-nav {
  display: grid;
  gap: 0.25rem;
}

.settings-nav a {
  padding: 0.7rem 0.8rem;
  color: #54615b;
  border-radius: 0.65rem;
  font-size: 0.76rem;
  font-weight: 620;
}

.settings-nav a.active,
.settings-nav a:hover {
  color: var(--sera-green);
  background: var(--sera-green-soft);
}

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

.calendar {
  min-width: 650px;
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.calendar-title {
  min-width: 175px;
  margin: 0;
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  text-align: center;
  text-transform: capitalize;
}

.calendar-nav {
  display: flex;
  gap: 0.35rem;
}

.calendar-nav button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--sera-ink);
  background: #fff;
  border: 1px solid var(--sera-line);
  border-radius: 0.62rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(82px, 1fr));
  overflow: hidden;
  border-top: 1px solid var(--sera-line);
  border-left: 1px solid var(--sera-line);
  border-radius: 0.85rem;
}

.calendar-weekday {
  padding: 0.62rem 0.45rem;
  color: var(--sera-muted);
  background: #f7f9f7;
  border-right: 1px solid var(--sera-line);
  border-bottom: 1px solid var(--sera-line);
  font-size: 0.65rem;
  font-weight: 760;
  letter-spacing: 0.05em;
  text-align: center;
  text-transform: uppercase;
}

.calendar-day {
  min-height: 104px;
  padding: 0.48rem;
  background: #fff;
  border: 0;
  border-right: 1px solid var(--sera-line);
  border-bottom: 1px solid var(--sera-line);
  text-align: left;
}

.calendar-day:hover {
  background: #f9fbf9;
}

.calendar-day.is-outside {
  color: #a8b0ab;
  background: #fafbfa;
}

.calendar-day.is-today {
  background: #f2f9f5;
  box-shadow: inset 0 0 0 2px rgba(38, 149, 103, 0.35);
}

.calendar-day.is-selected {
  background: var(--sera-green-soft);
}

.calendar-date {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  margin-bottom: 0.3rem;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 680;
}

.calendar-day.is-today .calendar-date {
  color: #fff;
  background: var(--sera-green);
}

.calendar-event {
  display: block;
  margin-top: 0.24rem;
  padding: 0.22rem 0.3rem;
  overflow: hidden;
  color: #155839;
  background: #dff2e7;
  border-left: 3px solid var(--event-color, var(--sera-green-2));
  border-radius: 0.32rem;
  font-size: 0.59rem;
  font-weight: 680;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event.is-disabled {
  color: #76817b;
  background: #eef1ef;
  border-left-color: #9da7a1;
}

.calendar-more {
  display: block;
  margin-top: 0.2rem;
  color: var(--sera-muted);
  font-size: 0.58rem;
  text-align: center;
}

.schedule-list {
  display: grid;
  gap: 0.72rem;
}

.schedule-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(110px, 0.75fr) minmax(120px, 0.8fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem 0.9rem 1.15rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--sera-line);
  border-radius: 0.85rem;
}

.schedule-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  content: "";
  background: var(--schedule-color, var(--sera-green-2));
}

.schedule-card.is-disabled {
  opacity: 0.64;
}

.schedule-name {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 730;
}

.schedule-place,
.schedule-detail {
  display: block;
  margin-top: 0.18rem;
  color: var(--sera-muted);
  font-size: 0.68rem;
}

.schedule-time {
  font-size: 1.05rem;
  font-weight: 760;
  letter-spacing: -0.03em;
}

.schedule-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.4rem;
}

.weekday-picker {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.35rem;
}

.weekday-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.weekday-picker label {
  display: grid;
  min-height: 38px;
  place-items: center;
  color: var(--sera-muted);
  background: #f7f9f7;
  border: 1px solid var(--sera-line);
  border-radius: 0.58rem;
  font-size: 0.68rem;
  font-weight: 700;
  cursor: pointer;
}

.weekday-picker input:checked + label {
  color: #fff;
  background: var(--sera-green);
  border-color: var(--sera-green);
}

.weekday-picker input:focus-visible + label {
  outline: 3px solid rgba(38, 149, 103, 0.2);
  outline-offset: 2px;
}

.upcoming-list {
  display: grid;
}

.upcoming-item {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.65rem;
  padding: 0.78rem 0;
  border-bottom: 1px solid #edf0ed;
}

.upcoming-item:last-child {
  border-bottom: 0;
}

.upcoming-date {
  padding: 0.35rem 0.25rem;
  color: var(--sera-green);
  background: var(--sera-green-soft);
  border-radius: 0.58rem;
  font-size: 0.58rem;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
}

.upcoming-date strong {
  display: block;
  font-size: 0.92rem;
}

.manual-control {
  padding: 1rem;
  color: #eaf7ef;
  background:
    radial-gradient(circle at 85% 0%, rgba(185, 215, 93, 0.18), transparent 12rem),
    #153c2c;
  border-radius: 0.95rem;
}

.manual-control .form-label,
.manual-control .form-hint {
  color: #b8cfc3;
}

.manual-control .form-select,
.manual-control .form-control {
  color: #fff;
  background-color: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

.manual-control .form-select option {
  color: var(--sera-ink);
}

.control-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.control-state strong {
  font-size: 0.9rem;
}

.control-state span {
  color: #b8cfc3;
  font-size: 0.68rem;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  padding: 1rem 0;
  border-bottom: 1px solid #edf0ed;
}

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

.setting-name {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 680;
}

.setting-description {
  max-width: 560px;
  margin: 0.2rem 0 0;
  color: var(--sera-muted);
  font-size: 0.69rem;
}

.form-switch .form-check-input {
  width: 2.6em;
  height: 1.35em;
  border-color: #bdc9c2;
}

.form-check-input:checked {
  background-color: var(--sera-green);
  border-color: var(--sera-green);
}

.dialog {
  width: min(560px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  overflow-y: auto;
  color: var(--sera-ink);
  background: #fff;
  border: 0;
  border-radius: 1rem;
  box-shadow: 0 28px 90px rgba(17, 42, 32, 0.26);
}

.dialog::backdrop {
  background: rgba(15, 27, 22, 0.58);
  backdrop-filter: blur(3px);
}

.dialog-header,
.dialog-body,
.dialog-footer {
  padding: 1rem 1.2rem;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #edf0ed;
}

.dialog-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 730;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  border-top: 1px solid #edf0ed;
}

.toast-stack {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 2000;
  display: grid;
  width: min(360px, calc(100vw - 2rem));
  gap: 0.55rem;
}

.app-toast {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.85rem 0.95rem;
  color: #fff;
  background: #183b2d;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.8rem;
  box-shadow: var(--shadow-md);
  animation: toast-in 180ms ease both;
}

.app-toast.is-error {
  background: #7c302d;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

.toast-text strong {
  display: block;
  font-size: 0.76rem;
}

.toast-text span {
  display: block;
  margin-top: 0.12rem;
  color: rgba(255, 255, 255, 0.76);
  font-size: 0.68rem;
}

.login-page {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(380px, 0.92fr) minmax(520px, 1.35fr);
  background: #f5f7f3;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  width: min(430px, 100%);
}

.login-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 3.2rem;
  color: var(--sera-ink);
}

.login-brand .brand-name {
  font-size: 1.15rem;
}

.login-brand .brand-logo-icon {
  width: 48px;
  height: 48px;
  flex-basis: 48px;
  filter: none;
}

.login-brand .brand-subtitle {
  color: var(--sera-muted);
}

.login-card h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 780;
  letter-spacing: -0.055em;
}

.login-lead {
  margin: 0.55rem 0 1.8rem;
  color: var(--sera-muted);
}

.login-card .form-control {
  min-height: 49px;
  background: #fff;
}

.login-card .btn {
  min-height: 49px;
}

.login-aside {
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 3.2rem;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(155deg, rgba(14, 62, 40, 0.16), rgba(8, 35, 24, 0.86)),
    radial-gradient(circle at 75% 15%, rgba(185, 215, 93, 0.34), transparent 21rem),
    #13482f;
}

.login-aside::before,
.login-aside::after {
  position: absolute;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
}

.login-aside::before {
  top: 8%;
  right: -11%;
  width: 64vw;
  height: 64vw;
}

.login-aside::after {
  top: 21%;
  right: 5%;
  width: 38vw;
  height: 38vw;
}

.greenhouse-lines {
  position: absolute;
  inset: 0;
  opacity: 0.42;
  background:
    linear-gradient(67deg, transparent 49.7%, rgba(255,255,255,.15) 50%, transparent 50.3%),
    linear-gradient(113deg, transparent 49.7%, rgba(255,255,255,.15) 50%, transparent 50.3%);
  background-size: 240px 150px;
}

.login-aside-content {
  position: relative;
  z-index: 1;
  max-width: 630px;
}

.login-aside h2 {
  max-width: 540px;
  margin: 0;
  font-size: clamp(2rem, 4vw, 4.3rem);
  font-weight: 760;
  letter-spacing: -0.065em;
  line-height: 1.02;
}

.login-aside p {
  max-width: 530px;
  margin: 1.2rem 0 1.6rem;
  color: rgba(255, 255, 255, 0.72);
  font-size: 1rem;
}

.login-proof {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.login-proof span {
  padding: 0.45rem 0.7rem;
  color: #e9f8ef;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  font-size: 0.7rem;
  backdrop-filter: blur(5px);
}

.api-note {
  padding: 0.72rem 0.8rem;
  color: #55625b;
  background: #f5f8f5;
  border: 1px dashed #cdd9d1;
  border-radius: 0.7rem;
  font-size: 0.68rem;
}

.loading-bar {
  position: fixed;
  inset: 0 auto auto 0;
  z-index: 3000;
  width: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--sera-green), var(--sera-lime));
  transition: width 200ms ease, opacity 180ms ease;
}

.loading-bar.is-loading {
  width: 72%;
}

.loading-bar.is-complete {
  width: 100%;
  opacity: 0;
}

.place-items-center {
  place-items: center;
}

.sidebar-scrim {
  display: none;
}

@media (max-width: 1199.98px) {
  .page-content,
  .topbar {
    padding-right: 1.35rem;
    padding-left: 1.35rem;
  }
}

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 1030;
    display: block;
    visibility: hidden;
    background: rgba(12, 23, 18, 0.5);
    opacity: 0;
    transition: opacity 180ms ease, visibility 180ms ease;
  }

  .sidebar-scrim.is-visible {
    visibility: visible;
    opacity: 1;
  }

  .app-main {
    margin-left: 0;
  }

  .mobile-menu {
    display: grid;
  }

  .login-page {
    grid-template-columns: 1fr;
  }

  .login-aside {
    display: none;
  }
}

@media (max-width: 767.98px) {
  :root {
    --header-height: 66px;
  }

  body {
    font-size: 0.875rem;
  }

  .topbar {
    padding: 0.55rem 0.85rem;
  }

  .topbar-path,
  .user-meta {
    display: none;
  }

  .page-content {
    padding: 1rem 0.85rem 2rem;
  }

  .page-heading {
    align-items: flex-start;
    flex-direction: column;
    margin-bottom: 1rem;
  }

  .page-heading-actions {
    display: flex;
    width: 100%;
    gap: 0.5rem;
  }

  .page-heading-actions .btn {
    flex: 1;
  }

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

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

  .toolbar,
  .search-field {
    width: 100%;
  }

  .toolbar .form-select {
    min-width: 0 !important;
    flex: 1;
  }

  .table-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .chart-wrap,
  .chart-canvas {
    min-height: 230px;
    height: 230px;
  }

  .setting-row {
    align-items: flex-start;
  }

  .schedule-card {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .schedule-card > :nth-child(2),
  .schedule-card > :nth-child(3) {
    grid-column: 1;
  }

  .schedule-actions {
    grid-column: 2;
    grid-row: 1 / span 3;
    flex-direction: column;
  }

  .login-panel {
    padding: 1.25rem;
  }

  .login-brand {
    margin-bottom: 2.3rem;
  }
}

@media (max-width: 479.98px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .device-summary {
    align-items: flex-start;
  }

  .detail-list > div {
    grid-template-columns: 90px minmax(0, 1fr);
  }
}

@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;
  }
}

@media print {
  .sidebar,
  .topbar,
  .page-heading-actions,
  .toolbar,
  .btn {
    display: none !important;
  }

  .app-main {
    margin: 0;
  }

  .page-content {
    max-width: none;
    padding: 0;
  }

  .panel,
  .stat-card {
    box-shadow: none;
  }
}
