:root {
  color-scheme: light;
  --bg: #eef6f1;
  --bg-2: #f7fff9;
  --ink: #1a1c1f;
  --muted: #5b616b;
  --accent: #0f9d58;
  --accent-2: #0b8043;
  --card: #ffffff;
  --shadow: 0 20px 60px rgba(18, 21, 26, 0.12);
  --radius: 22px;
  --mono: "JetBrains Mono", monospace;
  --sans: "Space Grotesk", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--sans);
  background: radial-gradient(circle at top, #f1fbf4 0%, var(--bg) 55%, #e6f1e8 100%);
  color: var(--ink);
  min-height: 100vh;
}

.bg-orb {
  position: fixed;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  filter: blur(0px);
  opacity: 0.45;
  z-index: 0;
}

.orb-a {
  top: -120px;
  right: -80px;
  background: radial-gradient(circle at 30% 30%, #b1f1cf 0%, #34a853 45%, #0f9d58 70%);
}

.orb-b {
  bottom: -160px;
  left: -100px;
  background: radial-gradient(circle at 30% 30%, #b7f0d2 0%, #0b8043 60%, #066237 100%);
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  padding: 32px 18px;
  background: rgba(246, 253, 248, 0.94);
  border-right: 1px solid #e2efe6;
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  align-self: flex-start;
  overflow-y: auto;
}

.sidebar-brand {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
}

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

.hero {
  position: relative;
  z-index: 1;
  padding: 40px 6vw 16px;
  display: flex;
  justify-content: space-between;
  gap: 32px;
  align-items: center;
  flex-wrap: wrap;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  flex: 1;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid #e2efe6;
}

.nav-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.nav-link {
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  background: #eaf6ef;
  border: 1px solid #dfeee5;
  cursor: pointer;
  font-family: var(--sans);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
}

.nav-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid #e2efe6;
}

.nav-link.active {
  background: var(--accent);
  color: white;
  border-color: transparent;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-2);
  margin: 0 0 12px;
}

h1 {
  font-size: clamp(32px, 3vw, 54px);
  margin: 0 0 12px;
}

.subhead {
  max-width: 520px;
  font-size: 16px;
  color: var(--muted);
}

.status-card {
  background: var(--card);
  padding: 18px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 14px;
  align-items: center;
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #c4c4c4;
}

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

.value {
  margin: 0;
  font-weight: 600;
}

.layout {
  position: relative;
  z-index: 1;
  padding: 20px 6vw 80px;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 32px;
}

.layout.single {
  grid-template-columns: 1fr;
}

.layout.layout-wide {
  padding: 20px clamp(16px, 2vw, 32px) 72px;
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel.wide {
  grid-column: 1 / -1;
}

.panel h2 {
  margin: 0;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field input,
.field select,
textarea {
  border: 1px solid #dceee2;
  border-radius: 12px;
  padding: 12px 14px;
  font-family: var(--sans);
  background: #f7fffb;
  color: var(--ink);
}

.table-input {
  width: 100%;
  border: 1px solid #dceee2;
  border-radius: 10px;
  padding: 8px 10px;
  font-family: var(--sans);
  background: #f7fffb;
  color: var(--ink);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.code-block {
  border: 1px solid #dceee2;
  border-radius: 12px;
  padding: 12px 14px;
  background: #f6fffa;
  font-family: var(--mono);
  font-size: 12px;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
}

small {
  color: var(--muted);
}

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

.modal .actions {
  margin-top: 14px;
}

button {
  border: none;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
  filter: saturate(0.6);
}

button.primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 26px rgba(15, 157, 88, 0.35);
}

button.ghost {
  background: #eaf5ee;
  color: var(--ink);
}

button.danger {
  background: #b42318;
  color: #fff;
  box-shadow: 0 12px 26px rgba(180, 35, 24, 0.24);
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
}

.inline-input {
  border: 1px solid #dceee2;
  border-radius: 10px;
  padding: 8px 10px;
  font-family: var(--sans);
  background: #f7fffb;
  color: var(--ink);
  min-width: 140px;
}

button:hover {
  transform: translateY(-2px);
}

.icon-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: #eaf5ee;
  color: var(--ink);
}

.icon-btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 22px rgba(15, 157, 88, 0.35);
}

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

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
}

