/* D.EIGHT case UI shared by the customer portal and the admin case manager. */
.pt-band { background: var(--band); color: var(--on-brand); position: relative; overflow: hidden; }
.pt-band::after { content: ""; position: absolute; right: -160px; top: -200px; width: 560px; height: 560px; border-radius: 50%; border: 1px solid rgba(143, 172, 203, .18); pointer-events: none; }
.pt-band .wrap { position: relative; z-index: 1; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; padding-top: 44px; padding-bottom: 44px; }
.pt-band .eyebrow { color: var(--steel); }
.pt-band h1 { margin: 10px 0 0; font-family: var(--f-display); font-weight: 700; letter-spacing: -.015em; font-size: clamp(28px, 3.6vw, 42px); line-height: 1.12; color: var(--on-brand); word-break: break-word; }
.pt-band .serif { margin: 6px 0 0; color: var(--steel); font-size: clamp(24px, 3vw, 34px); }
.pt-band .btn-cream { background: var(--c-cream); border-color: var(--c-cream); color: var(--c-navy); }
.pt-band .btn-cream:hover { background: #FFFFFF; }
.pt-back { display: inline-flex; align-items: center; gap: 8px; color: var(--on-brand-2); text-decoration: none; font-family: var(--f-display); font-weight: 600; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; }
.pt-back:hover { color: var(--on-brand); }
.pt-main { padding: 36px 0 90px; min-height: 50vh; }
.pt-loading { padding: 80px 0; text-align: center; color: var(--muted); }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--steel-200); border-top-color: var(--navy); animation: spin .8s var(--ease-io) infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* sign in */
.pt-signin { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); border-radius: 22px; overflow: hidden; background: var(--white); border: 1px solid var(--line);
             box-shadow: 0 2px 4px rgba(11, 27, 51, .04), 0 30px 60px rgba(11, 27, 51, .1); margin: 20px 0 0; }
