/* Portal prepaid dashboard. Every class starts with pd- and every rule sits under .pd, so none of
   it can reach the rest of the Portal. Light by default, dark with data-theme="dark". */
.pd {
  --pd-bg: #f2f0ed; --pd-panel: #ffffff; --pd-panel2: #f6f4f1; --pd-bd: #e2dfda;
  --pd-text: #1c1e22; --pd-muted: #6a7078; --pd-grid: #ebe8e4;
  --pd-brand: #db2a0a; --pd-brand2: #b81f05; --pd-orange: #dc5e0a; --pd-ink: #2f3338; --pd-grey: #9aa0a8; --pd-lgrey: #d4d6da;
  --pd-good: #1a7f5a; --pd-bad: #b42318; --pd-band: rgba(219,42,10,.07);
  --pd-shadow: 0 6px 20px rgba(0,0,0,.07);
  background: var(--pd-bg); color: var(--pd-text); padding: 18px 22px 40px; min-height: 100%;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; box-sizing: border-box;
}
.pd[data-theme="dark"] {
  --pd-bg: #0d0e10; --pd-panel: #16181b; --pd-panel2: #1d2024; --pd-bd: rgba(255,255,255,.08);
  --pd-text: #f3f3f4; --pd-muted: #9aa0a8; --pd-grid: rgba(255,255,255,.07);
  --pd-brand: #f0502d; --pd-brand2: #db2a0a; --pd-orange: #f5842a; --pd-ink: #e8eaee; --pd-grey: #7b8189; --pd-lgrey: #3a3e44;
  --pd-good: #3fb68b; --pd-bad: #f0705f; --pd-band: rgba(240,80,45,.10);
  --pd-shadow: 0 12px 32px rgba(0,0,0,.35);
}
.pd *, .pd *::before, .pd *::after { box-sizing: border-box; }
.pd button { font: inherit; color: inherit; cursor: pointer; }

/* header, tabs, controls */
.pd-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.pd-top h2 { margin: 0; font-size: 26px; letter-spacing: -.015em; color: var(--pd-text); }
.pd-top p { margin: 2px 0 0; color: var(--pd-muted); font-size: 13px; }
.pd-ctrl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pd-btn { background: var(--pd-panel2); border: 1px solid var(--pd-bd); border-radius: 8px; padding: 6px 14px; font-weight: 600; font-size: 13px; transition: border-color .15s; }
.pd-btn:hover { border-color: var(--pd-brand); }
.pd-btn.live { border-color: var(--pd-brand); color: var(--pd-brand); }
.pd-seg { display: inline-flex; border: 1px solid var(--pd-bd); border-radius: 8px; overflow: hidden; background: var(--pd-panel2); }
.pd-seg button { background: none; border: 0; padding: 6px 12px; font-size: 13px; font-weight: 600; color: var(--pd-muted); }
.pd-seg button.on { background: var(--pd-brand); color: #fff; }
.pd-tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--pd-bd); margin-bottom: 18px; scrollbar-width: none; }
.pd-tab { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 16px; font-size: 13.5px; font-weight: 600; color: var(--pd-muted); white-space: nowrap; }
.pd-tab:hover { color: var(--pd-text); }
.pd-tab.on { color: var(--pd-brand); border-bottom-color: var(--pd-brand); }
.pd-snap { color: var(--pd-muted); font-size: 12.5px; }
.pd-note { background: var(--pd-panel); border: 1px dashed var(--pd-bd); border-radius: 12px; padding: 22px; color: var(--pd-muted); text-align: center; }

