/* ==========================================================================
   GameBuddy prototype - components (FOUNDATION owns this file)
   Every class uses the platform prefix pd-. Module CSS must use its own prefix (st-, gm-, pl-, lb-, dv-, ad-, wl-, am-).
   Colors come from css/tokens.css only.
   ========================================================================== */

/* ---------- keycap ---------- */
.pd-kbd {
  display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 5px; flex: none;
  background: var(--bg-keycap); color: var(--text-2); font-family: var(--font-sans); font-size: var(--fs-xs); font-weight: 500; line-height: 1; box-shadow: var(--shadow-key);
}

/* ==========================================================================
   Button
   ========================================================================== */
.pd-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex: none;
  height: var(--control-h); padding: 0 12px; border-radius: var(--r-btn); border: 1px solid transparent;
  font-size: var(--fs-md); font-weight: 500; line-height: 1; white-space: nowrap; user-select: none; text-decoration: none; color: var(--text);
  transition: background var(--dur-1), border-color var(--dur-1), color var(--dur-1), box-shadow var(--dur-1), transform var(--dur-1), filter var(--dur-1);
}
.pd-btn:hover { text-decoration: none; }
.pd-btn--sm { height: var(--control-h-sm); padding: 0 10px; font-size: var(--fs-sm); gap: 6px; }
.pd-btn--lg { height: var(--control-h-lg); padding: 0 12px; font-size: var(--fs-base); border-radius: var(--r-inner); gap: 8px; }
.pd-btn--icon { padding: 0; width: var(--control-h); }
.pd-btn--icon.pd-btn--sm { width: var(--control-h-sm); }
.pd-btn--icon.pd-btn--lg { width: var(--control-h-lg); }
.pd-btn--block { display: flex; width: 100%; }
.pd-btn__label { overflow: hidden; text-overflow: ellipsis; }
.pd-btn .pd-kbd { margin-right: -4px; }

.pd-btn--primary {
  background: linear-gradient(180deg, var(--accent-top) 0%, var(--accent-bottom) 100%); color: var(--accent-fg); border-color: var(--accent-edge);
  box-shadow: inset 0 1px 0 var(--accent-hi), 0 1px 2px rgba(0, 0, 0, .28);
}
.pd-btn--primary:hover { filter: brightness(1.08); }
.pd-btn--primary:active { filter: brightness(.92); transform: translateY(.5px); box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25); }
.pd-btn--secondary { background: var(--bg-raised); border-color: var(--border); color: var(--text); }
.pd-btn--secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.pd-btn--secondary:active { background: var(--bg-active); }
.pd-btn--ghost { background: transparent; color: var(--text-2); }
.pd-btn--ghost:hover { background: var(--bg-hover); color: var(--text); }
.pd-btn--ghost:active { background: var(--bg-active); }
.pd-btn--soft { background: var(--accent-soft); color: var(--accent-text); }
.pd-btn--soft:hover { background: var(--accent-soft-2); }
.pd-btn--danger { background: var(--red-bg); color: var(--red-text); border-color: var(--red-border); }
.pd-btn--danger:hover { background: var(--red-solid); color: #fff; border-color: var(--red-solid); }
.pd-btn--danger:active { filter: brightness(.9); }
.pd-btn:disabled, .pd-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.pd-btn.is-loading { cursor: progress; }
.pd-btn__spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: pd-spin .7s linear infinite; flex: none; }
.pd-spinner { display: inline-block; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--accent); animation: pd-spin .7s linear infinite; }

/* ==========================================================================
   Chip, count, delta, tile
   ========================================================================== */
.pd-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--r-chip); flex: none;
  font-size: var(--fs-sm); font-weight: 500; line-height: 1; white-space: nowrap; background: var(--gray-bg); color: var(--gray-text); border: 1px solid transparent;
}
.pd-chip--sm { height: 20px; padding: 0 7px; font-size: var(--fs-xs); border-radius: 5px; }
.pd-chip--green { background: var(--green-bg); color: var(--green-text); }
.pd-chip--red { background: var(--red-bg); color: var(--red-text); }
.pd-chip--amber { background: var(--amber-bg); color: var(--amber-text); }
.pd-chip--purple { background: var(--purple-bg); color: var(--purple-text); }
.pd-chip--blue { background: var(--blue-bg); color: var(--blue-text); }
.pd-chip--orange { background: var(--orange-bg); color: var(--orange-text); }
.pd-chip--gray { background: var(--gray-bg); color: var(--gray-text); }
.pd-chip--accent { background: var(--accent-soft); color: var(--accent-text); }
.pd-chip--outline { background: transparent; border-color: currentColor; }
.pd-chip--dot .pd-chip__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pd-chip--btn { cursor: pointer; transition: filter var(--dur-1), border-color var(--dur-1); }
.pd-chip--btn:hover { filter: brightness(1.15); }
.pd-chip--btn[aria-pressed="true"] { border-color: currentColor; }
.pd-count {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 8px; flex: none;
  background: var(--bg-raised); border: 1px solid var(--border-subtle); color: var(--text-3); font-size: var(--fs-sm); font-weight: 500; font-variant-numeric: tabular-nums;
}
.pd-delta {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 9px 0 7px; border-radius: 8px; font-size: var(--fs-md); font-weight: 500;
  background: var(--bg-raised); border: 1px solid var(--border-subtle); color: var(--text); font-variant-numeric: tabular-nums;
}
.pd-delta--up svg { color: var(--green-text); }
.pd-delta--down svg { color: var(--red-text); }
.pd-delta--flat { color: var(--text-3); padding-left: 9px; }

.pd-tile {
  --tile-s: 24px; display: inline-grid; place-items: center; flex: none; width: var(--tile-s); height: var(--tile-s); border-radius: calc(var(--tile-s) * .29);
  color: #fff; background: var(--tile-blue); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 1px rgba(0, 0, 0, .25);
}
.pd-tile--blue { background: var(--tile-blue); }
.pd-tile--orange { background: var(--tile-orange); }
.pd-tile--green { background: var(--tile-green); }
.pd-tile--violet { background: var(--tile-violet); }
.pd-tile--red { background: var(--tile-red); }
.pd-tile--amber { background: var(--tile-amber); color: #2b1800; }
.pd-tile--gray { background: var(--tile-gray); }
.pd-tile--white { background: var(--tile-white); color: var(--tile-white-fg); }
.pd-tile--accent { background: linear-gradient(180deg, var(--accent-top), var(--accent-bottom)); color: var(--accent-fg); }
.pd-tile--soft { box-shadow: none; }
.pd-tile--soft.pd-tile--blue { background: var(--blue-bg); color: var(--blue-text); }
.pd-tile--soft.pd-tile--orange { background: var(--orange-bg); color: var(--orange-text); }
.pd-tile--soft.pd-tile--green { background: var(--green-bg); color: var(--green-text); }
.pd-tile--soft.pd-tile--violet { background: var(--purple-bg); color: var(--purple-text); }
.pd-tile--soft.pd-tile--red { background: var(--red-bg); color: var(--red-text); }
.pd-tile--soft.pd-tile--amber { background: var(--amber-bg); color: var(--amber-text); }
.pd-tile--soft.pd-tile--gray, .pd-tile--soft.pd-tile--white { background: var(--gray-bg); color: var(--gray-text); }
.pd-tile--soft.pd-tile--accent { background: var(--accent-soft); color: var(--accent-text); }
.pd-divider { border: 0; border-top: 1px solid var(--border-subtle); margin: var(--sp-4) 0; }
.pd-divider--v { border: 0; border-left: 1px solid var(--border-subtle); height: 1em; margin: 0 var(--sp-2); display: inline-block; }

/* ==========================================================================
   Card
   ========================================================================== */
.pd-card { display: block; position: relative; min-width: 0; padding: 20px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg-surface); color: inherit; }
.pd-card:hover { text-decoration: none; }
.pd-card--inner { border-radius: var(--r-inner); }
.pd-card--raised { background: var(--bg-raised); }
.pd-card--sunken { background: var(--bg-sunken); border-color: var(--border-subtle); }
.pd-card--pad-none, .pd-card--flush { padding: 0; }
.pd-card--pad-sm { padding: 12px; }
.pd-card--pad-md { padding: 20px; }
.pd-card--pad-lg { padding: 28px; }
.pd-card.is-interactive { cursor: pointer; transition: border-color var(--dur-2), transform var(--dur-2) var(--ease), box-shadow var(--dur-2); }
.pd-card.is-interactive:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.pd-card.is-interactive:active { transform: none; }
.pd-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.pd-card__heading { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pd-card__icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--bg-active); color: var(--text-2); flex: none; }
.pd-card__title { font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.pd-card__sub { margin-top: 2px; font-size: var(--fs-md); color: var(--text-3); }
.pd-card__actions { display: flex; align-items: center; gap: 8px; flex: none; }
.pd-card__foot { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-subtle); }
.pd-card--flush > .pd-card__head, .pd-card--pad-none > .pd-card__head { margin: 0; padding: 16px 20px; border-bottom: 1px solid var(--border-subtle); }
.pd-card--flush > .pd-card__foot, .pd-card--pad-none > .pd-card__foot { margin: 0; padding: 12px 20px; }
.pd-card--flush { overflow: hidden; }

