/* Admin targeted OTA dialog (src/components/AdminTargetedOta.js).
   Badges reuse .admin-badge from admin-panel.css: the cloud shell recolours every
   .chip with !important. Long IDs, hashes and versions wrap instead of widening. */
.admin-tota {
  width: min(880px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  box-sizing: border-box;
  margin: auto;
  padding: 22px;
  border: 1px solid var(--surface-border);
  border-radius: 18px;
  background: var(--bg-color);
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  overflow: auto;
  overflow-wrap: anywhere;
}
.admin-tota::backdrop { background: rgb(0 0 0 / 65%); }
.admin-tota h3,
.admin-tota h4,
.admin-tota p { margin: 0; }
.admin-tota h3 { font-size: 1.2rem; }
.admin-tota h4 { font-size: 1rem; line-height: 1.35; }
.admin-tota .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.admin-tota__muted { color: var(--text-secondary); }
/* A device ID moves to the next line as a whole instead of breaking at its hyphen. */
.admin-tota__id { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }
.admin-tota [data-tota-step]:focus { outline: none; }
.admin-tota__error { color: var(--br-cloud-red, #ef5753); }

.admin-tota__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 16px; }
.admin-tota__heading { display: grid; gap: 4px; min-width: 0; }
.admin-tota__eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-secondary); }
.admin-tota__release { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 13px; }

