/* PEMIS modern UI layer — shared by dashboard, sale-permission approval and apply forms */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --pm-primary: #146c43;
  --pm-primary-600: #0f5a37;
  --pm-primary-50: #e9f6ef;
  --pm-accent: #f59f00;
  --pm-info: #1971c2;
  --pm-danger: #c92a2a;
  --pm-warning: #e67700;
  --pm-violet: #6741d9;
  --pm-text: #1f2933;
  --pm-muted: #6b7785;
  --pm-border: #e3e8ee;
  --pm-bg: #f4f6f9;
  --pm-surface: #ffffff;
  --pm-radius: 12px;
  --pm-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 14px rgba(16, 24, 40, .06);
}

/* ---------- generic building blocks ---------- */
.pm-page { font-family: 'Inter', 'Work Sans', system-ui, sans-serif; color: var(--pm-text); background: var(--pm-bg); padding: 20px 8px 32px; min-height: 100%; }
.pm-page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.pm-page-head h1 { font-size: 22px; font-weight: 700; margin: 0; }
.pm-page-head p { margin: 2px 0 0; color: var(--pm-muted); font-size: 13px; }

.pm-card { background: var(--pm-surface); border: 1px solid var(--pm-border); border-radius: var(--pm-radius); box-shadow: var(--pm-shadow); margin-bottom: 18px; }
.pm-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--pm-border); }
.pm-card-head h2, .pm-card-head h3 { font-size: 15px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.pm-card-head h2 i, .pm-card-head h3 i { color: var(--pm-primary); }
.pm-card-body { padding: 16px 18px; }

.pm-section-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--pm-muted); margin: 22px 0 10px; }

