:root {
  --bg-deep: #0f0a07;
  --bg: #16100b;
  --surface: #221910;
  --surface-2: #2c2116;
  --surface-3: #362818;
  --border: #5a4528;
  --border-soft: #3d2e1c;
  --gold: #e4b429;
  --gold-bright: #f5d061;
  --gold-dim: #a67c00;
  --text: #f8edd8;
  --muted: #a89578;
  --online: #45e08a;
  --offline: #e89555;
  --danger: #c94a4a;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  --font: "DM Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --gold-soft: #d4a84a;
  --bg-card: var(--surface-2);
}

*, *::before, *::after { box-sizing: border-box; }

html { font-size: 15px; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

body.jax-booting .login-gate,
body.jax-booting .app-shell {
  visibility: hidden;
}

.panel-boot {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
  color: var(--muted);
  font-size: 0.95rem;
  z-index: 9999;
}

.panel-boot.hidden {
  display: none;
}

.hidden { display: none !important; }

/* —— Login —— */
.login-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(228, 180, 41, 0.12), transparent),
    linear-gradient(180deg, #1a120c 0%, var(--bg-deep) 100%);
}

.login-card {
  width: min(420px, 100%);
  background: linear-gradient(165deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 2.25rem;
  box-shadow: var(--shadow);
}

.login-brand {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-bottom: 2rem;
}

.login-logo {
  font-size: 2rem;
  color: var(--gold);
  filter: drop-shadow(0 0 12px rgba(228, 180, 41, 0.4));
}

.login-brand h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-brand p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-fields label {
  display: block;
  margin-bottom: 1rem;
}

.login-fields label span {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.login-fields input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: var(--bg-deep);
  color: var(--text);
  font-size: 1rem;
}

.login-fields input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(228, 180, 41, 0.15);
}

.login-err {
  color: #ff7b7b;
  font-size: 0.9rem;
  margin-top: 1rem;
  text-align: center;
}

/* —— App shell —— */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  max-width: 100%;
  background:
    radial-gradient(ellipse 100% 60% at 50% 0%, rgba(228, 180, 41, 0.06), transparent 55%),
    var(--bg-deep);
}

.app-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.85rem 1.75rem;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(34, 25, 16, 0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-block {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  min-width: 200px;
}

.brand-mark { color: var(--gold); font-size: 1.1rem; }
.brand-name { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand-ver { color: var(--muted); font-size: 0.8rem; font-weight: 500; }

.main-nav {
  display: flex;
  gap: 0.35rem;
  flex: 1;
  justify-content: center;
  flex-wrap: wrap;
}

.nav-pill {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 500;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.nav-pill:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
}

.nav-pill.active {
  color: var(--gold-bright);
  border-color: var(--gold);
  background: rgba(228, 180, 41, 0.08);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 200px;
  justify-content: flex-end;
}

.live-badge {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  color: var(--muted);
}

.live-badge.on {
  color: var(--online);
  border-color: rgba(69, 224, 138, 0.35);
  background: rgba(69, 224, 138, 0.08);
}

.live-badge.on::before {
  content: "● ";
}

.user-chip {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.35rem 0.65rem;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
}

.app-body {
  flex: 1;
  padding: 1.35rem clamp(1rem, 2.5vw, 2.5rem) 2rem;
  max-width: none;
  width: 100%;
  margin: 0;
}

.app-footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--border-soft);
  opacity: 0.7;
}

/* —— Metrics —— */
.metric-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.metric-row-3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 992px) {
  .metric-row { grid-template-columns: repeat(2, 1fr); }
  .metric-row-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .metric-row { grid-template-columns: 1fr; }
}

.metric-card {
  background: linear-gradient(145deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}

.metric-card.highlight {
  border-color: rgba(69, 224, 138, 0.25);
  background: linear-gradient(145deg, #1a2e22, var(--surface));
}

.metric-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.metric-value {
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
}

.metric-value.accent { color: var(--gold); }
.metric-value.online { color: var(--online); }
.metric-value.warn { color: var(--offline); }

/* —— Cards —— */
.card {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.card-head h2, .card-head h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.card-head-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--bg-deep);
  border: 1px solid var(--border-soft);
}

.segment {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 0.85rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
}

.segment.active {
  background: rgba(228, 180, 41, 0.15);
  color: var(--gold-bright);
}

.badge.deleted {
  background: rgba(201, 74, 74, 0.15);
  color: #ff8a8a;
  border: 1px solid rgba(201, 74, 74, 0.35);
}

.select-toolbar {
  min-width: 140px;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-deep);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
}

/* —— Fleet stats (mockup top cards) —— */
.fleet-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.15rem;
}

@media (max-width: 720px) {
  .fleet-stats { grid-template-columns: 1fr; }
}

