/* ATO resident portal.
   Loaded after the site's app.css, so the brand tokens, fonts, focus rings and
   reduced-motion handling all come for free and only portal-specific
   components are defined here. Prefixed `p` throughout so nothing collides
   with the marketing site. */

.pbody { background: var(--ground-2); min-height: 100vh;
         display: flex; flex-direction: column; }
.pwrap { width: min(100% - (var(--gutter) * 2), 1100px); margin-inline: auto; }

/* ---------- header ------------------------------------------------------- */
.phead { background: var(--brand); border-bottom: 4px solid var(--gold); }
.phead .pwrap { display: flex; flex-wrap: wrap; gap: var(--sp-3);
                align-items: center; justify-content: space-between;
                padding-block: var(--sp-4); }
.pbrand { display: inline-flex; align-items: center; gap: var(--sp-4);
          text-decoration: none; }
.pbrand img { display: block; height: 40px; width: auto; }
.pbrand span { font-family: var(--font-mono); font-size: var(--step--2);
               font-weight: 650; letter-spacing: .14em; text-transform: uppercase;
               color: var(--gold-bright); }
.pmeta { display: flex; align-items: center; gap: var(--sp-4);
         font-size: var(--step--1); }
.pw-who { color: #E3D5FF; }
.pw-out { color: #fff; font-weight: 650; text-decoration: underline;
          text-underline-offset: .2em; min-height: 24px; display: inline-flex;
          align-items: center; }
.pw-out:hover { color: var(--gold-bright); }

.pnav { background: var(--navy); }
.pnav .pwrap { display: flex; gap: var(--sp-2); overflow-x: auto;
               scrollbar-width: none; }
.pnav .pwrap::-webkit-scrollbar { display: none; }
.pnav a { flex: none; padding: .85rem var(--sp-4); color: #CDBEE8;
          text-decoration: none; font-family: var(--font-mono);
          font-size: var(--step--1); font-weight: 600; white-space: nowrap;
          border-bottom: 3px solid transparent; }
.pnav a:hover { color: #fff; }
.pnav a.is-here { color: #fff; border-bottom-color: var(--gold-bright); }

.pmain { flex: 1; padding-block: var(--sp-6) var(--sp-8); }
.pmain > h1 { margin-bottom: var(--sp-5); }
.pmain > h2 { margin-top: var(--sp-7); }

/* ---------- flashes ------------------------------------------------------ */
.pf { padding: var(--sp-4) var(--sp-5); border-radius: var(--r-md);
      border-left: 4px solid; margin-bottom: var(--sp-5);
      font-size: var(--step--1); line-height: 1.6; }
.pf--ok { background: #EAF6EE; border-color: #1F6B3A; color: #14432A; }
.pf--info { background: var(--brand-tint); border-color: var(--brand-400);
            color: var(--ink); }
.pf--warn { background: var(--gold-100); border-color: var(--gold-text);
            color: #4A2E00; }
.pf--urgent { background: #FDECEC; border-color: #A3232B; color: #5C1418; }
.pf p:last-child { margin-bottom: 0; }

/* ---------- cards and grid ---------------------------------------------- */
.pgrid { display: grid; gap: var(--sp-5); margin-top: var(--sp-5);
         grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
         align-items: start; }
.pcard { background: var(--surface); border: 1px solid var(--rule);
         border-radius: var(--r-lg); padding: var(--sp-5);
         container-type: inline-size; }
.pcard h2 { font-size: var(--step-1); margin-bottom: var(--sp-4); }
.pcard p { font-size: var(--step--1); }
.pcard--help { background: var(--gold-100); border-color: var(--gold); }
.pcard--alert { border-color: #A3232B; border-left-width: 4px; }
.pcard--auth { max-width: 32rem; margin-inline: auto; }
.pcard--auth h1 { font-size: var(--step-2); }
.pcard-link { display: inline-block; margin-top: var(--sp-4);
              font-family: var(--font-mono); font-size: var(--step--1);
              font-weight: 650; color: var(--brand); text-decoration: none;
              min-height: 24px; }
.pcard-link:hover { text-decoration: underline; }

/* ---------- hero and balance -------------------------------------------- */
.phero { display: flex; flex-wrap: wrap; gap: var(--sp-5);
         justify-content: space-between; align-items: flex-start;
         padding-bottom: var(--sp-5); border-bottom: 1px solid var(--rule); }
.phero h1 { margin: 0 0 .2rem; }
.peyebrow { font-family: var(--font-mono); font-size: var(--step--2);
            font-weight: 650; letter-spacing: .12em; text-transform: uppercase;
            color: var(--ink-3); margin-bottom: .3rem; }
.plede { font-size: var(--step-0); color: var(--ink-2); max-width: 62ch; }

.pbal { background: var(--navy); color: #fff; border-radius: var(--r-lg);
        padding: var(--sp-5); min-width: 13rem; text-align: center; }
.pbal--clear { background: #14432A; }
.pbal--credit { background: var(--brand); }
.pbal-num { display: block; font-family: var(--font-display); font-weight: 700;
            font-size: var(--step-4); line-height: 1; letter-spacing: -.02em; }
.pbal-lab { display: block; margin-top: .4rem; font-family: var(--font-mono);
            font-size: var(--step--2); letter-spacing: .1em;
            text-transform: uppercase; color: var(--gold-bright); }
.pbal .pbtn { margin-top: var(--sp-4); }
.pbal-strip { display: flex; flex-wrap: wrap; gap: var(--sp-5);
              align-items: center; background: var(--surface);
              border: 1px solid var(--rule); border-left: 5px solid var(--navy);
              border-radius: var(--r-md); padding: var(--sp-5);
              margin-bottom: var(--sp-6); }
.pbal-strip .pbal-num { color: var(--navy); font-size: var(--step-3); }
.pbal-strip .pbal-lab { color: var(--gold-text); }
.pbal-strip p { font-size: var(--step--1); color: var(--ink-2); max-width: 52ch; }
.pbal-strip.pbal--owing { border-left-color: var(--gold); }
.pbal-strip.pbal--clear { border-left-color: #1F6B3A; }

/* ---------- stats (staff) ----------------------------------------------- */
.pstats { display: grid; gap: var(--sp-4); margin-bottom: var(--sp-6);
          grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
.pstat { background: var(--surface); border: 1px solid var(--rule);
         border-radius: var(--r-md); padding: var(--sp-5);
         text-decoration: none; display: block; }
.pstat:hover { border-color: var(--brand-400); }
.pstat--alert { border-color: var(--gold); background: var(--gold-100); }
.pstat-n { display: block; font-family: var(--font-display); font-weight: 700;
           font-size: var(--step-3); line-height: 1; color: var(--brand); }
.pstat-l { display: block; margin-top: .3rem; font-size: var(--step--1);
           color: var(--ink-2); }
.pstat-sub { display: block; margin-top: .2rem; font-family: var(--font-mono);
             font-size: var(--step--2); color: var(--gold-text); font-weight: 650; }

/* ---------- lists -------------------------------------------------------- */
.pitems { list-style: none; padding: 0; margin: 0; }
.pitems > li { border-top: 1px solid var(--rule); }
.pitems > li:first-child { border-top: 0; }
.pitems > li > a, .pitems > li { display: block; padding: var(--sp-4) 0;
                                 text-decoration: none; color: inherit; }
.pitems > li > a:hover .pit-main { color: var(--brand); text-decoration: underline; }
.pitems--plain > li { padding-block: var(--sp-3); }
.pitems--lg > li > a { padding-block: var(--sp-5); }
.pit-main { display: block; font-weight: 600; color: var(--ink);
            font-size: var(--step-0); }
.pit-meta { display: block; margin-top: .25rem; font-size: var(--step--2);
            color: var(--ink-3); }
.pit-none { padding: var(--sp-5) 0; color: var(--ink-3); font-size: var(--step--1); }

/* ---------- pills and tags ---------------------------------------------- */
.ppill { display: inline-flex; align-items: center; min-height: 24px;
         padding: .2rem .7rem; border-radius: var(--r-pill);
         font-family: var(--font-mono); font-size: var(--step--2);
         font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.ppill--open { background: var(--gold-100); color: var(--gold-text); }
.ppill--done { background: #EAF6EE; color: #14432A; }
.ppill--off { background: var(--ground-3); color: var(--ink-2); }
.ptag { display: inline-block; padding: .1rem .5rem; margin-left: .4rem;
        background: var(--brand-tint); color: var(--brand);
        border-radius: var(--r-xs); font-family: var(--font-mono);
        font-size: var(--step--2); font-weight: 650; }
.ptag--off { background: var(--ground-3); color: var(--ink-2); }

/* ---------- tables ------------------------------------------------------- */
.ptable-wrap { overflow-x: auto; border: 1px solid var(--rule);
               border-radius: var(--r-md); background: var(--surface);
               margin-bottom: var(--sp-6); }
.ptable { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.ptable th, .ptable td { text-align: left; padding: .8rem var(--sp-4);
                         border-bottom: 1px solid var(--rule);
                         vertical-align: top; }
.ptable th { font-family: var(--font-mono); font-size: var(--step--2);
             font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
             color: var(--gold-text); background: var(--ground-2);
             white-space: nowrap; }
.ptable tbody tr:last-child td { border-bottom: 0; }
.ptable--dense th, .ptable--dense td { padding: .5rem var(--sp-3);
                                       font-size: var(--step--2); }
.pnum { text-align: right; font-variant-numeric: tabular-nums;
        white-space: nowrap; }
.pdebit { color: #8A2A2A; font-weight: 650; }
.pcredit { color: #14432A; font-weight: 650; }
.pvoid { opacity: .5; text-decoration: line-through; }
.prow-alert { background: var(--gold-100); }

/* A table of a resident's money must not hide columns behind a scrollbar on a
   phone, so below the breakpoint each row becomes a labelled block. */
@media (max-width: 48rem) {
  .ptable-wrap { overflow-x: visible; border: 0; background: none; }
  .ptable, .ptable tbody, .ptable tr, .ptable td { display: block; width: 100%; }
  .ptable thead { position: absolute; width: 1px; height: 1px; overflow: hidden;
                  clip-path: inset(50%); }
  .ptable tr { background: var(--surface); border: 1px solid var(--rule);
               border-radius: var(--r-md); padding: var(--sp-4);
               margin-bottom: var(--sp-4); }
  .ptable td { border: 0; padding: .35rem 0; display: grid;
               grid-template-columns: 7rem minmax(0, 1fr); gap: var(--sp-4);
               align-items: baseline; }
  .ptable td + td { border-top: 1px solid var(--rule); }
  .ptable td::before { content: attr(data-label);
                       font-family: var(--font-mono); font-size: var(--step--2);
                       font-weight: 700; letter-spacing: .08em;
                       text-transform: uppercase; color: var(--gold-text); }
  .ptable td:empty { display: none; }
  .pnum { text-align: left; }
}

/* ---------- forms -------------------------------------------------------- */
.pform { display: grid; gap: .3rem; max-width: 34rem; }
.pform--wide { max-width: 46rem; }
.pform--inline { display: flex; flex-wrap: wrap; gap: var(--sp-3);
                 align-items: flex-end; max-width: none; }
.pform label { font-family: var(--font-mono); font-size: var(--step--2);
               font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
               color: var(--navy); margin-top: var(--sp-4); }
.pform input, .pform select, .pform textarea {
  font: inherit; font-size: var(--step-0); width: 100%;
  padding: .7rem .85rem; color: var(--ink); background: var(--surface);
  border: 1.5px solid var(--rule-strong); border-radius: var(--r-sm);
  min-height: 48px;
}
.pform textarea { min-height: 7rem; resize: vertical; line-height: 1.55; }
.pform input:focus-visible, .pform select:focus-visible,
.pform textarea:focus-visible { border-color: var(--brand-400); }
.pform button { justify-self: start; margin-top: var(--sp-5); }
.popt { font-weight: 500; text-transform: none; letter-spacing: 0;
        color: var(--ink-3); }
.phint { font-size: var(--step--2); color: var(--ink-3); margin: .25rem 0 0;
         line-height: 1.5; }
.pfieldset { border: 1px solid var(--rule); border-radius: var(--r-md);
             padding: var(--sp-4) var(--sp-5); margin-top: var(--sp-5); }
.pfieldset legend { font-family: var(--font-mono); font-size: var(--step--2);
                    font-weight: 700; letter-spacing: .08em;
                    text-transform: uppercase; color: var(--gold-text);
                    padding-inline: .4rem; }
.pcheck { display: flex; gap: .7rem; align-items: flex-start;
          margin-top: var(--sp-3); font-family: var(--font-sans);
          font-size: var(--step--1); font-weight: 500; text-transform: none;
          letter-spacing: 0; color: var(--ink-2); line-height: 1.5; }
.pcheck input { width: 22px; height: 22px; min-height: 22px; flex: none;
                margin-top: .1rem; }
.pinline { display: inline; }

/* ---------- buttons ------------------------------------------------------ */
.pbtn { display: inline-flex; align-items: center; justify-content: center;
        gap: .5rem; min-height: 48px; padding: .75rem 1.4rem;
        border-radius: var(--r-sm); border: 2px solid transparent;
        font-family: var(--font-mono); font-size: var(--step--1);
        font-weight: 700; letter-spacing: .02em; text-decoration: none;
        cursor: pointer; }
.pbtn--gold { background: var(--gold); border-color: var(--gold);
              color: var(--navy); }
.pbtn--gold:hover { background: var(--gold-bright); border-color: var(--gold-bright); }
.pbtn--brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.pbtn--ghost { background: var(--surface); border-color: var(--rule-strong);
               color: var(--brand); }
.pbtn--ghost:hover { border-color: var(--brand-400); }
.pbtn--sm { min-height: 36px; padding: .35rem .8rem; font-size: var(--step--2); }
.pbtn--lg { min-height: 56px; padding: .95rem 1.8rem; font-size: var(--step-0); }
.pbtn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- detail lists ------------------------------------------------- */
.pdl { display: grid; gap: 0; margin: var(--sp-5) 0;
       grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
       background: var(--surface); border: 1px solid var(--rule);
       border-radius: var(--r-md); overflow: hidden; }
.pdl > div { padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--rule); }
.pdl dt { font-family: var(--font-mono); font-size: var(--step--2);
          font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
          color: var(--gold-text); margin-bottom: .2rem; }
.pdl dd { margin: 0; font-size: var(--step--1); color: var(--ink);
          line-height: 1.5; overflow-wrap: anywhere; }

/* ---------- documents --------------------------------------------------- */
.pdocs { list-style: none; padding: 0; margin: var(--sp-5) 0; display: grid;
         gap: var(--sp-4); }
.pdoc { background: var(--surface); border: 1px solid var(--rule);
        border-radius: var(--r-md); padding: var(--sp-5);
        display: flex; flex-wrap: wrap; gap: var(--sp-4);
        align-items: center; justify-content: space-between; }
.pdoc--old { opacity: .72; }
.pdoc-title { margin: 0; font-weight: 650; font-size: var(--step-0); }
.pdoc-meta { margin: .25rem 0 0; font-size: var(--step--2); color: var(--ink-3); }
.pdoc-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; }

/* ---------- timeline ----------------------------------------------------- */
.ptls { list-style: none; padding: 0; margin: var(--sp-5) 0; display: grid;
        gap: var(--sp-4); }
.ptl { background: var(--surface); border: 1px solid var(--rule);
       border-left: 4px solid var(--brand-400); border-radius: 0 var(--r-md) var(--r-md) 0;
       padding: var(--sp-4) var(--sp-5); }
.ptl--internal { border-left-color: var(--gold); background: var(--gold-100); }
.ptl-when { font-family: var(--font-mono); font-size: var(--step--2);
            color: var(--ink-3); }
.ptl-who { display: block; font-weight: 700; font-size: var(--step--1);
           color: var(--navy); margin-bottom: .3rem; }
.ptl p { margin: 0; font-size: var(--step--1); line-height: 1.6;
         white-space: pre-wrap; }
.ptl-status { margin-top: .5rem !important; font-family: var(--font-mono);
              font-size: var(--step--2); color: var(--gold-text); }

.pquote { background: var(--surface); border: 1px solid var(--rule);
          border-radius: var(--r-md); padding: var(--sp-5);
          white-space: pre-wrap; font-size: var(--step--1); line-height: 1.65;
          margin-bottom: var(--sp-5); }
.pthumbs { display: flex; flex-wrap: wrap; gap: var(--sp-3);
           margin-bottom: var(--sp-5); }
.pthumb { display: inline-flex; align-items: center; min-height: 40px;
          padding: .4rem .8rem; background: var(--surface);
          border: 1px solid var(--rule); border-radius: var(--r-sm);
          font-family: var(--font-mono); font-size: var(--step--2);
          color: var(--brand); text-decoration: none; max-width: 16rem;
          overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pthumb:hover { border-color: var(--brand-400); }

/* ---------- odds and ends ----------------------------------------------- */
.prow-between { display: flex; flex-wrap: wrap; gap: var(--sp-4);
                align-items: center; justify-content: space-between;
                margin-bottom: var(--sp-4); }
.prow-between h1, .prow-between h2 { margin: 0; }
.pback { font-family: var(--font-mono); font-size: var(--step--2);
         margin-bottom: var(--sp-4); }
.ptabs { display: flex; gap: var(--sp-2); }
.ptabs a { padding: .4rem .9rem; border: 1px solid var(--rule);
           border-radius: var(--r-pill); font-family: var(--font-mono);
           font-size: var(--step--2); font-weight: 650; text-decoration: none;
           color: var(--ink-2); background: var(--surface);
           min-height: 32px; display: inline-flex; align-items: center; }
.ptabs a.is-here { background: var(--brand); border-color: var(--brand);
                   color: #fff; }
.pfine { font-size: var(--step--2); color: var(--ink-3); line-height: 1.6; }
.pmain code { font-family: var(--font-mono); font-size: .92em;
              background: var(--ground-3); padding: .1em .35em;
              border-radius: var(--r-xs); }

/* ---------- footer ------------------------------------------------------- */
.pfoot { background: var(--navy); color: #BDADDD; padding-block: var(--sp-6);
         margin-top: var(--sp-8); border-top: 4px solid var(--gold); }
.pfoot p { font-size: var(--step--1); margin-bottom: .4rem; color: #BDADDD; }
.pfoot strong { color: #fff; }
.pfoot a { color: #D9CCF0; }
.pfoot .pfine { color: #A493C6; }

@media print {
  .phead, .pnav, .pfoot, .pbtn, .pform { display: none !important; }
  .pbody { background: #fff; }
}

/* ---------- corrections found by the audit ------------------------------ */

/* app.css gives every table a 480px min-width so it scrolls rather than
   squeezes. That floor has to be lifted for the stacked layout, or the rows
   overflow a 360px screen instead of becoming blocks. Same trap as the
   capacity table on the main site. */
.ptable { min-width: 0; }
@media (max-width: 48rem) {
  .ptable, .ptable tbody, .ptable tr, .ptable td { min-width: 0; }
  /* A nowrap pill or a long ref still sets its own min-content floor. */
  .ptable td > * { min-width: 0; }
  .ptable td .ppill { white-space: normal; }
}

/* WCAG 2.2 AA, 2.5.8: standalone controls need a 24px box. Links sitting
   inline inside a sentence are exempt and stay at reading size. */
.pback a,
.ptable td > a,
.pdl dd > a,
.pitems--plain a {
  display: inline-flex; align-items: center; min-height: 24px;
}
.pback { font-size: var(--step--1); }
/* A checkbox is the target, so it carries the floor itself. */
.pcheck input { width: 24px; height: 24px; min-height: 24px; }

/* Ways to pay. Same component as the marketing site; repeated here because the
   portal's stylesheet loads after app.css and these need the portal's spacing. */
.pay-methods { margin-top: var(--sp-5); padding-top: var(--sp-4);
               border-top: 1px solid var(--rule); }
.pay-label { font-family: var(--font-mono); font-size: var(--step--2);
             font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
             color: var(--gold-text); margin-bottom: var(--sp-3); }
.pay-list { list-style: none; padding: 0; margin: 0; display: flex;
            flex-wrap: wrap; gap: var(--sp-3); }
.pay-chip { display: inline-flex; align-items: center; min-height: 32px;
            padding: .3rem .8rem; margin: 0; background: var(--surface);
            color: var(--navy); border: 1px solid var(--rule-strong);
            border-radius: var(--r-pill); font-family: var(--font-mono);
            font-size: var(--step--2); font-weight: 650; white-space: nowrap; }
.pay-note { margin: var(--sp-3) 0 0; font-size: var(--step--2);
            color: var(--ink-3); line-height: 1.6; max-width: 56ch; }

/* Rent payment link. The one place in the portal that sends a resident out to
   Square without an invoice behind it, so it is deliberately set apart from the
   surrounding card: a resident should never tap it by accident while reading
   their balance. --hold is the variant shown when what they owe does not match
   what the button charges, and it carries no button at all. */
.prentpay { margin-top: var(--sp-5); padding: var(--sp-5);
            background: var(--tint); border: 1px solid var(--rule);
            border-left: 4px solid var(--gold); border-radius: var(--r-sm); }
.prentpay h3 { margin: 0 0 var(--sp-3); font-size: var(--step-1); }
.prentpay p { max-width: 60ch; }
.prentpay > p:first-of-type { margin-bottom: var(--sp-4); }
.prentpay .pay-methods { margin-top: var(--sp-4); }
.prentpay .pfine { margin-top: var(--sp-4); margin-bottom: 0; }
.prentpay--hold { border-left-color: var(--warn); }
.prentpay--hold p:last-child { margin-bottom: 0; }
