/*
 * Postlinkly suggestion modal, metabox shell, and Gutenberg sidebar styles.
 *
 * Loaded on post-edit screens (both Classic and Block editor).
 * Depends on admin-base.css for design tokens.
 *
 * @package Postlinkly
 * @since   1.0.0
 * @since   1.1.0
 * @since   1.3.0 Shared design-token colours and surfaces.
 */

/* ==========================================================================
   METABOX SHELL (Classic Editor sidebar widget)
   ========================================================================== */

#postlinkly-metabox { padding: 2px 0; }

.pl-stats {
	display: flex;
	gap: 6px;
	margin-bottom: 12px;
}
.pl-stat {
	flex: 1;
	background: var(--pl-soft);
	border: 1px solid var(--pl-line);
	border-radius: 6px;
	padding: 8px 4px;
	text-align: center;
}
.pl-stat-value {
	font-size: 18px;
	font-weight: 700;
	line-height: 1;
}
.pl-stat-label {
	font-size: 10px;
	color: var(--pl-faint);
	margin-top: 3px;
	text-transform: uppercase;
	letter-spacing: .3px;
}
.pl-stat-inbound  .pl-stat-value { color: var(--pl-primary); }
.pl-stat-outbound .pl-stat-value { color: var(--pl-green); }
.pl-stat-external .pl-stat-value { color: var(--pl-red); }

.pl-find-btn {
	width: 100%;
	justify-content: center;
	display: flex;
	align-items: center;
	gap: 6px;
}

.pl-count-badge {
	margin-top: 8px;
	text-align: center;
	font-size: 12px;
	color: var(--pl-faint);
}

/* ==========================================================================
   CLASSIC EDITOR OVERLAY
   ========================================================================== */

.pl-overlay {
	position: fixed;
	inset: 0;
	background: rgba(12, 30, 50, .55);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	z-index: 999999;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 40px 20px;
	overflow-y: auto;
}

body.pl-panel-open { overflow: hidden; }

.pl-panel {
	background: var(--pl-surface);
	border-radius: 16px;
	width: 100%;
	max-width: 960px;
	box-shadow: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1);
	border: 1px solid var(--pl-line);
	display: flex;
	flex-direction: column;
	max-height: calc(100vh - 80px);
	animation: pl-slide-up .3s cubic-bezier(.34,1.56,.64,1);
}

@keyframes pl-slide-up {
	from { transform: translateY(40px) scale(.96); opacity: 0; }
	to   { transform: translateY(0)    scale(1);   opacity: 1; }
}

/* Panel header */
.pl-panel-header {
	padding: 20px 28px;
	border-bottom: 1px solid var(--pl-line);
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}
.pl-panel-header-left {
	display: flex;
	align-items: center;
	gap: 14px;
}
.pl-panel-icon {
	width: 42px;
	height: 42px;
	background: var(--pl-primary-tint);
	border-radius: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--pl-primary);
	flex-shrink: 0;
}
.pl-panel-title h2 {
	font-size: 16px;
	font-weight: 700;
	color: var(--pl-ink);
	margin: 0;
}
.pl-panel-title p {
	font-size: 12px;
	color: var(--pl-muted);
	margin: 2px 0 0;
}
.pl-close-btn {
	width: 32px;
	height: 32px;
	border: 1px solid var(--pl-line);
	background: var(--pl-surface);
	border-radius: 50%;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--pl-muted);
	transition: all .15s;
	flex-shrink: 0;
}
.pl-close-btn:hover {
	background: var(--pl-soft);
	border-color: var(--pl-line-2);
	color: var(--pl-ink);
}