/* ==========================================================================
   KPI card
   ========================================================================== */
.pd-kpi { display: flex; flex-direction: column; min-width: 0; min-height: 191px; padding: 14px 20px 12px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg-surface); }
.pd-kpi--compact { min-height: 0; padding-bottom: 16px; }
.pd-kpi.is-interactive { cursor: pointer; transition: border-color var(--dur-2); }
.pd-kpi.is-interactive:hover { border-color: var(--border-strong); }
.pd-kpi__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.pd-kpi__label { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--fs-base); font-weight: 500; color: var(--text-3); }
.pd-kpi__label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-kpi__action { display: flex; align-items: center; flex: none; }
.pd-kpi__value { margin-top: 18px; font-size: var(--fs-kpi); line-height: 1.1; font-weight: 600; letter-spacing: -.02em; color: var(--text); }
.pd-kpi__caption { margin-top: 6px; font-size: var(--fs-base); color: var(--text-3); }
.pd-kpi__visual { margin-top: auto; padding-top: 10px; min-width: 0; }
@media (min-width: 720px) and (max-width: 1023px) { .pd-kpi { padding-left: 16px; padding-right: 16px; } }
.pd-kpi .pd-kpi__menu, .pd-kcol .pd-kcol__menu { color: var(--text); }
.pd-kcol .pd-kcol__menu { margin-right: -2px; }
.pd-kpi__arrow {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--text); background: var(--bg-raised); border: 1px solid var(--border);
  transition: background var(--dur-1), border-color var(--dur-1), transform var(--dur-1);
}
.pd-kpi__arrow:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.pd-kpi__arrow:active { transform: scale(.94); }

/* ==========================================================================
   Progress
   ========================================================================== */
.pd-progress { position: relative; display: flex; width: 100%; height: 8px; overflow: hidden; border-radius: 999px; background: var(--bg-track); }
.pd-progress--thin { height: 4px; }
.pd-progress--sm { height: 6px; }
.pd-progress--md { height: 8px; }
.pd-progress--lg { height: 14px; border-radius: 4px; }
.pd-progress--multi { gap: 2px; }
.pd-progress__fill, .pd-progress__seg { position: relative; display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width var(--dur-3) var(--ease); }
.pd-progress__seg { border-radius: 2px; flex: none; }
.pd-progress__fill--accent { background: var(--accent); }
.pd-progress__fill--green { background: var(--green-solid); }
.pd-progress__fill--purple { background: var(--purple-solid); }
.pd-progress__fill--orange { background: var(--orange-solid); }
.pd-progress__fill--red { background: var(--red-solid); }
.pd-progress__fill--amber { background: var(--amber-solid); }
.pd-progress__fill--blue { background: var(--blue-solid); }
.pd-progress__fill--gray { background: var(--gray-solid); }
.pd-progress__marker { position: absolute; top: 50%; width: 3px; height: 3px; border-radius: 50%; background: #fff; transform: translateY(-50%); left: 2px; }
.pd-progress__marker--end { left: auto; right: 2px; }
.pd-progress--lg .pd-progress__marker { width: 10px; height: 10px; border-radius: 3px; left: 3px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .08); }
.pd-progress--lg .pd-progress__marker--end { left: auto; right: 3px; }
.pd-progress-wrap__head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: var(--fs-sm); color: var(--text-3); }
.pd-cell-progress { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.pd-cell-progress .pd-progress { flex: 1; }
.pd-cell-progress .pd-num { width: 34px; text-align: right; font-size: var(--fs-sm); }

/* ==========================================================================
   Tabs and segmented control
   ========================================================================== */
.pd-tabs { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.pd-tabs::-webkit-scrollbar { display: none; }
.pd-tab {
  display: inline-flex; align-items: center; gap: 7px; flex: none; height: 40px; padding: 0 12px; border-radius: var(--r-inner); border: 1px solid transparent;
  font-size: var(--fs-base); font-weight: 500; color: var(--text-3); white-space: nowrap; transition: background var(--dur-1), color var(--dur-1), box-shadow var(--dur-1);
}
.pd-tab:hover { color: var(--text); background: var(--bg-hover); }
.pd-tab.is-active { background: var(--bg-active); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .18), inset 0 0 0 1px var(--border-subtle); }
.pd-tab svg { flex: none; }
.pd-tab:focus-visible { outline-offset: -2px; }       /* the strip scrolls (overflow), so an outer ring would be cut off */
.pd-tabs--underline { gap: 20px; border-bottom: 1px solid var(--border); width: 100%; }
.pd-tabs--underline .pd-tab { height: 40px; padding: 0 2px; border-radius: 0; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.pd-tabs--underline .pd-tab:hover { background: none; }
.pd-tabs--underline .pd-tab.is-active { background: none; box-shadow: none; border-bottom-color: var(--accent); }
.pd-seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: var(--r-inner); background: var(--bg-sunken); border: 1px solid var(--border-subtle); }
.pd-seg__btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: var(--r-btn); font-size: var(--fs-md); font-weight: 500; color: var(--text-3); transition: background var(--dur-1), color var(--dur-1); white-space: nowrap; }
.pd-seg--sm .pd-seg__btn { height: 26px; padding: 0 10px; font-size: var(--fs-sm); }
.pd-seg__btn:hover { color: var(--text); }
.pd-seg__btn.is-active { background: var(--bg-seg-active); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }

/* ==========================================================================
   Table
   ========================================================================== */
.pd-table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
.pd-table-wrap--sticky { overflow: auto; }
/* scroll hint (ui.Table sets has-more-left / has-more-right): the edge on the side where more of the table is hidden fades out, but never to nothing, so a button there stays findable */
.pd-table-wrap { --pd-fade: 28px; --pd-fade-end: rgba(0, 0, 0, .2); }
.pd-table-wrap.has-more-right { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - var(--pd-fade)), var(--pd-fade-end)); mask-image: linear-gradient(to right, #000 calc(100% - var(--pd-fade)), var(--pd-fade-end)); }
.pd-table-wrap.has-more-left { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - var(--pd-fade)), var(--pd-fade-end)); mask-image: linear-gradient(to left, #000 calc(100% - var(--pd-fade)), var(--pd-fade-end)); }
.pd-table-wrap.has-more-left.has-more-right { -webkit-mask-image: linear-gradient(to right, var(--pd-fade-end), #000 var(--pd-fade), #000 calc(100% - var(--pd-fade)), var(--pd-fade-end)); mask-image: linear-gradient(to right, var(--pd-fade-end), #000 var(--pd-fade), #000 calc(100% - var(--pd-fade)), var(--pd-fade-end)); }
.pd-table { width: 100%; font-size: var(--fs-md); border-collapse: separate; border-spacing: 0; }
.pd-table th {
  padding: 10px 16px; text-align: left; font-size: var(--fs-sm); font-weight: 500; color: var(--text-3); white-space: nowrap;
  background: var(--bg-sunken); border-bottom: 1px solid var(--border);
}
.pd-table-wrap--sticky th { position: sticky; top: 0; z-index: 1; }
.pd-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); color: var(--text-2); vertical-align: middle; }
.pd-table-wrap--dense td { padding: 8px 12px; }
.pd-table tbody tr:last-child td { border-bottom: 0; }
.pd-table tbody tr:hover td { background: var(--bg-hover); }
.pd-table tr.is-clickable { cursor: pointer; }
.pd-table tr.is-clickable:focus-visible { outline-offset: -2px; }
.pd-table .pd-table__empty:hover td { background: none; }
.pd-ta-right { text-align: right !important; }
.pd-ta-center { text-align: center !important; }
.pd-th-btn { display: inline-flex; align-items: center; gap: 4px; font: inherit; font-weight: 500; color: inherit; border-radius: 4px; }
.pd-th-btn:hover { color: var(--text); }
.pd-ta-right .pd-th-btn { flex-direction: row-reverse; }
.pd-th-ico { opacity: .6; }
th[aria-sort="ascending"] .pd-th-ico, th[aria-sort="descending"] .pd-th-ico { opacity: 1; color: var(--accent-text); }
.pd-cell-game { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); }
.pd-cell-game:hover { text-decoration: none; }
.pd-cell-game .pd-cell-game__cover { width: 36px; flex: none; border-radius: 8px; }
.pd-cell-game__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.pd-cell-game__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-cell-game__sub { font-size: var(--fs-sm); color: var(--text-3); }

/* ==========================================================================
   Kanban
   ========================================================================== */
