.app-shell[hidden],
.login-screen[hidden] {
  display: none;
}

.topbar-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.topbar-logo {
  display: block;
  width: min(38vw, 148px);
  max-height: 40px;
  object-fit: contain;
}

.topbar-logo-link {
  display: flex;
  align-items: center;
  margin: auto 0;
  padding-bottom: 10px;
}

.topbar-title {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}

.topbar-title h1 {
  color: #7a8580;
  font-size: 1rem;
  line-height: 1.2;
}

.topbar-menu-button {
  display: none;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  gap: 8px;
}

.sidebar-scrim {
  display: none;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #d7e2dc;
}

.main-nav {
  display: grid;
  gap: 4px;
}

.main-nav a {
  display: block;
  border-radius: 6px;
  padding: 10px 12px;
  color: #17211c;
  text-decoration: none;
}

.main-nav a:hover,
.main-nav a.active {
  background: #e7eee9;
}

.nav-irrigation-status {
  display: flex;
  align-items: center;
  min-height: 40px;
  margin-top: 12px;
  border-left: 4px solid #d44c3d;
  border-radius: 6px;
  padding: 8px 10px;
  background: #fff0e8;
  color: #8f2f27;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.4;
}

.alarm-bar {
  display: grid;
  gap: 8px;
  padding: 10px 16px;
  background: #fff0e8;
  border-bottom: 1px solid #e7b59e;
}

.alarm-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
}

.is-abnormal {
  border-color: #d44c3d !important;
  background: #fff1ee !important;
  color: #7a271a;
}

.is-abnormal dt,
.is-abnormal .card-head span,
.health-monitor-job-row.is-abnormal span,
.is-abnormal .diagnostic-message {
  color: #9d3b32;
}

.panel.is-abnormal,
.table-row.is-abnormal,
.health-monitor-job-row.is-abnormal,
.health-monitor-diagnostic.is-abnormal,
.diagnostic-checks div.is-abnormal,
.simple-row.is-abnormal {
  box-shadow: 0 0 0 2px rgba(212, 76, 61, 0.12);
}

.section-head,
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-head h3 {
  margin: 0;
}

.section-head {
  margin-bottom: 16px;
}

.section-head.compact {
  margin-bottom: 8px;
}

.view-stack {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.view-stack > .section-head,
.view-stack > .summary-grid,
.view-stack > #dashboard-camera-grid {
  margin-bottom: 0;
}

#view-health-monitor .health-monitor-overview,
#view-health-monitor .health-monitor-job-list,
#view-health-monitor .health-monitor-diagnostic-list,
#view-health-monitor .table-list {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

#view-health-monitor .health-monitor-card {
  margin-bottom: 0;
}

#view-health-monitor .panel > .section-head.compact {
  margin-bottom: 0;
}

#view-health-monitor .panel h3,
#view-health-monitor .health-monitor-card h3 {
  margin: 10px;
}

.content-grid,
.summary-grid,
.camera-grid,
.device-grid,
.health-monitor-overview {
  display: grid;
  gap: 30px;
}

.content-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.summary-grid {
  margin-bottom: 16px;
}

.dashboard-status-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  border: 1px solid #d7e2dc;
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
}

.dashboard-status-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding-left: 14px;
  color: #31433a;
}

.dashboard-status-item::before {
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 0;
  width: 1px;
  background: #d7e2dc;
  content: "";
}

.dashboard-status-item.is-line-start {
  padding-left: 0;
}

.dashboard-status-item.is-line-start::before {
  display: none;
}

.dashboard-status-item span,
.dashboard-status-item small {
  color: #5b6a62;
  font-size: 0.86rem;
}

.dashboard-status-item small {
  color: #7b8982;
}

.dashboard-status-item strong {
  min-width: 1.3em;
  color: #1f3f31;
  font-size: 1.05rem;
  line-height: 1;
  text-align: right;
}