/* period scrubber */
.pd-scrub { display: flex; align-items: center; gap: 10px; background: var(--pd-panel); border: 1px solid var(--pd-bd); border-radius: 999px; padding: 5px 6px 5px 5px; box-shadow: var(--pd-shadow); max-width: 100%; }
.pd-play { width: 32px; height: 32px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--pd-orange), var(--pd-brand2)); color: #fff; font-size: 12px; flex: none; }
.pd-chips { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.pd-chip { background: none; border: 0; border-radius: 999px; padding: 6px 11px; font-size: 12.5px; color: var(--pd-muted); font-weight: 600; white-space: nowrap; position: relative; }
.pd-chip:hover { color: var(--pd-text); }
.pd-chip.on { background: var(--pd-brand); color: #fff; }
.pd-chip.live::after { content: ""; position: absolute; top: 5px; right: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--pd-orange); animation: pd-ping 1.8s infinite; }
.pd-chip.on.live::after { background: #fff; }
@keyframes pd-ping { 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.pd-pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 16px; }

/* screens */
.pd-screen { display: none; }
.pd-screen.on { display: block; animation: pd-fadein .35s ease; }
@keyframes pd-fadein { from { opacity: 0; transform: translateY(6px); } }
@keyframes pd-rise { from { opacity: 0; transform: translateY(14px); } }

.pd-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(156px, 1fr)); gap: 12px; }
.pd-tile { background: var(--pd-panel); border: 1px solid var(--pd-bd); border-radius: 14px; padding: 14px 15px 10px; box-shadow: var(--pd-shadow); position: relative; overflow: hidden; animation: pd-rise .5s both; animation-delay: calc(var(--i) * 55ms); }
.pd-tile::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: linear-gradient(90deg, var(--pd-orange), var(--pd-brand)); opacity: .85; }
.pd-lbl { font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--pd-muted); font-weight: 600; display: flex; justify-content: space-between; gap: 6px; }
.pd-lbl em { font-style: normal; color: var(--pd-orange); text-transform: none; letter-spacing: 0; font-weight: 600; }
.pd-val { font-size: 30px; font-weight: 750; letter-spacing: -.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.pd-delta { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; min-height: 18px; }
.pd-delta.good { color: var(--pd-good); } .pd-delta.bad { color: var(--pd-bad); } .pd-delta.flat { color: var(--pd-muted); }
.pd-delta span { color: var(--pd-muted); font-weight: 400; }
.pd-tile svg { display: block; width: 100%; height: 30px; margin-top: 6px; }

.pd-row { display: grid; gap: 14px; margin-top: 14px; }
.pd-row.r21 { grid-template-columns: 2fr 1fr; } .pd-row.r11 { grid-template-columns: 1fr 1fr; } .pd-row.r1 { grid-template-columns: 1fr; }
@media (max-width: 1000px) { .pd-row.r21, .pd-row.r11 { grid-template-columns: 1fr; } }
.pd-card { background: var(--pd-panel); border: 1px solid var(--pd-bd); border-radius: 16px; padding: 18px 18px 12px; box-shadow: var(--pd-shadow); min-width: 0; }
.pd-card h3 { margin: 0; font-size: 15px; color: var(--pd-text); }
.pd-card .pd-d { margin: 2px 0 10px; font-size: 12.5px; color: var(--pd-muted); }
.pd-chart { position: relative; }
.pd-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.pd-xl { fill: var(--pd-muted); font-size: 11px; } .pd-xl.on { fill: var(--pd-text); font-weight: 700; }
.pd-yl { fill: var(--pd-muted); font-size: 11px; }
.pd-selband { fill: var(--pd-band); transition: x .35s cubic-bezier(.3,.8,.2,1); }
.pd-hit { cursor: pointer; }
.pd-bar { transition: opacity .25s; } .pd-bar.dim { opacity: .38; }
.pd-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: pd-draw 1.3s cubic-bezier(.3,.7,.2,1) forwards; }
@keyframes pd-draw { to { stroke-dashoffset: 0; } }
.pd-fade { opacity: 0; animation: pd-fade .6s .9s forwards; }
@keyframes pd-fade { to { opacity: 1; } }
.pd-grow { transform: scaleY(0); animation: pd-grow .75s cubic-bezier(.2,.8,.2,1) forwards; }
@keyframes pd-grow { to { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .pd-draw, .pd-fade, .pd-grow, .pd-tile, .pd-screen.on { animation: none !important; opacity: 1; transform: none; stroke-dashoffset: 0; } }
.pd-tip { position: absolute; top: 4px; pointer-events: none; background: var(--pd-panel2); color: var(--pd-text); border: 1px solid var(--pd-bd); border-radius: 10px; padding: 9px 12px; font-size: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25); display: none; z-index: 6; white-space: nowrap; }
.pd-tip .pd-h { font-weight: 700; margin-bottom: 4px; }
.pd-tip .pd-r { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.pd-tip .pd-r i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.pd-tip .pd-r b { font-variant-numeric: tabular-nums; } .pd-tip .pd-tot { border-top: 1px solid var(--pd-bd); margin-top: 4px; padding-top: 4px; }

.pd-ringcard { display: flex; flex-direction: column; }
.pd-ringsvg { width: 100%; max-width: 230px; margin: 4px auto 6px; display: block; }
.pd-trk { fill: none; stroke: var(--pd-lgrey); stroke-width: 16; opacity: .55; }
.pd-arc { fill: none; stroke-width: 16; stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.3,.8,.2,1); }
.pd-dots { fill: none; stroke: var(--pd-grey); stroke-width: 1.5; stroke-dasharray: 1 6; stroke-linecap: round; opacity: .5; }
.pd-rv { fill: var(--pd-text); font-size: 38px; font-weight: 750; letter-spacing: -.02em; }
.pd-rl { fill: var(--pd-muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.pd-legend { display: grid; gap: 7px; margin-top: auto; padding-top: 8px; }
.pd-legend div { display: flex; justify-content: space-between; align-items: center; font-size: 13px; padding: 7px 10px; background: var(--pd-panel2); border-radius: 9px; }
.pd-legend i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.pd-legend b { font-variant-numeric: tabular-nums; }

.pd-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.pd-stat { background: var(--pd-panel); border: 1px solid var(--pd-bd); border-radius: 14px; padding: 16px; box-shadow: var(--pd-shadow); }
.pd-big { font-size: 34px; font-weight: 800; letter-spacing: -.02em; background: linear-gradient(135deg, var(--pd-orange), var(--pd-brand)); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.pd-stat p { margin: 2px 0 0; color: var(--pd-muted); font-size: 12.5px; }
.pd-secttl { margin: 22px 0 10px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--pd-muted); font-weight: 700; }
.pd-bigstat { text-align: center; padding: 10px 0 18px; }
.pd-bigstat .pd-v { font-size: 64px; font-weight: 800; letter-spacing: -.03em; background: linear-gradient(135deg, var(--pd-orange), var(--pd-brand)); -webkit-background-clip: text; background-clip: text; color: transparent; font-variant-numeric: tabular-nums; }
.pd-bigstat p { color: var(--pd-muted); margin: 0 auto; max-width: 34ch; font-size: 13px; }

.pd-scroll { overflow-x: auto; }
.pd-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.pd-table th, .pd-table td { padding: 7px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--pd-grid); color: var(--pd-text); background: transparent; }
.pd-table th:first-child, .pd-table td:first-child { text-align: left; position: sticky; left: 0; background: var(--pd-panel); z-index: 1; padding-left: 4px; }
.pd-table thead th { color: var(--pd-muted); font-weight: 600; cursor: pointer; }
.pd-table thead th:hover { color: var(--pd-text); }
.pd-table td.sel, .pd-table th.sel { box-shadow: inset 2px 0 0 var(--pd-brand), inset -2px 0 0 var(--pd-brand); }
.pd-table tr.pd-sec td { text-transform: uppercase; letter-spacing: .1em; font-size: 10.5px; font-weight: 700; color: var(--pd-brand); padding-top: 16px; background: var(--pd-panel); }
.pd-hint { color: var(--pd-muted); font-size: 12px; margin: 0 0 10px; }
.pd-foot { margin-top: 22px; color: var(--pd-muted); font-size: 12px; }

/* the order list keeps the Portal's own look, sat on the same page background */
.pd-orders { background: var(--pd-panel); border: 1px solid var(--pd-bd); border-radius: 16px; padding: 18px; box-shadow: var(--pd-shadow); color: var(--pd-text); }
.pd-orders .table { color: var(--pd-text); }
