﻿:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --line: #d9e0e8;
  --line-strong: #b8c4d2;
  --text: #18212d;
  --muted: #647386;
  --ok: #16805a;
  --ok-bg: #e4f5ee;
  --warn: #a86800;
  --warn-bg: #fff2cf;
  --danger: #b42318;
  --danger-bg: #fde7e4;
  --accent: #0a66c2;
  --accent-dark: #074f97;
  --focus: #7db7ff;
  font-family: Arial, Helvetica, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

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

.shell {
  min-height: 100vh;
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-areas:
    "top top"
    "summary summary"
    "error error"
    "main detail";
  gap: 14px;
}

.topbar {
  grid-area: top;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-bottom: 4px;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.top-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.primary {
  min-height: 36px;
  border: 1px solid var(--accent-dark);
  border-radius: 6px;
  padding: 0 14px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.primary:hover {
  background: var(--accent-dark);
}

.secondary {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 12px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

.primary:disabled,
.secondary:disabled,
.small-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 9px;
  background: #fff;
  color: var(--accent-dark);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
}

.small-button:hover {
  background: #eef6ff;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.detail-head-actions {
  margin-top: 10px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.primary:focus-visible,
.secondary:focus-visible,
.small-button:focus-visible,
.icon-button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.neutral,
.pill.neutral {
  color: #3f4f63;
  background: #e8edf3;
}

.badge.ok,
.pill.ok {
  color: var(--ok);
  background: var(--ok-bg);
}

.badge.warn,
.pill.warn {
  color: var(--warn);
  background: var(--warn-bg);
}

.badge.danger,
.pill.danger {
  color: var(--danger);
  background: var(--danger-bg);
}

.pill.offline {
  color: #4d5c6f;
  background: #e8edf3;
}

.status-cell {
  display: grid;
  gap: 5px;
  min-width: 170px;
  max-width: 230px;
}

.status-cell .pill {
  justify-self: start;
}

.status-reason {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  white-space: normal;
}

.warning-reason-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-left: 4px solid var(--warn);
  background: var(--warn-bg);
}

.warning-reason-notice strong {
  font-size: 13px;
  line-height: 1.4;
}

.summary {
  grid-area: summary;
  display: grid;
  grid-template-columns: repeat(7, minmax(110px, 1fr));
  gap: 10px;
}

.metric {
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.metric strong {
  display: block;
  font-size: 22px;
  line-height: 1.1;
}

.metric.ok {
  border-color: #acdcca;
}

.metric.warn {
  border-color: #f4cf75;
}

.metric.danger {
  border-color: #f0aaa3;
}

.metric.offline {
  border-color: #b8c4d2;
  background: #f1f4f7;
}

.metric-filter {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.metric-filter:hover {
  border-color: #8799ac;
  background: #f4f7fa;
}

.metric-filter.active {
  border-color: #536f8c;
  background: #eaf0f6;
  box-shadow: inset 0 0 0 1px #536f8c;
}

.metric-filter.ok.active {
  border-color: var(--ok);
  background: var(--ok-bg);
  box-shadow: inset 0 0 0 1px var(--ok);
}

.metric-filter.warn.active {
  border-color: var(--warn);
  background: var(--warn-bg);
  box-shadow: inset 0 0 0 1px var(--warn);
}

.metric-filter.danger.active {
  border-color: var(--danger);
  background: var(--danger-bg);
  box-shadow: inset 0 0 0 1px var(--danger);
}

.metric-filter.offline.active {
  border-color: #627386;
  background: #dde5ed;
  box-shadow: inset 0 0 0 1px #627386;
}

.error-box {
  grid-area: error;
  border: 1px solid #e7b5ae;
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--danger-bg);
  color: var(--danger);
}

.workspace {
  grid-area: main;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.bulk-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
}

.update-overview {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.update-overview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.update-card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.update-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfe;
  color: inherit;
  font: inherit;
  text-align: left;
}

.update-card-filter {
  cursor: pointer;
}

.update-card-filter:hover {
  border-color: #8799ac;
  background: #f4f7fa;
}

.update-card-filter.active {
  border-color: #536f8c;
  background: #eaf0f6;
  box-shadow: inset 0 0 0 1px #536f8c;
}

.update-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.update-card-grid {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 5px 8px;
  align-items: baseline;
  font-size: 12px;
}

.update-card-grid span {
  color: var(--muted);
  font-weight: 700;
}

.update-card-grid strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-info {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.selection-info.warn {
  color: var(--danger);
}

label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.search {
  flex: 1;
  min-width: 260px;
}

input,
select,
textarea {
  min-height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
  color: var(--text);
}

textarea {
  padding: 9px 10px;
  line-height: 1.4;
  resize: vertical;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 300px);
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1760px;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3f8;
  color: #415164;
  font-size: 12px;
  font-weight: 700;
}

.sort-header {
  min-height: 24px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.sort-header::after {
  content: "";
  display: inline-block;
  width: 14px;
  color: var(--accent);
}

.sort-header.active[data-dir="asc"]::after {
  content: "▲";
}

.sort-header.active[data-dir="desc"]::after {
  content: "▼";
}

.sort-header.active[data-dir="asc"]::after {
  content: " ^";
}

.sort-header.active[data-dir="desc"]::after {
  content: " v";
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.active {
  background: #eef6ff;
}

.select-col {
  width: 42px;
  text-align: center;
}

.select-col input {
  min-height: 0;
  width: 16px;
  height: 16px;
  padding: 0;
}

.select-col input:disabled {
  cursor: not-allowed;
}

.main-cell {
  display: grid;
  gap: 2px;
}

.strong {
  font-weight: 700;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.mono {
  font-family: Consolas, "Courier New", monospace;
}

.version {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.version-cell {
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.update-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 130px;
  border-radius: 6px;
  padding: 0 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}

.update-chip.ok {
  color: var(--ok);
  background: var(--ok-bg);
}

.update-chip.warn {
  color: var(--warn);
  background: var(--warn-bg);
}

.update-chip.neutral {
  color: var(--muted);
  background: #eef1f5;
}

.note-cell {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 74px;
}

.note-marker {
  width: 11px;
  height: 11px;
  flex: 0 0 11px;
  border: 1px solid #aab7c5;
  border-radius: 50%;
  background: #fff;
}

.note-marker.open {
  border-color: #8a6100;
  background: #ffd400;
}

.note-marker.onsite {
  border-color: #b42318;
  background: #d92d20;
}

.note-marker.info {
  border-color: #175cd3;
  background: #2e90fa;
}

.note-marker.resolved {
  border-color: #aab7c5;
  background: #fff;
}

.job-panel {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  background: #fbfcfe;
}

.job-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.job-steps {
  display: grid;
  gap: 6px;
}

.job-step {
  display: grid;
  grid-template-columns: 190px 70px 170px 80px minmax(180px, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  background: #fff;
  font-size: 12px;
}

.job-step.running {
  border-color: #f4cf75;
  background: #fffaf0;
}

.job-step.succeeded {
  border-color: #acdcca;
  background: #f3fbf7;
}

.job-step.failed {
  border-color: #f0aaa3;
  background: #fff4f2;
}

.job-step.skipped {
  color: var(--muted);
}

.fix-job-panel {
  background: #f5f9fd;
}

.fix-job-head {
  margin-bottom: 10px;
}

.fix-action {
  display: grid;
  gap: 6px;
  min-width: 210px;
}

.fix-action .small-button {
  justify-self: start;
}

.fix-progress {
  display: grid;
  gap: 4px;
  min-width: 200px;
  max-width: 560px;
  color: var(--text);
  font-size: 12px;
  line-height: 1.35;
}

.fix-progress progress {
  width: 100%;
  height: 8px;
  accent-color: var(--accent);
}

.fix-progress.complete {
  color: var(--ok);
}

.fix-progress.failed {
  color: var(--danger);
}

.fix-progress.failed progress {
  accent-color: var(--danger);
}

.fix-job-message {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.audit-panel {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  background: #fbfcfe;
}

.audit-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.audit-table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.audit-table {
  min-width: 980px;
  font-size: 12px;
}

.audit-table td {
  vertical-align: top;
}

.audit-group-row td {
  background: #eef3f8;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-weight: 700;
}

.audit-group-row .muted {
  margin-left: 8px;
  font-weight: 500;
}

.type-cell {
  width: 48px;
  font-weight: 700;
  white-space: nowrap;
}

.detail-panel {
  grid-area: detail;
  align-self: start;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.detail-empty {
  padding: 18px;
  color: var(--muted);
}

.detail-head {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.detail-head h2 {
  margin: 6px 0 2px;
  font-size: 17px;
}

.detail-body {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.kv {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px;
  align-items: baseline;
}

.kv span:first-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.detail-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.detail-section h3 {
  margin: 0 0 8px;
  font-size: 13px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(24 33 45 / 48%);
}

.modal-dialog {
  position: relative;
  width: min(1080px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: 16px auto;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 24px 70px rgb(24 33 45 / 30%);
}

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

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

.hems-suggestions-modal {
  z-index: 20;
}

.hems-suggestions-dialog {
  width: min(980px, calc(100vw - 32px));
}

.modal-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hems-assignments-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.hems-assignments-table {
  min-width: 520px;
}

.hems-assignments-table tbody tr {
  cursor: default;
}

.hems-assignments-table td {
  vertical-align: top;
}

.hems-assignments-table td:first-child {
  min-width: 240px;
}

.hems-assignments-table td:first-child > * {
  display: block;
}

.hems-assignments-table td:first-child > * + * {
  margin-top: 4px;
}

.hems-assignments-table code {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.hems-suggestion-summary,
.hems-suggestion-actions,
.hems-suggestion-confirmation {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 11px 12px;
  background: #fbfcfe;
}

.hems-suggestion-summary > div,
.hems-suggestion-confirmation > div:first-child {
  display: grid;
  gap: 4px;
}

.hems-suggestion-summary span,
.hems-suggestion-confirmation span,
.hems-suggestion-selection-status {
  color: var(--muted);
  font-size: 12px;
}

.hems-suggestion-selection {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
}

.hems-suggestion-selection input,
.hems-suggestion-table input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
}

.hems-suggestion-table-wrap {
  overflow: auto;
  max-height: min(52vh, 520px);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.hems-suggestion-table {
  min-width: 800px;
}

.hems-suggestion-table tbody tr {
  cursor: default;
}

.hems-suggestion-table th:first-child,
.hems-suggestion-table td:first-child {
  width: 48px;
  text-align: center;
}

.hems-suggestion-table td {
  vertical-align: top;
}

.hems-suggestion-table td:nth-child(2),
.hems-suggestion-table td:nth-child(3) {
  min-width: 150px;
}

.hems-suggestion-table td:nth-child(2) > *,
.hems-suggestion-table td:nth-child(3) > * {
  display: block;
}

.hems-suggestion-table td:nth-child(2) > * + *,
.hems-suggestion-table td:nth-child(3) > * + * {
  margin-top: 4px;
}

.hems-suggestion-table code {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.hems-suggestion-confirmation {
  border-color: #f4cf75;
  background: #fffaf0;
}

.hems-suggestion-confirmation[hidden] {
  display: none;
}

.hems-suggestion-confirmation-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.hems-suggestion-batch-status {
  min-height: 18px;
  font-size: 12px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.modal-head h2 {
  margin: 0 0 4px;
  font-size: 18px;
}

.modal-body {
  min-height: 0;
  overflow: auto;
  padding: 14px;
  display: grid;
  gap: 14px;
}

.modal-body .error-box {
  grid-area: auto;
}

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

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

.recommendation-item {
  border-left: 4px solid var(--line-strong);
  padding: 10px 12px;
  background: #f7f9fb;
  line-height: 1.45;
}

.recommendation-item.warn {
  border-left-color: #e7bd20;
  background: #fffbe0;
}

.recommendation-item strong {
  display: block;
  margin-bottom: 4px;
}

.manufacturer-data-notice {
  border-left: 4px solid #e7bd20;
  padding: 8px 10px;
  background: #fffbe0;
  color: var(--text);
  line-height: 1.4;
}

.setting-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfe;
}

.setting-card-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0;
}

.setting-card-split-battery {
  grid-column: span 2;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.setting-card-segment {
  min-width: 0;
  padding: 10px;
}

.setting-card-segment + .setting-card-segment {
  border-left: 1px solid var(--line);
}

.setting-card.ok {
  border-color: #acdcca;
  background: #f3fbf7;
}

.setting-card.warn {
  border-color: #f4cf75;
  background: #fffaf0;
}

.setting-card.unknown {
  color: var(--muted);
}

.setting-card span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.setting-card strong {
  display: block;
  min-height: 22px;
  overflow-wrap: anywhere;
}

.setting-card code {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
}

.settings-section {
  display: grid;
  gap: 8px;
}

.settings-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.power-limit-header-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.power-limit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.power-limit-toggle input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: var(--accent);
}

.settings-section h3 {
  margin: 0;
  font-size: 14px;
}

.hems-assignment-section {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

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

.hems-serial-field {
  display: grid;
  flex: 1 1 280px;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.hems-serial-field input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 7px 9px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 15px;
}

.hems-serial-field input:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 18%, transparent);
  outline-offset: 1px;
}

.hems-serial-field input:disabled {
  background: var(--bg);
  color: var(--text);
  opacity: 1;
}

.hems-save-confirmation {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  border-top: 1px dashed var(--line-strong);
  padding-top: 10px;
}

.hems-save-confirmation[hidden] {
  display: none;
}

.hems-save-confirmation > div:first-child {
  display: grid;
  flex: 1 1 300px;
  gap: 4px;
}

.hems-save-confirmation span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.hems-confirmation-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.hems-serial-save-status {
  min-height: 18px;
  font-size: 12px;
}

.battery-wakeup-section {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.battery-wakeup-action-row {
  align-items: flex-end;
  flex-wrap: wrap;
}

.battery-wakeup-action-row > div {
  display: grid;
  gap: 4px;
}

.battery-wakeup-status {
  min-height: 18px;
  font-size: 12px;
  font-weight: 700;
}

.battery-wakeup-status.idle {
  color: var(--muted);
}

.battery-wakeup-status.pending {
  color: var(--accent);
}

.battery-wakeup-status.success {
  color: var(--ok);
}

.battery-wakeup-status.error {
  color: var(--danger);
}

.power-limits-section {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.power-limits-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

.power-limit-field {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
}

.power-limit-field > span:first-child {
  min-height: 34px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.power-limit-field code {
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.power-limit-control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 34px;
}

.power-limit-control strong {
  font-size: 18px;
}

.power-limit-control span {
  color: var(--muted);
  font-size: 11px;
}

.power-limit-input {
  width: min(100%, 150px);
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 6px 9px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
}

.power-limit-input:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent) 18%, transparent);
  outline-offset: 1px;
}

.power-limit-input:invalid {
  border-color: var(--danger);
}

.power-limit-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.power-limit-save-status {
  margin-right: auto;
  font-size: 12px;
}

.error-text {
  color: var(--danger);
  font-weight: 700;
}

.diagnostics-result {
  display: grid;
  gap: 8px;
}

.diagnostics-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ct-diagnostics-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.ct-action-row {
  align-items: flex-end;
  flex-wrap: wrap;
}

.ct-controls,
.ct-days-control {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.ct-days-control {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.ct-days-control select {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 0 30px 0 9px;
  background: #fff;
  color: var(--text);
}

.ct-diagnostic-reason {
  line-height: 1.4;
}

.ct-phase-table {
  min-width: 900px;
}

.ct-window-table {
  min-width: 1120px;
}

.ct-window-table td:nth-child(n+2):nth-child(-n+7) {
  white-space: nowrap;
}

.settings-table-wrap {
  overflow: auto;
  max-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.settings-table {
  min-width: 620px;
}

.settings-table th,
.settings-table td {
  padding: 7px 9px;
  font-size: 12px;
}

.settings-table td {
  vertical-align: top;
}

.settings-table code {
  overflow-wrap: anywhere;
}

.battery-modules-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.battery-module-table-wrap {
  max-height: 300px;
}

.battery-module-table {
  min-width: 480px;
}

.battery-module-table th:first-child,
.battery-module-table td:first-child {
  width: 64px;
  text-align: center;
}

.battery-module-table th:nth-child(3),
.battery-module-table td:nth-child(3) {
  width: 100px;
  text-align: right;
}

.open-events-section {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.open-events-table-wrap {
  max-height: 300px;
}

.open-events-table {
  min-width: 680px;
}

.open-events-table th:first-child,
.open-events-table td:first-child {
  width: 150px;
  white-space: nowrap;
}

.open-events-table th:nth-child(2),
.open-events-table td:nth-child(2) {
  width: 96px;
}

.open-events-table th:nth-child(3),
.open-events-table td:nth-child(3) {
  width: 70px;
  text-align: center;
}

.notes-compose {
  display: grid;
  gap: 10px;
}

.notes-input {
  width: 100%;
  min-height: 116px;
}

.notes-flag-options {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.notes-flag-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  font-weight: 600;
}

.notes-flag-check input {
  width: 17px;
  height: 17px;
  margin: 0;
}

.notes-flag-check.onsite input {
  accent-color: #d92d20;
}

.notes-flag-check.info input {
  accent-color: #1570ef;
}

.notes-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

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

.note-entry {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfe;
}

.note-entry.open {
  border-color: #e7bd20;
  background: #fffbe0;
}

.note-entry.open.onsite {
  border-color: #f0a6a0;
  background: #fff5f4;
}

.note-entry.open.info {
  border-color: #84adff;
  background: #eff8ff;
}

.note-entry.resolved {
  border-color: #acdcca;
}

.note-entry-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.note-entry-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.note-flag-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  border-radius: 4px;
  padding: 0 7px;
  color: var(--muted);
  background: #eef1f5;
  font-size: 12px;
  font-weight: 700;
}

.note-flag-toggle.onsite.active {
  color: var(--danger);
  background: var(--danger-bg);
}

.note-flag-toggle.info.active {
  color: #175cd3;
  background: #eff8ff;
}

.note-flag-toggle.resolved.active {
  color: var(--ok);
  background: var(--ok-bg);
}

.note-flag-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
}

.note-flag-toggle.onsite input {
  accent-color: #d92d20;
}

.note-flag-toggle.info input {
  accent-color: #1570ef;
}

.note-flag-toggle.resolved input {
  accent-color: var(--ok);
}

.note-entry-meta {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.note-delete-button {
  min-height: 26px;
  color: var(--danger);
}

.note-delete-button:hover {
  background: var(--danger-bg);
}

.note-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "top"
      "summary"
      "error"
      "main"
      "detail";
  }

  .summary {
    grid-template-columns: repeat(3, minmax(120px, 1fr));
  }

  .detail-panel {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .setting-card-split-battery {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .setting-card-split-battery .setting-card-segment + .setting-card-segment {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

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

  .power-limit-field > span:first-child {
    min-height: 0;
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 12px;
  }

  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .bulk-actions {
    margin-left: 0;
    flex-wrap: wrap;
  }

  .update-overview-head {
    display: grid;
  }

  .top-actions {
    justify-content: space-between;
  }

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

  .search {
    min-width: 0;
  }

  .job-step {
    grid-template-columns: 1fr;
  }
}