.pd-kcol { min-width: 0; padding: 3px 7px 8px; background: var(--bg-sunken); border: 1px solid var(--border-subtle); border-radius: var(--r-card); }
.pd-kcol__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 34px; margin-bottom: 2px; padding-left: 5px; }
.pd-kcol__title { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text); }
.pd-kcol__title svg { color: var(--text-2); flex: none; }
.pd-kcol__title h3 { font-size: var(--fs-base); font-weight: 600; letter-spacing: -.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-kcol__cards { display: flex; flex-direction: column; gap: 8px; }
.pd-kcol__empty { padding: 24px 12px; text-align: center; font-size: var(--fs-md); color: var(--text-4); }
.pd-kcard { position: relative; display: block; padding: 12px 14px 13px; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-inner); color: inherit; }
.pd-kcard:hover { text-decoration: none; }
.pd-kcard.is-interactive { cursor: pointer; transition: border-color var(--dur-2), transform var(--dur-2) var(--ease), box-shadow var(--dur-2); }
.pd-kcard.is-interactive:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.pd-kcard.is-interactive:active { transform: none; box-shadow: none; }
/* the category line and the status chip share a row; when the category does not fit beside the chip, the chip drops to its own line (right aligned) and the category keeps its whole words */
.pd-kcard__top { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 6px 8px; min-height: 22px; }
.pd-kcard__top > .pd-chip { flex: none; margin-left: auto; }
.pd-kcard__cat { display: inline-flex; align-items: flex-start; gap: 6px; min-width: 0; max-width: 100%; padding-top: 2px; font-size: var(--fs-sm); line-height: 18px; font-weight: 500; letter-spacing: .01em; text-transform: uppercase; color: var(--text-4); }
.pd-kcard__cat span { min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pd-kcard__cat svg { flex: none; margin-top: 2px; }
.pd-kcard__title { margin-top: 16px; font-size: 15px; font-weight: 400; line-height: 20px; color: var(--text-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-kcard__amount { margin-top: 4px; font-size: var(--fs-2xl); line-height: 28px; font-weight: 700; letter-spacing: -.02em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-kcard__of { margin-left: 6px; font-size: var(--fs-base); font-weight: 400; letter-spacing: 0; color: var(--text-4); }
.pd-kcard__rule { height: 1px; margin-top: 18px; background: var(--border-subtle); }
.pd-kcard__bar { display: flex; align-items: center; height: 1px; margin-top: 18px; }
.pd-kcard__bar .pd-progress { flex: none; }
.pd-kcard__foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; font-size: var(--fs-xs); line-height: 18px; color: var(--text-3); }
.pd-kcard__date { display: inline-flex; align-items: center; gap: 6px; flex: 0 1 auto; min-width: 0; overflow: hidden; color: var(--text-2); white-space: nowrap; }
.pd-kcard__date > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.pd-kcard__date svg { flex: none; color: var(--text-3); }
.pd-kcard__prefix { color: var(--text-4); }
.pd-kcard__strong { color: var(--text); font-weight: 500; }
.pd-kcard__meta { flex: 0 1 auto; min-width: 0; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ==========================================================================
   Avatar, cover, game card, rating
   ========================================================================== */
.pd-avatar {
  --av-s: 32px; position: relative; display: inline-grid; place-items: center; flex: none; width: var(--av-s); height: var(--av-s); border-radius: 50%; overflow: hidden;
  color: #fff; font-size: calc(var(--av-s) * .38); font-weight: 600; letter-spacing: 0; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); background-color: var(--bg-active);
}
.pd-avatar--rounded { border-radius: calc(var(--av-s) * .25); }
.pd-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pd-avstack { display: inline-flex; align-items: center; }
.pd-avstack__item { box-shadow: 0 0 0 2px var(--bg-canvas); }
.pd-avstack__item + .pd-avstack__item { margin-left: -8px; }
.pd-avstack__more { display: inline-grid; place-items: center; width: var(--av-s, 28px); height: var(--av-s, 28px); border-radius: 50%; background: var(--bg-keycap); color: var(--text-2); font-size: var(--fs-xs); font-weight: 500; }
.pd-cover { position: relative; width: 100%; overflow: hidden; border-radius: var(--r-inner); background: var(--bg-active); }
.pd-cover--flat { border-radius: 0; }
.pd-cover svg { display: block; width: 100%; height: 100%; }

.pd-gcard { position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden; background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-card); transition: border-color var(--dur-2), transform var(--dur-2) var(--ease), box-shadow var(--dur-2); }
.pd-gcard:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.pd-gcard:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.pd-gcard__media { position: relative; }
.pd-gcard__cover { border-radius: 0; }
.pd-gcard__chips { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.pd-gcard__chips .pd-chip { background: rgba(10, 10, 14, .74); color: #fff; backdrop-filter: blur(6px); }
.pd-gcard__chips .pd-chip--amber { color: #ffd37a; }
.pd-gcard__rank { position: absolute; top: 8px; right: 8px; display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: 16px; background: rgba(12, 12, 16, .66); font-size: 17px; font-weight: 700; line-height: 1; color: #fff; box-shadow: 0 0 0 1px rgba(255, 255, 255, .16); }
.pd-gcard__body { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px 14px; min-width: 0; }
.pd-gcard__link { color: var(--text); font-size: var(--fs-base); font-weight: 600; letter-spacing: -.005em; min-width: 0; }
.pd-gcard__link:hover { text-decoration: none; }
.pd-gcard__link::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.pd-gcard__link:focus-visible { outline: none; }
.pd-gcard__title { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-gcard__tagline { font-size: var(--fs-md); color: var(--text-3); }
.pd-gcard__desc { font-size: var(--fs-md); color: var(--text-3); margin-top: 4px; }
.pd-gcard__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pd-gcard__meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: var(--fs-sm); color: var(--text-3); min-width: 0; }
.pd-gcard__sep { width: 3px; height: 3px; border-radius: 50%; background: var(--text-4); flex: none; }
.pd-gcard__genre { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-gcard__plays { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.pd-gcard__actions { position: relative; z-index: 2; margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.pd-gcard__dev { font-size: var(--fs-sm); color: var(--text-4); }
.pd-gcard--compact { flex-direction: row; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; }
.pd-gcard--compact .pd-gcard__cover { width: 52px; flex: none; border-radius: 10px; }
.pd-gcard--compact .pd-gcard__body { flex: 1; padding: 0; }
.pd-gcard--compact .pd-gcard__meta { margin-top: 2px; }
.pd-gcard--compact:hover { transform: none; }
.pd-gcard--compact .pd-gcard__actions { position: relative; z-index: 2; margin: 0; }
.pd-gcard--wide { flex-direction: row; }
.pd-gcard--wide .pd-gcard__media { flex: 0 0 44%; max-width: 420px; }
.pd-gcard--wide .pd-gcard__cover { height: 100%; aspect-ratio: auto !important; min-height: 180px; }
.pd-gcard--wide .pd-gcard__body { flex: 1; padding: 18px 20px; justify-content: center; }
.pd-gcard--wide .pd-gcard__link { font-size: var(--fs-xl); }
.pd-gcard--sponsored { border-color: var(--amber-border); }
.pd-rating { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-3); }
.pd-rating__stars { position: relative; display: inline-flex; }
.pd-rating__off { color: var(--border-strong); flex: none; }
.pd-rating__fill { position: absolute; left: 0; top: 0; height: 100%; display: flex; overflow: hidden; }
.pd-rating__on { color: var(--amber-solid); flex: none; }
.pd-rating__value { color: var(--text); font-weight: 600; }
.pd-rating--compact { gap: 4px; }
.pd-rating--compact svg { color: var(--amber-solid); }
.pd-rating--input { gap: 2px; }
.pd-rating__btn { display: grid; place-items: center; color: var(--border-strong); border-radius: 6px; padding: 2px; transition: color var(--dur-1), transform var(--dur-1); }
.pd-rating__btn.is-on { color: var(--amber-solid); }
.pd-rating__btn:hover { transform: scale(1.12); }

/* ==========================================================================
   Breadcrumbs
   ========================================================================== */
.pd-crumbs__list { display: flex; align-items: center; gap: 4px; min-width: 0; }
.pd-crumbs__item { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 0 1 auto; }
/* when the trail does not fit, the current page (often a long name) shortens first; the parents keep a readable stub of at least 9 characters.
   The full text of a shortened crumb is its tooltip (ui.clip). */
.pd-crumbs__item:not(:last-child) { flex-shrink: .2; min-width: min(100%, 9ch); }
.pd-crumbs__item:last-child { flex-shrink: 5; min-width: min(100%, 12ch); }
.pd-crumb { display: inline-flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; font-size: var(--fs-base); font-weight: 500; color: var(--text-3); white-space: nowrap; min-width: 0; }
a.pd-crumb:hover { color: var(--text); background: var(--bg-hover); text-decoration: none; }
.pd-crumb.is-current { color: var(--text); font-weight: 600; }
.pd-crumb__label { overflow: hidden; text-overflow: ellipsis; max-width: 28ch; }
.pd-crumb__ico { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--bg-active); color: var(--text-2); flex: none; }
.pd-crumb__ico.is-current { border-radius: 50%; background: var(--text); color: var(--bg-canvas); }
.pd-crumbs__sep { color: var(--text-4); flex: none; }

/* ==========================================================================
   Feedback and content blocks
   ========================================================================== */
.pd-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 44px 20px; }
.pd-empty--compact { padding: 24px 16px; gap: 6px; }
.pd-empty__icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 4px; border-radius: 14px; background: var(--bg-active); color: var(--text-3); border: 1px solid var(--border); }
.pd-empty--compact .pd-empty__icon { width: 36px; height: 36px; border-radius: 10px; }
.pd-empty__icon--red { background: var(--red-bg); color: var(--red-text); border-color: var(--red-border); }
.pd-empty__icon--accent { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-ring); }
.pd-empty__icon--green { background: var(--green-bg); color: var(--green-text); border-color: var(--green-border); }
.pd-empty__title { font-size: var(--fs-lg); font-weight: 600; }
.pd-empty__text { max-width: 420px; font-size: var(--fs-md); color: var(--text-3); }
.pd-empty__action { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pd-skel { display: block; border-radius: 6px; background-color: var(--bg-skeleton); background-image: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .06) 50%, transparent 80%); background-size: 200% 100%; animation: pd-shimmer 1.6s linear infinite; }
.pd-skel--text { height: 12px; width: 100%; }
.pd-skel--block { height: 40px; width: 100%; border-radius: 10px; }
.pd-skel--card { height: 160px; width: 100%; border-radius: var(--r-card); }
.pd-skel--circle { width: 40px; height: 40px; border-radius: 50%; }
.pd-skel-stack { display: flex; flex-direction: column; gap: 8px; }
.pd-callout { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: var(--r-inner); border: 1px solid var(--blue-border); background: var(--blue-bg); color: var(--text-2); font-size: var(--fs-md); line-height: 1.5; }
.pd-callout__icon { flex: none; margin-top: 1px; color: var(--blue-text); }
.pd-callout__body { flex: 1; min-width: 0; }
.pd-callout__title { color: var(--text); font-weight: 600; margin-bottom: 2px; }
.pd-callout__action { flex: none; }
.pd-callout__close { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; color: var(--text-3); }
.pd-callout__close:hover { background: var(--bg-active); color: var(--text); }
.pd-callout--warn { border-color: var(--amber-border); background: var(--amber-bg); } .pd-callout--warn .pd-callout__icon { color: var(--amber-text); }
.pd-callout--success { border-color: var(--green-border); background: var(--green-bg); } .pd-callout--success .pd-callout__icon { color: var(--green-text); }
.pd-callout--danger { border-color: var(--red-border); background: var(--red-bg); } .pd-callout--danger .pd-callout__icon { color: var(--red-text); }
.pd-timeline { display: flex; flex-direction: column; }
.pd-tl-item { position: relative; display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 12px; padding-bottom: 18px; }
.pd-tl-item::before { content: ''; position: absolute; left: 11.5px; top: 26px; bottom: 2px; width: 1px; background: var(--border); }
.pd-tl-item:last-child { padding-bottom: 0; }
.pd-tl-item:last-child::before { display: none; }
.pd-tl-dot { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--gray-bg); color: var(--gray-text); border: 1px solid var(--gray-border); }
.pd-tl-item--green .pd-tl-dot { background: var(--green-bg); color: var(--green-text); border-color: var(--green-border); }
.pd-tl-item--red .pd-tl-dot { background: var(--red-bg); color: var(--red-text); border-color: var(--red-border); }
.pd-tl-item--amber .pd-tl-dot { background: var(--amber-bg); color: var(--amber-text); border-color: var(--amber-border); }
.pd-tl-item--purple .pd-tl-dot { background: var(--purple-bg); color: var(--purple-text); border-color: var(--purple-border); }
.pd-tl-item--blue .pd-tl-dot { background: var(--blue-bg); color: var(--blue-text); border-color: var(--blue-border); }
.pd-tl-title { font-size: var(--fs-md); font-weight: 600; color: var(--text); line-height: 1.4; padding-top: 2px; }
.pd-tl-text { font-size: var(--fs-md); color: var(--text-3); margin-top: 2px; }
.pd-tl-time { font-size: var(--fs-sm); color: var(--text-4); white-space: nowrap; padding-top: 3px; }
.pd-statrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-card); overflow: hidden; }
.pd-stat { padding: 16px 20px; border-right: 1px solid var(--border-subtle); min-width: 0; }
.pd-stat:last-child { border-right: 0; }
.pd-stat__label { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--text-3); font-weight: 500; }
.pd-stat__value { margin-top: 6px; font-size: 24px; line-height: 1.15; font-weight: 600; letter-spacing: -.02em; white-space: nowrap; }
.pd-stat__foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.pd-stat__hint { font-size: var(--fs-sm); color: var(--text-3); }
.pd-kv { display: flex; flex-direction: column; }
.pd-kv__row { display: grid; grid-template-columns: minmax(110px, 36%) minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border-subtle); font-size: var(--fs-md); }
.pd-kv__row:last-child { border-bottom: 0; }
.pd-kv dt { color: var(--text-3); }
.pd-kv dd { color: var(--text); }
.pd-kv--dense .pd-kv__row { padding: 6px 0; }
.pd-kv--2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
.pd-code { margin: 0; border: 1px solid var(--border); border-radius: var(--r-inner); background: var(--bg-sunken); overflow: hidden; }
.pd-code__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 4px 14px; border-bottom: 1px solid var(--border-subtle); font-size: var(--fs-xs); font-weight: 600; letter-spacing: .06em; color: var(--text-3); }
.pd-code__pre { margin: 0; padding: 14px 16px; overflow: auto; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.65; color: var(--text-2); tab-size: 2; }
.pd-code--wrap .pd-code__pre { white-space: pre-wrap; word-break: break-word; }
.pd-tok-k { color: var(--purple-text); } .pd-tok-s { color: var(--green-text); } .pd-tok-c { color: var(--text-4); font-style: italic; } .pd-tok-n { color: var(--amber-text); }
.pd-pager { display: inline-flex; align-items: center; gap: 4px; }
.pd-pager__btn { min-width: 32px; height: 32px; padding: 0 8px; border-radius: var(--r-btn); font-size: var(--fs-md); font-weight: 500; color: var(--text-3); transition: background var(--dur-1), color var(--dur-1); }
.pd-pager__btn:hover { background: var(--bg-hover); color: var(--text); }
.pd-pager__btn.is-active { background: var(--bg-active); color: var(--text); }
.pd-pager__gap { padding: 0 4px; color: var(--text-4); }
.pd-loadmore { display: flex; justify-content: center; padding: 8px 0; }