/* Controls bar */
.pl-controls {
	padding: 12px 28px;
	background: var(--pl-soft);
	border-bottom: 1px solid var(--pl-line);
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
}
.pl-controls-left {
	display: flex;
	align-items: center;
	gap: 10px;
}
.pl-select-all-label {
	font-size: 13px;
	font-weight: 600;
	color: var(--pl-ink);
	cursor: pointer;
	margin: 0;
	display: flex;
	align-items: center;
	gap: 8px;
}
.pl-found-badge {
	background: var(--pl-line);
	color: var(--pl-muted);
	font-size: 11px;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: 10px;
}
.pl-checkbox {
	width: 16px;
	height: 16px;
	cursor: pointer;
	accent-color: var(--pl-primary);
	margin: 0;
}

/* Suggestion list scroll area */
.pl-suggestion-list {
	overflow-y: auto;
	flex: 1;
	padding: 24px 28px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

/* Loading state */
.pl-panel-loading {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 20px 0;
	color: var(--pl-muted);
	font-size: 13px;
}

/* Empty state */
.pl-empty {
	padding: 30px 0;
	text-align: center;
	color: var(--pl-muted);
}

/* ==========================================================================
   CLASSIC EDITOR SUGGESTION CARD
   Three columns: checkbox | sentence + badges | target + insert button
   ========================================================================== */

.pl-card {
	border: 1px solid var(--pl-line);
	border-radius: 10px;
	display: grid;
	grid-template-columns: 48px 1fr 240px;
	overflow: visible;
	transition: all .2s cubic-bezier(.4,0,.2,1);
	background: var(--pl-surface);
	width: 100%;
	box-sizing: border-box;
}
.pl-card:hover {
	border-color: var(--pl-primary);
	box-shadow: 0 0 0 1px var(--pl-primary), 0 1px 2px rgba(0,0,0,.05);
}
.pl-card.selected {
	border-color: var(--pl-primary);
	background: var(--pl-primary-tint);
}
.pl-card.pl-card-done {
	opacity: .5;
	pointer-events: none;
}

.pl-card-check {
	width: 48px;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding-top: 18px;
	border-right: 1px solid var(--pl-line);
	background: var(--pl-soft);
	border-radius: 10px 0 0 10px;
	cursor: pointer;
}
.pl-card-check input {
	width: 16px;
	height: 16px;
	accent-color: var(--pl-primary);
	cursor: pointer;
}

.pl-card-source {
	padding: 16px 20px;
	border-right: 1px solid var(--pl-line);
	min-width: 0;
}
.pl-card-meta-label {
	font-size: 10.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .5px;
	color: var(--pl-muted);
	margin-bottom: 8px;
}
.pl-sentence {
	font-size: 13.5px;
	line-height: 1.6;
	color: var(--pl-ink);
	word-break: break-word;
}
.pl-anchor-highlight {
	background: var(--pl-amber-l);
	border-bottom: 2px solid var(--pl-amber);
	font-weight: 600;
	border-radius: 3px;
	padding: 1px 4px;
	cursor: default;
}
.pl-anchor-phrase {
	font-size: 13px;
	font-weight: 700;
	color: var(--pl-ink);
	background: var(--pl-amber-l);
	border-bottom: 2px solid var(--pl-amber);
	border-radius: 3px;
	padding: 2px 6px;
	display: inline-block;
	max-width: 100%;
	word-break: break-word;
}
.pl-card-badges {
	margin-top: 10px;
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
}
.pl-badge {
	font-size: 11px;
	font-weight: 600;
	padding: 3px 8px;
	border-radius: 20px;
	display: inline-flex;
	align-items: center;
	gap: 4px;
}
.pl-badge-keyword { background: var(--pl-amber-l); color: var(--pl-amber); }

.pl-card-target {
	padding: 16px 20px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	box-sizing: border-box;
	border-radius: 0 10px 10px 0;
}
.pl-target-title {
	font-size: 13.5px;
	font-weight: 600;
	color: var(--pl-ink);
	line-height: 1.35;
	word-break: break-word;
}
.pl-target-url {
	font-size: 11.5px;
	color: var(--pl-muted);
	word-break: break-all;
	overflow-wrap: anywhere;
	line-height: 1.4;
}
.pl-insert-btn {
	width: 100%;
	padding: 7px 12px;
	background: var(--pl-primary);
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s;
	box-shadow: 0 4px 10px rgba(34,113,177,.2);
	margin-top: auto;
}
.pl-insert-btn:hover:not(:disabled) {
	background: var(--pl-primary-hover);
	box-shadow: 0 4px 12px rgba(34,113,177,.3);
}
.pl-insert-btn.inserted {
	background: var(--pl-muted);
	cursor: default;
	box-shadow: none;
}
.pl-insert-btn.already-linked {
	background: var(--pl-amber);
	cursor: default;
	font-size: 11px;
	box-shadow: none;
}
.pl-insert-btn.pl-insert-btn--unavailable {
	background: var(--pl-danger);
	box-shadow: none;
}
.pl-insert-btn:disabled { opacity: .7; cursor: not-allowed; }

/* A no_safe_position failure: nothing was inserted, so the card must not
   look done (see .pl-card-done above). The button stays enabled/retryable,
   so no opacity/pointer-events change here - the border plus .pl-card-note
   below explain why, without blocking another attempt. */
.pl-card.pl-card-unavailable {
	border-left: 3px solid var(--pl-danger);
}
.pl-card-note {
	font-size: 11px;
	color: var(--pl-danger);
	margin-top: 4px;
}

/* Panel footer */
.pl-panel-footer {
	padding: 16px 28px;
	border-top: 1px solid var(--pl-line);
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-shrink: 0;
	background: var(--pl-soft);
	border-radius: 0 0 16px 16px;
}
.pl-footer-info {
	font-size: 13px;
	font-weight: 600;
	color: var(--pl-muted);
}
.pl-footer-actions {
	display: flex;
	gap: 10px;
}
.pl-btn-insert-all {
	background: var(--pl-primary) !important;
	border-color: var(--pl-primary) !important;
	color: #fff !important;
	box-shadow: 0 4px 10px rgba(34,113,177,.2);
}
.pl-btn-insert-all:hover:not(:disabled) {
	background: var(--pl-primary-hover) !important;
	border-color: var(--pl-primary-hover) !important;
}
.pl-btn-insert-all:disabled { opacity: .6; cursor: not-allowed; }

/* ==========================================================================
   GUTENBERG SIDEBAR (compact stats widget)
   ========================================================================== */

.pl-sb-wrap {
	padding: 12px;
	font-size: 13px;
}
.pl-sb-stats {
	display: flex;
	gap: 6px;
	margin-bottom: 12px;
}
.pl-sb-stat {
	flex: 1;
	background: var(--pl-soft);
	border: 1px solid var(--pl-line);
	border-radius: 6px;
	padding: 8px 4px;
	text-align: center;
}
.pl-sb-stat-value {
	display: block;
	font-size: 18px;
	font-weight: 700;
	line-height: 1;
}
.pl-sb-stat-label {
	display: block;
	font-size: 10px;
	color: var(--pl-faint);
	margin-top: 3px;
	text-transform: uppercase;
	letter-spacing: .3px;
}
.pl-sb-inbound  .pl-sb-stat-value { color: var(--pl-primary); }
.pl-sb-outbound .pl-sb-stat-value { color: var(--pl-green); }
.pl-sb-external .pl-sb-stat-value { color: var(--pl-red); }

.pl-sb-divider {
	border: none;
	border-top: 1px solid var(--pl-line);
	margin: 0 0 12px;
}
.pl-sb-find-btn {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 9px 12px;
	background: var(--pl-primary);
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background .15s;
}
.pl-sb-find-btn:hover:not(:disabled) { background: var(--pl-primary-hover); }
.pl-sb-find-btn:disabled { opacity: .6; cursor: not-allowed; }

.pl-sb-error {
	background: var(--pl-red-l);
	border: 1px solid var(--pl-red);
	border-radius: 4px;
	padding: 8px 10px;
	color: var(--pl-red);
	font-size: 12px;
	margin-bottom: 10px;
}

/* ==========================================================================
   PORTAL MODAL (Gutenberg — portalled to <body>)

   The portal is appended to document.body so it sits above the Gutenberg
   editor chrome. The overlay must be truly fullscreen.
   Cards use min-width on fixed columns to prevent flex collapse from
   Gutenberg's reset (min-width: 0 on flex children).
   ========================================================================== */

.pl-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(12, 30, 50, .55);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	z-index: 9999;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 42px 20px;
	overflow-y: auto;
	box-sizing: border-box;
}