.dashboard-status-item.is-count {
  gap: 8px;
}

.dashboard-status-item.is-count.is-alert strong {
  color: #b42318;
}

.dashboard-storage-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dashboard-storage-panel .card-head {
  align-items: center;
}

.dashboard-storage-panel .card-head span {
  color: #5b6a62;
  font-size: 0.9rem;
}

.storage-usage-bar {
  display: flex;
  width: 100%;
  min-height: 22px;
  overflow: hidden;
  border: 1px solid #cad8d1;
  border-radius: 8px;
  background: #ffffff;
}

.storage-segment {
  min-width: 0;
}

.storage-segment.is-free,
.storage-swatch.is-free {
  background: #ffffff;
}

.storage-segment.is-other,
.storage-swatch.is-other {
  background: #a8dbe8;
}

.storage-segment.is-recordings,
.storage-swatch.is-recordings {
  background: #2e7d59;
}

.storage-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: #4f6158;
  font-size: 0.88rem;
}

.storage-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.storage-swatch {
  display: inline-flex;
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  border: 1px solid #cad8d1;
  border-radius: 3px;
}

.status-dot {
  display: inline-flex;
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 999px;
  background: #2e7d59;
}

.status-dot.is-warning {
  background: #c68a1a;
}

.status-dot.is-alert {
  background: #b42318;
}

.camera-grid,
.device-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.camera-grid {
  grid-template-columns: repeat(var(--camera-columns, 1), minmax(0, 1fr));
}

#irrigation-grid {
  justify-content: flex-start;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}

#irrigation-grid .device-card {
  width: 100%;
  max-width: 400px;
}

#dashboard-camera-grid {
  margin-bottom: 16px;
}

.emergency-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  border: 2px solid #b42318;
  border-radius: 8px;
  padding: 14px;
  background: #fff1ee;
  color: #7a271a;
}

.emergency-panel h3,
.emergency-panel p {
  margin: 0;
}

.emergency-panel p {
  margin-top: 4px;
  font-weight: 700;
}

.emergency-panel.is-active {
  animation: emergency-alert-pulse 1.2s ease-in-out infinite;
}

.danger-button {
  border-color: #b42318;
  background: #b42318;
  color: #ffffff;
  font-weight: 800;
}

.primary-button {
  background: #3158d4;
}

.primary-button:hover {
  background: #2547b1;
}

.button-like {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid #0f7f62;
  border-radius: 6px;
  background: #0f7f62;
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

.button-like:hover,
.button-like:focus-visible {
  background: #0b6f55;
}

.snapshot-frame {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 8px;
  background: #eef3ef;
  color: #5b6a62;
}

.snapshot-frame img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #17211c;
}

.stream-frame img {
  object-fit: contain;
}

.ptz-pad button {
  touch-action: none;
  user-select: none;
}

.snapshot-frame.is-paused {
  background: #f5f1e9;
  color: #6e5b30;
}

.camera-card {
  cursor: pointer;
}

.camera-card:focus-visible {
  outline: 3px solid #80b9a8;
  outline-offset: 2px;
}

.ptz-pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(64px, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.ptz-pad button {
  min-height: 48px;
  font-weight: 800;
}

.ptz-pad button:nth-child(1) {
  grid-column: 2;
}

.ptz-pad button:nth-child(2) {
  grid-column: 1;
}

.ptz-pad button:nth-child(3) {
  grid-column: 2;
}

.ptz-pad button:nth-child(4) {
  grid-column: 3;
}

.ptz-pad button:nth-child(5) {
  grid-column: 2;
}

.device-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 88px;
  margin: 12px 0;
  border-radius: 8px;
  background: #eef3f0;
  font-weight: 800;
}

.device-state strong {
  font-size: 2rem;
  line-height: 1;
}

.device-state-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
}

.device-state button {
  min-height: 34px;
  padding: 6px 18px;
}

.device-card {
  position: relative;
}

