/* Repeater Control Desk layout overrides */

.control-desk-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 360px);
  gap: 18px;
  align-items: start;
}

.control-desk-main,
.control-desk-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

.control-overview-grid,
.traffic-log-grid {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.control-overview-grid {
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr);
  grid-template-areas:
    "repeater system"
    "repeater disk";
  align-items: stretch;
}

.traffic-log-grid {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}

.control-desk-layout .panel,
body > .panel {
  margin-bottom: 0;
}

.control-overview-grid > .panel:has(.repeaterinfo) { grid-area: repeater; }
.control-overview-grid > .panel:has(#sysinfo) { grid-area: system; }
.control-overview-grid > .panel:has(#diskuse) { grid-area: disk; }

.control-overview-grid > .panel:has(.repeaterinfo) .panel-body,
.control-overview-grid > .panel:has(#sysinfo) .panel-body,
.control-overview-grid > .panel:has(#diskuse) .panel-body {
  padding: 14px;
}

.control-overview-grid > .panel:has(.repeaterinfo) {
  border-color: rgba(255, 209, 102, .26);
}

.control-overview-grid > .panel:has(.repeaterinfo)::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--live), transparent 78%);
}

body > .current-tx-panel {
  margin-bottom: 18px;
}

.control-desk-side > .active-modes-panel { order: 1; }
.control-desk-side > .booking-panel { order: 2; }

.control-desk-side {
  position: sticky;
  top: 18px;
}

.control-desk-side .ysf-switch-control > form:first-child,
.control-desk-side .dmrplus-booking form {
  grid-template-columns: minmax(0, 1fr);
  justify-content: stretch;
  width: 100%;
}

.control-desk-side .ysf-switch-control > form:first-child label,
.control-desk-side .dmrplus-booking form label {
  width: 100%;
}

.control-desk-side #ysf-reflector-search,
.control-desk-side #dmrplus-reflector {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.control-desk-side .dmrplus-booking form {
  flex: 1 1 100%;
}

.current-tx-panel .table-responsive {
  overflow-x: auto;
}

.current-tx-panel .curTx {
  table-layout: fixed;
  width: 100%;
  min-width: 760px;
  font-size: .74rem;
}

.current-tx-panel .curTx th,
.current-tx-panel .curTx td {
  padding-left: 8px !important;
  padding-right: 8px !important;
  white-space: normal;
}

.current-tx-panel .curTx th:nth-child(1),
.current-tx-panel .curTx td:nth-child(1) { width: 18%; }
.current-tx-panel .curTx th:nth-child(2),
.current-tx-panel .curTx td:nth-child(2) { width: 12%; }
.current-tx-panel .curTx th:nth-child(3),
.current-tx-panel .curTx td:nth-child(3) { width: 14%; }
.current-tx-panel .curTx th:nth-child(4),
.current-tx-panel .curTx td:nth-child(4) { width: 14%; }
.current-tx-panel .curTx th:nth-child(5),
.current-tx-panel .curTx td:nth-child(5) { width: 16%; }
.current-tx-panel .curTx th:nth-child(6),
.current-tx-panel .curTx td:nth-child(6) { width: 12%; }
.current-tx-panel .curTx th:nth-child(7),
.current-tx-panel .curTx td:nth-child(7) { width: 8%; }
.current-tx-panel .curTx th:nth-child(8),
.current-tx-panel .curTx td:nth-child(8) { width: 6%; }

.repeaterinfo,
.sysinfo,
.diskuse {
  font-size: .8rem;
}

