/* ─── CPS-specific styles ─────────────────────────────────────────────────── */
/* Imports and extends the root CSS variables from ../style.css */

/* ── Layout ──────────────────────────────────────────────────────────────── */

.cps-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 0px); /* adjusted via JS for header+nav height */
  overflow: hidden;
}

main.cps-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: none;
  padding: 0;
  margin: 0;
}

/* ── Warning banner ───────────────────────────────────────────────────────── */

.warn-banner {
  background: #4a3200;
  border-bottom: 1px solid #7a5500;
  color: #ffd666;
  padding: 8px 20px;
  font-size: 0.82rem;
  flex-shrink: 0;
}

/* ── Info bar ─────────────────────────────────────────────────────────────── */

.info-bar {
  background: #192235;
  border-bottom: 1px solid var(--border);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.info-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

.tab-exp {
  color: #fbbf24;
  font-size: 0.68rem;
  font-weight: 700;
  margin-left: 6px;
  text-transform: uppercase;
}

.info-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
}

.info-value.placeholder {
  color: var(--locked-text);
  font-style: italic;
  font-weight: 400;
  font-family: inherit;
}

.info-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}

.info-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

/* ── Tab bar ──────────────────────────────────────────────────────────────── */

.tab-bar {
  background: #141e2e;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  padding: 0 20px;
  gap: 4px;
  flex-shrink: 0;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 10px 14px 8px;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}

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

.tab-btn.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 600;
}

.tab-count {
  background: var(--blue-tint);
  color: #93c5fd;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  min-width: 22px;
  text-align: center;
  line-height: 1.6;
}

.tab-btn.active .tab-count {
  background: var(--blue);
  color: #fff;
}

/* ── Table area ───────────────────────────────────────────────────────────── */

.table-area {
  flex: 1;
  overflow: auto;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

table.cps-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

table.cps-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

table.cps-table th {
  background: #141e2e;
  border-bottom: 2px solid var(--border);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 8px 12px;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

table.cps-table th:first-child { padding-left: 20px; }
table.cps-table td:first-child { padding-left: 20px; }
table.cps-table th:last-child  { padding-right: 20px; }
table.cps-table td:last-child  { padding-right: 20px; }

table.cps-table td {
  border-bottom: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  vertical-align: middle;
  white-space: nowrap;
}

table.cps-table tbody tr:hover td {
  background: rgba(59,130,246,.06);
}

.col-num {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  width: 3em;
}

.col-mono {
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
  font-size: 0.8rem;
}

.col-name {
  font-weight: 600;
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Mode / type badges ───────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  text-transform: uppercase;
}

.badge-dmr {
  background: rgba(59,130,246,.18);
  color: #93c5fd;
}

.badge-fm {
  background: rgba(34,197,94,.15);
  color: #86efac;
}

.badge-group {
  background: rgba(59,130,246,.15);
  color: #93c5fd;
}

.badge-private {
  background: rgba(251,191,36,.12);
  color: #fde68a;
}

.badge-all {
  background: rgba(248,113,113,.12);
  color: #fca5a5;
}

.badge-ts {
  background: rgba(139,92,246,.15);
  color: #c4b5fd;
  font-size: 0.65rem;
}

.badge-rxonly {
  background: rgba(248,113,113,.12);
  color: #fca5a5;
}

/* ── CSS tone ─────────────────────────────────────────────────────────────── */

.css-tone {
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
  font-size: 0.78rem;
  color: #a5f3fc;
}

/* ── Zone channel pills ───────────────────────────────────────────────────── */

.zone-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 400px;
}

.ch-pill {
  background: #1e3a5f;
  border: 1px solid #2d5a8e;
  border-radius: 4px;
  color: #93c5fd;
  font-size: 0.7rem;
  padding: 1px 6px;
  white-space: nowrap;
}

/* ── Empty state ──────────────────────────────────────────────────────────── */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 40px 20px;
  text-align: center;
}

.empty-options {
  align-items: stretch;
  display: flex;
  gap: 0;
  max-width: 780px;
  width: 100%;
}

