/* Client portal (prototype) - builds on styles.css tokens */
.portal-page {
  --good: #0ca30c; --warn: #fab219; --bad: #d03b3b;
  --good-text: #006300; --bad-text: #b02a2a;
  --plan: var(--stone);
}
:root[data-theme="dark"] .portal-page { --good-text: #0ca30c; --bad-text: #ef6b6b; --plan: #3a3735; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .portal-page { --good-text: #0ca30c; --bad-text: #ef6b6b; --plan: #3a3735; }
}
.portal-page [hidden] { display: none !important; }
.portal-page code { font-family: ui-monospace, Consolas, monospace; font-size: .9em; background: var(--tint); color: var(--ink); padding: 1px 6px; border-radius: 4px; }

/* ---------- Log in ---------- */
.pt-login { display: grid; grid-template-columns: 1.1fr 1fr; min-height: calc(100vh - var(--nav-h)); }
.pt-login-photo { position: relative; overflow: hidden; background: var(--tint); }
.pt-login-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pt-login-box { align-self: center; width: 100%; max-width: 460px; margin: 0 auto; padding: 56px 32px; }
.pt-login-box h1 { font-size: clamp(2rem, 3.6vw, 2.8rem); }
.pt-login-lead { margin-top: 1rem; }
#loginForm { margin-top: 2rem; display: grid; gap: 18px; }
.pt-field { display: grid; gap: 6px; }
.pt-field > span:first-child { font-family: var(--head); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.pt-field input { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; outline: none; transition: border-color .2s; }
.pt-field input:focus { border-color: var(--ink); }
.pt-pass { position: relative; display: block; }
.pt-pass input { padding-right: 48px; }
.pt-show { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 50%; }
.pt-show:hover { color: var(--ink); }
.pt-error { color: var(--bad-text); font-size: .92rem; }
.pt-submit { margin-top: 4px; width: 100%; }
.pt-demo-note { display: flex; gap: 12px; margin-top: 28px; padding: 14px 16px; border: 1px dashed var(--line); border-radius: var(--radius); font-size: .92rem; line-height: 1.6; }
.pt-demo-note > i { color: var(--muted); margin-top: 4px; }
.pt-link { background: none; border: 0; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; cursor: pointer; }
.pt-help { margin-top: 18px; font-size: .88rem; color: var(--muted); }
.pt-help a { color: var(--ink); }

/* ---------- Dashboard header + KPIs ---------- */
.pt-head { padding: 48px 0 32px; }
.pt-head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.pt-head h1 { font-size: clamp(1.9rem, 3.6vw, 2.8rem); }
.pt-head-btns { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- Choose a project (clients with more than one) ---------- */
.pt-pick { min-height: calc(100vh - var(--nav-h) - 80px); padding-bottom: 80px; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 36px; }
.pick { display: flex; flex-direction: column; gap: 8px; text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; cursor: pointer; transition: border-color .2s, transform .3s; }
.pick:hover { border-color: var(--ink); transform: translateY(-2px); }
.pick:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.pick-type { font-family: var(--head); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.pick-title { font-family: var(--head); font-size: 1.35rem; font-weight: 500; line-height: 1.25; }
.pick-meta { font-size: .9rem; color: var(--muted); }
.pick-bar { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; margin-top: 10px; font-size: .85rem; }
.pick-bar .meter { margin-top: 0; }
.pick-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--line); font-size: .9rem; }
.pick-foot b { font-variant-numeric: tabular-nums; }
.pick-foot > i { margin-left: auto; color: var(--muted); transition: transform .3s, color .2s; }
.pick:hover .pick-foot > i { transform: translateX(4px); color: var(--ink); }
.pt-sample { color: var(--bad-text); }
.pt-meta { margin-top: .6rem; color: var(--muted); }
.pt-logout { flex: none; display: inline-flex; align-items: center; gap: 8px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: .6rem 1.1rem; font-family: var(--head); font-size: .88rem; cursor: pointer; transition: border-color .2s; }
.pt-logout:hover { border-color: var(--ink); }
.pt-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 32px; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; background: var(--surface); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.kpi-label { font-size: .85rem; color: var(--muted); }
.kpi-value { font-family: var(--head); font-weight: 600; color: var(--ink); font-size: 1.7rem; line-height: 1.2; }
.kpi-value.small { font-size: 1.2rem; font-weight: 500; }
.kpi-sub { font-size: .88rem; color: var(--text); line-height: 1.5; }
.meter { height: 8px; border-radius: 999px; background: var(--plan); overflow: hidden; margin-top: 6px; }
.meter > span { display: block; height: 100%; background: var(--ink); border-radius: 999px; }
.meter.thin { height: 4px; margin-top: 0; }

/* status: icon + label, colour never alone */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; line-height: 1.3; color: var(--ink); background: var(--tint); border-radius: 999px; padding: 3px 10px 3px 8px; white-space: nowrap; width: max-content; }
.chip i { font-size: .8rem; }
.chip.good i { color: var(--good); }
.chip.warn i { color: #c88a00; }
.chip.bad i { color: var(--bad); }
.chip.idle i { color: var(--muted); }
:root[data-theme="dark"] .chip.warn i { color: var(--warn); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.warn i { color: var(--warn); } }

/* ---------- Section tabs ---------- */
.pt-tabs { position: sticky; top: var(--nav-h); z-index: 20; background: var(--nav-bg); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.pt-tabs .container { display: flex; gap: 28px; overflow-x: auto; scrollbar-width: none; }
.pt-tabs .container::-webkit-scrollbar { display: none; }
.pt-tabs a { flex: none; padding: 14px 0; font-family: var(--head); font-size: .92rem; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; transition: color .2s, border-color .2s; }
.pt-tabs a:hover, .pt-tabs a.on { color: var(--ink); border-bottom-color: var(--ink); }
.pt-sec { padding: 56px 0 24px; scroll-margin-top: calc(var(--nav-h) + 52px); }
.pt-sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 24px; }
.pt-sec-head h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.pt-sec-note { color: var(--muted); font-size: .92rem; }

/* ---------- Gantt ---------- */
.pt-legend { display: flex; gap: 18px; font-size: .85rem; color: var(--text); }
.pt-legend span { display: inline-flex; align-items: center; gap: 6px; }
.sw { display: inline-block; width: 18px; height: 8px; border-radius: 4px; }
.sw-plan { background: var(--plan); }
.sw-act { background: var(--ink); }
.sw-today { width: 2px; height: 14px; border-radius: 0; background: var(--bad); }
.gantt { --label: 300px; position: relative; }
.g-scale, .g-row { display: grid; grid-template-columns: var(--label) 1fr; gap: 20px; align-items: center; }
.g-scale { font-size: .78rem; color: var(--muted); padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.g-months { position: relative; height: 18px; }
.g-months span { position: absolute; top: 0; transform: translateX(2px); white-space: nowrap; }
.g-scale { padding-top: 22px; }
.g-row { padding: 14px 0; border-bottom: 1px solid var(--line); }
.g-name { display: grid; gap: 4px; min-width: 0; }
.g-name b { font-family: var(--head); font-weight: 500; color: var(--ink); font-size: .98rem; }
.g-name small { font-size: .82rem; color: var(--muted); line-height: 1.4; }
.g-track { position: relative; height: 30px; }
.g-grid { position: absolute; top: -14px; bottom: -14px; width: 1px; background: var(--line); opacity: .6; }
.g-bar { position: absolute; height: 10px; border-radius: 4px; cursor: default; outline: none; }
.g-bar.plan { top: 3px; background: var(--plan); }
.g-bar.act { top: 16px; background: var(--ink); box-shadow: 0 0 0 2px var(--bg); }
.g-bar.act.open { background: repeating-linear-gradient(135deg, var(--ink) 0 6px, color-mix(in srgb, var(--ink) 55%, transparent) 6px 9px); }
.g-bar:hover, .g-bar:focus-visible { filter: brightness(.85); }
.g-bar:focus-visible { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink); }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); pointer-events: none; z-index: 2; }
.g-months .g-today { top: 0; bottom: -10px; }
.g-months .g-today::before { content: "Today"; position: absolute; top: -2px; left: 6px; font-size: .72rem; color: var(--bad-text); font-family: var(--head); white-space: nowrap; }
.g-body { position: relative; }
.pt-tip { position: fixed; z-index: 80; pointer-events: none; background: var(--ink); color: var(--on-ink); font-size: .82rem; line-height: 1.5; padding: 8px 12px; border-radius: 8px; max-width: 260px; box-shadow: 0 8px 24px -10px rgba(0,0,0,.4); }
.pt-tip b { font-weight: 500; }