/* stat tiles */
.pm-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.pm-stat { position: relative; display: block; background: var(--pm-surface); border: 1px solid var(--pm-border); border-radius: var(--pm-radius); padding: 16px 16px 14px; box-shadow: var(--pm-shadow); color: var(--pm-text); text-decoration: none !important; transition: transform .12s ease, box-shadow .12s ease; overflow: hidden; }
.pm-stat:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(16, 24, 40, .10); color: var(--pm-text); }
.pm-stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--tone, var(--pm-primary)); }
.pm-stat .pm-stat-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--tone, var(--pm-primary)) 12%, white); color: var(--tone, var(--pm-primary)); margin-bottom: 10px; }
.pm-stat .pm-stat-label { font-size: 12.5px; color: var(--pm-muted); font-weight: 500; }
.pm-stat .pm-stat-value { font-size: 28px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.pm-stat .pm-stat-link { font-size: 12px; color: var(--tone, var(--pm-primary)); font-weight: 600; margin-top: 4px; display: inline-block; }
.pm-stat.is-active { outline: 2px solid var(--tone, var(--pm-primary)); }
.tone-green { --tone: #146c43; } .tone-blue { --tone: #1971c2; } .tone-red { --tone: #c92a2a; }
.tone-amber { --tone: #e67700; } .tone-violet { --tone: #6741d9; } .tone-teal { --tone: #0c8599; } .tone-gray { --tone: #495057; }

/* filter bar */
.pm-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; align-items: end; }
.pm-field label { display: block; font-size: 12px; font-weight: 600; color: var(--pm-muted); margin-bottom: 4px; }
.pm-field input, .pm-field select, .pm-input, .pm-textarea {
  width: 100%; height: 38px; border: 1px solid var(--pm-border); border-radius: 8px; padding: 6px 10px; font-size: 14px; background: #fff; color: var(--pm-text); transition: border-color .12s, box-shadow .12s; }
.pm-textarea { height: auto; min-height: 90px; resize: vertical; }
.pm-field input:focus, .pm-field select:focus, .pm-input:focus, .pm-textarea:focus { outline: none; border-color: var(--pm-primary); box-shadow: 0 0 0 3px rgba(20, 108, 67, .15); }
.pm-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* buttons & chips */
.pm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 38px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent; font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none !important; transition: background .12s, border-color .12s; white-space: nowrap; }
.pm-btn-primary { background: var(--pm-primary); color: #fff !important; }
.pm-btn-primary:hover { background: var(--pm-primary-600); }
.pm-btn-outline { background: #fff; border-color: var(--pm-border); color: var(--pm-text) !important; }
.pm-btn-outline:hover { border-color: var(--pm-primary); color: var(--pm-primary) !important; }
.pm-btn-danger { background: var(--pm-danger); color: #fff !important; }
.pm-btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.pm-chip { display: inline-flex; align-items: center; height: 28px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--pm-border); background: #fff; font-size: 12.5px; font-weight: 500; color: var(--pm-text); cursor: pointer; }
.pm-chip:hover, .pm-chip.active { border-color: var(--pm-primary); background: var(--pm-primary-50); color: var(--pm-primary); }
.pm-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2f6; color: #495057; white-space: nowrap; }
.pm-badge.green { background: #e6f4ea; color: #146c43; } .pm-badge.blue { background: #e7f1fb; color: #1864ab; }
.pm-badge.red { background: #fdecec; color: #c92a2a; } .pm-badge.amber { background: #fff4e0; color: #b35c00; }
.pm-badge.violet { background: #f0ebff; color: #5f3dc4; }

/* tables */
.pm-table-wrap { overflow-x: auto; }
.pm-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.pm-table th { position: sticky; top: 0; background: #f8fafc; color: var(--pm-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 10px 12px; border-bottom: 1px solid var(--pm-border); text-align: left; white-space: nowrap; }
.pm-table td { padding: 10px 12px; border-bottom: 1px solid var(--pm-border); vertical-align: middle; }
.pm-table tbody tr:hover td { background: #f8fbf9; }
.pm-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.pm-table tfoot td { font-weight: 700; background: #f8fafc; border-top: 2px solid var(--pm-border); }
.pm-link-num { color: var(--pm-info); font-weight: 600; cursor: pointer; text-decoration: none; }
.pm-link-num:hover { text-decoration: underline; }
.pm-link-num.zero { color: #adb5bd; cursor: default; pointer-events: none; }
.pm-empty { text-align: center; color: var(--pm-muted); padding: 28px 10px; }
.pm-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--pm-muted); }
.pm-breadcrumb a { color: var(--pm-info); cursor: pointer; }

/* key-value detail grid */
.pm-kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 22px; }
.pm-kv dt { font-size: 12px; color: var(--pm-muted); font-weight: 500; margin-bottom: 2px; }
.pm-kv dd { margin: 0; font-weight: 600; font-size: 14px; word-break: break-word; }

/* workflow timeline */
.pm-steps { list-style: none; margin: 0; padding: 0; }
.pm-steps li { position: relative; padding: 0 0 18px 34px; }
.pm-steps li::before { content: ""; position: absolute; left: 11px; top: 24px; bottom: 0; width: 2px; background: var(--pm-border); }
.pm-steps li:last-child::before { display: none; }
.pm-steps .dot { position: absolute; left: 0; top: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; background: #e9ecef; color: #868e96; }
.pm-steps li.done .dot { background: var(--pm-primary); color: #fff; }
.pm-steps li.current .dot { background: var(--pm-accent); color: #fff; box-shadow: 0 0 0 4px rgba(245, 159, 0, .2); }
.pm-steps .who { font-weight: 600; font-size: 13.5px; }
.pm-steps .note { font-size: 13px; color: var(--pm-muted); margin-top: 2px; white-space: pre-wrap; }

.pm-alert { border-radius: 10px; padding: 12px 14px; font-size: 13.5px; margin-bottom: 14px; border: 1px solid; }
.pm-alert.success { background: #e6f4ea; border-color: #b2dfc1; color: #0f5132; }
.pm-alert.warn { background: #fff8e6; border-color: #ffe08a; color: #7a4d00; }
.pm-alert.error { background: #fdecec; border-color: #f5c2c2; color: #842029; }

.pm-radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 12px; }
.pm-radio-cards label { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--pm-border); border-radius: 10px; padding: 12px; cursor: pointer; font-size: 13.5px; }
.pm-radio-cards input { margin-top: 3px; accent-color: var(--pm-primary); }
.pm-radio-cards label:has(input:checked) { border-color: var(--pm-primary); background: var(--pm-primary-50); }
.pm-radio-cards b { display: block; }
.pm-radio-cards small { color: var(--pm-muted); }

.pm-loading { opacity: .5; pointer-events: none; transition: opacity .15s; }

@media (max-width: 576px) {
  .pm-page { padding: 14px 4px 24px; }
  .pm-page-head h1 { font-size: 19px; }
  .pm-stat .pm-stat-value { font-size: 24px; }
}

/* ---------- Apply forms (public) : restyles existing bootstrap markup ---------- */
.modern-apply { font-family: 'Inter', 'Work Sans', system-ui, sans-serif; color: var(--pm-text); max-width: 1280px; margin: 0 auto; padding: 8px 12px 40px; }
.modern-apply .pm-hero { background: linear-gradient(120deg, #0f5a37 0%, #198754 55%, #2f9e44 100%); color: #fff; border-radius: 16px; padding: 22px 26px; margin: 14px 0 22px; box-shadow: var(--pm-shadow); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 14px; }
.modern-apply .pm-hero h1 { font-size: 22px; font-weight: 700; margin: 0 0 4px; color: #fff !important; }
.modern-apply .pm-hero p { margin: 0; opacity: .9; font-size: 13.5px; }
.modern-apply .pm-hero .pm-head-code { background: rgba(255, 255, 255, .15); border: 1px solid rgba(255, 255, 255, .3); border-radius: 10px; padding: 8px 14px; font-size: 13px; font-weight: 600; }
.modern-apply .pm-hero .pm-head-code span { display: block; font-size: 11px; opacity: .8; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }
.modern-apply > h3, .modern-apply h3.text-center { display: none; }
.modern-apply .card { border: 1px solid var(--pm-border) !important; border-radius: var(--pm-radius) !important; box-shadow: var(--pm-shadow); margin-bottom: 18px !important; overflow: visible; background: #fff; }
.modern-apply .card .card { box-shadow: none; }
.modern-apply .card-header { background: #fff !important; color: var(--pm-text) !important; border: 0 !important; border-bottom: 1px solid var(--pm-border) !important; border-left: 4px solid var(--pm-primary) !important; border-radius: var(--pm-radius) var(--pm-radius) 0 0 !important; font-weight: 600; font-size: 15px; padding: 14px 18px; }
.modern-apply .card-header.alert-info { border-left-color: var(--pm-info) !important; }
.modern-apply .card-header.alert-danger { border-left-color: var(--pm-danger) !important; }
.modern-apply .card-header.alert-warning { border-left-color: var(--pm-warning) !important; }
.modern-apply .card-header.alert-success { border-left-color: #2f9e44 !important; }
.modern-apply .card > b.text-right { display: none; }
.modern-apply .card-body { padding: 18px; }
.modern-apply label { font-size: 12.5px; font-weight: 600; color: #475461; margin-bottom: 5px; }
.modern-apply .form-control, .modern-apply select, .modern-apply textarea { border: 1px solid #d6dde4; border-radius: 8px; min-height: 38px; font-size: 14px; box-shadow: none; transition: border-color .12s, box-shadow .12s; }
.modern-apply .form-control:focus, .modern-apply select:focus, .modern-apply textarea:focus { border-color: var(--pm-primary); box-shadow: 0 0 0 3px rgba(20, 108, 67, .15); outline: none; }
.modern-apply .form-control.ng-touched.ng-invalid, .modern-apply .form-control.ng-dirty.ng-invalid { border-color: #e03131; }
.modern-apply .form-group { margin-bottom: 14px; }
.modern-apply .btn { border-radius: 8px; font-weight: 600; padding: 8px 18px; }
.modern-apply .btn-success, .modern-apply .btn-primary { background: var(--pm-primary); border-color: var(--pm-primary); }
.modern-apply .btn-success:hover, .modern-apply .btn-primary:hover { background: var(--pm-primary-600); border-color: var(--pm-primary-600); }
.modern-apply .table { font-size: 13.5px; }
.modern-apply .table thead th { background: #f8fafc; color: var(--pm-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; border-bottom-width: 1px; }
.modern-apply .requireds::after, .modern-apply .required::after { color: #e03131; }
.modern-apply .text-danger { color: #c92a2a !important; }
@media (max-width: 576px) {
  .modern-apply .pm-hero { padding: 18px; }
  .modern-apply .pm-hero h1 { font-size: 18px; }
}

/* ---------- Application wizard (Retailer / PCO / Renewal / Sale Permission) ---------- */
.pm-wizard { list-style: none; margin: 0 0 22px; padding: 14px 16px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; background: #fff; border: 1px solid var(--pm-border); border-radius: var(--pm-radius); box-shadow: var(--pm-shadow); counter-reset: none; }
.pm-wizard li { position: relative; display: flex; justify-content: center; }
.pm-wizard li::before { content: ""; position: absolute; top: 19px; left: -50%; width: 100%; height: 3px; background: var(--pm-border); z-index: 0; }
.pm-wizard li:first-child::before { display: none; }
.pm-wizard li.done::before, .pm-wizard li.current::before { background: var(--pm-primary); }
.pm-wizard li > a, .pm-wizard li > span { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; text-decoration: none !important; color: var(--pm-muted); }
.pm-wz-dot { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #fff; border: 2px solid var(--pm-border); color: #98a2ad; font-size: 15px; transition: transform .12s; }
.pm-wz-text { font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.pm-wz-text small { display: block; font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: .05em; opacity: .8; }
.pm-wizard li.done .pm-wz-dot { background: var(--pm-primary); border-color: var(--pm-primary); color: #fff; }
.pm-wizard li.done a:hover .pm-wz-dot { transform: scale(1.08); }
.pm-wizard li.done .pm-wz-text { color: var(--pm-primary); }
.pm-wizard li.current .pm-wz-dot { border-color: var(--pm-primary); color: var(--pm-primary); box-shadow: 0 0 0 5px rgba(20, 108, 67, .14); }
.pm-wizard li.current .pm-wz-text { color: var(--pm-text); }
@media (max-width: 767.98px) {
  .pm-wizard { padding: 12px 6px; }
  .pm-wz-text { display: none; }
  .pm-wizard li.current .pm-wz-text { display: block; position: absolute; top: 40px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 11px; text-align: center; }
  .pm-wizard { padding-bottom: 30px; }
  .pm-wz-dot { width: 34px; height: 34px; font-size: 13px; }
  .pm-wizard li::before { top: 16px; }
}
/* legacy bits inside the wizard pages */
.modern-apply .card-header.bg-warning, .modern-apply .card-header.bg-info { background: #fff !important; color: var(--pm-text) !important; }
.modern-apply .card-header.bg-warning { border-left-color: var(--pm-warning) !important; }
.modern-apply .card-header.bg-info { border-left-color: var(--pm-info) !important; }
.modern-apply .btn-secondary { background: #fff; color: var(--pm-text); border-color: #d6dde4; }
.modern-apply .btn-secondary:hover { border-color: var(--pm-primary); color: var(--pm-primary); background: #fff; }
.modern-apply .btn-danger { border-radius: 8px; }
.modern-apply .card-body > .row:last-child .btn, .modern-apply form > .text-center .btn { min-width: 140px; }
.modern-apply input.invisible { position: absolute !important; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; overflow: hidden; }