body.pl-modal-open { overflow: hidden; }

.pl-modal {
	position: relative;
	width: min(880px, 100%);
	background: var(--pl-surface);
	border-radius: var(--pl-radius);
	box-shadow: 0 24px 60px -20px rgba(10, 40, 70, .5);
	display: flex;
	flex-direction: column;
	max-height: calc(100vh - 84px);
	overflow: hidden;
	box-sizing: border-box;
	animation: pl-slide-up .3s cubic-bezier(.34,1.56,.64,1);
}

/* Modal header */
.pl-modal-header {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	padding: 20px 22px;
	border-bottom: 1px solid var(--pl-line);
	background: linear-gradient(180deg, #fbfdff, var(--pl-surface));
	flex-shrink: 0;
}
.pl-modal-header-left {
	flex: 1;
	min-width: 0;
	display: flex;
	align-items: flex-start;
	gap: 14px;
}
.pl-modal-icon {
	flex: none;
	width: 42px;
	height: 42px;
	border-radius: 10px;
	background: var(--pl-primary-tint);
	border: 1px solid var(--pl-primary-line);
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--pl-primary);
}
.pl-modal-icon-img {
	display: block;
	width: 26px;
	height: 26px;
}
.pl-modal-title {
	font-size: 18px;
	font-weight: 600;
	line-height: 1.3;
	margin: 0;
	color: var(--pl-ink);
}
.pl-modal-subtitle {
	margin-top: 3px;
	color: var(--pl-muted);
	font-size: 13px;
}
.pl-modal-close {
	flex: none;
	width: 36px;
	height: 36px;
	border: 1px solid transparent;
	background: transparent;
	border-radius: var(--pl-radius-sm);
	color: var(--pl-muted);
	font-size: 16px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}
