/* Instagram messages: the list on the left, the message on the right, both
   on one screen so sending a run of DMs needs no scrolling back and forth. */

.igdm {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

/* ---- the list ---- */

.igdm-side {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  position: sticky;
  top: 8px;
}
.igdm-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-inner);
  background: var(--input-bg);
  color: var(--text-faint);
}
.igdm-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  padding: 0;
  color: var(--text);
  font: inherit;
}
.igdm-search input:focus { outline: none; }
.igdm-count {
  margin: 10px 2px 8px;
  font-size: .78rem;
  color: var(--text-faint);
}
.igdm-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 60vh;
  overflow-y: auto;
}
.igdm-lead {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  width: 100%;
  height: auto;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-inner);
  background: none;
  text-align: left;
  cursor: pointer;
}
.igdm-lead:hover { background: var(--panel-2); }
.igdm-lead.is-on { background: var(--accent-soft); }
.igdm-lead-text { min-width: 0; flex: 1; }
.igdm-lead-text b {
  display: block;
  font-weight: 500;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.igdm-lead-text small {
  display: block;
  font-size: .78rem;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.igdm-sent {
  flex: 0 0 auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-dim);
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
}
.igdm-empty,
.igdm-note {
  margin: 8px 2px;
  color: var(--text-dim);
  font-size: .86rem;
}

/* ---- the message ---- */

.igdm-main {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-height: 320px;
}
.igdm-to {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.igdm-to-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent);
}
.igdm-to b { display: block; font-weight: 500; }
.igdm-to small { display: block; color: var(--text-faint); font-size: .82rem; }

.igdm-tpls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.igdm-tpl {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--panel);
  color: var(--text-dim);
  font-size: .82rem;
  cursor: pointer;
}
.igdm-tpl.is-on {
  border-color: var(--accent);
  color: var(--accent);
}

.igdm-field label {
  display: block;
  margin-bottom: 6px;
  font-size: .86rem;
  color: var(--text-dim);
}
.igdm-field textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  line-height: 1.5;
}
.igdm-hint {
  display: block;
  margin-top: 6px;
  color: var(--text-faint);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}

.igdm-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.igdm-actions button,
.igdm-actions .button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

/* ---- nothing picked ---- */

.igdm-blank {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 280px;
  text-align: center;
  gap: 4px;
}
.igdm-blank-mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--text-faint);
}
.igdm-blank h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}
.igdm-blank p {
  margin: 0;
  color: var(--text-dim);
  font-size: .9rem;
  max-width: 34ch;
}

@media (max-width: 900px) {
  .igdm { grid-template-columns: 1fr; }
  .igdm-side { position: static; }
  .igdm-list { max-height: 40vh; }
}
