/* Portals page — runbook list + edit drawer. All classes pt- namespaced. */

/* A DataTable in an intermediate page root needs the root to be a flex column,
   or the table grows to content height and the pagination footer is clipped
   off-viewport (main.css .route-view.active:has(.dt-host) locks overflow). */
.pt-page-root {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.pt-page-root > .page-header { flex-shrink: 0; }

.pt-name-btn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: #4f46e5;
  cursor: pointer;
  text-align: left;
}
.pt-name-btn:hover { text-decoration: underline; }

.pt-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}
.pt-badge-on  { background: #d1fae5; color: #065f46; }
.pt-badge-off { background: #e5e7eb; color: #4b5563; }

/* A portal past its own stated cadence — the "did anyone run the pass" flag. */
.pt-overdue { color: #b91c1c; font-weight: 600; }

/* ── Drawer form ───────────────────────────────────────────────────────── */

.pt-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pt-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.pt-field { display: flex; flex-direction: column; gap: 6px; }
.pt-field-full { grid-column: 1 / -1; }

.pt-field-label {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.pt-field-hint {
  font-size: 12px;
  color: #6b7280;
  margin: 0;
}

.pt-req { color: #dc2626; }

.pt-textarea {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}

.pt-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #374151;
  cursor: pointer;
}

.pt-form input[disabled],
.pt-form select[disabled],
.pt-form textarea[disabled] {
  background: #f3f4f6;
  color: #6b7280;
  cursor: default;
}

@media (max-width: 700px) {
  .pt-grid { grid-template-columns: 1fr; }
}

/* Drawer footer actions.

   The row itself, because .drawer-footer is display:block — controls
   concatenated into it with no separator butt together at 0px. Same flex
   treatment .act-drawer-footer gives the activity drawer, same 0.5rem gap.

   The rule on .btn is needed because main.css's .btn sets font-size and weight
   but neither font-family nor line-height. A <button> therefore falls back to
   the UA's own font (Arial) and line-height:normal, while an <a class="btn">
   inherits the page font and the body's 21px line-height — identical padding,
   boxes 5px apart in height, and two different typefaces side by side. Pinning
   both makes the five footer controls one row of identical buttons, without
   restyling every .btn in the app. */
.pt-drawer-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}
.pt-drawer-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: inherit;
  line-height: 1.25;
  text-decoration: none;
  /* The five controls want 545px at natural width and this drawer's footer
     offers 520px. Without these the flex row shrinks the two widest buttons
     until their labels wrap INSIDE them — two 53px buttons beside three 35.5px
     ones. Wrapping the ROW instead keeps every button one identical line. */
  white-space: nowrap;
  flex-shrink: 0;
}
.pt-open-btn svg { width: 14px; height: 14px; }


/* Copy-to-clipboard on the credential fields. The button sits inside the
   input's box rather than beside it, so the field keeps its grid width and the
   two-column form does not reflow. */
.pt-copy-wrap { position: relative; display: block; }
.pt-copy-wrap .form-input { width: 100%; padding-right: 38px; }

/* SCOPED to .pt-copy-wrap deliberately. The row-action buttons in the table
   share the .pt-copy class (one delegated handler serves both surfaces) but
   have no positioned ancestor — an unscoped `position:absolute` here made
   EVERY row's copy button stack at the same point, so clicking one row copied
   another row's username. Keep this selector as a child of the wrap. */
.pt-copy-wrap > .pt-copy {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
}
.pt-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: none;
  color: #6b7280;
  cursor: pointer;
}
.pt-copy svg { width: 15px; height: 15px; }
.pt-copy:hover { background: #eef2ff; color: #4f46e5; }
.pt-copy:focus-visible { outline: 2px solid #4f46e5; outline-offset: -2px; }
.pt-copy:disabled { color: #d1d5db; cursor: default; background: none; }
/* Confirmation lives next to the field being copied rather than in a toast —
   this is a frequent micro-action and toasts would stack. */
.pt-copy.is-copied { color: #059669; }
.pt-copy.is-copied:hover { background: none; }

/* Row action cluster: copy username · copy password · open. */
.pt-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.pt-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: #4f46e5;
  cursor: pointer;
}
.pt-act svg { width: 15px; height: 15px; }
.pt-act:hover { background: #eef2ff; }
.pt-act:focus-visible { outline: 2px solid #4f46e5; outline-offset: -2px; }
/* Nothing to act on — greyed rather than hidden, so the column reads as "this
   record is missing something" instead of looking broken. */
.pt-act-off { color: #cbd5e1; cursor: default; }
.pt-act-off:hover { background: none; }
.pt-act.is-copied { color: #059669; }
.pt-act.is-copied:hover { background: none; }

/* Same ellipsis trap as .dt-select-col: `.datatable-table td` paints
   text-overflow:ellipsis, and atomic inline content brushing the content-box
   edge makes Chrome draw a literal '…' beside it. */
.datatable-table td.col-_actions,
.datatable-table th.col-_actions {
  text-align: center;
  padding: 0 4px;
  text-overflow: clip;
}

/* A URL field with nothing in it still renders its open affordance, greyed. */
.pt-copy[data-disabled] { color: #d1d5db; cursor: default; }
.pt-copy[data-disabled]:hover { background: none; }