.pl-modal-close:hover {
	background: var(--pl-soft);
	border-color: var(--pl-line);
}

/* Controls bar */
.pl-modal-controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 22px;
	background: var(--pl-soft);
	border-bottom: 1px solid var(--pl-line);
	flex-shrink: 0;
	gap: 10px;
}
.pl-modal-controls-left {
	display: flex;
	align-items: center;
	gap: 10px;
}
.pl-modal-controls-right {
	display: flex;
	align-items: center;
	gap: 8px;
}
.pl-modal-select-all {
	display: flex;
	align-items: center;
	gap: 9px;
	font-size: 13px;
	color: var(--pl-muted);
	cursor: pointer;
}
.pl-modal-select-all input {
	width: 17px;
	height: 17px;
	accent-color: var(--pl-primary);
}
.pl-modal-select-all-label {
	display: flex;
	align-items: center;
	gap: 9px;
	font-size: 13px;
	color: var(--pl-muted);
	cursor: pointer;
	margin: 0;
}
.pl-modal-count-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: var(--pl-faint);
}
.pl-modal-checkbox {
	width: 17px;
	height: 17px;
	cursor: pointer;
	accent-color: var(--pl-primary);
	margin: 0;
}

/* Error banner */
.pl-modal-error {
	padding: 12px 16px;
	color: var(--pl-red);
	background: var(--pl-red-l);
	border: 1px solid var(--pl-red-line);
	border-radius: var(--pl-radius-sm);
	font-size: 13px;
	flex-shrink: 0;
}

/* Same shape as the error banner so the eye reads them as one slot, in the
   colour that says the run worked. */
.pl-modal-notice {
	padding: 12px 16px;
	color: var(--pl-green);
	background: var(--pl-green-l);
	border: 1px solid var(--pl-green-line);
	border-radius: var(--pl-radius-sm);
	font-size: 13px;
	flex-shrink: 0;
}

