/* ===========================================================================
   SDRWeb — Dark theme stylesheet
   Radio monitoring / scanner aesthetic
   =========================================================================== */

/* ---------------------------------------------------------------------------
   Reset & Base
   --------------------------------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---------------------------------------------------------------------------
   Login Page
   --------------------------------------------------------------------------- */
.login-body {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-card {
    background: #16213e;
    border: 1px solid #2a2a4a;
    border-radius: 8px;
    padding: 2.5rem 2rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: #00d4ff;
    margin: 0 0 0.25rem 0;
    letter-spacing: 2px;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

.login-subtitle {
    color: #8888aa;
    font-size: 0.85rem;
    margin: 0;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    color: #8888aa;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-group input {
    width: 100%;
    padding: 0.7rem 0.75rem;
    background: #0f0f23;
    border: 1px solid #2a2a4a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #00d4ff;
}

.error-message {
    background: rgba(255, 60, 60, 0.15);
    border: 1px solid #ff3c3c;
    color: #ff6b6b;
    padding: 0.6rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* ---------------------------------------------------------------------------
   Buttons
   --------------------------------------------------------------------------- */
.btn {
    cursor: pointer;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.7rem 1.25rem;
    transition: background-color 0.2s, opacity 0.2s;
}

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

.btn-primary {
    width: 100%;
    background: #00d4ff;
    color: #0f0f23;
}

.btn-primary:hover:not(:disabled) {
    background: #00b8e6;
}

.btn-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-outline {
    background: transparent;
    border: 1px solid #555;
    color: #aaa;
}

.btn-outline:hover {
    border-color: #00d4ff;
    color: #00d4ff;
}

/* ---------------------------------------------------------------------------
   Top Bar
   --------------------------------------------------------------------------- */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: #0f0f23;
    border-bottom: 1px solid #2a2a4a;
    flex-shrink: 0;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #00d4ff;
    margin: 0;
    letter-spacing: 2px;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

.user-info {
    font-size: 0.85rem;
    color: #aaa;
}

.user-name {
    color: #e0e0e0;
}

.user-role {
    color: #666;
    margin-left: 0.25rem;
    font-size: 0.75rem;
}

/* ---------------------------------------------------------------------------
   Connection Status
   --------------------------------------------------------------------------- */
.connection-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-connected .status-dot {
    background: #00e676;
    box-shadow: 0 0 6px rgba(0, 230, 118, 0.6);
}

.status-connected .status-text {
    color: #00e676;
}

.status-connecting .status-dot {
    background: #ffc107;
    box-shadow: 0 0 6px rgba(255, 193, 7, 0.6);
    animation: pulse 1s infinite;
}

.status-connecting .status-text {
    color: #ffc107;
}

.status-disconnected .status-dot {
    background: #ff3c3c;
    box-shadow: 0 0 6px rgba(255, 60, 60, 0.6);
}

.status-disconnected .status-text {
    color: #ff3c3c;
}

/* TRS Data Health indicator */
.trs-health {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 1rem;
}

.trs-health-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    background: #556677;
}

.trs-health-text {
    font-weight: 600;
}

.trs-health.health-good .trs-health-dot {
    background: #00e676;
    box-shadow: 0 0 6px rgba(0, 230, 118, 0.6);
}
.trs-health.health-good .trs-health-label,
.trs-health.health-good .trs-health-text { color: #00e676; }

.trs-health.health-fair .trs-health-dot {
    background: #ffc107;
    box-shadow: 0 0 6px rgba(255, 193, 7, 0.6);
}
.trs-health.health-fair .trs-health-label,
.trs-health.health-fair .trs-health-text { color: #ffc107; }

.trs-health.health-poor .trs-health-dot {
    background: #ff6b6b;
    box-shadow: 0 0 6px rgba(255, 107, 107, 0.6);
}
.trs-health.health-poor .trs-health-label,
.trs-health.health-poor .trs-health-text { color: #ff6b6b; }

.trs-health.health-none .trs-health-dot {
    background: #556677;
}
.trs-health.health-none .trs-health-label,
.trs-health.health-none .trs-health-text { color: #556677; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ---------------------------------------------------------------------------
   Tab Bar
   --------------------------------------------------------------------------- */
.tab-bar {
    display: flex;
    background: #12122a;
    border-bottom: 1px solid #2a2a4a;
    padding: 0 0.5rem;
    flex-shrink: 0;
    overflow-x: auto;
}

.tab {
    padding: 0.6rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: #777;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.tab:hover {
    color: #bbb;
}

.tab.active {
    color: #00d4ff;
    border-bottom-color: #00d4ff;
}

/* ---------------------------------------------------------------------------
   Content Area
   --------------------------------------------------------------------------- */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    min-height: 0;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

#tab-live-monitor.active {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
}

/* ---------------------------------------------------------------------------
   Monitor Stack (single-column layout)
   --------------------------------------------------------------------------- */
.monitor-stack {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.active-calls-panel {
    flex-shrink: 0;
    max-height: 40vh;
    overflow-y: auto;
}

.active-calls-panel .data-table {
    table-layout: fixed;
}

.active-calls-panel .data-table td {
    padding: 0.2rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.active-calls-panel .data-table th:nth-child(1),
.active-calls-panel .data-table td:nth-child(1) { width: 35%; }
.active-calls-panel .data-table th:nth-child(2),
.active-calls-panel .data-table td:nth-child(2) { width: 25%; }
.active-calls-panel .data-table th:nth-child(3),
.active-calls-panel .data-table td:nth-child(3) { width: 20%; }
.active-calls-panel .data-table th:nth-child(4),
.active-calls-panel .data-table td:nth-child(4) { width: 10%; }
.active-calls-panel .data-table th:nth-child(5),
.active-calls-panel .data-table td:nth-child(5) { width: 10%; }

.active-calls-panel .data-table thead th {
    padding: 0.3rem 0.5rem;
}

.call-row-cc td {
    color: #bb86fc !important;
    font-weight: 600;
    border-bottom: 1px solid #2a2a4a;
}

.call-row-idle td {
    color: #333 !important;
}
.call-row-idle td.freq {
    color: #556677 !important;
}

.call-row-phase2 td.freq {
    color: #556677 !important;
    font-style: italic;
}
/* Active call on a Phase 2 slot keeps light blue */
.call-row-phase2:not(.call-row-idle) td.freq {
    color: #00d4ff !important;
    font-style: italic;
}

.call-flags {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #ff6b6b;
    letter-spacing: 0.5px;
}

.system-info-panel {
    flex-shrink: 0;
}

.system-identity {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    font-size: 0.75rem;
}

.sys-field {
    color: #6688aa;
}

.sys-field span {
    color: #00d4ff;
    font-weight: 600;
}

.system-info-panel .data-table td {
    padding: 0.2rem 0.5rem;
    font-size: 0.72rem;
}

.system-info-panel .data-table thead th {
    padding: 0.25rem 0.5rem;
    font-size: 0.65rem;
}

.cc-feed-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.cc-feed-panel .cc-feed-body {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.cc-feed-toggles {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}
.cc-toggle {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #8899aa;
    cursor: pointer;
    user-select: none;
}
.cc-toggle input[type="checkbox"] {
    accent-color: #4488ff;
    cursor: pointer;
}

/* ---------------------------------------------------------------------------
   Panels
   --------------------------------------------------------------------------- */
.panel {
    background: #12122a;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    background: #0f0f23;
    border-bottom: 1px solid #2a2a4a;
}

.panel-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #8888aa;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.panel-badge {
    background: #2a2a4a;
    color: #00d4ff;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* ---------------------------------------------------------------------------
   Data Tables
   --------------------------------------------------------------------------- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    font-size: 0.8rem;
}

.data-table thead th {
    position: sticky;
    top: 0;
    background: #16213e;
    color: #6688aa;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.5rem 0.6rem;
    text-align: left;
    border-bottom: 1px solid #2a2a4a;
}

.data-table tbody tr {
    border-bottom: 1px solid #1e1e3a;
    transition: background-color 0.15s;
}

.data-table tbody tr:hover:not(.empty-row) {
    background: rgba(0, 212, 255, 0.05);
}

.data-table td {
    padding: 0.45rem 0.6rem;
    color: #c0c0d0;
}

.data-table .freq {
    color: #00d4ff;
}

.data-table .duration {
    color: #ffc107;
}

.empty-row td {
    text-align: center;
    color: #555;
    font-style: italic;
    padding: 2rem 0.6rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Channel status badges */
.channel-status {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 600;
}

.channel-status.status-active {
    background: rgba(0, 230, 118, 0.15);
    color: #00e676;
}

.channel-status.status-idle {
    background: rgba(136, 136, 170, 0.15);
    color: #8888aa;
}

/* ---------------------------------------------------------------------------
   Recordings Search Form
   --------------------------------------------------------------------------- */
.recordings-search-form .search-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
}

.recordings-search-form .search-field {
    flex: 1;
    min-width: 150px;
}

.recordings-search-form .search-field-btn {
    flex: 0 0 auto;
    min-width: auto;
}

.recordings-search-form label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.7rem;
    color: #6688aa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.recordings-search-form input {
    width: 100%;
    padding: 0.5rem 0.6rem;
    background: #0f0f23;
    border: 1px solid #2a2a4a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

.recordings-search-form input:focus {
    border-color: #00d4ff;
}

/* Datetime-local inputs — fix coloring in dark theme */
.recordings-search-form input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
}

/* ---------------------------------------------------------------------------
   Map Container
   --------------------------------------------------------------------------- */
.map-layout {
    display: flex;
    gap: 0;
    height: calc(100vh - 160px);
    min-height: 400px;
}
#map-container {
    flex: 1;
    min-width: 0;
    background: #0f0f23;
    border-radius: 6px 0 0 6px;
}

.map-units-panel {
    width: 260px;
    flex-shrink: 0;
    background: #13132b;
    border-left: 1px solid #2a2a4a;
    border-radius: 0 6px 6px 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.map-units-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: #0f0f23;
    border-bottom: 1px solid #2a2a4a;
}
.map-units-list {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}
.map-unit-item {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid #1a1a3a;
    cursor: pointer;
    transition: background 0.15s;
}
.map-unit-item:hover {
    background: #1a1a3f;
}
.map-unit-item.active {
    background: #1a1a4a;
    border-left: 2px solid #4488ff;
}
.map-unit-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #c0c0d0;
}
.map-unit-meta {
    font-size: 0.7rem;
    color: #667;
    margin-top: 0.1rem;
}
.map-unit-trail-btn {
    font-size: 0.65rem;
    color: #4488ff;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-top: 0.15rem;
    text-align: left;
}
.map-unit-trail-btn:hover {
    text-decoration: underline;
}

.map-unit-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 0.25rem;
}

.map-unit-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.map-unit-emergency {
    background: rgba(220, 38, 38, 0.12);
}

.map-unit-emergency .map-unit-name {
    color: #ff4444;
    font-weight: 700;
}

.map-unit-dot-emergency {
    animation: unit-dot-blink 0.5s ease-in-out infinite alternate;
    box-shadow: 0 0 6px rgba(255, 0, 0, 0.6);
}

@keyframes unit-dot-blink {
    0%   { background-color: #ff0000; }
    100% { background-color: #ffc107; }
}

.leaflet-container {
    background: #0f0f23;
}

.leaflet-popup-content-wrapper {
    background: #16213e;
    color: #e0e0e0;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
}

.leaflet-popup-tip {
    background: #16213e;
}

.leaflet-popup-content {
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    font-size: 0.8rem;
}

/* ---------------------------------------------------------------------------
   Status Bar
   --------------------------------------------------------------------------- */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.3rem 1rem;
    background: #0a0a1a;
    border-top: 1px solid #2a2a4a;
    font-size: 0.75rem;
    color: #666;
    flex-shrink: 0;
}

.status-time {
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    color: #555;
}

/* ---------------------------------------------------------------------------
   Scrollbar styling
   --------------------------------------------------------------------------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #0f0f23;
}

::-webkit-scrollbar-thumb {
    background: #2a2a4a;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3a3a5a;
}

/* ---------------------------------------------------------------------------
   Audio Player Bar
   --------------------------------------------------------------------------- */
.audio-player-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    background: #0f0f23;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.audio-player-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.audio-player-center {
    flex: 1;
    text-align: center;
    min-width: 0;
}

.audio-player-right {
    flex-shrink: 0;
}

.audio-now-playing {
    font-size: 0.85rem;
    color: #8888aa;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audio-now-playing.active {
    color: #00e676;
}

.audio-status {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #555;
}

.audio-status.playing {
    color: #00e676;
}

.audio-btn {
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    line-height: 1;
}

/* Volume slider */
.audio-volume {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 4px;
    background: #2a2a4a;
    border-radius: 2px;
    outline: none;
}

.audio-volume::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #00d4ff;
    cursor: pointer;
}

.audio-volume::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #00d4ff;
    cursor: pointer;
    border: none;
}

/* ---------------------------------------------------------------------------
   Filter Bar
   --------------------------------------------------------------------------- */
.filter-bar, .map-filter-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: #0f0f23;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
}