.empty-divider {
  align-items: center;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  justify-content: center;
  width: 44px;
}

.empty-divider::before,
.empty-divider::after {
  background: var(--border);
  content: '';
  flex: 1;
  width: 1px;
}

.empty-divider span {
  color: var(--locked-text);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  padding: 8px 0;
  text-transform: uppercase;
}

.empty-new-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  flex: 1;
  padding: 48px 40px;
  text-align: center;
  transition: border-color .2s, background .2s;
}

.empty-new-card:hover {
  background: rgba(59,130,246,.04);
  border-color: var(--blue);
}

@media (max-width: 640px) {
  .empty-options { flex-direction: column; }
  .empty-divider { flex-direction: row; height: 40px; width: 100%; }
  .empty-divider::before,
  .empty-divider::after { height: 1px; width: auto; }
}

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  flex: 1;
  padding: 48px 40px;
  transition: border-color .2s, background .2s;
  cursor: pointer;
}

.drop-zone.dragover {
  border-color: var(--blue);
  background: rgba(59,130,246,.06);
}

.drop-zone-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  opacity: .6;
}

.drop-zone h2,
.empty-new-card h2 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.drop-zone p,
.empty-new-card p {
  color: var(--muted);
  font-size: 0.875rem;
  margin-bottom: 20px;
}

.drop-zone .file-types,
.empty-new-card .file-types {
  color: var(--locked-text);
  font-size: 0.78rem;
  margin-top: 12px;
}

/* ── Buttons (CPS variants) ───────────────────────────────────────────────── */

.btn-sm {
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity .15s, background .15s;
}

.btn-sm:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.btn-sm-primary {
  background: var(--blue);
  color: #fff;
}
.btn-sm-primary:hover:not(:disabled) { background: var(--blue-dark); }

.btn-sm-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-sm-outline:hover:not(:disabled) { background: rgba(255,255,255,.05); }

.btn-sm-danger {
  background: transparent;
  border: 1px solid rgba(248,113,113,.3);
  color: #f87171;
}
.btn-sm-danger:hover:not(:disabled) { background: rgba(248,113,113,.1); }

/* ── Search / toolbar ─────────────────────────────────────────────────────── */

.table-toolbar {
  background: #141e2e;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  flex-shrink: 0;
}

.search-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.8rem;
  padding: 5px 10px;
  width: 200px;
}

.search-input::placeholder { color: var(--locked-text); }
.search-input:focus { outline: none; border-color: var(--blue); }

.row-count {
  color: var(--muted);
  font-size: 0.78rem;
  margin-left: auto;
}

/* ── Filename in info bar ─────────────────────────────────────────────────── */

.filename-chip {
  background: var(--blue-tint);
  border: 1px solid #2d5a8e;
  border-radius: 5px;
  color: #93c5fd;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
}

/* ── Info bar inline editing ──────────────────────────────────────────────── */

.info-value.editable {
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 4px;
  margin: -1px -4px;
  transition: background .15s;
}
.info-value.editable:hover { background: rgba(255,255,255,.07); }

.info-inline-edit {
  background: var(--bg);
  border: 1px solid var(--blue);
  border-radius: 5px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
  outline: none;
  padding: 1px 6px;
  width: 120px;
}

/* ── Edit modal ───────────────────────────────────────────────────────────── */

.edit-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  color: var(--text);
  max-height: 90vh;
  max-width: 500px;
  padding: 0;
  width: calc(100vw - 32px);
}

.edit-modal[open] {
  display: flex;
  flex-direction: column;
}

.edit-modal::backdrop { background: rgba(0,0,0,.6); }

.modal-header {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-shrink: 0;
  gap: 12px;
  padding: 16px 20px;
}

