/* Client portal: calm, minimal, premium. Builds on the shared brand tokens in /css/app.css. */
body.portal { background: #F6F9F8; min-height: 100vh; }
body.portal::before { content: ""; position: fixed; inset: 0; z-index: -1; background: radial-gradient(60% 40% at 85% -5%, rgba(56,175,166,.16), transparent 70%), radial-gradient(45% 35% at 0% 100%, rgba(0,119,113,.08), transparent 70%); }

/* ---------- Sign-in ---------- */
.p-auth { min-height: 100vh; display: grid; place-items: center; padding: 28px 18px; }
.p-auth-card { width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line-200); border-radius: 26px; box-shadow: var(--shadow-lg); padding: 44px 38px 34px; text-align: center; animation: rise .5s var(--ease); }
.p-auth-card img.logo { height: 38px; width: auto; margin: 0 auto 30px; }
.p-auth-card h1 { font-size: 24px; letter-spacing: -.02em; margin-bottom: 8px; }
.p-auth-card p { margin: 0 0 26px; color: var(--ink-500); line-height: 1.6; }
.p-auth-card form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.p-auth-card .input { height: 48px; border-radius: 14px; font-size: 15px; }
.p-auth-card .btn.primary { height: 48px; font-size: 15px; }
.p-sent { width: 64px; height: 64px; border-radius: 20px; margin: 0 auto 20px; display: grid; place-items: center; background: var(--teal-50); color: var(--teal-600); }
.p-sent svg { width: 30px; height: 30px; }
.p-fine { margin-top: 22px; font-size: 12.5px; color: var(--ink-400); }