.pt-signin-art { position: relative; overflow: hidden; background: radial-gradient(120% 100% at 80% 20%, #0B3F86 0%, var(--brand) 50%, var(--brand-800) 100%); color: var(--on-brand); padding: 54px 48px; min-height: 520px; }
.pt-signin-art h1 { margin: 16px 0 0; font-family: var(--f-display); font-weight: 700; letter-spacing: -.02em; font-size: clamp(32px, 3.8vw, 48px); line-height: 1.08; color: var(--on-brand); }
.pt-signin-art .serif { margin: 8px 0 0; color: var(--steel); font-size: clamp(26px, 3vw, 36px); }
.pt-signin-art ul { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 14px; position: relative; z-index: 1; }
.pt-signin-art li { display: flex; gap: 12px; align-items: flex-start; color: #DCE5EE; line-height: 1.6; }
.pt-signin-art li svg { flex: 0 0 auto; margin-top: 4px; color: var(--steel); }
.pt-signin-art .mark { position: absolute; right: -70px; bottom: -60px; width: 300px; opacity: .08; }
.pt-signin-card { padding: 54px 48px; display: flex; flex-direction: column; justify-content: center; }
.pt-signin-card h2 { margin: 0; }
.pt-gbtn { margin: 26px 0 0; min-height: 44px; }
.pt-fine { margin: 26px 0 0; font-size: 13px; color: var(--muted); line-height: 1.7; }
.pt-fine a { color: var(--navy); }
.pt-or { display: flex; align-items: center; gap: 12px; margin: 28px 0 0; color: var(--muted); font-size: 13px; }
.pt-or::before, .pt-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* list */
.pt-tools { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.pt-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.pt-filters button { height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--white); color: var(--navy); cursor: pointer;
                     font-family: var(--f-display); font-weight: 600; font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.pt-filters button[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.pt-filters button b { font-weight: 600; opacity: .6; margin-left: 4px; }
.pt-search { width: min(320px, 100%); height: 40px; border-radius: 999px; }
.pt-list { display: grid; gap: 10px; }
.pt-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 18px; align-items: center; padding: 18px 22px; background: var(--white); border: 1px solid var(--line);
          border-radius: 14px; text-decoration: none; color: inherit; transition: border-color var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out); position: relative; }
.pt-row:hover { border-color: var(--steel); box-shadow: 0 10px 24px rgba(11, 27, 51, .07); transform: translateY(-1px); }
.pt-row .id { font-family: var(--f-display); font-weight: 600; font-size: 11px; letter-spacing: .12em; color: var(--steel); }
.pt-row .ttl { display: block; margin-top: 4px; font-weight: 600; color: var(--navy); font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-row .meta { grid-column: 1; color: var(--muted); font-size: 13px; }
.pt-row .right { grid-row: 1 / span 2; grid-column: 2; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.pt-row .new { font-family: var(--f-display); font-weight: 600; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--navy); display: inline-flex; align-items: center; gap: 6px; }
.pt-row .new::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #E0A526; }
.st { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px; white-space: nowrap;
      font-family: var(--f-display); font-weight: 600; font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; background: var(--steel-200); color: var(--navy); }
.st-received { background: var(--steel-100); color: var(--navy); }
.st-needs_info { background: var(--err-bg); color: var(--err-fg2); }
.st-in_design { background: var(--steel-200); color: var(--navy); }
.st-review { background: var(--warn-bg); color: var(--warn-fg); }
.st-approved { background: var(--info-bg); color: var(--navy); border: 1px solid var(--steel); }
.st-delivered { background: var(--ok-bg); color: var(--success); }
.st-cancelled { background: var(--mute-bg); color: var(--mute-fg); }
.pt-empty { text-align: center; padding: 64px 24px; background: var(--white); border: 1px dashed var(--steel-300); border-radius: 18px; }
.pt-empty img { display: block; width: 60px; margin: 0 auto; opacity: .9; }
.pt-empty h2 { margin: 18px 0 8px; }
.pt-empty p { margin: 0 auto 22px; max-width: 420px; color: var(--muted); line-height: 1.7; }
.pt-note { margin: 16px 0 0; font-size: 13px; color: var(--muted); }

/* case */
.pt-steps { list-style: none; margin: 0 0 26px; padding: 22px 26px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: var(--white); border: 1px solid var(--line); border-radius: 16px; }
.pt-steps li { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding-right: 10px; }
.pt-steps li::before { content: ""; position: absolute; left: 30px; right: 0; top: 11px; height: 2px; background: var(--steel-200); }
.pt-steps li:last-child::before { display: none; }
.pt-steps li.done::before { background: var(--brand); }
.pt-steps .dot { position: relative; z-index: 1; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--steel-300); background: var(--white); display: flex; align-items: center; justify-content: center; }
.pt-steps li.done .dot { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.pt-steps li.cur .dot { border-color: var(--navy); box-shadow: 0 0 0 5px rgba(143, 172, 203, .35); }
.pt-steps li.cur .dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.pt-steps .lbl { font-family: var(--f-display); font-weight: 600; font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); line-height: 1.4; }
.pt-steps li.done .lbl, .pt-steps li.cur .lbl { color: var(--navy); }
.pt-alert { display: flex; gap: 14px; align-items: flex-start; padding: 16px 20px; border-radius: 14px; margin: 0 0 22px; line-height: 1.6; }
.pt-alert svg { flex: 0 0 auto; margin-top: 2px; }
.pt-alert.warn { background: var(--err-bg); color: var(--err-fg); border: 1px solid var(--err-bd); }
.pt-alert.info { background: var(--warn-bg); color: var(--warn-fg2); border: 1px solid var(--warn-bd); }
.pt-alert.ok { background: var(--ok-bg); color: var(--ok-fg); border: 1px solid var(--ok-bd); }
.pt-alert.mute { background: var(--mute-bg); color: var(--mute-fg2); }
.pt-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.pt-grid > div > .card + .card, .pt-grid aside .card + .card { margin-top: 22px; }
.pt-grid .card { padding: 26px; }
.card h2.h-caps { margin: 0 0 4px; }
.card .sub { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.pv { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; }
.pv + .pv { margin-top: 10px; }
.pv .ic { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 10px; background: var(--brand); color: var(--on-brand-2); display: flex; align-items: center; justify-content: center; }
.pv .tx { flex: 1; min-width: 0; }
.pv b { display: block; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv small { color: var(--muted); }
.approve { margin-top: 18px; padding: 20px; border-radius: 14px; background: var(--steel-100); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.approve p { margin: 0; flex: 1 1 260px; color: var(--ink); line-height: 1.6; }
.approve .btns { display: flex; gap: 10px; flex-wrap: wrap; }
.approve p.rev-left { order: 1; flex: 1 1 100%; font-size: 13.5px; color: var(--muted); }
.btn-ok { background: var(--ok-fill); border-color: var(--ok-fill); color: var(--on-brand); }
.btn-ok:hover { background: #1c6b45; border-color: #1c6b45; }
.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.files li:first-child { border-top: 0; }
.files .nm { flex: 1; min-width: 0; }
.files .nm b { display: block; font-weight: 500; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .nm small { color: var(--muted); }
.files .ext { flex: 0 0 auto; width: 42px; height: 42px; border-radius: 10px; background: var(--steel-100); color: var(--navy); display: flex; align-items: center; justify-content: center;
              font-family: var(--f-display); font-weight: 700; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; }
.files .out .ext { background: var(--ok-bg); color: var(--success); }
.iconbtn { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--white); color: var(--navy); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; }
.iconbtn:hover { background: var(--steel-100); }
.iconbtn.del { color: var(--error); }
.iconbtn.del.armed { background: var(--err-fill); border-color: var(--err-fill); color: var(--on-brand); }
.grp { margin: 18px 0 6px; font-family: var(--f-display); font-weight: 600; font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--steel); }
.grp:first-of-type { margin-top: 4px; }

.drop.compact { min-height: 0; padding: 26px 18px; background: var(--cream); }
.drop.compact strong { font-size: 15.5px; }
.drop.compact > span { font-size: 13px; }
.drop.compact > svg { color: var(--navy); }
.picked { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.picked li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--white); border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.picked li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked li small { color: var(--muted); }
.picked li button { border: 0; background: none; color: var(--muted); cursor: pointer; width: 28px; height: 28px; border-radius: 50%; }
.picked li button:hover { background: var(--steel-100); color: var(--error); }
.progress.block { margin-top: 14px; min-width: 0; }

.thread { display: grid; gap: 12px; max-height: 520px; overflow-y: auto; padding: 4px 2px 8px; }
.bub { max-width: 84%; padding: 12px 16px; border-radius: 16px; line-height: 1.6; font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }
.bub small { display: block; margin-top: 6px; font-size: 11.5px; opacity: .7; }
.bub.me { justify-self: end; background: var(--brand); color: var(--on-brand); border-bottom-right-radius: 4px; }
.bub.them { justify-self: start; background: var(--steel-100); color: var(--ink); border-bottom-left-radius: 4px; }
.bub.them b { display: block; font-family: var(--f-display); font-weight: 600; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--navy); margin-bottom: 4px; }
.sys { justify-self: center; display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.sys .st { height: 22px; font-size: 8.5px; padding: 0 9px; }
.compose { margin-top: 14px; display: grid; gap: 10px; }
.compose textarea { min-height: 96px; }
.compose-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.compose-foot .hint { margin: 0; }
textarea.input { height: auto; min-height: 120px; padding: 14px 16px; line-height: 1.6; resize: vertical; }
select.input { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer;
  background: var(--white) no-repeat right 16px center / 12px var(--chevron); }
.dl { margin: 0; }
.dl > div { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.dl > div:first-child { border-top: 0; padding-top: 0; }
.dl dt { font-family: var(--f-display); font-weight: 600; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--steel); padding-top: 3px; }
.dl dd { margin: 0; color: var(--ink); word-break: break-word; }
.notes { white-space: pre-wrap; line-height: 1.7; color: var(--ink); margin: 0; }
.links a { display: block; color: var(--navy); word-break: break-all; padding: 4px 0; }

/* new case form */
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.fs { margin: 0; padding: 0; border: 0; }
.fs + .fs { margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--line); }
.fs legend { padding: 0; margin: 0 0 18px; display: flex; align-items: center; gap: 12px; }
.fs legend .n { width: 30px; height: 30px; border-radius: 50%; background: var(--brand); color: var(--on-brand); display: inline-flex; align-items: center; justify-content: center; font-family: var(--f-display); font-weight: 600; font-size: 11px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 16px; }
.row2 .full { grid-column: 1 / -1; }
.req { color: var(--error); margin-left: 2px; }
.linkrow { display: flex; gap: 8px; }
.linkrow + .linkrow { margin-top: 8px; }
.tips { position: sticky; top: 130px; }
.tips ul { margin: 12px 0 0; padding-left: 18px; color: var(--muted); line-height: 1.7; font-size: 14px; }
.tips li + li { margin-top: 6px; }
.submit-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 26px; }

@media (max-width: 980px) {
  .pt-signin { grid-template-columns: 1fr; }
  .pt-signin-art { min-height: 0; }
  .pt-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .tips { position: static; }
}
@media (max-width: 640px) {
  .pt-band .wrap { padding-top: 30px; padding-bottom: 30px; }
  .pt-signin-art, .pt-signin-card { padding: 34px 24px; }
  .pt-steps { grid-template-columns: 1fr; gap: 0; padding: 18px 20px; }
  .pt-steps li { flex-direction: row; align-items: center; padding: 0 0 18px; }
  .pt-steps li:last-child { padding-bottom: 0; }
  .pt-steps li::before { left: 11px; right: auto; top: 24px; bottom: 0; width: 2px; height: auto; }
  .pt-row { grid-template-columns: 1fr; padding: 16px 18px; }
  .pt-row .right { grid-row: auto; grid-column: 1; flex-direction: row; align-items: center; justify-content: space-between; }
  .row2 { grid-template-columns: 1fr; }
  .pt-grid .card { padding: 20px; }
  .bub { max-width: 92%; }
  .dl > div { grid-template-columns: 1fr; gap: 2px; }
  .submit-row .btn { width: 100%; }
}

/* chat translation */
.bub-text { white-space: pre-wrap; }
.bub-tr { margin-top: 8px; padding-top: 8px; border-top: 1px dashed rgba(11, 27, 51, .18); white-space: pre-wrap; }
.bub.me .bub-tr { border-top-color: rgba(252, 253, 246, .3); }
.bub-tr span { display: block; margin-bottom: 2px; font-family: var(--f-display); font-weight: 600; font-size: 8.5px; letter-spacing: .14em; text-transform: uppercase; opacity: .7; }
.tr-btn { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; opacity: 1; }
.tr-btn:disabled { cursor: default; text-decoration: none; opacity: .7; }
.thread-tools { display: flex; justify-content: flex-end; margin: -6px 0 8px; }
.thread-tools button { background: none; border: 1px solid var(--line); border-radius: 999px; height: 30px; padding: 0 12px; cursor: pointer; color: var(--navy);
  font-family: var(--f-display); font-weight: 600; font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; }
.thread-tools button:hover { background: var(--steel-100); }
.compose-tr { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.compose-orig { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--steel-100); font-size: 13px; color: var(--muted); white-space: pre-wrap; }
.compose-orig b { font-family: var(--f-display); font-weight: 600; font-size: 9px; letter-spacing: .14em; text-transform: uppercase; color: var(--navy); margin-right: 6px; }

/* free trial + billing */
.pt-trial { display: flex; align-items: center; gap: 14px; padding: 14px 18px; margin: 0 0 20px; border-radius: 14px; background: var(--white); border: 1px solid var(--steel);
  color: var(--navy); line-height: 1.55; }
.pt-trial svg { flex: 0 0 auto; width: 22px; height: 22px; color: var(--navy); }
.pt-trial b { font-weight: 600; }
.badge-trial { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--brand); color: var(--on-brand);
  font-family: var(--f-display); font-weight: 600; font-size: 8.5px; letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; }
.pay { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; font-family: var(--f-display); font-weight: 600; font-size: 8.5px;
  letter-spacing: .12em; text-transform: uppercase; white-space: nowrap; background: var(--steel-100); color: var(--navy); }
.pay-due { background: var(--warn-bg); color: var(--warn-fg); }
.pay-paid { background: var(--ok-bg); color: var(--success); }
.pay-check { background: var(--info-bg); color: var(--navy); }
.card-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* picked files with health check */
.picked .pk { flex: 1; min-width: 0; }
.picked li .pk span { display: block; flex: none; }
.picked .pk-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picked li .pk-c { white-space: normal; font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.45; }
.picked .pk-c.ok { color: var(--success); }
.picked .pk-c.warn { color: var(--warn-fg); }
.picked .pk-c.bad { color: var(--error); }

/* AI helpers */
.ai-box { margin: 0 0 26px; border: 1px solid var(--steel); border-radius: 14px; background: linear-gradient(135deg, var(--ai-bg) 0%, var(--white) 70%); }
.ai-box > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 16px 18px; color: var(--navy); font-weight: 600; }
.ai-box > summary::-webkit-details-marker { display: none; }
.ai-box > summary .tag, .ai-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; background: var(--brand); color: var(--on-brand);
  font-family: var(--f-display); font-weight: 600; font-size: 8.5px; letter-spacing: .14em; }
.ai-box > summary::after { content: "+"; margin-left: auto; font-size: 20px; line-height: 1; color: var(--navy); }
.ai-box[open] > summary::after { content: "–"; }
.ai-box .in { padding: 0 18px 18px; display: grid; gap: 12px; }
.ai-box textarea.input { min-height: 90px; }
.ai-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ai-row .nm { color: var(--muted); font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.ai-ok { margin: 0; padding: 10px 12px; border-radius: 10px; background: var(--ok-bg); color: var(--ok-fg); font-size: 14px; }
.input.ai-filled { border-color: var(--steel); box-shadow: 0 0 0 3px rgba(143, 172, 203, .35); background: var(--ai-bg2); }
.warnbox { margin: 18px 0 0; padding: 18px 20px; border-radius: 14px; background: var(--warn-bg2); border: 1px solid var(--warn-bd); color: var(--warn-fg2); }
.warnbox h3 { margin: 0 0 8px; }
.warnbox ul { margin: 0 0 14px; padding-left: 20px; line-height: 1.65; }
.warnbox .btns { display: flex; gap: 10px; flex-wrap: wrap; }
.ai-sum { white-space: pre-wrap; line-height: 1.7; font-size: 14.5px; color: var(--ink); margin: 0; }
.ai-meta { margin: 10px 0 0; font-size: 12.5px; color: var(--muted); }
.tr-auto { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; font-size: 13px; color: var(--muted); cursor: pointer; }
.tr-auto input { accent-color: var(--navy); }
.tr-auto[hidden], .thread-tools button[hidden] { display: none; }
/* case chat as a round button in the corner; the thread opens in a panel above it (portal and admin) */
.chat-bub { position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); z-index: 70;
  width: 58px; height: 58px; border: 0; border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  background: var(--brand); color: var(--on-brand); box-shadow: 0 12px 30px rgba(11, 27, 51, .28); transition: transform var(--t-fast) var(--ease-out); }
.chat-bub:hover { transform: translateY(-2px); }
.chat-bub:focus-visible { outline: 3px solid var(--navy); outline-offset: 3px; }
.chat-bub[hidden] { display: none; }
.chat-n { position: absolute; top: -4px; right: -4px; min-width: 22px; height: 22px; padding: 0 6px; box-sizing: border-box; border-radius: 999px;
  background: var(--warning); color: #1A1205; box-shadow: 0 0 0 2px var(--white); font-family: var(--f-display); font-weight: 700; font-size: 11px; line-height: 18px; text-align: center; }
.chat-n[hidden] { display: none; }
.chat-bub.pop { animation: chat-pop 280ms var(--ease-out); }
@keyframes chat-pop { 0% { transform: scale(.72); opacity: .4; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
.chat-panel { position: fixed; right: max(20px, env(safe-area-inset-right)); bottom: max(20px, env(safe-area-inset-bottom)); z-index: 71;
  width: min(420px, calc(100vw - 40px)); max-height: calc(100dvh - 40px); margin: 0; padding: 18px; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: 0 22px 56px rgba(11, 27, 51, .24); }
.chat-panel:not(.open) { display: none; }
.chat-panel.open { animation: chat-in 240ms var(--ease-out); }
@keyframes chat-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.chat-head h2 { margin: 0; }
.chat-panel .sub { margin: 0 0 8px; }
.chat-panel .thread { flex: 1 1 auto; min-height: 0; max-height: none; }
.chat-panel .compose { margin-top: 12px; }
.chat-panel .compose textarea { min-height: 72px; }
@media (max-width: 600px) { .chat-panel { left: 12px; right: 12px; bottom: 12px; width: auto; max-height: calc(100dvh - 24px); } .chat-bub { right: 16px; bottom: 16px; } }
@media (prefers-reduced-motion: reduce) { .chat-bub.pop, .chat-panel.open { animation: none; } .chat-bub:hover { transform: none; } }
.pt-band .sk { background: rgba(214, 225, 231, .12); }
.pt-band .sk::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .1), transparent); }
/* payment due (customer portal) */
.pay-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px 32px; align-items: center; margin: 0 0 26px; padding: 24px 28px;
  border-radius: var(--radius); border: 1px solid var(--warn-bd); background: var(--warn-bg2); }