.filter-label {
    font-size: 0.7rem;
    color: #6688aa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    white-space: nowrap;
}

.filter-select {
    padding: 0.3rem 0.5rem;
    background: #12122a;
    border: 1px solid #2a2a4a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.8rem;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    min-width: 160px;
}

.filter-select:focus {
    border-color: #00d4ff;
    outline: none;
}

.filter-badge {
    background: rgba(0, 212, 255, 0.15);
    color: #00d4ff;
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-weight: 600;
}

.filter-spacer {
    flex: 1;
}

/* ---------------------------------------------------------------------------
   CC Activity Feed
   --------------------------------------------------------------------------- */
.cc-feed-body {
    display: flex;
    flex-direction: column;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    font-size: 0.75rem;
}

.cc-feed-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.6rem;
    border-bottom: 1px solid #1e1e3a;
    white-space: nowrap;
    overflow: hidden;
}

.cc-feed-row:hover {
    background: rgba(0, 212, 255, 0.05);
}

.cc-time {
    color: #555;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.cc-badge {
    display: inline-block;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
    min-width: 55px;
    text-align: center;
}

.cc-badge-grant     { background: rgba(0, 230, 118, 0.2); color: #00e676; }
.cc-badge-release   { background: rgba(136, 136, 170, 0.2); color: #8888aa; }
.cc-badge-encrypted { background: rgba(255, 60, 60, 0.2); color: #ff6b6b; }
.cc-badge-no_source { background: rgba(255, 152, 0, 0.2); color: #ff9800; }
.cc-badge-transmission { background: rgba(0, 212, 255, 0.2); color: #00d4ff; }
.cc-badge-unknown   { background: rgba(136, 136, 170, 0.15); color: #666; }
.cc-badge-system_decode { background: rgba(187, 134, 252, 0.2); color: #bb86fc; }
.cc-badge-active_calls_summary { background: rgba(100, 181, 246, 0.2); color: #64b5f6; }
.cc-badge-data      { background: rgba(124, 58, 237, 0.2); color: #a78bfa; }
.cc-badge-affiliation   { background: rgba(255, 152, 0, 0.2); color: #ffab40; }
.cc-badge-deaffiliation { background: rgba(231, 76, 60, 0.15); color: #e67e73; }
.cc-badge-registration  { background: rgba(52, 152, 219, 0.2); color: #5dade2; }
.cc-badge-gps        { background: rgba(0, 200, 83, 0.25); color: #00c853; }
.cc-badge-unit_alias { background: rgba(255, 193, 7, 0.2); color: #ffc107; }
.cc-badge-emrg      { background: #dc2626; color: #fff; }

.cc-info {
    color: #c0c0d0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cc-gps-tag {
    margin-left: 0.4rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    background: rgba(0, 200, 83, 0.2);
    color: #00e676;
    cursor: pointer;
    border: 1px solid rgba(0, 200, 83, 0.3);
    transition: background 0.15s;
}
.cc-gps-tag:hover {
    background: rgba(0, 200, 83, 0.4);
}

.cc-gps-indicator {
    margin-left: 0.4rem;
    padding: 0.1rem 0.35rem;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.cc-gps-valid {
    background: rgba(0, 230, 118, 0.2);
    color: #00e676;
    cursor: pointer;
}
.cc-gps-valid:hover {
    background: rgba(0, 230, 118, 0.4);
}
.cc-gps-none {
    background: rgba(255, 60, 60, 0.15);
    color: #ff6b6b;
}

.cc-feed-empty {
    text-align: center;
    color: #555;
    font-style: italic;
    padding: 2rem 0.6rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Log Export */
.log-export-form { max-width: 400px; }
.log-export-form .form-row { margin-bottom: 0.75rem; }
.log-export-form .form-label { display: block; margin-bottom: 0.25rem; color: #c0c0d0; font-size: 0.85rem; }
.log-export-form .form-input { width: 100%; padding: 0.4rem 0.5rem; background: #1a1a2e; border: 1px solid #333; color: #e0e0e0; border-radius: 4px; }
.log-mode-toggles { display: flex; gap: 1rem; }
.log-event-checkboxes { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; }
.log-status { margin-top: 0.75rem; font-size: 0.85rem; }

/* Backend toggle switch */
.toggle-switch input:checked + span { background: #00b894; }
.toggle-switch input:checked ~ #backend-slider { transform: translateX(20px); }

/* ---------------------------------------------------------------------------
   Raw Log Drawer
   --------------------------------------------------------------------------- */
.raw-log-drawer {
    display: flex;
    flex-direction: column;
    background: #0a0a18;
    border: 1px solid #2a2a4a;
    border-radius: 6px;
    margin-top: 0.75rem;
    height: 250px;
    min-height: 150px;
}

.raw-log-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.75rem;
    background: #0f0f23;
    border-bottom: 1px solid #2a2a4a;
    border-radius: 6px 6px 0 0;
    flex-shrink: 0;
}

.raw-log-controls {
    display: flex;
    gap: 0.35rem;
}

.raw-log-body {
    flex: 1;
    overflow-y: auto;
    margin: 0;
    padding: 0.5rem 0.75rem;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    font-size: 0.7rem;
    line-height: 1.5;
    color: #8c8ca0;
    white-space: pre-wrap;
    word-break: break-all;
}

#raw-log-toggle.active {
    border-color: #00d4ff;
    color: #00d4ff;
}

#raw-log-pause.active {
    border-color: #ffc107;
    color: #ffc107;
}

.raw-log-stderr {
    color: #ff6b6b;
}

/* ---------------------------------------------------------------------------
   Monitor Layout — legacy (removed 2-column grid)
   --------------------------------------------------------------------------- */

/* ---------------------------------------------------------------------------
   Talkgroups & Radios Layout
   --------------------------------------------------------------------------- */
.tg-radio-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

/* Constrain panels so they scroll internally instead of growing the page */
.tg-radio-layout > .panel {
    max-height: calc(100vh - 140px);
}

.inline-search {
    padding: 0.25rem 0.5rem;
    background: #0f0f23;
    border: 1px solid #2a2a4a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.8rem;
    width: 140px;
    outline: none;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
}

.inline-search:focus {
    border-color: #00d4ff;
}

.inline-edit {
    padding: 0.2rem 0.4rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    color: #c0c0d0;
    font-size: 0.8rem;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    width: 100%;
    outline: none;
    transition: border-color 0.2s, background-color 0.2s;
}

.inline-edit:hover {
    border-color: #2a2a4a;
    background: #0f0f23;
}

.inline-edit:focus {
    border-color: #00d4ff;
    background: #0f0f23;
}

.inline-edit::placeholder {
    color: #444;
    font-style: italic;
}

/* Emergency banner */
.emergency-banner {
    background: #dc2626;
    color: #fff;
    padding: 0.75rem 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: emergency-pulse 1.5s ease-in-out infinite;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

@keyframes emergency-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.emergency-icon {
    font-size: 1.4rem;
}

.emergency-locate-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.5);
    border-radius: 4px;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.emergency-locate-btn:hover {
    background: rgba(255,255,255,0.35);
}

.emergency-duration {
    margin-left: auto;
    font-variant-numeric: tabular-nums;
}

.call-row-data td {
    color: #7c8aaa !important;
    font-style: italic;
}

/* Emergency row in active calls table */
.call-row-emergency {
    background: rgba(220, 38, 38, 0.15) !important;
    border-left: 3px solid #dc2626;
}

/* ---------------------------------------------------------------------------
   Responsive — stack panels on mobile
   --------------------------------------------------------------------------- */
@media (max-width: 1024px) {
    .monitor-stack {
        overflow: auto;
    }

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

@media (max-width: 768px) {
    .monitor-stack {
        overflow: auto;
    }

    .top-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .top-bar-left, .top-bar-right {
        width: 100%;
        justify-content: space-between;
    }

    .tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .user-info {
        font-size: 0.8rem;
    }
}