/* ==========================================================================
   Forms
   ========================================================================== */
.pd-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pd-field__label { font-size: var(--fs-md); font-weight: 500; color: var(--text-2); }
.pd-field__req { color: var(--red-text); }
.pd-field__opt { color: var(--text-4); font-weight: 400; }
.pd-field__hint { font-size: var(--fs-sm); color: var(--text-3); }
.pd-field__error { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--red-text); }
.pd-field--inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
.pd-input, .pd-select, .pd-textarea { position: relative; }
.pd-input { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--r-input); transition: border-color var(--dur-1), box-shadow var(--dur-1); }
.pd-input--sm { height: var(--control-h); padding: 0 10px; }
.pd-input--lg { height: 48px; }
.pd-input:hover { border-color: var(--border-strong); }
.pd-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.pd-input.is-invalid { border-color: var(--red-solid); }
.pd-input.is-invalid:focus-within { box-shadow: 0 0 0 3px var(--red-bg); }
.pd-input.is-disabled { opacity: .55; }
.pd-input__el { flex: 1; min-width: 0; height: 100%; padding: 0; background: none; border: 0; outline: none !important; color: var(--text); font-size: var(--fs-base); }
.pd-input__el::placeholder, .pd-textarea__el::placeholder { color: var(--text-4); }
.pd-input__el::-webkit-search-cancel-button { display: none; }
.pd-input__icon { display: grid; place-items: center; color: var(--text-4); flex: none; }
.pd-input__affix { color: var(--text-3); font-size: var(--fs-md); white-space: nowrap; flex: none; }
.pd-input__clear { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; color: var(--text-3); flex: none; }
.pd-input__clear:hover { background: var(--bg-active); color: var(--text); }
.pd-textarea__el { display: block; width: 100%; min-height: 96px; padding: 10px 12px; resize: vertical; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--r-input); color: var(--text); font-size: var(--fs-base); line-height: 1.5; outline: none !important; transition: border-color var(--dur-1), box-shadow var(--dur-1); }
.pd-textarea__el:hover { border-color: var(--border-strong); }
.pd-textarea__el:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.pd-textarea.is-invalid .pd-textarea__el { border-color: var(--red-solid); }
.pd-textarea__count { position: absolute; right: 10px; bottom: 8px; font-size: var(--fs-xs); color: var(--text-4); pointer-events: none; }
.pd-select { display: flex; align-items: center; }
.pd-select__el { appearance: none; -webkit-appearance: none; width: 100%; height: 40px; padding: 0 36px 0 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--r-input); color: var(--text); font-size: var(--fs-base); cursor: pointer; outline: none !important; transition: border-color var(--dur-1), box-shadow var(--dur-1); }
.pd-select--sm .pd-select__el { height: var(--control-h); font-size: var(--fs-md); }
.pd-select__el:hover { border-color: var(--border-strong); }
.pd-select__el:focus-visible { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.pd-select__el option { background: var(--bg-popover); color: var(--text); }
.pd-select__chev { position: absolute; right: 12px; pointer-events: none; color: var(--text-3); display: grid; }
.pd-select__icon { position: absolute; left: 12px; pointer-events: none; color: var(--text-4); display: grid; }
.pd-select__icon + .pd-select__el { padding-left: 36px; }
.pd-select.is-invalid .pd-select__el { border-color: var(--red-solid); }
.pd-toggle, .pd-check, .pd-radio { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; position: relative; }
.pd-toggle.is-disabled, .pd-check.is-disabled, .pd-radio.is-disabled { opacity: .5; cursor: not-allowed; }
.pd-toggle__input, .pd-check__input, .pd-radio__input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.pd-toggle__track { position: relative; flex: none; width: 36px; height: 20px; margin-top: 1px; border-radius: 999px; background: var(--border-strong); transition: background var(--dur-2); }
.pd-toggle__thumb { position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .35); transition: transform var(--dur-2) var(--ease); }
.pd-toggle__input:checked + .pd-toggle__track { background: var(--accent); }
.pd-toggle__input:checked + .pd-toggle__track .pd-toggle__thumb { transform: translateX(16px); }
.pd-toggle__input:focus-visible + .pd-toggle__track, .pd-check__input:focus-visible + .pd-check__box, .pd-radio__input:focus-visible + .pd-radio__dot { outline: 2px solid var(--focus); outline-offset: 2px; }
.pd-toggle__text, .pd-check__text, .pd-radio__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pd-toggle__label, .pd-check__label, .pd-radio__label { font-size: var(--fs-base); color: var(--text); line-height: 20px; }
.pd-toggle__desc, .pd-check__desc, .pd-radio__desc { font-size: var(--fs-sm); color: var(--text-3); }
.pd-check__box { position: relative; flex: none; display: grid; place-items: center; width: 18px; height: 18px; margin-top: 1px; border-radius: 5px; border: 1.5px solid var(--border-strong); background: var(--bg-input); color: var(--accent-fg); transition: background var(--dur-1), border-color var(--dur-1); }
.pd-check__tick, .pd-check__dash { opacity: 0; transition: opacity var(--dur-1); }
.pd-check__dash { position: absolute; width: 8px; height: 2px; border-radius: 1px; background: currentColor; }
.pd-check:hover .pd-check__box { border-color: var(--text-3); }
.pd-check__input:checked + .pd-check__box, .pd-check__input:indeterminate + .pd-check__box { background: var(--accent); border-color: var(--accent); }
.pd-check__input:checked + .pd-check__box .pd-check__tick { opacity: 1; }
.pd-check__input:indeterminate + .pd-check__box .pd-check__dash { opacity: 1; }
.pd-radios { display: flex; flex-direction: column; gap: 10px; }
.pd-radios--inline { flex-direction: row; flex-wrap: wrap; gap: 16px; }
.pd-radio__dot { position: relative; flex: none; width: 18px; height: 18px; margin-top: 1px; border-radius: 50%; border: 1.5px solid var(--border-strong); background: var(--bg-input); transition: border-color var(--dur-1); }
.pd-radio__dot::after { content: ''; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform var(--dur-2) var(--ease); }
.pd-radio__input:checked + .pd-radio__dot { border-color: var(--accent); }
.pd-radio__input:checked + .pd-radio__dot::after { transform: scale(1); }
.pd-radios--cards { gap: 8px; }
.pd-radios--cards .pd-radio { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-inner); background: var(--bg-surface); transition: border-color var(--dur-1), background var(--dur-1); }
.pd-radios--cards .pd-radio:hover { border-color: var(--border-strong); }
.pd-radios--cards .pd-radio:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.pd-slider { display: flex; flex-direction: column; gap: 8px; }
.pd-slider__head { display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-md); color: var(--text-2); }
.pd-slider__value { font-weight: 600; color: var(--text); }
.pd-slider__el { --pct: 50%; -webkit-appearance: none; appearance: none; width: 100%; height: 20px; margin: 0; background: transparent; cursor: pointer; }
.pd-slider__el::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) var(--pct), var(--bg-track) var(--pct)); }
.pd-slider__el::-moz-range-track { height: 6px; border-radius: 3px; background: var(--bg-track); }
.pd-slider__el::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
.pd-slider__el::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform var(--dur-1); }
.pd-slider__el::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--accent); }
.pd-slider__el:active::-webkit-slider-thumb { transform: scale(1.15); }
.pd-slider__marks { display: flex; justify-content: space-between; font-size: var(--fs-xs); color: var(--text-4); }
.pd-slider.is-disabled { opacity: .5; }
.pd-drop { display: flex; align-items: center; justify-content: center; min-height: 168px; padding: 24px; text-align: center; border: 1.5px dashed var(--border-strong); border-radius: var(--r-card); background: var(--bg-sunken); cursor: pointer; transition: border-color var(--dur-2), background var(--dur-2); }
.pd-drop:hover { border-color: var(--text-4); }
.pd-drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.pd-drop.is-disabled { opacity: .5; cursor: not-allowed; }
.pd-drop[data-state="error"] { border-color: var(--red-solid); }
.pd-drop[data-state="done"] { border-style: solid; border-color: var(--green-solid); }
.pd-drop__inner { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; max-width: 360px; }
.pd-drop__icon { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 4px; border-radius: 12px; background: var(--bg-active); color: var(--text-2); border: 1px solid var(--border); }
.pd-drop__icon--error { background: var(--red-bg); color: var(--red-text); border-color: var(--red-border); }
.pd-drop__icon--done { background: var(--green-bg); color: var(--green-text); border-color: var(--green-border); }
.pd-drop__title { font-size: var(--fs-base); font-weight: 600; word-break: break-all; }
.pd-drop__hint { font-size: var(--fs-md); color: var(--text-3); margin-bottom: 6px; }
.pd-drop__msg { font-size: var(--fs-md); color: var(--text-2); }
.pd-drop__msg.is-error { color: var(--red-text); }
.pd-drop .pd-progress { margin-top: 6px; }
.pd-stepper { display: flex; align-items: flex-start; gap: 0; width: 100%; }
.pd-step { position: relative; flex: 1; min-width: 0; }
.pd-step::after { content: ''; position: absolute; top: 13px; left: calc(50% + 20px); right: calc(-50% + 20px); height: 2px; background: var(--border); border-radius: 1px; }
.pd-step:last-child::after { display: none; }
.pd-step.is-done::after { background: var(--accent); }
.pd-step__btn { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; text-align: center; color: inherit; border-radius: 8px; }
.pd-step__dot { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--bg-surface); color: var(--text-3); font-size: var(--fs-sm); font-weight: 600; position: relative; z-index: 1; transition: background var(--dur-2), border-color var(--dur-2); }
.pd-step.is-current .pd-step__dot { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 4px var(--accent-soft); }
.pd-step.is-done .pd-step__dot { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.pd-step__text { display: flex; flex-direction: column; gap: 2px; }
.pd-step__label { font-size: var(--fs-md); font-weight: 500; color: var(--text-3); }
.pd-step.is-current .pd-step__label, .pd-step.is-done .pd-step__label { color: var(--text); }
.pd-step__hint { font-size: var(--fs-xs); color: var(--text-4); }
.pd-stepper--v { flex-direction: column; gap: 4px; }
.pd-stepper--v .pd-step::after { display: none; }
.pd-stepper--v .pd-step__btn { flex-direction: row; text-align: left; }

/* ==========================================================================
   Charts
   ========================================================================== */
.pd-dots, .pd-bars { width: 100%; overflow: hidden; }
.pd-dots svg, .pd-bars svg, .pd-lchart svg { display: block; }
.pd-dot { fill: var(--dot-off); }
.pd-dot--on { fill: var(--dot-on); }
/* dark theme: highlighted dots are a lighter, peachy tint of the tone (as in the reference); falls back to the plain tone without color-mix */
:root[data-theme="dark"] .pd-dot--on { fill: color-mix(in srgb, var(--dot-on) 58%, #fff); }
.pd-bar { fill: var(--bar-off); }
.pd-bar--on { fill: var(--bar-on); }
.pd-spark { width: 100%; }
.pd-spark svg { display: block; width: 100%; height: 100%; }
.pd-legend { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.pd-legend--inline { flex-direction: row; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; }
.pd-legend__item { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); color: var(--text-2); }
.pd-legend__dot { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.pd-legend__value { margin-left: auto; padding-left: 16px; color: var(--text-3); font-size: var(--fs-sm); white-space: nowrap; }
.pd-donut { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.pd-donut__chart { position: relative; flex: none; }
.pd-donut__track { stroke: var(--bg-track); }
.pd-donut__center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.pd-donut__value { font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.pd-donut__label { font-size: var(--fs-xs); color: var(--text-3); }
.pd-donut .pd-legend { flex: 1; min-width: 160px; }
.pd-sbars { position: relative; }
.pd-sbars__plot { position: relative; }
.pd-sbars__grid { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.pd-sbars__line { position: relative; height: 0; margin-left: 44px; border-top: 1px solid var(--chart-grid); }
.pd-sbars__y { position: absolute; left: -44px; top: -8px; width: 38px; text-align: right; font-size: var(--fs-xs); color: var(--chart-axis); }
.pd-sbars__cols { position: absolute; inset: 0 0 0 44px; display: grid; gap: 4px; align-items: stretch; }
.pd-sbars__col { display: flex; align-items: flex-end; justify-content: center; height: 100%; border-radius: 4px; }
.pd-sbars__col:hover, .pd-sbars__col:focus-visible { background: var(--bg-hover); }
.pd-sbars__stack { display: flex; flex-direction: column-reverse; width: 72%; max-width: 30px; height: 100%; }
.pd-sbars__seg { display: block; min-height: 1px; width: 100%; }
.pd-sbars__seg:last-child { border-radius: 3px 3px 0 0; }
.pd-sbars__xl { display: grid; margin: 6px 0 0 44px; gap: 4px; font-size: var(--fs-xs); color: var(--chart-axis); }
.pd-sbars__xl span { text-align: center; white-space: nowrap; overflow: visible; }
.pd-lchart { position: relative; border-radius: 8px; }
.pd-lchart__host { position: relative; width: 100%; }
.pd-lc-grid { stroke: var(--chart-grid); stroke-width: 1; }
.pd-lc-ytick, .pd-lc-xtick { fill: var(--chart-axis); font-size: 11px; font-family: var(--font-sans); }
.pd-lc-guide { stroke: var(--border-strong); stroke-dasharray: 3 3; }
.pd-lc-dot { fill: var(--bg-surface); stroke-width: 2.5; }
.pd-chart-tip { position: absolute; z-index: 3; min-width: 140px; padding: 8px 10px; border-radius: 10px; background: var(--bg-popover); border: 1px solid var(--border); box-shadow: var(--shadow-md); font-size: var(--fs-sm); pointer-events: none; }
.pd-chart-tip__title { margin-bottom: 4px; font-weight: 600; color: var(--text); }
.pd-chart-tip__row { display: flex; align-items: center; gap: 8px; color: var(--text-3); line-height: 1.7; }
.pd-chart-tip__row b { margin-left: auto; padding-left: 12px; color: var(--text); font-weight: 600; }
.pd-chart-tip__dot { width: 8px; height: 8px; border-radius: 3px; flex: none; }

/* ==========================================================================
   Overlays: modal, drawer, popover, menu, toast, tooltip, palette
   ========================================================================== */
#pd-overlays { position: fixed; inset: 0; z-index: var(--z-overlay); pointer-events: none; }
.pd-overlay, .pd-pop, .pd-toasts, .pd-tooltip, .pd-welcome { pointer-events: auto; }
.pd-overlay { position: fixed; inset: 0; display: flex; z-index: var(--z-modal); }
.pd-overlay--modal { align-items: center; justify-content: center; padding: 16px; }
.pd-overlay--palette { align-items: flex-start; justify-content: center; padding: min(14vh, 120px) 12px 12px; }
.pd-overlay--drawer { justify-content: flex-end; }
.pd-scrim { position: absolute; inset: 0; background: var(--bg-overlay); animation: pd-fade-in var(--dur-2) var(--ease); }
.pd-overlay.is-closing { opacity: 0; transition: opacity 140ms var(--ease); }
.pd-sheet { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--bg-popover); border: 1px solid var(--border); box-shadow: var(--shadow-lg); outline: none; }
.pd-modal { width: 520px; max-width: 100%; max-height: calc(100dvh - 32px); border-radius: 16px; animation: pd-pop-in var(--dur-2) var(--ease); }
.pd-modal--sm { width: 400px; } .pd-modal--md { width: 520px; } .pd-modal--lg { width: 720px; } .pd-modal--xl { width: 960px; }
.pd-drawer { width: 440px; max-width: 100vw; height: 100%; border-radius: 0; border-width: 0 0 0 1px; animation: pd-slide-in var(--dur-3) var(--ease); }
.pd-drawer--sm { width: 360px; } .pd-drawer--md { width: 440px; } .pd-drawer--lg { width: 640px; }
@keyframes pd-slide-in { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: none; } }
.pd-sheet__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 0; }
.pd-sheet__heading { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.pd-sheet__icon { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); }
.pd-sheet__icon.is-danger { background: var(--red-bg); color: var(--red-text); }
.pd-sheet__title { font-size: 17px; font-weight: 600; letter-spacing: -.01em; padding-top: 6px; }
.pd-sheet__desc { margin-top: 4px; font-size: var(--fs-md); color: var(--text-3); }
.pd-sheet__close { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 8px; color: var(--text-3); transition: background var(--dur-1), color var(--dur-1); }
.pd-sheet__close:hover { background: var(--bg-hover); color: var(--text); }
.pd-sheet__body { flex: 1; min-height: 0; overflow: auto; padding: 16px 20px; }
.pd-sheet__text { font-size: var(--fs-base); color: var(--text-2); line-height: 1.55; }
.pd-sheet__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 4px 20px 20px; flex: none; }
.pd-drawer .pd-sheet__foot { padding-top: 14px; border-top: 1px solid var(--border-subtle); }
.pd-pop { position: fixed; z-index: var(--z-pop); max-height: calc(100dvh - 16px); overflow: auto; background: var(--bg-popover); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-lg); animation: pd-pop-in 120ms var(--ease); outline: none; }
.pd-pop.is-closing { opacity: 0; transition: opacity 120ms var(--ease); }
.pd-pop--panel { overflow: hidden auto; }
.pd-menu { display: flex; flex-direction: column; padding: 6px; }
.pd-menu__item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 6px 10px; border-radius: var(--r-btn); font-size: var(--fs-md); font-weight: 500; color: var(--text-2); text-align: left; cursor: pointer; text-decoration: none; }
.pd-menu__item:hover, .pd-menu__item:focus { background: var(--bg-hover); color: var(--text); text-decoration: none; }
.pd-menu__item:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
.pd-menu__item[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.pd-menu__item--danger { color: var(--red-text); }
.pd-menu__item--danger:hover, .pd-menu__item--danger:focus { background: var(--red-bg); color: var(--red-text); }
.pd-menu__ico { display: grid; place-items: center; width: 16px; flex: none; color: var(--text-3); }
.pd-menu__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.pd-menu__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-menu__desc { font-size: var(--fs-sm); font-weight: 400; color: var(--text-4); }
.pd-menu__check { display: grid; place-items: center; color: var(--accent-text); flex: none; }
.pd-menu__sep { height: 1px; margin: 6px -6px; background: var(--border-subtle); }
.pd-menu__header { padding: 8px 10px 4px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-4); }
.pd-pop--roles .pd-menu { padding-top: 6px; }
.pd-roles__head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); }
.pd-roles__name { font-size: var(--fs-base); font-weight: 600; }
.pd-roles__mail { font-size: var(--fs-sm); color: var(--text-3); }
.pd-settings { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
.pd-settings__title { font-size: var(--fs-base); font-weight: 600; }
.pd-settings__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.pd-settings__label { display: flex; flex-direction: column; gap: 2px; font-size: var(--fs-md); color: var(--text-2); font-weight: 500; }
.pd-settings__hint { font-size: var(--fs-xs); font-weight: 400; color: var(--text-4); max-width: 150px; }
.pd-settings__row .pd-settings__hint { max-width: none; }
.pd-swatches { display: flex; gap: 8px; }
.pd-swatch { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); transition: transform var(--dur-1); }
.pd-swatch svg { opacity: 0; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .4)); }
.pd-swatch:hover { transform: scale(1.08); }
.pd-swatch.is-active { outline: 2px solid var(--text); outline-offset: 2px; }
.pd-swatch.is-active svg { opacity: 1; }
.pd-swatch--blue { background: var(--sw-blue); } .pd-swatch--violet { background: var(--sw-violet); } .pd-swatch--green { background: var(--sw-green); } .pd-swatch--orange { background: var(--sw-orange); }
.pd-notes__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 6px 16px; }
.pd-notes__title { font-size: var(--fs-base); font-weight: 600; }
.pd-notes__list { display: flex; flex-direction: column; padding: 4px 6px 8px; max-height: 360px; overflow: auto; }
.pd-note { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: var(--r-inner); color: inherit; }
.pd-note:hover { background: var(--bg-hover); text-decoration: none; }
.pd-note.is-unread { background: var(--accent-soft); }
.pd-note__dot { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--gray-solid); }
.pd-note__dot--green { background: var(--green-solid); } .pd-note__dot--red { background: var(--red-solid); } .pd-note__dot--amber { background: var(--amber-solid); } .pd-note__dot--blue { background: var(--blue-solid); } .pd-note__dot--purple { background: var(--purple-solid); }
.pd-note__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pd-note__title { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.pd-note__text { font-size: var(--fs-sm); color: var(--text-3); }
.pd-note__time { font-size: var(--fs-xs); color: var(--text-4); }
.pd-note.is-unread .pd-note__time { color: var(--text-3); }           /* on the tinted unread row the dim token falls under 4.5:1 */
.pd-dl__list { display: flex; flex-direction: column; gap: 14px; padding: 6px 16px 10px; }
.pd-dl__top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: var(--fs-md); }
.pd-dl__name { font-weight: 600; }
.pd-dl__meta { color: var(--text-3); font-size: var(--fs-sm); }
.pd-dl__note { padding: 0 16px 10px; font-size: var(--fs-sm); color: var(--text-3); }
.pd-dl__foot { display: flex; justify-content: flex-end; padding: 0 8px 8px; }
.pd-dl__body .pd-empty { padding: 20px 16px 14px; }
.pd-faq__item { border-bottom: 1px solid var(--border-subtle); }
.pd-faq__item summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; font-size: var(--fs-base); font-weight: 500; cursor: pointer; list-style: none; border-radius: 6px; }
.pd-faq__item summary::-webkit-details-marker { display: none; }
.pd-faq__item summary svg { flex: none; color: var(--text-3); transition: transform var(--dur-2) var(--ease); }
.pd-faq__item[open] summary svg { transform: rotate(180deg); }
.pd-faq__item p { padding: 0 0 14px; font-size: var(--fs-md); color: var(--text-3); line-height: 1.6; }
.pd-faq__contact { margin-top: 16px; font-size: var(--fs-md); color: var(--text-3); }
.pd-faq__tour { margin: 12px 0 0 -8px; }