.stat-card {
  position: relative;
  background: linear-gradient(145deg, var(--surface-2), var(--surface));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem 1.1rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 80% at 100% 0%, rgba(228, 180, 41, 0.08), transparent);
  pointer-events: none;
}

.stat-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.35rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--gold-bright);
  font-variant-numeric: tabular-nums;
}

.stat-online .stat-value { color: var(--online); }
.stat-offline .stat-value { color: var(--offline); }

.stat-icon {
  position: absolute;
  top: 0.85rem;
  right: 0.9rem;
  font-size: 0.75rem;
  color: rgba(228, 180, 41, 0.45);
}

.stat-online .stat-icon { color: rgba(69, 224, 138, 0.5); }

/* —— Devices table: fit viewport width, no horizontal scroll —— */
.devices-card {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.devices-card .card-actions {
  min-width: 0;
  flex: 1 1 100%;
}

.devices-card .card-actions .input.grow {
  min-width: 0;
  flex: 1 1 8rem;
  max-width: 100%;
}

.devices-card .table-wrap {
  overflow-x: clip;
  max-width: 100%;
}

.devices-table {
  table-layout: fixed;
  width: 100%;
  max-width: 100%;
  font-size: 0.78rem;
}

.devices-table .col-select {
  width: 2.25rem;
}

.devices-table .col-status {
  width: 5.25rem;
}

/* Fixed data columns — extra table width goes to Actions, not a wide empty Host cell */
.devices-table .col-host {
  width: 10.5rem;
}

.devices-table .col-identity {
  width: 8rem;
}

.devices-table .col-system,
.devices-table .col-hardware {
  width: 9rem;
  min-width: 7rem;
}

.devices-table .col-location {
  width: 8.5rem;
}

/* Extra table width goes here (metric bars), not into action buttons */
.devices-table .col-metrics {
  width: auto;
  min-width: 9.5rem;
}

.devices-table td.cell-metrics {
  white-space: normal;
  overflow: visible;
  line-height: 1.15;
  font-size: 0.65rem;
}

.metrics-live .metric-line {
  display: grid;
  grid-template-columns: 1.6rem 1fr auto;
  gap: 0.2rem 0.35rem;
  align-items: center;
  margin-bottom: 0.12rem;
}

.metrics-live .metric-line:last-child {
  margin-bottom: 0;
}

.metrics-live.metrics-stale {
  opacity: 0.72;
}

.metrics-live.metrics-stale .metric-bar i {
  filter: saturate(0.65);
}

.metric-lbl {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 700;
  text-transform: uppercase;
}

.metric-bar {
  display: block;
  height: 0.35rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
  border: 1px solid var(--border-soft);
}

.metric-bar i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold-bright));
  transition: width 0.35s ease;
}

.metric-val {
  font-variant-numeric: tabular-nums;
  font-size: 0.62rem;
  min-width: 2.5rem;
  text-align: right;
}

.devices-main-split {
  display: block;
}

.devices-card.device-detail-open .devices-main-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 30%);
  gap: 0.75rem;
  align-items: start;
}

.device-detail-drawer {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 0.85rem 0.9rem 1rem;
  max-height: 28rem;
  overflow-y: auto;
}

.device-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.device-detail-label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
  font-weight: 700;
}

.device-detail-title {
  margin: 0.15rem 0 0;
  font-size: 1rem;
  word-break: break-word;
}

.device-detail-status {
  margin: 0 0 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.device-detail-sub {
  font-size: 0.78rem;
  color: var(--muted);
}

.device-detail-section-title {
  margin: 0 0 0.45rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gold-bright);
}

.device-detail-section {
  margin-bottom: 0.85rem;
}

.device-detail-dl {
  margin: 0;
}

.device-detail-row {
  display: grid;
  grid-template-columns: 38% 1fr;
  gap: 0.35rem 0.5rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.78rem;
}

.device-detail-row dt {
  margin: 0;
  color: var(--muted);
  font-weight: 500;
}

.device-detail-row dd {
  margin: 0;
  word-break: break-word;
}

.device-detail-foot {
  margin-top: 0.5rem;
}

.device-detail-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.65rem;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 0.35rem;
}

.device-detail-tab {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  cursor: pointer;
}

.device-detail-tab.on {
  color: var(--gold-bright);
  background: rgba(228, 180, 41, 0.08);
  box-shadow: inset 0 -2px 0 var(--gold);
}

.device-detail-software {
  margin-top: 0.65rem;
  max-height: 14rem;
  overflow: auto;
  font-size: 0.68rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: rgba(0, 0, 0, 0.25);
}

tr.device-row-clickable {
  cursor: pointer;
}

tr.device-row-selected td {
  background: rgba(228, 180, 41, 0.06);
}

tr.device-row-selected td.row-actions {
  background: var(--surface);
}

.devices-table .col-last {
  width: 6.75rem;
}

.devices-table .col-actions {
  width: 22rem;
  max-width: 22rem;
}

