:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --line: rgba(0, 0, 0, .08);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --purple: #0071e3;
  --blue: #0071e3;
  --green: #34c759;
  --yellow: #ff9f0a;
  --red: #ff3b30;
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

.hidden { display: none !important; }

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: #f5f5f7;
  color: var(--text);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}
body.sidebar-collapsed .shell { grid-template-columns: 78px 1fr; }
body.sidebar-collapsed .brand strong,
body.sidebar-collapsed .side-nav button b,
body.sidebar-collapsed .next-check { display: none; }
body.sidebar-collapsed .side-nav button { justify-content: center; padding: 0; }
body.sidebar-collapsed .brand { justify-content: center; }

button, input, select { font: inherit; }
button { cursor: pointer; }
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 10%, rgba(124, 77, 255, .26), transparent 38%),
    rgba(4, 8, 13, .94);
  backdrop-filter: blur(18px);
}
.login-overlay.show { display: grid; }
.login-card {
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(20, 32, 43, .96), rgba(10, 16, 24, .98));
  box-shadow: 0 30px 90px rgba(0, 0, 0, .55);
}
.login-brand { margin-bottom: 18px; }
.login-card h1 { margin: 0 0 20px; font-size: 26px; }
.login-card label { display: grid; gap: 7px; margin-bottom: 12px; color: var(--muted); }
.login-card input {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 14, 20, .58);
  color: var(--text);
  padding: 0 12px;
}
.login-card button { width: 100%; margin-top: 8px; }

.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(247, 249, 252, .92));
  backdrop-filter: saturate(180%) blur(20px);
}

.brand, .topbar, .profile, .mobile-title, .metric, .asic-card, .feed-row {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  min-height: 52px;
  padding: 6px 8px;
  font-size: 18px;
  border-radius: 12px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: #1d1d1f;
  box-shadow: 0 10px 22px rgba(0, 0, 0, .12);
}

.side-nav {
  display: grid;
  gap: 5px;
  margin-top: 18px;
  padding: 8px;
  border: 1px solid #ececf1;
  border-radius: 16px;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 8px 28px rgba(15, 23, 42, .04);
}
.side-nav button {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 0;
  border-radius: 10px;
  color: #3a3a3c;
  background: transparent;
  text-align: left;
  font-weight: 700;
}
.side-nav button span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  color: #6e6e73;
  background: transparent;
}
.side-nav button.active {
  color: white;
  background: #0071e3;
  box-shadow: 0 10px 20px rgba(0, 113, 227, .2);
}
.side-nav button.active span {
  color: #fff;
  background: rgba(255, 255, 255, .16);
}
.side-nav button:hover:not(.active) {
  background: #f5f5f7;
  color: #0071e3;
}

.next-check {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 18px;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 2px 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid #ececf1;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .06);
}
.next-check > span {
  display: grid;
  place-items: center;
  grid-row: span 2;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #0071e3;
  background: rgba(0, 113, 227, .1);
}
.next-check small, .profile span, .mobile-title span, .metric small, .panel h2 span { color: var(--muted); }
.next-check b { display: block; margin-top: 2px; font-size: 15px; }

.workspace { min-width: 0; }
.topbar {
  height: 70px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 15, 22, .74);
  backdrop-filter: blur(20px);
}
.top-spacer { flex: 1; }
.farm-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 220px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(148, 163, 184, .08);
}
.farm-switch span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.farm-switch select {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  outline: none;
}
.light-mode .farm-switch select { color: #1d1d1f; }
.farm-add-btn {
  height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(0, 113, 227, .22);
  border-radius: 10px;
  background: rgba(0, 113, 227, .1);
  color: var(--blue);
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 8px 20px rgba(0, 113, 227, .08);
}
.farm-add-btn:hover {
  background: rgba(0, 113, 227, .16);
  box-shadow: 0 12px 26px rgba(0, 113, 227, .14);
}
.icon-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #e2e8f0;
}
.icon-btn:hover { border-color: var(--line); background: rgba(148, 163, 184, .08); }
.notify em {
  position: absolute;
  right: 3px;
  top: 3px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--red);
  color: white;
  font-size: 11px;
  font-style: normal;
  line-height: 18px;
}

.profile {
  gap: 10px;
  margin-left: 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  padding: 4px 8px;
}
.avatar {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6b7280, #334155);
}
.profile b, .profile span { display: block; font-size: 13px; }
.profile span { font-size: 12px; }

.content { padding: 24px; }
.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
}
.metric {
  justify-content: space-between;
  min-height: 102px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(31, 44, 58, .82), rgba(15, 24, 33, .86));
  box-shadow: 0 20px 44px rgba(0, 0, 0, .2);
}
.metric-clickable {
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.metric-clickable:hover,
.metric-clickable:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(0, 113, 227, .32);
  box-shadow: 0 22px 48px rgba(0, 0, 0, .25);
  outline: none;
}
.metric h3 { margin: 0 0 8px; font-size: 13px; font-weight: 500; color: #e5edf7; }
.metric strong { display: block; font-size: 30px; line-height: 1; }
.metric .accent-purple { color: #8d69ff; }
.metric .accent-yellow { color: var(--yellow); }
.metric .accent-red { color: var(--red); }
.metric .accent-green { color: var(--green); }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(20, 32, 43, .82), rgba(12, 20, 29, .9));
  box-shadow: 0 20px 50px rgba(0, 0, 0, .22);
  overflow: hidden;
}
.analytics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(330px, .75fr);
  gap: 14px;
  margin-top: 14px;
}
.panel-head, .toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}
.panel h2 { margin: 0; font-size: 16px; }
.panel canvas { width: 100%; }
.chart-panel canvas { padding: 0 18px 18px; }
.chart-panel { height: 330px; }
.chart-panel canvas {
  display: block;
  height: 240px !important;
  max-height: 240px;
}
select, .search input {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(8, 14, 20, .64);
  color: var(--text);
  padding: 0 12px;
}

.legend { display: grid; gap: 12px; }
.legend-row { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: center; color: #dbe6f2; }
.swatch { width: 10px; height: 10px; border-radius: 50%; }
.zec-panel { min-height: 330px; }
.zec-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 18px 8px;
}
.zec-summary div {
  min-height: 78px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 14, 20, .38);
}
.zec-summary span,
.market-source,
.market-hint {
  color: var(--muted);
  font-size: 12px;
}
.zec-summary strong,
.zec-summary b {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  line-height: 1;
}
.zec-summary small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}
.zec-summary .positive { color: var(--green); }
.zec-summary .negative { color: var(--red); }
.zec-panel canvas {
  display: block;
  height: 150px !important;
  max-height: 150px;
  padding: 0 18px;
}
.market-hint {
  margin: 4px 18px 16px;
  line-height: 1.35;
}
.model-strip {
  margin-top: 14px;
}
.model-bar {
  display: flex;
  align-items: center;
  width: calc(100% - 36px);
  height: 44px;
  margin: 0 18px 18px;
  overflow: hidden;
  border-radius: 14px;
  background: #f5f5f7;
  box-shadow: inset 0 0 0 1px var(--line);
}
.model-bar-segment {
  display: block;
  min-width: 8px;
  height: 100%;
}
.model-bar-empty {
  display: grid;
  place-items: center;
  width: 100%;
  color: #6e6e73;
  font-size: 13px;
}
.model-strip-legend {
  grid-template-columns: repeat(auto-fit, minmax(190px, max-content));
  align-items: center;
  gap: 12px 26px;
  padding: 0 18px 20px;
}

.schedule-panel {
  margin-top: 14px;
}
body:not([data-view="schedule"]) .schedule-panel {
  display: none;
}
body[data-view="schedule"] .metric-grid,
body[data-view="schedule"] .analytics-grid,
body[data-view="schedule"] .model-strip,
body[data-view="schedule"] .asic-panel,
body[data-view="schedule"] .bottom-grid {
  display: none;
}
body[data-view="asics"] .analytics-grid,
body[data-view="asics"] .model-strip,
body[data-view="asics"] .bottom-grid {
  display: none;
}
.schedule-status {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.schedule-toolbar {
  display: grid;
  grid-template-columns: minmax(190px, 1.2fr) minmax(170px, 1fr) auto auto;
  gap: 10px;
  align-items: end;
  padding: 0 18px 14px;
}
.schedule-toolbar label {
  display: grid;
  gap: 6px;
}
.schedule-toolbar label span {
  color: var(--muted);
  font-size: 12px;
}
.schedule-main-toggle {
  min-height: 46px;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 14, 20, .38);
}
.schedule-main-toggle span {
  color: var(--text) !important;
  font-weight: 800;
}
.schedule-toolbar input:not([type="checkbox"]) {
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 14, 20, .58);
  color: var(--text);
  outline: none;
}
.schedule-toolbar button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(10, 16, 24, .58);
  padding: 0 16px;
  font-weight: 800;
}
.schedule-rows {
  display: grid;
  grid-template-columns: repeat(7, minmax(128px, 1fr));
  gap: 10px;
  padding: 0 18px 12px;
}
.schedule-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 14, 20, .38);
}
.schedule-day-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
}
.schedule-row label:not(.schedule-day-toggle) {
  display: grid;
  gap: 5px;
}
.schedule-row label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.schedule-row input[type="time"] {
  width: 100%;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 14, 20, .58);
  color: var(--text);
}
.schedule-panel .hint {
  margin: 0;
  padding: 0 18px 18px;
}

.asic-panel { margin-top: 14px; }
.toolbar { flex-wrap: wrap; }
.tabs button, .actions button, .link-btn, .modal-actions button {
  height: 38px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(10, 16, 24, .58);
  color: var(--text);
  padding: 0 14px;
}
.tabs .active { background: rgba(124, 77, 255, .18); border-color: rgba(124, 77, 255, .5); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.danger-soft { color: #ff817d !important; border-color: rgba(239, 68, 68, .55) !important; }
.blue-soft { color: #78b8ff !important; border-color: rgba(47, 156, 255, .45) !important; }
.green-soft { color: #61e982 !important; border-color: rgba(54, 221, 95, .42) !important; }
.search { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.search input { width: 220px; }

.table-wrap { overflow-x: auto; padding: 0 18px 18px; }
table { width: 100%; min-width: 1080px; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: #aebbd0; font-weight: 500; background: rgba(4, 9, 14, .36); }
th:last-child,
td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  width: 174px;
  min-width: 174px;
  background: var(--panel);
  box-shadow: -10px 0 18px rgba(15, 23, 42, .06);
}
th:last-child { z-index: 3; }
.compact-col,
.compact-data {
  width: 64px;
  max-width: 72px;
  text-align: center;
}
.compact-col .sort-btn {
  justify-content: center;
  text-align: center;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
}
.status-pill.online { color: var(--green); background: rgba(54, 221, 95, .12); }
.status-pill.offline { color: var(--red); background: rgba(239, 68, 68, .12); }
.status-pill.problem { color: var(--red); background: rgba(239, 68, 68, .14); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.online { background: var(--green); box-shadow: 0 0 14px rgba(54, 221, 95, .75); }
.dot.offline { background: var(--red); box-shadow: 0 0 14px rgba(239, 68, 68, .7); }
.dot.problem { background: var(--red); box-shadow: 0 0 14px rgba(239, 68, 68, .75); }
.row-actions {
  display: inline-flex;
  gap: 6px;
  justify-content: flex-end;
  padding: 4px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, .05);
}
.row-actions button {
  display: grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  color: #1d1d1f;
  background: #f5f5f7;
  font-size: 13px;
  font-weight: 800;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.row-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, .12);
}
.row-actions button i { font-style: normal; font-size: 14px; line-height: 1; }
.row-actions .action-check { background: rgba(0, 113, 227, .1); color: #0071e3; }
.row-actions .action-locate { background: rgba(52, 199, 89, .14); color: #188038; }
.row-actions .action-reboot { background: rgba(255, 159, 10, .14); color: #9a5a00; }
.row-actions .action-stop { background: rgba(255, 59, 48, .1); color: #b42318; }
.row-actions .action-start { background: rgba(52, 199, 89, .14); color: #188038; }
.row-actions .action-info { background: #f5f5f7; color: #3a3a3c; }
.row-actions .action-delete { background: rgba(255, 59, 48, .1); color: #ff3b30; }
.row-actions button:disabled { opacity: .35; cursor: not-allowed; transform: none; box-shadow: none; }

.mobile-list { display: none; }
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 14px;
}
.feed { padding: 0 18px 10px; }
.feed-row {
  gap: 14px;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
  color: #dbe6f2;
}
.feed-row p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.feed-row time { margin-left: auto; color: #aeb7c2; font-size: 12px; }
.link-btn { margin: 0 0 16px 18px; color: #9b7cff; border: 0; background: transparent; padding: 0; }

.bottom-nav, .mobile-only { display: none; }
dialog {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
}
dialog::backdrop { background: rgba(1, 5, 10, .72); backdrop-filter: blur(8px); }
.modal-card {
  width: min(420px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111b25;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
}
.modal-card h3 { margin: 12px 0 8px; }
.modal-card p { color: var(--muted); }
.modal-icon { font-size: 30px; color: var(--yellow); }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.detail-card .modal-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px;
}
.detail-card .modal-actions button {
  width: 100%;
  min-width: 0;
  padding-inline: 12px;
  white-space: nowrap;
}
.modal-actions .danger { background: rgba(239, 68, 68, .9); border-color: transparent; }
.modal-actions .ghost { background: transparent; }
.small-btn { min-width: 34px; padding: 0 !important; }
.compact { padding: 0 0 14px; }
.detail-card {
  width: min(860px, calc(100vw - 32px));
  max-height: calc(100vh - 36px);
  overflow: auto;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 20px;
}
.detail-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 14, 20, .38);
}
.detail-item span { display: block; color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.detail-boards,
.detail-boards-empty {
  grid-column: 1 / -1;
}
.detail-boards h4 {
  margin: 4px 0 10px;
}
.detail-boards-hint {
  margin: -2px 0 12px;
  color: var(--muted);
  font-size: 13px;
}
.detail-boards-hint.danger {
  padding: 10px 12px;
  border: 1px solid rgba(239, 68, 68, .24);
  border-radius: 8px;
  color: var(--red);
  background: rgba(239, 68, 68, .08);
}
.detail-boards-empty {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(8, 14, 20, .22);
}
.detail-fans {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 14, 20, .28);
}
.detail-fans span {
  color: var(--muted);
  font-size: 12px;
}
.boards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.board-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 14, 20, .38);
}
.board-card.pending {
  border-style: dashed;
  opacity: .78;
}
.board-card.warm {
  border-color: rgba(245, 158, 11, .45);
}
.board-card.hot {
  border-color: rgba(239, 68, 68, .55);
  background: rgba(239, 68, 68, .08);
}
.board-card.bad {
  border-color: rgba(239, 68, 68, .7);
  background: rgba(239, 68, 68, .1);
}
.board-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.board-card-head span {
  color: var(--muted);
  font-size: 12px;
}
.board-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.board-metrics span {
  display: grid;
  gap: 3px;
}
.board-metrics small {
  color: var(--muted);
  font-size: 11px;
}
.board-metrics b {
  font-size: 13px;
}
.form-card { width: min(560px, calc(100vw - 32px)); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.form-grid label, .bulk-field {
  display: grid;
  gap: 7px;
}
.form-grid label span, .bulk-field span, .hint {
  color: var(--muted);
  font-size: 13px;
}
.form-grid input, .bulk-field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 14, 20, .58);
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}
.pool-card { width: min(860px, calc(100vw - 32px)); }
.pool-update-modes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 14px;
}
.pool-update-modes label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid #dbe4ee;
  border-radius: 8px;
  background: #f8fafc;
  font-weight: 700;
}
.pool-update-modes input { width: 18px; height: 18px; }
.profile-card { width: min(760px, calc(100vw - 32px)); }
.farm-create-result {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid rgba(52, 199, 89, .28);
  border-radius: 8px;
  background: rgba(52, 199, 89, .08);
}
.farm-create-result span {
  color: var(--muted);
  font-size: 12px;
}
.farm-create-result code {
  display: block;
  overflow-wrap: anywhere;
  padding: 9px 10px;
  border-radius: 8px;
  background: rgba(8, 14, 20, .48);
}
.profile-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 14, 20, .38);
}
.avatar.big {
  width: 54px;
  height: 54px;
  font-size: 22px;
}
.profile-summary b,
.profile-summary span {
  display: block;
}
.profile-summary span {
  margin-top: 4px;
  color: var(--muted);
}
.profile-sections {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}
.profile-sections h4 {
  margin: 0 0 12px;
}
.full-btn {
  width: 100%;
  height: 42px;
  margin-top: 12px;
}
.farm-download-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 14, 20, .38);
}
.farm-download-card b,
.farm-download-card span {
  display: block;
}
.farm-download-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}
.farm-download-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.download-btn {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
}
.inline-confirm-link {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  margin-top: 8px;
  padding: 0 12px;
  border: 1px solid rgba(52, 199, 89, .28);
  border-radius: 8px;
  background: rgba(52, 199, 89, .12);
  color: var(--green);
  font-weight: 800;
  text-decoration: none;
}
.panel-users-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}
.panel-user-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 14, 20, .38);
}
.panel-user-row b,
.panel-user-row span {
  display: block;
}
.panel-user-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.panel-user-row button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 0 10px;
  font-weight: 700;
}
.user-form {
  margin-top: 8px;
}
.pool-grid {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}
.pool-row {
  display: grid;
  grid-template-columns: 44px minmax(210px, 1.5fr) minmax(160px, 1fr) minmax(90px, .55fr);
  gap: 8px;
  align-items: center;
}
.pool-head {
  color: var(--muted);
  font-size: 12px;
  padding: 0 10px;
}
.pool-row b {
  display: grid;
  place-items: center;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(8, 14, 20, .38);
}
.pool-row input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 14, 20, .58);
  color: var(--text);
  padding: 0 11px;
  outline: none;
}
.pool-row input:focus {
  border-color: rgba(124, 77, 255, .72);
  box-shadow: 0 0 0 3px rgba(124, 77, 255, .14);
}
.form-grid input:focus, .bulk-field textarea:focus {
  border-color: rgba(124, 77, 255, .72);
  box-shadow: 0 0 0 3px rgba(124, 77, 255, .14);
}
.form-grid .wide { grid-column: 1 / -1; }
.bulk-field textarea { resize: vertical; min-height: 180px; }
.hint { margin: 12px 0 18px; line-height: 1.45; }
.scan-results {
  display: grid;
  gap: 8px;
  margin: 14px 0 18px;
  max-height: 320px;
  overflow: auto;
}
.scan-bulk-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(34, 197, 94, .35);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .12);
}
.scan-bulk-toolbar small { display: block; color: var(--muted); margin-top: 4px; }
.scan-bulk-toolbar button { white-space: nowrap; }
.scan-add-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 22px;
  padding: 16px;
  border: 1px solid rgba(34, 197, 94, .35);
  border-radius: 10px;
  background: rgba(34, 197, 94, .08);
}
.scan-error-text { color: var(--danger); }
.scan-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(8, 14, 20, .38);
}
.scan-row small { display: block; color: var(--muted); margin-top: 3px; }
@media (max-width: 700px) {
  .scan-bulk-toolbar { align-items: stretch; flex-direction: column; }
  .scan-bulk-toolbar button { width: 100%; }
}
.tooltip {
  position: relative;
}
.tooltip::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  transform: translateX(-50%);
  z-index: 20;
  width: max-content;
  max-width: 190px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(8, 14, 20, .96);
  color: var(--text);
  font-size: 12px;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.tooltip:hover::after { opacity: 1; }
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 30;
  max-width: 360px;
  padding: 13px 16px;
  border: 1px solid rgba(124, 77, 255, .45);
  border-radius: 8px;
  background: rgba(16, 25, 35, .96);
  color: var(--text);
  box-shadow: 0 20px 55px rgba(0, 0, 0, .45);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