.device-card.is-menu-open {
  z-index: 30;
}

.device-card-menu {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 40;
}

.kebab-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 999px;
  background: #eef3f0;
  color: #405047;
  font-size: 1.25rem;
  line-height: 1;
}

.device-card-menu-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  min-width: 132px;
  border: 1px solid #d7e2dc;
  border-radius: 8px;
  padding: 6px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(28, 51, 39, 0.14);
}

.device-card-menu-popover button {
  justify-content: flex-start;
  width: 100%;
  background: transparent;
  color: #17211c;
}

.device-card.is-on {
  border-color: #d44c3d;
  box-shadow: 0 0 0 2px rgba(212, 76, 61, 0.12);
  animation: device-alert-pulse 1.6s ease-in-out infinite;
}

.device-card.is-on .device-state {
  background: #fff0e8;
  color: #9d3b32;
}

.device-alert {
  margin: 12px 0 0;
  border-left: 4px solid #d44c3d;
  padding: 8px 10px;
  background: #fff7f2;
  color: #8f2f27;
  font-weight: 700;
}

.valve-visual {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  align-items: center;
  height: 118px;
  margin: 12px 0;
  overflow: hidden;
  border-radius: 8px;
  background: #f6f8f7;
}

.valve-water {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 50%;
  height: 18px;
  border-radius: 999px;
  transform: translateY(-50%);
  opacity: 0;
}

.valve-open .valve-water {
  opacity: 1;
  background:
    repeating-linear-gradient(90deg,
      #1ca7d8 0,
      #1ca7d8 18px,
      #78d4ef 18px,
      #78d4ef 34px);
  background-size: 68px 18px;
  animation: water-flow 0.8s linear infinite;
}

.valve-pipe {
  z-index: 1;
  height: 28px;
  background: #17211c;
}

.valve-pipe-left {
  margin-left: 18px;
}

.valve-pipe-right {
  margin-right: 18px;
}

.valve-body {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  height: 58px;
  border-radius: 8px;
  background: #17211c;
}

.valve-body::before,
.valve-body::after {
  content: "";
  position: absolute;
  top: -8px;
  width: 14px;
  height: 74px;
  background: #17211c;
}

.valve-body::before {
  left: 8px;
}

.valve-body::after {
  right: 8px;
}

.valve-blocker {
  width: 16px;
  height: 72px;
  border-radius: 4px;
  background: #d44c3d;
  transform: rotate(0deg);
  opacity: 0.92;
}

.valve-open .valve-blocker {
  height: 20px;
  width: 70px;
  background: #1ca7d8;
}

.valve-stem {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 15px;
  width: 12px;
  height: 28px;
  border-radius: 999px;
  background: #17211c;
  transform: translateX(-50%);
}

.valve-handle {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 13px;
  width: 86px;
  height: 8px;
  border-radius: 999px;
  background: #17211c;
  transform: translateX(-50%);
}

.valve-cap {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 42px;
  width: 44px;
  height: 8px;
  border-radius: 999px 999px 0 0;
  border-top: 8px solid #17211c;
  transform: translateX(-50%);
}

.valve-open .valve-handle {
  animation: valve-handle-alert 1.6s ease-in-out infinite;
}

.meta-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.meta-list div,
.simple-row,
.event-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #edf2ef;
}

.meta-list dt {
  color: #5b6a62;
  font-size: 0.84rem;
}

.meta-list dd {
  margin: 0;
  text-align: right;
}

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

#dashboard-irrigation .pill.off {
  background: #dff3e8;
  color: #23664e;
}

#dashboard-irrigation .pill.on {
  background: #fae5df;
  color: #9d3b32;
}

.event-list,
.list,
.health-monitor-job-list,
.table-list {
  display: grid;
  gap: 4px;
}

.event-row,
.table-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}

.audit-log-filter-panel {
  overflow: hidden;
  padding: 0;
}