.devices-table .col-select-head,
.devices-table td.cell-select,
.devices-table th.col-status-head,
.devices-table td.cell-status {
  text-align: center;
  vertical-align: middle;
  padding-left: 0.4rem !important;
  padding-right: 0.4rem !important;
}

.devices-table th.col-select-head {
  overflow: visible;
  position: relative;
  z-index: 2;
}

.devices-table td.cell-select .device-select-cb,
.devices-table .col-select-head input {
  width: 1rem;
  height: 1rem;
  margin: 0;
  cursor: pointer;
  accent-color: var(--gold);
}

.devices-table td.cell-status .badge {
  display: inline-block;
  min-width: 4.25rem;
  text-align: center;
}

.device-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.75rem;
  margin: 0 0 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem;
  border: 1px solid var(--gold-dim);
  background: rgba(228, 180, 41, 0.06);
}

.device-bulk-count {
  font-weight: 600;
  color: var(--gold-bright);
  margin-right: 0.25rem;
}

.bulk-run-hint {
  margin: 0 1rem 0.75rem;
}

.bulk-run-fields {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0 1rem 0.75rem;
}

.bulk-run-fields .field span {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.bulk-run-actions {
  padding: 0 1rem 1rem;
}

.bulk-run-log {
  margin: 0 1rem 1rem;
  max-height: 12rem;
}


.devices-table th {
  color: var(--gold);
  padding: 0.45rem 0.28rem;
  font-size: 0.58rem;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.devices-table td {
  padding: 0.45rem 0.28rem;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.devices-table td.cell-host,
.devices-table td.cell-identity,
.devices-table td.cell-location {
  line-height: 1.3;
  overflow: hidden;
  white-space: normal;
  max-width: 0;
}

.devices-table .cell-idn-line,
.devices-table .cell-loc-ip {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.devices-table td.cell-host strong {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  font-size: 0.76rem;
}

.host-sub {
  display: block;
  color: var(--muted);
  font-size: 0.62rem;
  margin-top: 0.08rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: none;
}

.host-sub-caps,
.device-detail-sub-caps {
  letter-spacing: 0.04em;
  font-weight: 600;
}

.group-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.75rem;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px dashed var(--gold-dim);
  color: var(--gold-bright);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  max-width: none;
}

.devices-table tbody tr.device-data-row {
  position: relative;
}

.devices-table tbody tr.device-data-row td {
  position: relative;
  min-height: 2.65rem;
}

.devices-table tbody tr.device-data-row:hover td {
  background: rgba(228, 180, 41, 0.04);
}

.devices-table td.cell-location .cell-loc-ip {
  font-variant-numeric: tabular-nums;
}

.devices-table .cell-last {
  font-size: 0.72rem;
  color: var(--muted);
}

.devices-table .cell-last .last-seen-live {
  color: var(--ok);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.devices-table .cell-last .last-seen-live::before {
  content: "";
  display: inline-block;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.35rem;
  border-radius: 50%;
  background: var(--ok);
  vertical-align: 0.05em;
  animation: last-seen-pulse 2.4s ease-in-out infinite;
}

@keyframes last-seen-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.85);
  }
}

.devices-table th.col-actions-head,
.devices-table th:last-child {
  text-align: center;
}

.devices-table td.row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.22rem;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.25rem;
  background: var(--surface);
  overflow: visible;
}

.devices-table .row-actions .btn-act,
.devices-table .row-actions .btn-outline,
.devices-table .row-actions .btn-danger {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.26rem 0.38rem;
  border-radius: 5px;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
}

.devices-table .row-actions .btn-outline {
  padding: 0.24rem 0.36rem;
}

.devices-table .badge {
  font-size: 0.58rem;
  padding: 0.18rem 0.35rem;
  letter-spacing: 0.04em;
}

.devices-table .cell-metrics {
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.devices-table .group-chip {
  min-height: 1.45rem;
  padding: 0.1rem 0.4rem;
  font-size: 0.62rem;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Section divider — smooth ribbon, no center seam */
.devices-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  margin-top: 0.85rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.18);
}

.devices-pagination-left,
.devices-pagination-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
}

.devices-page-size {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.devices-page-size span {
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  font-size: 0.68rem;
}

.devices-page-summary {
  font-size: 0.82rem;
  color: var(--text);
}

.devices-page-indicator {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gold-bright);
  min-width: 6.5rem;
  text-align: center;
}

.devices-pagination .btn-sm:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.devices-section-divider,
.devices-ribbon {
  height: 1px;
  margin: 1.25rem 0 1rem;
  border: none;
  border-radius: 0;
  background: linear-gradient(90deg, transparent, var(--border-soft) 15%, var(--gold-dim) 50%, var(--border-soft) 85%, transparent);
  box-shadow: none;
  clip-path: none;
  opacity: 0.85;
}

.deleted-devices-block {
  padding-top: 0.25rem;
}

