/* Rights portal structure (public pages for Data Principals). Loaded after site.css and dpdp.css by _PortalLayout, and
   built on the theme v2 tokens (surfaces, radii, accent and the --ts text scale), so light/dark, the accent colour and
   the text-size setting all apply.
   It sets layout and grouping, not colours: each step and each part of "My data" is its own card on the page. */

/* Page frame: the form or content, and a narrower summary column that sticks while scrolling. */
.portal .pt-layout { grid-template-columns: minmax(0, 1fr) 340px; gap: 24px 32px; }
.portal .pt-main { display: grid; gap: 16px; align-content: start; }
.portal .pt-main > .pt-title { margin: 0; }
.portal .pt-main > .pt-lead { margin: -8px 0 8px; }
.portal .pt-main > form { display: grid; gap: 16px; }

/* Request form: each step is a card with its number in the margin. */
.portal .pt-sec { grid-template-columns: 32px minmax(0, 1fr); gap: 16px; padding: 22px 24px 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s; }
    .portal .pt-sec.is-now { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); }
.portal .pt-sec-body { gap: 14px; }
.portal .pt-sec-title { margin: 4px 0 0; }

/* Step 1: what the request is, as a grid of choice cards (name, and the section of the Act). */
.pt-types { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 10px; }
.pt-type { position: relative; display: flex; flex-direction: column; gap: 2px; min-height: 64px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); cursor: pointer; transition: border-color .15s, background-color .15s, box-shadow .15s; }
    .pt-type input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
    .pt-type:hover { border-color: var(--input); }
    .pt-type:has(input:checked) { border-color: var(--primary); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--primary); }
    .pt-type:has(input:focus-visible) { outline: 2px solid var(--ring); outline-offset: 2px; }
.pt-type-name { font-weight: 600; line-height: 1.3; }
    .pt-type:has(input:checked) .pt-type-name { color: var(--accent-foreground); }
.pt-type-sec { font-size: calc(13px * var(--ts)); color: var(--muted-foreground); }
.portal .pt-help { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--foreground); max-width: none; }

/* Step 2: email or mobile as a two-way switch, then the name on its own row and the two contact fields side by side. */
.portal .pt-choice { margin: 0; }
.pt-seg { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--surface-3); }
.pt-seg-opt { position: relative; }
    .pt-seg-opt input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
    .pt-seg-opt span { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 38px; padding: 0 16px; border-radius: var(--r-pill); font-weight: 600; color: var(--muted); white-space: nowrap; transition: background-color .15s, color .15s, box-shadow .15s; }
    .pt-seg-opt span svg { width: 16px; height: 16px; }
    .pt-seg-opt:hover span { color: var(--foreground); }
    .pt-seg-opt input:checked + span { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-sm); }
    .pt-seg-opt input:focus-visible + span { outline: 2px solid var(--ring); outline-offset: 2px; }
.portal .pt-fields-contact { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 16px; }
    .pt-fields-contact .pt-field-full { grid-column: 1 / -1; }
.portal .pt-sec-body > .field-hint { margin: -4px 0 0; }

/* Step 3: the declaration stands apart from the description. */
.pt-declare-box { margin-top: 4px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); max-width: none; }

/* Summary column */
.portal .pt-side { top: 20px; }
.portal .pt-summary { gap: 18px; padding: 22px 22px 20px; }
.portal .pt-dl { padding-bottom: 16px; border-bottom: 1px solid var(--border); }