.pay-amt .eyebrow { color: var(--warn-fg); }
.pay-amt b { display: block; margin: 8px 0 4px; font-family: var(--f-display); font-weight: 500; font-size: clamp(26px, 3vw, 34px); letter-spacing: .04em; color: var(--ink); }
.pay-amt small { color: var(--muted); font-size: 13px; }
.pay-act .btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; }
.pay-act .hint { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin: 10px 0 0; font-size: 12.5px; text-align: right; }
.pay-act .hint svg { flex: 0 0 auto; }
.paid-line { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; }
.pay-card-check { border-color: var(--line); background: var(--info-bg); }
.pay-card-check .pay-amt .eyebrow { color: var(--navy); }
.pay-other { margin-top: 12px; text-align: right; }
.pay-other summary { cursor: pointer; color: var(--navy); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; list-style: none; }
.pay-other summary::-webkit-details-marker { display: none; }
.pay-other form { display: grid; gap: 8px; margin-top: 10px; text-align: left; }
.pay-other form .btn { justify-self: end; }
@media (max-width: 760px) { .pay-other { text-align: left; } .pay-other form .btn { justify-self: start; } }
@media (max-width: 760px) {
  .pay-card { grid-template-columns: minmax(0, 1fr); padding: 20px; }
  .pay-act .btns .btn { flex: 1 1 100%; }
  .pay-act .hint { justify-content: flex-start; text-align: left; }
}
/* keep the footer below the fold while a portal screen loads (no jump when content arrives) */
body[data-page="portal"] #view { min-height: calc(100vh - 140px); }