body.light-mode {
  --bg: #eef3f8;
  --panel: rgba(255, 255, 255, .82);
  --panel-strong: rgba(255, 255, 255, .96);
  --line: rgba(15, 23, 42, .12);
  --text: #0f172a;
  --muted: #64748b;
  background: linear-gradient(135deg, #edf3f8 0%, #f8fbff 100%);
}

/* Service-center visual theme */
.sidebar {
  background: rgba(255, 255, 255, .85);
  border-right-color: var(--line);
  backdrop-filter: saturate(180%) blur(20px);
}
.brand { color: #1d1d1f; }
.brand-mark {
  border: 0;
  background: #1d1d1f;
  color: #fff;
  box-shadow: none;
}
.side-nav button { color: #3a3a3c; font-weight: 600; }
.side-nav button:hover { background: #f5f5f7; color: #0071e3; }
.side-nav button.active {
  color: #fff;
  background: #0071e3;
  box-shadow: 0 8px 20px rgba(0, 113, 227, .22);
}
.next-check {
  background: #f5f5f7;
  border-color: #e5e5ea;
  box-shadow: none;
}
.topbar {
  background: rgba(255, 255, 255, .85);
  border-bottom-color: var(--line);
  backdrop-filter: saturate(180%) blur(20px);
}
.icon-btn {
  color: #1d1d1f;
  border-radius: 999px;
}
.icon-btn:hover { border-color: #e5e5ea; background: #f5f5f7; }
.profile { color: #1d1d1f; }
.avatar { background: #1d1d1f; color: #fff; }
.content { padding: 24px 28px 32px; }
.metric {
  background: #fff;
  border-color: #e5e5ea;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
}
.metric h3 { color: #6e6e73; font-weight: 650; }
.metric strong { color: #1d1d1f; letter-spacing: -0.04em; }
.metric > span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f5f5f7;
}
.panel {
  background: #fff;
  border-color: #e5e5ea;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
}
.panel h2 { color: #1d1d1f; font-weight: 750; letter-spacing: -0.02em; }
.panel h2 span { color: #6e6e73; }
.chart-panel canvas { padding-bottom: 20px; }
select, .search input {
  background: #f5f5f7;
  color: #1d1d1f;
  border-color: #e5e5ea;
}
.legend-row { color: #1d1d1f; }
.schedule-main-toggle,
.schedule-row {
  background: #f5f5f7;
  border-color: #e5e5ea;
}
.schedule-toolbar input:not([type="checkbox"]),
.schedule-row input[type="time"] {
  background: #fff;
  color: #1d1d1f;
  border-color: #e5e5ea;
}
.schedule-toolbar button {
  background: #fff;
  border-color: #e5e5ea;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}
.zec-summary div,
.detail-item,
.detail-fans,
.board-card,
.scan-row,
.pool-row b {
  background: #f5f5f7;
  border-color: #e5e5ea;
}
.zec-summary strong,
.zec-summary b {
  color: #1d1d1f;
}
.zec-summary .positive { color: #1c7c3a; }
.zec-summary .negative { color: #ff3b30; }
.market-source {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f5f5f7;
  color: #6e6e73;
  font-weight: 650;
}
.market-hint { color: #6e6e73; }
.model-strip {
  background: #fff;
  border-color: #e5e5ea;
}
.toolbar {
  display: grid;
  grid-template-columns: 1fr;
  align-items: end;
  gap: 16px;
  border-bottom: 1px solid #e5e5ea;
}
.tabs button, .actions button, .link-btn, .modal-actions button {
  border-color: #e5e5ea;
  background: #fff;
  color: #1d1d1f;
  font-weight: 650;
}
.tabs button {
  height: 46px;
  border-radius: 14px;
  padding: 0 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
}
.tabs .active {
  background: #f5f5f7;
  border-color: #e5e5ea;
  color: #1d1d1f;
}
.actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-items: stretch;
  justify-content: stretch;
  gap: 10px;
  width: 100%;
}
.actions button {
  width: 100%;
  min-width: 0;
  height: 46px;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.actions .active {
  background: #f5f5f7;
  color: #1d1d1f;
  border-color: #e5e5ea;
}
.actions button:hover, .modal-actions button:hover {
  background: #f5f5f7;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .08);
  transform: translateY(-1px);
}
.danger-soft { color: #ff3b30 !important; border-color: rgba(255, 59, 48, .28) !important; }
.blue-soft { color: #0071e3 !important; border-color: rgba(0, 113, 227, .25) !important; }
.green-soft { color: #1c7c3a !important; border-color: rgba(52, 199, 89, .28) !important; }
.search {
  align-self: end;
  justify-content: end;
  width: 100%;
}
.search input {
  width: min(100%, 320px);
  height: 46px;
  border-radius: 14px;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .03);
}
.filterbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  gap: 10px;
  padding: 14px 18px 18px;
  border-bottom: 1px solid #e5e5ea;
  background: #fbfbfd;
}
.filterbar label {
  display: grid;
  gap: 6px;
}
.filterbar span {
  color: #6e6e73;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.filterbar select {
  width: 100%;
  height: 38px;
  background: #fff;
}
.filter-reset {
  align-self: end;
  height: 38px;
  border: 1px solid #e5e5ea;
  border-radius: 7px;
  background: #fff;
  color: #0071e3;
  padding: 0 14px;
  font-weight: 650;
}
.filter-reset:hover { background: #f5f5f7; }
th {
  color: #6e6e73;
  background: #f5f5f7;
  font-weight: 700;
}
.sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  font-weight: 700;
  text-align: left;
}
.sort-btn::after {
  content: "↕";
  color: #aeaeb2;
  font-size: 11px;
}
.sort-btn.active { color: #0071e3; }
.sort-btn.active[data-direction="asc"]::after { content: "↑"; color: #0071e3; }
.sort-btn.active[data-direction="desc"]::after { content: "↓"; color: #0071e3; }
td { color: #1d1d1f; }
th:last-child,
td:last-child { background: #fff; }
tr:hover td { background: #fbfbfd; }
tr:hover td:last-child { background: #fff; }
.status-pill.online { color: #1c7c3a; background: rgba(52, 199, 89, .12); }
.status-pill.offline { color: #ff3b30; background: rgba(255, 59, 48, .1); }
.status-pill.problem { color: #ff3b30; background: rgba(255, 59, 48, .13); }
.dot.online { background: #34c759; box-shadow: none; }
.dot.offline { background: #ff3b30; box-shadow: none; }
.dot.problem { background: #ff3b30; box-shadow: none; }
.row-actions button {
  border-radius: 999px;
  color: #1d1d1f;
  background: #f5f5f7;
  min-width: 72px;
}
.row-actions button:nth-child(1) { background: rgba(0, 113, 227, .12); color: #0071e3; }
.row-actions button:nth-child(2) { background: rgba(255, 159, 10, .14); color: #9a5a00; }
.row-actions button:nth-child(3) { background: #f5f5f7; color: #1d1d1f; }
.row-actions button:nth-child(4) { background: rgba(255, 59, 48, .1); color: #ff3b30; }
.feed-row { color: #1d1d1f; }
.feed-row p, .feed-row time { color: #6e6e73; }
.link-btn { color: #0071e3; }
dialog::backdrop { background: rgba(0, 0, 0, .25); backdrop-filter: blur(8px); }
.modal-card {
  background: #fff;
  border-color: #e5e5ea;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .18);
}
.modal-card p { color: #6e6e73; }
.detail-item,
.scan-row,
.pool-row b,
.profile-summary,
.panel-user-row {
  background: #f5f5f7;
  border-color: #e5e5ea;
}
.form-grid input,
.bulk-field textarea,
.pool-row input {
  background: #f5f5f7;
  color: #1d1d1f;
  border-color: #e5e5ea;
}
.form-grid input:focus,
.bulk-field textarea:focus,
.pool-row input:focus,
select:focus,
.search input:focus {
  border-color: #0071e3;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, .12);
}
.tooltip::after {
  background: #1d1d1f;
  color: #fff;
  border: 0;
}
.toast {
  border-color: rgba(0, 113, 227, .22);
  background: #1d1d1f;
  color: #fff;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .18);
}
.login-overlay {
  background: rgba(245, 245, 247, .92);
  backdrop-filter: saturate(180%) blur(20px);
}
.login-card {
  background: #fff;
  border-color: #e5e5ea;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .12);
}
.login-card input {
  background: #f5f5f7;
  color: #1d1d1f;
  border-color: #e5e5ea;
}

@media (max-width: 920px) {
  body { padding-bottom: 76px; }
  .shell { display: block; }
  .sidebar { display: none; }
  .desktop-only, .analytics-grid, .bottom-grid, .table-wrap { display: none; }
  .mobile-only, .mobile-list, .bottom-nav { display: flex; }
  .topbar {
    height: 130px;
    align-items: flex-start;
    padding: 34px 28px 16px;
  }
  .mobile-title {
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
  }
  .mobile-title strong { font-size: 18px; }
  .mobile-title span { font-size: 13px; }
  .content { padding: 16px 16px 0; }
  .metric-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }
  .metric {
    min-height: 84px;
    padding: 13px;
  }
  .metric h3 { font-size: 12px; }
  .metric strong { font-size: 24px; }
  .metric:nth-child(4) { grid-column: span 2; }
  .metric:nth-child(5) { grid-column: span 1; }
  .asic-panel { margin-top: 10px; border-left: 0; border-right: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .toolbar { padding: 16px 0 10px; }
  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .filterbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px 0 14px;
    background: transparent;
    border-bottom: 0;
  }
  .filter-reset { grid-column: 1 / -1; }
  .search { display: none; }
  .schedule-toolbar {
    grid-template-columns: 1fr;
    padding: 0 0 12px;
  }
  .schedule-rows {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 0 12px;
  }
  .schedule-panel {
    margin-top: 10px;
    padding: 0 14px;
  }
  .schedule-panel .panel-head,
  .schedule-panel .hint {
    padding-left: 0;
    padding-right: 0;
  }
  .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    overflow: visible;
    gap: 10px;
  }
  .actions button {
    min-width: 0;
    width: 100%;
    white-space: normal;
  }
  .mobile-list {
    flex-direction: column;
    gap: 10px;
  }
  .asic-card {
    min-height: 66px;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(26, 39, 52, .9), rgba(14, 22, 31, .95));
  }
  .asic-card {
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .04);
  }
  .asic-card .main { min-width: 0; flex: 1; }
  .asic-card b, .asic-card span { display: block; }
  .asic-card span { color: #6e6e73; font-size: 12px; margin-top: 3px; }
  .asic-card .numbers { text-align: right; min-width: 92px; }
  .asic-card .numbers small { display: block; margin-top: 4px; color: var(--green); }
  .asic-card.offline .numbers small { color: var(--red); }
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    justify-content: space-around;
    height: 72px;
    border-top: 1px solid var(--line);
    background: rgba(8, 13, 19, .94);
    backdrop-filter: blur(20px);
  }
  .bottom-nav {
    background: rgba(255, 255, 255, .88);
    backdrop-filter: saturate(180%) blur(20px);
  }
  .bottom-nav button {
    display: grid;
    place-items: center;
    gap: 3px;
    min-width: 70px;
    border: 0;
    background: transparent;
    color: #3a3a3c;
    font-size: 12px;
  }
  .bottom-nav button span { font-size: 24px; }
  .bottom-nav .active { color: #0071e3; }
  .detail-grid { grid-template-columns: 1fr; }
  .boards-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .pool-row { grid-template-columns: 34px 1fr; }
  .pool-head { display: none; }
  .pool-row input { grid-column: 2; }
  .toast { left: 16px; right: 16px; bottom: 84px; }
}

@media (max-width: 520px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric:nth-child(4) { grid-column: span 2; }
  .metric:nth-child(5) { grid-column: span 1; }
  .metric h3, .metric small { overflow-wrap: anywhere; }
  .metric strong { font-size: clamp(20px, 7vw, 27px); }
}

/* Final sidebar and row action polish */
.shell { grid-template-columns: 232px 1fr; }
.sidebar {
  padding: 18px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(247,249,252,.94));
  border-right: 1px solid #ececf1;
  box-shadow: 10px 0 30px rgba(15, 23, 42, .035);
}
.brand {
  min-height: 52px;
  padding: 6px 8px;
  border-radius: 12px;
  font-size: 18px;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  box-shadow: 0 10px 22px rgba(0,0,0,.12);
}
.side-nav {
  gap: 5px;
  margin-top: 18px;
  padding: 8px;
  border: 1px solid #ececf1;
  border-radius: 16px;
  background: rgba(255,255,255,.76);
  box-shadow: 0 8px 28px rgba(15,23,42,.04);
}
.side-nav button {
  min-height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  font-weight: 700;
}
.side-nav button span {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  color: #6e6e73;
}
.side-nav button.active span {
  color: #fff;
  background: rgba(255,255,255,.16);
}
.next-check {
  left: 14px;
  right: 14px;
  bottom: 18px;
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 2px 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid #ececf1;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15,23,42,.06);
}
.next-check > span {
  display: grid;
  place-items: center;
  grid-row: span 2;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #0071e3;
  background: rgba(0,113,227,.1);
}
th:last-child,
td:last-child {
  width: 212px;
  min-width: 212px;
  background: #fff;
  box-shadow: -10px 0 18px rgba(15,23,42,.06);
}
.row-actions {
  display: inline-flex;
  gap: 6px;
  justify-content: flex-end;
  padding: 4px;
  border: 1px solid rgba(15,23,42,.08);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(15,23,42,.05);
}
.row-actions button {
  display: grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
  box-shadow: none;
}
.row-actions button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15,23,42,.12);
}
.row-actions .action-check { background: rgba(0,113,227,.1); color: #0071e3; }
.row-actions .action-locate { background: rgba(52,199,89,.14); color: #188038; }
.row-actions .action-reboot { background: rgba(255,159,10,.14); color: #9a5a00; }
.row-actions .action-stop { background: rgba(255,59,48,.1); color: #b42318; }
.row-actions .action-start { background: rgba(52,199,89,.14); color: #188038; }
.row-actions .action-info { background: #f5f5f7; color: #3a3a3c; }
.row-actions .action-delete { background: rgba(255,59,48,.1); color: #ff3b30; }
.row-actions button:disabled { opacity: .35; cursor: not-allowed; transform: none; box-shadow: none; }

/* Stable grouped action order: blue, green, red */
#allAsicsBtn { order: 10; }
#bulkAddBtn { order: 11; }
#scanNetworkBtn { order: 12; }
#checkAllBtn { order: 13; }
#workerSelectedBtn { order: 14; }
#addAsicBtn { order: 20; }
#poolSelectedBtn { order: 21; }
#exportBtn { order: 22; }
#rebootAllBtn { order: 30; }
#rebootSelectedBtn { order: 31; }
#deleteSelectedBtn { order: 32; }

/* ASIC UI polish: stable spacing, grouped controls, calmer colors */
:root {
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --border-soft: #e5e7eb;
  --shadow-soft: 0 12px 28px rgba(15, 23, 42, .06);
  --shadow-card: 0 18px 42px rgba(15, 23, 42, .075);
  --blue-soft-bg: #eef6ff;
  --green-soft-bg: #eefaf2;
  --red-soft-bg: #fff1f1;
}

body {
  background:
    linear-gradient(180deg, #fbfcff 0%, #f3f5f8 42%, #eef1f5 100%);
}

.topbar {
  height: 72px;
  background: rgba(255, 255, 255, .9);
  border-bottom: 1px solid var(--border-soft);
  box-shadow: 0 1px 0 rgba(15, 23, 42, .03);
}

.icon-btn {
  color: #1f2937;
  border-color: transparent;
}

.icon-btn:hover {
  background: #f3f7fb;
  border-color: #d8e3ef;
}

.content {
  max-width: 1640px;
  margin-inline: auto;
}

.panel,
.metric {
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.panel {
  overflow: clip;
}

.metric-grid {
  gap: 16px;
}

.metric {
  min-height: 118px;
  padding: 22px 24px;
}

.metric h3 {
  font-size: 14px;
  font-weight: 800;
  color: #6b7280;
}

.metric strong {
  margin-top: 8px;
  line-height: 1;
}

.analytics-grid {
  grid-template-columns: minmax(0, 1.6fr) minmax(360px, .9fr);
  gap: 16px;
}

.panel-head,
.toolbar {
  padding: 22px 24px;
}

.model-strip {
  padding-bottom: 22px;
}

.model-bar {
  margin-inline: 24px;
}

.model-strip-legend {
  padding-inline: 24px;
}

.asic-panel {
  margin-top: 18px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 18px;
  align-items: start;
  border-bottom: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
}

.actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(148px, 1fr));
  gap: 10px;
  width: 100%;
}

.actions button,
.farm-add-btn,
.filter-reset {
  height: 46px;
  min-width: 0;
  padding: 0 16px;
  border-radius: 12px;
  font-weight: 850;
  line-height: 1.08;
  white-space: normal;
  text-align: center;
  box-shadow: 0 6px 16px rgba(15, 23, 42, .045);
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
}

.actions button:hover,
.farm-add-btn:hover,
.filter-reset:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, .09);
}

.actions .active,
.actions .blue-soft {
  color: #0b66d8 !important;
  border-color: #bfdbfe !important;
  background: var(--blue-soft-bg) !important;
}

.actions .green-soft {
  color: #167a34 !important;
  border-color: #bbf7d0 !important;
  background: var(--green-soft-bg) !important;
}

.actions .danger-soft {
  color: #dc2626 !important;
  border-color: #fecaca !important;
  background: var(--red-soft-bg) !important;
}

#allAsicsBtn { order: 10; }
#bulkAddBtn { order: 11; }
#scanNetworkBtn { order: 12; }
#checkAllBtn { order: 13; }
#workerSelectedBtn { order: 14; }
#addAsicBtn { order: 20; }
#poolSelectedBtn { order: 21; }
#exportBtn { order: 22; }
#rebootAllBtn { order: 30; }
#rebootSelectedBtn { order: 31; }
#deleteSelectedBtn { order: 32; }

.search {
  justify-self: end;
  width: 100%;
  max-width: 360px;
  height: 46px;
  margin-left: 0;
  padding: 0 14px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: #f8fafc;
}

.search input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.filterbar {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr)) minmax(120px, .55fr);
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-soft);
  background: #fbfcfe;
}

.filterbar label {
  gap: 7px;
}

.filterbar span {
  color: #7b8493;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .08em;
}

.filterbar select,
.filter-reset {
  height: 42px;
  border-radius: 11px;
  border-color: #dbe3ec;
  background: #fff;
}

.table-wrap {
  padding: 0;
}

table {
  min-width: 1160px;
  font-size: 13px;
}

th,
td {
  padding: 12px 14px;
}

th {
  color: #667085;
  background: #f8fafc;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .06em;
  text-transform: uppercase;
}

tbody tr {
  background: #fff;
}

tbody tr:hover {
  background: #f9fbff;
}

td:last-child,
th:last-child {
  width: 232px;
  min-width: 232px;
}

.row-actions {
  gap: 5px;
  padding: 5px;
  border-radius: 16px;
  background: #f8fafc;
  box-shadow: inset 0 0 0 1px #edf1f5;
}

.row-actions button {
  width: 29px;
  min-width: 29px;
  height: 29px;
  border-radius: 10px;
}

.row-actions .action-check {
  background: #eaf4ff;
  color: #0b66d8;
}

.row-actions .action-locate,
.row-actions .action-start {
  background: #ebf9ef;
  color: #167a34;
}

.row-actions .action-reboot {
  background: #fff7e8;
  color: #a15c00;
}

.row-actions .action-stop,
.row-actions .action-delete {
  background: #fff1f1;
  color: #dc2626;
}

.row-actions .action-info {
  background: #eef2f7;
  color: #344054;
}

.status-pill {
  min-width: 82px;
  justify-content: center;
  font-weight: 800;
}

.detail-card {
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(15, 23, 42, .18);
}

.detail-item,
.board-card,
.detail-fans {
  border-color: var(--border-soft);
  border-radius: 14px;
  background: #f8fafc;
}

.board-card-head span {
  color: #667085;
}

@media (max-width: 1280px) {
  .toolbar {
    grid-template-columns: 1fr;
  }
  .search {
    justify-self: stretch;
    max-width: none;
  }
  .actions {
    grid-template-columns: repeat(4, minmax(140px, 1fr));
  }
  .filterbar {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
}

@media (max-width: 760px) {
  .actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .filterbar {
    grid-template-columns: 1fr;
    padding-inline: 16px;
  }
}

/* v0.51: per-ASIC action control, no sticky overlay over telemetry */
@media (min-width: 921px) {
  .table-wrap table { min-width: 1380px !important; }
  .table-wrap th:last-child,
  .table-wrap td:last-child {
    position: static !important;
    right: auto !important;
    z-index: auto !important;
    width: 226px !important;
    min-width: 226px !important;
    max-width: 226px !important;
    padding: 10px 12px !important;
    background: inherit !important;
    box-shadow: none !important;
  }
  .table-wrap th:last-child { text-align: left !important; }
  .table-wrap .row-actions {
    position: relative !important;
    display: flex !important;
    grid-template-columns: none !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    width: 202px !important;
    min-width: 202px !important;
    max-width: 202px !important;
    height: 42px !important;
    padding: 4px !important;
    border: 1px solid #dfe7f1 !important;
    border-radius: 13px !important;
    background: #f8fafc !important;
    box-shadow: none !important;
  }
  .table-wrap .row-actions > button,
  .table-wrap .action-menu > summary {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 34px !important;
    min-width: 34px !important;
    max-width: 34px !important;
    height: 34px !important;
    min-height: 34px !important;
    max-height: 34px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 9px !important;
    cursor: pointer;
    list-style: none;
  }
  .table-wrap .row-actions > .action-info {
    width: 82px !important;
    min-width: 82px !important;
    max-width: 82px !important;
    gap: 6px;
    color: #344054 !important;
    background: #eef2f7 !important;
    font-size: 12px !important;
    font-weight: 800 !important;
  }
  .table-wrap .row-actions > .action-info span { display: inline !important; }
  .table-wrap .row-actions > .action-check { background: #e7f1ff !important; color: #0969da !important; }
  .table-wrap .row-actions > .action-locate { background: #fff3df !important; color: #9a5a00 !important; }
  .action-menu { position: relative; width: 34px; height: 34px; }
  .action-menu > summary { color: #475467; background: #eef2f7; font-weight: 900; letter-spacing: 1px; }
  .action-menu > summary::-webkit-details-marker { display: none; }
  .action-menu[open] { z-index: 30; }
  .action-menu-popover {
    position: absolute;
    top: 40px;
    right: 0;
    z-index: 40;
    display: grid;
    gap: 5px;
    width: 176px;
    padding: 7px;
    border: 1px solid #dfe7f1;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
  }
  .table-wrap .action-menu-popover button {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 9px !important;
    width: 100% !important;
    max-width: none !important;
    height: 36px !important;
    min-height: 36px !important;
    padding: 0 10px !important;
    border: 0 !important;
    border-radius: 8px !important;
    font-size: 12px !important;
    font-weight: 750 !important;
  }
  .action-menu-popover button i { width: 18px; text-align: center; }
  .action-menu-popover .action-reboot { color: #344054 !important; background: #f4f6f9 !important; }
  .action-menu-popover .action-stop,
  .action-menu-popover .action-delete { color: #c62828 !important; background: #fff1f2 !important; }
  .action-menu-popover .action-start { color: #167a34 !important; background: #ebf9ef !important; }
}

html[data-theme="dark"] .table-wrap .row-actions { background: #1d2630 !important; border-color: #354150 !important; }
html[data-theme="dark"] .table-wrap .row-actions > .action-info,
html[data-theme="dark"] .action-menu > summary { background: #273240 !important; color: #dbe5f1 !important; }
html[data-theme="dark"] .action-menu-popover { background: #171e27; border-color: #354150; }

/* v0.64 final overrides must remain last because this stylesheet contains legacy layers. */
.asic-list-controls { position: sticky !important; top: 74px !important; z-index: 22 !important; }
.table-wrap .asic-data-row td { padding-top: 12px !important; padding-bottom: 12px !important; border-bottom: 1px solid var(--border-soft,#e8edf3) !important; }
.table-wrap .asic-actions-subrow { display: none !important; }
@media (min-width: 921px) {
  .table-wrap th.actions-col,
  .table-wrap td.asic-action-cell,
  .table-wrap th:last-child,
  .table-wrap .asic-data-row td:last-child {
    position: static !important; width: 72px !important; min-width: 72px !important; max-width: 72px !important;
    padding: 8px !important; text-align: center !important; background: inherit !important; box-shadow: none !important;
  }
}
@media (max-width: 760px) { .asic-list-controls { position: static !important; } }

/* v0.64 compact BTC-Tools-like ASIC list: sticky filters and one + action menu. */
.asic-list-controls {
  position: sticky;
  top: 74px;
  z-index: 22;
  border-bottom: 1px solid #e6ebf1;
  background: rgba(255,255,255,.96);
  box-shadow: 0 9px 22px rgba(15,23,42,.06);
  backdrop-filter: blur(12px);
}
.asic-list-controls .toolbar { padding-bottom: 10px !important; }
.asic-list-controls .filterbar { margin-top: 0 !important; padding-top: 0 !important; }
.table-wrap .asic-data-row td { padding-top: 12px !important; padding-bottom: 12px !important; border-bottom: 1px solid var(--border-soft,#e8edf3) !important; }
.table-wrap .asic-actions-subrow { display: none !important; }
.table-wrap .actions-col,
.table-wrap .asic-action-cell { width: 72px !important; min-width: 72px !important; text-align: center !important; }
.asic-more-btn {
  width: 34px; height: 34px; border: 1px solid #d5deea; border-radius: 9px;
  background: #f4f7fb; color: #344054; font-size: 22px; font-weight: 600;
  line-height: 28px; cursor: pointer;
}
.asic-more-btn:hover { border-color: #8ebcf2; background: #eaf3ff; color: #0969da; }
.asic-action-floating {
  position: fixed; z-index: 1000; display: grid; gap: 4px; width: 210px;
  padding: 8px; border: 1px solid #dce4ee; border-radius: 13px;
  background: #fff; box-shadow: 0 18px 48px rgba(15,23,42,.24);
}
.asic-action-floating.hidden { display: none !important; }
.asic-action-menu-title { display: flex; flex-direction: column; padding: 7px 9px 9px; border-bottom: 1px solid #edf1f5; }
.asic-action-menu-title small { color: #7b8493; margin-top: 2px; }
.asic-action-floating button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 36px;
  padding: 0 10px; border: 0; border-radius: 8px; background: transparent;
  color: #344054; font: 750 12px inherit; text-align: left; cursor: pointer;
}
.asic-action-floating button:hover { background: #eef5ff; color: #0969da; }
.asic-action-floating button.danger { color: #c62828; }
.asic-action-floating button.danger:hover { background: #fff1f2; }
.asic-action-floating button:disabled { opacity: .35; cursor: not-allowed; }
.asic-action-floating button i { width: 17px; font-style: normal; text-align: center; }
html[data-theme="dark"] .asic-list-controls { background: rgba(23,30,39,.96); border-color: #354150; }
html[data-theme="dark"] .asic-more-btn { background: #273240; border-color: #435064; color: #dbe5f1; }
html[data-theme="dark"] .asic-action-floating { background: #171e27; border-color: #354150; }
html[data-theme="dark"] .asic-action-floating button { color: #dbe5f1; }
html[data-theme="dark"] .asic-action-menu-title { border-color: #354150; }
@media(max-width: 760px) {
  .asic-list-controls { position: static; }
}

/* v0.62.1 ABSOLUTE FINAL TOOLBAR OVERRIDE */
.asic-panel .toolbar { padding: 22px 28px !important; }
.asic-panel .actions {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 10px 12px !important;
  align-items: stretch !important;
  width: 100% !important;
}
.asic-panel .actions > button,
.asic-panel .actions > .search {
  width: 100% !important;
  min-width: 0 !important;
  height: 50px !important;
  margin: 0 !important;
  border-radius: 12px !important;
}
.asic-panel .actions > .search {
  order: 1 !important;
  display: flex !important;
  grid-column: 1 / -1 !important;
  align-items: center !important;
  padding: 0 16px !important;
  background: #f8fafc !important;
  border: 1px solid #dbe6f2 !important;
  box-shadow: none !important;
}
.asic-panel .actions > .search input { width: 100% !important; min-width: 0 !important; font-size: 15px !important; }
#allAsicsBtn { order: 10 !important; grid-column: span 1 !important; }
#boardProblemFilterBtn { order: 11 !important; grid-column: span 1 !important; }
#checkAllBtn { order: 12 !important; grid-column: span 1 !important; }
#scanNetworkBtn { order: 13 !important; grid-column: span 1 !important; }
#addAsicBtn { order: 14 !important; grid-column: span 1 !important; }
#bulkAddBtn { order: 15 !important; grid-column: span 1 !important; }
#installPatchSelectedBtn { order: 20 !important; grid-column: span 3 !important; }
#installFirmwareSelectedBtn { order: 21 !important; grid-column: span 3 !important; }
.asic-panel .actions > .firmware-action { height: 56px !important; font-size: 15px !important; font-weight: 850 !important; }
#workerSelectedBtn { order: 30 !important; grid-column: span 2 !important; }
#poolSelectedBtn { order: 31 !important; grid-column: span 2 !important; }
#exportBtn { order: 32 !important; grid-column: span 2 !important; }
#rebootAllBtn { order: 40 !important; grid-column: span 2 !important; }
#rebootSelectedBtn { order: 41 !important; grid-column: span 2 !important; }
#deleteSelectedBtn { order: 42 !important; grid-column: span 2 !important; }
@media (max-width: 1280px) {
  .asic-panel .actions { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .asic-panel .actions > button { grid-column: span 1 !important; }
  #installPatchSelectedBtn, #installFirmwareSelectedBtn { grid-column: 1 / -1 !important; }
}
@media (max-width: 680px) {
  .asic-panel .toolbar { padding: 16px !important; }
  .asic-panel .actions { grid-template-columns: 1fr !important; }
  .asic-panel .actions > button, .asic-panel .actions > .search { grid-column: 1 !important; }
}

/* v0.62.1 FINAL: the last toolbar rule wins over all legacy layouts. */
.asic-panel .toolbar {
  padding: 22px 28px !important;
}
.asic-panel .actions {
  display: grid !important;
  grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  gap: 10px 12px !important;
  align-items: stretch !important;
  width: 100% !important;
}
.asic-panel .actions > button,
.asic-panel .actions > .search {
  width: 100% !important;
  min-width: 0 !important;
  height: 50px !important;
  margin: 0 !important;
  border-radius: 12px !important;
}
.asic-panel .actions > .search {
  order: 1 !important;
  display: flex !important;
  grid-column: 1 / -1 !important;
  align-items: center !important;
  padding: 0 16px !important;
  background: #f8fafc !important;
  border: 1px solid #dbe6f2 !important;
  box-shadow: none !important;
}
.asic-panel .actions > .search input {
  width: 100% !important;
  min-width: 0 !important;
  font-size: 15px !important;
}
#allAsicsBtn { order: 10 !important; grid-column: span 1 !important; }
#boardProblemFilterBtn { order: 11 !important; grid-column: span 1 !important; }
#checkAllBtn { order: 12 !important; grid-column: span 1 !important; }
#scanNetworkBtn { order: 13 !important; grid-column: span 1 !important; }
#addAsicBtn { order: 14 !important; grid-column: span 1 !important; }
#bulkAddBtn { order: 15 !important; grid-column: span 1 !important; }
#installPatchSelectedBtn { order: 20 !important; grid-column: span 3 !important; }
#installFirmwareSelectedBtn { order: 21 !important; grid-column: span 3 !important; }
.asic-panel .actions > .firmware-action {
  height: 56px !important;
  font-size: 15px !important;
  font-weight: 850 !important;
}
#workerSelectedBtn { order: 30 !important; grid-column: span 2 !important; }
#poolSelectedBtn { order: 31 !important; grid-column: span 2 !important; }
#exportBtn { order: 32 !important; grid-column: span 2 !important; }
#rebootAllBtn { order: 40 !important; grid-column: span 2 !important; }
#rebootSelectedBtn { order: 41 !important; grid-column: span 2 !important; }
#deleteSelectedBtn { order: 42 !important; grid-column: span 2 !important; }
@media (max-width: 1280px) {
  .asic-panel .actions { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .asic-panel .actions > button { grid-column: span 1 !important; }
  #installPatchSelectedBtn,
  #installFirmwareSelectedBtn { grid-column: 1 / -1 !important; }
}
@media (max-width: 680px) {
  .asic-panel .toolbar { padding: 16px !important; }
  .asic-panel .actions { grid-template-columns: 1fr !important; }
  .asic-panel .actions > button,
  .asic-panel .actions > .search { grid-column: 1 !important; }
}

.farm-download-actions .primary-installer-download {
  min-width: 260px;
  min-height: 48px;
  font-size: 15px;
  font-weight: 800;
}
.farm-download-actions .secondary-agent-download {
  opacity: .72;
}

/* v0.62: ordered ASIC actions; search and firmware choices have dedicated rows. */
.asic-panel .actions {
  grid-template-columns: repeat(6, minmax(140px, 1fr)) !important;
  gap: 10px 12px !important;
}
.asic-panel .actions .search {
  order: 1 !important;
  grid-column: 1 / -1 !important;
  height: 50px !important;
  margin-bottom: 4px !important;
  background: #fff !important;
}
.asic-panel .actions .search input {
  font-size: 15px !important;
}
#allAsicsBtn { order: 10 !important; }
#boardProblemFilterBtn { order: 11 !important; }
#checkAllBtn { order: 12 !important; }
#scanNetworkBtn { order: 13 !important; }
#addAsicBtn { order: 14 !important; }
#bulkAddBtn { order: 15 !important; }
#installFirmwareSelectedBtn {
  order: 20 !important;
  grid-column: span 3 !important;
}
#installPatchSelectedBtn {
  order: 21 !important;
  grid-column: span 3 !important;
}
.asic-panel .actions .firmware-action {
  min-height: 58px !important;
  font-size: 15px !important;
  box-shadow: inset 0 0 0 1px currentColor, 0 8px 18px rgba(15, 23, 42, .05) !important;
}
#workerSelectedBtn { order: 30 !important; }
#poolSelectedBtn { order: 31 !important; }
#exportBtn { order: 32 !important; }
#rebootAllBtn { order: 40 !important; }
#rebootSelectedBtn { order: 41 !important; }
#deleteSelectedBtn { order: 42 !important; }
@media (max-width: 1500px) {
  .asic-panel .actions { grid-template-columns: repeat(4, minmax(145px, 1fr)) !important; }
  #installFirmwareSelectedBtn,
  #installPatchSelectedBtn { grid-column: span 2 !important; }
}
@media (max-width: 900px) {
  .asic-panel .actions { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  #installFirmwareSelectedBtn,
  #installPatchSelectedBtn { grid-column: 1 / -1 !important; }
}

/* v0.56: action strip contains only buttons */
@media (min-width: 921px) {
  .table-wrap .asic-row-footer {
    display: grid !important;
    grid-template-columns: minmax(840px, 1fr) !important;
    align-items: center !important;
    gap: 0 !important;
    width: 100% !important;
    min-height: 58px !important;
    padding: 7px 9px !important;
  }
  .table-wrap .asic-row-context {
    display: grid !important;
    grid-template-columns: minmax(150px, 1fr) auto auto auto !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0;
  }
  .table-wrap .asic-row-action-title {
    display: grid !important;
    gap: 1px !important;
    min-width: 0 !important;
    color: #344054 !important;
  }
  .table-wrap .asic-row-action-title b,
  .table-wrap .asic-row-action-title small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .table-wrap .asic-row-action-title b { font-size: 12px !important; }
  .table-wrap .asic-row-action-title small { color: #7b8493; font-size: 10px; }
  .table-wrap .asic-row-action-health,
  .table-wrap .asic-row-action-metric {
    display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 0 9px;
    color: #526077; font-size: 10px; font-weight: 800; white-space: nowrap;
    border: 1px solid #e0e7f0; border-radius: 8px; background: #fff;
  }
  .table-wrap .asic-row-action-health i { width: 7px; height: 7px; border-radius: 50%; background: #20b965; }
  .table-wrap .asic-row-action-health.problem i,
  .table-wrap .asic-row-action-health.hot i { background: #f59e0b; }
  .table-wrap .asic-row-action-health.offline i { background: #e5484d; }
  .table-wrap .asic-row-footer .row-actions {
    display: grid !important;
    grid-template-columns: repeat(7, minmax(105px, 1fr)) !important;
    gap: 7px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
  }
  .table-wrap .asic-row-footer .row-actions > button {
    display: inline-flex !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 38px !important;
    min-height: 38px !important;
    padding: 0 8px !important;
  }
}

html[data-theme="dark"] .table-wrap .asic-row-action-health,
html[data-theme="dark"] .table-wrap .asic-row-action-metric { color: #c9d4e2; border-color: #3b4859; background: #27313d; }

@media (max-width: 1200px) {
  .asic-row-context { display: none !important; }
  .table-wrap .asic-row-footer { display: block !important; }
}

/* v0.52: every ASIC owns a full action row; telemetry columns never collide */
.table-wrap table { min-width: 1550px !important; table-layout: auto; }
.table-wrap th:last-child,
.table-wrap td:last-child,
.table-wrap .asic-data-row td:last-child,
.table-wrap .asic-actions-subrow td:last-child {
  position: static !important; right: auto !important; z-index: auto !important;
  width: auto !important; min-width: 0 !important; max-width: none !important;
  background: inherit !important; box-shadow: none !important;
}
.table-wrap .temp-col,
.table-wrap .temp-data { width: 180px !important; min-width: 180px !important; max-width: 180px !important; padding-left: 18px !important; padding-right: 18px !important; text-align: left !important; }
.table-wrap .fan-col,
.table-wrap .fan-data { width: 180px !important; min-width: 180px !important; max-width: 180px !important; padding-left: 18px !important; padding-right: 18px !important; text-align: left !important; }
.table-wrap .temp-data,
.table-wrap .fan-data { overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.table-wrap .asic-data-row td { padding-top: 14px; padding-bottom: 7px; border-bottom: 0; }
.table-wrap .asic-actions-subrow td { padding-top: 0 !important; padding-bottom: 12px !important; border-bottom: 1px solid var(--border-soft, #e8edf3); }
.table-wrap .asic-actions-subrow > td:first-child { width: 42px !important; min-width: 42px !important; }
.asic-row-footer {
  display: flex; align-items: center; gap: 14px; min-height: 46px; padding: 5px 8px;
  border: 1px solid #e1e8f0; border-radius: 12px; background: #f8fafc;
}
.asic-row-action-title { min-width: 175px; color: #7b8493; font-size: 11px; white-space: nowrap; }
.asic-row-action-title b { color: #344054; font-size: 12px; }
.table-wrap .asic-row-footer .row-actions {
  position: static !important; display: flex !important; grid-template-columns: none !important;
  flex-wrap: nowrap !important; align-items: center !important; justify-content: flex-start !important;
  gap: 7px !important; width: auto !important; min-width: 0 !important; max-width: none !important;
  height: auto !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important;
  background: transparent !important; box-shadow: none !important;
}
.table-wrap .asic-row-footer .row-actions button {
  display: inline-flex !important; align-items: center !important; justify-content: center !important; gap: 6px !important;
  width: auto !important; min-width: 92px !important; max-width: none !important;
  height: 34px !important; min-height: 34px !important; max-height: 34px !important;
  padding: 0 11px !important; border: 1px solid transparent !important; border-radius: 9px !important;
  font-size: 11px !important; font-weight: 800 !important; white-space: nowrap;
}
.table-wrap .asic-row-footer .row-actions button i { width: 15px; font-size: 14px !important; font-style: normal; text-align: center; }
.table-wrap .asic-row-footer .action-info { color: #344054 !important; background: #eef2f7 !important; }
.table-wrap .asic-row-footer .action-check { color: #0969da !important; background: #e7f1ff !important; }
.table-wrap .asic-row-footer .action-locate { color: #9a5a00 !important; background: #fff3df !important; }
.table-wrap .asic-row-footer .action-reboot { color: #344054 !important; background: #f1f4f8 !important; }
.table-wrap .asic-row-footer .action-stop,
.table-wrap .asic-row-footer .action-delete { color: #c62828 !important; background: #fff1f2 !important; }
.table-wrap .asic-row-footer .action-start { color: #167a34 !important; background: #ebf9ef !important; }
.table-wrap .asic-row-footer .row-actions button:disabled { opacity: .35 !important; cursor: not-allowed; }
.asic-data-row:hover,
.asic-data-row:hover td,
.asic-actions-subrow:hover,
.asic-actions-subrow:hover td { background: #fff !important; }
html[data-theme="dark"] .asic-row-footer { background: #1d2630; border-color: #354150; }
html[data-theme="dark"] .asic-row-action-title b { color: #e6edf5; }
html[data-theme="dark"] .asic-data-row:hover,
html[data-theme="dark"] .asic-data-row:hover td,
html[data-theme="dark"] .asic-actions-subrow:hover,
html[data-theme="dark"] .asic-actions-subrow:hover td { background: #171e27 !important; }

/* Symmetric ASIC toolbar layout */
.asic-panel .toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
  padding: 24px 28px 22px;
}

.asic-panel .actions {
  display: grid;
  grid-template-columns: repeat(11, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  align-items: stretch;
}

.asic-panel .actions button {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 850;
  line-height: 1.06;
  white-space: normal;
  text-align: center;
}

.asic-panel .actions .active,
.asic-panel .actions .blue-soft {
  color: #0969da !important;
  border-color: #b6d7ff !important;
  background: #edf6ff !important;
}

.asic-panel .actions .green-soft {
  color: #17783a !important;
  border-color: #b8efc9 !important;
  background: #effaf3 !important;
}

.asic-panel .actions .danger-soft {
  color: #d1242f !important;
  border-color: #ffc9c9 !important;
  background: #fff1f1 !important;
}

.asic-panel .search {
  justify-self: end;
  width: min(420px, 100%);
  max-width: none;
  height: 48px;
  margin-left: 0;
}

.asic-panel .filterbar {
  padding: 18px 28px;
}

@media (max-width: 1500px) {
  .asic-panel .actions {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .asic-panel .actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .asic-panel .toolbar {
    padding: 16px;
  }
  .asic-panel .actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .asic-panel .actions button {
    height: 46px;
    font-size: 14px;
  }
  .asic-panel .search {
    display: flex;
    width: 100%;
  }
}

/* v3: strict visual symmetry for action zones */
.topbar {
  gap: 12px;
}

.topbar .farm-switch {
  width: 292px;
  min-width: 292px;
  height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid #dbe6f2;
  background: #f8fafc;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .045);
}

.topbar .farm-add-btn {
  width: 136px;
  height: 48px;
  border-radius: 14px;
}

.topbar .icon-btn,
.topbar .profile {
  height: 48px;
}

.asic-panel .toolbar {
  gap: 16px;
  padding: 24px 32px;
}

.asic-panel .actions {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  max-width: 1260px;
}

.asic-panel .actions button {
  height: 54px;
  padding: 0 12px;
  border-radius: 13px;
  font-size: 14px;
  overflow-wrap: anywhere;
  word-break: normal;
}

.asic-panel .actions-spacer {
  display: block;
  order: 15;
  min-height: 54px;
  visibility: hidden;
}

#allAsicsBtn { order: 10; }
#bulkAddBtn { order: 11; }
#scanNetworkBtn { order: 12; }
#checkAllBtn { order: 13; }
#workerSelectedBtn { order: 14; }
#addAsicBtn { order: 20; }
#poolSelectedBtn { order: 21; }
#exportBtn { order: 22; }
#rebootAllBtn { order: 23; }
#rebootSelectedBtn { order: 24; }
#deleteSelectedBtn { order: 25; }

.asic-panel .search {
  justify-self: end;
  width: 420px;
  height: 52px;
  border-radius: 14px;
}

.detail-card {
  padding-bottom: 28px;
}

.detail-card .modal-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
  margin-top: 22px;
}

.detail-card .modal-actions button {
  height: 52px;
  min-width: 0;
  width: 100%;
  padding: 0 12px;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 850;
  white-space: normal;
  overflow-wrap: anywhere;
}

#detailStopBtn { grid-column: 1 / 2; }
#detailStartBtn { grid-column: 2 / 3; }
#detailRebootBtn { grid-column: 3 / 5; }

@media (max-width: 1500px) {
  .asic-panel .actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .asic-panel .actions-spacer {
    display: none;
  }
}

@media (max-width: 900px) {
  .topbar .farm-switch {
    width: 240px;
    min-width: 240px;
  }
  .asic-panel .actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .detail-card .modal-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #detailStopBtn,
  #detailStartBtn,
  #detailRebootBtn {
    grid-column: auto;
  }
}

/* v4: search in the same symmetric 6x2 action grid */
.asic-panel .toolbar {
  display: block;
  padding: 24px 32px;
}

.asic-panel .actions {
  display: grid;
  grid-template-columns: repeat(6, minmax(142px, 1fr));
  gap: 12px;
  max-width: none;
  width: 100%;
  align-items: stretch;
}

.asic-panel .actions button,
.asic-panel .actions .search {
  height: 54px;
  min-width: 0;
  width: 100%;
  border-radius: 13px;
}

.asic-panel .actions .search {
  display: flex;
  order: 15;
  grid-column: auto;
  justify-self: stretch;
  max-width: none;
  margin: 0;
  padding: 0 14px;
  border: 1px solid #dbe6f2;
  background: #f8fafc;
  box-shadow: 0 6px 16px rgba(15, 23, 42, .045);
}

.asic-panel .actions .search input {
  min-width: 0;
}

.asic-panel .actions-spacer {
  display: none !important;
}

#allAsicsBtn { order: 10; }
#bulkAddBtn { order: 11; }
#scanNetworkBtn { order: 12; }
#checkAllBtn { order: 13; }
#workerSelectedBtn { order: 14; }
#addAsicBtn { order: 20; }
#poolSelectedBtn { order: 21; }
#exportBtn { order: 22; }
#rebootAllBtn { order: 23; }
#rebootSelectedBtn { order: 24; }
#deleteSelectedBtn { order: 25; }

@media (max-width: 1500px) {
  .asic-panel .actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .asic-panel .actions .search {
    grid-column: auto;
  }
}

@media (max-width: 760px) {
  .asic-panel .toolbar {
    padding: 16px;
  }
  .asic-panel .actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .asic-panel .actions .search {
    grid-column: 1 / -1;
  }
}

/* Farm map and insight dialogs */
.chart-panel {
  min-height: 500px;
  height: auto;
}

.farm-map-legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #667085;
  font-size: 12px;
  font-weight: 750;
}

.farm-map-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.farm-map-legend .ok { background: #34c759; }
.farm-map-legend .hot { background: #ff3b30; }
.farm-map-legend .off { background: #9ca3af; }

.farm-map {
  display: grid;
  grid-template-columns: repeat(5, minmax(178px, 1fr));
  gap: 14px;
  padding: 0 24px 24px;
  overflow-x: auto;
}

.rack-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid #e4eaf2;
  border-radius: 14px;
  background: #f8fafc;
}

.rack-card header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  color: #111827;
  font-size: 13px;
}

.rack-card header span {
  color: #667085;
  font-weight: 800;
}

.shelf-grid {
  display: grid;
  gap: 7px;
}

.shelf-row {
  display: grid;
  grid-template-columns: 18px repeat(5, minmax(24px, 1fr));
  gap: 6px;
  align-items: center;
}

.shelf-row small {
  color: #98a2b3;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
}

.farm-slot {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  aspect-ratio: 1.16 / 1;
  min-width: 0;
  min-height: 34px;
  padding: 4px 2px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  overflow: hidden;
  box-shadow: inset 0 -8px 12px rgba(0, 0, 0, .08);
}

.farm-slot .slot-worker {
  max-width: 100%;
  padding-inline: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.farm-slot small {
  display: block;
  max-width: 100%;
  margin-top: 3px;
  overflow: hidden;
  color: rgba(255, 255, 255, .92);
  font-size: 9px;
  font-weight: 850;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.farm-slot.ok {
  background: linear-gradient(180deg, #46d86d, #25b84d);
}

.farm-slot.hot {
  background: linear-gradient(180deg, #ff6961, #dc2626);
}

.farm-slot.problem {
  background: linear-gradient(180deg, #ff5b55, #c81e1e);
}

.farm-slot.offline {
  background: linear-gradient(180deg, #cbd5e1, #94a3b8);
}

.farm-slot.empty {
  border-color: #e5e7eb;
  background: #eef2f7;
  box-shadow: none;
}

button.farm-slot:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(15, 23, 42, .14);
}

.insight-card {
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  border-radius: 18px;
  background: #fff;
}

.insight-card canvas {
  display: block;
  width: 100%;
  height: 260px !important;
  max-height: 260px;
  cursor: crosshair;
}

#powerInsightChart {
  height: 240px !important;
  max-height: 240px;
}

.interactive-chart {
  position: relative;
}

.chart-readout {
  position: absolute;
  z-index: 3;
  min-width: 118px;
  padding: 8px 10px;
  border: 1px solid rgba(139, 92, 255, .22);
  border-radius: 12px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 14px 30px rgba(15, 23, 42, .12);
  pointer-events: none;
}

.chart-readout b,
.chart-readout span {
  display: block;
}

.chart-readout b {
  color: #1d1d1f;
  font-size: 14px;
  line-height: 1.1;
}

.chart-readout span {
  margin-top: 3px;
  color: #667085;
  font-size: 11px;
  font-weight: 750;
}

.offline-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.offline-summary article,
.cost-calc article {
  padding: 14px;
  border: 1px solid #e4eaf2;
  border-radius: 14px;
  background: #f8fafc;
}

.offline-summary span,
.cost-calc span {
  display: block;
  color: #667085;
  font-size: 12px;
  font-weight: 750;
}

.offline-summary b,
.cost-calc b {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.insight-card h4 {
  margin: 16px 0 10px;
}

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

.offline-row {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 12px;
  border: 1px solid #e4eaf2;
  border-radius: 14px;
  background: #fff;
  text-align: left;
}

.offline-row:hover {
  background: #f8fafc;
}

.offline-row span b,
.offline-row span small {
  display: block;
}

.offline-row span small {
  margin-top: 2px;
  color: #667085;
}

.offline-row strong {
  color: #dc2626;
}

.empty-note {
  margin: 0;
  padding: 14px;
  border: 1px dashed #dbe6f2;
  border-radius: 14px;
  color: #667085;
  background: #f8fafc;
}

.period-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.period-tabs button {
  height: 42px;
  border: 1px solid #dbe6f2;
  border-radius: 12px;
  background: #f8fafc;
  color: #344054;
  font-weight: 850;
}

.period-tabs button.active {
  border-color: #b6d7ff;
  background: #edf6ff;
  color: #0969da;
}

.cost-calc {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.cost-calc label {
  display: grid;
  gap: 7px;
}

.cost-calc input,
.cost-calc select {
  height: 46px;
  padding: 0 12px;
  border: 1px solid #dbe6f2;
  border-radius: 12px;
  background: #f8fafc;
}

@media (max-width: 1280px) {
  .farm-map {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .farm-map {
    grid-template-columns: 1fr;
    padding-inline: 16px;
  }
  .offline-summary,
  .period-tabs,
  .cost-calc {
    grid-template-columns: 1fr;
  }
}

/* v6: readable farm map and compact market row */
.events-btn {
  height: 48px;
  padding: 0 18px;
  border: 1px solid #dbe6f2;
  border-radius: 14px;
  background: #f8fafc;
  color: #344054;
  font-weight: 850;
  box-shadow: 0 8px 20px rgba(15, 23, 42, .045);
}

.events-btn:hover {
  border-color: #b6d7ff;
  background: #edf6ff;
  color: #0969da;
}

.analytics-grid {
  grid-template-columns: minmax(0, 1fr) !important;
}

.chart-panel {
  min-height: auto;
  overflow: visible;
}

.chart-panel .panel-head {
  align-items: flex-start;
}

.farm-map-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.map-edit-btn {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 850;
}

.farm-map {
  grid-template-columns: repeat(var(--rack-count, 3), minmax(min(100%, calc(98px + var(--slots-per-shelf, 5) * 46px)), 1fr));
  gap: 16px;
  padding: 2px 24px 26px;
  overflow-x: auto;
}

.rack-card {
  padding: 15px 16px 17px;
  border-radius: 15px;
}

.rack-card header {
  margin-bottom: 10px;
  font-size: 13px;
}

.shelf-grid {
  gap: 8px;
}

.shelf-row {
  grid-template-columns: 12px repeat(var(--slots-per-shelf, 5), minmax(34px, 1fr));
  gap: 7px;
}

.shelf-row small {
  font-size: 10px;
  text-align: left;
}

.farm-slot {
  min-height: 48px;
  padding: 7px 4px 6px;
  border-radius: 11px;
}

.farm-slot .slot-worker {
  max-width: none;
  width: 100%;
  font-size: 12px;
  letter-spacing: 0;
  text-align: center;
}

.farm-slot small {
  margin-top: 5px;
  max-width: none;
  width: 100%;
  font-size: 11px;
  text-align: center;
}

.map-config-card {
  max-width: 720px;
}

.map-picker-card {
  width: min(720px, calc(100vw - 32px));
  max-height: min(86vh, 820px);
  overflow: hidden;
}

.map-picker-card .panel-head.compact {
  align-items: flex-start;
}

.map-picker-card .panel-head h3 {
  margin-bottom: 4px;
}

.map-picker-search {
  display: grid;
  gap: 8px;
  margin: 12px 0 14px;
}

.map-picker-search span {
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}

.map-picker-search input {
  height: 52px;
  border: 1px solid #dbe6f2;
  border-radius: 14px;
  background: #f8fafc;
  padding: 0 16px;
  font-size: 16px;
}

.map-picker-search input:focus {
  border-color: #93c5fd;
  outline: 3px solid rgba(0, 113, 227, .12);
}

.map-picker-list {
  display: grid;
  gap: 10px;
  max-height: min(58vh, 520px);
  overflow-y: auto;
  padding: 2px 4px 4px;
}

.map-picker-row {
  display: grid;
  grid-template-columns: minmax(120px, 170px) 1fr auto;
  align-items: center;
  gap: 14px;
  min-height: 66px;
  border: 1px solid #e0e7ef;
  border-radius: 16px;
  background: #fff;
  padding: 12px 14px;
  text-align: left;
  color: #111827;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .05);
}

.map-picker-row:hover {
  border-color: #93c5fd;
  background: #f8fbff;
}

.map-picker-row.current {
  border-color: #34c759;
  background: #f0fff5;
}

.map-picker-row.clear {
  border-color: #fecaca;
  background: #fff7f7;
}

.map-picker-row b,
.map-picker-row span,
.map-picker-row em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-picker-row b {
  color: #0f172a;
  font-size: 17px;
}

.map-picker-row span {
  color: #475467;
  font-size: 14px;
}

.map-picker-row em {
  color: #667085;
  font-size: 13px;
  font-style: normal;
  text-align: right;
}

.map-preset-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.map-preset-row button {
  min-height: 48px;
  border-radius: 12px;
  font-weight: 850;
}

.farm-map.editing .farm-slot:not(.empty) {
  cursor: grab;
  outline: 2px dashed rgba(0, 113, 227, .28);
  outline-offset: 2px;
}

.farm-map.editing .farm-slot.empty {
  border-style: dashed;
  background: #f8fafc;
}

.zec-panel {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 0 26px;
  min-height: 188px;
  margin-top: 16px;
}

.zec-panel .panel-head {
  padding-bottom: 10px;
}

.zec-panel .panel-head {
  grid-column: 1 / -1;
}

.zec-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 10px;
  padding: 0 0 14px 24px;
}

.zec-summary div {
  min-height: 62px;
  padding: 10px 12px;
  border-radius: 13px;
}

.zec-summary span {
  font-size: 12px;
}

.zec-summary strong,
.zec-summary b {
  margin-top: 5px;
  font-size: 22px;
}

.zec-panel canvas {
  height: 136px !important;
  max-height: 136px;
  padding: 0 26px 12px 0;
}

.market-hint {
  grid-column: 1 / -1;
  display: none;
}

.asic-panel + .model-strip {
  margin-top: 18px;
}

.events-card .feed {
  padding: 0 0 8px;
}

@media (max-width: 1280px) {
  .farm-map {
    grid-template-columns: repeat(2, minmax(250px, 1fr));
  }
}

@media (max-width: 900px) {
  .zec-panel {
    grid-template-columns: 1fr;
  }
  .zec-panel canvas {
    padding: 0 18px 14px;
  }
}

@media (max-width: 760px) {
  .farm-map-tools {
    justify-content: flex-start;
  }
  .farm-map {
    grid-template-columns: 1fr;
  }
  .shelf-row {
    grid-template-columns: 12px repeat(var(--slots-per-shelf, 5), minmax(34px, 1fr));
  }
  .map-preset-row {
    grid-template-columns: 1fr;
  }
  .map-picker-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .map-picker-row em {
    text-align: left;
  }
}

/* 20260808: Windows sharpness, stable table actions, and mobile farm switch */
html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.table-wrap table {
  min-width: 1320px;
}

.table-wrap th,
.table-wrap td {
  white-space: nowrap;
}

.table-wrap tbody td {
  font-size: 13.5px;
  line-height: 1.25;
}

.table-wrap th:last-child,
.table-wrap td:last-child {
  min-width: 274px;
}

.row-actions {
  display: grid !important;
  grid-template-columns: repeat(7, 32px);
  gap: 6px;
  width: max-content;
  min-width: 260px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(248, 250, 252, .92);
  box-shadow: inset 0 0 0 1px #e4eaf2, 0 8px 18px rgba(15, 23, 42, .06);
}

.row-actions button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 11px;
  box-shadow: none;
}

.row-actions button i {
  font-size: 15px;
}

@media (min-width: 921px) {
  .topbar {
    min-height: 72px;
  }

  .asic-panel .actions {
    grid-template-columns: repeat(6, minmax(138px, 1fr));
    gap: 12px;
  }

  .asic-panel .actions button,
  .asic-panel .actions .search {
    height: 52px;
    border-radius: 14px;
  }
}

@media (max-width: 920px) {
  body {
    padding-bottom: calc(86px + env(safe-area-inset-bottom));
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 44px 44px;
    gap: 8px;
    align-items: center;
    height: auto;
    min-height: 66px;
    padding: 10px 12px;
  }

  .topbar .mobile-title,
  .topbar .top-spacer,
  .topbar .farm-add-btn,
  .topbar .events-btn,
  .topbar .profile {
    display: none !important;
  }

  .topbar .farm-switch {
    display: flex !important;
    grid-column: 2;
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 10px;
    border-radius: 14px;
    overflow: hidden;
  }

  .topbar .farm-switch span {
    flex: 0 0 auto;
    font-size: 11px;
    font-weight: 750;
  }

  .topbar .farm-switch select {
    min-width: 0;
    width: 100%;
    font-size: 14px;
    font-weight: 850;
    text-overflow: ellipsis;
  }

  #mobileMenuBtn {
    grid-column: 1;
  }

  #themeBtn {
    grid-column: 3;
  }

  #logoutBtn {
    grid-column: 4;
  }

  .content {
    padding: 16px 14px 0;
  }

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

  .metric {
    min-height: 126px;
    padding: 16px 14px;
    border-radius: 18px;
  }

  .metric h3,
  .metric small,
  .metric p {
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
  }

  .metric h3,
  .metric small {
    font-size: 15px;
    line-height: 1.18;
  }

  .metric strong {
    font-size: clamp(30px, 9vw, 42px);
    line-height: 1.04;
    white-space: normal;
  }

  .metric p {
    font-size: 15px;
    line-height: 1.28;
  }

  .metric:nth-child(4),
  .metric:nth-child(5) {
    grid-column: 1 / -1;
  }

  .metric:nth-child(4) strong,
  .metric:nth-child(5) strong {
    font-size: clamp(34px, 10vw, 46px);
  }

  .zec-panel {
    grid-template-columns: 1fr;
    min-height: auto;
    margin-top: 14px;
    padding-bottom: 16px;
  }

  .zec-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 0 16px 12px;
  }

  .zec-summary strong,
  .zec-summary b {
    font-size: clamp(22px, 7vw, 30px);
    line-height: 1.05;
  }

  .zec-panel canvas {
    height: 160px !important;
    max-height: 160px;
    padding: 0 16px 10px;
  }

  .asic-panel .toolbar {
    padding: 16px 14px;
  }

  .asic-panel .actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .asic-panel .actions button,
  .asic-panel .actions .search {
    height: 48px;
    border-radius: 13px;
    font-size: 14px;
  }

  .asic-panel .actions .search {
    grid-column: 1 / -1;
  }

  .bottom-nav {
    height: calc(76px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
  }
}

@media (max-width: 420px) {
  .topbar {
    grid-template-columns: 40px minmax(0, 1fr) 40px 40px;
    padding: 9px 10px;
  }

  .topbar .farm-switch {
    height: 42px;
  }

  .metric-grid {
    gap: 10px;
  }

  .metric {
    min-height: 116px;
    padding: 14px 12px;
  }

  .metric h3,
  .metric small,
  .metric p {
    font-size: 14px;
  }
}

/* 20260808 v2: force desktop row action buttons to stay readable on Windows */
@media (min-width: 921px) {
  .table-wrap table {
    min-width: 1420px !important;
  }

  .table-wrap th:last-child,
  .table-wrap td:last-child {
    width: 342px !important;
    min-width: 342px !important;
    max-width: 342px !important;
  }

  .table-wrap th:last-child {
    text-align: center;
  }

  .table-wrap td:last-child {
    padding-left: 18px !important;
    padding-right: 18px !important;
  }

  .table-wrap .row-actions {
    display: grid !important;
    grid-template-columns: repeat(7, 38px) !important;
    gap: 7px !important;
    justify-content: center !important;
    align-items: center !important;
    width: 324px !important;
    min-width: 324px !important;
    max-width: 324px !important;
    height: 54px !important;
    padding: 7px !important;
    border-radius: 22px !important;
    background: #f8fafc !important;
    border: 1px solid #dfe7f1 !important;
    box-shadow: 0 10px 22px rgba(15, 23, 42, .08) !important;
  }

  .table-wrap .row-actions button {
    display: grid !important;
    place-items: center !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    max-width: 38px !important;
    max-height: 38px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 13px !important;
    font-size: 16px !important;
    line-height: 1 !important;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .55) !important;
  }

  .table-wrap .row-actions button i {
    display: block !important;
    font-size: 16px !important;
    line-height: 1 !important;
    font-style: normal !important;
  }

  .table-wrap .row-actions .action-check {
    background: #e7f1ff !important;
    color: #0969da !important;
  }

  .table-wrap .row-actions .action-locate {
    background: #fff3df !important;
    color: #9a5a00 !important;
  }

  .table-wrap .row-actions .action-reboot,
  .table-wrap .row-actions .action-info {
    background: #f4f6f9 !important;
    color: #1f2937 !important;
  }

  .table-wrap .row-actions .action-stop {
    background: #ffe4e6 !important;
    color: #ef4444 !important;
  }

  .table-wrap .row-actions .action-start {
    background: #eaf8ef !important;
    color: #188038 !important;
  }

  .table-wrap .row-actions .action-delete {
    background: #fff1f2 !important;
    color: #ef4444 !important;
  }
}

/* 20260808: polished auth card */
.login-overlay {
  background:
    radial-gradient(circle at 20% 18%, rgba(0, 113, 227, .08), transparent 30%),
    radial-gradient(circle at 82% 78%, rgba(52, 199, 89, .08), transparent 28%),
    linear-gradient(135deg, #f8fafc 0%, #f3f6fa 52%, #eef3f8 100%) !important;
  backdrop-filter: none;
}

.login-card {
  width: min(440px, calc(100vw - 32px)) !important;
  padding: 34px !important;
  border: 1px solid #e0e7ef !important;
  border-radius: 18px !important;
  background: rgba(255, 255, 255, .96) !important;
  color: #111827 !important;
  box-shadow: 0 30px 90px rgba(15, 23, 42, .14) !important;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px !important;
  padding: 0 !important;
}

.login-brand .brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 14px;
}

.login-brand strong {
  font-size: 21px;
  letter-spacing: 0;
}

.login-card h1 {
  margin: 0 0 22px !important;
  color: #111827;
  font-size: 30px !important;
  line-height: 1.12;
}

.login-card label {
  gap: 8px !important;
  margin-bottom: 14px !important;
  color: #667085 !important;
  font-size: 14px;
  font-weight: 750;
}

.login-card input {
  height: 54px !important;
  border: 1px solid #dbe6f2 !important;
  border-radius: 13px !important;
  background: #f8fafc !important;
  color: #111827 !important;
  padding: 0 16px !important;
  font-size: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75);
}

.login-card input:focus {
  border-color: #93c5fd !important;
  background: #fff !important;
  outline: 3px solid rgba(0, 113, 227, .12);
}

.login-card button {
  height: 52px !important;
  border-radius: 13px !important;
  font-size: 16px;
  font-weight: 850;
}

.login-card button[type="submit"] {
  border-color: #0969da !important;
  background: linear-gradient(180deg, #147ce5, #0969da) !important;
  color: #fff !important;
  box-shadow: 0 12px 24px rgba(9, 105, 218, .22);
}

.login-card .ghost {
  border: 1px solid #dbe6f2 !important;
  background: #f8fafc !important;
  color: #344054 !important;
}

.login-card .hint {
  min-height: 18px;
  margin: 12px 0 0;
  color: #667085;
  font-size: 13px;
}

@media (max-width: 520px) {
  .login-card {
    padding: 24px !important;
  }

  .login-card h1 {
    font-size: 26px !important;
  }
}

/* 20260808: polished profile dialog */
#profileModal::backdrop {
  background: rgba(15, 23, 42, .34);
  backdrop-filter: blur(8px);
}

#profileModal .profile-card {
  width: min(860px, calc(100vw - 36px)) !important;
  max-height: min(88vh, 940px);
  padding: 28px !important;
  overflow-y: auto;
  border: 1px solid #e0e7ef !important;
  border-radius: 20px !important;
  background: #fff !important;
  color: #111827 !important;
  box-shadow: 0 32px 90px rgba(15, 23, 42, .22) !important;
}

#profileModal .panel-head.compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 18px;
  margin: 0;
}

#profileModal .panel-head.compact h3 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

#profileModal .small-btn {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  min-width: 42px;
  padding: 0;
  border: 1px solid #dbe6f2 !important;
  border-radius: 13px !important;
  background: #f8fafc !important;
  color: #111827 !important;
  font-size: 22px;
}

#profileModal .profile-summary,
#profileModal .profile-sections section,
#profileModal .panel-user-row,
#profileModal .farm-download-card {
  border: 1px solid #e0e7ef !important;
  border-radius: 16px !important;
  background: #f8fafc !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8);
}

#profileModal .profile-summary {
  gap: 16px;
  padding: 18px !important;
}

#profileModal .avatar.big {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #111827;
  color: #fff;
  font-size: 28px;
}

#profileModal .profile-summary b {
  color: #111827;
  font-size: 20px;
}

#profileModal .profile-summary span {
  color: #667085;
  font-size: 15px;
}

#profileModal .profile-sections {
  gap: 16px;
  margin-top: 18px;
}

#profileModal .profile-sections section {
  padding: 18px;
}

#profileModal .profile-sections h4 {
  margin: 0 0 14px;
  color: #111827;
  font-size: 19px;
}

#profileModal .subscription-card {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

#profileModal .subscription-card div {
  padding: 14px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: #fff;
}

#profileModal .subscription-card span,
#profileModal .subscription-card b {
  display: block;
}

#profileModal .subscription-card span {
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}

#profileModal .subscription-card b {
  margin-top: 6px;
  color: #0f172a;
  font-size: 18px;
}

#profileModal .form-grid {
  gap: 12px 14px;
}

#profileModal label span {
  color: #667085;
  font-size: 13px;
  font-weight: 800;
}

#profileModal input,
#profileModal select {
  height: 50px;
  border: 1px solid #dbe6f2 !important;
  border-radius: 13px !important;
  background: #fff !important;
  color: #111827 !important;
  padding: 0 14px;
  font-size: 15px;
}

#profileModal input:focus,
#profileModal select:focus {
  border-color: #93c5fd !important;
  outline: 3px solid rgba(0, 113, 227, .12);
}

#profileModal .farm-enabled-label {
  align-self: end;
  display: flex;
  min-height: 50px;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid #dbe6f2;
  border-radius: 13px;
  background: #fff;
}

#profileModal .farm-enabled-label input {
  width: 18px;
  height: 18px;
  padding: 0;
}

#profileModal .farm-enabled-label span {
  color: #111827;
  font-size: 14px;
}

#profileModal .farm-editor-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, auto);
  gap: 12px;
  margin-top: 14px;
}

#profileModal .farm-editor-actions button {
  min-height: 48px;
  border-radius: 13px;
  font-size: 15px;
  font-weight: 850;
}

#profileModal #saveProfileFarmBtn {
  border: 1px solid #b6d7ff !important;
  background: #edf6ff !important;
  color: #0969da !important;
}

#profileModal #deleteProfileFarmBtn {
  border: 1px solid #ffc9c9 !important;
  background: #fff1f1 !important;
  color: #d1242f !important;
}

#profileModal .full-btn {
  height: 50px !important;
  margin-top: 14px;
  border-radius: 13px !important;
  font-size: 15px;
  font-weight: 850;
}

#profileModal #savePasswordBtn,
#profileModal #savePanelUserBtn {
  border-color: #0969da !important;
  background: linear-gradient(180deg, #147ce5, #0969da) !important;
  color: #fff !important;
  box-shadow: 0 12px 24px rgba(9, 105, 218, .18);
}

#profileModal .farm-download-card {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 16px !important;
  margin-top: 12px;
  background: #fff !important;
}

#profileModal .farm-download-card b {
  color: #111827;
  font-size: 18px;
}

#profileModal .farm-download-card span {
  color: #667085;
  font-size: 13px;
}

#profileModal .farm-download-actions {
  gap: 10px;
}

#profileModal .download-btn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 850;
}

#profileModal #downloadFarmAgentBtn {
  border: 1px solid #b8efc9 !important;
  background: #effaf3 !important;
  color: #17783a !important;
}

#profileModal #downloadFarmEnvBtn {
  border: 1px solid #b6d7ff !important;
  background: #edf6ff !important;
  color: #0969da !important;
}

#profileModal .panel-users-list {
  gap: 10px;
}

#profileModal .panel-user-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
  padding: 14px !important;
  background: #fff !important;
}

#profileModal .panel-user-row b {
  color: #111827;
  font-size: 17px;
}

#profileModal .panel-user-row span {
  color: #667085;
  font-size: 13px;
}

#profileModal .panel-user-row button {
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  font-weight: 850;
}

#profileModal .panel-user-row button:first-of-type {
  border-color: #b6d7ff;
  background: #edf6ff;
  color: #0969da;
}

#profileModal .panel-user-row button:last-of-type {
  border-color: #ffc9c9;
  background: #fff1f1;
  color: #d1242f;
}

@media (max-width: 760px) {
  #profileModal .profile-card {
    width: calc(100vw - 20px) !important;
    max-height: 92vh;
    padding: 20px !important;
    border-radius: 18px !important;
  }

  #profileModal .panel-head.compact h3 {
    font-size: 25px;
  }

  #profileModal .form-grid,
  #profileModal .farm-download-card,
  #profileModal .panel-user-row,
  #profileModal .subscription-card {
    grid-template-columns: 1fr;
  }

  #profileModal .farm-download-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  #profileModal .farm-editor-actions {
    grid-template-columns: 1fr;
  }
}

/* 20260808: fixed farm-map slot size across all rack layouts */
.chart-panel {
  overflow: hidden;
}

.farm-map {
  --farm-slot-size: 68px;
  --farm-slot-height: 58px;
  display: grid !important;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  grid-template-columns: none !important;
  justify-content: start;
  gap: 16px !important;
  width: 100%;
  padding: 2px 24px 26px !important;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-padding-inline: 24px;
}

.rack-card {
  width: max-content;
  min-width: 0 !important;
  padding: 16px !important;
}

.shelf-grid {
  gap: 8px !important;
}

.shelf-row {
  display: grid;
  grid-template-columns: 14px repeat(var(--slots-per-shelf, 5), var(--farm-slot-size)) !important;
  gap: 8px !important;
  align-items: center;
}

.shelf-row > small {
  width: 14px;
  text-align: center !important;
}

.farm-slot {
  width: var(--farm-slot-size) !important;
  height: var(--farm-slot-height) !important;
  min-width: var(--farm-slot-size) !important;
  min-height: var(--farm-slot-height) !important;
  max-width: var(--farm-slot-size) !important;
  max-height: var(--farm-slot-height) !important;
  aspect-ratio: auto !important;
  padding: 7px 4px 6px !important;
  border-radius: 12px !important;
}

.farm-slot .slot-worker {
  font-size: 13px !important;
  line-height: 1.05 !important;
}

.farm-slot small {
  margin-top: 4px !important;
  font-size: 11px !important;
  line-height: 1 !important;
}

@media (max-width: 920px) {
  .farm-map {
    --farm-slot-size: 64px;
    --farm-slot-height: 56px;
    padding-inline: 16px !important;
    scroll-padding-inline: 16px;
  }
}

@media (max-width: 520px) {
  .farm-map {
    --farm-slot-size: 58px;
    --farm-slot-height: 52px;
  }

  .shelf-row {
    grid-template-columns: 12px repeat(var(--slots-per-shelf, 5), var(--farm-slot-size)) !important;
    gap: 7px !important;
  }
}

/* 20260809: large monitor layout for 27-32 inch displays */
@media (min-width: 2100px) {
  .content {
    max-width: 2280px !important;
    padding: 28px 34px 40px !important;
  }

  .topbar {
    padding-inline: 34px;
  }

  .metric-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 18px !important;
  }

  .metric {
    min-height: 124px;
    padding: 24px 28px;
  }

  .chart-panel {
    min-height: auto !important;
  }

  .chart-panel .panel-head {
    padding: 24px 28px 18px;
  }

  .farm-map {
    --farm-slot-size: 68px;
    --farm-slot-height: 58px;
    grid-auto-columns: max-content;
    justify-content: space-between;
    gap: 18px !important;
    padding: 4px 28px 28px !important;
    overflow-x: auto;
  }

  .rack-card {
    padding: 18px !important;
  }

  .shelf-row {
    gap: 8px !important;
  }

  .zec-panel {
    grid-template-columns: 460px minmax(0, 1fr);
    gap: 0 32px;
  }

  .zec-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-left: 28px;
  }

  .zec-panel canvas {
    height: 168px !important;
    max-height: 168px;
    padding-right: 28px;
  }

  .asic-panel .toolbar {
    padding: 24px 28px;
  }

  .asic-panel .actions {
    grid-template-columns: repeat(6, minmax(170px, 1fr)) !important;
    gap: 14px !important;
  }

  .asic-panel .actions button,
  .asic-panel .actions .search {
    height: 54px;
  }

  .filterbar {
    grid-template-columns: repeat(5, minmax(180px, 1fr)) minmax(140px, .55fr);
    gap: 14px;
    padding: 20px 28px;
  }

  .table-wrap table {
    min-width: 1680px !important;
  }

  .table-wrap tbody td {
    font-size: 14px;
  }
}

@media (min-width: 2400px) {
  .content {
    max-width: 2380px !important;
  }

  .farm-map {
    --farm-slot-size: 72px;
    --farm-slot-height: 60px;
  }

  .asic-panel .actions {
    grid-template-columns: repeat(6, minmax(190px, 1fr)) !important;
  }
}

/* 20260810: fixed physical farm map geometry on every computer */
.farm-map {
  --farm-slot-size: 70px !important;
  --farm-slot-height: 60px !important;
  --farm-slot-gap: 9px !important;
  --farm-row-label: 18px !important;
  display: grid !important;
  grid-auto-flow: column !important;
  grid-auto-columns: max-content !important;
  grid-template-columns: none !important;
  justify-content: start !important;
  align-items: start !important;
  gap: 18px !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 4px 28px 30px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scroll-padding-inline: 28px !important;
  overscroll-behavior-x: contain;
}

.rack-card {
  flex: 0 0 auto !important;
  width: calc(
    var(--farm-row-label) +
    (var(--slots-per-shelf, 5) * var(--farm-slot-size)) +
    (var(--slots-per-shelf, 5) * var(--farm-slot-gap)) +
    34px
  ) !important;
  min-width: calc(
    var(--farm-row-label) +
    (var(--slots-per-shelf, 5) * var(--farm-slot-size)) +
    (var(--slots-per-shelf, 5) * var(--farm-slot-gap)) +
    34px
  ) !important;
  max-width: calc(
    var(--farm-row-label) +
    (var(--slots-per-shelf, 5) * var(--farm-slot-size)) +
    (var(--slots-per-shelf, 5) * var(--farm-slot-gap)) +
    34px
  ) !important;
  padding: 16px !important;
  box-sizing: border-box !important;
}

.shelf-grid {
  gap: var(--farm-slot-gap) !important;
}

.shelf-row {
  grid-template-columns: var(--farm-row-label) repeat(var(--slots-per-shelf, 5), var(--farm-slot-size)) !important;
  gap: var(--farm-slot-gap) !important;
  align-items: center !important;
}

.shelf-row > small {
  width: var(--farm-row-label) !important;
  min-width: var(--farm-row-label) !important;
  text-align: center !important;
}

.farm-slot {
  width: var(--farm-slot-size) !important;
  height: var(--farm-slot-height) !important;
  min-width: var(--farm-slot-size) !important;
  min-height: var(--farm-slot-height) !important;
  max-width: var(--farm-slot-size) !important;
  max-height: var(--farm-slot-height) !important;
  box-sizing: border-box !important;
  padding: 7px 5px 6px !important;
  border-radius: 12px !important;
  aspect-ratio: auto !important;
}

.farm-slot .slot-worker {
  font-size: 14px !important;
  line-height: 1.05 !important;
  letter-spacing: 0 !important;
}

.farm-slot small {
  margin-top: 4px !important;
  font-size: 12px !important;
  line-height: 1 !important;
  letter-spacing: 0 !important;
}

@media (max-width: 760px) {
  .farm-map {
    --farm-slot-size: 70px !important;
    --farm-slot-height: 60px !important;
    padding-inline: 18px !important;
    scroll-padding-inline: 18px !important;
  }
}

/* 20260810: stable ASIC toolbar, search on the first row */
.asic-panel .toolbar {
  padding: 24px 32px 22px !important;
}

.asic-panel .actions {
  display: grid !important;
  grid-template-columns: repeat(7, minmax(132px, 1fr)) !important;
  gap: 12px !important;
  align-items: stretch !important;
  width: 100% !important;
}

.asic-panel .actions button,
.asic-panel .actions .search {
  width: 100% !important;
  min-width: 0 !important;
  height: 54px !important;
  border-radius: 14px !important;
  margin: 0 !important;
}

.asic-panel .actions button {
  padding: 0 12px !important;
  white-space: normal !important;
  line-height: 1.08 !important;
}

.asic-panel .actions .search {
  order: 16 !important;
  display: flex !important;
  grid-column: auto !important;
  align-items: center !important;
  justify-self: stretch !important;
  padding: 0 14px !important;
  background: #f8fafc !important;
  border: 1px solid #dbe6f2 !important;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .05) !important;
}

.asic-panel .actions .search input {
  width: 100% !important;
  min-width: 0 !important;
}

#allAsicsBtn { order: 10 !important; }
#bulkAddBtn { order: 11 !important; }
#scanNetworkBtn { order: 12 !important; }
#checkAllBtn { order: 13 !important; }
#workerSelectedBtn { order: 14 !important; }
#installPatchSelectedBtn { order: 15 !important; }
#addAsicBtn { order: 20 !important; }
#poolSelectedBtn { order: 21 !important; }
#exportBtn { order: 22 !important; }
#rebootAllBtn { order: 30 !important; }
#rebootSelectedBtn { order: 31 !important; }
#deleteSelectedBtn { order: 32 !important; }

@media (max-width: 1500px) {
  .asic-panel .actions {
    grid-template-columns: repeat(4, minmax(150px, 1fr)) !important;
  }
}

@media (max-width: 900px) {
  .asic-panel .toolbar {
    padding: 18px 16px !important;
  }

  .asic-panel .actions {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .asic-panel .actions .search {
    grid-column: 1 / -1 !important;
  }
}

/* 0.20: visible panel version */
.app-version {
  display: inline-flex;
  align-items: center;
  width: max-content;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  color: #6b7280;
  background: #eef2f7;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.4;
}

.app-footer-version {
  padding: 14px 4px 4px;
  color: #8a94a6;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

/* v0.40: board-health quick filter in the main ASIC toolbar */
#boardProblemFilterBtn {
  order: 11 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-inline: 16px !important;
  white-space: nowrap !important;
}

#boardProblemFilterBtn > span {
  min-width: 0;
  overflow: hidden;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#boardProblemFilterBtn > b {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  min-width: 28px;
  width: max-content;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  color: #fff;
  background: #d92d20;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#boardProblemFilterBtn.active {
  color: #fff !important;
  border-color: #d92d20 !important;
  background: #d92d20 !important;
  box-shadow: 0 7px 18px rgba(217, 45, 32, .2) !important;
}

#boardProblemFilterBtn.active > b {
  color: #b42318;
  background: #fff;
}

#boardProblemFilterBtn:disabled > b {
  background: #98a2b3;
}

@media (min-width: 1801px) {
  .asic-panel .actions {
    grid-template-columns: repeat(8, minmax(132px, 1fr)) !important;
  }
}

@media (max-width: 760px) {
  .app-footer-version {
    padding-bottom: 88px;
  }
}

/* v0.43: persistent dark theme */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1319;
  --panel: #171c23;
  --panel-strong: #1b2129;
  --line: rgba(255, 255, 255, .10);
  --text: #edf2f7;
  --muted: #9ca8b8;
}

html[data-theme="dark"] body {
  background: #0f1319;
  color: var(--text);
}

html[data-theme="dark"] .sidebar,
html[data-theme="dark"] .topbar {
  border-color: var(--line);
  background: rgba(18, 23, 30, .94);
}

html[data-theme="dark"] .brand,
html[data-theme="dark"] .profile,
html[data-theme="dark"] .mobile-title,
html[data-theme="dark"] .icon-btn,
html[data-theme="dark"] .farm-switch select,
html[data-theme="dark"] .legend-row,
html[data-theme="dark"] td,
html[data-theme="dark"] .feed-row,
html[data-theme="dark"] .panel h2,
html[data-theme="dark"] .metric strong,
html[data-theme="dark"] .zec-summary strong,
html[data-theme="dark"] .zec-summary b {
  color: var(--text);
}

html[data-theme="dark"] .brand-mark,
html[data-theme="dark"] .avatar {
  color: #fff;
  background: #080b10;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}

html[data-theme="dark"] .side-nav {
  border-color: var(--line);
  background: rgba(24, 30, 38, .82);
  box-shadow: 0 14px 36px rgba(0, 0, 0, .18);
}

html[data-theme="dark"] .side-nav button { color: #cbd4df; }
html[data-theme="dark"] .side-nav button span { color: #9ca8b8; }
html[data-theme="dark"] .side-nav button:hover:not(.active) {
  color: #69adff;
  background: #222a34;
}

html[data-theme="dark"] .next-check,
html[data-theme="dark"] .metric,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .model-strip {
  border-color: var(--line);
  background: var(--panel);
  box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
}

html[data-theme="dark"] .metric h3,
html[data-theme="dark"] .panel h2 span,
html[data-theme="dark"] .farm-map-legend,
html[data-theme="dark"] .market-hint,
html[data-theme="dark"] .feed-row p,
html[data-theme="dark"] .feed-row time {
  color: var(--muted);
}

html[data-theme="dark"] .metric > span,
html[data-theme="dark"] .market-source,
html[data-theme="dark"] .zec-summary div,
html[data-theme="dark"] .detail-item,
html[data-theme="dark"] .detail-fans,
html[data-theme="dark"] .board-card,
html[data-theme="dark"] .scan-row,
html[data-theme="dark"] .pool-row b,
html[data-theme="dark"] .profile-summary,
html[data-theme="dark"] .panel-user-row,
html[data-theme="dark"] .schedule-main-toggle,
html[data-theme="dark"] .schedule-row {
  border-color: var(--line);
  background: #202630;
}

html[data-theme="dark"] select,
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .search input,
html[data-theme="dark"] .filterbar select,
html[data-theme="dark"] .schedule-toolbar input:not([type="checkbox"]),
html[data-theme="dark"] .schedule-row input[type="time"],
html[data-theme="dark"] .form-grid input,
html[data-theme="dark"] .bulk-field textarea,
html[data-theme="dark"] .pool-row input,
html[data-theme="dark"] #profileModal input,
html[data-theme="dark"] #profileModal select,
html[data-theme="dark"] .map-picker-search input {
  border-color: var(--line);
  background: #11161d;
  color: var(--text);
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder { color: #717e8e; }

html[data-theme="dark"] .farm-switch,
html[data-theme="dark"] .icon-btn:hover,
html[data-theme="dark"] .tabs .active,
html[data-theme="dark"] .actions .active,
html[data-theme="dark"] .actions button:hover,
html[data-theme="dark"] .filter-reset:hover,
html[data-theme="dark"] .schedule-toolbar button,
html[data-theme="dark"] .row-actions button,
html[data-theme="dark"] .app-version {
  border-color: var(--line);
  background: #222a34;
  color: var(--text);
}

html[data-theme="dark"] .farm-add-btn {
  border-color: rgba(65, 148, 255, .35);
  background: rgba(26, 115, 232, .16);
  color: #69adff;
}

html[data-theme="dark"] .toolbar,
html[data-theme="dark"] .filterbar {
  border-color: var(--line);
  background: #151a21;
}

html[data-theme="dark"] .tabs button,
html[data-theme="dark"] .actions button,
html[data-theme="dark"] .link-btn,
html[data-theme="dark"] .modal-actions button,
html[data-theme="dark"] .filter-reset {
  border-color: var(--line);
  background: #1c232c;
  color: #dce4ee;
  box-shadow: none;
}

html[data-theme="dark"] .blue-soft { color: #69adff !important; border-color: rgba(65, 148, 255, .38) !important; }
html[data-theme="dark"] .green-soft { color: #63d985 !important; border-color: rgba(66, 194, 101, .38) !important; }
html[data-theme="dark"] .danger-soft { color: #ff837c !important; border-color: rgba(255, 92, 84, .38) !important; }

html[data-theme="dark"] th,
html[data-theme="dark"] th:last-child,
html[data-theme="dark"] td:last-child {
  border-color: var(--line);
  background: #171c23;
  color: #9ca8b8;
}

html[data-theme="dark"] td { border-color: rgba(255, 255, 255, .07); }
html[data-theme="dark"] tr:hover td,
html[data-theme="dark"] tr:hover td:last-child { background: #1d242d; }

html[data-theme="dark"] .rack-card {
  border-color: var(--line);
  background: #1b222b;
}

html[data-theme="dark"] .rack-card header { color: var(--text); }
html[data-theme="dark"] .rack-card header span,
html[data-theme="dark"] .shelf-row > small { color: #8f9bac; }
html[data-theme="dark"] .farm-slot.empty {
  border-color: rgba(255, 255, 255, .09);
  background: #252c35;
}

html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .insight-card,
html[data-theme="dark"] #profileModal .profile-card,
html[data-theme="dark"] .map-picker-row {
  border-color: var(--line);
  background: #171c23;
  color: var(--text);
  box-shadow: 0 26px 90px rgba(0, 0, 0, .48);
}

html[data-theme="dark"] dialog::backdrop { background: rgba(0, 0, 0, .68); }
html[data-theme="dark"] .map-picker-row b { color: var(--text); }
html[data-theme="dark"] .map-picker-row span,
html[data-theme="dark"] .map-picker-row em { color: var(--muted); }
html[data-theme="dark"] .map-picker-row:hover { border-color: #438bd6; background: #202833; }
html[data-theme="dark"] .map-picker-row.current { border-color: #3fbf68; background: #172a20; }
html[data-theme="dark"] .map-picker-row.clear { border-color: #9f413d; background: #2b1c1d; }

html[data-theme="dark"] .login-overlay { background: rgba(8, 11, 16, .94); }
html[data-theme="dark"] .login-card {
  border-color: var(--line);
  background: #171c23;
  color: var(--text);
  box-shadow: 0 28px 90px rgba(0, 0, 0, .5);
}

html[data-theme="dark"] .login-card input {
  border-color: var(--line);
  background: #10151b;
  color: var(--text);
}

html[data-theme="dark"] .app-footer-version { color: #7f8b9b; }

html[data-theme="dark"] #themeBtn {
  color: #ffd66b;
  background: rgba(255, 196, 61, .08);
}

/* v0.44: complete dark treatment for the ASIC workspace */
html[data-theme="dark"] .asic-panel .actions .search {
  border-color: var(--line) !important;
  background: #1c232c !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .asic-panel .actions .search input {
  border-color: transparent !important;
  background: #11161d !important;
  color: var(--text) !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .table-wrap,
html[data-theme="dark"] .table-wrap table,
html[data-theme="dark"] .table-wrap tbody,
html[data-theme="dark"] .table-wrap tbody tr {
  background: #171c23 !important;
}

html[data-theme="dark"] .table-wrap tbody td {
  border-color: rgba(255, 255, 255, .075) !important;
  background: #171c23 !important;
  color: #e4eaf2 !important;
}

html[data-theme="dark"] .table-wrap tbody tr:nth-child(even) td {
  background: #191f27 !important;
}

html[data-theme="dark"] .table-wrap tbody tr:hover td,
html[data-theme="dark"] .table-wrap tbody tr:hover td:last-child {
  background: #222a34 !important;
}

html[data-theme="dark"] .table-wrap th,
html[data-theme="dark"] .table-wrap th:last-child {
  border-color: var(--line) !important;
  background: #151a21 !important;
  color: #9ca8b8 !important;
}

html[data-theme="dark"] .table-wrap td:last-child {
  background: inherit !important;
  box-shadow: -12px 0 24px rgba(0, 0, 0, .08);
}

html[data-theme="dark"] .row-actions {
  border: 1px solid #343d49;
  background: #202630 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #boardProblemFilterBtn > span {
  flex: 1 1 auto;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

/* v0.45: consistent dark controls across every panel and dialog */
html[data-theme="dark"] .asic-panel .actions button,
html[data-theme="dark"] dialog button,
html[data-theme="dark"] .schedule-panel button,
html[data-theme="dark"] .farm-map-tools button,
html[data-theme="dark"] .map-preset-row button,
html[data-theme="dark"] #profileModal button {
  border-color: #354150 !important;
  background: #202833 !important;
  color: #dce6f2 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .asic-panel .actions .blue-soft,
html[data-theme="dark"] dialog .blue-soft,
html[data-theme="dark"] dialog .ghost,
html[data-theme="dark"] .farm-map-tools .blue-soft {
  border-color: rgba(73, 151, 255, .42) !important;
  background: rgba(35, 111, 208, .16) !important;
  color: #72b3ff !important;
}

html[data-theme="dark"] .asic-panel .actions .green-soft,
html[data-theme="dark"] dialog .green-soft,
html[data-theme="dark"] .farm-download-actions .green-soft {
  border-color: rgba(71, 196, 112, .38) !important;
  background: rgba(35, 142, 75, .15) !important;
  color: #70dc91 !important;
}

html[data-theme="dark"] .asic-panel .actions .danger-soft,
html[data-theme="dark"] dialog .danger,
html[data-theme="dark"] dialog .danger-soft,
html[data-theme="dark"] #profileModal .danger {
  border-color: rgba(255, 101, 93, .4) !important;
  background: rgba(181, 50, 46, .16) !important;
  color: #ff8d86 !important;
}

html[data-theme="dark"] .asic-panel .actions button:hover,
html[data-theme="dark"] dialog button:hover,
html[data-theme="dark"] .schedule-panel button:hover,
html[data-theme="dark"] .farm-map-tools button:hover,
html[data-theme="dark"] #profileModal button:hover {
  border-color: #4f6073 !important;
  background: #293440 !important;
  filter: brightness(1.08);
}

html[data-theme="dark"] #boardProblemFilterBtn {
  border-color: rgba(255, 101, 93, .42) !important;
  background: rgba(181, 50, 46, .16) !important;
  color: #ff8d86 !important;
}

html[data-theme="dark"] #boardProblemFilterBtn.active {
  border-color: #df453e !important;
  background: #b9322e !important;
  color: #fff !important;
}

html[data-theme="dark"] #boardProblemFilterBtn:not(.active) > b {
  color: #fff;
  background: #c53a34;
}

html[data-theme="dark"] .table-wrap .row-actions {
  border-color: #354150 !important;
  background: #1d252f !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .table-wrap .row-actions button {
  border: 1px solid transparent !important;
  background: #29323d !important;
  color: #cbd6e3 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] .table-wrap .row-actions .action-check {
  background: rgba(35, 111, 208, .2) !important;
  color: #72b3ff !important;
}

html[data-theme="dark"] .table-wrap .row-actions .action-locate,
html[data-theme="dark"] .table-wrap .row-actions .action-reboot {
  background: rgba(186, 118, 24, .18) !important;
  color: #f0bd68 !important;
}

html[data-theme="dark"] .table-wrap .row-actions .action-stop,
html[data-theme="dark"] .table-wrap .row-actions .action-delete {
  background: rgba(181, 50, 46, .18) !important;
  color: #ff817a !important;
}

html[data-theme="dark"] .table-wrap .row-actions .action-start {
  background: rgba(35, 142, 75, .17) !important;
  color: #70dc91 !important;
}

html[data-theme="dark"] .table-wrap .row-actions .action-info {
  background: #29323d !important;
  color: #d5dee9 !important;
}

html[data-theme="dark"] .table-wrap .row-actions button:disabled {
  background: #252c34 !important;
  color: #64717f !important;
  opacity: .72 !important;
}

html[data-theme="dark"] .zec-summary div,
html[data-theme="dark"] .chart-readout,
html[data-theme="dark"] .cost-calc > div,
html[data-theme="dark"] .subscription-card,
html[data-theme="dark"] .farm-download-card,
html[data-theme="dark"] .farm-create-result,
html[data-theme="dark"] .profile-sections section,
html[data-theme="dark"] .users-panel,
html[data-theme="dark"] .subscription-panel,
html[data-theme="dark"] .farm-downloads-panel,
html[data-theme="dark"] .pool-update-modes,
html[data-theme="dark"] .form-grid,
html[data-theme="dark"] .bulk-field,
html[data-theme="dark"] .scan-results,
html[data-theme="dark"] .panel-users-list {
  border-color: var(--line) !important;
  background: #1c232c !important;
  color: var(--text) !important;
}

html[data-theme="dark"] .feed-row,
html[data-theme="dark"] .panel-user-row,
html[data-theme="dark"] .farm-download-card,
html[data-theme="dark"] .subscription-card {
  border-color: var(--line) !important;
  background: #202630 !important;
  color: var(--text) !important;
}

html[data-theme="dark"] dialog,
html[data-theme="dark"] dialog form,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] #profileModal .profile-card {
  color: var(--text);
}

html[data-theme="dark"] .modal-card h2,
html[data-theme="dark"] .modal-card h3,
html[data-theme="dark"] .modal-card h4,
html[data-theme="dark"] .modal-card b,
html[data-theme="dark"] .profile-card h2,
html[data-theme="dark"] .profile-card h3,
html[data-theme="dark"] .profile-card h4 {
  color: var(--text) !important;
}

html[data-theme="dark"] .modal-card p,
html[data-theme="dark"] .modal-card label,
html[data-theme="dark"] .modal-card small,
html[data-theme="dark"] .hint {
  color: var(--muted) !important;
}

html[data-theme="dark"] .period-tabs button {
  border-color: var(--line) !important;
  background: #202833 !important;
  color: #cbd6e3 !important;
}

html[data-theme="dark"] .period-tabs button.active {
  border-color: rgba(73, 151, 255, .5) !important;
  background: rgba(35, 111, 208, .2) !important;
  color: #72b3ff !important;
}

html[data-theme="dark"] .toast {
  border: 1px solid #3a4654;
  background: #202833;
  color: #f1f5f9;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .38);
}

html[data-theme="dark"] ::-webkit-scrollbar-track { background: #11161d; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb {
  border: 3px solid #11161d;
  background: #3b4654;
}

/* v0.46: complete dark-theme coverage for profile and form dialogs */
html[data-theme="dark"] #profileModal { color-scheme: dark; }

html[data-theme="dark"] #profileModal .profile-card {
  border-color: #354150 !important;
  background: #171c23 !important;
  color: #e8eef6 !important;
  box-shadow: 0 32px 90px rgba(0, 0, 0, .52) !important;
}

html[data-theme="dark"] #profileModal .panel-head.compact,
html[data-theme="dark"] #profileModal .profile-sections,
html[data-theme="dark"] #profileModal .form-grid,
html[data-theme="dark"] #profileModal .panel-users-list {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #profileModal .panel-head.compact h3,
html[data-theme="dark"] #profileModal .profile-sections h4,
html[data-theme="dark"] #profileModal .profile-summary b,
html[data-theme="dark"] #profileModal .subscription-card b,
html[data-theme="dark"] #profileModal .farm-download-card b,
html[data-theme="dark"] #profileModal .panel-user-row b {
  color: #eef4fb !important;
}

html[data-theme="dark"] #profileModal .profile-summary span,
html[data-theme="dark"] #profileModal .subscription-card span,
html[data-theme="dark"] #profileModal .farm-download-card span,
html[data-theme="dark"] #profileModal .panel-user-row span,
html[data-theme="dark"] #profileModal label span {
  color: #9aa7b8 !important;
}

html[data-theme="dark"] #profileModal .profile-summary,
html[data-theme="dark"] #profileModal .profile-sections section {
  border-color: #354150 !important;
  background: #1c232c !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #profileModal .subscription-card {
  border: 0 !important;
  background: transparent !important;
}

html[data-theme="dark"] #profileModal .subscription-card > div,
html[data-theme="dark"] #profileModal .farm-download-card,
html[data-theme="dark"] #profileModal .panel-user-row,
html[data-theme="dark"] #profileModal .farm-enabled-label {
  border-color: #354150 !important;
  background: #202833 !important;
  color: #e8eef6 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #profileModal input,
html[data-theme="dark"] #profileModal select,
html[data-theme="dark"] #profileModal textarea {
  border-color: #3b4858 !important;
  background: #11161d !important;
  color: #e8eef6 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] #profileModal input::placeholder,
html[data-theme="dark"] #profileModal textarea::placeholder {
  color: #687587 !important;
}

html[data-theme="dark"] #profileModal input:focus,
html[data-theme="dark"] #profileModal select:focus,
html[data-theme="dark"] #profileModal textarea:focus {
  border-color: #4d9fff !important;
  background: #141b24 !important;
  outline-color: rgba(77, 159, 255, .2) !important;
}

html[data-theme="dark"] #profileModal .small-btn {
  border-color: #4a596b !important;
  background: #202833 !important;
  color: #e8eef6 !important;
}

html[data-theme="dark"] #profileModal #saveProfileFarmBtn,
html[data-theme="dark"] #profileModal #downloadFarmEnvBtn,
html[data-theme="dark"] #profileModal .panel-user-row button:first-of-type {
  border-color: #285f9f !important;
  background: #162b45 !important;
  color: #70b5ff !important;
}

html[data-theme="dark"] #profileModal #deleteProfileFarmBtn,
html[data-theme="dark"] #profileModal .panel-user-row button:last-of-type {
  border-color: #74383e !important;
  background: #3a2025 !important;
  color: #ff8f96 !important;
}

html[data-theme="dark"] #profileModal #downloadFarmAgentBtn {
  border-color: #2e6947 !important;
  background: #183326 !important;
  color: #70d998 !important;
}

/* v0.47: one dark surface system for every modal and nested form */
html[data-theme="dark"] dialog,
html[data-theme="dark"] dialog[open] {
  color-scheme: dark !important;
  border: 0 !important;
  background: transparent !important;
  color: #e8eef6 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] dialog > form.modal-card,
html[data-theme="dark"] dialog > .modal-card {
  border: 1px solid #354150 !important;
  background: #171c23 !important;
  color: #e8eef6 !important;
  box-shadow: 0 32px 90px rgba(0, 0, 0, .56) !important;
}

html[data-theme="dark"] dialog .panel-head,
html[data-theme="dark"] dialog .panel-head.compact,
html[data-theme="dark"] dialog .profile-sections,
html[data-theme="dark"] dialog .form-grid,
html[data-theme="dark"] dialog .panel-users-list {
  background: transparent !important;
  color: #e8eef6 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] dialog .detail-item,
html[data-theme="dark"] dialog .scan-row,
html[data-theme="dark"] dialog .pool-row,
html[data-theme="dark"] dialog .profile-summary,
html[data-theme="dark"] dialog .profile-sections section,
html[data-theme="dark"] dialog .subscription-panel,
html[data-theme="dark"] dialog .farm-downloads-panel,
html[data-theme="dark"] dialog .users-panel,
html[data-theme="dark"] dialog .farm-download-card,
html[data-theme="dark"] dialog .farm-create-result,
html[data-theme="dark"] dialog .panel-user-row,
html[data-theme="dark"] dialog .farm-enabled-label,
html[data-theme="dark"] dialog .map-picker-row,
html[data-theme="dark"] dialog .offline-row,
html[data-theme="dark"] dialog .feed-row,
html[data-theme="dark"] dialog .chart-readout,
html[data-theme="dark"] dialog .cost-calc > div {
  border-color: #354150 !important;
  background: #1c232c !important;
  color: #e8eef6 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] dialog .subscription-card {
  border-color: transparent !important;
  background: transparent !important;
}

html[data-theme="dark"] dialog .subscription-card > div {
  border-color: #354150 !important;
  background: #202833 !important;
  color: #e8eef6 !important;
}

html[data-theme="dark"] dialog h2,
html[data-theme="dark"] dialog h3,
html[data-theme="dark"] dialog h4,
html[data-theme="dark"] dialog h5,
html[data-theme="dark"] dialog strong,
html[data-theme="dark"] dialog b {
  color: #eef4fb !important;
}

html[data-theme="dark"] dialog p,
html[data-theme="dark"] dialog label,
html[data-theme="dark"] dialog small,
html[data-theme="dark"] dialog .hint,
html[data-theme="dark"] dialog .muted {
  color: #9aa7b8 !important;
}

html[data-theme="dark"] dialog input,
html[data-theme="dark"] dialog select,
html[data-theme="dark"] dialog textarea {
  border-color: #3b4858 !important;
  background: #10151b !important;
  color: #e8eef6 !important;
  box-shadow: none !important;
}

html[data-theme="dark"] dialog input::placeholder,
html[data-theme="dark"] dialog textarea::placeholder {
  color: #687587 !important;
}

html[data-theme="dark"] dialog input:focus,
html[data-theme="dark"] dialog select:focus,
html[data-theme="dark"] dialog textarea:focus {
  border-color: #4d9fff !important;
  background: #141b24 !important;
  outline-color: rgba(77, 159, 255, .2) !important;
}

/* v0.48: complete dark-theme coverage for every dialog surface. */
html[data-theme="dark"] dialog article,
html[data-theme="dark"] dialog .offline-summary article,
html[data-theme="dark"] dialog .cost-calc article,
html[data-theme="dark"] dialog .empty-note,
html[data-theme="dark"] dialog .offline-row,
html[data-theme="dark"] dialog .feed-row,
html[data-theme="dark"] dialog .scan-row,
html[data-theme="dark"] dialog .map-picker-row,
html[data-theme="dark"] dialog .chart-readout,
html[data-theme="dark"] dialog .farm-download-card,
html[data-theme="dark"] dialog .panel-user-row {
  background: #202833 !important;
  border-color: #354150 !important;
  color: #eef4fb !important;
  box-shadow: none !important;
}

html[data-theme="dark"] dialog .offline-summary span,
html[data-theme="dark"] dialog .cost-calc span,
html[data-theme="dark"] dialog .offline-row span,
html[data-theme="dark"] dialog .feed-row span,
html[data-theme="dark"] dialog .scan-row span,
html[data-theme="dark"] dialog .map-picker-row span,
html[data-theme="dark"] dialog .chart-readout span,
html[data-theme="dark"] dialog .detail-item span,
html[data-theme="dark"] dialog .profile-summary span,
html[data-theme="dark"] dialog .farm-download-card span,
html[data-theme="dark"] dialog .panel-user-row span {
  color: #9aa7b8 !important;
}

html[data-theme="dark"] dialog .offline-summary b,
html[data-theme="dark"] dialog .cost-calc b,
html[data-theme="dark"] dialog .offline-row b,
html[data-theme="dark"] dialog .feed-row b,
html[data-theme="dark"] dialog .scan-row b,
html[data-theme="dark"] dialog .map-picker-row b,
html[data-theme="dark"] dialog .chart-readout b,
html[data-theme="dark"] dialog .detail-item b,
html[data-theme="dark"] dialog .profile-summary b,
html[data-theme="dark"] dialog .farm-download-card b,
html[data-theme="dark"] dialog .panel-user-row b {
  color: #eef4fb !important;
}

html[data-theme="dark"] dialog .period-tabs button,
html[data-theme="dark"] dialog .map-preset-row button {
  background: #202833 !important;
  border-color: #354150 !important;
  color: #cbd5e1 !important;
}

html[data-theme="dark"] dialog .period-tabs button.active,
html[data-theme="dark"] dialog .map-preset-row button.active {
  background: #12345a !important;
  border-color: #3b82f6 !important;
  color: #8fc4ff !important;
}

html[data-theme="dark"] dialog .scan-results,
html[data-theme="dark"] dialog .events-list,
html[data-theme="dark"] dialog .offline-list,
html[data-theme="dark"] dialog .map-picker-list {
  background: #171e27 !important;
  border-color: #303b49 !important;
  color: #dbe5f1 !important;
}

html[data-theme="dark"] #profileModal .profile-summary,
html[data-theme="dark"] #profileModal .profile-sections section,
html[data-theme="dark"] #profileModal .subscription-panel,
html[data-theme="dark"] #profileModal .farm-downloads-panel,
html[data-theme="dark"] #profileModal .users-panel,
html[data-theme="dark"] #offlineModal .offline-summary article,
html[data-theme="dark"] #offlineModal .empty-note {
  background: #1c232c !important;
  border-color: #354150 !important;
  color: #eef4fb !important;
}

html[data-theme="dark"] dialog .modal-close {
  background: #202833 !important;
  border-color: #465568 !important;
  color: #dce6f2 !important;
}

html[data-theme="dark"] dialog .modal-close:hover {
  background: #293544 !important;
  border-color: #5ea7ff !important;
  color: #ffffff !important;
}
/* v0.49: definitive dark-dialog surface and contrast pass */
html[data-theme="dark"] body dialog[open] > .modal-card {
  background-color: #171c23 !important;
  background-image: none !important;
  border-color: #354150 !important;
  color: #e8eef6 !important;
}

html[data-theme="dark"] body dialog[open] .modal-card h2,
html[data-theme="dark"] body dialog[open] .modal-card h3,
html[data-theme="dark"] body dialog[open] .modal-card h4,
html[data-theme="dark"] body dialog[open] .modal-card label,
html[data-theme="dark"] body dialog[open] .modal-card strong,
html[data-theme="dark"] body dialog[open] .modal-card b {
  color: #eef4fb !important;
  -webkit-text-fill-color: #eef4fb !important;
}

html[data-theme="dark"] body dialog[open] .modal-card input,
html[data-theme="dark"] body dialog[open] .modal-card select,
html[data-theme="dark"] body dialog[open] .modal-card textarea {
  background-color: #11171e !important;
  background-image: none !important;
  border-color: #354150 !important;
  color: #eef4fb !important;
  -webkit-text-fill-color: #eef4fb !important;
  color-scheme: dark;
}

html[data-theme="dark"] body dialog[open] .modal-card input::placeholder,
html[data-theme="dark"] body dialog[open] .modal-card textarea::placeholder {
  color: #78869a !important;
  -webkit-text-fill-color: #78869a !important;
  opacity: 1;
}

html[data-theme="dark"] body #offlineModal[open] #offlineModalBody .offline-summary > article,
html[data-theme="dark"] body #offlineModal[open] #offlineModalBody .offline-list > .empty-note,
html[data-theme="dark"] body #offlineModal[open] #offlineModalBody .offline-row {
  background-color: #202833 !important;
  background-image: none !important;
  border-color: #354150 !important;
  color: #eef4fb !important;
  -webkit-text-fill-color: #eef4fb !important;
  box-shadow: none !important;
}

html[data-theme="dark"] body #offlineModal[open] #offlineModalBody .offline-summary span,
html[data-theme="dark"] body #offlineModal[open] #offlineModalBody .offline-row span,
html[data-theme="dark"] body #offlineModal[open] #offlineModalBody .offline-row small,
html[data-theme="dark"] body #offlineModal[open] #offlineModalBody .empty-note {
  color: #a6b2c2 !important;
  -webkit-text-fill-color: #a6b2c2 !important;
}

html[data-theme="dark"] body #offlineModal[open] #offlineModalBody .offline-summary b,
html[data-theme="dark"] body #offlineModal[open] #offlineModalBody .offline-row strong {
  color: #f5f8fc !important;
  -webkit-text-fill-color: #f5f8fc !important;
}

html[data-theme="dark"] body dialog[open] .detail-item,
html[data-theme="dark"] body dialog[open] .detail-fans,
html[data-theme="dark"] body dialog[open] .board-card,
html[data-theme="dark"] body dialog[open] .feed-row,
html[data-theme="dark"] body dialog[open] .chart-readout,
html[data-theme="dark"] body dialog[open] .cost-calc article,
html[data-theme="dark"] body dialog[open] .scan-row,
html[data-theme="dark"] body dialog[open] .map-picker-row,
html[data-theme="dark"] body dialog[open] .profile-summary,
html[data-theme="dark"] body dialog[open] .profile-sections section,
html[data-theme="dark"] body dialog[open] .subscription-card > div,
html[data-theme="dark"] body dialog[open] .farm-download-card,
html[data-theme="dark"] body dialog[open] .panel-user-row,
html[data-theme="dark"] body dialog[open] .farm-create-result,
html[data-theme="dark"] body dialog[open] .farm-enabled-label,
html[data-theme="dark"] body dialog[open] .pool-row,
html[data-theme="dark"] body dialog[open] .empty-note {
  background-color: #202833 !important;
  background-image: none !important;
  border-color: #354150 !important;
  color: #e8eef6 !important;
  box-shadow: none !important;
}
/* v0.50: compact ASIC actions, targeted schedules and per-device history */
.board-temp-list { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
.row-actions { display: grid; grid-template-columns: repeat(4, 30px); gap: 5px; width: max-content; }
.row-actions button { width: 30px; height: 30px; min-width: 30px; padding: 0; border-radius: 8px; box-shadow: none; }
.row-actions button i { font-style: normal; line-height: 1; }
.row-actions button:disabled { opacity: .28; cursor: not-allowed; }
.action-info { grid-column: 1 / span 2; width: auto !important; }
.action-delete { grid-column: 3 / span 2; width: auto !important; }

.schedule-targets { margin-top: 18px; padding: 16px; border: 1px solid var(--border, #dfe5ef); border-radius: 14px; background: var(--surface-soft, rgba(125,140,170,.06)); }
.schedule-targets-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.schedule-targets-head > div { display: grid; gap: 3px; }
.schedule-targets-head span { color: var(--muted, #718096); font-size: 12px; }
.schedule-search { max-width: 420px; margin-bottom: 12px; }
.schedule-asic-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; max-height: 300px; overflow: auto; padding-right: 4px; }
.schedule-asic-list label { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border, #dfe5ef); border-radius: 10px; background: var(--panel, #fff); cursor: pointer; }
.schedule-asic-list label:hover { border-color: #6d5dfc; }
.schedule-asic-list label span { display: grid; min-width: 0; }
.schedule-asic-list small { color: var(--muted, #718096); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.history-launch { cursor: pointer; transition: border-color .15s ease, transform .15s ease; }
.history-launch:hover { border-color: #6d5dfc; transform: translateY(-1px); }
.history-card { width: min(960px, calc(100vw - 30px)); }
.history-periods { display: flex; gap: 7px; margin: 14px 0; }
.history-periods button { min-width: 52px; padding: 8px 12px; border-radius: 9px; }
.history-periods button.active { color: #fff; background: #6d5dfc; border-color: #6d5dfc; }
.history-canvas-wrap { position: relative; min-height: 360px; border: 1px solid var(--border, #dfe5ef); border-radius: 14px; overflow: hidden; background: var(--panel, #fff); }
.history-tooltip { position: absolute; z-index: 2; display: grid; gap: 2px; min-width: 150px; padding: 9px 11px; border-radius: 9px; color: #fff; background: rgba(22,29,45,.94); pointer-events: none; box-shadow: 0 8px 30px rgba(0,0,0,.24); }
.history-tooltip span { font-size: 11px; opacity: .8; }
.detail-fans.muted { opacity: .7; }

@media (max-width: 760px) {
  .schedule-asic-list { grid-template-columns: 1fr; }
  .history-card { padding: 14px; }
  .history-canvas-wrap { min-height: 300px; }
}

/* v0.54: explicit schedule targets and clearer ASIC history */
.schedule-target-actions { display: flex !important; flex-direction: row !important; gap: 8px; }
.schedule-target-actions button { min-height: 36px; padding: 7px 12px; border-radius: 10px; white-space: nowrap; }
.schedule-target-actions button.active { color: #0b64d8; border-color: #8dbbff; background: #eaf3ff; }
.schedule-selected-asics { margin: 0 0 14px; padding: 13px; border: 1px solid #cddbf0; border-radius: 13px; background: #fff; }
.schedule-selected-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.schedule-selected-title span { color: var(--muted, #718096); font-size: 12px; }
.schedule-selected-list { display: flex; flex-wrap: wrap; gap: 8px; }
.schedule-selected-chip { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 7px 9px 7px 12px; color: #26334a; text-align: left; border: 1px solid #bdd2f4; border-radius: 11px; background: #f4f8ff; box-shadow: none; }
.schedule-selected-chip span { display: grid; gap: 1px; }
.schedule-selected-chip small { color: #718096; font-size: 11px; }
.schedule-selected-chip i { display: grid; place-items: center; width: 25px; height: 25px; color: #e5484d; font-style: normal; font-weight: 800; border-radius: 7px; background: #ffe9ea; }
.schedule-selected-asics.all-farm { border-color: #a9e2bf; background: #f1fbf5; }
.schedule-all-farm-card { display: flex; align-items: center; gap: 12px; }
.schedule-all-farm-card > span { display: grid; place-items: center; width: 34px; height: 34px; color: #fff; font-weight: 900; border-radius: 50%; background: #20b965; }
.schedule-all-farm-card div { display: grid; gap: 2px; }
.schedule-all-farm-card small { color: #4f765e; }

.history-modal .history-card { width: min(1060px, calc(100vw - 36px)); padding: 26px; border-radius: 22px; }
.history-modal .modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.history-modal .modal-head > div { min-width: 0; }
.history-modal .modal-head h3 { margin: 0 0 5px; font-size: 24px; }
.history-modal .modal-head .icon-btn { position: static !important; flex: 0 0 40px; width: 40px !important; min-width: 40px !important; height: 40px !important; margin: 0 !important; padding: 0 !important; color: #526077; font-size: 22px; line-height: 1; border: 1px solid #d7e0ec; border-radius: 11px !important; background: #f5f7fa; box-shadow: none !important; }
.history-controls { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 18px 0 14px; }
.history-periods { display: inline-flex; gap: 4px; margin: 0; padding: 4px; border: 1px solid #dce4ef; border-radius: 12px; background: #f3f6fa; }
.history-periods button { min-width: auto; padding: 8px 14px; color: #526077; border: 0; border-radius: 8px; background: transparent; box-shadow: none; }
.history-periods button.active { color: #fff; background: #6557ef; box-shadow: 0 5px 14px rgba(101,87,239,.24); }
.history-samples { color: var(--muted, #718096); font-size: 12px; }
.history-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px; margin-bottom: 12px; }
.history-stats > div { display: grid; gap: 4px; padding: 11px 13px; border: 1px solid #e0e6ef; border-radius: 11px; background: #f8fafc; }
.history-stats span { color: #718096; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
.history-stats b { overflow: hidden; color: #172033; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.history-legend { display: flex; flex-wrap: wrap; gap: 16px; min-height: 22px; margin: 0 0 9px; color: #526077; font-size: 12px; font-weight: 700; }
.history-legend span { display: inline-flex; align-items: center; gap: 6px; }
.history-legend i,
.history-tooltip i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--series-color); }
.history-canvas-wrap { min-height: 390px; border-color: #dce4ef; border-radius: 16px; background: linear-gradient(180deg, #fff 0%, #fbfcff 100%); }
.history-tooltip { min-width: 205px; padding: 10px 12px; border-radius: 11px; }
.history-tooltip > span { margin-bottom: 4px; }
.history-tooltip b { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 7px; font-size: 12px; }
.history-tooltip strong { font-size: 12px; }

html[data-theme="dark"] .schedule-selected-asics { border-color: #3a4a61; background: #202833; }
html[data-theme="dark"] .schedule-selected-asics.all-farm { border-color: #2b6e49; background: #173225; }
html[data-theme="dark"] .schedule-selected-chip { color: #e8eef6; border-color: #405d85; background: #243246; }
html[data-theme="dark"] .schedule-selected-chip small { color: #9cabc0; }
html[data-theme="dark"] .history-modal .modal-head .icon-btn,
html[data-theme="dark"] .history-periods,
html[data-theme="dark"] .history-stats > div { color: #dbe5f2; border-color: #3a4657; background: #242c37; }
html[data-theme="dark"] .history-stats b { color: #f3f6fa; }
html[data-theme="dark"] .history-canvas-wrap { border-color: #3a4657; background: #1f2731; }

@media (max-width: 760px) {
  .schedule-targets-head, .schedule-selected-title, .history-controls { align-items: stretch; flex-direction: column; }
  .schedule-target-actions { width: 100%; }
  .schedule-target-actions button { flex: 1; }
  .history-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-modal .history-card { padding: 16px; }
  .history-canvas-wrap { min-height: 330px; overflow-x: auto; }
}

/* v0.51 final override: actions belong to their ASIC row and never cover telemetry */
@media (min-width: 921px) {
  .table-wrap table { min-width: 1380px !important; }
  .table-wrap th:last-child,
  .table-wrap td:last-child {
    position: static !important; right: auto !important; z-index: auto !important;
    width: 226px !important; min-width: 226px !important; max-width: 226px !important;
    padding: 10px 12px !important; background: inherit !important; box-shadow: none !important;
  }
  .table-wrap th:last-child { text-align: left !important; }
  .table-wrap .row-actions {
    position: relative !important; display: flex !important; grid-template-columns: none !important;
    align-items: center !important; justify-content: flex-start !important; gap: 6px !important;
    width: 202px !important; min-width: 202px !important; max-width: 202px !important;
    height: 42px !important; padding: 4px !important; border: 1px solid #dfe7f1 !important;
    border-radius: 13px !important; background: #f8fafc !important; box-shadow: none !important;
  }
  .table-wrap .row-actions > button,
  .table-wrap .action-menu > summary {
    display: inline-flex !important; align-items: center !important; justify-content: center !important;
    width: 34px !important; min-width: 34px !important; max-width: 34px !important;
    height: 34px !important; min-height: 34px !important; max-height: 34px !important;
    padding: 0 !important; border: 0 !important; border-radius: 9px !important;
    cursor: pointer; list-style: none;
  }
  .table-wrap .row-actions > .action-info {
    width: 82px !important; min-width: 82px !important; max-width: 82px !important; gap: 6px;
    color: #344054 !important; background: #eef2f7 !important; font-size: 12px !important; font-weight: 800 !important;
  }
  .table-wrap .row-actions > .action-info span { display: inline !important; }
  .table-wrap .row-actions > .action-check { background: #e7f1ff !important; color: #0969da !important; }
  .table-wrap .row-actions > .action-locate { background: #fff3df !important; color: #9a5a00 !important; }
  .action-menu { position: relative; width: 34px; height: 34px; }
  .action-menu > summary { color: #475467; background: #eef2f7; font-weight: 900; letter-spacing: 1px; }
  .action-menu > summary::-webkit-details-marker { display: none; }
  .action-menu[open] { z-index: 30; }
  .action-menu-popover {
    position: absolute; top: 40px; right: 0; z-index: 40; display: grid; gap: 5px;
    width: 176px; padding: 7px; border: 1px solid #dfe7f1; border-radius: 12px;
    background: #fff; box-shadow: 0 16px 40px rgba(15, 23, 42, .18);
  }
  .table-wrap .action-menu-popover button {
    display: flex !important; align-items: center !important; justify-content: flex-start !important; gap: 9px !important;
    width: 100% !important; max-width: none !important; height: 36px !important; min-height: 36px !important;
    padding: 0 10px !important; border: 0 !important; border-radius: 8px !important;
    font-size: 12px !important; font-weight: 750 !important;
  }
  .action-menu-popover button i { width: 18px; text-align: center; }
  .action-menu-popover .action-reboot { color: #344054 !important; background: #f4f6f9 !important; }
  .action-menu-popover .action-stop,
  .action-menu-popover .action-delete { color: #c62828 !important; background: #fff1f2 !important; }
  .action-menu-popover .action-start { color: #167a34 !important; background: #ebf9ef !important; }
}
html[data-theme="dark"] .table-wrap .row-actions { background: #1d2630 !important; border-color: #354150 !important; }
html[data-theme="dark"] .table-wrap .row-actions > .action-info,
html[data-theme="dark"] .action-menu > summary { background: #273240 !important; color: #dbe5f1 !important; }
html[data-theme="dark"] .action-menu-popover { background: #171e27; border-color: #354150; }
