/* ── Config Tab Layout Grid ── */
.config-layout-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  align-items: start;
}
.config-main-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.config-side-col {
  position: sticky;
  top: 70px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

@media (max-width: 1100px) {
  .config-layout-grid {
    grid-template-columns: 1fr;
  }
  .config-side-col {
    position: static;
  }
}

/* ── Config & Control: Sections & Subsections ── */
.builder-sec {
  padding: 12px 14px;
  border-bottom: 1px solid var(--brd);
}
.builder-sec:last-child {
  border-bottom: none;
}
.builder-title {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Compact Input Groups ── */
.compact-input-group {
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--brd);
  border-radius: var(--rs);
  overflow: hidden;
  transition: border-color 0.15s;
}
.compact-input-group:focus-within {
  border-color: var(--blue);
}
.compact-input-group input, 
.compact-input-group select {
  flex: 1;
  border: none !important;
  background: transparent !important;
  padding: 6px 10px;
  color: var(--txt);
  font-size: 11px;
  outline: none;
  font-family: inherit;
}
.compact-input-group .btn-get {
  background: rgba(255, 255, 255, 0.04);
  border: none;
  border-left: 1px solid var(--brd);
  color: var(--txt2);
  cursor: pointer;
  padding: 6px 10px;
  font-size: 10px;
  font-weight: 500;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
  transition: all 0.15s;
}
.compact-input-group .btn-get:hover {
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
}
.compact-input-group .btn-set {
  background: rgba(56, 189, 248, 0.12);
  color: var(--blue);
  border: none;
  border-left: 1px solid var(--brd);
  cursor: pointer;
  padding: 6px 12px;
  font-size: 10px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  transition: all 0.15s;
}
.compact-input-group .btn-set:hover {
  background: var(--blue);
  color: #000;
}
.compact-input-group .btn-sm-action:hover {
  background: rgba(56, 189, 248, 0.2) !important;
  color: #fff !important;
}

/* ── Master MAC Smart Proposal & Status Tag ── */
.mac-match-tag {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(52, 211, 153, 0.12);
  color: var(--green);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  margin-left: 6px;
  vertical-align: middle;
  letter-spacing: 0.2px;
}
.mac-proposal-box {
  margin-top: 8px;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.08), rgba(34, 211, 238, 0.03));
  border: 1px solid rgba(56, 189, 248, 0.25);
  border-radius: var(--rs);
  padding: 8px 10px;
  animation: fadeInProposal 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes fadeInProposal {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.mac-proposal-content {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mac-proposal-header {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 11px;
}
.mac-proposal-icon {
  font-size: 13px;
}
.mac-proposal-label {
  color: var(--txt2);
  font-weight: 500;
}
.mac-proposal-val {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.12);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(34, 211, 238, 0.2);
  letter-spacing: 0.5px;
}
.mac-proposal-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
}
.btn-proposal-apply {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.2), rgba(52, 211, 153, 0.2));
  color: var(--blue);
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: var(--rs);
  padding: 4px 10px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.btn-proposal-apply:hover {
  background: var(--blue);
  color: #000;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.35);
}
.btn-proposal-fill {
  background: rgba(255, 255, 255, 0.05);
  color: var(--txt2);
  border: 1px solid var(--brd);
  border-radius: var(--rs);
  padding: 4px 8px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.btn-proposal-fill:hover {
  color: var(--txt);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ── Keypad Matrix 3x3 Styles ── */
.keyboard-interactive-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 180px;
  margin: 10px auto;
}
.keypad-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--brd);
  border-radius: var(--rs);
  color: var(--txt);
  font-size: 16px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}
