/* Internal Devices and TetraMobile Devices: the card grid, the device card and its comments modal. */

/* ----------------------------------------------------------------------
   Card grid
   ------------------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  grid-auto-rows: 8px;
  column-gap: 16px;
  row-gap: 0;
  align-items: start;
}

/* thin rows + a row span per card (see layoutGrid in devices.js) */

.grid > .card {
  align-self: start;
}

.grid > .empty {
  grid-row-end: span 18;
}

/* ----------------------------------------------------------------------
   Device card
   ------------------------------------------------------------------- */

@keyframes pulse {
  0% {
    transform: scale(1);
    opacity: 0.5;
  }
  100% {
    transform: scale(2.8);
    opacity: 0;
  }
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--card-hi), var(--card) 55%);
  border: 1px solid var(--line);
  border-radius: 18px;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--green);
}

.card.in_use::before {
  background: var(--red);
}

.card.maintenance::before {
  background: var(--amber);
}

.card:hover {
  border-color: var(--line-hi);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.card.mine {
  border-color: rgba(255, 77, 67, 0.5);
  box-shadow: inset 0 0 0 1px rgba(255, 77, 67, 0.25);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.in_use .pill {
  color: var(--red);
  background: var(--red-bg);
}

.maintenance .pill {
  color: var(--amber);
  background: var(--amber-bg);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  position: relative;
}

.dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.5;
  animation: pulse 2s infinite;
}

/* SIM block: number row + note row + comment row, one line each */

.sims {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.simbox {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 12px;
  background: var(--inset);
  border: 1px solid transparent;
  border-radius: 12px;
  transition: 0.15s;
}

.simbox:hover {
  border-color: var(--line);
}

.sim {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  font-size: 14px;
  cursor: pointer;
  text-align: left;
}

.op {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
}

.slot {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-soft);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 2px 7px;
}

.num {
  display: flex;
  gap: 8px;
  align-items: center;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.num svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
  opacity: 0;
  transition: 0.15s;
}

.sim:hover .num svg {
  opacity: 1;
}

.holder {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  font-size: 14px;
}

.holder .avatar {
  width: 30px;
  height: 30px;
  font-size: 13px;
}

.holder .who {
  flex: 1;
  min-width: 0;
  font-weight: 650;
  line-height: 1.25;
}

.holder small {
  display: block;
  margin-top: 2px;
  font-weight: 400;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.holder.free {
  color: var(--muted);
}

.sim-op {
  color: var(--muted);
  font-size: 12px;
}

.sim-num {
  background: none;
  border: 0;
  padding: 0;
  color: var(--text);
  font-family: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.sim-num:hover {
  text-decoration: underline;
}

.sim-edit {
  padding: 14px;
  background: var(--card-hi);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.sim-edit-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.timer {
  font-variant-numeric: tabular-nums;
}

.card.mini {
  align-self: start;
  gap: 10px;
  padding: 14px 16px;
}

.card.mini .name {
  font-size: 18px;
}

.name {
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.2px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* long titles (PL-4/SRB-2) stay on one line */

.top-r {
  display: flex;
  align-items: center;
  flex: none;
  gap: 4px;
}

.top-r .icon-btn {
  width: 28px;
  height: 28px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 650;
  padding: 5px 11px 5px 9px;
  border-radius: 999px;
  color: var(--green);
  background: var(--green-bg);
  flex: none;
  white-space: nowrap;
}

.holder.support .mini {
  flex: none;
  padding: 7px 16px;
  min-height: 0;
  font-size: 12.5px;
}

.pill.sup {
  background: rgba(143, 178, 255, 0.16);
  color: var(--blue);
}

/* ----------------------------------------------------------------------
   Device card: comments and notes
   ------------------------------------------------------------------- */

.note svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.cmtline svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.note span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cmtline .prev {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 30px;
  padding: 6px 9px;
  font-size: 12.5px;
  line-height: 1.4;
  border-radius: 8px;
  color: var(--amber);
  background: rgba(245, 194, 107, 0.09);
}

.note.none {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
}

.note.none svg {
  opacity: 0.6;
}

.cmtline {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 30px;
  padding: 6px 9px;
  line-height: 1.4;
  border-radius: 8px;
  border: 1px dashed var(--line-hi);
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
  transition: 0.15s;
}

.cmtline:hover {
  color: var(--text);
  border-color: var(--muted);
}

.cmtline.has {
  border: 1px solid transparent;
  background: var(--blue-bg);
  color: var(--text);
}

.cmtline.has svg {
  color: var(--blue);
}

.cmtline.has:hover {
  background: rgba(143, 178, 255, 0.17);
}

.cmtline .prev b {
  color: var(--blue);
  font-weight: 650;
  margin-right: 5px;
}

.cmtline .cnt {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--blue);
  background: rgba(143, 178, 255, 0.18);
  border-radius: 6px;
  padding: 1px 7px;
}

/* ----------------------------------------------------------------------
   Device card: buttons
   ------------------------------------------------------------------- */

.actions {
  display: flex;
  gap: 8px;
  flex-direction: column;
}

.actions .btn {
  flex: none;
  width: 100%;
}

.actions-sub {
  display: flex;
  gap: 8px;
}

.actions-sub > button,
.actions-sub > a {
  flex: 1;
  justify-content: center;
  min-height: 40px;
  padding: 0 10px;
}

/* ----------------------------------------------------------------------
   Comments modal
   ------------------------------------------------------------------- */

.mrow {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--blue-bg);
  border-radius: 10px;
}

.mrow.editing {
  background: none;
  padding: 0;
  gap: 6px;
}

.mtxt {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.4;
}

.mtxt small {
  display: block;
  margin-top: 3px;
  font-size: 12px;
  color: var(--muted);
}

.cmt-actions {
  display: flex;
  gap: 10px;
  flex: none;
}

.madd {
  display: flex;
  gap: 6px;
  margin-top: 4px;
}

.cmt-max {
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
  padding: 2px 0;
}

/* ----------------------------------------------------------------------
   Device card: support requests
   ------------------------------------------------------------------- */

.support-under {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.support-wait {
  flex: none;
  font-size: 11.5px;
  color: var(--muted);
}