.audit-log-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 38px;
  border-radius: 0;
  padding: 8px 12px;
  background: #f3faf6;
  cursor: pointer;
  user-select: none;
}

.audit-log-filter-head:hover,
.audit-log-filter-head:focus {
  background: #eaf6ef;
  outline: none;
}

.audit-log-filter-head h3 {
  margin: 0;
  color: #25332d;
  font-size: 0.95rem;
  font-weight: 800;
}

.audit-log-filter-arrow {
  display: inline-flex;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  align-items: center;
  justify-content: center;
}

.audit-log-filter-arrow::before {
  display: block;
  width: 9px;
  height: 9px;
  border-right: 2px solid #226b55;
  border-bottom: 2px solid #226b55;
  content: "";
  transform: translateY(-2px) rotate(45deg);
}

.audit-log-filter-head.is-open .audit-log-filter-arrow::before {
  transform: translateY(2px) rotate(225deg);
}

.audit-log-filter-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 16px;
  padding: 16px;
}

.audit-log-filter-form>label {
  display: flex;
  width: min(100%, 240px);
  flex-direction: column;
  gap: 6px;
  color: #5b6a62;
  font-size: 0.86rem;
  font-weight: 700;
}

.system-log-filter-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 16px;
}

.system-log-filter-form label {
  display: flex;
  width: min(100%, 180px);
  flex-direction: column;
  gap: 6px;
  color: #5b6a62;
  font-size: 0.86rem;
  font-weight: 700;
}

.audit-log-filter-group {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  border: 1px solid #d8e3dd;
  border-radius: 8px;
  padding: 10px 12px;
}

.audit-log-filter-group legend {
  padding: 0 4px;
  color: #5b6a62;
  font-size: 0.86rem;
  font-weight: 700;
}

.audit-log-check-options {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.audit-log-check-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #25332d;
  font-size: 0.78rem;
  font-weight: 600;
}

.audit-log-check-options input {
  margin: 0;
  width: 13px;
  height: 13px;
}

.audit-log-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.audit-log-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 16px;
  align-items: center;
  border-left: 4px solid #b8c7bf;
  border-bottom: 1px solid #edf2ef;
  padding: 12px 0 12px 12px;
}

.audit-log-row.is-alert {
  border-left-color: #c68a1a;
}

.audit-log-row.is-critical {
  border-left-color: #b42318;
}

.audit-log-main,
.audit-log-meta,
.audit-log-sub {
  min-width: 0;
}

.audit-log-main {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.audit-log-main strong,
.audit-log-main span {
  overflow-wrap: anywhere;
}

.audit-log-main strong {
  color: #17211c;
}

.audit-log-main span,
.audit-log-sub {
  color: #5f7067;
  font-size: 0.86rem;
}

.audit-log-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  color: #5b6a62;
  font-size: 0.82rem;
}

.audit-log-meta span,
.audit-log-meta time {
  border-radius: 999px;
  padding: 3px 8px;
  background: #eef3f0;
  white-space: nowrap;
}

.audit-log-sub {
  grid-column: 1 / -1;
}

.audit-log-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-bottom: 18px;
}

.audit-log-pager-bottom {
  margin-top: 18px;
  margin-bottom: 0;
}

.audit-log-pager button {
  display: inline-flex;
  width: 38px;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 6px;
  font-size: 0.95rem;
  line-height: 1;
}

.pager-arrow {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
}

.pager-arrow::before {
  display: block;
  width: 8px;
  height: 8px;
  border-top: 2px solid #f2fff8;
  border-right: 2px solid #f2fff8;
  content: "";
}

.pager-arrow-left::before {
  transform: rotate(225deg);
}

.pager-arrow-right::before {
  transform: rotate(45deg);
}

.audit-log-pager span {
  color: #5b6a62;
  font-size: 0.88rem;
  font-weight: 700;
}

.audit-log-range-label {
  margin-right: auto;
}