/* first-visit welcome tips (js/welcome.js): a floating card next to the profile card of the sidebar, bottom-left sheet on narrow screens */
.pd-welcome { position: fixed; z-index: var(--z-pop); width: min(400px, calc(100vw - 24px)); padding: 16px 16px 14px; background: var(--bg-popover); border: 1px solid var(--border); border-radius: var(--r-card); box-shadow: var(--shadow-lg); outline: none; animation: pd-welcome-in var(--dur-3) var(--ease) both; }
.pd-welcome.is-closing { opacity: 0; transform: translateY(6px); transition: opacity 140ms var(--ease), transform 140ms var(--ease); }
.pd-welcome[data-mode="side"]::before { content: ''; position: absolute; left: -7px; bottom: 30px; width: 12px; height: 12px; background: var(--bg-popover); border-left: 1px solid var(--border); border-bottom: 1px solid var(--border); transform: rotate(45deg); }
.pd-welcome__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pd-welcome__title { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -.01em; line-height: 1.3; }
.pd-welcome__lead { margin-top: 4px; font-size: var(--fs-md); color: var(--text-3); line-height: 1.45; }
.pd-welcome__close { flex: none; margin: -6px -8px 0 0; }
.pd-welcome__tips { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.pd-welcome__tip { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; align-items: start; }
.pd-welcome__tipt { font-size: var(--fs-base); font-weight: 600; }
.pd-welcome__tipb { margin-top: 2px; font-size: var(--fs-md); color: var(--text-2); line-height: 1.5; }
.pd-welcome__act { margin-top: 8px; }
.pd-welcome__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border-subtle); font-size: var(--fs-sm); color: var(--text-3); }
@keyframes pd-welcome-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .pd-welcome { animation: none; } .pd-welcome.is-closing { transition: none; } }