/* ---------- Shell ---------- */
.p-top { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.82); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid rgba(228,236,234,.9); }
.p-top-in { max-width: 1080px; margin: 0 auto; height: 68px; padding: 0 24px; display: flex; align-items: center; gap: 28px; }
.p-top img.logo { height: 26px; width: auto; display: block; }
.p-nav { display: flex; gap: 4px; }
.p-nav a { height: 38px; padding: 0 16px; border-radius: var(--r-pill); display: inline-flex; align-items: center; gap: 8px; color: var(--ink-500); font-weight: 700; transition: .15s; }
.p-nav a:hover { color: var(--teal-700); background: var(--teal-50); }
.p-nav a.on { color: var(--teal-700); background: var(--teal-50); }
.p-nav a svg { width: 16px; height: 16px; }
.p-user { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.p-user .who { text-align: right; line-height: 1.25; }
.p-user .who b { display: block; color: var(--ink-900); font-size: 13.5px; }
.p-user .who span { font-size: 12px; color: var(--ink-400); }
.p-main { max-width: 1080px; margin: 0 auto; padding: 38px 24px 80px; animation: rise .4s var(--ease); }
.p-foot { text-align: center; color: var(--ink-300); font-size: 12.5px; padding: 0 0 36px; }

/* ---------- Headings ---------- */
.p-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 26px; }
.p-hero h1 { font-size: 30px; letter-spacing: -.025em; }
.p-hero p { margin: 6px 0 0; color: var(--ink-500); font-size: 15px; }
.p-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 26px; }
.p-stat { background: #fff; border: 1px solid var(--line-200); border-radius: 18px; padding: 20px 22px; box-shadow: var(--shadow-xs); }
.p-stat b { display: block; font: 600 32px/1 var(--font-display); color: var(--ink-900); letter-spacing: -.03em; }
.p-stat span { display: block; margin-top: 8px; color: var(--ink-500); font-weight: 600; font-size: 13.5px; }
.p-stat.warn b { color: var(--warning); }

/* ---------- Lists ---------- */
.p-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.p-toolbar .search { flex: 1; min-width: 220px; max-width: 360px; }
.p-list { background: #fff; border: 1px solid var(--line-200); border-radius: 20px; box-shadow: var(--shadow-sm); overflow: hidden; }
.p-row { display: flex; align-items: center; gap: 16px; padding: 18px 22px; border-top: 1px solid var(--line-100); cursor: pointer; transition: background .15s; }
.p-row:first-child { border-top: 0; }
.p-row:hover { background: #F8FCFB; }
.p-row .pmain { flex: 1; min-width: 0; }
.p-row .pmain b { display: block; color: var(--ink-900); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-row .pmain small { color: var(--ink-400); font-size: 12.5px; }
.p-row .meta { display: flex; align-items: center; gap: 14px; flex: none; }
.p-row .when { color: var(--ink-400); font-size: 12.5px; min-width: 70px; text-align: right; }
.p-row .chev { color: var(--ink-300); width: 18px; height: 18px; }
.pill.wait { --c: #C77F11; }
.p-empty { padding: 64px 24px; text-align: center; color: var(--ink-400); }
.p-empty .ico { width: 60px; height: 60px; border-radius: 20px; margin: 0 auto 16px; display: grid; place-items: center; background: var(--teal-50); color: var(--teal-500); }
.p-empty .ico svg { width: 28px; height: 28px; }
.p-empty h3 { font-size: 17px; margin-bottom: 4px; }

/* ---------- Ticket ---------- */
.p-back { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-500); font-weight: 700; margin-bottom: 16px; }
.p-back:hover { color: var(--teal-700); }
.p-back svg { width: 16px; height: 16px; }
.p-ticket { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.p-head { background: #fff; border: 1px solid var(--line-200); border-radius: 20px; padding: 26px 28px; box-shadow: var(--shadow-sm); margin-bottom: 20px; }
.p-head h1 { font-size: 24px; line-height: 1.3; letter-spacing: -.02em; margin: 10px 0 0; }
.p-head .row { gap: 10px; }
.p-banner { display: flex; gap: 12px; align-items: center; padding: 14px 18px; border-radius: 14px; background: #FBF3E4; border: 1px solid #F1DFBC; color: #7A4E08; font-weight: 700; margin-bottom: 20px; }
.p-banner svg { width: 18px; height: 18px; }
.p-thread { display: flex; flex-direction: column; gap: 16px; margin-bottom: 22px; }
.p-msg { display: grid; grid-template-columns: 36px 1fr; gap: 12px; }
.p-bubble { background: #fff; border: 1px solid var(--line-200); border-radius: 4px 18px 18px 18px; padding: 14px 18px 16px; box-shadow: var(--shadow-xs); }
.p-msg.staff .p-bubble { background: linear-gradient(180deg, #F2FAF9, #EAF6F4); border-color: var(--teal-100); }
.p-bubble .who { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.p-bubble .who b { color: var(--ink-900); }
.p-bubble .who span { color: var(--ink-400); font-size: 12.5px; white-space: nowrap; }
.p-bubble .text { white-space: pre-wrap; word-wrap: break-word; color: var(--ink-700); line-height: 1.65; }
.p-files { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.p-file { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line-200); background: #fff; border-radius: 10px; font-size: 12.5px; font-weight: 700; color: var(--ink-700); }
.p-file:hover { border-color: var(--teal-300); color: var(--teal-700); }
.p-file svg { width: 14px; height: 14px; color: var(--teal-500); }
.p-reply { background: #fff; border: 1px solid var(--line-200); border-radius: 20px; padding: 18px; box-shadow: var(--shadow-sm); }
.p-reply textarea { min-height: 110px; border-radius: 14px; }
.p-reply .foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.p-side { background: #fff; border: 1px solid var(--line-200); border-radius: 20px; padding: 8px 22px; box-shadow: var(--shadow-sm); position: sticky; top: 92px; }
.p-side .kv2 { padding: 14px 0; border-top: 1px solid var(--line-100); }
.p-side .kv2:first-child { border-top: 0; }
.p-side .kv2 label { display: block; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-400); margin-bottom: 4px; }
.p-side .kv2 div { color: var(--ink-900); font-weight: 600; }

/* ---------- New request ---------- */
.p-form { max-width: 720px; background: #fff; border: 1px solid var(--line-200); border-radius: 22px; padding: 32px; box-shadow: var(--shadow-sm); }
.p-form .stack { gap: 22px; }
.p-form .input, .p-form .select { height: 46px; border-radius: 14px; }
.p-form .textarea { min-height: 150px; border-radius: 14px; }
.p-choices { display: flex; gap: 10px; flex-wrap: wrap; }
.p-choice { display: inline-flex; align-items: center; gap: 9px; height: 42px; padding: 0 18px; border-radius: var(--r-pill); border: 1.5px solid var(--line-200); background: #fff; font-weight: 700; color: var(--ink-600); cursor: pointer; transition: .15s; }
.p-choice:hover { border-color: var(--teal-300); }
.p-choice.on { border-color: var(--teal-600); background: var(--teal-50); color: var(--teal-800); box-shadow: 0 0 0 3px rgba(56,175,166,.16); }
.p-drop { border: 1.5px dashed var(--teal-200); border-radius: 16px; padding: 18px; text-align: center; color: var(--ink-500); cursor: pointer; background: #FAFDFC; transition: .15s; }
.p-drop:hover { border-color: var(--teal-400); background: var(--teal-50); }
.p-attached { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.p-attached .item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line-200); border-radius: 10px; font-weight: 600; }
.p-attached .item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Devices / team ---------- */
.p-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.p-card { background: #fff; border: 1px solid var(--line-200); border-radius: 20px; padding: 22px; box-shadow: var(--shadow-xs); }
.p-card .top { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.p-card .top .ic { width: 46px; height: 46px; border-radius: 14px; background: var(--teal-50); color: var(--teal-600); display: grid; place-items: center; }
.p-card .top .ic svg { width: 22px; height: 22px; }
.p-card .top b { display: block; color: var(--ink-900); font-size: 15.5px; }
.p-card .top small { color: var(--ink-400); }
.p-card dl { margin: 0; display: grid; grid-template-columns: 90px 1fr; gap: 8px 12px; font-size: 13.5px; }
.p-card dt { color: var(--ink-400); font-weight: 700; }
.p-card dd { margin: 0; color: var(--ink-700); font-weight: 600; word-break: break-word; }

@media (max-width: 520px) { .p-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; } .p-stat { padding: 14px 12px; } .p-stat b { font-size: 22px; } }
@media (max-width: 860px) {
  .p-ticket { grid-template-columns: minmax(0, 1fr); } .p-side { position: static; }
  .p-stat { padding: 16px 16px; border-radius: 16px; } .p-stat b { font-size: 26px; } .p-stat span { font-size: 12px; margin-top: 6px; } .p-top-in { gap: 12px; padding: 0 16px; } .p-user .who { display: none; }
  .p-nav a span { display: none; } .p-nav a { padding: 0 12px; } .p-main { padding: 26px 16px 64px; } .p-row .meta .when { display: none; }
  .p-form { padding: 22px; } .p-hero h1 { font-size: 26px; }
}