/* Card list */
.pl-modal-list {
	display: block;
	overflow: auto;
	padding: 16px;
}
.pl-modal-empty {
	padding: 32px 20px;
	text-align: center;
	color: var(--pl-muted);
	font-size: 13px;
}
.pl-modal-loading {
	padding: 32px 20px;
	text-align: center;
	color: var(--pl-muted);
	font-size: 13px;
}

/* ==========================================================================
   SUGGESTION LIST
   Compact, one-line-first rows with progressive disclosure. Each row
   collapses to a single scannable line (checkbox + sentence + chevron);
   clicking it expands the full sentence, badges, the anchor range selector,
   and the insert action below. Nothing about the sentence is ever
   height-clipped — the row grows to whatever height its content needs, both
   collapsed (an anchor-safe truncated preview) and expanded (the full
   sentence) — so a highlighted anchor can never be hidden by a fixed box.
   ========================================================================== */

.pl-modal-item { border-bottom: 1px solid var(--pl-line); }
.pl-modal-item:last-child { border-bottom: none; }
.pl-modal-item:hover { background: var(--pl-soft); }
.pl-modal-item--checked { box-shadow: inset 4px 0 0 var(--pl-primary); }
.pl-modal-item--done { opacity: .5; pointer-events: none; }
.pl-modal-item--stale { opacity: .6; }
.pl-modal-item--stale-msg {
	padding: 10px 14px;
	color: var(--pl-amber);
	font-size: 12px;
	line-height: 1.5;
}
.pl-modal-item--stale-msg a { color: var(--pl-primary); }

.pl-modal-item-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 11px 14px;
	cursor: pointer;
}
.pl-modal-item-row input[type="checkbox"] {
	width: 17px;
	height: 17px;
	accent-color: var(--pl-primary);
	flex: none;
	margin: 0;
}

.pl-modal-item-line {
	flex: 1;
	min-width: 0;
	font-size: 13.5px;
	line-height: 1.5;
	color: var(--pl-ink-2);
}

.pl-modal-item-expand {
	flex: none;
	width: 24px;
	height: 24px;
	border-radius: 6px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: none;
	background: none;
	color: var(--pl-muted);
	cursor: pointer;
}
.pl-modal-item-expand:hover { background: var(--pl-line); }
.pl-modal-item-expand svg { transition: transform .15s; }
.pl-modal-item--open .pl-modal-item-expand svg { transform: rotate(180deg); }

/* Once a row is open, the collapsed preview hides so the full sentence
   below is the only copy of it on screen — a label fills the row instead
   so the header isn't left looking empty. */
.pl-modal-item-row-label {
	flex: 1;
	font-size: 10.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .5px;
	color: var(--pl-faint);
}

.pl-modal-item-detail {
	padding: 2px 14px 18px 46px;
	border-top: 1px dashed var(--pl-line);
}
.pl-modal-detail-sentence {
	font-size: 14.5px;
	line-height: 1.65;
	color: var(--pl-ink);
	margin-top: 12px;
	word-break: break-word;
}

.pl-modal-highlight {
	background: var(--pl-primary-tint2);
	color: var(--pl-primary-deep);
	border-bottom: 2px solid var(--pl-primary);
	font-weight: 600;
	border-radius: 3px;
	padding: 1px 3px;
}

/* Short-form badges: an icon/glyph, full description on hover — the old
   spelled-out labels ("Focus Keyword Match", "Embedding ranked") took as
   much room as the sentence once several could stack on one row. */