.subhead-row {
  margin-bottom: 0.75rem;
}

.subhead-row h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold-bright);
}

.empty-inline {
  padding: 1.25rem;
  font-style: italic;
}

.table-wrap-compact {
  border-color: rgba(90, 69, 40, 0.5);
}

.btn-outline.refresh-btn {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
  font-weight: 600;
}

.btn-outline.refresh-btn:hover {
  background: rgba(228, 180, 41, 0.08);
  border-color: var(--gold);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
  justify-content: flex-end;
  min-width: 280px;
}

.lead {
  color: var(--muted);
  margin: -0.5rem 0 1.25rem;
  font-size: 0.92rem;
  max-width: 720px;
}

.subhead {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

/* —— Forms —— */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.field span {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field input,
.field select,
.input,
.select-sm {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-soft);
  background: var(--bg-deep);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
}

.field.readonly input {
  opacity: 0.85;
  cursor: default;
}

.field input:focus,
.input:focus,
.field select:focus {
  outline: none;
  border-color: var(--gold);
}

.input.grow { flex: 1; min-width: 200px; }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 1rem; }

.file-drop {
  display: block;
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 1.5rem;
  text-align: center;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.file-drop:hover {
  border-color: var(--gold);
  background: rgba(228, 180, 41, 0.04);
}

.file-drop input { display: none; }

.file-drop-label { color: var(--muted); font-size: 0.9rem; }

.split-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

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

/* —— Buttons —— */
.btn {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: transform 0.1s, filter 0.15s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-dim));
  color: #1a1008;
  box-shadow: 0 2px 8px rgba(228, 180, 41, 0.25);
}

.btn-primary:hover { filter: brightness(1.05); }

.btn-secondary {
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border-soft);
}

.btn-ghost:hover { color: var(--text); border-color: var(--border); }

.btn-danger {
  background: linear-gradient(180deg, #d65555, #9e3333);
  color: #fff;
  font-size: 0.78rem;
  padding: 0.35rem 0.7rem;
}

.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.78rem; }
.btn-block { width: 100%; margin-top: 0.5rem; padding: 0.7rem; }
.btn-icon { font-size: 1.35rem; line-height: 1; padding: 0.25rem 0.5rem; }

/* —— Tables —— */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--border-soft); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table thead {
  background: rgba(0, 0, 0, 0.25);
}

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  border-bottom: 1px solid var(--border-soft);
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(61, 46, 28, 0.6);
  vertical-align: middle;
}

.data-table tbody tr:hover td {
  background: rgba(228, 180, 41, 0.03);
}

.data-table.compact td,
.data-table.compact th { padding: 0.55rem 0.75rem; font-size: 0.82rem; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.badge.on {
  background: rgba(69, 224, 138, 0.15);
  color: var(--online);
  border: 1px solid rgba(69, 224, 138, 0.35);
}

.badge.off {
  background: rgba(232, 149, 85, 0.12);
  color: var(--offline);
  border: 1px solid rgba(232, 149, 85, 0.3);
}

.badge.stopped {
  background: rgba(228, 180, 41, 0.12);
  color: var(--gold-bright);
  border: 1px solid rgba(228, 180, 41, 0.35);
}

.row-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.row-actions .btn-primary,
.row-actions .btn-secondary,
.row-actions .btn-act {
  font-size: 0.75rem;
  padding: 0.32rem 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.row-actions .btn-act {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: #1a1208;
  border: none;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.15) inset;
}

.row-actions .btn-act:hover:not(:disabled) {
  filter: brightness(1.06);
}

.tools-toolbar {
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tools-toolbar .grow {
  flex: 1;
  min-width: 10rem;
}

.row-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.row-actions .btn-outline {
  font-size: 0.75rem;
  padding: 0.3rem 0.65rem;
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--gold-dim);
}

.row-actions .btn-outline:hover:not(:disabled) {
  background: rgba(228, 180, 41, 0.1);
  border-color: var(--gold);
}

.col-metrics { width: 7.5rem; }
.cell-metrics {
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
}
.cell-metrics .metric-cpu { color: var(--gold); }

.process-modal-pro {
  width: min(960px, 96vw);
  max-height: 90vh;
}

.process-toolbar .process-status {
  margin-left: auto;
  flex: 1 1 12rem;
  text-align: right;
  font-size: 0.78rem;
}

.process-live-mode {
  min-width: 7.5rem;
}

.process-table-wrap {
  max-height: min(52vh, 520px);
  overflow: auto;
  border-top: 1px solid var(--border-soft);
  padding: 0 0.5rem 0.75rem;
}
.process-table { margin: 0; font-size: 0.82rem; }
.process-table th { position: sticky; top: 0; background: var(--bg-card); z-index: 1; }
.process-auto-label { font-size: 0.82rem; }
.process-table tr.proc-row-changed td {
  animation: fs-row-highlight 1.2s ease-out;
}

.process-out {
  margin: 0;
  padding: 1rem 1.1rem;
  min-height: 280px;
  max-height: min(60vh, 520px);
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  background: #0a0705;
  border-top: 1px solid var(--border-soft);
  white-space: pre-wrap;
  word-break: break-word;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1.5rem;
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
}

.empty-state.hidden { display: none; }

/* —— Code blocks —— */
.code-block {
  font-family: var(--mono);
  font-size: 0.82rem;
  background: var(--bg-deep);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 1rem 1.15rem;
  overflow-x: auto;
  margin: 0;
  line-height: 1.55;
}

.code-block.terminal { min-height: 120px; max-height: 280px; overflow-y: auto; }

.code-block.muted { color: var(--muted); }

.result-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-soft);
}