.system-log-range-label {
  margin-right: auto;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: end;
  gap: 12px;
}

.inline-form label,
.toolbar label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.inline-form label.inline {
  display: flex;
  align-items: center;
  min-height: 38px;
}

.inline-form input,
.inline-form select,
.toolbar select {
  width: 100%;
}

.table-row {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #edf2ef;
}

.table-row strong,
.table-row span,
.table-row time {
  overflow-wrap: anywhere;
}

.table-row .button-row {
  justify-content: end;
}

.recording-row {
  grid-template-columns: minmax(180px, 1.2fr) minmax(160px, 1fr) minmax(90px, auto) minmax(130px, auto);
}

#recording-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.recording-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.recording-thumb {
  position: relative;
  display: flex;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 8px;
  background: #17221d;
  color: #fff;
  text-decoration: none;
}

.recording-thumb-link {
  display: flex;
  width: 100%;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.recording-thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #17221d;
}

.recording-delete-button {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  background: #c9362b;
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(23, 33, 28, 0.28);
}

.recording-delete-button:hover {
  background: #a92d24;
}

.recording-delete-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.recording-duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(11, 16, 13, 0.82);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
}

.recording-card-body {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.recording-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.recording-card-head>div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.recording-card-head strong,
.recording-card-head span {
  overflow-wrap: anywhere;
}

.recording-card-head strong {
  color: #17251e;
  font-size: 0.98rem;
}

.recording-card-head span {
  color: #66766e;
  font-size: 0.86rem;
}

.recording-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 0;
  color: #304039;
  font-size: 0.88rem;
}

.recording-meta div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.recording-meta dt {
  flex: 0 0 auto;
  color: #6a7a72;
}

.recording-meta dd {
  min-width: 0;
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
}

.schedule-row {
  grid-template-columns: minmax(180px, 1fr) minmax(130px, auto) minmax(90px, auto) minmax(150px, auto);
}

.schedule-board {
  display: grid;
  gap: 14px;
  border: 1px solid #d7e2dc;
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfb;
  box-shadow: 0 12px 28px rgba(28, 51, 39, 0.06);
}

.schedule-board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.schedule-board-head h3,
.schedule-board-head p,
.modal-head h3 {
  margin: 0;
}

.schedule-board-head p {
  margin-top: 4px;
  color: #65746c;
  font-size: 0.88rem;
}

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

.schedule-card {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  min-height: 86px;
  border: 1px solid #dfe8e3;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
  box-shadow: 0 8px 22px rgba(28, 51, 39, 0.05);
}

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

.schedule-time {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 148px;
  min-height: 58px;
  padding: 0 12px;
  border-radius: 8px;
  background: #eef3ff;
  color: #3158d4;
}

.schedule-time strong {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

.schedule-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.schedule-main strong {
  overflow-wrap: anywhere;
}

.schedule-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.schedule-meta span {
  border-radius: 999px;
  padding: 4px 8px;
  background: #f1f5f3;
  color: #4f6057;
  font-size: 0.78rem;
  font-weight: 700;
}

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

.section-head .icon-button {
  flex: 0 0 36px;
  font-size: 1.25rem;
  line-height: 1;
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid #d7e2dc;
  border-radius: 999px;
  background: #ffffff;
  color: #405047;
}

.icon-button:hover {
  background: #eef3f0;
}

.icon-button.danger {
  border-color: #f0c4bd;
  color: #b42318;
}

.icon-button.danger:hover {
  background: #fff1ee;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toggle-control {
  display: inline-grid;
  place-items: center;
  min-width: 48px;
}

.toggle-control input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.toggle-control span {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #cdd8d2;
  transition: background 0.16s ease;
}

.toggle-control span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(23, 33, 28, 0.22);
  content: "";
  transition: transform 0.16s ease;
}

.toggle-control input:checked+span {
  background: #24b26b;
}

.toggle-control input:checked+span::after {
  transform: translateX(20px);
}

