/* ASD GROUP — customer portal (Portal Meter TNB). Builds on style.css. */

body.portal, body.admin { background: var(--mist); font-size: 16px; display: flex; flex-direction: column; min-height: 100vh; }
.btn-sm { min-height: 40px; padding: 0 1rem; font-size: .88rem; }
.btn-wa { background: #1FA855; color: #fff; }
.btn-wa:hover { background: #178A45; }

/* Header / footer */
.p-top { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.p-top-inner { display: flex; align-items: center; justify-content: space-between; min-height: 68px; gap: 1rem; }
.p-brand { display: flex; align-items: center; gap: .65rem; }
.p-brand img { width: 36px; height: 36px; }
.p-brand strong { display: block; font-family: var(--font-head); font-size: 1rem; line-height: 1.2; }
.p-brand small { display: block; font-size: .72rem; color: var(--slate); letter-spacing: .06em; }
.p-nav { display: flex; align-items: center; gap: 1rem; }
.p-nav > a:not(.btn), .p-link { font-family: var(--font-head); font-size: .9rem; color: var(--navy); background: none; border: 0; cursor: pointer; padding: .5rem 0; min-height: 40px; }
.p-nav > a:not(.btn):hover, .p-link:hover { color: var(--maroon); }
.p-nav form { margin: 0; }
@media (max-width: 640px) {
  .p-brand small { display: none; }
  .p-nav { gap: .6rem; }
  .p-nav > a:not(.btn):first-child { display: none; }
}
.p-main { padding-top: 32px; padding-bottom: 64px; flex: 1; width: 100%; }
.p-narrow { max-width: 520px; }
.p-foot { border-top: 1px solid var(--line); background: #fff; font-size: .88rem; color: var(--slate); }
.p-foot .container { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding-top: 16px; padding-bottom: 16px; }
.p-foot a { color: var(--maroon); }

/* Cards & text */
.p-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; margin-bottom: 20px; }
.p-card h1 { font-size: 1.6rem; }
.p-card h2 { font-size: 1.15rem; display: flex; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.p-card h3 { font-size: 1rem; }
.p-sub { color: var(--slate); font-size: .98rem; }
.p-muted { color: var(--slate); font-size: .9rem; }
.p-alt { text-align: center; margin: 1.25rem 0 0; color: var(--slate); font-size: .95rem; }
.p-alt a, .p-back a { color: var(--maroon); font-weight: 600; }
.p-back { margin: 0 0 12px; }
.p-block { width: 100%; }
.p-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 20px; }
.p-head h1 { font-size: clamp(1.5rem, 3vw, 2rem); margin: .2rem 0 .3rem; }
.p-ref { font-family: var(--font-head); font-size: .82rem; font-weight: 600; letter-spacing: .08em; color: var(--maroon); }
.req { color: var(--danger); }
.p-hint { font-size: .85rem; color: var(--slate); margin-top: .35rem; }
.p-check { display: flex; gap: .65rem; align-items: flex-start; font-size: .92rem; color: var(--navy); cursor: pointer; }
.p-check input { width: 20px; height: 20px; margin-top: 2px; flex: none; accent-color: var(--maroon); }
.field .p-check { font-weight: 400; }

/* Flash messages */
.p-flash, .flash { margin-bottom: 16px; padding: .85rem 1rem; border-radius: 10px; background: #EEF4FF; border: 1px solid #C7D7FE; color: #1E3A8A; font-size: .95rem; }
.p-flash-ok, .flash-ok { background: #ECFDF3; border-color: #BBF7D0; color: #14532D; }
.p-flash-error, .flash-error { background: #FEF2F2; border-color: #FECACA; color: #7F1D1D; }

/* Apply form */
.p-step { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: inline-grid; place-items: center; font-size: .85rem; flex: none; }
.form-row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 760px) { .form-row3 { grid-template-columns: 1fr; gap: 0; } }
.p-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.p-opt { display: flex; gap: .75rem; align-items: flex-start; border: 1.5px solid var(--line); border-radius: 12px; padding: 16px; cursor: pointer; transition: border-color .2s, background .2s; }
.p-opt:hover { border-color: #CBD5E1; }
.p-opt input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--maroon); flex: none; }
.p-opt strong { display: block; font-family: var(--font-head); }
.p-opt small { display: block; color: var(--slate); font-size: .88rem; }
.p-opt:has(input:checked) { border-color: var(--maroon); background: #FBF3F3; }
@media (max-width: 560px) { .p-choice { grid-template-columns: 1fr; } }

.p-docs { display: grid; gap: 12px; }
.p-docs[hidden] { display: none; }
.p-doc { display: grid; grid-template-columns: 1fr 1.3fr; gap: 12px; align-items: center; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.p-doc.invalid { border-color: var(--danger); background: #FEF2F2; }
.p-doc-label { font-size: .95rem; }
.p-opt-tag { font-size: .75rem; color: var(--slate); background: var(--mist); border-radius: 6px; padding: .1rem .4rem; }
@media (max-width: 640px) { .p-doc { grid-template-columns: 1fr; } }

.p-file { display: flex; align-items: center; gap: .75rem; cursor: pointer; min-width: 0; }
.p-file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.p-file-btn { flex: none; display: inline-flex; align-items: center; min-height: 42px; padding: 0 1rem; border: 1.5px dashed #94A3B8; border-radius: 10px; font-family: var(--font-head); font-size: .88rem; color: var(--navy); background: #fff; }
.p-file:hover .p-file-btn, .p-file:focus-within .p-file-btn { border-color: var(--maroon); color: var(--maroon); }
.p-file-names { font-size: .88rem; color: var(--slate); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-file.has-files .p-file-names { color: var(--success); font-weight: 600; }

.p-submit { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 8px 0 24px; }
.p-submit .p-sub { margin: 0; max-width: 60ch; }
.p-progress { font-size: .9rem; color: var(--slate); }

/* Status badges */
.pst { display: inline-flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 700; padding: .3rem .75rem; border-radius: 999px; white-space: nowrap; background: #E2E8F0; color: #334155; }
.pst-submitted { background: #FEF3C7; color: #92400E; }
.pst-reviewing, .pst-site_visit { background: #DBEAFE; color: #1E40AF; }
.pst-need_info { background: #FFEDD5; color: #9A3412; }
.pst-submitted_tnb, .pst-installation { background: #EDE9FE; color: #5B21B6; }
.pst-approved, .pst-completed { background: #DCFCE7; color: #166534; }
.pst-rejected { background: #FEE2E2; color: #991B1B; }

/* Dashboard */
.p-apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.p-app { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: .2rem; transition: border-color .2s, box-shadow .2s; }
.p-app:hover { border-color: #CBD5E1; box-shadow: var(--shadow); }
.p-app-top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .4rem; }
.p-app h3 { font-size: 1.1rem; margin: 0; }
.p-app p { margin: 0; font-size: .92rem; }
.p-app-foot { display: flex; justify-content: space-between; margin-top: .9rem; padding-top: .75rem; border-top: 1px solid var(--line); font-size: .85rem; color: var(--slate); }
.p-action-needed { margin-top: .6rem; font-size: .88rem; font-weight: 600; color: #9A3412; background: #FFF7ED; border-radius: 8px; padding: .45rem .65rem; }
.p-empty { text-align: center; padding: 48px 24px; }
.p-empty h2 { justify-content: center; }

/* Application detail */
.p-remark { border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; background: #EEF4FF; border: 1px solid #C7D7FE; }
.p-remark p { margin: .25rem 0 0; }
.p-remark-need_info { background: #FFF7ED; border-color: #FED7AA; }
.p-remark-rejected { background: #FEF2F2; border-color: #FECACA; }
.p-remark-note { margin-top: .75rem; padding-top: .75rem; border-top: 1px solid rgba(0,0,0,.08); }
.p-remark-note span { font-weight: 700; }

.p-timeline { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.p-timeline li { position: relative; padding-top: 30px; font-size: .9rem; }
.p-timeline li::before { content: ""; position: absolute; top: 10px; left: 0; right: -8px; height: 3px; background: var(--line); }
.p-timeline li:last-child::before { right: 0; }
.p-timeline .dot { position: absolute; top: 3px; left: 0; width: 17px; height: 17px; border-radius: 50%; background: #fff; border: 3px solid #CBD5E1; z-index: 1; }
.p-timeline strong { display: block; font-size: .9rem; line-height: 1.3; color: var(--slate); }
.p-timeline .p-muted { display: block; font-size: .82rem; margin-top: .2rem; }
.p-timeline .is-done::before { background: var(--success); }
.p-timeline .is-done .dot { background: var(--success); border-color: var(--success); }
.p-timeline .is-done strong { color: var(--ink); }
.p-timeline .is-current .dot { border-color: var(--maroon); box-shadow: 0 0 0 4px rgba(139,26,26,.15); }
.p-timeline .is-current strong { color: var(--maroon); }
@media (max-width: 760px) {
  .p-timeline { grid-template-columns: 1fr; gap: 0; }
  .p-timeline li { padding: 0 0 18px 30px; }
  .p-timeline li::before { top: 17px; bottom: -3px; left: 7px; right: auto; width: 3px; height: auto; }
  .p-timeline li:last-child::before { display: none; }
  .p-timeline .dot { top: 2px; }
}

.p-grid2 { display: grid; grid-template-columns: 1.2fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .p-grid2 { grid-template-columns: 1fr; } }
.p-doclist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.p-doclist li { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.p-doclist-head { display: flex; justify-content: space-between; gap: .75rem; font-size: .95rem; font-weight: 600; }
.p-ok { color: var(--success); white-space: nowrap; }
.p-miss { color: #9A3412; font-size: .85rem; white-space: nowrap; }
.p-file-link { display: block; font-size: .9rem; color: #1D4ED8; margin-top: .35rem; word-break: break-all; }
.p-file-link:hover { text-decoration: underline; }
.p-upload-more { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.p-upload-more .btn { margin-top: 12px; }
.p-kv { display: grid; grid-template-columns: 100px 1fr; gap: .5rem 1rem; margin: 0; font-size: .95rem; }
.p-kv dt { color: var(--slate); }
.p-kv dd { margin: 0; font-weight: 600; word-break: break-word; }
.p-kv a { color: #1D4ED8; }
.p-history { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; font-size: .92rem; }
.p-history li { border-left: 3px solid var(--line); padding-left: 12px; }
.p-history strong { display: block; }

/* Apply form: fields that depend on Individu / Syarikat */
.p-form[data-cat="individu"] .co-only { display: none; }
.p-form[data-cat="syarikat"] .ind-only { display: none; }