.result-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

/* —— Shell modal (enterprise terminal chrome) —— */
.shell-modal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  width: min(960px, 96vw);
  padding: 0;
  box-shadow: var(--shadow);
}

.shell-modal-pro {
  border-color: rgba(255, 255, 255, 0.08);
  background: linear-gradient(180deg, #1a1512 0%, #12100e 100%);
}

.shell-modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
}

.shell-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-soft);
}

.shell-head-pro {
  padding: 0.85rem 1.25rem;
  background: rgba(0, 0, 0, 0.35);
}

.shell-head-text {
  min-width: 0;
}

.shell-title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.shell-label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
}

.shell-host {
  font-weight: 600;
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.shell-session-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
  background: rgba(0, 0, 0, 0.4);
}

.shell-session-badge.live {
  color: #7dffb2;
  border-color: rgba(125, 255, 178, 0.35);
  background: rgba(40, 120, 80, 0.25);
}

.shell-session-badge.warn {
  color: #ffc966;
  border-color: rgba(255, 201, 102, 0.35);
}

.shell-close-btn {
  font-size: 1.35rem;
  line-height: 1;
}

.shell-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.25rem;
  border-bottom: 1px solid var(--border-soft);
}

.shell-toolbar-pro {
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  background: rgba(0, 0, 0, 0.2);
}

.shell-field-label {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
}

.shell-type-select {
  min-width: 9rem;
}

.shell-quick-details {
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--muted);
}

.shell-quick-details summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.shell-quick-details summary::-webkit-details-marker {
  display: none;
}

.shell-quick-details[open] summary {
  margin-bottom: 0.5rem;
  color: var(--text);
}

.shell-quick-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem;
  width: min(420px, 100%);
}

.shell-quick-input {
  flex: 1 1 12rem;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.shell-quick-out {
  flex: 1 1 100%;
  margin: 0;
  padding: 0.65rem 0.75rem;
  max-height: 140px;
  overflow: auto;
  font-size: 0.72rem;
  line-height: 1.45;
  font-family: var(--mono);
  border-radius: var(--radius-sm, 6px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: #0d1117;
  color: #c9d1d9;
  white-space: pre-wrap;
  word-break: break-word;
}

.shell-quick-out.ok {
  border-color: rgba(125, 255, 178, 0.2);
}

.shell-quick-out.err {
  border-color: rgba(255, 120, 100, 0.35);
}

.shell-terminal-wrap {
  padding: 0;
  background: #0d1117;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.shell-screen {
  min-height: 400px;
  height: min(52vh, 520px);
  padding: 0.35rem 0.5rem 0.5rem;
  background: #0d1117;
}

.shell-screen .xterm {
  height: 100%;
}

.shell-screen .xterm-viewport {
  overflow-y: auto !important;
}

.shell-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.45rem 1.25rem;
  font-size: 0.68rem;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.45);
}

.shell-foot-meta {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
}

.hint-inline { color: var(--muted); font-size: 0.82rem; }

.mono-id {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.75rem;
}

.toast {
  position: fixed;
  bottom: 1.35rem;
  right: 1.25rem;
  left: auto;
  transform: none;
  z-index: 1100;
  padding: 0.75rem 1.1rem;
  padding-left: 2.75rem;
  border-radius: var(--radius-sm);
  background: rgba(22, 18, 15, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.4;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  max-width: min(380px, 92vw);
  text-align: left;
  pointer-events: none;
  animation: toast-in 0.22s ease;
}

.toast::before {
  content: "";
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--gold-bright);
}

.toast.toast-success {
  border-color: rgba(125, 255, 178, 0.35);
}

.toast.toast-success::before {
  background: #7dffb2;
}

.toast.toast-error {
  border-color: rgba(255, 120, 100, 0.4);
}

.toast.toast-error::before {
  background: #ff8a7a;
}

.toast.toast-info::before {
  background: var(--gold-bright);
}

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

.confirm-modal {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #1a1512 0%, #12100e 100%);
  color: var(--text);
  width: min(440px, 92vw);
  padding: 0;
  box-shadow: var(--shadow);
}