.pl-modal-chips {
	display: flex;
	gap: 6px;
	margin-top: 9px;
	flex-wrap: wrap;
}
.pl-modal-chip {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 3px;
	font-size: 11px;
	font-weight: 600;
	padding: 2px 8px;
	border-radius: 20px;
	cursor: default;
}
.pl-modal-chip--keyword { background: var(--pl-amber-l); color: var(--pl-amber); }
.pl-modal-chip--score   { background: var(--pl-green-l); color: var(--pl-green); }
.pl-modal-chip--emb     { background: var(--pl-primary-tint); color: var(--pl-primary); border: 1px solid var(--pl-primary-line); }
.pl-modal-chip--llm     { background: var(--pl-ink); color: #fff; }
.pl-modal-chip-tip {
	display: none;
	position: absolute;
	bottom: 130%;
	/* Left-anchored, not centered: a centered tooltip on a chip near the
	   modal's left edge extends past it and gets clipped by .pl-modal-list's
	   overflow:auto (invisible, not just cut off — the user can't scroll to
	   see it). Anchoring to the chip's own left edge only ever grows
	   rightward, where the modal has room. */
	left: 0;
	width: max-content;
	max-width: 190px;
	background: var(--pl-ink);
	color: #fff;
	font-size: 11px;
	font-weight: 400;
	padding: 6px 9px;
	border-radius: 6px;
	line-height: 1.4;
	white-space: normal;
	z-index: 5;
}
.pl-modal-chip:hover .pl-modal-chip-tip { display: block; }

/* ── Anchor range selector ─────────────────────────────────────────────── */
.pl-range-selector {
	display: block;            /* a separate control row, NOT inline with the sentence */
	margin-top: 11px;
	padding: 6px 10px;
	background: var(--pl-primary-tint);
	border: 1px solid var(--pl-primary-line);
	border-radius: 7px;
	font-size: 12px;
}

.pl-range-selector__row {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
}

.pl-range-selector__label {
	font-size: 11px;
	font-weight: 600;
	color: var(--pl-muted);
	margin-right: 4px;
}

.pl-range-selector__anchor {
	font-weight: 700;
	color: var(--pl-ink);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 280px;
}

.pl-range-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	padding: 0;
	background: var(--pl-surface);
	border: 1px solid var(--pl-primary-line);
	border-radius: 4px;
	cursor: pointer;
	color: var(--pl-primary);
	font-size: 12px;
	line-height: 1;
}

.pl-range-btn:hover { background: var(--pl-primary-tint); }
.pl-range-btn:disabled { opacity: 0.35; cursor: default; }

.pl-range-btn--reset {
	margin-left: 2px;
	color: var(--pl-muted);
}

/* ── Target section ───────────────────────────────────────────────────── */
/* Dismiss menu — sits beside the Insert button in the expanded card. */
.pl-modal-actions {
	display: flex;
	align-items: center;
	gap: 12px;
}
.pl-modal-dismiss {
	position: relative;
}
.pl-modal-dismiss-toggle {
	background: none;
	border: none;
	padding: 0;
	font-size: 12.5px;
	color: var(--pl-muted);
	cursor: pointer;
	text-decoration: none;
}
.pl-modal-dismiss-toggle:hover,
.pl-modal-dismiss-toggle:focus {
	color: var(--pl-ink-2);
	text-decoration: underline;
}
.pl-modal-dismiss-menu {
	position: absolute;
	right: 0;
	bottom: calc(100% + 6px);
	z-index: 10;
	min-width: 190px;
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid var(--pl-line);
	border-radius: 7px;
	box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
	overflow: hidden;
}
.pl-modal-dismiss-option {
	background: none;
	border: none;
	text-align: left;
	padding: 9px 13px;
	font-size: 12.5px;
	color: var(--pl-ink-2);
	cursor: pointer;
	white-space: nowrap;
}
.pl-modal-dismiss-option:hover,
.pl-modal-dismiss-option:focus {
	background: var(--pl-soft);
}