.table-controls {
  margin: 10px 0 6px;
}

.bulk-actions {
  justify-content: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

#blockedBulkActions {
  margin: 8px 0 14px;
}

.table-controls.with-columns {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.table-controls.with-columns .field {
  flex: 1 1 auto;
}

.table-search .field {
  width: 100%;
}

.table-search input {
  width: 100%;
}

.column-picker {
  position: relative;
  flex: 0 0 auto;
}

.column-panel {
  position: absolute;
  right: 0;
  left: auto;
  top: 42px;
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #dfeee5;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15, 20, 16, 0.12);
  min-width: 200px;
  color: var(--ink);
  max-height: 260px;
  overflow: auto;
  z-index: 20;
}

.column-panel.open {
  display: flex;
}

.column-option {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--ink);
}

.column-option span {
  display: inline-block;
  white-space: nowrap;
  text-align: right;
  justify-self: end;
  padding-right: 4px;
}

.column-option input {
  justify-self: end;
}

.hidden-col {
  display: none;
}

.table-controls.inline-controls {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 12px;
  width: 100%;
  overflow-x: auto;
  padding-bottom: 4px;
}

.table-controls.inline-controls .field {
  min-width: 140px;
  flex: 0 0 220px;
}

.table-controls.inline-controls button {
  align-self: flex-end;
  flex: 0 0 auto;
  white-space: nowrap;
}

.table-controls.inline-controls .field input,
.table-controls.inline-controls .field select {
  width: 100%;
}

.billing-filters {
  width: 100%;
}

.billing-filters .field {
  flex: 1 1 0;
  min-width: 200px;
}

.agent-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.agent-table th,
.agent-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid #dfeee5;
}

.agent-table th[data-agent-col="name"],
.agent-table td[data-agent-col="name"] {
  min-width: 180px;
  width: 180px;
}

.agent-table th.num-col,
.agent-table td.num-col {
  width: 56px;
  text-align: right;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.blocklist-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 14px;
  align-items: start;
}

.builds-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 14px;
  align-items: start;
}

.builds-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.builds-main {
  position: sticky;
  top: 0;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.builds-main textarea {
  min-height: 220px;
}

.blocklist-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.blocklist-group {
  border: 1px solid #dceee2;
  border-radius: 12px;
  padding: 10px 12px;
  background: #f6fffa;
}

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

.blocklist-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 700;
}

.blocklist-items {
  border: 1px dashed #e4f2e9;
  border-radius: 10px;
  background: #f7fffb;
  padding: 8px 10px;
  white-space: pre;
  max-height: 170px;
  overflow: auto;
}

.blocklist-main textarea {
  min-height: 220px;
  width: 100%;
  display: block;
}

.blocklist-main {
  /* Keep the manual editor visible when the modal scrolls */
  position: sticky;
  top: 0;
  align-self: start;
}

#blockTableView {
  min-width: 0;
}

.agent-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.agent-table.compact th,
.agent-table.compact td {
  padding: 8px 10px;
  font-size: 12px;
}

.agent-table.compact th {
  font-size: 11px;
  letter-spacing: 0.08em;
}

.agent-actions {
  vertical-align: middle;
}

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

.select-col input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-2);
}

.agent-actions .action-group {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
}

