/* v0.3.5–0.4.1: monitoring, closing statuses, sorting and responsive history. */
.stats{grid-template-columns:repeat(4,1fr)}
.monitor-stat{appearance:none;width:100%;border:2px solid transparent;background:var(--panel);color:var(--text);text-align:left;transition:border-color .15s,transform .15s}
.monitor-stat:hover{transform:translateY(-1px);border-color:#d9def8}
.monitor-stat.active{border-color:var(--brand);box-shadow:0 8px 25px #5966ee24}
.monitor-stat:focus-visible{outline:3px solid #5966ee42;outline-offset:2px}
.monitor-status-v037{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.monitor-status-v037 .status-separator-v037{color:var(--muted);font-weight:800}
.monitor-sort-button-v038{display:inline-flex;align-items:center;gap:4px;padding:0;border:0;border-radius:4px;background:transparent;color:inherit;font:inherit;font-weight:inherit;line-height:1.2;text-align:left;cursor:pointer}
.monitor-sort-button-v038:hover,.monitor-sort-button-v038.active{color:var(--text)}
.monitor-sort-button-v038:focus-visible{outline:2px solid #5966ee55;outline-offset:3px}
.monitor-sort-arrow-v038{color:var(--brand);font-size:13px;font-weight:900}
.monitor-grid{grid-template-columns:minmax(0,1.5fr) minmax(280px,1fr)}
.monitor-grid>.panel{min-width:0}
.monitor-grid>.panel:first-child{overflow-x:auto}
#view-computers>.panel{min-width:0;overflow-x:auto}
.computer-summary{display:grid;grid-template-columns:minmax(180px,260px);margin:18px 0}
.badge.early{background:#fff8cf;color:#8a6a00}
.badge.late{background:#ffedd8;color:#a65300}
.badge.overnight{background:#f1e7ff;color:#6f35a8}
.attention-row{background:#fffdf8}
.history-filters{display:grid;grid-template-columns:repeat(3,minmax(150px,1fr));flex:0 0 100%;width:100%}
.history-filters input,.history-filters select{min-width:150px}
.history-day-row td{padding:20px 12px 9px;border-bottom:2px solid var(--line);color:var(--text);font-size:17px;font-weight:800;text-transform:capitalize;background:var(--bg)}
.history-meta{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin-top:5px}
.attention-card-v036{display:grid;gap:9px}
.attention-card-v036.attention-live-v036{border-left:4px solid #d33b3b;background:#fff8f7}
.issue-list,.attention-card-v036,.attention-title-v036,.attention-event-v036,.attention-current-v036{min-width:0}
.attention-title-v036,.attention-event-v036,.attention-current-v036{display:flex;align-items:center;justify-content:space-between;gap:12px}
.attention-title-v036>strong,.attention-event-v036>b,.attention-current-v036>.monitor-status-v037{min-width:0;overflow-wrap:break-word}
.attention-title-v036>.badge,.attention-current-v036 .badge{max-width:100%;white-space:normal;overflow-wrap:break-word}
.attention-location-v039{display:flex;align-items:center;gap:7px;min-width:0;flex-wrap:wrap}
.attention-location-v039>strong{min-width:0;overflow-wrap:break-word}
.attention-event-v036{color:var(--muted);font-size:13px}
.attention-event-v036 b{color:var(--text);text-align:right}
.attention-current-v036>span:first-child{color:var(--muted);font-size:13px;font-weight:700}
.attention-current-status-v039{display:flex;align-items:center;justify-content:flex-end;gap:6px;min-width:0;flex-wrap:wrap;text-align:right}
.attention-last-signal-v039{color:var(--muted);font-size:12px;font-weight:700;overflow-wrap:break-word}
.mobile-refresh{display:none}
#deviceAdvancedUpdate{margin-top:14px}
#deviceAdvancedUpdate summary{cursor:pointer;font-weight:700}
#deviceAdvancedUpdate select{margin-top:10px;min-width:220px}
.history-location-v040{display:flex;align-items:center;gap:7px;min-width:0;flex-wrap:wrap}
.history-location-v040>b{min-width:0;overflow-wrap:break-word;word-break:normal}

@media(max-width:1280px){
  .monitor-grid{grid-template-columns:minmax(0,1fr)}
}

@media(max-width:1100px){
  .history-filters button{width:100%}
}

@media(max-width:760px){
  .mobile-refresh{display:inline-flex;align-items:center;justify-content:center;min-width:42px;min-height:42px;font-size:22px;line-height:1}
  .stats{grid-template-columns:1fr 1fr}
  .stats .card:last-child{grid-column:auto}
  .computer-summary{grid-template-columns:1fr 1fr;margin:12px 0}
  .history-filters{grid-template-columns:1fr 1fr}
  .history-filters input,.history-filters select{min-width:0;width:100%}
  #view-monitor table thead{display:block;margin-bottom:10px}
  #view-monitor table thead tr{display:flex;width:100%;padding:0;border:0;border-radius:0;background:transparent;gap:6px;flex-wrap:wrap}
  #view-monitor table thead th{display:block;padding:0;border:0}
  #view-monitor .monitor-sort-button-v038{padding:7px 9px;border-radius:999px;background:#eef0f6;color:#596176;font-size:11px}
  #view-monitor .monitor-sort-button-v038.active{background:#e7eaff;color:var(--brand)}
  #monitorDevices td:nth-child(1)::before{content:'Направление'}
  #monitorDevices td:nth-child(2)::before{content:'Компьютер'}
  #monitorDevices td:nth-child(3)::before{content:'График'}
  #monitorDevices td:nth-child(4)::before{content:'Появился на связи'}
  #monitorDevices td:nth-child(5)::before{content:'Статус'}
  #historyBody td:nth-child(6)::before{content:'Появился на связи'}
  #historyBody .history-day-row{padding:0;border:0;background:transparent}
  #historyBody .history-day-row td{display:block;max-width:none;padding:18px 2px 7px;border:0;border-bottom:2px solid var(--line);text-align:left;background:var(--bg)}
  #historyBody .history-day-row td::before{content:none}
  #historyBody tr:not(.history-day-row) td{display:flex;flex-direction:column;align-items:flex-start;gap:4px;text-align:left;overflow-wrap:break-word;word-break:normal}
  #historyBody tr:not(.history-day-row) td::before{flex:0 0 auto;text-align:left}
  #historyBody tr:not(.history-day-row) td>*{max-width:100%}
  #historyBody tr:not(.history-day-row) td.history-date-v040{display:none}
  #historyBody .history-location-cell-v040::before{content:none}
  #historyBody .history-location-v040{align-items:flex-start;flex-direction:column;gap:6px}
  #historyBody .history-meta{margin-top:2px}
  .monitor-grid>.panel:first-child{order:2}
  .monitor-grid>.panel:last-child{order:1}
  .attention-title-v036,.attention-event-v036,.attention-current-v036{align-items:flex-start}
}

@media(max-width:430px){
  .history-filters{grid-template-columns:1fr}
}