.modal-header h3 {
  flex: 1;
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  border-radius: 5px;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.25rem;
  line-height: 1;
  padding: 3px 7px;
}
.modal-close:hover { background: rgba(255,255,255,.07); color: var(--text); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.modal-footer {
  align-items: center;
  border-top: 1px solid var(--border);
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  padding: 14px 20px;
}

.modal-spacer { flex: 1; }

/* ── Edit forms ───────────────────────────────────────────────────────────── */

.edit-form { display: flex; flex-direction: column; gap: 14px; }
.edit-form.hidden { display: none; }

.field-group {
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

.field-group-title {
  background: #192235;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 6px 12px;
  text-transform: uppercase;
}

.field-row {
  align-items: center;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  padding: 8px 12px;
}

.field-row:first-of-type { border-top: none; }

.field-label {
  color: var(--muted);
  flex-shrink: 0;
  font-size: 0.8rem;
  min-width: 130px;
}

.field-input, .field-select {
  background: transparent;
  border: none;
  border-radius: 0;
  color: var(--text);
  flex: 1;
  font-size: 0.875rem;
  min-width: 0;
  outline: none;
  padding: 0;
}

.field-input:focus, .field-select:focus { color: #fff; }
.field-select option { background: var(--surface); }

.field-input[type="number"] { -moz-appearance: textfield; }
.field-input[type="number"]::-webkit-inner-spin-button { display: none; }

.checkbox-row {
  align-items: center;
  display: flex;
  gap: 8px;
  padding: 8px 12px;
}

.checkbox-row input[type="checkbox"] {
  accent-color: var(--blue);
  height: 15px;
  width: 15px;
}

.checkbox-row label {
  color: var(--text);
  cursor: pointer;
  font-size: 0.875rem;
}

/* ── Zone dual-list editor ────────────────────────────────────────────────── */

.zone-editor {
  align-items: flex-start;
  display: flex;
  gap: 6px;
  width: 100%;
}

.zone-col {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.zone-col-header {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.zone-list {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  height: 190px;
  overflow-y: auto;
}

.zone-list-item {
  cursor: pointer;
  font-size: 0.8rem;
  overflow: hidden;
  padding: 5px 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zone-list-item:hover { background: rgba(59,130,246,.08); }
.zone-list-item.selected { background: var(--blue-tint); color: #93c5fd; }

.zone-btns {
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
  padding-top: 22px;
}

.zone-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 5px 8px;
}
.zone-btn:hover { background: rgba(255,255,255,.06); }
.zone-btn:disabled { opacity: .3; cursor: not-allowed; }

/* ── Table action column ──────────────────────────────────────────────────── */

.col-actions { width: 60px; text-align: right; }

.btn-row-edit {
  background: none;
  border: none;
  border-radius: 4px;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 3px 6px;
  transition: color .15s, background .15s;
}
.btn-row-edit:hover { background: rgba(59,130,246,.1); color: #93c5fd; }

.btn-row-delete {
  background: none;
  border: none;
  border-radius: 4px;
  color: var(--locked-text);
  cursor: pointer;
  font-size: 0.75rem;
  padding: 3px 6px;
  transition: color .15s, background .15s;
}
.btn-row-delete:hover { background: rgba(248,113,113,.1); color: #f87171; }

/* ── Tone selectors ───────────────────────────────────────────────────────── */

.tone-selector {
  align-items: center;
  display: flex;
  flex: 1;
  gap: 6px;
  min-width: 0;
}

.tone-selector > .field-select { flex: 0 0 80px; }
.tone-selector > .field-input  { flex: 1; min-width: 50px; }

.tone-dcs {
  align-items: center;
  display: flex;
  flex: 1;
  gap: 5px;
  min-width: 0;
}

.tone-dcs .field-input  { flex: 0 0 52px; }
.tone-dcs .field-select { flex: 1; }

/* ── New Codeplug Wizard ──────────────────────────────────────────────────── */

.wizard-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  color: var(--text);
  max-height: 90vh;
  max-width: 460px;
  padding: 0;
  width: calc(100vw - 32px);
}

.wizard-modal[open] { display: flex; flex-direction: column; }
.wizard-modal::backdrop { background: rgba(0,0,0,.6); }

/* Progress bar */
.wizard-progress {
  align-items: center;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: center;
  padding: 16px 32px;
  gap: 0;
  flex-shrink: 0;
}

.wprog-dot {
  align-items: center;
  background: #243045;
  border-radius: 50%;
  color: var(--muted);
  display: flex;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  height: 26px;
  justify-content: center;
  transition: background .25s, color .25s;
  width: 26px;
}

.wprog-dot.done {
  background: var(--blue-tint);
  color: #93c5fd;
}

.wprog-dot.active {
  background: var(--blue);
  color: #fff;
}

.wprog-line {
  background: var(--border);
  flex: 1;
  height: 2px;
  max-width: 64px;
  transition: background .3s;
}

.wprog-line.done { background: var(--blue); }

/* Step body */
.wizard-body {
  flex: 1;
  overflow-y: auto;
  padding: 28px 28px 16px;
}

.wizard-step { text-align: center; }
.wizard-step.hidden { display: none; }

.wiz-icon {
  font-size: 2.8rem;
  line-height: 1;
  margin-bottom: 16px;
}

.wiz-title {
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0 0 10px;
}

.wiz-hint {
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.6;
  margin-bottom: 20px;
  text-align: left;
}

.wiz-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-sizing: border-box;
  color: var(--text);
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
  font-size: 1.15rem;
  font-weight: 600;
  outline: none;
  padding: 10px 14px;
  text-align: center;
  transition: border-color .15s;
  width: 100%;
}

.wiz-input:focus { border-color: var(--blue); }
.wiz-input[type="number"] { -moz-appearance: textfield; }
.wiz-input[type="number"]::-webkit-inner-spin-button { display: none; }

.wiz-subhint {
  color: var(--locked-text);
  font-size: 0.78rem;
  line-height: 1.7;
  margin-top: 10px;
  text-align: center;
}

.wiz-subhint a { color: #93c5fd; text-decoration: none; }
.wiz-subhint a:hover { color: #bfdbfe; text-decoration: underline; }

.wiz-skip { color: var(--muted) !important; text-decoration: underline; text-underline-offset: 2px; }
.wiz-skip:hover { color: var(--text) !important; }

/* Radio model dropdown */
.wiz-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-sizing: border-box;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  outline: none;
  padding: 10px 14px;
  transition: border-color .15s;
  width: 100%;
}

.wiz-select:focus { border-color: var(--blue); }
.wiz-select option { background: var(--surface); }

/* Sort toolbar group */
.sort-group {
  align-items: center;
  display: flex;
  gap: 4px;
}

.sort-label {
  color: var(--locked-text);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Channel drag-and-drop */
.col-drag {
  cursor: default;
  padding: 0 4px 0 8px !important;
  width: 20px;
}

.drag-handle {
  color: var(--locked-text);
  cursor: grab;
  display: block;
  font-size: 1.1rem;
  line-height: 1;
  padding: 2px 0;
  text-align: center;
  transition: color .15s;
  user-select: none;
}

.drag-handle:active { cursor: grabbing; }
table.cps-table tbody tr:hover .drag-handle { color: var(--muted); }

tr.dragging { opacity: 0.35; }
tr.drag-over td { box-shadow: inset 0 2px 0 var(--blue) !important; }

/* ── Boot Screen & Melody panels ─────────────────────────────────────────── */

.boot-panel,
.melody-panel {
  overflow-y: auto;
  padding: 20px 24px 40px;
}

.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 20px;
  overflow: hidden;
}

.section-card-header {
  background: #192235;
  border-bottom: 1px solid var(--border);
  padding: 9px 16px;
}

.section-card-header h3 {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  margin: 0;
  text-transform: uppercase;
}

.section-card-body { padding: 18px 16px; }

.section-desc {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.65;
  margin-bottom: 16px;
}

.section-desc code {
  background: rgba(255,255,255,.07);
  border-radius: 3px;
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
  font-size: 0.8rem;
  padding: 1px 5px;
}

.inline-warn {
  background: rgba(122, 85, 0, 0.22);
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 8px;
  color: #fcd34d;
  font-size: 0.82rem;
  line-height: 1.55;
  margin-bottom: 14px;
  padding: 10px 12px;
}

/* Boot image */
.boot-upload-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.boot-upload-hint {
  color: var(--locked-text);
  font-size: 0.78rem;
}

.boot-threshold-row {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.boot-threshold-label {
  color: var(--muted);
  flex-shrink: 0;
  font-size: 0.8rem;
  min-width: 110px;
}

.boot-slider {
  accent-color: var(--blue);
  flex: 1;
  max-width: 200px;
}

.boot-threshold-num {
  color: var(--muted);
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
  font-size: 0.8rem;
  min-width: 28px;
  text-align: right;
}

.boot-canvas-wrap {
  display: flex;
  justify-content: center;
  margin: 12px 0 4px;
}

.boot-canvas {
  border: 1px solid var(--border);
  display: block;
  height: 256px;   /* 2× native */
  image-rendering: pixelated;
  width: 320px;    /* 2× native */
}

.boot-canvas-label {
  color: var(--locked-text);
  font-size: 0.72rem;
  margin-top: 6px;
  text-align: center;
}

.boot-action-row,
.section-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 14px;
}

/* Melody editor */
.melody-toolbar {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.melody-textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-sizing: border-box;
  color: var(--text);
  font-family: ui-monospace, 'Cascadia Code', 'SF Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.7;
  outline: none;
  padding: 10px 12px;
  resize: vertical;
  transition: border-color .15s;
  width: 100%;
}

.melody-textarea:focus  { border-color: var(--blue); }
.melody-textarea::placeholder { color: var(--locked-text); font-style: italic; }

.melody-status {
  font-size: 0.78rem;
  margin-top: 6px;
  min-height: 1.2em;
}

.melody-status.ok   { color: #86efac; }
.melody-status.warn { color: #fde68a; }
.melody-status.err  { color: #fca5a5; }

/* Wizard footer */
.wizard-footer {
  align-items: center;
  border-top: 1px solid var(--border);
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  padding: 14px 20px;
}

/* ── Write to Radio button & modal ───────────────────────────────────────── */

.btn-sm-write {
  background: #14532d;
  border: 1px solid #166534;
  color: #86efac;
}
.btn-sm-write:hover:not(:disabled) { background: #166534; }

/* ── Read from Radio button ──────────────────────────────────────────────── */

.btn-sm-read {
  background: #164e63;
  border: 1px solid #0e7490;
  color: #67e8f9;
}
.btn-sm-read:hover:not(:disabled) { background: #155e75; }

/* ── Drop zone action buttons ────────────────────────────────────────────── */

.drop-zone-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.write-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  color: var(--text);
  max-height: 90vh;
  max-width: 480px;
  padding: 0;
  width: calc(100vw - 32px);
}

.write-modal[open] { display: flex; flex-direction: column; }
.write-modal::backdrop { background: rgba(0,0,0,.6); }

.write-dfu-steps {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 12px 16px;
}

.write-dfu-steps ol {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.8;
  margin: 0;
  padding-left: 20px;
}

.write-dfu-steps strong { color: var(--text); }

.write-note {
  background: rgba(234,179,8,.06);
  border: 1px solid rgba(234,179,8,.25);
  border-radius: 6px;
  color: #fde68a;
  font-size: 0.82rem;
  line-height: 1.6;
  margin-bottom: 16px;
  padding: 10px 14px;
}

.write-progress-wrap {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.write-progress-wrap.visible { display: flex; }

.write-progress-bar {
  background: #1e293b;
  border-radius: 4px;
  height: 10px;
  overflow: hidden;
  width: 100%;
}

.write-progress-fill {
  background: var(--blue);
  height: 100%;
  transition: width .2s;
  width: 0%;
}

.write-progress-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
}

.write-status {
  font-size: 0.85rem;
  min-height: 1.3em;
}
.write-status.ok    { color: #86efac; }
.write-status.err   { color: #fca5a5; }
.write-status.muted { color: var(--muted); }

.write-footer {
  align-items: center;
  border-top: 1px solid var(--border);
  display: flex;
  flex-shrink: 0;
  gap: 8px;
  padding: 14px 20px;
}