/* "My data": an overview row, then one card per part of the page. */
.pt-overview { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pt-stat { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
    .pt-stat:hover { border-color: var(--input); transform: translateY(-1px); text-decoration: none; color: inherit; }
.pt-stat-label { font-size: calc(13px * var(--ts)); font-weight: 500; color: var(--muted-foreground); }
.pt-stat-value { font-size: 24px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.pt-stat-hint { font-size: calc(13px * var(--ts)); color: var(--muted-foreground); }

.pt-card { display: grid; gap: 14px; padding: 22px 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); min-width: 0; scroll-margin-top: 20px; }
.pt-card-head { display: grid; gap: 4px; }
.pt-card-title { margin: 0; font-size: calc(17px * var(--ts)); font-weight: 600; letter-spacing: -.01em; }
.pt-card-sub { margin: 0; max-width: 72ch; font-size: calc(14px * var(--ts)); color: var(--muted-foreground); }
.pt-card-foot { display: flex; justify-content: flex-end; padding-top: 4px; }
.pt-card .table-scroll { margin: 0 -24px; padding: 0 24px; overflow-x: auto; }
.pt-empty { margin: 0; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: calc(14px * var(--ts)); color: var(--muted-foreground); }
.pt-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.pt-group { display: grid; gap: 8px; align-content: start; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pt-group-title { margin: 0; font-size: calc(14px * var(--ts)); font-weight: 600; }
.pt-kv { display: grid; grid-template-columns: minmax(96px, max-content) minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: calc(14px * var(--ts)); }
    .pt-kv dt { color: var(--muted-foreground); }
    .pt-kv dd { margin: 0; overflow-wrap: anywhere; }

/* "My data" side card: who is signed in, actions, and a short contents list. */
.pt-who-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pt-avatar { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-foreground); }
    .pt-avatar svg { width: 18px; height: 18px; }
.pt-who-text { min-width: 0; }
.pt-who-text .pt-summary-title { font-size: calc(13px * var(--ts)); font-weight: 500; color: var(--muted-foreground); }
.portal .pt-who-text .pt-who { margin: 0; font-weight: 600; }
.pt-toc { display: grid; gap: 2px; padding-top: 14px; border-top: 1px solid var(--border); }
.pt-toc-label { margin-bottom: 4px; font-size: calc(12px * var(--ts)); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-foreground); }
.pt-toc a { display: block; padding: 6px 10px; margin: 0 -10px; border-radius: var(--radius-sm); color: var(--foreground); font-size: calc(14px * var(--ts)); text-decoration: none; }
    .pt-toc a:hover { background: var(--surface-2); }
.pt-signout { margin: -6px 0 0; }
    .pt-signout .btn { padding-left: 0; }

/* Narrower screens: the summary goes under the content; on phones fields and overview tiles stack. */
@media (max-width: 1099.98px) {
    .portal .pt-layout { grid-template-columns: minmax(0, 1fr); }
    .portal .pt-side { position: static; }
}
@media (max-width: 767.98px) {
    .portal .pt-sec { grid-template-columns: minmax(0, 1fr); padding: 18px 16px 20px; }
    .portal .pt-sec-title { padding-left: 40px; }
    .portal .pt-num { left: 16px; top: 18px; }
    .portal .pt-fields-contact { grid-template-columns: minmax(0, 1fr); }
    .pt-types { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .pt-seg { display: grid; width: 100%; }
    .pt-overview { gap: 8px; }
    .pt-stat { padding: 12px; }
    .pt-stat-value { font-size: calc(20px * var(--ts)); }
    .pt-stat-hint { display: none; }
    .pt-card { padding: 18px 16px; }
    /* Tables become one block per row, each value under its label (cells carry data-label). */
    .pt-card .table-scroll { margin: 0; padding: 0; overflow: visible; }
    .pt-card .stack-table, .pt-card .stack-table tbody, .pt-card .stack-table tr, .pt-card .stack-table td { display: block; width: auto; }
    .pt-card .stack-table thead { display: none; }
    .pt-card .stack-table tr { padding: 12px 0; border-bottom: 1px solid var(--border); }
        .pt-card .stack-table tr:last-child { border-bottom: 0; }
    .pt-card .stack-table td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
        .pt-card .stack-table td::before { content: attr(data-label); flex: none; color: var(--muted-foreground); font-size: calc(13px * var(--ts)); text-align: left; }
        .pt-card .stack-table td:not([data-label]) { display: block; text-align: left; }
        .pt-card .stack-table td:not([data-label])::before { content: none; }
        .pt-card .stack-table td:empty { display: none; }
        .pt-card .stack-table td.right:not([data-label]) { padding-top: 8px; }
}
@media (max-width: 400px) { .pt-types { grid-template-columns: minmax(0, 1fr); } }
