/* Дополнения tehmaps. Базовый styles.css скопирован из эталона без изменений. */

.login-view {
  background: radial-gradient(circle at 28% 18%, rgba(234, 88, 12, .22), transparent 34%),
              linear-gradient(145deg, #24272d, #111317 72%);
}

.fleet-content { max-width: 1520px; }
.panel-head > div { min-width: 0; }

.tab-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; margin-left: 4px; padding: 0 6px;
  border-radius: 999px; color: var(--accent); background: var(--accent-soft);
  font-size: 11px; vertical-align: 1px;
}

.table-wrap {
  max-width: 100%; overflow-x: auto; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.empty-card { margin: 0; padding: 52px 20px; }

.fleet-table {
  width: 100%; border-collapse: collapse; background: var(--surface);
}
.fleet-table th, .fleet-table td {
  min-width: 0; padding: 12px 14px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--border); overflow-wrap: anywhere;
}
.fleet-table th {
  color: var(--muted); background: #fafafb; font-size: 12px; font-weight: 700;
  white-space: nowrap;
}
.fleet-table td { min-height: 44px; font-size: 13px; }
.fleet-table tbody tr:last-child td { border-bottom: 0; }
.fleet-table tbody tr:hover { background: #fffdfb; }
.restaurants-table { min-width: 700px; }
.devices-table { min-width: 1360px; }
.devices-table th:nth-child(1) { width: 190px; }
.devices-table th:nth-child(2) { width: 170px; }
.devices-table th:nth-child(3) { width: 260px; }
.devices-table th:nth-child(4) { width: 170px; }
.devices-table th:nth-child(5) { width: 150px; }
.devices-table th:nth-child(6) { width: 130px; }
.devices-table th:nth-child(7) { width: 105px; }
.devices-table th:nth-child(8) { width: 105px; }

.device-new td { background: #fffaf5; }
.device-new td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.device-id-line { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-bottom: 8px; }
.device-id-line code { font-size: 12px; font-weight: 700; }
.compact-input, .compact-select {
  width: 100%; min-width: 0; min-height: 44px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 9px; background: #fbfbfc; font: inherit;
}
.compact-input:focus, .compact-select:focus {
  outline: 2px solid var(--accent-soft); border-color: var(--accent);
}
.url-cell { min-width: 0; }
.url-link {
  display: block; max-width: 100%; color: #285f9e; text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.url-link:hover { text-decoration: underline; }
.url-cell .effective-url { margin-bottom: 8px; }
.url-cell small { display: block; margin-top: 5px; }

.row-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.row-actions .btn { min-height: 44px; padding: 8px 11px; font-size: 13px; }
.vertical-actions { flex-direction: column; }

.switch-control {
  display: inline-flex; min-height: 44px; align-items: center; gap: 8px;
  cursor: pointer; user-select: none;
}
.switch-control input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  position: relative; flex: 0 0 42px; width: 42px; height: 24px;
  border-radius: 999px; background: #c7cbd1; transition: background .15s;
}
.switch-track span {
  position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
  transition: transform .15s;
}
.switch-control input:checked + .switch-track { background: var(--accent); }
.switch-control input:checked + .switch-track span { transform: translateX(18px); }
.switch-control input:focus-visible + .switch-track { outline: 3px solid rgba(234, 88, 12, .22); }
.switch-control input:disabled + .switch-track { opacity: .55; }
.switch-label { max-width: 94px; font-size: 12px; font-weight: 700; }

.online-status { font-weight: 700; white-space: nowrap; }
.online-status.online { color: #1f9d55; }
.online-status.offline { color: var(--muted); }
.cell-note { margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.platform-android { color: #1f8050; background: #e7f6ee; }
.platform-windows { color: #285f9e; background: #eaf2fb; }

.modal-body small { line-height: 1.4; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.modal-actions .btn { min-height: 44px; }
.confirm-text { margin: 0; line-height: 1.5; }

.ota-current-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ota-current {
  min-width: 0; display: flex; flex-direction: column; gap: 5px;
  padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: #fafafb;
}
.ota-current .hash {
  overflow: hidden; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px; text-overflow: ellipsis; white-space: nowrap;
}
#ota-form { display: flex; flex-direction: column; gap: 14px; }
#ota-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
#ota-form input, #ota-form select {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: #fbfbfc; font: inherit;
}

@media (max-width: 700px) {
  .fleet-content { padding: 16px; }
  .panel-head { align-items: stretch; }
  .panel-head .btn { min-height: 44px; }
  .table-wrap { overflow: visible; border: 0; background: transparent; box-shadow: none; }
  .fleet-table, .fleet-table tbody, .fleet-table tr, .fleet-table td {
    display: block; width: 100%; min-width: 0;
  }
  .fleet-table thead { display: none; }
  .fleet-table tbody { display: grid; gap: 12px; }
  .fleet-table tr {
    overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); box-shadow: var(--shadow);
  }
  .fleet-table td {
    display: grid; grid-template-columns: minmax(96px, .38fr) minmax(0, 1fr);
    min-height: 44px; align-items: start; gap: 10px; padding: 11px 12px;
  }
  .fleet-table td::before {
    content: attr(data-label); color: var(--muted); font-size: 11px; font-weight: 700;
  }
  .fleet-table td > * { min-width: 0; }
  .fleet-table tbody tr:last-child td:not(:last-child) { border-bottom: 1px solid var(--border); }
  .device-new td { background: transparent; }
  .device-new td:first-child { background: #fffaf5; }
  .url-link { white-space: normal; overflow-wrap: anywhere; }
  .vertical-actions { flex-direction: row; }
  .vertical-actions .btn { flex: 1 1 120px; }
  .ota-current-list { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  .topbar { padding: 12px; }
  .topbar-right { gap: 7px; }
  #current-user { display: none; }
  .fleet-table td { grid-template-columns: 86px minmax(0, 1fr); padding: 10px; gap: 8px; }
  .row-actions { width: 100%; }
  .row-actions .btn { flex: 1 1 auto; }
  .switch-label { font-size: 11px; }
}