/* ---------- Site progress feed ---------- */
.pt-feed { display: grid; gap: 0; }
.up { display: grid; grid-template-columns: 140px 1fr; gap: 24px; padding: 24px 0; border-top: 1px solid var(--line); }
.up:last-child { border-bottom: 1px solid var(--line); }
.up-date { font-family: var(--head); color: var(--ink); font-size: .95rem; }
.up-date small { display: block; color: var(--muted); font-family: var(--body); font-size: .82rem; margin-top: 2px; }
.up-stage { font-family: var(--head); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.up-note { color: var(--text); margin-top: 4px; max-width: 70ch; }
.up-photos { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.up-photos a { display: block; width: 200px; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--tint); }
.up-photos img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease-out, ease); }
.up-photos a:hover img { transform: scale(1.05); }

/* ---------- BOQ ---------- */
.boq-g { border-top: 1px solid var(--line); }
.boq-g:last-of-type { border-bottom: 1px solid var(--line); }
.boq-g summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 1fr 160px 150px 20px; gap: 20px; align-items: center; padding: 16px 0; }
.boq-g summary::-webkit-details-marker { display: none; }
.boq-g summary b { font-family: var(--head); font-weight: 500; color: var(--ink); }
.boq-g summary .amt { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.boq-g summary .done { display: grid; gap: 4px; font-size: .8rem; color: var(--muted); }
.boq-g summary > i { color: var(--muted); transition: transform .3s; }
.boq-g[open] summary > i { transform: rotate(180deg); }
.boq-total { display: flex; justify-content: space-between; gap: 20px; padding: 18px 0 0; font-family: var(--head); color: var(--ink); font-size: 1.1rem; }
.pt-table-wrap { overflow-x: auto; }
.pt-table { width: 100%; border-collapse: collapse; font-size: .92rem; min-width: 640px; }
.pt-table th { text-align: left; font-family: var(--head); font-weight: 500; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.pt-table td { padding: 12px; border-bottom: 1px solid var(--line); color: var(--text); vertical-align: middle; }
.pt-table td.n, .pt-table th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pt-table td.strong { color: var(--ink); }
.boq-g .pt-table { margin-bottom: 16px; }
.boq-g .pt-table td { padding: 10px 12px; }
.pct { display: grid; grid-template-columns: 34px 60px; gap: 8px; align-items: center; justify-content: end; }

/* ---------- Payments ---------- */
.pay-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.pay-bar { grid-column: 1 / -1; }
.seg { display: flex; gap: 2px; height: 8px; }
.seg span { height: 100%; border-radius: 999px; }
.seg .s-paid { background: var(--ink); }
.seg .s-due { background: var(--bad); }
.seg .s-up { background: var(--plan); }
.seg-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; font-size: .85rem; }
.seg-legend span { display: inline-flex; align-items: center; gap: 6px; }
.seg-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* ---------- Assistant ---------- */
.ask-fab { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: inline-flex; align-items: center; gap: 10px; background: var(--ink); color: var(--on-ink); border: 0; border-radius: 999px; padding: .9rem 1.3rem; font-family: var(--head); font-size: .95rem; cursor: pointer; box-shadow: 0 12px 30px -12px rgba(0,0,0,.5); transition: transform .25s; }
.ask-fab:hover { transform: translateY(-2px); }
.ask { position: fixed; right: 20px; bottom: 20px; z-index: 70; width: min(400px, calc(100vw - 32px)); height: min(620px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px -20px rgba(0,0,0,.45); opacity: 0; transform: translateY(16px) scale(.98); pointer-events: none; transition: opacity .25s, transform .3s; }
.ask.open { opacity: 1; transform: none; pointer-events: auto; }
.ask-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.ask-head h3 { font-size: 1.05rem; }
.ask-head p { font-size: .8rem; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.ask-close { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--ink); cursor: pointer; }
.ask-log { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 14px; font-size: .92rem; line-height: 1.55; }
.msg.me { align-self: flex-end; background: var(--ink); color: var(--on-ink); border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--tint); color: var(--ink); border-bottom-left-radius: 4px; }
.msg.bot p + p { margin-top: .5rem; }
.msg.typing { color: var(--muted); }
.msg.typing span { display: inline-block; animation: pt-blink 1s infinite; }
.msg.typing span:nth-child(2) { animation-delay: .2s; }
.msg.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes pt-blink { 50% { opacity: .2; } }
.ask-chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 18px 10px; scrollbar-width: none; }
.ask-chips button { flex: none; font: inherit; font-size: .82rem; color: var(--ink); background: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.ask-chips button:hover { border-color: var(--ink); }
.ask-form { display: flex; gap: 8px; padding: 0 18px 10px; }
.ask-form input { flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: .7rem 1rem; outline: none; }
.ask-form input:focus { border-color: var(--ink); }
.ask-form button { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--ink); color: var(--on-ink); cursor: pointer; }
.ask-foot { font-size: .72rem; color: var(--muted); line-height: 1.4; padding: 0 18px 14px; }