.pd-acc { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg-surface); overflow: hidden; }
.pd-acc__item { border-bottom: 1px solid var(--border-subtle); }
.pd-acc__item:last-child { border-bottom: 0; }
.pd-acc__item summary { display: flex; align-items: center; gap: 12px; padding: 14px 16px; font-size: var(--fs-base); font-weight: 500; cursor: pointer; list-style: none; }
.pd-acc__item summary::-webkit-details-marker { display: none; }
.pd-acc__item summary:hover { background: var(--bg-hover); }
.pd-acc__item summary:focus-visible { outline-offset: -2px; }
.pd-acc__title { flex: 1; min-width: 0; }
.pd-acc__meta { font-size: var(--fs-sm); color: var(--text-3); }
.pd-acc__item summary svg { flex: none; color: var(--text-3); transition: transform var(--dur-2) var(--ease); }
.pd-acc__item[open] summary svg { transform: rotate(180deg); }
.pd-acc__body { padding: 0 16px 16px; font-size: var(--fs-md); color: var(--text-3); line-height: 1.6; }

.pd-toasts { position: fixed; right: 16px; bottom: 16px; z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.pd-toasts[data-over] { right: auto; left: 16px; }
.pd-toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 10px 12px 14px; border-radius: var(--r-card); background: var(--bg-popover); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: pd-rise-in var(--dur-3) var(--ease); }
.pd-toast.is-closing { opacity: 0; transform: translateY(6px); transition: opacity 140ms, transform 140ms; }
.pd-toast__icon { flex: none; margin-top: 1px; color: var(--blue-text); }
.pd-toast--success .pd-toast__icon { color: var(--green-text); } .pd-toast--warn .pd-toast__icon { color: var(--amber-text); } .pd-toast--danger .pd-toast__icon { color: var(--red-text); }
.pd-toast__body { flex: 1; min-width: 0; font-size: var(--fs-md); line-height: 1.45; }
.pd-toast__title { font-weight: 600; color: var(--text); }
.pd-toast__msg { color: var(--text-2); }
.pd-toast__action { flex: none; align-self: center; padding: 4px 8px; border-radius: 6px; font-size: var(--fs-md); font-weight: 600; color: var(--accent-text); }
.pd-toast__action:hover { background: var(--accent-soft); }
.pd-toast__close { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; color: var(--text-4); }
.pd-toast__close:hover { background: var(--bg-hover); color: var(--text); }
.pd-tooltip { position: fixed; z-index: var(--z-tooltip); max-width: 260px; padding: 6px 9px; border-radius: 7px; background: var(--bg-inverse); color: var(--text-inverse); font-size: var(--fs-sm); font-weight: 500; line-height: 1.35; box-shadow: var(--shadow-md); pointer-events: none; }
.pd-palette { position: relative; display: flex; flex-direction: column; width: 620px; max-width: 100%; max-height: min(70vh, 560px); overflow: hidden; background: var(--bg-popover); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); animation: pd-pop-in var(--dur-2) var(--ease); }
.pd-palette__search { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 14px; border-bottom: 1px solid var(--border-subtle); color: var(--text-3); flex: none; }
.pd-palette__input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none !important; color: var(--text); font-size: 15px; }
.pd-palette__input::placeholder { color: var(--text-4); }
.pd-palette__list { flex: 1; min-height: 0; overflow: auto; padding: 6px; }
.pd-palette__group { padding: 10px 10px 4px; font-size: var(--fs-xs); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-4); }
.pd-palette__item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-inner); color: var(--text-2); cursor: pointer; }
.pd-palette__item.is-active { background: var(--bg-active); color: var(--text); }
.pd-palette__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-base); }
.pd-palette__mark { background: var(--accent-soft-2); color: inherit; border-radius: 3px; }
.pd-palette__hint { margin-left: auto; padding-left: 12px; font-size: var(--fs-sm); color: var(--text-4); white-space: nowrap; }
.pd-palette__go { display: grid; color: var(--text-4); opacity: 0; }
.pd-palette__item.is-active .pd-palette__go { opacity: 1; }
.pd-palette__empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 16px; color: var(--text-3); font-size: var(--fs-md); text-align: center; }
.pd-palette__foot { display: flex; gap: 16px; padding: 10px 14px; border-top: 1px solid var(--border-subtle); font-size: var(--fs-sm); color: var(--text-4); flex: none; }
.pd-palette__foot span { display: inline-flex; align-items: center; gap: 4px; }

