/* Marginus – client portal (builds on /mgmt/assets/admin.css components) */
.p-app { min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); }
.p-top { position: sticky; top: 0; z-index: 20; background: rgba(250, 251, 253, .9); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line-2); }
.p-top-in { max-width: 1240px; margin: 0 auto; padding: 0 24px; height: 68px; display: flex; align-items: center; gap: 28px; }
.p-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; flex: none; }
.p-brand img { height: 38px; width: auto; display: block; }
.p-brand span { font: 500 10.5px var(--f-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--copper-ink); border: 1px solid rgba(122, 31, 43, .35); padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.p-nav { display: flex; gap: 2px; margin-left: 8px; }
.p-nav a { padding: 8px 14px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font: 500 14.5px var(--f-display); white-space: nowrap; }
.p-nav a:hover { background: rgba(17, 26, 48, .05); color: var(--ink); }
.p-nav a.is-active { background: var(--ink); color: var(--paper); }
.p-user { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.p-company { display: grid; text-align: right; line-height: 1.25; }
.p-company b { font: 600 14px var(--f-display); }
.p-company small { color: var(--muted); font-size: 12.5px; }
.p-main { width: 100%; max-width: 1240px; margin: 0 auto; padding: 28px 24px 64px; flex: 1; }
.p-head { margin-bottom: 20px; }
.p-head h1 { font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.035em; }
.p-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.p-head p a { color: var(--muted); }
.p-foot { text-align: center; padding: 24px; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line-2); }
.p-foot a { color: var(--muted); }
.p-kicker { font: 500 11px var(--f-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--copper-ink); margin: 0 0 6px; }
.a-card.attn { border-color: #E8C4CA; background: var(--copper-soft); }
.a-card.attn strong { color: var(--copper-ink); }

.p-cta { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 22px 24px; margin-bottom: 20px; border-radius: var(--r-lg); background: var(--graphite); color: var(--on-dark); flex-wrap: wrap; }
.p-cta h2 { font-size: 20px; }
.p-cta p { margin: 4px 0 0; color: var(--on-dark-muted) !important; font-size: 14px; }
.p-cta .a-btn.primary { background: var(--copper); border-color: var(--copper); color: #fff; }

/* new ticket */
.p-newticket { max-width: 860px; gap: 22px; }
.p-fs { border: 0; padding: 0; display: grid; gap: 10px; }
.p-fs legend { padding: 0; margin-bottom: 4px; font: 600 14px var(--f-display); letter-spacing: -0.01em; text-transform: none; color: var(--ink); }
.prio-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.prio-card { position: relative; cursor: pointer; }
.prio-card input { position: absolute; opacity: 0; }
.prio-card span { display: grid; gap: 4px; height: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--white); transition: border-color .2s, box-shadow .2s, background .2s; }
.prio-card b { display: flex; align-items: center; gap: 8px; font: 600 15px var(--f-display); }
.prio-card small { color: var(--muted); font-size: 12.5px; line-height: 1.4; font-weight: 400; }
.prio-card input:checked + span { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(17, 26, 48, .08); background: var(--surface); }
.prio-card input:focus-visible + span { outline: 2px solid var(--copper); outline-offset: 2px; }
.chips-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chips-select label { position: relative; cursor: pointer; }
.chips-select input { position: absolute; opacity: 0; }
.chips-select span { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); font-size: 14px; transition: all .2s; }
.chips-select input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chips-select input:focus-visible + span { outline: 2px solid var(--copper); outline-offset: 2px; }
.p-files input[type=file] { padding: 12px; border: 1px dashed var(--line); border-radius: 12px; background: var(--white); font-size: 14px; }
.file-list { margin: 4px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }

/* priority + status pills (shared look) */
.prio { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.prio i, .prio-card b i { width: 8px; height: 8px; transform: rotate(45deg); background: var(--subtle); flex: none; }
.pr-low i { background: #8890A4; } .pr-normal i { background: #3D5A80; } .pr-high i { background: var(--amber); } .pr-critical i { background: var(--red); }

/* ticket view */
.p-ticket { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.p-thread { display: grid; gap: 12px; min-width: 0; }
.t-msg { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; max-width: 92%; }
.t-msg.mine { justify-self: end; background: var(--white); }
.t-msg.staff { border-left: 3px solid var(--copper); }
.t-msg.internal { background: var(--amber-soft); border-color: #E9D59F; border-left: 3px solid var(--amber); }
.t-msg header { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; font-size: 14px; }
.t-msg header time { margin-left: auto; color: var(--subtle); font-size: 12.5px; }
.t-badge { font: 500 10.5px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--copper-ink); background: var(--copper-soft); padding: 2px 7px; border-radius: 999px; }
.t-badge.int { color: var(--amber); background: #F0DFB4; }
.t-body { font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.t-files { list-style: none; margin: 10px 0 0; padding: 10px 0 0; border-top: 1px dashed var(--line); display: grid; gap: 4px; font-size: 14px; }
.t-event { display: flex; justify-content: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.t-event span { background: var(--paper-2); padding: 4px 10px; border-radius: 999px; }
.t-event time { padding-top: 4px; }
.t-reply { margin-top: 6px; }
.p-side { display: grid; gap: 16px; position: sticky; top: 88px; }
.a-dl.compact > div { grid-template-columns: 96px minmax(0, 1fr); padding: 8px 0; }
.p-side-actions { display: grid; gap: 8px; margin-top: 14px; }
.p-side-actions form, .p-side-actions .a-btn { width: 100%; }
.p-side-actions .a-btn { width: 100%; }
.p-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.stars { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; }
.stars input { position: absolute; opacity: 0; }
.stars label { font-size: 28px; color: var(--line); cursor: pointer; line-height: 1; transition: color .15s; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: var(--copper); }
.stars input:focus-visible + label { outline: 2px solid var(--copper); border-radius: 4px; }
.stars-ro { font-size: 22px; color: var(--copper); margin: 0; letter-spacing: 2px; }

/* worksheet */
.ws-doc h3 { margin: 22px 0 8px; font-size: 16px; }
.ws-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0 0 8px; padding: 14px; background: var(--paper); border-radius: 12px; }
.ws-meta dt { font: 500 11px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ws-meta dd { margin: 2px 0 0; font-weight: 500; }
.ws-desc { font-size: 15px; line-height: 1.6; }
.ws-items { margin-top: 4px; border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; }
.a-table .num { text-align: right; white-space: nowrap; }
.ws-tot { display: flex; justify-content: flex-end; gap: 24px; margin-top: 12px; font-size: 15px; flex-wrap: wrap; }
.accept-box { border-color: var(--copper); box-shadow: 0 0 0 3px rgba(122, 31, 43, .08); }
.sig { display: grid; gap: 6px; }
.sig-label { font-weight: 500; font-size: 13.5px; color: var(--ink-2); }
.sig-pad { width: 100%; height: 130px; background: var(--white); border: 1px dashed var(--line); border-radius: 12px; touch-action: none; cursor: crosshair; }
.sig .linkbtn { justify-self: start; }
.sig-img { max-width: 100%; height: auto; background: var(--white); border: 1px solid var(--line-2); border-radius: 10px; margin-top: 10px; }
.hash { font-size: 12.5px; color: var(--muted); margin: 12px 0 0; }

@media (max-width: 960px) {
  .p-top-in { height: auto; padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .p-nav { order: 3; width: 100%; margin: 0; overflow-x: auto; }
  .p-nav a { padding: 8px 11px; font-size: 14px; }
  .p-company { display: none; }
  .p-main { padding: 20px 16px 48px; }
  .p-ticket { grid-template-columns: minmax(0, 1fr); }
  .t-event { flex-wrap: wrap; text-align: center; }
  .t-msg.mine { justify-self: stretch; }
  .ws-items { display: block; overflow-x: auto; }
  .p-side { position: static; }
  .prio-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ws-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .t-msg { max-width: 100%; }
}

/* PDF: view online + download */
.pdf-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.pdf-actions .a-btn { flex: 1 1 auto; justify-content: center; text-align: center; }
td.right .a-btn + .a-btn { margin-left: 4px; }
.t-files .sm a { color: inherit; text-decoration: underline; }