/* ---------- 3D preview of design files (viewer3d.js) ---------- */
.v3d { position: relative; display: grid; grid-template-rows: minmax(0, 1fr) auto; height: 440px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 38%, #fbfaf6 0%, #e7e5dd 100%); }
html[data-theme="dark"] .v3d { background: radial-gradient(ellipse at 50% 38%, #24324a 0%, #101a2b 100%); }
.v3d-stage { position: relative; min-height: 0; }
.v3d-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; touch-action: none; cursor: grab; outline: none; }
.v3d-canvas:active { cursor: grabbing; }
.v3d-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--navy); }
.v3d-msg { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; color: var(--muted); font-size: 14px; }
.v3d-msg.err { color: var(--err-fg2); }
.v3d-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 8px 10px 8px 14px; background: var(--white); border-top: 1px solid var(--line); }
.v3d-info { display: grid; min-width: 0; }
.v3d-info b { overflow: hidden; color: var(--navy); font-size: 13.5px; text-overflow: ellipsis; white-space: nowrap; }
.v3d-info small { color: var(--muted); font-size: 12px; }
.v3d-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.v3d-tools button, .v3d-tools a { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--white); color: var(--navy); cursor: pointer; }
.v3d-tools button:hover, .v3d-tools a:hover { background: var(--steel-100); }
.v3d-tools svg { width: 18px; height: 18px; }
.v3d-overlay { position: fixed; inset: 0; z-index: 1000; display: grid; padding: 24px; background: rgba(4, 18, 40, .74); }
.v3d-overlay .v3d { height: auto; min-height: 0; border: 0; border-radius: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); }
.v3d:fullscreen { height: 100vh; border-radius: 0; }
.v3d-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.v3d-chip { max-width: 260px; overflow: hidden; padding: 5px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--navy); font: inherit; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.v3d-chip.on { border-color: var(--brand); background: var(--brand); color: var(--on-brand); }
.v3d-wait { place-items: center; grid-template-rows: 1fr; }
.v3d-tools a[hidden] { display: none; }
/* several files in one view: the mode switch, chips that switch files on and off, a row per file under the view */
.v3d-mode { display: inline-flex; margin: 0 0 10px; }
.v3d-mode label { flex: 0 0 auto; }
.v3d-mode span { height: 30px; padding: 0 14px; font-size: 9.5px; }
.v3d-chips.multi .v3d-chip { position: relative; padding-left: 30px; }
.v3d-chips.multi .v3d-chip::before { content: ""; position: absolute; top: 50%; left: 11px; width: 12px; height: 12px; margin-top: -6px; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 2v8M2 6h8' stroke='black' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M6 2v8M2 6h8' stroke='black' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.v3d-chips.multi .v3d-chip.on::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2l2.3 2.3 4.7-5' fill='none' stroke='black' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.v3d-hint { margin: -4px 0 12px; font-size: 12.5px; }
.v3d-hint:empty { display: none; }
.v3d.multi { height: 520px; }
.v3d.multi:fullscreen { height: 100vh; }
.v3d.multi .v3d-info { flex: 1 1 100%; }
.v3d-legend { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.v3d-legend li { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 30px; }
.v3d-dot { flex: 0 0 auto; width: 12px; height: 12px; border-radius: 50%; background: #e6dcc4; box-shadow: inset 0 0 0 1px rgba(11, 27, 51, .2); }
.v3d-dot.t1 { background: #9ec2ed; }
.v3d-dot.t2 { background: #edada8; }
.v3d-dot.t3 { background: #a3dbb8; }
.v3d-dot.scan { background: conic-gradient(#f1e7d2 0 50%, #d99a92 50% 100%); }
.v3d-legend b { flex: 1 1 auto; min-width: 0; overflow: hidden; color: var(--navy); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.v3d-legend small { flex: 0 1 auto; min-width: 0; overflow: hidden; color: var(--muted); font-size: 11.5px; text-overflow: ellipsis; white-space: nowrap; }
.v3d-legend li.err small { color: var(--err-fg2); }
.v3d-legend button { flex: 0 0 auto; height: 26px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--navy);
  font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; transition: background-color .2s ease-out, color .2s ease-out; }
.v3d-legend button:hover { background: var(--steel-100); }
.v3d-legend button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand); color: var(--on-brand); }
.v3d-legend a { flex: 0 0 auto; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; color: var(--navy); }
.v3d-legend a:hover { background: var(--steel-100); }
.v3d-legend svg { width: 15px; height: 15px; }
@media (prefers-reduced-motion: reduce) { .v3d-legend button { transition: none; } }
.case-3d { margin: 6px 0 16px; }
.ochat-3d { margin: 4px 0 0 6px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); color: var(--navy); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.ochat-3d:hover { background: var(--steel-100); }
@media (max-width: 640px) {
  .v3d { height: 320px; }
  .v3d.multi { height: 440px; }
  .v3d-legend li:not(.err) small { display: none; }
  .v3d-overlay { padding: 0; }
  .v3d-overlay .v3d { border-radius: 0; }
}

/* a case that needs the viewer (workspace) or the customer (portal): red dot before the code, red edge */
.pt-row.need { border-left: 3px solid var(--err-fill); }
.attn-dot { display: inline-block; width: 10px; height: 10px; margin-right: 8px; border-radius: 50%; background: var(--err-fill); vertical-align: 1px;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--err-fill) 22%, transparent); }

/* live case chat: "is typing" line and the inline previews of a case */
.typing { display: flex; align-items: center; gap: 8px; margin: 10px 2px 0; font-size: 12.5px; color: var(--muted); }
.typing[hidden] { display: none; }
.typing .dots { display: inline-flex; gap: 3px; }
.typing .dots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .3; animation: typing-dot 1.2s ease-in-out infinite; }
.typing .dots i:nth-child(2) { animation-delay: .15s; }
.typing .dots i:nth-child(3) { animation-delay: .3s; }
@keyframes typing-dot { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.case-frame { display: block; width: 100%; height: min(72vh, 640px); min-height: 340px; border: 1px solid var(--line); border-radius: 12px; margin-top: 12px; background: #fff; }
@media (max-width: 600px) { .case-frame { min-height: 280px; } }
@media (prefers-reduced-motion: reduce) { .typing .dots i { animation: none; opacity: .6; } }