.modal-dialog {
  width: min(520px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: #ffffff;
  box-shadow: 0 28px 70px rgba(20, 31, 26, 0.34);
}

.modal-dialog::backdrop {
  background: rgba(24, 34, 29, 0.48);
}

.modal-dialog form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px;
}

.modal-dialog .modal-form {
  padding: 18px;
}

.modal-head,
.field-wide,
.weekday-selector,
.modal-dialog .channel-settings,
.inline-confirm-panel,
.modal-dialog .button-row,
.modal-dialog .message {
  grid-column: 1 / -1;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.modal-head button {
  display: grid;
  place-items: center;
  width: 32px;
  min-height: 32px;
  padding: 0;
  border: 1px solid #d7e2dc;
  background: #ffffff;
  color: #425049;
}

.device-event-dialog {
  width: min(680px, calc(100vw - 32px));
}

.device-event-dialog .modal-form {
  display: flex;
  flex-direction: column;
  max-height: min(720px, 86vh);
}

.device-event-dialog-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  overflow-y: auto;
}

.device-event-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  border-bottom: 1px solid #edf2ef;
  padding: 10px 0;
}

.device-event-row>div {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.device-event-row strong,
.device-event-row span,
.device-event-row time,
.device-event-row p {
  overflow-wrap: anywhere;
}

.event-type-manual {
  color: #171b19;
}

.event-type-emergency {
  color: #b42318;
}

.device-event-row p {
  grid-column: 1 / -1;
  margin: 0;
  color: #8f2f27;
}

.device-event-row p:empty {
  display: none;
}

.inline-confirm-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 4px solid #c68a1a;
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff8e8;
  color: #5f4314;
}

.inline-confirm-panel strong {
  color: #5a3900;
}

.inline-confirm-panel p {
  margin: 0;
}

.weekday-selector {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.weekday-selector legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  color: #17211c;
  font-size: 0.9rem;
  font-weight: 650;
}

.weekday-selector label {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 38px;
  border: 1px solid #d7e2dc;
  border-radius: 6px;
  background: #f7faf8;
  font-weight: 800;
  cursor: pointer;
}

.weekday-selector input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
}

.weekday-selector label:has(input:checked) {
  border-color: #3158d4;
  background: #eef3ff;
  color: #3158d4;
}

.alarm-table-row {
  grid-template-columns: minmax(220px, 1.4fr) minmax(130px, auto) minmax(120px, auto) minmax(150px, auto);
}

.event-setting-row {
  grid-template-columns: minmax(220px, 1fr) minmax(120px, auto);
}

.email-recipient-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.email-recipient-form label {
  display: flex;
  flex: 1 1 220px;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.email-recipient-form input {
  width: 100%;
}

.email-recipient-form .message {
  flex: 1 0 100%;
}

.email-recipient-row {
  grid-template-columns: minmax(180px, 1fr) auto;
}

.email-recipient-row .button-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: nowrap;
}

.email-recipient-test-button {
  border-color: #d2a62c;
  background: #fff4c2;
  color: #a36f00;
}

.email-recipient-test-button:hover {
  border-color: #b98700;
  background: #f5df91;
  color: #765100;
}

.email-recipient-test-button .email-test-arrow {
  fill: currentColor;
  stroke: none;
}

.pill {
  display: inline-grid;
  place-items: center;
  min-width: 54px;
  border-radius: 999px;
  padding: 4px 8px;
  background: #e7eee9;
  color: #33423a;
  font-size: 0.8rem;
  font-weight: 700;
}

.pill.ok,
.pill.online,
.pill.on {
  background: #dff3e8;
  color: #23664e;
}

.pill.error,
.pill.critical,
.pill.offline,
.pill.off,
.pill.stopped {
  background: #fae5df;
  color: #9d3b32;
}

.pill.running {
  background: #e1edff;
  color: #2c5799;
}