.keypad-btn:hover {
  border-color: var(--blue);
  background: rgba(56, 189, 248, 0.08);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.keypad-btn:active {
  transform: scale(0.95);
}
.keypad-btn.active {
  background: linear-gradient(135deg, rgba(52, 211, 153, 0.25), rgba(34, 211, 238, 0.2));
  border-color: var(--green);
  color: #fff;
  box-shadow: 0 0 16px rgba(52, 211, 153, 0.35);
  font-weight: 800;
}

/* ── Settings Archive & Backup Styles ── */
.archive-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--brd);
}
.archive-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 2px;
}
.archive-card {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--brd);
  border-radius: var(--rs);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: all 0.2s ease;
}
.archive-card:hover {
  border-color: var(--brd-h);
  background: rgba(0, 0, 0, 0.35);
}
.archive-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.archive-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.archive-card-label {
  font-weight: 600;
  font-size: 12px;
  color: var(--blue);
}
.archive-card-meta {
  font-size: 10px;
  color: var(--txt3);
  font-family: 'JetBrains Mono', monospace;
}
.archive-card-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}
.param-pill {
  font-size: 9px;
  font-family: 'JetBrains Mono', monospace;
  padding: 1px 5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  color: var(--txt2);
}
.archive-card-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ── Empty State Notice ── */
.config-empty-notice {
  padding: 24px;
  text-align: center;
  background: rgba(0, 0, 0, 0.15);
  border: 1px dashed var(--brd);
  border-radius: var(--r);
  color: var(--txt3);
  font-size: 12px;
  margin-top: 10px;
}

/* ── Searchable Target Dropdown (Combobox) ── */
.custom-target-select-wrap {
  position: relative;
  flex: 1;
  min-width: min(240px, 100%);
}

.custom-target-btn {
  width: 100%;
  height: 32px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid var(--brd);
  border-radius: var(--rs);
  color: var(--txt);
  font-family: inherit;
  font-size: 11px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
}

.custom-target-btn:hover {
  border-color: var(--blue);
  background: rgba(56, 189, 248, 0.06);
}

.custom-target-btn.open {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
  background: rgba(17, 24, 39, 0.95);
}

.custom-target-display {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.custom-target-display .target-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.custom-target-display .target-status-dot.online {
  background: var(--green);
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.6);
}

.custom-target-display .target-status-dot.offline {
  background: var(--txt3);
}

.custom-target-display .target-name {
  font-weight: 600;
  color: var(--txt);
  font-size: 12px;
}

.custom-target-display .target-mac-badge {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid rgba(34, 211, 238, 0.2);
}

.custom-target-btn .target-arrow {
  font-size: 9px;
  color: var(--txt3);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.custom-target-btn.open .target-arrow {
  transform: rotate(180deg);
  color: var(--blue);
}

.custom-target-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: #111827;
  border: 1px solid var(--brd-h);
  border-radius: var(--r);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(16px);
  z-index: 2500;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: targetMenuFadeIn 0.15s ease-out;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
}

.custom-target-menu.drop-up {
  top: auto;
  bottom: calc(100% + 4px);
  box-shadow: 0 -16px 36px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
  animation: targetMenuFadeInUp 0.15s ease-out;
}

@keyframes targetMenuFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes targetMenuFadeInUp {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.target-search-wrap {
  padding: 8px;
  border-bottom: 1px solid var(--brd);
  background: rgba(0, 0, 0, 0.3);
}

.target-search-input {
  width: 100%;
  height: 30px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--brd);
  border-radius: var(--rs);
  color: var(--txt);
  font-size: 11px;
  font-family: inherit;
  padding: 0 10px;
  outline: none;
  box-sizing: border-box;
  transition: all 0.15s;
}

.target-search-input:focus {
  border-color: var(--blue);
  background: rgba(56, 189, 248, 0.08);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

.target-options-list {
  max-height: min(260px, calc(100vh - 140px));
  max-height: min(260px, calc(100dvh - 140px));
  overflow-y: auto;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.target-option-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-radius: var(--rs);
  cursor: pointer;
  transition: all 0.12s;
  user-select: none;
}

.target-option-item:hover {
  background: rgba(56, 189, 248, 0.12);
}

.target-option-item.selected {
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.target-opt-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  overflow: hidden;
}

.target-opt-role {
  font-size: 12px;
  font-weight: 600;
  color: var(--txt);
}

.target-option-item.selected .target-opt-role {
  color: var(--blue);
}

.target-opt-mac {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--txt2);
}

.target-opt-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.target-opt-check {
  color: var(--blue);
  font-size: 12px;
  font-weight: bold;
}

.target-empty-search {
  padding: 16px;
  text-align: center;
  font-size: 11px;
  color: var(--txt3);
}