.blocked-target-col {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Only the Blocked IPs grid is dense; other tables keep their current spacing. */
.blocked-ips-table {
  width: auto;
  max-width: 100%;
  table-layout: auto;
  min-width: 0;
}

.blocked-ips-table th,
.blocked-ips-table td {
  padding: 7px 4px;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blocked-ips-table th {
  letter-spacing: 0.02em;
}

.blocked-ips-table .mono,
.blocked-ips-table .status-pill {
  font-size: 12px;
}

.blocked-ips-table .status-pill {
  max-width: 100%;
  padding: 3px 6px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.blocked-ips-table .th-cell {
  min-width: 0;
  gap: 2px;
}

.blocked-ips-table .th-filter-btn {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.blocked-ips-table th[data-blocked-col="select"] { width: 28px; }
.blocked-ips-table th[data-blocked-col="num"] { width: 30px; }

.blocked-ips-table td[data-blocked-col="ip"] { max-width: 150px; }
.blocked-ips-table td[data-blocked-col="domain"] { max-width: 160px; }
.blocked-ips-table td[data-blocked-col="token"] {
  max-width: 125px;
  text-overflow: ellipsis;
}

.blocked-ips-table td[data-blocked-col="hostname"],
.blocked-ips-table td[data-blocked-col="category"] {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  overflow-wrap: anywhere;
}

.blocked-ips-table td[data-blocked-col="hostname"] {
  min-width: 210px;
  max-width: 260px;
}

.blocked-ips-table td[data-blocked-col="category"] {
  min-width: 265px;
  max-width: 310px;
}

.blocked-ips-table th[data-blocked-col="actions"],
.blocked-ips-table td[data-blocked-col="actions"] { width: 1%; }

.blocked-ips-table td[data-blocked-col="actions"] {
  min-width: max-content;
  overflow: visible;
}

.blocked-ips-table .agent-actions .action-group {
  width: max-content;
}

.blocked-ips-table th.num-col,
.blocked-ips-table td.num-col {
  width: 30px;
  font-size: 12px;
}

.blocked-ips-table .agent-actions .ghost {
  flex: none;
  padding: 5px 8px;
  font-size: 12px;
  white-space: nowrap;
}

.build-target {
  margin-left: 6px;
  font-size: 11px;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #eaf5ee;
  color: var(--ink);
}

.status-pill.ok {
  background: rgba(11, 110, 79, 0.12);
  color: var(--accent-2);
}

.status-pill.off {
  background: rgba(139, 44, 29, 0.12);
  color: #8b2c1d;
}

.status-pill.warn {
  background: rgba(255, 107, 61, 0.14);
  color: var(--accent);
}

.agent-table .status-pill.pending {
  background: rgba(36, 93, 152, 0.12);
  color: #245d98;
}

.agent-table .status-pill.neutral {
  background: rgba(100, 116, 139, 0.12);
  color: #475569;
}

.agent-table .status-pill.error {
  background: rgba(139, 44, 29, 0.12);
  color: #8b2c1d;
}

.agent-state-detail {
  display: block;
  max-width: 260px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  white-space: normal;
  overflow-wrap: anywhere;
}

td.ok {
  color: var(--accent-2);
  font-weight: 600;
}

td.danger {
  color: #8b2c1d;
  font-weight: 600;
}

.agent-table th.sortable {
  cursor: pointer;
  position: relative;
  padding-right: 28px;
}

.agent-table th.bill-filter {
  padding-right: 36px;
}

.bill-filter-btn {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
}

.bill-filter-btn.active {
  color: var(--accent);
}

.filter-popover {
  position: fixed;
  right: 6px;
  top: calc(100% + 6px);
  min-width: 240px;
  max-width: 360px;
  background: #f6fffa;
  border: 1px solid #dfeee5;
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 12px 30px rgba(35, 27, 16, 0.16);
  display: none;
  z-index: 1000;
}

.filter-popover.open {
  display: block;
}

.filter-popover .filter-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 6px;
}

.filter-popover .filter-search {
  width: 100%;
  margin-bottom: 6px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid #d6e9dc;
  background: #f7fffb;
}

.filter-popover .filter-search:focus {
  outline: 2px solid rgba(255, 107, 61, 0.35);
  outline-offset: 2px;
}

.filter-popover .filter-list {
  display: grid;
  gap: 4px;
  max-height: 220px;
  overflow: auto;
}

.filter-popover .filter-note {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
}

.filter-popover .filter-footer {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.filter-popover .filter-footer button {
  width: auto;
  padding: 4px 10px;
  font-size: 12px;
}

.filter-popover button {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--ink);
  white-space: normal;
  word-break: break-word;
}

.filter-popover button.active {
  background: #eaf5ee;
  font-weight: 600;
}

.filter-popover button:hover,
.filter-popover button.active {
  background: #eaf5ee;
}

.agent-table th.filterable {
  position: relative;
}

.th-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.th-filter-btn {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: inherit;
  cursor: pointer;
}

.th-filter-btn.active {
  color: var(--accent);
}

.sort-btn {
  appearance: none;
  border: none;
  background: none;
  padding: 0 2px;
  font-size: 11px;
  line-height: 1;
  color: #c2b4a3;
  cursor: pointer;
}

.agent-table th.sortable::after {
  content: "↕";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: #c2b4a3;
}

.agent-table th.sortable[data-dir="asc"]::after {
  content: "▲";
  color: var(--ink);
}

.agent-table th.sortable[data-dir="desc"]::after {
  content: "▼";
  color: var(--ink);
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.table-footer-left {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.inline-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

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

.inline-field input {
  width: 110px;
}

.add-token-grid {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(220px, 320px);
  gap: 18px;
}

.add-token-side {
  display: grid;
  gap: 12px;
  align-content: start;
}

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

.add-token-actions .status-pill {
  margin-left: auto;
}

@media (max-width: 900px) {
  .add-token-grid {
    grid-template-columns: 1fr;
  }

  .add-token-actions .status-pill {
    margin-left: 0;
  }
}

.footer-page-size select {
  min-width: 90px;
}

.pager {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pager button {
  padding: 6px 12px;
  border-radius: 10px;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #e0efe5;
  background: #f6fffa;
  font-size: 12px;
  color: var(--muted);
}

.status-line strong {
  color: var(--ink);
  font-weight: 600;
}

.agent-card {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid #e0efe5;
  background: #f6fffa;
  cursor: pointer;
  transition: border 0.2s ease, transform 0.2s ease;
}

.agent-card.active {
  border-color: var(--accent-2);
  box-shadow: 0 10px 20px rgba(11, 110, 79, 0.2);
}

.tag-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #e0efe5;
  background: #ffffff;
}

.tag-row .meta {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.tag-row button {
  background: #ffffff;
  box-shadow: none;
  border: 1px solid #dfeee5;
}

.cli-table {
  min-width: 0;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal.open {
  display: flex;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 14, 18, 0.55);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(1100px, 92vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.settings-modal-card {
  width: min(1620px, 96vw);
}

.auto-default-rules {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.auto-default-rule {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px auto;
  gap: 8px;
  align-items: center;
}

@media (max-width: 600px) {
  .auto-default-rule {
    grid-template-columns: minmax(0, 1fr) 90px;
  }
}

.modal-card .field input,
.modal-card .field select,
.modal-card textarea {
  background: #ffffff;
  border-color: #dfeee5;
  color: var(--ink);
}

.modal-card .field input::placeholder,
.modal-card textarea::placeholder {
  color: var(--muted);
}

#logModal .code-block {
  background: #ffffff;
  border: 1px solid #dfeee5;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.agent-id {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.stat {
  padding: 14px;
  border-radius: 16px;
  background: #ffffff;
  border: 1px solid #dfeee5;
}

.table-card {
  background: #ffffff;
}

.job-card {
  background: #ffffff;
}

.job-card .stat {
  background: #ffffff;
}

.job-card .code-block {
  background: #ffffff;
  border: 1px solid #dfeee5;
}

.stat label {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.stat span {
  font-weight: 600;
  font-size: 18px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

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

.grid-3.compact {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.grid-4.compact {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.grid-3.compact .field input,
.grid-3.compact .field select {
  padding: 8px 10px;
  font-size: 13px;
}

.loading-indicator {
  display: none;
  align-items: center;
  gap: 10px;
}

.loading-indicator.active {
  display: inline-flex;
}

.notification-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.notification-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.notification-row .check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
}

.notification-row .check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.notification-row .check-spacer {
  display: inline-block;
  width: 16px;
  height: 16px;
}

.mini-input {
  border: 1px solid #dceee2;
  border-radius: 10px;
  padding: 8px 10px;
  background: #ffffff;
  font-family: var(--sans);
  color: var(--ink);
  width: 120px;
}

.input-white {
  background: #ffffff !important;
}

.proxmox-hosts-page button {
  line-height: 1.2;
  padding-top: 12px;
  padding-bottom: 11px;
}

.proxmox-hosts-page .icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 11px;
}

.proxmox-hosts-page .icon-btn.danger {
  background: rgba(139, 44, 29, 0.1);
  color: #8b2c1d;
}

.proxmox-hosts-page .card .actions {
  margin-top: 12px;
}

.proxmox-hosts-page .hosts-layout {
  display: grid;
  grid-template-columns: minmax(720px, 1.8fr) minmax(340px, 0.8fr);
  gap: 18px;
  align-items: start;
}

.proxmox-hosts-page .hosts-list-card {
  min-width: 0;
}

.proxmox-hosts-page .hosts-list-card .table-wrap {
  overflow-x: hidden;
  background: #ffffff;
}

.proxmox-hosts-page .hosts-form-card {
  min-width: 0;
}

.proxmox-hosts-page #hostsTableView {
  min-width: 0;
  font-size: 12px;
  table-layout: fixed;
  background: #ffffff;
}

.proxmox-hosts-page #hostsTableView th,
.proxmox-hosts-page #hostsTableView td {
  white-space: nowrap;
  padding: 9px 10px;
  background: #ffffff;
}

.proxmox-hosts-page #hostsTableView td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.proxmox-hosts-page #hostsTableView th:last-child,
.proxmox-hosts-page #hostsTableView td.host-actions {
  width: 86px;
  min-width: 86px;
  max-width: 86px;
}

.proxmox-hosts-page #hostsTableView th.num-col,
.proxmox-hosts-page #hostsTableView td.num-col {
  width: 38px;
}

.proxmox-hosts-page #hostsTableView th[data-host-col="name"],
.proxmox-hosts-page #hostsTableView td[data-host-col="name"] {
  width: 13%;
}

.proxmox-hosts-page #hostsTableView th[data-host-col="api_url"],
.proxmox-hosts-page #hostsTableView td[data-host-col="api_url"] {
  width: 24%;
}

.proxmox-hosts-page #hostsTableView th[data-host-col="token_id"],
.proxmox-hosts-page #hostsTableView td[data-host-col="token_id"] {
  width: 12%;
}

.proxmox-hosts-page #hostsTableView th[data-host-col="last_test"],
.proxmox-hosts-page #hostsTableView td[data-host-col="last_test"] {
  width: 13%;
}

.proxmox-hosts-page #hostsTableView th[data-host-col="user_realm"],
.proxmox-hosts-page #hostsTableView td[data-host-col="user_realm"] {
  width: 11%;
}

.proxmox-hosts-page #hostsTableView th[data-host-col="default_node"],
.proxmox-hosts-page #hostsTableView td[data-host-col="default_node"],
.proxmox-hosts-page #hostsTableView th[data-host-col="verify_tls"],
.proxmox-hosts-page #hostsTableView td[data-host-col="verify_tls"],
.proxmox-hosts-page #hostsTableView th[data-host-col="enabled"],
.proxmox-hosts-page #hostsTableView td[data-host-col="enabled"] {
  width: 8%;
}