.pill.pending,
.pill.unknown,
.pill.skipped {
  background: #eef3f0;
  color: #5b6a62;
}

.pill.stale {
  background: #fff1c9;
  color: #806217;
}

.pill.warning {
  background: #fff1c9;
  color: #806217;
}

.health-monitor-card {
  margin-bottom: 16px;
}

.health-monitor-job-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(360px, 2fr);
  gap: 16px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #edf2ef;
}

.health-monitor-job-row strong,
.health-monitor-job-row span {
  display: block;
}

.health-monitor-job-row span {
  margin-top: 4px;
  color: #5b6a62;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.health-monitor-job-row dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(90px, 1fr));
  gap: 8px;
  margin: 0;
}

.health-monitor-job-row dt {
  color: #5b6a62;
  font-size: 0.78rem;
}

.health-monitor-job-row dd {
  margin: 2px 0 0;
}

.health-monitor-diagnostic-list {
  display: grid;
  gap: 14px;
}

.health-monitor-diagnostic {
  display: grid;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid #edf2ef;
}

.health-monitor-diagnostic h4,
.health-monitor-diagnostic p {
  margin: 0;
}

.acknowledged-alarm-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 0;
  border: 2px solid #35a854;
  border-radius: 50%;
  background: #ffffff;
  color: #35a854;
}

.acknowledged-alarm-button:hover,
.acknowledged-alarm-button:focus-visible {
  border-color: #24843e;
  background: #edf9f0;
  color: #24843e;
}

.acknowledged-alarm-button span {
  width: 9px;
  height: 16px;
  margin-top: -4px;
  border-right: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: rotate(45deg);
}

.acknowledged-alarm-dialog {
  width: min(760px, calc(100vw - 32px));
}

.acknowledged-alarm-dialog .modal-form {
  display: flex;
  flex-direction: column;
  max-height: min(720px, 86vh);
}

.acknowledged-alarm-dialog-list {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
}

.acknowledged-alarm-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0;
  border-bottom: 1px solid #edf2ef;
}

.acknowledged-alarm-row > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.acknowledged-alarm-row > div span {
  color: #5b6a62;
  font-size: 0.88rem;
}

.acknowledged-alarm-row dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.acknowledged-alarm-row dt {
  color: #69776f;
  font-size: 0.76rem;
}

.acknowledged-alarm-row dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.health-monitor-diagnostic p {
  color: #5b6a62;
}

.diagnostic-message {
  color: #17211c;
  font-weight: 700;
}

.diagnostic-checks {
  display: grid;
  gap: 8px;
  margin: 0;
}

.diagnostic-checks div {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.diagnostic-checks dt {
  color: #5b6a62;
  font-size: 0.84rem;
}

.diagnostic-checks dd {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  overflow-wrap: anywhere;
}

.diagnostic-commands {
  display: grid;
  gap: 6px;
}

.diagnostic-commands code {
  display: block;
  overflow-x: auto;
  border-radius: 6px;
  padding: 8px;
  background: #f3f7f4;
  color: #17211c;
  white-space: pre;
}

.settings-form {
  display: grid;
  gap: 18px;
}

.system-setting-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
}

.system-setting-row h3 {
  margin: 0;
  white-space: nowrap;
}

.registered-valve-control {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
}

.system-camera-reboot-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.system-camera-reboot-control select {
  min-width: 180px;
}

.system-camera-reboot-control select,
.system-camera-reboot-control button {
  height: 40px;
}

.system-camera-reboot-control button {
  white-space: nowrap;
}

.registered-valve-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-width: 0;
}

.registered-valve-summary span {
  min-width: 0;
  color: #17211c;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.registered-valve-summary strong {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 40px;
  border: 1px solid #b8d5c8;
  border-radius: 8px;
  padding: 8px 12px;
  background: #eef8f3;
  color: #1f6d53;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1;
}

.registered-valve-summary em {
  color: #7b8982;
  font-style: normal;
}

