* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #0d0d0d;
    --surface: #1a1a1a;
    --surface-2: #242424;
    --border: #333;
    --text: #e0e0e0;
    --text-dim: #888;
    --orange: #ff8c00;
    --orange-dim: #cc7000;
    --green: #4caf50;
    --red: #f44336;
    --blue: #42a5f5;
}

body {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* ── Header ── */
header {
    background: var(--surface);
    border-bottom: 2px solid var(--orange);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

header h1 {
    font-size: 18px;
    font-weight: 600;
    color: var(--orange);
    letter-spacing: 1px;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--red);
}

.status-dot.connected { background: var(--green); }

.shortcut-hint {
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.3px;
}

/* ── Grid layout ── */
.main-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: 1fr;
    gap: 1px;
    height: calc(100vh - 50px);
    background: var(--border);
}

.panel {
    background: var(--surface);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--orange);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.panel-body {
    overflow-y: auto;
    padding: 12px;
}

/* ── Sidebar ── */
.sidebar {
    grid-row: 1 / -1;
}

.connect-section {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.port-select {
    width: 100%;
    padding: 8px;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    margin-bottom: 8px;
}

.quick-commands {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    width: 100%;
}

.btn-primary {
    background: var(--orange);
    color: #000;
}
.btn-primary:hover { background: var(--orange-dim); }

.btn-danger {
    background: var(--red);
    color: #fff;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 12px;
    width: auto;
}

.btn-quick {
    background: var(--surface-2);
    color: var(--text-dim);
    border: 1px solid transparent;
    text-align: left;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.15s;
}

.btn-quick:hover {
    color: var(--text);
    background: var(--border);
}

.btn-quick.active {
    color: var(--orange);
    border-color: var(--orange);
    background: rgba(255, 140, 0, 0.08);
}

.btn-quick.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ── Sidebar Info Output ── */
.sidebar-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-top: 1px solid var(--border);
    overflow: hidden;
    min-height: 0;
}

.sidebar-info-header {
    padding: 8px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--orange);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.sidebar-info-output {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
    font-size: 12px;
    line-height: 1.6;
}

.info-placeholder {
    color: var(--text-dim);
    font-style: italic;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
}

.info-table tr {
    border-bottom: 1px solid var(--border);
}

.info-table td {
    padding: 3px 4px;
    vertical-align: top;
    display: block;
    font-size: 11px;
}

.info-table td:first-child {
    color: var(--text);
    font-weight: 600;
    padding-bottom: 0;
}

.info-table td:last-child {
    color: var(--text-dim);
    word-break: break-all;
    padding-top: 0;
    padding-bottom: 6px;
}

.info-raw {
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-dim);
}

/* ── Tabbed Panel (right side, full height) ── */
.bottom-panel {
    grid-column: 2;
    grid-row: 1;
}