.proxmox-hosts-page #hostsTableView .th-cell {
  min-width: 0;
}

.proxmox-hosts-page #hostsTableView .th-filter-btn {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proxmox-hosts-page .host-action-group {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 7px;
}

.proxmox-hosts-page .host-actions {
  overflow: visible;
}

@media (max-width: 1200px) {
  .proxmox-hosts-page .hosts-layout {
    grid-template-columns: 1fr;
  }
}

.proxy-packages-page .field input,
.proxy-packages-page .field select,
.proxy-packages-page textarea {
  background: #ffffff;
}

.proxy-packages-page #importSheet,
.proxy-packages-page #runAllocate,
.proxy-packages-page #testAssignedProxies,
.proxy-packages-page #copyStatusExport,
.proxy-packages-page #runSoftAllocation,
.proxy-packages-page #runHardAllocation {
  line-height: 1.2;
  padding-top: 14px;
  padding-bottom: 14px;
}

.proxy-packages-page .card .actions {
  margin-top: 12px;
  margin-bottom: 18px;
}

.proxy-packages-page .job-log-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 18px 0 10px;
}

.proxy-packages-page .job-log-tabs button.active {
  background: var(--ink);
  color: #ffffff;
}

.proxy-packages-page .job-log-panel {
  display: none;
  max-height: 520px;
}