/* the launcher window: dialogs and drawers start below the title bar, so its drag area and window controls stay visible and usable */
@media (min-width: 720px) {
  html[data-desktop="true"] .pd-overlay { top: var(--titlebar-h); }
}
/* tablet widths: a page footer with decision buttons (data-toast-aside) spans most of the width, so a bottom-left toast would still touch the first button;
   the toast goes to the top there, like on phones, and does not swallow clicks meant for the page under it */
@media (min-width: 720px) and (max-width: 1023px) {
  .pd-toasts[data-over="footer"] { bottom: auto; top: 12px; }
  html[data-desktop="true"] .pd-toasts[data-over="footer"] { top: calc(var(--titlebar-h) + 12px); }
  .pd-toasts[data-over="footer"] .pd-toast { pointer-events: none; }
  .pd-toasts[data-over="footer"] .pd-toast__action, .pd-toasts[data-over="footer"] .pd-toast__close { pointer-events: auto; }
}
@media (max-width: 479px) {
  .pd-sheet__foot { flex-direction: column-reverse; align-items: stretch; }
  .pd-sheet__foot > * { width: 100%; justify-content: center; }
}
/* small touch targets: inline link-style controls get a padded hit area (about 34 px) without changing the layout (the padding is taken back with a negative margin) */
@media (pointer: coarse), (max-width: 719px) {
  a.pd-gcard__link, .lb-card__link, .lb-resume__link, .st-resume__link, a.gm-dev, button.wl-link, .pd-th-btn { padding-block: 6px; margin-block: -6px; }
  a.pd-chip, button.pd-chip--btn { height: auto; min-height: 26px; }        /* chips that are links or filters: at least 24 px tall, with room to tap */
}
@media (max-width: 719px) {
  .pd-toasts { right: 12px; left: 12px; bottom: calc(var(--tabbar-h) + 12px); width: auto; }
  .pd-toasts[data-over] { top: 12px; bottom: auto; left: 12px; right: 12px; }
  .pd-toasts[data-over] .pd-toast { pointer-events: none; }          /* over a sheet the toast must not swallow taps meant for the page under it */
  .pd-toasts[data-over] .pd-toast__action, .pd-toasts[data-over] .pd-toast__close { pointer-events: auto; }
  .pd-modal { max-height: calc(100dvh - 16px); }
  .pd-overlay--modal { padding: 8px; align-items: flex-end; }
  .pd-modal { border-radius: 16px 16px 12px 12px; }
  .pd-overlay--palette { padding-top: 8vh; }
  .pd-gcard--wide { flex-direction: column; }
  .pd-gcard--wide .pd-gcard__media { flex: none; max-width: none; }
  .pd-gcard--wide .pd-gcard__cover { aspect-ratio: 16 / 9 !important; min-height: 0; }
  .pd-step__hint { display: none; }
  .pd-kv--2 { grid-template-columns: minmax(0, 1fr); }
  .pd-statrow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pd-stat:nth-child(2n) { border-right: 0; }
  .pd-stat { border-bottom: 1px solid var(--border-subtle); }
}

