/* The new Categories, Tags, Captions and History pages (designed on the canvas). Lists follow Material 3:
   separate tiles 2px apart, big outer corners, a gray state layer on hover, icon buttons without a fill until hovered */
.pg-toolbar { margin-bottom: 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.pg-toolbar > .ig-search { flex: 1 1 260px; }
.pg-toolbar .ig-seg { flex: none; background: var(--card); box-shadow: inset 0 0 0 1px var(--border); }
.pg-toolbar .ig-seg button { flex: none; padding: 0 18px; font-size: 14px; }
.pg-filters { display: flex; gap: 12px; }
.pg-filter { position: relative; }
.pg-select { height: 46px; padding: 0 12px 0 16px; display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--field); border-radius: 12px; background: var(--card); font-size: 14px; font-weight: 500; white-space: nowrap; transition: background .15s; }
.pg-select:hover { background: color-mix(in srgb, var(--ink) 7%, var(--card)); }
.pg-select svg { flex: none; color: var(--muted); transition: transform .15s; }
.pg-select.is-open svg { transform: rotate(180deg); }
.pg-select span { overflow: hidden; text-overflow: ellipsis; }

/* menus: same build for both filters */
.pg-menu-bg { position: fixed; z-index: 11; inset: 0; }
.pg-menu { position: absolute; z-index: 12; top: calc(100% + 4px); left: 0; width: 260px; padding: 8px; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; background: var(--card); box-shadow: var(--pop-shadow); }
.pg-menu.is-wide { width: 300px; }
.pg-menu .ig-search { margin: 0 0 6px; }
.pg-menu-list { max-height: 330px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
/* every item is an inset rounded tile: hover = gray, chosen = darker gray, a small gap between them */
.ig .pg-menu .ig-dd-item { width: 100%; min-height: 40px; margin: 0; padding: 0 10px 0 8px; gap: 10px; border-radius: 10px; background: none; transition: background .12s; }
.ig .pg-menu .ig-dd-item:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.ig .pg-menu .ig-dd-item.is-on { background: var(--accent-soft); color: var(--on-accent-soft); }
.ig .pg-menu .ig-dd-item.is-on:hover { background: color-mix(in srgb, var(--on-accent-soft) 8%, var(--accent-soft)); }
.pg-menu .ig-dd-item.is-on .pg-mcheck, .pg-menu .ig-dd-item.is-on .pg-menu-count { color: var(--on-accent-soft); }
.pg-mcheck { width: 20px; flex: none; display: inline-flex; justify-content: center; color: transparent; }
.pg-menu-div { height: 1px; margin: 4px 8px; background: var(--line); }
.pg-menu .ig-dd-item.is-on .ig-dd-text > span { font-weight: 600; }
.pg-menu-count { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pg-menu .ig-dd-item.is-on .pg-menu-count { color: var(--ink); }

/* lists */
.ig .pg-list { padding: 0; display: flex; flex-direction: column; gap: 2px; border: none; border-radius: 0; background: none; box-shadow: none; }
.pg-row { width: 100%; padding: 16px 20px; display: flex; align-items: center; gap: 14px; border: none; border-radius: 4px; background: var(--card); text-align: left; cursor: pointer; transition: background .15s; }
.pg-row:first-of-type { border-top-left-radius: 20px; border-top-right-radius: 20px; }
.pg-row:last-of-type { border-bottom-left-radius: 20px; border-bottom-right-radius: 20px; }
.pg-row:hover, .pg-cap:hover { background: var(--row-hover); }
.pg-row.is-picked, .pg-row.is-picked:hover { background: var(--row-picked); }
/* gray badges would vanish into the hover gray, so they turn card-colored */
.pg-row:hover .pg-badge:not(.is-violet):not(.is-warn), .pg-row.is-picked .pg-badge:not(.is-violet):not(.is-warn), .pg-cap:hover .pg-badge:not(.is-violet):not(.is-warn) { background: var(--card); }
.pg-row:hover .pg-chev { color: var(--ink); }
.pg-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pg-row-main strong { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 15px; font-weight: 600; }
.pg-row-main strong > span:first-child { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-row-main strong .pg-badge { flex: none; }
.pg-meta-badge { height: 20px; margin-right: 6px; vertical-align: baseline; }
.pg-row-main > span { overflow: hidden; font-size: 13px; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.pg-short { display: none; }
.pg-row-side { flex: none; font-size: 13px; color: var(--muted); white-space: nowrap; }
.pg-chev { flex: none; display: inline-flex; color: var(--muted); transition: color .15s; }
.pg-acts { flex: none; display: flex; gap: 2px; }
.ig .pg-row .ig-icon-btn { width: 40px; height: 40px; background: none; color: var(--soft-ink); transition: background .15s, color .15s; }
.ig .pg-row .ig-icon-btn:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.pg-badge { height: 22px; padding: 0 8px; display: inline-flex; align-items: center; gap: 4px; border-radius: 999px; background: var(--soft); color: var(--soft-ink); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pg-badge.is-violet { background: var(--violet-bg); color: var(--violet); }
.pg-badge.is-warn { background: var(--warn-bg); color: var(--warn); }
.pg-badge.is-muted { background: var(--soft); color: var(--muted); }
.pg-dim strong { color: var(--muted); }
.ig .pg-foot { margin-top: 28px; display: flex; flex-direction: column; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }

/* above the list: count + Select, or the selection bar */
.pg-listhead { min-height: 40px; margin-bottom: 8px; padding: 0 4px 0 8px; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.pg-listhead .ig-btn { min-height: 40px; padding: 0 16px; font-size: 14px; }
.pg-push { margin-left: auto; }
.pg-order { flex: none; background: var(--card); box-shadow: inset 0 0 0 1px var(--border); }
.pg-order button { flex: none; padding: 0 14px; }
.pg-selbar { min-height: 64px; margin-bottom: 12px; padding: 10px 12px 10px 20px; display: flex; align-items: center; gap: 14px; border-radius: 20px; background: color-mix(in srgb, var(--ink) 7%, var(--page)); font-size: 14px; font-weight: 600; }
.pg-selbar .ig-btn { min-height: 40px; padding: 0 18px; }
.ig .pg-tonal-danger { background: var(--coral-bg); color: var(--coral); }
.ig .pg-tonal-danger:hover { background: color-mix(in srgb, var(--coral) 16%, var(--card)); }
.ig .pg-tonal-danger.is-off { background: color-mix(in srgb, var(--ink) 12%, transparent); color: color-mix(in srgb, var(--ink) 38%, transparent); cursor: default; }
.pg-selall { margin-left: -8px; padding: 6px 12px 6px 8px; display: inline-flex; align-items: center; gap: 14px; border: none; border-radius: 10px; background: none; color: var(--ink); font-size: 14px; font-weight: 600; }
.pg-selall:hover { background: color-mix(in srgb, var(--ink) 7%, transparent); }
.pg-check { width: 22px; height: 22px; padding: 0; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--field-open); border-radius: 6px; background: var(--card); color: transparent; cursor: pointer; }
.pg-check.is-on, .pg-check.is-some { border-color: var(--ink); background: var(--ink); color: var(--on-ink); }
.pg-check.is-some svg { display: none; }
.pg-check.is-some::after { content: ''; width: 10px; height: 2px; border-radius: 1px; background: var(--on-ink); }

/* windows */
.pg-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pg-tags + .ig-hits { margin-top: 10px; }
.pg-tag { height: 34px; padding: 0 4px 0 12px; display: inline-flex; align-items: center; gap: 2px; border-radius: 999px; background: var(--soft); font-size: 13px; font-weight: 500; }
.pg-tag button { width: 24px; height: 24px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: 50%; background: none; color: var(--muted); }
/* an archived tag in the category window: dotted outline, no fill */
.ig .pg-tag-input.is-bad { border-color: var(--coral); border-style: solid; }
.pg-tag.is-archived { border: 1px dashed var(--field-open); background: none; color: var(--soft-ink); cursor: help; }
.ig .pg-tag-input { width: 190px; height: 34px; min-height: 34px; padding: 0 14px; border: 1px dashed var(--field); border-radius: 999px; background: var(--card); font-size: 13px; }
.pg-head-acts { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.pg-del-wrap { position: relative; display: inline-flex; }
.ig .pg-del { background: none; color: var(--soft-ink); }
.ig .pg-del:hover { background: var(--coral-bg); color: var(--coral); }
.ig .pg-del.is-off { color: color-mix(in srgb, var(--ink) 38%, transparent); cursor: help; }
.ig .pg-del.is-off:hover { background: none; }
.pg-tip { position: absolute; z-index: 5; top: calc(100% + 8px); right: -6px; width: 240px; padding: 9px 12px; display: none; border-radius: 10px; background: var(--ink); color: var(--on-ink); font-size: 13px; font-weight: 500; line-height: 1.45; box-shadow: var(--pop-shadow); }
.pg-del-wrap:hover .pg-tip, .pg-tip.is-on { display: block; }
.pg-phone { display: none; }
.pg-label-row { min-height: 28px; margin-bottom: 8px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.ig .pg-label-row .ig-label { margin: 0; }
/* a long suggestion ("Use @averylongaccount") ends in "..." and moves under the label instead of squeezing it */
.pg-label-acts { min-width: 0; max-width: 100%; margin-left: auto; display: flex; gap: 6px; }
.pg-label-acts .pg-suggest { min-width: 0; max-width: 100%; }
.pg-label-acts .pg-suggest > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* the field's own action ("Use @...", "Open account") right under it, lined up with its right edge */
.pg-field-acts { margin-top: 8px; justify-content: flex-end; }
.pg-mini-btn, .pg-suggest { height: 32px; padding: 0 12px 0 10px; display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--field); border-radius: 999px; background: var(--card); color: var(--soft-ink); font-size: 13px; font-weight: 600; text-decoration: none; white-space: nowrap; transition: background .15s; }
.pg-mini-btn:hover, .pg-suggest:hover { background: color-mix(in srgb, var(--ink) 7%, var(--card)); color: var(--ink); }
.pg-mini-btn svg, .pg-suggest svg { flex: none; }
.pg-mini-btn svg:last-child:not(:first-child) { margin-left: 3px; }
.pg-suggest { border-style: dashed; border-color: var(--field-open); }
.ig .pg-danger { background: var(--coral); color: var(--on-coral); }
/* a quiet text button that deletes: turns red on hover */
.ig .ig-btn.is-text.pg-destructive:hover { background: var(--coral-bg); color: var(--coral); }
.ig .pg-confirm-text { line-height: 1.9; }
.ig .pg-undo { font-weight: 700; color: var(--ink); }
.pg-inline { padding: 2px 8px; border-radius: 6px; background: var(--seg); color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap; }
.pg-chips { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px; }
/* a confirm with a long list (delete selected / delete empty categories): wider, in the middle, the list scrolls */
.ig .ig-modal.pg-list-confirm { top: 50%; max-height: calc(100vh - 32px); transform: translate(-50%, -50%); }
.ig .ig-modal.pg-list-confirm.is-wide { width: 640px; }
@supports (height: 100dvh) { .ig .ig-modal.pg-list-confirm { max-height: calc(100dvh - 32px); } }
.pg-list-confirm .pg-chips { min-height: 0; flex: 0 1 auto; overflow-y: auto; align-content: flex-start; padding: 2px 0; }
.pg-list-confirm > :not(.pg-chips) { flex: none; }

/* captions */
.pg-cap-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.pg-cap { padding: 20px; gap: 16px; cursor: pointer; text-align: left; transition: background .15s; }
.pg-cap-top { display: flex; align-items: flex-start; gap: 14px; }
.pg-cap-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pg-cap-title { overflow: hidden; font-size: 15px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.pg-cap-title.is-auto { font-weight: 600; color: var(--muted); }
.pg-cap-top p { color: var(--soft-ink) !important; min-width: 0; display: -webkit-box; overflow: hidden; -webkit-line-clamp: 5; -webkit-box-orient: vertical; font-size: 14px; line-height: 1.6; color: var(--ink); white-space: pre-line; }
.pg-cap-top .ig-badge, .pg-cap-top .pg-mini-btn { flex: none; }
.pg-cap-foot { margin-top: auto; display: flex; justify-content: flex-end; }

/* pager (Captions): Previous / page numbers / Next, the current page in the accent tint */
.pg-pager { margin-top: 28px; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px; }
.ig .pg-pager-step { background: none; color: var(--ink); }
.ig .pg-pager-step:disabled { color: color-mix(in srgb, var(--ink) 38%, transparent); cursor: default; box-shadow: none; }
.ig .pg-page { min-width: 40px; height: 40px; padding: 0 6px; border: none; border-radius: 999px; background: none; color: var(--soft-ink); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ig .pg-page.is-on { background: var(--accent-soft); color: var(--on-accent-soft); }
.ig .pg-page.is-gap { min-width: 24px; cursor: default; color: var(--muted); }
@media (hover: hover) { .ig .pg-page:not(.is-on):not(.is-gap):hover { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); } }
/* narrow phones: a bit tighter, so Previous, up to 7 numbers and Next stay on one line */
@media (max-width: 520px) { .pg-pager { flex-wrap: nowrap; gap: 2px; } .ig .pg-page, .ig .pg-pager-step { min-width: 36px; width: auto; height: 36px; } .ig .pg-pager-step { width: 36px; } .ig .pg-page.is-gap { min-width: 20px; padding: 0; } }

/* history */
.pg-dayblock { margin-bottom: 36px; }
.ig .pg-day { margin: 0 0 12px 8px; font-size: 14px; font-weight: 600; color: var(--soft-ink); }
.pg-hist { padding: 16px 20px; flex-direction: column; align-items: stretch; gap: 10px; }
.pg-hist-top { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); }
.pg-hist-top strong { flex: none; font-size: 14px; color: var(--ink); }
.pg-hist-cats { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-hist-tags { overflow: hidden; font-size: 14px; color: var(--soft-ink); text-overflow: ellipsis; white-space: nowrap; }
.pg-row.pg-hist.is-static { cursor: default; }
.pg-row.pg-hist.is-static:hover { background: var(--card); }
.pg-hist.is-open .pg-hist-tags { overflow: visible; white-space: normal; overflow-wrap: anywhere; }

@media (max-width: 760px) {
    .pg-toolbar > .ig-search { flex: 1 1 0; min-width: 0; }
    .pg-toolbar .ig-seg, .pg-filters { order: 3; width: 100%; }
    .pg-toolbar .ig-seg button { flex: 1; padding: 0 8px; }
    .pg-filter { flex: 1; min-width: 0; }
    .pg-filter .pg-select { width: 100%; }
    .pg-filter:last-child .pg-menu { left: auto; right: 0; }
    .pg-menu, .pg-menu.is-wide { width: min(300px, calc(100vw - 32px)); }
    .pg-add { padding: 0 18px; }
    .pg-long { display: none; }
    .pg-phone { display: inline; }
    .pg-selbar { padding-left: 16px; gap: 10px; }
    .pg-selbar .ig-btn { padding: 0 14px; }
    .pg-row { padding: 14px 16px; }
    .pg-row-side { display: none; }
    .pg-short { display: inline; }
    .pg-cap-grid { grid-template-columns: minmax(0, 1fr); }
    .pg-hist { padding: 14px 16px; }
    .pg-dayblock { margin-bottom: 28px; }
    .pg-row .pg-chev svg { width: 18px; height: 18px; }
}
