/* Customer support portal - page layer over the Rapax v2 design system (css/rapax.css, a
   build-time copy of /ui/ds/rapax.css), --rx-* tokens only, light + dark. Sign-in type pages
   use the two-column brand panel of the staff sign-in page; signed-in pages use a slim top
   bar and a centred content column. Strict CSP: no inline styles anywhere. */
@layer page {
  /* the design system pins body to the viewport (app shell); the portal scrolls like a document */
  body.pt-body { display: block; height: auto; min-height: 100dvh; overflow: auto; }
  body.pt-appbody { display: flex; flex-direction: column; }
  [hidden] { display: none !important; }
  .pt-grow { flex: 1; min-width: 0; }

  /* ================================================================ sign-in type pages */
  .pt-auth { position: relative; display: grid; grid-template-columns: minmax(360px, 44%) minmax(0, 1fr); min-height: 100dvh; }
  /* the sign-in panel is always dark. Settings > Branding > Support portal may set its accent
     and hero background: /api/branding.css?scope=portal then defines --pt-accent (the accent
     lightened to >= 4.5:1 on the hero), --pt-hero, --pt-hero-2 and --pt-hero-muted - all
     BRD-04 checked on save; without them the defaults below apply */
  .pt-brand {
    --pt-accent-x: var(--pt-accent, color-mix(in oklab, var(--rx-brand) 55%, #FFFFFF));
    --pt-hero-x: var(--pt-hero, #111822);
    position: relative; overflow: hidden; isolation: isolate;
    display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
    padding: 40px 48px; color: #E6E9EE;
    background-color: var(--pt-hero-x);
    background-image:
      radial-gradient(1200px 520px at 0% 100%, color-mix(in oklab, var(--rx-brand) 38%, transparent), transparent 60%),
      radial-gradient(700px 420px at 100% 0%, color-mix(in oklab, var(--rx-brand) 22%, transparent), transparent 65%),
      linear-gradient(160deg, var(--pt-hero-2, #1A2332) 0%, var(--pt-hero-x) 70%);
  }
  /* optional sign-in background image (decorative <img>, never a CSS url): under a scrim in
     the hero colour so the panel text keeps its checked contrast */
  .pt-hero-img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
  .pt-brand.has-bg::before { opacity: 1; background-image: none; background-color: color-mix(in srgb, var(--pt-hero-x) 80%, transparent); mask-image: none; }
  .pt-brand::before {
    content: ""; position: absolute; inset: 0; z-index: -1; opacity: .5;
    background-image: radial-gradient(rgba(255, 255, 255, .09) 1px, transparent 1.4px);
    background-size: 22px 22px;
    mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  }
  .pt-brand .pt-logo { color: #fff; font-size: 20px; }
  .pt-brand .pt-mark { width: 36px; height: 36px; border-radius: 9px; font-size: 18px; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); }
  .pt-brand .pt-logo-img { max-height: 44px; max-width: 240px; }
  .pt-brand-mid { max-width: 460px; }
  .pt-kicker { margin: 0 0 10px; font-size: var(--rx-text-xs); font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--pt-accent-x); }
  .pt-tagline { font-size: 32px; line-height: 1.15; font-weight: 650; letter-spacing: -.02em; color: #fff; margin: 0 0 24px; text-wrap: balance; overflow-wrap: anywhere; }
  .pt-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; color: var(--pt-hero-muted, #C3CBD6); font-size: var(--rx-text-md); }
  .pt-points li { display: flex; align-items: center; gap: 12px; }
  .pt-pt { width: 8px; height: 8px; border-radius: 50%; background: var(--pt-accent-x); box-shadow: 0 0 0 4px color-mix(in oklab, var(--pt-accent-x) 22%, transparent); flex: none; }
  .pt-legal { margin: 0; font-size: var(--rx-text-xs); color: var(--pt-hero-muted, #8C99A8); }
  /* FRANK line (sign-in page): name, fixed "AI assistant" badge (text, not colour only), intro */
  .pt-frank { display: flex; align-items: flex-start; gap: 12px; margin-top: 28px; padding: 14px 16px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); }
  .pt-frank-av { width: 40px; height: 40px; border-radius: 50%; flex: none; object-fit: cover; background: rgba(255, 255, 255, .1); }
  .pt-frank-txt { min-width: 0; display: grid; gap: 4px; }
  .pt-frank-who { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; color: #fff; font-size: var(--rx-text-md); letter-spacing: .04em; }
  .pt-ai-badge { display: inline-flex; align-items: center; padding: 0 7px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 18px; letter-spacing: .02em; color: var(--pt-accent-x); border: 1px solid currentColor; }
  .pt-frank-intro { margin: 0; color: var(--pt-hero-muted, #C3CBD6); font-size: var(--rx-text-sm); line-height: 1.45; overflow-wrap: anywhere; }

  .pt-panel { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px 24px; background: var(--rx-surface-0); min-width: 0; }
  .pt-tools { position: absolute; top: 14px; right: 14px; }
  .pt-card { width: min(420px, 100%); margin: auto 0; animation: pt-in .35s ease-out both; }
  @keyframes pt-in { from { opacity: 0; transform: translateY(8px); } }
  .pt-head { margin-bottom: 24px; }
  .pt-head h1 { font-size: var(--rx-text-2xl); font-weight: 650; letter-spacing: -.015em; margin-bottom: 6px; }
  .pt-head p { margin: 0; }
  .pt-alt { margin: 20px 0 0; text-align: center; font-size: var(--rx-text-sm); color: var(--rx-text-2); }
  .pt-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 12px; padding-top: 32px; font-size: var(--rx-text-xs); color: var(--rx-text-2); text-align: center; }
  .pt-foot a { color: var(--rx-text-2); }
  .pt-legal-sm { display: none; flex-basis: 100%; margin: 4px 0 0; }

  /* ================================================================ logo (both layouts) */
  .pt-logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.01em; text-decoration: none !important; color: var(--rx-text); min-width: 0; }
  .pt-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--rx-brand-mark); color: #fff; font-size: 15px; flex: none; }
  .pt-logo-img { max-height: 32px; max-width: 200px; width: auto; display: block; }
  .pt-logo.has-img .pt-mark, .pt-logo.has-img .pt-name { display: none; }
  .pt-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pt-name-sub { font-weight: 500; color: var(--rx-text-2); }

  /* ================================================================ forms */
  .pt-form .rx-field { margin-bottom: 16px; gap: 6px; }
  .pt-form .rx-field > label:not(.pt-file), .pt-label-row label, .pt-label, .pt-choice legend { font-size: var(--rx-text-sm); font-weight: 600; color: var(--rx-text); }
  .rx-input.pt-input { height: 42px; padding: 0 12px; font-size: 15px; background: var(--rx-surface-1); border-radius: 8px; }
  textarea.rx-input.pt-input { height: auto; padding: 10px 12px; line-height: 1.5; min-height: 96px; }
  select.rx-input.pt-input { padding-right: 8px; }
  .rx-input.pt-input[aria-invalid="true"] { border-color: var(--rx-sev-critical-fg); }
  .rx-input:disabled { opacity: .65; }
  .pt-label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
  .pt-small { font-size: var(--rx-text-sm); }
  .pt-req, .pt-opt { font-size: var(--rx-text-xs); font-weight: 500; color: var(--rx-text-2); margin-left: 4px; }
  .pt-hint { margin: 0; font-size: var(--rx-text-xs); color: var(--rx-text-2); }
  .pt-form > .pt-hint { margin: -10px 0 16px; }
  .pt-pw { position: relative; }
  .pt-pw .pt-input { padding-right: 46px; }
  .pt-eye { position: absolute; top: 4px; right: 4px; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 6px; background: none; color: var(--rx-text-2); cursor: pointer; }
  .pt-eye:hover { background: var(--rx-surface-2); color: var(--rx-text); }
  .pt-eye .rx-i { width: 18px; height: 18px; }
  .rx-btn.pt-submit { width: 100%; min-height: 44px; border-radius: 8px; font-size: 15px; font-weight: 600; gap: 10px; margin-top: 4px; }
  .rx-btn .rx-i { width: 15px; height: 15px; }
  .pt-spin { display: inline-block; width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: pt-spin .8s linear infinite; flex: none; }
  @keyframes pt-spin { to { transform: rotate(360deg); } }
  .pt-link-btn { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; padding: 0; color: var(--rx-interactive); font-size: var(--rx-text-sm); cursor: pointer; text-align: left; }
  .pt-link-btn:hover { text-decoration: underline; }
  .pt-link-btn .rx-i { width: 13px; height: 13px; }
  .pt-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
  .pt-captcha #captcha-question { font-weight: 700; font-variant-numeric: tabular-nums; }

  /* status / error line */
  .pt-msg { --c: var(--rx-sev-critical-fg); display: flex; align-items: flex-start; gap: 10px; margin: 0 0 16px; padding: 10px 12px; border-radius: 8px; font-size: var(--rx-text-sm); color: var(--rx-text);
    background: color-mix(in oklab, var(--c) 12%, var(--rx-surface-1)); border: 1px solid color-mix(in oklab, var(--c) 45%, transparent); animation: pt-in .2s ease-out both; }
  .pt-msg > svg { color: var(--c); margin-top: 1px; }
  .pt-msg.success { --c: var(--rx-sev-clear-fg); }
  .pt-msg.warn { --c: var(--rx-sev-major-fg); }
  .pt-msg.info { --c: var(--rx-interactive); }
  .pt-form .rx-btn.pt-submit + .pt-msg { margin: 16px 0 0; }

  /* ================================================================ signed-in layout */
  .pt-skip { position: absolute; left: 8px; top: -60px; z-index: 50; padding: 8px 12px; border-radius: 6px; background: var(--rx-interactive); color: var(--rx-on-interactive); font-weight: 600; }
  .pt-skip:focus { top: 8px; }
  .pt-top { position: sticky; top: 0; z-index: 20; background: color-mix(in oklab, var(--rx-surface-1) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--rx-border-subtle); }
  .pt-top-in { max-width: 1180px; margin: 0 auto; height: 56px; padding: 0 20px; display: flex; align-items: center; gap: 12px; }
  .pt-nav { display: flex; align-items: center; gap: 2px; margin-left: 16px; }
  .pt-nav-a { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 8px; color: var(--rx-text-2); font-size: var(--rx-text-sm); font-weight: 500; text-decoration: none !important; }
  .pt-nav-a:hover { background: var(--rx-surface-2); color: var(--rx-text); }
  .pt-nav-a[aria-current="page"] { color: var(--rx-text); background: var(--rx-interactive-soft); box-shadow: inset 0 -2px 0 var(--rx-interactive); }
  .pt-user { position: relative; }
  .pt-user-btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 4px; border: 1px solid transparent; border-radius: 999px; background: none; cursor: pointer; max-width: 260px; }
  .pt-user-btn:hover, .pt-user-btn[aria-expanded="true"] { background: var(--rx-surface-2); border-color: var(--rx-border-subtle); }
  .pt-avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; background: var(--rx-interactive-soft); color: var(--rx-interactive); flex: none; }
  .pt-user-name { font-size: var(--rx-text-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pt-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 230px; padding: 6px; border-radius: 10px; border: 1px solid var(--rx-border-subtle); background: var(--rx-surface-1); box-shadow: var(--rx-shadow-2); display: grid; gap: 2px; z-index: 30; }
  .pt-menu-who { margin: 0 0 4px; padding: 8px 10px 10px; display: grid; gap: 2px; font-size: var(--rx-text-xs); border-bottom: 1px solid var(--rx-border-subtle); overflow-wrap: anywhere; }
  .pt-menu-who b { font-size: var(--rx-text-sm); font-weight: 600; }
  .pt-menu [role="menuitem"] { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--rx-text); font-size: var(--rx-text-sm); text-align: left; cursor: pointer; text-decoration: none !important; }
  .pt-menu [role="menuitem"]:hover, .pt-menu [role="menuitem"]:focus-visible { background: var(--rx-surface-2); }

  .pt-main { flex: 1 0 auto; width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 20px 48px; }
  .pt-page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
  .pt-page-head h1 { font-size: var(--rx-text-2xl); font-weight: 650; letter-spacing: -.015em; margin-bottom: 4px; }
  .pt-page-head p { margin: 0; }
  .rx-btn.pt-cta, .pt-actions .rx-btn, .td-actions .rx-btn, .pt-state .rx-btn { min-height: 38px; padding: 0 16px; border-radius: 8px; font-size: var(--rx-text-sm); }
  .pt-crumb { margin-bottom: 12px; font-size: var(--rx-text-sm); }
  .pt-crumb a { display: inline-flex; align-items: center; gap: 6px; color: var(--rx-text-2); }
  .pt-crumb a:hover { color: var(--rx-text); }
  .pt-footer { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; padding: 20px; font-size: var(--rx-text-xs); color: var(--rx-text-2); border-top: 1px solid var(--rx-border-subtle); }
  .pt-footer a { color: var(--rx-text-2); }

  .pt-panel-card { background: var(--rx-surface-1); border: 1px solid var(--rx-border-subtle); border-radius: 12px; box-shadow: var(--rx-shadow-1); padding: 20px; min-width: 0; }
  .pt-panel-card.flush { padding: 0; }
  .pt-panel-card > h2 { font-size: var(--rx-text-md); font-weight: 650; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
  .pt-count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--rx-surface-2); color: var(--rx-text-2); font-size: var(--rx-text-xs); font-weight: 700; font-variant-numeric: tabular-nums; }
  .pt-card-skel { height: 220px; border-radius: 12px; border: 1px solid var(--rx-border-subtle);
    background: linear-gradient(90deg, var(--rx-surface-1) 25%, var(--rx-surface-2) 50%, var(--rx-surface-1) 75%); background-size: 200% 100%; animation: pt-shimmer 1.4s linear infinite; }
  @keyframes pt-shimmer { to { background-position: -200% 0; } }
  .empty { margin: 0; color: var(--rx-text-2); font-size: var(--rx-text-sm); }
  .pt-state { display: grid; justify-items: center; gap: 8px; padding: 48px 24px; text-align: center; }
  .pt-state h1, .pt-state h2 { font-size: var(--rx-text-lg); }
  .pt-state p { max-width: 440px; }
  .pt-state-ic { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--rx-interactive-soft); color: var(--rx-interactive); margin-bottom: 4px; }
  .pt-state-ic.err { background: color-mix(in oklab, var(--rx-sev-critical-fg) 12%, var(--rx-surface-1)); color: var(--rx-sev-critical-fg); }
  .pt-state-ic .rx-i { width: 22px; height: 22px; }
  .pt-state .rx-btn { margin-top: 8px; }

  /* status + priority pills (text label always present; colour is a second cue) */
  .pt-status { --c: var(--rx-text-2); display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; border-radius: 999px; font-size: var(--rx-text-xs); font-weight: 600; line-height: 22px; white-space: nowrap;
    color: color-mix(in oklab, var(--c) 85%, var(--rx-text)); background: color-mix(in oklab, var(--c) 13%, var(--rx-surface-1)); border: 1px solid color-mix(in oklab, var(--c) 35%, transparent); }
  .pt-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
  .pt-status.st-new { --c: var(--rx-sev-warning-fg); }
  .pt-status.st-acknowledged, .pt-status.st-pending { --c: var(--rx-viz-cat-1); }
  .pt-status.st-investigating, .pt-status.st-escalated { --c: var(--rx-sev-minor-fg); }
  .pt-status.st-monitoring, .pt-status.st-on_hold { --c: var(--rx-viz-cat-7); }
  .pt-status.st-resolved { --c: var(--rx-sev-clear-fg); }
  .pt-status.st-closed { --c: var(--rx-text-2); }
  .pt-prio { --c: var(--rx-sev-info-fg); display: inline-flex; align-items: center; gap: 4px; padding: 0 8px; border-radius: 6px; font-size: var(--rx-text-xs); line-height: 22px; white-space: nowrap; color: var(--rx-text); border: 1px solid var(--rx-border-subtle); background: var(--rx-surface-1); }
  .pt-prio b { color: var(--c); font-weight: 700; }
  .pt-prio.p1 { --c: var(--rx-sev-critical-fg); border-color: color-mix(in oklab, var(--rx-sev-critical-fg) 45%, transparent); }
  .pt-prio.p2 { --c: var(--rx-sev-major-fg); }
  .pt-prio.p3 { --c: var(--rx-sev-minor-fg); }
  .pt-tag { display: inline-flex; align-items: center; padding: 0 8px; border-radius: 6px; font-size: var(--rx-text-xs); line-height: 22px; background: var(--rx-surface-2); color: var(--rx-text-2); }

  /* ================================================================ ticket list */
  #app { display: grid; gap: 20px; }
  .pt-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
  .pt-search { position: relative; flex: 1 1 320px; max-width: 460px; }
  .pt-search > svg { position: absolute; left: 12px; top: 12px; color: var(--rx-text-2); }
  .pt-search .rx-input { height: 40px; padding-left: 36px; border-radius: 8px; background: var(--rx-surface-1); }
  .pt-summary { font-size: var(--rx-text-sm); }
  .ts-head { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--rx-border-subtle); }
  .ts-head h2 { font-size: var(--rx-text-md); font-weight: 650; }
  .ticket-section > .empty { padding: 18px 20px; }
  .ticket-list { list-style: none; margin: 0; padding: 0; }
  .ticket-list > li + li { border-top: 1px solid var(--rx-border-subtle); }
  .ticket-row { display: grid; grid-template-columns: minmax(0, 1fr) 110px 130px 150px 16px; align-items: center; gap: 16px; padding: 14px 20px; color: var(--rx-text); text-decoration: none !important; }
  .ticket-row:hover { background: color-mix(in oklab, var(--rx-interactive) 5%, var(--rx-surface-1)); }
  .ticket-row:focus-visible { outline-offset: -2px; }
  .ticket-section .ticket-list > li:last-child .ticket-row { border-radius: 0 0 12px 12px; }
  .tr-main { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; row-gap: 2px; align-items: baseline; min-width: 0; }
  .ticket-number { font-family: var(--rx-font-mono); font-size: 12.5px; color: var(--rx-text-2); white-space: nowrap; }
  .ticket-subject { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tr-sub { grid-column: 2; font-size: var(--rx-text-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tr-upd { font-size: var(--rx-text-xs); text-align: right; white-space: nowrap; }
  .tr-go { color: var(--rx-text-2); display: grid; }
  .ts-nomatch { padding: 14px 20px; }

  /* ================================================================ new ticket */
  .ticket-form { max-width: 760px; }
  .pt-narrow { max-width: 520px; }
  .pt-choice { border: 0; margin: 0 0 18px; padding: 0; min-width: 0; }
  .pt-choice legend { padding: 0; margin-bottom: 8px; }
  .pt-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .pt-opt-card { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--rx-border-control); background: var(--rx-surface-1); cursor: pointer; font-size: var(--rx-text-sm); }
  .pt-opt-card:hover { border-color: var(--rx-interactive); }
  .pt-opt-card input { accent-color: var(--rx-interactive); margin: 2px 0 0; width: 16px; height: 16px; flex: none; }
  .pt-opt-card > span { display: grid; gap: 2px; }
  .pt-opt-card .rx-muted { font-size: var(--rx-text-xs); }
  .pt-opt-card:has(input:checked) { border-color: var(--rx-interactive); background: var(--rx-interactive-soft); box-shadow: 0 0 0 1px var(--rx-interactive); }
  .pt-opt-card:has(input:focus-visible) { outline: 2px solid var(--rx-focus); outline-offset: 2px; }
  .outage-warn { margin: -4px 0 18px; padding: 12px 14px; border-radius: 10px; font-size: var(--rx-text-sm); border: 1px solid color-mix(in oklab, var(--rx-sev-critical-fg) 50%, transparent); background: color-mix(in oklab, var(--rx-sev-critical-fg) 9%, var(--rx-surface-1)); }
  .outage-warn p { margin: 0 0 10px; }
  .outage-warn .ack-row { align-items: flex-start; font-weight: 600; }
  .outage-warn .ack-row input { margin-top: 2px; flex: none; }
  .pt-file { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 14px; border: 1px dashed var(--rx-border-control); border-radius: 10px; background: var(--rx-surface-1); cursor: pointer; font-size: var(--rx-text-sm); color: var(--rx-text-2); min-width: 0; }
  .pt-file:hover { border-color: var(--rx-interactive); color: var(--rx-text); }
  .pt-file:has(input:focus-visible) { outline: 2px solid var(--rx-focus); outline-offset: 2px; }
  .pt-file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
  .pt-file.has-file { border-style: solid; color: var(--rx-text); }
  .pt-file-ic { display: grid; color: var(--rx-interactive); }
  .pt-file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .pt-file.sm { min-height: 40px; }
  .pt-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
  .pt-form .pt-msg { margin: 0 0 16px; }

  /* ================================================================ ticket detail */
  .td-header { margin-bottom: 20px; }
  .td-id { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin: 0 0 6px; font-size: var(--rx-text-sm); }
  .td-header h1 { font-size: var(--rx-text-2xl); font-weight: 650; letter-spacing: -.015em; margin-bottom: 10px; overflow-wrap: anywhere; }
  .td-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .td-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
  .td-main, .td-side { display: grid; gap: 20px; min-width: 0; }
  .td-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--rx-text-md); line-height: 1.55; }
  .td-kv { grid-template-columns: 96px minmax(0, 1fr); gap: 10px 12px; align-items: center; }
  .conv { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
  .note { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; }
  .note-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--rx-surface-2); color: var(--rx-text-2); }
  .note.from-support .note-av { background: var(--rx-interactive-soft); color: var(--rx-interactive); }
  .note-body { min-width: 0; padding: 10px 14px; border-radius: 4px 12px 12px 12px; background: var(--rx-surface-2); }
  .note.from-support .note-body { background: color-mix(in oklab, var(--rx-interactive) 8%, var(--rx-surface-1)); border: 1px solid color-mix(in oklab, var(--rx-interactive) 25%, var(--rx-border-subtle)); }
  .note-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 4px; font-size: var(--rx-text-xs); color: var(--rx-text-2); }
  .note-meta strong { color: var(--rx-text); font-size: var(--rx-text-sm); }
  .note-meta .role { padding: 0 6px; border-radius: 4px; font-weight: 700; font-size: 11px; line-height: 17px; text-transform: uppercase; letter-spacing: .04em; color: var(--rx-interactive); border: 1px solid color-mix(in oklab, var(--rx-interactive) 45%, transparent); }
  .note-meta .role.ai { text-transform: none; letter-spacing: .01em; }
  img.note-av { object-fit: cover; background: var(--rx-surface-2); }
  .note.from-frank .note-body { border-style: dashed; }
  .note-meta .via { font-style: italic; }
  .note-time { margin-left: auto; }
  .note-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--rx-text-md); line-height: 1.5; }
  .td-reply textarea { margin-bottom: 12px; }
  .td-reply .pt-msg { margin: 0 0 12px; }
  .td-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
  .pt-note-closed { display: flex; gap: 10px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; font-size: var(--rx-text-sm); border: 1px solid var(--rx-border-subtle); background: var(--rx-surface-2); }
  .pt-note-closed > svg { color: var(--rx-sev-clear-fg); margin-top: 1px; }
  .attach-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
  .attach-list li { display: flex; gap: 10px; align-items: flex-start; min-width: 0; }
  .att-ic { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--rx-surface-2); color: var(--rx-text-2); flex: none; }
  .att-main { display: grid; gap: 1px; min-width: 0; }
  .att-main .pt-link-btn { font-weight: 600; overflow-wrap: anywhere; }
  .attach-size { font-size: var(--rx-text-xs); }
  .td-attachments > .empty { margin-bottom: 14px; }
  .td-attach-upload { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding-top: 14px; border-top: 1px solid var(--rx-border-subtle); }
  .td-attach-upload .pt-hint, .td-attach-upload .pt-msg { grid-column: 1 / -1; margin: 0; }
  .td-attach-upload .rx-btn { min-height: 40px; border-radius: 8px; }

  /* ================================================================ tablet / phone */
  @media (max-width: 960px) {
    .td-grid { grid-template-columns: minmax(0, 1fr); }
    .ticket-row { grid-template-columns: minmax(0, 1fr) auto auto 16px; }
    .tr-upd { display: none; }
  }
  @media (max-width: 900px) {
    .pt-auth { grid-template-columns: minmax(300px, 40%) minmax(0, 1fr); }
    .pt-brand { padding: 32px; }
    .pt-tagline { font-size: 26px; }
  }
  @media (max-width: 720px) {
    /* sign-in pages: the brand panel becomes a compact band */
    .pt-auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
    .pt-brand { padding: 20px 16px 22px; gap: 10px; }
    .pt-brand-mid { max-width: none; }
    .pt-kicker { margin: 0; }
    .pt-tagline { font-size: var(--rx-text-lg); font-weight: 600; margin: 0; color: var(--pt-hero-muted, #C3CBD6); letter-spacing: 0; }
    .pt-points, .pt-legal { display: none !important; }
    .pt-frank { margin-top: 10px; padding: 8px 10px; gap: 10px; align-items: center; }
    .pt-frank-av { width: 28px; height: 28px; }
    .pt-frank-who { font-size: var(--rx-text-sm); }
    .pt-frank-intro { font-size: var(--rx-text-xs); }
    .pt-panel { position: static; justify-content: flex-start; padding: 28px 16px 20px; }
    .pt-tools { top: 16px; right: 10px; }
    .pt-tools .rx-btn { color: #DCE3EA; min-height: 36px; width: 36px; }
    .pt-tools .rx-btn:hover { background: rgba(255, 255, 255, .08); color: #fff; }
    .pt-card { margin: 0; }
    .pt-legal-sm:not([hidden]) { display: block; }

    /* signed-in pages */
    .pt-top-in { padding: 0 12px; gap: 6px; height: 52px; }
    .pt-nav { margin-left: 4px; }
    .pt-nav-a { padding: 0 10px; }
    .pt-user-name, .pt-name-sub { display: none; }
    .pt-nav-a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .pt-user-btn { padding: 0 4px; }
    .pt-main { padding: 20px 16px 40px; }
    .pt-page-head h1, .td-header h1 { font-size: var(--rx-text-xl); }
    .pt-panel-card { padding: 16px; }
    .pt-choices { grid-template-columns: 1fr; }
    .ticket-row { grid-template-columns: auto auto minmax(0, 1fr) 16px; gap: 8px; padding: 14px 16px; }
    .tr-main { grid-column: 1 / 4; grid-template-columns: minmax(0, 1fr); }
    .tr-main .ticket-number, .tr-sub { grid-column: 1; }
    .ticket-subject { white-space: normal; }
    .tr-prio { grid-column: 1; grid-row: 2; }
    .tr-status { grid-column: 2; grid-row: 2; }
    .tr-go { grid-column: 4; grid-row: 1 / 3; }
    .ts-head { padding: 12px 16px; }
    .ticket-section > .empty, .ts-nomatch { padding: 14px 16px; }
    .pt-actions .rx-btn { flex: 1; }
    .note-time { margin-left: 0; flex-basis: 100%; }
  }
}