/* ==========================================================================
   Accounts (wave 1): password field, strength meter, one-time code, copy field, QR code, setting rows, sections, gates,
   checklist, avatar upload, compact stepper, menu extras, status cells. Colors are tokens only (the QR tile has its own).
   ========================================================================== */

/* ---------- PasswordField ---------- */
.pd-pw { display: flex; flex-direction: column; gap: 8px; }
.pd-pw__toggle { margin-right: -6px; }
.pd-pw__caps { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--amber-text); }
.pd-meter { display: flex; align-items: center; gap: 10px; }
.pd-meter__bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; flex: 1; }
.pd-meter__bar { height: 4px; border-radius: 2px; background: var(--bg-track); transition: background var(--dur-2); }
.pd-meter[data-level="1"] .pd-meter__bar:nth-child(-n+1) { background: var(--red-solid); }
.pd-meter[data-level="2"] .pd-meter__bar:nth-child(-n+2) { background: var(--amber-solid); }
.pd-meter[data-level="3"] .pd-meter__bar:nth-child(-n+3) { background: var(--green-solid); }
.pd-meter[data-level="4"] .pd-meter__bar:nth-child(-n+4) { background: var(--green-solid); }
.pd-meter__label { flex: none; min-width: 74px; text-align: right; font-size: var(--fs-sm); font-weight: 500; color: var(--text-2); }

/* ---------- OtpInput: ONE real input drawn as cells ---------- */
.pd-otp { position: relative; display: grid; grid-template-columns: repeat(var(--otp-n, 6), minmax(0, 1fr)); gap: 8px; max-width: 360px; }
.pd-otp__cell { display: grid; place-items: center; height: 52px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--r-input); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; transition: border-color var(--dur-1), box-shadow var(--dur-1); }
.pd-otp__cell.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.pd-otp.is-invalid .pd-otp__cell { border-color: var(--red-solid); }
.pd-otp__caret { width: 1.5px; height: 24px; background: var(--accent-text); animation: pd-otp-blink 1s steps(1) infinite; }
@keyframes pd-otp-blink { 50% { opacity: 0; } }
.pd-otp__el { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; opacity: 0; cursor: text; border: 0; background: none; font-size: 22px; caret-color: transparent; }
.pd-otp.is-disabled { opacity: .55; }
.pd-resend { display: inline-flex; align-items: center; }

/* ---------- CopyField ---------- */
.pd-copy { display: flex; align-items: stretch; flex-wrap: wrap; gap: 8px; }
.pd-copy__val { flex: 1 1 200px; min-width: 0; display: flex; align-items: center; padding: 0 12px; min-height: 40px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--r-input); font-family: var(--font-mono); font-size: var(--fs-md); letter-spacing: .04em; color: var(--text); overflow-wrap: anywhere; user-select: all; }
.pd-copy__val.is-multi { display: block; padding: 10px 12px; white-space: pre-line; line-height: 1.7; }

/* ---------- QR code: always dark on light, whatever the theme ---------- */
.pd-qr { display: block; width: fit-content; max-width: 100%; padding: 8px; background: var(--qr-bg); border-radius: var(--r-inner); border: 1px solid var(--border); line-height: 0; forced-color-adjust: none; }
.pd-qr svg { display: block; width: var(--qr-size, 192px); height: var(--qr-size, 192px); max-width: 100%; }
.pd-twofa { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 719px) { .pd-twofa { grid-template-columns: minmax(0, 1fr); justify-items: start; } }

/* ---------- SettingRow and Section ---------- */
.pd-section { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-card); }
.pd-section__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border-subtle); }
.pd-section__title { font-size: var(--fs-title); font-weight: 600; letter-spacing: -.01em; }
.pd-section__desc { margin-top: 2px; font-size: var(--fs-md); color: var(--text-3); }
.pd-section__actions { display: flex; align-items: center; gap: 8px; flex: none; }
.pd-section__body { display: flex; flex-direction: column; padding: 4px 20px; }
.pd-section__body > .pd-muted, .pd-section__body > .pd-row { padding: 14px 0; }
.pd-setrow { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 12px 0; border-bottom: 1px solid var(--border-subtle); color: inherit; text-align: left; width: 100%; }
.pd-setrow:last-child { border-bottom: 0; }
.pd-setrow__ico { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: var(--r-btn); background: var(--bg-raised); color: var(--text-2); }
.pd-setrow__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.pd-setrow__label { font-size: var(--fs-base); font-weight: 500; color: var(--text); }
.pd-setrow__desc { font-size: var(--fs-md); color: var(--text-3); line-height: 1.45; }
.pd-setrow__ctl { flex: none; display: inline-flex; align-items: center; max-width: 55%; }
.pd-setrow__chev { color: var(--text-4); flex: none; display: grid; place-items: center; }
.pd-setrow--link { cursor: pointer; border-radius: 0; transition: background var(--dur-1); }
.pd-setrow--link:hover { text-decoration: none; background: var(--bg-hover); margin: 0 -20px; padding-left: 20px; padding-right: 20px; width: calc(100% + 40px); }
.pd-setrow--link:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
.pd-setrow.is-danger .pd-setrow__label, .pd-setrow.is-danger .pd-setrow__ico { color: var(--red-text); }
@media (max-width: 719px) { .pd-setrow { flex-wrap: wrap; } .pd-setrow__ctl { max-width: 100%; margin-left: 44px; } .pd-section__head, .pd-section__body { padding-inline: 14px; } .pd-setrow--link:hover { margin: 0 -14px; padding-inline: 14px; width: calc(100% + 28px); } }

/* ---------- denied screens (gates) and the empty-state variants ---------- */
.pd-gate__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.pd-gate__list { list-style: none; margin: 4px auto 6px; padding: 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.pd-gate__item { display: flex; align-items: center; gap: 8px; font-size: var(--fs-md); color: var(--text-3); }
.pd-gate__item.is-done { color: var(--text); }
.pd-gate__item.is-done > svg { color: var(--green-text); }
.pd-empty__icon--amber { background: var(--amber-bg); color: var(--amber-text); }
.pd-empty__icon--gray { background: var(--bg-raised); color: var(--text-3); }

/* ---------- Checklist ---------- */
.pd-cklist { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-card); background: var(--bg-surface); text-align: left; }
.pd-cklist--compact { padding: 0; border: 0; background: none; }
.pd-cklist__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pd-cklist__title { font-size: var(--fs-base); font-weight: 600; }
.pd-cklist__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pd-cklist__item { display: flex; gap: 10px; align-items: flex-start; }
.pd-cklist__mark { flex: none; color: var(--text-4); display: grid; place-items: center; margin-top: 1px; }
.pd-cklist__item.is-done .pd-cklist__mark { color: var(--green-text); }
.pd-cklist__body { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; min-width: 0; }
.pd-cklist__t { font-size: var(--fs-md); font-weight: 500; color: var(--text); }
.pd-cklist__item.is-done .pd-cklist__t { color: var(--text-3); }
.pd-cklist__d { font-size: var(--fs-md); color: var(--text-3); }

/* ---------- AvatarUpload ---------- */
.pd-avup { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px dashed transparent; border-radius: var(--r-card); transition: border-color var(--dur-1), background var(--dur-1); }
.pd-avup.is-over { border-color: var(--accent); background: var(--accent-soft); }
.pd-avup__row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.pd-avup__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pd-avup__err { font-size: var(--fs-sm); color: var(--red-text); }
.pd-avup[aria-busy="true"] { opacity: .7; }

/* ---------- Stepper, compact ("Step 2 of 5: Account" with a thin bar) ---------- */
.pd-stepper-box .pd-stepper-now { display: none; flex-direction: column; gap: 8px; }
.pd-stepper__now { font-size: var(--fs-md); font-weight: 500; color: var(--text-2); }
.pd-stepper-box[data-compact="true"] > .pd-stepper { display: none; }
.pd-stepper-box[data-compact="true"] .pd-stepper-now { display: flex; }
.pd-step.is-error .pd-step__dot { border-color: var(--red-solid); color: var(--red-text); }

/* ---------- menu extras: right-aligned meta (a chip, a role), the head block ---------- */
.pd-menu__meta { flex: none; display: inline-flex; align-items: center; margin-left: 8px; color: var(--text-3); font-size: var(--fs-sm); }
.pd-menu__head { display: block; }
.pd-danger { display: flex; flex-direction: column; gap: 14px; }
.pd-danger__list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-md); color: var(--text-2); }

/* ---------- table cells for people ---------- */
.pd-cell-user { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.pd-cell-user__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.pd-cell-user__name { font-weight: 500; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-cell-user__sub { font-size: var(--fs-sm); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-cell-roles { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