.admin-tota__stepper { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0; padding: 0; list-style: none; }
.admin-tota__stepper li {
  padding: 4px 10px;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.admin-tota__stepper-item--passed { border-style: dashed; }
.admin-tota__stepper-item--current {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  font-weight: 700;
  background: color-mix(in srgb, var(--accent-primary) 14%, transparent);
}

.admin-tota__body { display: grid; gap: 12px; min-width: 0; }
.admin-tota__field { display: grid; gap: 6px; min-width: 0; }
.admin-tota__field label { font-size: 13px; color: var(--text-secondary); }
.admin-tota__field .flow-input { width: 100%; box-sizing: border-box; }
.admin-tota__search { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 16px; }
.admin-tota__search .admin-tota__field { flex: 1 1 260px; }
.admin-tota__toggle,
.admin-tota__ack { display: flex; align-items: center; gap: 10px; font-size: 13px; line-height: 1.35; cursor: pointer; }
.admin-tota__toggle input,
.admin-tota__ack input { flex: 0 0 auto; margin: 0; }

.admin-tota__alert {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--surface-border);
  border-left-width: 4px;
  border-radius: 10px;
  background: var(--surface-secondary);
  font-size: 13px;
  line-height: 1.45;
}
.admin-tota__alert > button { justify-self: start; }
.admin-tota__alert--info { border-left-color: var(--accent-primary); }
.admin-tota__alert--warn { border-left-color: var(--br-cloud-amber, #e9a833); }
.admin-tota__alert--block { border-left-color: var(--br-cloud-red, #ef5753); }
.admin-tota__plain-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }

.admin-badge--block {
  color: color-mix(in srgb, var(--br-cloud-red, #ef5753) 70%, var(--br-cloud-ink, #09243b));
  border-color: color-mix(in srgb, var(--br-cloud-red, #ef5753) 55%, transparent);
  background: color-mix(in srgb, var(--br-cloud-red, #ef5753) 12%, transparent);
}
.admin-badge--progress {
  color: var(--text-primary);
  border-color: color-mix(in srgb, var(--accent-primary) 55%, transparent);
  background: color-mix(in srgb, var(--accent-primary) 12%, transparent);
}
.admin-tota .admin-badge { max-width: 100%; padding-block: 3px; white-space: normal; text-align: left; }

.admin-tota__targets { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.admin-tota__targets--busy { opacity: .6; }
.admin-tota-target {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "id chips"
    "name chips"
    "meta meta"
    "owner owner";
  gap: 4px 12px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--surface-border);
  border-radius: 12px;
  background: var(--surface-primary);
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  line-height: 1.35;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}
.admin-tota-target:hover { border-color: var(--accent-primary); }
.admin-tota-target:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }
.admin-tota-target__id { grid-area: id; font-weight: 700; }
.admin-tota-target__name { grid-area: name; color: var(--text-secondary); }
.admin-tota-target__meta { grid-area: meta; display: flex; flex-wrap: wrap; gap: 2px 12px; color: var(--text-secondary); }
.admin-tota-target__owner { grid-area: owner; font-size: 12px; color: var(--text-secondary); }
.admin-tota-target__chips { grid-area: chips; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; max-width: 260px; }

.admin-tota__facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0; }
.admin-tota__facts > div { min-width: 0; padding: 10px 12px; border: 1px solid var(--surface-border); border-radius: 10px; background: var(--surface-primary); }
.admin-tota__facts dt { margin-bottom: 4px; font-size: 12px; color: var(--text-secondary); }
.admin-tota__facts dd { margin: 0; font-size: 13px; }

.admin-tota__verdict { padding: 10px 14px; border-radius: 10px; font-weight: 700; border: 1px solid var(--surface-border); }
.admin-tota__verdict--ok { border-color: color-mix(in srgb, var(--br-cloud-green, #27b76a) 55%, transparent); background: color-mix(in srgb, var(--br-cloud-green, #27b76a) 12%, transparent); }
.admin-tota__verdict--warn { border-color: color-mix(in srgb, var(--br-cloud-amber, #e9a833) 60%, transparent); background: color-mix(in srgb, var(--br-cloud-amber, #e9a833) 14%, transparent); }
.admin-tota__verdict--block { border-color: color-mix(in srgb, var(--br-cloud-red, #ef5753) 55%, transparent); background: color-mix(in srgb, var(--br-cloud-red, #ef5753) 12%, transparent); }

.admin-tota__checks { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.admin-tota__checks--busy { opacity: .6; }
.admin-tota-check { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 8px; align-items: start; padding: 8px 10px; border: 1px solid var(--surface-border); border-radius: 10px; background: var(--surface-primary); font-size: 13px; }
.admin-tota-check__icon { font-weight: 800; text-align: center; line-height: 1.35; }
.admin-tota-check__text { display: grid; gap: 2px; min-width: 0; }
.admin-tota-check--ok .admin-tota-check__icon { color: var(--br-cloud-green, #27b76a); }
.admin-tota-check--warn { border-color: color-mix(in srgb, var(--br-cloud-amber, #e9a833) 55%, var(--surface-border)); }
.admin-tota-check--warn .admin-tota-check__icon { color: var(--br-cloud-amber, #e9a833); }
.admin-tota-check--block { border-color: color-mix(in srgb, var(--br-cloud-red, #ef5753) 60%, var(--surface-border)); }
.admin-tota-check--block .admin-tota-check__icon { color: var(--br-cloud-red, #ef5753); }

.admin-tota__card { display: grid; gap: 8px; padding: 12px 14px; border: 1px dashed var(--surface-border); border-radius: 12px; background: var(--surface-secondary); font-size: 13px; }
.admin-tota__card--active { border-style: solid; border-color: color-mix(in srgb, var(--accent-primary) 55%, var(--surface-border)); }
.admin-tota__actions,
.admin-tota__footer { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-tota__footer { justify-content: flex-end; padding-top: 4px; }

.admin-tota__status { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--surface-border); font-weight: 700; line-height: 1.4; }
.admin-tota__status--ok { border-color: color-mix(in srgb, var(--br-cloud-green, #27b76a) 55%, transparent); background: color-mix(in srgb, var(--br-cloud-green, #27b76a) 12%, transparent); }
.admin-tota__status--warn { border-color: color-mix(in srgb, var(--br-cloud-amber, #e9a833) 60%, transparent); background: color-mix(in srgb, var(--br-cloud-amber, #e9a833) 14%, transparent); }
.admin-tota__status--block { border-color: color-mix(in srgb, var(--br-cloud-red, #ef5753) 55%, transparent); background: color-mix(in srgb, var(--br-cloud-red, #ef5753) 12%, transparent); }
.admin-tota__status--progress { border-color: color-mix(in srgb, var(--accent-primary) 55%, transparent); background: color-mix(in srgb, var(--accent-primary) 10%, transparent); }

.admin-tota__timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.admin-tota-step { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 4px 10px; align-items: start; padding: 6px 0; font-size: 13px; }
.admin-tota-step__dot { width: 12px; height: 12px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--surface-border); background: var(--bg-color); }
.admin-tota-step__time { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.admin-tota-step--done .admin-tota-step__dot { border-color: var(--br-cloud-green, #27b76a); background: var(--br-cloud-green, #27b76a); }
.admin-tota-step--current .admin-tota-step__dot { border-color: var(--accent-primary); background: color-mix(in srgb, var(--accent-primary) 45%, transparent); }
.admin-tota-step--current .admin-tota-step__label { font-weight: 700; }
.admin-tota-step--warn .admin-tota-step__dot { border-color: var(--br-cloud-amber, #e9a833); background: var(--br-cloud-amber, #e9a833); }
.admin-tota-step--failed .admin-tota-step__dot { border-color: var(--br-cloud-red, #ef5753); background: var(--br-cloud-red, #ef5753); }
.admin-tota-step--failed .admin-tota-step__label { font-weight: 700; }
.admin-tota-step--pending .admin-tota-step__label,
.admin-tota-step--skipped .admin-tota-step__label { color: var(--text-secondary); }
.admin-tota-step--skipped .admin-tota-step__dot { border-style: dashed; }

.admin-tota__bar { height: 8px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--surface-border) 75%, transparent); }
.admin-tota__bar > span { display: block; height: 100%; max-width: 100%; border-radius: inherit; background: var(--accent-primary); transition: width .3s ease; }

.admin-tota__journal { font-size: 12px; }
.admin-tota__journal summary { cursor: pointer; color: var(--text-secondary); }
.admin-tota__journal ol { margin-top: 6px; }

.admin-tota__history { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--surface-border); }
.admin-tota__history-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.admin-tota__history-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 10px; border: 1px solid var(--surface-border); border-radius: 10px; font-size: 12px; }
.admin-tota__history-item--current { border-color: var(--accent-primary) !important; }
.admin-tota__history-line { flex: 1 1 220px; min-width: 0; }

/* Firmware table: the long action label may wrap inside the narrow actions column. */
.admin-actions .admin-fw-target { white-space: normal; text-align: center; }

@media (max-width: 640px) {
  .admin-tota { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); padding: 16px; }
  .admin-tota__header { flex-direction: column; }
  .admin-tota__header > button { align-self: stretch; }
  .admin-tota__facts { grid-template-columns: 1fr; }
  .admin-tota-target { grid-template-columns: minmax(0, 1fr); grid-template-areas: "id" "name" "meta" "owner" "chips"; }
  .admin-tota-target__chips { flex-direction: row; flex-wrap: wrap; align-items: center; max-width: none; }
  .admin-tota-step { grid-template-columns: 18px minmax(0, 1fr); }
  .admin-tota-step__time { grid-column: 2; }
  .admin-tota__footer > button { flex: 1 1 100%; }
}