.repeaterinfo > tbody > tr:first-child {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.repeaterinfo > tbody > tr:first-child > th,
.repeaterinfo > tbody > tr:first-child > td {
  display: block;
  padding: 11px 12px !important;
  border: 1px solid var(--line-soft) !important;
  border-radius: 12px;
  background: rgba(23, 45, 72, .42);
}

.repeaterinfo > tbody > tr:first-child > th {
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.repeaterinfo > tbody > tr:first-child > td {
  color: var(--text);
  font-family: var(--mono);
  font-size: .9rem;
  font-weight: 700;
}

.repeaterinfo > tbody > tr:nth-child(2) > td {
  display: block;
  padding: 12px 0 0 !important;
  border-top: 0 !important;
}

.repeaterinfo > tbody > tr:nth-child(2) table {
  display: block;
}

.repeaterinfo > tbody > tr:nth-child(2) table tbody,
.repeaterinfo > tbody > tr:nth-child(2) table tr {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.repeaterinfo > tbody > tr:nth-child(2) table th,
.repeaterinfo > tbody > tr:nth-child(2) table td {
  display: block;
  padding: 9px 10px !important;
  border: 1px solid var(--line-soft) !important;
  border-radius: 10px;
  background: rgba(7, 17, 31, .28);
  white-space: normal;
}

.repeaterinfo > tbody > tr:nth-child(2) table th {
  color: var(--muted);
  font-size: .65rem;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.repeaterinfo > tbody > tr:nth-child(2) table td {
  color: var(--text);
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 650;
}

.sysinfo tr,
.diskuse tbody tr {
  display: grid;
  grid-template-columns: minmax(94px, .75fr) minmax(0, 1fr);
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line-soft);
}

.sysinfo tr:first-child,
.diskuse tbody tr:first-child {
  border-top: 0;
}

.sysinfo td,
.sysinfo th,
.diskuse tbody td {
  display: block;
  padding: 0 !important;
  border-top: 0 !important;
  white-space: normal;
}

.sysinfo td:first-child,
.sysinfo th:first-child,
.diskuse tbody td:first-child,
.diskuse tbody td:nth-child(2) {
  color: var(--muted);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.sysinfo td:last-child,
.diskuse tbody td:not(:first-child):not(:nth-child(2)) {
  color: var(--text);
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 650;
}

.diskuse thead {
  display: none;
}

.diskuse tbody tr {
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 10px 0;
}

.diskuse tbody td:nth-child(1)::before { content: "FS "; color: var(--cyan); }
.diskuse tbody td:nth-child(2)::before { content: "Mount "; color: var(--cyan); }
.diskuse tbody td:nth-child(4)::before { content: "Free "; color: var(--muted); }
.diskuse tbody td:nth-child(5)::before { content: "Used "; color: var(--muted); }
.diskuse tbody td:nth-child(6)::before { content: "Total "; color: var(--muted); }

.traffic-log-grid .panel-body {
  padding: 12px 14px 14px;
}

.traffic-log-grid .dataTables_wrapper .dataTables_length,
.traffic-log-grid .dataTables_wrapper .dataTables_filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}

.traffic-log-grid .dataTables_wrapper .dataTables_filter {
  float: right;
}

.traffic-log-grid .lastHeard,
.traffic-log-grid .localTx {
  font-size: .78rem;
}

.traffic-log-grid .lastHeard > thead > tr > th,
.traffic-log-grid .lastHeard > tbody > tr > td,
.traffic-log-grid .localTx > thead > tr > th,
.traffic-log-grid .localTx > tbody > tr > td {
  padding: 6px 8px !important;
}

.traffic-log-grid .lastHeard td:nth-child(1),
.traffic-log-grid .localTx td:nth-child(1) {
  color: var(--muted);
  font-family: var(--mono);
  font-size: .74rem;
}

.traffic-log-grid .lastHeard td:nth-child(2),
.traffic-log-grid .localTx td:nth-child(2) {
  color: var(--cyan);
  font-size: .7rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.traffic-log-grid .lastHeard td:nth-child(3),
.traffic-log-grid .localTx td:nth-child(3) {
  color: var(--text);
  font-family: var(--mono);
  font-size: .9rem;
  font-weight: 800;
  letter-spacing: .02em;
}

.traffic-log-grid .lastHeard td:nth-child(5),
.traffic-log-grid .localTx td:nth-child(5) {
  color: var(--live);
  font-weight: 700;
}

.traffic-log-grid .lastHeard td:nth-child(6),
.traffic-log-grid .localTx td:nth-child(6),
.traffic-log-grid .lastHeard td:nth-last-child(-n+3),
.traffic-log-grid .localTx td:nth-last-child(-n+4) {
  font-family: var(--mono);
  font-size: .76rem;
  font-variant-numeric: tabular-nums;
}

.active-modes-panel .table-responsive {
  overflow-x: hidden;
}

.active-modes-table {
  table-layout: fixed;
  width: 100%;
  font-size: .78rem;
}

.active-modes-table > thead > tr > th,
.active-modes-table > tbody > tr > th,
.active-modes-table > tbody > tr > td {
  white-space: normal;
}

.active-modes-table > thead > tr > th:nth-child(1),
.active-modes-table > tbody > tr > th:nth-child(1) { width: 18%; }
.active-modes-table > thead > tr > th:nth-child(2),
.active-modes-table > tbody > tr > td:nth-child(2) { width: 17%; }
.active-modes-table > thead > tr > th:nth-child(3),
.active-modes-table > tbody > tr > td:nth-child(3) { width: 40%; }
.active-modes-table > thead > tr > th:nth-child(4),
.active-modes-table > tbody > tr > td:nth-child(4) { width: 25%; }

.active-mode-state {
  text-align: left;
  white-space: nowrap;
}

.current-tx-panel,
.traffic-log-grid > .panel:has(#lastHeard),
.traffic-log-grid > .panel:has(#localTx) {
  border-color: rgba(97, 230, 255, .24);
}

.current-tx-panel::before,
.traffic-log-grid > .panel:has(#lastHeard)::before,
.traffic-log-grid > .panel:has(#localTx)::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--cyan), transparent 74%);
}

@media (max-width: 1180px) {
  .control-desk-layout {
    display: block;
  }

  .control-desk-side {
    position: static;
  }

  .control-overview-grid,
  .traffic-log-grid {
    grid-template-columns: 1fr;
    grid-template-areas: none;
  }

  .control-overview-grid > .panel:has(.repeaterinfo),
  .control-overview-grid > .panel:has(#sysinfo),
  .control-overview-grid > .panel:has(#diskuse) {
    grid-area: auto;
  }

  .control-desk-layout .panel,
  .control-overview-grid,
  .traffic-log-grid,
  body > .panel,
  body > .page-header {
    margin-bottom: 18px;
  }
}

@media (min-width: 900px) and (max-width: 1180px) {
  .control-desk-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }
}