.tab-bar {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.tab {
    padding: 10px 20px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.15s;
}

.tab:hover { color: var(--text); }

.tab.active {
    color: var(--orange);
    border-bottom-color: var(--orange);
}

.tab-actions {
    margin-left: auto;
    padding: 0 12px;
}

.tab-content {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

.tab-content.active {
    display: flex;
}

/* ── Terminal ── */
.terminal-output {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

.terminal-output .cmd { color: var(--orange); }
.terminal-output .resp { color: var(--text-dim); }
.terminal-output .err { color: var(--red); }
.terminal-output .sys { color: var(--blue); font-style: italic; }

.terminal-input {
    display: flex;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.terminal-input span {
    padding: 10px 12px;
    color: var(--orange);
    font-size: 14px;
    font-weight: bold;
    background: var(--surface-2);
}

.terminal-input input {
    flex: 1;
    padding: 10px 12px;
    background: var(--surface-2);
    color: var(--text);
    border: none;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

/* ── Terminal Autocomplete & Search ── */
.autocomplete-hint {
    display: none;
    padding: 4px 12px;
    font-size: 11px;
    color: var(--text-dim);
    background: var(--surface-2);
    border-top: 1px solid var(--border);
}

.autocomplete-hint span {
    margin-right: 8px;
    padding: 1px 6px;
    border-radius: 3px;
}

.autocomplete-hint .autocomplete-active {
    background: var(--orange);
    color: #000;
    font-weight: 600;
}

.terminal-search-overlay {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--surface-2);
    border-top: 1px solid var(--orange);
    font-size: 12px;
}

.search-label {
    color: var(--orange);
    font-weight: 600;
    white-space: nowrap;
}

.search-input {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 3px 8px;
    font-family: inherit;
    font-size: 12px;
    outline: none;
    width: 200px;
}

.search-input:focus {
    border-color: var(--orange);
}

.search-result {
    color: var(--text);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

/* ── File Browser ── */
.files-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.breadcrumb {
    font-size: 12px;
    color: var(--text-dim);
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.breadcrumb a {
    color: var(--orange);
    text-decoration: none;
    cursor: pointer;
}

.file-list {
    list-style: none;
}

.file-list li {
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.file-list li:hover {
    background: var(--surface-2);
}

.file-list .icon {
    width: 18px;
    text-align: center;
    color: var(--orange);
}

.file-list .size {
    margin-left: auto;
    color: var(--text-dim);
    font-size: 11px;
}

.file-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.file-list li:hover .file-actions {
    opacity: 1;
}

/* Push size left when actions appear */
.file-list li:hover .size {
    margin-left: 0;
    margin-right: 8px;
}

.file-action-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-2);
    color: var(--text-dim);
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
    font-family: inherit;
}

.file-action-btn:hover {
    color: #fff;
}

.file-action-delete:hover {
    background: var(--red);
    border-color: var(--red);
}

.file-action-rename:hover {
    background: var(--orange);
    border-color: var(--orange);
    color: #000;
}

.file-action-download:hover {
    background: var(--blue);
    border-color: var(--blue);
}

.upload-zone {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
    margin-top: 12px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--orange);
    color: var(--text);
}

/* ── WiFi Scanner ── */
.wifi-toolbar {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.wifi-connection {
    display: flex;
    align-items: center;
    gap: 6px;
}

.wifi-connection .port-select {
    width: auto;
    min-width: 140px;
    margin-bottom: 0;
}

.wifi-actions {
    display: flex;
    gap: 6px;
}

.wifi-results {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.wifi-results .info-placeholder {
    color: var(--text-dim);
    font-style: italic;
    font-size: 13px;
    text-align: center;
    padding: 40px 20px;
}

.ap-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.ap-table th {
    text-align: left;
    padding: 8px 10px;
    color: var(--orange);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    cursor: pointer;
    user-select: none;
}

.ap-table th:hover {
    color: var(--text);
}

.ap-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
}

.ap-table tr:hover td {
    background: var(--surface-2);
    color: var(--text);
}

.ap-table .ssid { color: var(--text); font-weight: 600; }
.ap-table .bssid { font-size: 11px; }

.rssi-bar {
    display: inline-block;
    height: 8px;
    border-radius: 2px;
    min-width: 4px;
}

.rssi-excellent { background: var(--green); }
.rssi-good { background: #8bc34a; }
.rssi-fair { background: var(--orange); }
.rssi-weak { background: var(--red); }

.scan-status {
    padding: 12px;
    text-align: center;
    color: var(--blue);
    font-style: italic;
    font-size: 13px;
}

.scan-status .spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--orange);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Sub-GHz ── */
.signal-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

.signal-card .signal-protocol {
    color: var(--orange);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}

.signal-card .signal-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 4px 16px;
    font-size: 12px;
}

.signal-card .signal-details .label {
    color: var(--text);
    font-weight: 600;
}

.signal-card .signal-details .value {
    color: var(--text-dim);
    font-family: inherit;
}

.signal-key {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 12px;
    color: var(--green);
    letter-spacing: 1px;
}

.no-signals {
    text-align: center;
    padding: 30px;
    color: var(--text-dim);
    font-size: 13px;
}

/* ── Sub-GHz Saved Signals ── */
.subghz-split {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.subghz-saved-panel {
    width: 300px;
    min-width: 280px;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.subghz-saved-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

/* ── NFC/RFID ── */
.nfcrfid-split {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.nfcrfid-saved-panel {
    width: 300px;
    min-width: 280px;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.nfcrfid-saved-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

.tag-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-left: 3px solid var(--blue);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

.tag-card .tag-type {
    color: var(--blue);
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}

.tag-card .tag-uid {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 13px;
    color: var(--green);
    letter-spacing: 2px;
    display: inline-block;
    margin-bottom: 6px;
}

.tag-card .tag-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 4px 16px;
    font-size: 12px;
}

.tag-card .tag-details .label { color: var(--text); font-weight: 600; }
.tag-card .tag-details .value { color: var(--text-dim); }

/* ── Remote Control (D-pad) ── */
.remote-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.dpad-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.dpad-grid {
    display: grid;
    grid-template-columns: 64px 64px 64px;
    grid-template-rows: 64px 64px 64px;
    gap: 4px;
}

.dpad-btn {
    width: 64px;
    height: 64px;
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    color: var(--text);
    border: 2px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.1s;
    user-select: none;
    -webkit-user-select: none;
}

.dpad-btn:hover {
    background: var(--border);
    border-color: var(--orange);
}

.dpad-btn:active,
.dpad-btn.pressed {
    background: var(--orange);
    color: #000;
    border-color: var(--orange);
    transform: scale(0.95);
}

.dpad-ok {
    background: var(--orange-dim);
    color: #000;
    font-size: 14px;
    font-weight: 800;
    border-color: var(--orange);
}

.dpad-ok:hover {
    background: var(--orange);
}

.dpad-back {
    width: 140px;
    height: 40px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
}

.dpad-spacer {
    width: 64px;
    height: 64px;
}

.remote-log {
    margin-top: 16px;
    font-size: 11px;
    color: var(--text-dim);
    max-height: 120px;
    overflow-y: auto;
    width: 100%;
    max-width: 300px;
    text-align: center;
}

.remote-log div {
    padding: 2px 0;
}

/* ── Screen Mirror ── */
.screen-mirror-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    position: relative;
    overflow: hidden;
    background: #000;
}

#screenCanvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: none;
    background: #000;
    max-width: 100%;
    max-height: 100%;
}

.screen-placeholder {
    color: var(--text-dim);
    font-style: italic;
    font-size: 13px;
    text-align: center;
    padding: 40px 20px;
}

/* ── IR Universal Buttons ── */
.ir-universal-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.ir-universal-buttons .btn {
    width: auto;
    padding: 4px 8px;
    font-size: 11px;
}

/* ── IR Saved Signals ── */
.ir-split {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.ir-saved-panel {
    width: 300px;
    min-width: 280px;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.ir-saved-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px;
}

.saved-signal {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border-radius: 4px;
    margin-bottom: 2px;
}

.saved-signal:hover {
    background: var(--surface-2);
}

.saved-signal-play {
    width: 28px !important;
    height: 28px;
    padding: 0 !important;
    font-size: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.saved-signal-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.saved-signal-name {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-signal-detail {
    display: block;
    font-size: 10px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.saved-signal .btn-danger {
    width: 22px !important;
    height: 22px;
    padding: 0 !important;
    font-size: 14px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
}

.saved-signal:hover .btn-danger {
    opacity: 1;
}

/* ── IRDB Modal ── */
.irdb-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
}

.irdb-modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.irdb-header {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--orange);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.irdb-breadcrumb {
    padding: 8px 16px;
    font-size: 12px;
    color: var(--text-dim);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.irdb-breadcrumb a {
    color: var(--orange);
    text-decoration: none;
    cursor: pointer;
}

.irdb-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.irdb-item {
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
}

.irdb-item:hover {
    background: var(--surface-2);
}

.irdb-item .icon {
    color: var(--orange);
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.irdb-item .size {
    margin-left: auto;
    color: var(--text-dim);
    font-size: 11px;
}

.irdb-signal {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
}

.irdb-signal:hover {
    background: var(--surface-2);
}

.irdb-signal input[type="checkbox"] {
    accent-color: var(--orange);
}

.irdb-signal .sig-name {
    font-weight: 600;
    color: var(--text);
    min-width: 100px;
}

.irdb-signal .sig-detail {
    color: var(--text-dim);
    font-size: 11px;
}

.irdb-signal .sig-raw-tag {
    color: var(--text-dim);
    font-size: 10px;
    font-style: italic;
}

.irdb-actions {
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* ── IRDB Search ── */
.irdb-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.irdb-search input {
    flex: 1;
    padding: 8px 10px;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

.irdb-search input:focus {
    border-color: var(--orange);
}

.irdb-search-status {
    font-size: 11px;
    color: var(--text-dim);
    white-space: nowrap;
}

.irdb-search-path {
    font-size: 11px;
    color: var(--text-dim);
    margin-left: auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── IR Remote Visual Layout ── */
.ir-remote {
    background: linear-gradient(180deg, #161616 0%, #0e0e0e 100%);
    border-radius: 20px 20px 36px 36px;
    padding: 16px 12px 24px;
    margin: 8px;
    border: 2px solid #2a2a2a;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.ir-rmt-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-bottom: 8px;
}

.rmt-spacer { flex: 1; }

.ir-rmt-btn {
    min-width: 50px;
    height: 32px;
    padding: 0 6px;
    font-family: inherit;
    font-size: 10px;
    font-weight: 700;
    border: 1px solid #333;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.12s;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    letter-spacing: 0.5px;
    user-select: none;
    -webkit-user-select: none;
}

.ir-rmt-btn.mapped {
    background: var(--surface-2);
    color: var(--text);
}

.ir-rmt-btn.mapped:hover {
    background: var(--orange);
    color: #000;
    border-color: var(--orange);
}

.ir-rmt-btn.mapped:active {
    transform: scale(0.93);
}

.ir-rmt-btn.empty {
    background: #0a0a0a;
    color: #222;
    border-color: #191919;
    cursor: default;
}

/* Power button */
.ir-rmt-btn.rmt-power.mapped {
    background: #2a1010;
    border-color: #442020;
    color: var(--red);
}

.ir-rmt-btn.rmt-power.mapped:hover {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}

/* OK button */
.ir-rmt-btn.rmt-ok {
    border-radius: 50%;
    width: 44px;
    height: 44px;
    min-width: 44px;
}

.ir-rmt-btn.rmt-ok.mapped {
    background: var(--orange-dim);
    color: #000;
    border-color: var(--orange);
    font-weight: 800;
}

.ir-rmt-btn.rmt-ok.mapped:hover {
    background: var(--orange);
}

/* Arrow buttons */
.ir-rmt-btn.rmt-arrow {
    min-width: 36px;
    font-size: 14px;
}

/* Number pad grid */
.ir-rmt-numpad {
    display: grid;
    grid-template-columns: repeat(3, 50px);
    gap: 4px;
    justify-content: center;
    margin-bottom: 12px;
}

/* Navigation area: Vol | D-pad | Ch */
.ir-rmt-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    margin-bottom: 12px;
}

.ir-rmt-strip {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ir-rmt-dpad {
    display: grid;
    grid-template-columns: 36px 44px 36px;
    grid-template-rows: 32px 44px 32px;
    gap: 2px;
    justify-content: center;
}

.ir-rmt-dpad .ir-rmt-btn {
    min-width: unset;
    width: 100%;
    height: 100%;
}

/* Delete overlay on hover */
.rmt-delete {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 14px;
    height: 14px;
    background: var(--red);
    color: #fff;
    font-size: 9px;
    font-weight: 400;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 2;
    border: 1px solid #000;
}

.ir-rmt-btn:hover .rmt-delete {
    display: flex;
}

/* Overflow signals below remote */
.ir-rmt-overflow {
    margin: 0 8px;
    border-top: 1px solid #2a2a2a;
    padding-top: 8px;
}

.ir-rmt-overflow-title {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #555;
    text-align: center;
    margin-bottom: 6px;
}

/* Section divider line */
.ir-rmt-divider {
    border-top: 1px solid #222;
    margin: 4px 12px 8px;
}

/* ── Tab bar overflow (8 tabs) ── */
.tab-bar {
    overflow-x: auto;
    white-space: nowrap;
}

.tab-bar::-webkit-scrollbar {
    height: 3px;
}

/* ── Library Toolbar (Export/Import) ── */
.library-toolbar {
    display: flex;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.library-toolbar .btn {
    background: var(--surface-2);
    color: var(--text-dim);
    border: 1px solid var(--border);
    font-size: 11px;
    padding: 3px 10px;
}

.library-toolbar .btn:hover {
    color: var(--text);
    border-color: var(--orange);
}

/* ── Toast Notifications ── */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
    pointer-events: none;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--blue);
    border-radius: 6px;
    padding: 10px 16px;
    font-size: 12px;
    color: var(--text);
    min-width: 220px;
    max-width: 360px;
    pointer-events: auto;
    animation: toastIn 0.25s ease-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.toast.toast-out {
    animation: toastOut 0.2s ease-in forwards;
}

.toast-success { border-left-color: var(--green); }
.toast-error { border-left-color: var(--red); }
.toast-info { border-left-color: var(--blue); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(40px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(40px); }
}

/* ── Modal Overlay (confirm/prompt) ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-dialog {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
    min-width: 320px;
    max-width: 440px;
}

.modal-dialog .modal-message {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 16px;
    line-height: 1.6;
    white-space: pre-wrap;
}

.modal-dialog .modal-input {
    width: 100%;
    padding: 8px 10px;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 13px;
    margin-bottom: 16px;
    outline: none;
}

.modal-dialog .modal-input:focus {
    border-color: var(--orange);
}

.modal-dialog .modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.modal-dialog .modal-btn {
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: var(--surface-2);
    color: var(--text);
}

.modal-dialog .modal-btn:hover {
    background: var(--border);
}

.modal-dialog .modal-btn-primary {
    background: var(--orange);
    color: #000;
    border-color: var(--orange);
}

.modal-dialog .modal-btn-primary:hover {
    background: var(--orange-dim);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #555; }