.confirm-modal::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
}

.confirm-head {
  padding: 1rem 1.25rem 0.5rem;
  border-bottom: 1px solid var(--border-soft);
}

.confirm-label {
  display: block;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 600;
}

.confirm-title {
  margin: 0.35rem 0 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.confirm-body {
  padding: 1rem 1.25rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
}

.confirm-body p {
  margin: 0 0 0.65rem;
}

.confirm-body p:last-child {
  margin-bottom: 0;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem 1rem;
  border-top: 1px solid var(--border-soft);
}

.file-drop.dragover {
  border-color: var(--gold-bright);
  background: rgba(228, 180, 41, 0.08);
}

.file-drop.has-file .file-drop-label {
  color: var(--gold-bright);
}

/* —— Pack links —— */
.packs-page .card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.packs-hint {
  margin: 0 0 1rem;
}

.packs-table .pack-col-select {
  width: 2.5rem;
  text-align: center;
}

.packs-table .pack-select-cb {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
  accent-color: var(--gold);
}

.packs-table td.pack-url-cell {
  max-width: 14rem;
  font-size: 0.72rem;
  word-break: break-all;
}

.packs-table .pack-actions {
  white-space: nowrap;
}

/* —— Agent Builder —— */
.builder-card {
  background: linear-gradient(180deg, #2a1f15 0%, #1d1510 100%);
}

.builder-unlimited-hint {
  margin: 0 0 1rem;
  padding: 0.65rem 0.85rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text);
  background: rgba(228, 180, 41, 0.08);
  border: 1px solid rgba(228, 180, 41, 0.25);
  border-radius: var(--radius-sm);
}

.builder-card .builder-field span {
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}

.builder-card .builder-field input,
.builder-card .builder-field select {
  font-size: 0.92rem;
}

.addresses-field .addresses-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.4rem;
  text-transform: none !important;
  letter-spacing: 0.02em;
}

.builder-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem 1rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 1200px) {
  .builder-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.addresses-field,
.formats-field,
.delivery-field {
  grid-column: 1 / -1;
}

.address-textarea {
  width: 100%;
  min-height: 4.5rem;
  padding: 0.65rem 0.85rem;
  background: #0f0905;
  border-radius: var(--radius-sm);
  border: 1px solid #4a3520;
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.45;
  resize: vertical;
  margin-bottom: 0.45rem;
}

.address-textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(228, 180, 41, 0.12);
}

.detected-ips {
  margin: 0 0 0.65rem;
  font-size: 0.82rem;
  color: var(--muted);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.4;
}

/* #lanIP / #publicIP live inside .field — override .field span { display: block } */
.detected-ips span {
  display: inline;
  margin: 0;
  padding: 0;
  text-transform: none;
  letter-spacing: 0.02em;
  font-size: inherit;
  font-weight: 600;
  color: var(--gold-bright);
}

.formats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.format-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.format-buttons {
  display: flex;
  gap: 0.5rem;
}

.btn-mini {
  background: transparent;
  border: 1px solid #4a3520;
  color: var(--muted);
  padding: 0.25rem 0.65rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-mini:hover {
  color: var(--text);
  border-color: var(--gold);
  background: rgba(228, 180, 41, 0.05);
}

.formats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem 1rem;
  padding: 0.25rem 0 0;
  background: transparent;
  border: none;
  border-radius: 0;
}

@media (max-width: 900px) {
  .formats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.format-name {
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

.format-name.format-named {
  text-transform: none;
}

.formats-field .checkbox-label,
.delivery-field .radio-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.86rem;
  margin: 0;
  cursor: pointer;
  color: var(--text);
  font-family: var(--mono);
}

.formats-field .checkbox-label.format-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.formats-field {
  border: 1px solid #4a3520;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  background: rgba(0, 0, 0, 0.12);
}

.delivery-field {
  border: 1px solid #4a3520;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  background: rgba(0, 0, 0, 0.12);
}

.delivery-options {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.35rem 0 0;
  margin-top: 0.35rem;
}

.delivery-option {
  align-items: flex-start !important;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: border-color 0.15s, background 0.15s;
}

.delivery-option:has(input:checked) {
  border-color: #5a4528;
  background: rgba(228, 180, 41, 0.08);
}

.delivery-option-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  line-height: 1.35;
}

.delivery-option-text strong {
  font-weight: 600;
  color: var(--text);
  font-family: inherit;
}

.delivery-option-text small {
  font-size: 0.78rem;
  color: var(--muted);
  font-family: inherit;
}

.checkbox-label input,
.radio-label input {
  width: auto;
  cursor: pointer;
  accent-color: var(--gold);
}

.builder-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.25rem 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid #4a3520;
}