.pl-modal-detail-target {
	margin-top: 13px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding-top: 11px;
	border-top: 1px solid var(--pl-line);
}
.pl-modal-target-label {
	font-size: 10.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .5px;
	color: var(--pl-faint);
	margin-bottom: 3px;
}
.pl-modal-target-title {
	font-size: 13px;
	font-weight: 600;
	color: var(--pl-ink);
	line-height: 1.35;
	word-break: break-word;
}
.pl-modal-target-url {
	font-size: 11.5px;
	color: var(--pl-primary);
	background: var(--pl-primary-tint);
	border: 1px solid var(--pl-primary-line);
	border-radius: 999px;
	padding: 1px 8px;
	display: inline-block;
	margin-top: 3px;
	word-break: break-all;
	overflow-wrap: anywhere;
	line-height: 1.4;
}
.pl-modal-insert-btn {
	padding: 8px 16px;
	background: var(--pl-primary);
	color: #fff;
	border: 1px solid var(--pl-primary);
	border-radius: var(--pl-radius-sm);
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	flex: none;
	transition: background .15s;
}
.pl-modal-insert-btn:hover:not(:disabled) { background: var(--pl-primary-hover); }
.pl-modal-insert-btn--done  {
	background: var(--pl-green-l);
	border-color: var(--pl-green-line);
	color: var(--pl-green);
	cursor: default;
	display: inline-flex;
	gap: 6px;
	align-items: center;
	justify-content: center;
}
.pl-modal-insert-btn--error {
	background: var(--pl-red-l);
	border-color: var(--pl-red-line);
	color: var(--pl-red);
}
.pl-modal-insert-btn:disabled { opacity: .7; cursor: not-allowed; }
.pl-modal-already-linked {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	font-size: 12.5px;
	font-weight: 500;
	color: var(--pl-amber);
}
.pl-modal-unavailable {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 12.5px;
	font-weight: 500;
	color: var(--pl-danger);
	margin-bottom: 8px;
}

/* Modal footer */
.pl-modal-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 15px 22px;
	border-top: 1px solid var(--pl-line);
	background: var(--pl-soft);
	flex-shrink: 0;
}
.pl-modal-footer-info { font-size: 13px; color: var(--pl-muted); }
.pl-modal-footer-info b { color: var(--pl-ink); font-variant-numeric: tabular-nums; }
.pl-modal-footer-actions { display: flex; gap: 10px; }
.pl-modal-cancel-btn { }
.pl-modal-insert-all-btn {
	border: 1px solid var(--pl-primary) !important;
	background: var(--pl-primary) !important;
	color: #fff !important;
	font-weight: 500;
	font-size: 13px;
	padding: 8px 16px;
	border-radius: var(--pl-radius-sm);
	cursor: pointer;
}
.pl-modal-insert-all-btn:hover:not(:disabled) { background: var(--pl-primary-hover) !important; }
.pl-modal-insert-all-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ==========================================================================
   FOCUS RINGS + RESPONSIVE
   Scoped to the modal/overlay so they never leak to other admin UI.
   ========================================================================== */

.pl-modal-overlay :focus-visible,
#pl-overlay :focus-visible {
	outline: none;
	box-shadow: 0 0 0 1.5px var(--pl-surface), 0 0 0 3.5px var(--pl-primary);
}

@media (max-width: 600px) {
	.pl-modal-overlay,
	#pl-overlay { padding: 16px 10px; }
	.pl-modal { max-height: calc(100vh - 32px); }
	.pl-modal-header,
	.pl-modal-controls,
	.pl-modal-footer { flex-wrap: wrap; gap: 10px; }
	.pl-modal-list { padding: 12px; }
	.pl-modal-footer { flex-direction: column; align-items: stretch; }
	.pl-modal-insert-all-btn { width: 100%; }
	/* Collapse the three-column suggestion cards (Classic Editor overlay) to
	   a single column; the Gutenberg suggestion list's rows are already
	   flex-based and reflow on their own. */
	.pl-card { grid-template-columns: 1fr; }
	.pl-modal-detail-target { flex-direction: column; align-items: stretch; }
	.pl-modal-insert-btn { width: 100%; }
	.pl-modal-actions { flex-direction: column-reverse; align-items: stretch; gap: 8px; }
	.pl-modal-dismiss { text-align: center; }
	.pl-modal-dismiss-menu { left: 0; right: 0; }
}