/* Assistant answer pieces */
.msg.bot p, .msg.bot li { font-size: inherit; line-height: inherit; color: inherit; }
.msg.bot .chip { vertical-align: middle; margin-left: 4px; }
.ask-sub { color: var(--muted); font-size: .86rem; }
.msg.bot .ask-sub { color: var(--muted); font-size: .86rem; }
.ask-meter { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; margin-top: .5rem; font-size: .82rem; font-variant-numeric: tabular-nums; }
.ask-meter .meter { margin-top: 0; background: color-mix(in srgb, var(--ink) 14%, transparent); }
.ask-meter-name { grid-column: 1 / -1; color: var(--ink); }
.ask-list { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: 6px; }
.ask-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.ask-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.ask-list small { display: block; color: var(--muted); font-size: .78rem; }
.ask-list b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ask-list.plain li { display: block; }
.ask-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: .6rem; }
.ask-photos a { display: block; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--surface); }
.ask-photos img { width: 100%; height: 100%; object-fit: cover; }
.ask-jump, .ask-wa { display: inline-flex; align-items: center; gap: 8px; margin-top: .7rem; margin-right: 6px; font: inherit; font-family: var(--head); font-size: .82rem; line-height: 1.2; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; cursor: pointer; text-decoration: none; transition: border-color .2s; }
.ask-jump:hover, .ask-wa:hover { border-color: var(--ink); }
.ask-jump i { font-size: .75rem; }
.ask-wa i { color: #1fa855; font-size: 1rem; }
.msg.bot a:not(.ask-wa):not(.ask-photos a) { color: var(--ink); }
.pt-flash { animation: pt-flash 2.2s ease-out; }
@keyframes pt-flash { 0%, 35% { background-color: var(--tint); box-shadow: 0 0 0 6px var(--tint); } 100% { background-color: transparent; box-shadow: 0 0 0 6px transparent; } }
@media (prefers-reduced-motion: reduce) { .pt-flash { animation-duration: .01s; } }

/* ---------- Small screens ---------- */
@media (max-width: 1000px) {
  .pt-kpis { grid-template-columns: repeat(2, 1fr); }
  .gantt { --label: 220px; }
}
@media (max-width: 760px) {
  .pt-login { grid-template-columns: 1fr; min-height: 0; }
  .pt-login-photo { height: 180px; }
  .pt-login-box { padding: 36px 16px 56px; }
  .pt-head { padding-top: 32px; }
  .pt-head-row { flex-direction: column; }
  .pt-kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi-value { font-size: 1.35rem; }
  .kpi-value.small { font-size: 1.05rem; }
  .g-scale, .g-row { grid-template-columns: 1fr; gap: 8px; }
  .g-scale > div:first-child { display: none; }
  .g-months span:nth-child(even) { display: none; }
  .up { grid-template-columns: 1fr; gap: 8px; }
  .up-photos a { width: calc(50% - 5px); }
  .boq-g summary { grid-template-columns: 1fr 100px 16px; gap: 12px; }
  .boq-g summary .amt { grid-column: 2; grid-row: 1; }
  .boq-g summary .done { grid-column: 1 / 3; grid-row: 2; }
  .boq-g summary > i { grid-column: 3; grid-row: 1; }
  .pay-sum { grid-template-columns: 1fr 1fr; }
  .pay-sum .kpi:first-child { grid-column: 1 / -1; }
  .ask { right: 16px; bottom: 16px; height: calc(100vh - 100px); }
  .ask-fab { right: 16px; bottom: 16px; }
  .ask-fab span { display: none; }
  .ask-fab { width: 56px; height: 56px; padding: 0; justify-content: center; font-size: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ask, .up-photos img, .ask-fab { transition: none; }
}
.pt-empty { color: var(--muted); padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* ---------- Drawings ---------- */
.pt-logout.small { padding: .45rem .9rem; font-size: .82rem; gap: 6px; }
.pt-logout:disabled { opacity: .55; cursor: default; }
.dw-head-right { display: flex; align-items: center; gap: 14px; }
.dw-group + .dw-group { margin-top: 28px; }
.dw-group h3 { font-size: .78rem; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.dw { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); scroll-margin-top: calc(var(--nav-h) + 80px); }
.dw-ic { font-size: 1.3rem; color: var(--muted); text-align: center; }
.dw-name { display: grid; gap: 2px; min-width: 0; }
.dw-name b { font-family: var(--head); font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.dw-name small { font-size: .84rem; color: var(--muted); }
.dw-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

/* ---------- Download box ---------- */
.pt-dl { box-sizing: border-box; margin: auto; overflow-y: auto; width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 22px; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 24px 60px -20px rgba(0,0,0,.45); }
.pt-dl::backdrop { background: rgba(0,0,0,.45); }
.pt-dl-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.pt-dl-head h3 { font-size: 1.25rem; }
.pt-dl-scope { border: 0; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pt-dl-scope legend { font-family: var(--head); font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.pt-dl-scope label { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; cursor: pointer; }
.pt-dl-scope label:has(input:checked) { border-color: var(--ink); }
.pt-dl-scope input { margin-top: 4px; accent-color: var(--ink); }
.pt-dl-scope span { display: grid; gap: 2px; color: var(--ink); font-family: var(--head); }
.pt-dl-scope small { font-family: inherit; font-size: .82rem; color: var(--muted); }
.pt-dl-opts { display: grid; gap: 10px; }
.pt-dl-opts button { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; text-align: left; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; cursor: pointer; transition: border-color .2s; }
.pt-dl-opts button:hover:not(:disabled) { border-color: var(--ink); }
.pt-dl-opts button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.pt-dl-opts button:disabled { opacity: .5; cursor: default; }
.pt-dl-opts i { font-size: 1.4rem; color: var(--ink); margin-top: 2px; }
.pt-dl-opts span { display: grid; gap: 3px; }
.pt-dl-opts b { font-family: var(--head); font-weight: 500; color: var(--ink); }
.pt-dl-opts small { font-size: .85rem; line-height: 1.5; color: var(--muted); }
.pt-dl-status { min-height: 1.4em; margin-top: 12px; font-size: .9rem; color: var(--ink); }
@media (max-width: 760px) {
  .dw { grid-template-columns: 24px 1fr; }
  .dw-btns { grid-column: 2; justify-content: flex-start; }
  .pt-dl { padding: 18px 16px; }
  .pt-dl-scope { grid-template-columns: 1fr; }
}