.proxy-packages-page .job-log-panel.active {
  display: block;
}

.proxy-packages-page .agent-disabled {
  opacity: 0.58;
}

.proxy-packages-page .agent-disabled td {
  cursor: not-allowed;
}

.proxy-packages-page .mini-card {
  margin: 0;
  min-height: 180px;
}

.proxy-packages-page .danger-zone {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid rgba(180, 35, 24, 0.28);
  border-radius: 18px;
  background: #fff7f6;
}

.proxy-packages-page .danger-zone h3 {
  margin: 0 0 6px;
  color: #8f1d13;
}

.input-eye {
  position: relative;
  display: flex;
  align-items: center;
}

.input-eye input {
  width: 100%;
  padding-right: 44px;
}

.eye-btn {
  position: absolute;
  right: 10px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
}

.eye-btn:hover {
  color: var(--ink);
  background: rgba(15, 157, 88, 0.08);
}

.eye-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-actions {
  margin-top: 10px;
}

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

.log-output {
  background: #ffffff;
  border: 1px solid #dfeee5;
}

@media (max-width: 900px) {
  .notification-row {
    align-items: flex-start;
  }
}

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #d6e9dc;
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

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

.card {
  padding: 18px;
  border-radius: 18px;
  background: #f7fffb;
  border: 1px solid #dfeee5;
}