.btn-build {
  background: linear-gradient(180deg, #f5d061, #c9981a);
  color: #1a1008;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.65rem 2rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(228, 180, 41, 0.3);
  transition: all 0.15s;
}

.btn-build:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(228, 180, 41, 0.4);
}

.btn-build:active {
  transform: translateY(0);
}

.build-status {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
}

.build-status.success {
  color: var(--online);
}

.download-link-section {
  padding: 1.25rem 1.35rem;
  background: rgba(0, 0, 0, 0.35);
  border-radius: var(--radius-sm);
  border: 1px solid #4a3520;
  margin-top: 1rem;
}

.download-link-section.download-ready {
  border-color: #6b5428;
  box-shadow: 0 0 0 1px rgba(228, 180, 41, 0.12);
}

.download-single-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.download-single-name {
  font-family: var(--mono);
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold-bright);
}

.download-single-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.download-title {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--gold-bright);
}

.download-hint {
  margin: 0 0 1rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.download-link-box {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.download-link-input {
  flex: 1;
  padding: 0.65rem 0.85rem;
  background: #0f0905;
  border: 1px solid #5a4528;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.85rem;
}

.download-block-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: 0.45rem;
}

.download-files-block {
  margin-bottom: 1rem;
}

.download-file-rows {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.download-file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.download-file-row .file-label {
  min-width: 8rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--gold-bright);
}

.download-file-row .download-link-input {
  flex: 1;
  min-width: 12rem;
}

.download-zip-row {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #3a2818;
}

.download-files-block + .download-zip-row {
  margin-top: 1rem;
}

.download-block-label.hidden {
  display: none;
}

.btn-gold {
  background: linear-gradient(180deg, #f5d061, #c9981a);
  color: #1a1008;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.65rem 1.25rem;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-gold:hover {
  filter: brightness(1.1);
}

.btn-outline {
  background: transparent;
  color: var(--gold);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 0.65rem 1.25rem;
  border-radius: 6px;
  border: 1px solid var(--gold);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-outline:hover {
  background: rgba(228, 180, 41, 0.1);
}

.copied-feedback {
  margin-top: 0.65rem;
  font-size: 0.82rem;
  color: var(--online);
  font-style: italic;
}

.field-hint code {
  font-family: var(--mono);
  color: var(--gold-bright);
  background: rgba(228, 180, 41, 0.1);
  padding: 0.15rem 0.35rem;
  border-radius: 3px;
}

/* —— Toolbox —— */
.toolbox-page .toolbox-section {
  padding: 1.1rem 1.35rem;
  margin-bottom: 1rem;
}

.toolbox-step {
  margin: 0 0 0.85rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-bright);
}

.toolbox-hint {
  margin: -0.35rem 0 0.85rem;
  max-width: 52rem;
  line-height: 1.55;
}

.toolbox-or-divider {
  margin: 0.85rem 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.toolbox-url-row .grow {
  flex: 1;
  min-width: 14rem;
}

.tools-url-row {
  border-top: 1px solid #3a2818;
  padding-top: 0.65rem;
  margin-top: 0.25rem;
}

.toolbox-args {
  min-width: 10rem;
  max-width: 14rem;
  flex: 0 1 auto;
}

.toolbox-args-inline {
  min-width: 6rem;
  max-width: 10rem;
}

.toolbox-run-out {
  margin: 0;
  max-height: 14rem;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: #e8dcc8;
  background: #0a0604;
  border: 1px solid #4a3520;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
}

.toolbox-upload-row,
.toolbox-run-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.toolbox-file-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  flex: 1;
  min-width: 240px;
  padding: 0.35rem 0.5rem;
  background: #0f0905;
  border: 1px solid #4a3520;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.toolbox-file-picker input[type="file"] {
  position: absolute;
  width: 0.1px;
  height: 0.1px;
  opacity: 0;
  overflow: hidden;
  z-index: -1;
}

.toolbox-file-btn {
  display: inline-block;
  padding: 0.35rem 0.75rem;
  background: #2a2118;
  border: 1px solid #5a4528;
  border-radius: 4px;
  font-size: 0.82rem;
  color: var(--text);
}

.toolbox-file-name {
  font-size: 0.85rem;
  color: var(--muted);
  font-family: var(--mono);
}

.toolbox-select {
  min-width: 200px;
  max-width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid #4a3520;
  background: #0f0905;
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
}

.toolbox-select.grow {
  flex: 1;
  min-width: 280px;
}

.toolbox-file-select {
  flex: 0 1 220px;
}

.toolbox-admin-check {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.toolbox-admin-check input {
  width: auto;
  accent-color: var(--gold);
}

.toolbox-table-wrap {
  border-color: #4a3520;
}

.toolbox-table th:last-child,
.toolbox-table td.toolbox-del-cell {
  width: 88px;
  text-align: right;
}

.toolbox-table .mono-size {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--muted);
}

/* —— Settings —— */
.settings-page {
  width: 100%;
}

.settings-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  width: 100%;
  align-items: start;
}

.settings-span-full {
  grid-column: 1 / -1;
}

.settings-card {
  margin: 0;
  height: 100%;
}

.settings-lead {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
  max-width: 56rem;
}

.settings-section-title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gold-soft);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1.25rem;
  margin-bottom: 1rem;
}