.muted {
  margin: 6px 0 0;
  color: #5b6a62;
}

.channel-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.channel-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 62px;
  border: 1px solid #d7e2dc;
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.channel-option input {
  width: 18px;
  height: 18px;
}

.channel-option span {
  display: grid;
  gap: 2px;
}

.channel-option small {
  color: #5b6a62;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed #bdcbc4;
  border-radius: 8px;
  color: #5b6a62;
  text-align: center;
}

.empty-state.small {
  min-height: 80px;
}

.confirm-dialog {
  width: min(460px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 20px;
}

.confirm-dialog::backdrop {
  background: rgba(23, 33, 28, 0.52);
}

@keyframes water-flow {
  from {
    background-position: 0 0;
  }

  to {
    background-position: 68px 0;
  }
}

@keyframes device-alert-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 2px rgba(212, 76, 61, 0.12);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(212, 76, 61, 0.2);
  }
}

@keyframes valve-handle-alert {

  0%,
  100% {
    transform: translateX(-50%) scaleX(1);
  }

  50% {
    transform: translateX(-50%) scaleX(1.08);
  }
}

@keyframes emergency-alert-pulse {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(180, 35, 24, 0.18);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(180, 35, 24, 0.2);
  }
}

@media (prefers-reduced-motion: reduce) {

  .device-card.is-on,
  .emergency-panel.is-active,
  .valve-open .valve-water,
  .valve-open .valve-handle {
    animation: none;
  }
}

@media (max-width: 860px) {
  .topbar {
    align-items: center;
    flex-direction: row;
    justify-content: space-between;
  }

  .topbar-title {
    display: none;
  }

  .topbar-logo {
    width: min(52vw, 150px);
    max-height: 36px;
  }

  .topbar-menu-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-height: 40px;
    padding: 8px;
    gap: 5px;
    background: #226b55;
  }

  .topbar-menu-button span {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: #ffffff;
  }

  .topbar-actions,
  .alarm-item,
  .event-row,
  .recording-row,
  .schedule-row,
  .alarm-table-row,
  .event-setting-row,
  .email-recipient-row,
  .emergency-panel,
  .health-monitor-job-row {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .email-recipient-row .button-row {
    justify-content: flex-start;
  }

  .acknowledged-alarm-row dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
  }

  .topbar-actions .session-summary {
    display: block;
    max-width: none;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 8;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    width: min(82vw, 320px);
    height: 100vh;
    height: 100dvh;
    max-height: none;
    padding: 80px 16px 20px;
    border-right: 1px solid #d7e2dc;
    background: #ffffff;
    box-shadow: 18px 0 48px rgba(28, 51, 39, 0.18);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .sidebar .main-nav {
    flex: 0 0 auto;
    overflow-y: visible;
    padding-bottom: 0;
  }

  .sidebar-footer {
    flex: 0 0 auto;
    margin-top: auto;
    padding-top: 20px;
    background: #ffffff;
  }

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

  .sidebar-scrim {
    position: fixed;
    inset: 0;
    z-index: 7;
    display: block;
    background: rgba(23, 33, 28, 0.36);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease;
  }

  .app-shell.sidebar-open .sidebar-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .health-monitor-job-row dl {
    grid-template-columns: repeat(2, minmax(90px, 1fr));
  }

  .system-setting-row,
  .registered-valve-control,
  .system-camera-reboot-control {
    align-items: flex-start;
    flex-direction: column;
  }

  .system-camera-reboot-control select {
    width: 100%;
  }

  .diagnostic-checks div {
    grid-template-columns: 1fr;
  }

  .schedule-card,
  .modal-dialog form,
  .camera-grid {
    grid-template-columns: 1fr;
  }

  .schedule-time {
    min-width: 0;
    justify-items: start;
    justify-content: flex-start;
    padding: 10px 12px;
  }

  .toggle-control {
    justify-items: start;
  }

  .weekday-selector {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