.card.table-card {
  background: #ffffff;
}

.section-toggle {
  display: inline-flex;
  gap: 10px;
  margin: 8px 0 12px;
}

.section-toggle.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.section-toggle .tab-group {
  display: inline-flex;
  gap: 10px;
  flex-wrap: wrap;
}

#agentConfigToolbar {
  flex-wrap: wrap;
}

#agentModal .modal-close-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
}

#agentModal .agent-config-main-grid {
  grid-template-columns: minmax(180px, 1.25fr) repeat(4, minmax(0, 1fr));
}

@media (max-width: 1000px) {
  #agentModal .agent-config-main-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  #agentModal .agent-config-main-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.agent-config-save-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

#agentModal .agent-auto-options {
  display: grid;
  gap: 16px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #dfeee5;
}

#agentModal .agent-auto-options h4 {
  margin: 0;
}

#agentModal .agent-auto-option {
  display: grid;
  gap: 6px;
}

#agentModal .agent-auto-option-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
}

#agentModal .agent-auto-option-line > .checkbox {
  justify-content: flex-start;
  width: fit-content;
  font-weight: 600;
  flex-shrink: 0;
}

#agentModal .agent-auto-help {
  flex: 1 1 240px;
  font-size: 12px;
  line-height: 1.45;
  font-weight: 400;
}

#agentModal .agent-restart-interval {
  width: min(220px, calc(100% - 26px));
  margin: 4px 0 0 26px;
}

#agentConfigOpening {
  font-size: 13px;
  color: var(--muted);
}

.icon-btn[aria-busy="true"] .spinner {
  display: inline-block;
}

.tab-btn {
  border-radius: 999px;
  padding: 8px 16px;
  background: #eaf5ee;
  color: var(--ink);
  font-weight: 600;
}

.tab-btn.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 157, 88, 0.25);
}

.runtime-panel {
  padding-top: 14px;
}

.runtime-panel > .grid-2,
.runtime-panel > .card {
  margin-top: 22px;
}

.hidden {
  display: none;
}

.section-card.hidden {
  display: none;
}

.section-card {
  margin-top: 4px;
}

.inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.settings-job-options {
  justify-content: flex-start;
  gap: 18px;
}

.checkbox {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 14px;
}