.settings-grid-1 {
  grid-template-columns: 1fr;
  max-width: 28rem;
}

.settings-grid-tg {
  grid-template-columns: 2fr 1fr;
  max-width: none;
}

.settings-grid .span-2 {
  grid-column: 1 / -1;
}

.settings-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.settings-checks input {
  margin-right: 0.4rem;
  accent-color: var(--gold);
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.settings-hint {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.5;
}

.settings-hint-last {
  margin-bottom: 0;
  margin-top: 0.75rem;
}

.settings-block {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: 32rem;
}

.settings-mono {
  font-family: var(--mono);
  font-size: 0.82rem;
  word-break: break-all;
  color: var(--text);
  margin: 0;
  padding: 0.65rem 0.75rem;
  background: var(--bg-deep);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
}

.settings-break {
  opacity: 0.85;
  font-size: 0.75rem;
}

.stealth-subtitle {
  margin: 1.25rem 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.stealth-subtitle:first-of-type {
  margin-top: 0.5rem;
}

.stealth-status-line {
  margin-top: 0.25rem;
  color: var(--gold-soft);
}

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

.stealth-interval-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-width: none;
}

.stealth-toggles {
  margin-top: 0.25rem;
}

.input-mono {
  font-family: var(--mono);
  font-size: 0.82rem;
}

.field input.ste-valid {
  border-color: rgba(72, 187, 120, 0.65);
}

.field input.ste-invalid {
  border-color: rgba(245, 101, 101, 0.75);
}

@media (max-width: 960px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }
  .settings-grid-tg {
    grid-template-columns: 1fr;
  }
  .stealth-wallet-grid,
  .stealth-interval-grid {
    grid-template-columns: 1fr;
  }
}

.files-modal {
  width: min(960px, 96vw);
  max-height: 90vh;
}

.files-modal-pro {
  border-color: rgba(255, 255, 255, 0.08);
}

.files-toolbar-pro {
  background: rgba(0, 0, 0, 0.2);
}

.files-live-toggle {
  font-size: 0.82rem;
}

.files-transfer-progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.files-transfer-progress:not(.hidden) {
  display: block;
}

.files-transfer-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  transition: width 0.15s ease-out;
}

.files-sort-btn {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  opacity: 0.85;
}

.files-sort-btn:hover {
  opacity: 1;
  color: var(--gold);
}

.files-sort-ind {
  font-size: 0.65rem;
  color: var(--gold);
  min-width: 0.75rem;
}

.files-actions-col {
  width: 1%;
  white-space: nowrap;
}

.files-table .fs-name-cell {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
}

.files-table .fs-entry-icon {
  flex-shrink: 0;
  width: 1.15rem;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1;
  opacity: 0.92;
}

.files-table tr.fs-row-new td {
  animation: fs-row-highlight 1.2s ease-out;
}

@keyframes fs-row-highlight {
  from {
    background: rgba(125, 255, 178, 0.12);
  }
  to {
    background: transparent;
  }
}

.files-status.live {
  color: var(--gold);
}

.files-toolbar {
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
}

.files-status {
  margin-left: auto;
  flex: 1 1 8rem;
  text-align: right;
}

.files-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.35rem;
  padding: 0.35rem 0.75rem 0.65rem;
  font-size: 0.82rem;
  font-family: var(--mono);
  color: var(--muted);
  border-bottom: 1px solid var(--border-soft);
}

.files-breadcrumb button {
  background: none;
  border: none;
  color: var(--gold);
  cursor: pointer;
  padding: 0.1rem 0.25rem;
  font: inherit;
}

.files-breadcrumb button:hover {
  text-decoration: underline;
}

.files-breadcrumb .crumb-sep {
  opacity: 0.5;
  user-select: none;
}

.files-table-wrap {
  overflow: auto;
  max-height: min(52vh, 520px);
  padding: 0 0.5rem 0.75rem;
}

.files-table td:first-child {
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.files-table .fs-dir-name {
  font-weight: 600;
  color: var(--text);
}

.files-table .fs-file-name {
  color: var(--text);
}

.files-upload-picker {
  margin: 0;
}

.files-filter {
  min-width: 10rem;
  max-width: 14rem;
  flex: 1 1 10rem;
}

.files-table tr.fs-row-nav {
  cursor: pointer;
}

.files-table tr.fs-row-nav:hover td {
  background: rgba(255, 255, 255, 0.04);
}

.files-table tr.fs-row-up td {
  color: var(--muted);
  font-style: italic;
}

.files-table tr.fs-row-hidden {
  display: none;
}