.section-disabled {
  opacity: 0.55;
  pointer-events: none;
}

.usage-table {
  font-family: var(--mono);
  font-size: 12px;
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow: auto;
}

.usage-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  background: white;
  border-radius: 10px;
  padding: 8px 10px;
  border: 1px solid #dbeee2;
}

.log-level {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #eaf5ee;
  color: var(--ink);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.log-level.info {
  background: rgba(11, 110, 79, 0.12);
  color: var(--accent-2);
}

.log-level.warning {
  background: rgba(255, 193, 7, 0.18);
  color: #9a6b00;
}

.log-level.error {
  background: rgba(139, 44, 29, 0.12);
  color: #8b2c1d;
}

.log-level.debug {
  background: rgba(99, 122, 167, 0.14);
  color: #3b4a73;
}

.log-message {
  max-width: 520px;
  word-break: break-word;
}

.autofill-guard {
  position: absolute;
  left: -9999px;
  top: -9999px;
  height: 0;
  width: 0;
  overflow: hidden;
}

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

.divider {
  height: 1px;
  background: #e4f2e9;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: #1b1f24;
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.2s ease;
  z-index: 1100;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Bulk build sidecar: existing Agents/Config table styles are not migrated. */
.agents-panel { min-width: 0; }

/* Agents server table only: modal/config/blocklist controls keep their styles. */
.agents-panel input:not([type="checkbox"]), .agents-panel select,
.agent-table-popover input:not([type="checkbox"]),
.agents-panel input:not([type="checkbox"]):hover, .agents-panel select:hover,
.agent-table-popover input:not([type="checkbox"]):hover,
.agents-panel input:not([type="checkbox"]):focus, .agents-panel select:focus,
.agent-table-popover input:not([type="checkbox"]):focus {
  border: 0;
  outline: 0;
  box-shadow: none;
}
.agents-panel input:not([type="checkbox"]):focus, .agents-panel select:focus,
.agent-table-popover input:not([type="checkbox"]):focus { background: #e1f1e8; }
.agents-panel .table-controls.with-columns { flex-wrap: wrap; align-items: center; }
.agents-panel .table-controls.with-columns .field { flex: 1 1 220px; width: auto; }
.agents-panel .table-controls button { white-space: nowrap; }
.agents-panel #agentColumnsPanel { max-width: calc(100vw - 32px); }
.agent-table-popover {
  position: fixed;
  z-index: 1100;
  width: min(320px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px);
  overflow: auto;
  padding: 12px;
  border: 0;
  border-radius: 12px;
  background: #f6fffa;
  box-shadow: 0 12px 30px rgba(35, 27, 16, 0.16);
}
.agent-table-popover[hidden] { display: none; }
.agent-table-popover > input { width: 100%; margin: 8px 0; }
.agent-filter-actions { display: flex; gap: 8px; margin-bottom: 8px; }
.agent-filter-actions [aria-pressed="true"] { background: #d5ebdf; font-weight: 700; }
.agent-filter-list { max-height: min(280px, 40dvh); overflow: auto; overflow-anchor: none; }
.agent-filter-list label {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px;
  border-radius: 6px; cursor: pointer; overflow-wrap: anywhere;
}
.agent-filter-list input { flex: 0 0 auto; }
.agent-filter-list label:focus-within, .agents-panel .column-option:focus-within { background: #d5ebdf; }
.agent-filter-list input:focus { outline: 0; box-shadow: none; }
.agent-table-status { height: 140px; }
.agent-table-status button { margin-left: 12px; }
.agent-refresh-indicator { display: inline-block; min-width: 230px; min-height: 1.3em; font-size: 12px; }
.agent-table-announcement {
  position: absolute; width: 1px; height: 1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
.bulk-build-toolbar,
.bulk-progress-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.agent-multi-actions { position: relative; margin-left: auto; flex: 0 0 auto; }
.agent-multi-action-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 80;
  display: flex; flex-direction: column; padding: 6px; min-width: max-content;
  max-width: calc(100vw - 32px); background: var(--card); border-radius: 12px; box-shadow: var(--shadow);
}
.agent-multi-action-menu[hidden] { display: none; }
.agent-multi-action-menu button { width: 100%; text-align: left; white-space: nowrap; border-radius: 8px; }
.agent-multi-actions button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.bulk-selection-cell { width: 42px; min-width: 42px; text-align: center; }
.bulk-build-card { width: min(1100px, 96vw); min-width: 0; }
.bulk-build-fields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.bulk-preview-items { max-height: 200px; overflow: auto; overflow-wrap: anywhere; }
.bulk-build-warning { padding: 12px; border-radius: 10px; color: #784411; background: #fff2d8; }
.bulk-actions-end { justify-content: flex-end; }
.bulk-tableview { min-width: 0; }
.bulk-progress-controls .field { flex: 1 1 220px; }
.bulk-progress-scroll { max-width: 100%; overflow-x: auto; }
.bulk-progress-scroll table { width: 100%; min-width: 540px; }
.bulk-progress-scroll th { white-space: nowrap; }
.bulk-progress-scroll td { max-width: 320px; white-space: normal; overflow-wrap: anywhere; }
.bulk-progress-scroll th:nth-child(2),
.bulk-progress-scroll td:nth-child(2) { width: 170px; white-space: nowrap; }
.bulk-progress-scroll tbody { min-height: 100px; }
.bulk-tableview [hidden], .bulk-table-popover[hidden], #bulkForm[hidden],
#bulkCurrent[hidden], #bulkPreviewDetails[hidden], #bulkTimeoutWarning[hidden] { display: none !important; }
#bulkProgressBar { width: 100%; height: 12px; accent-color: #159766; }
#bulkProgressCounts { font-size: 13px; color: #52605c; }
.bulk-table-popover { position: fixed; z-index: 1050; background: var(--card, #fff); padding: 14px; border: 0; border-radius: 12px; box-shadow: var(--shadow); overflow: auto; }
.bulk-table-popover h3 { margin: 0 0 12px; }
.bulk-table-popover input[type="search"] { width: 100%; min-width: 0; }
.bulk-filter-choices { max-height: 260px; overflow-y: auto; }
.bulk-choices-loading { opacity: 0.5; pointer-events: none; }
.bulk-choice { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 6px; overflow-wrap: anywhere; }
.bulk-choice[hidden] { display: none; }
.bulk-choice:focus-within { background: #d9eee4; }
.bulk-filter-active { color: #086646; background: #dbf1e5; }
.bulk-tableview input:not([type="checkbox"]),
.bulk-tableview select,
.bulk-tableview input:not([type="checkbox"]):hover,
.bulk-tableview select:hover,
.bulk-tableview input:not([type="checkbox"]):focus,
.bulk-tableview select:focus { border: 0; outline: none; box-shadow: none; }
.bulk-tableview input:not([type="checkbox"]):focus,
.bulk-tableview select:focus { background: #d9eee4; }
.bulk-tableview input[type="checkbox"]:focus-visible { outline: none; box-shadow: none; }
.bulk-tableview button:focus-visible { outline: 2px solid #0b6e4f; outline-offset: 2px; }
@media (max-width: 640px) {
  .bulk-build-card { padding: 16px; }
  .bulk-build-fields { grid-template-columns: minmax(0, 1fr); }
  .bulk-tableview .table-footer { gap: 12px; flex-wrap: wrap; }
}

@media (max-width: 960px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid #dfeee5;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px 16px;
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .nav-group {
    flex-direction: row;
    flex-wrap: wrap;
    border-top: none;
    padding-top: 0;
    gap: 8px;
  }

  .nav-group-title {
    width: 100%;
  }

  .nav-footer {
    flex-direction: row;
    flex-wrap: wrap;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    gap: 8px;
  }

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

  .hero {
    padding: 40px 6vw 16px;
  }

  .layout {
    padding: 16px 6vw 60px;
  }

  .table-controls.inline-controls {
    flex-wrap: wrap;
  }

  .table-controls.inline-controls button {
    width: 100%;
  }

  .blocklist-layout {
    grid-template-columns: 1fr;
  }
}
