/* ════════════════════════════════════════════════════════════════════
   Partner dashboard v2 (v3.7 S9) — Features/Home/Components/PartnerDashboardV2.razor

   The Service Portal's v3.5 design language on Ambolt Web's tokens:
   sentence case, one calm page title, 16px panels with a hairline border,
   Inter for body and Plus Jakarta Sans for headings (with the word-spacing
   fix), tabular figures, soft status chips, one column on a phone.

   Colours come only from css/ev/tokens.css (--ev-*), so per-brand
   colours and html[data-theme="dark"] work without extra rules.
   ════════════════════════════════════════════════════════════════════ */

.pd {
    --pd-radius: 16px;
    --pd-gap: 16px;
    --pd-body: "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --pd-display: "Plus Jakarta Sans", "Inter", "Segoe UI", sans-serif;
    font-family: var(--pd-body);
    color: var(--ev-text);
    font-size: 0.875rem;
    line-height: 1.45;
    max-width: 1280px;
}

.pd a { color: inherit; text-decoration: none; }
.pd h1, .pd h2 { font-family: var(--pd-display); word-spacing: 0.09em; text-wrap: balance; margin: 0; }
.pd p { margin: 0; }

.pd-micro { font-size: 0.8125rem; font-weight: 500; color: var(--ev-text-muted); }
.pd-muted { color: var(--ev-text-muted); }

/* ── Header ─────────────────────────────────────────────────────────── */
.pd-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin: 4px 0 20px;
}
.pd-head-text { min-width: 0; }
.pd-eyebrow { font-size: 0.8125rem; font-weight: 500; color: var(--ev-text-muted); display: flex; gap: 6px; flex-wrap: wrap; }
.pd-eyebrow a { color: var(--ev-primary); font-weight: 600; }
.pd-eyebrow a:hover { text-decoration: underline; text-underline-offset: 3px; }
.pd-title { font-size: 1.75rem; line-height: 2.25rem; font-weight: 700; letter-spacing: -0.015em; margin-top: 2px; }
.pd-sub { margin-top: 4px; color: var(--ev-text-muted); display: flex; gap: 6px; flex-wrap: wrap; }
.pd-stale { color: var(--ev-warn); }
.pd-head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Buttons: the portal's secondary button. "All tools" (HeroQuickTools) reuses .dash-refresh-btn,
   so it is restyled here to match while it sits in the v2 header. */
.pd-btn,
.pd-head-actions .dash-refresh-btn {
    display: inline-flex; align-items: center; gap: 6px;
    height: 36px; padding: 0 14px; border-radius: 8px;
    border: 1px solid var(--ev-border); background: var(--ev-surface); color: var(--ev-text);
    font: 500 0.875rem var(--pd-body); cursor: pointer; box-shadow: none;
    transition: background-color .15s, border-color .15s;
}
.pd-btn:hover:not(:disabled),
.pd-head-actions .dash-refresh-btn:hover { border-color: var(--ev-border-strong); background: var(--ev-bg); }
.pd-btn:disabled { opacity: .55; cursor: default; }
.pd-btn .material-icons,
.pd-head-actions .dash-refresh-btn .material-icons { font-size: 18px; }
.pd-spin { animation: pd-spin 1s linear infinite; }
@keyframes pd-spin { to { transform: rotate(360deg); } }

/* ── Partner picker ─────────────────────────────────────────────────── */
.pd-picker { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -6px 0 18px; }
.pd-select {
    height: 34px; min-width: 220px; max-width: 100%; padding: 0 10px; border-radius: 8px;
    border: 1px solid var(--ev-border); background: var(--ev-surface); color: var(--ev-text); font: inherit;
}
.pd-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.pd-chip-btn {
    height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--ev-border);
    background: var(--ev-surface); color: var(--ev-text-muted); font: 500 0.8125rem var(--pd-body); cursor: pointer;
}
.pd-chip-btn:hover { color: var(--ev-text); border-color: var(--ev-border-strong); }
.pd-chip-btn.is-active { background: var(--ev-primary-soft); border-color: var(--ev-primary-ring); color: var(--ev-primary); }

/* ── Tiles ──────────────────────────────────────────────────────────── */
.pd-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--pd-gap); margin-bottom: var(--pd-gap); }
.pd-tile {
    display: flex; flex-direction: column; gap: 2px; min-width: 0;
    padding: 16px 18px; border-radius: var(--pd-radius);
    background: var(--ev-surface); border: 1px solid var(--ev-border);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
    transition: border-color .15s, transform .15s;
}
a.pd-tile:hover { border-color: var(--ev-border-strong); transform: translateY(-1px); }
.pd-tile-value {
    font-family: var(--pd-display); font-size: 1.75rem; line-height: 2.1rem; font-weight: 700;
    letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 4px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pd-tile-sub { color: var(--ev-text-muted); font-size: 0.8125rem; }
.pd-tile--warning .pd-tile-value { color: var(--ev-warn); }
.pd-tile--danger .pd-tile-value { color: var(--ev-danger); }
.pd-tile--skeleton { height: 108px; background: var(--ev-bg); }
@media (prefers-reduced-motion: reduce) { a.pd-tile:hover { transform: none; } .pd-spin { animation: none; } }

/* ── Panels ─────────────────────────────────────────────────────────── */
.pd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--pd-gap); margin-bottom: var(--pd-gap); align-items: start; }
.pd-grid--lead { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }

.pd-panel {
    background: var(--ev-surface); border: 1px solid var(--ev-border); border-radius: var(--pd-radius);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); padding: 18px 20px; min-width: 0;
    scroll-margin-top: 80px;
}
.pd-panel-head { display: flex; align-items: center; gap: 8px; }
.pd-panel-title { font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.005em; }
.pd-panel-note { margin-top: 2px; color: var(--ev-text-muted); font-size: 0.8125rem; }
.pd-count {
    min-width: 22px; height: 20px; padding: 0 7px; border-radius: 999px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--ev-bg); color: var(--ev-text-muted); border: 1px solid var(--ev-border);
    font-size: 0.75rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.pd-panel-foot {
    display: flex; gap: 16px; flex-wrap: wrap; align-items: center;
    margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--ev-border);
    font-size: 0.8125rem;
}
.pd-panel-foot a { color: var(--ev-primary); font-weight: 500; }
.pd-panel-foot a:hover { text-decoration: underline; text-underline-offset: 3px; }
.pd-panel-foot .pd-muted { margin-right: auto; }

.pd-empty { display: flex; align-items: center; gap: 10px; padding: 22px 4px 8px; color: var(--ev-text-muted); }
.pd-empty .material-icons { color: var(--ev-success); font-size: 22px; }

/* Rows */
.pd-list { list-style: none; margin: 10px 0 0; padding: 0; }
.pd-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--ev-border); }
.pd-list .pd-row:first-child { border-top: 0; }
.pd-row-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1 1 auto; }
.pd-row-main:hover .pd-row-title { color: var(--ev-primary); }
.pd-row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-row-sub { color: var(--ev-text-muted); font-size: 0.8125rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-row-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.pd-row-go { color: var(--ev-text-soft); font-size: 20px; flex: none; }

/* Chips — soft fill + strong text, sentence case */
.pd-chip {
    display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px;
    font-size: 0.75rem; font-weight: 600; white-space: nowrap; flex: none;
    background: var(--ev-bg); color: var(--ev-text-muted); box-shadow: inset 0 0 0 1px var(--ev-border);
}
.pd-chip--danger { background: var(--ev-danger-soft); color: var(--ev-danger); box-shadow: none; }
.pd-chip--warning { background: var(--ev-warn-soft); color: var(--ev-warn); box-shadow: none; }
.pd-chip--info { background: var(--ev-primary-soft); color: var(--ev-primary); box-shadow: none; }

/* Commission */
.pd-money { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 14px 0 12px; }
.pd-money dd { margin: 0; }
.pd-money-value { font-family: var(--pd-display); font-size: 1.5rem; font-weight: 700; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; margin-top: 2px !important; }

/* Team */
.pd-people { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pd-person { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 4px 12px; align-items: center; padding: 12px; border: 1px solid var(--ev-border); border-radius: 12px; }
.pd-person-text { display: flex; flex-direction: column; min-width: 0; }
.pd-person-links { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 2px; font-size: 0.8125rem; min-width: 0; }
.pd-person-links a { color: var(--ev-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-person-links a:hover { text-decoration: underline; text-underline-offset: 3px; }
.pd-avatar {
    width: 36px; height: 36px; border-radius: 999px; object-fit: cover;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--ev-primary-soft); color: var(--ev-primary); font-weight: 700; font-size: 0.8125rem;
}
.pd-avatar--brand .material-icons { font-size: 20px; }

/* The Digital Switching strip sits between the tiles and the panels. */
.pd .ds-strip { margin: 0 0 var(--pd-gap); border-radius: var(--pd-radius); }

/* Reused Ev cards (Pipeline, Recently won, Recently visited) take the panel look inside v2. */
.pd .ev-card { border-radius: var(--pd-radius); box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); }
.pd .ev-card:hover { box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05); }
.pd .ev-card-icon { display: none; }
.pd .ev-card-head { padding-left: 20px; padding-right: 20px; }
.pd .ev-card-body { padding-left: 20px; padding-right: 20px; }
.pd .ev-card-title { font-family: var(--pd-display); font-size: 0.9375rem; font-weight: 600; word-spacing: 0.09em; }
.pd .ev-pipe-fill { background: var(--ev-primary); }
.pd .ev-empty { flex-direction: row; justify-content: flex-start; padding: 18px 0 8px; }

html[data-theme="dark"] .pd-tile,
html[data-theme="dark"] .pd-panel,
html[data-theme="dark"] .pd .ev-card { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }

/* ── Tablet and phone ───────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .pd-grid--lead { grid-template-columns: minmax(0, 1fr); }
    .pd-people { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .pd-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pd-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
    .pd { --pd-gap: 12px; }
    .pd-head { align-items: flex-start; margin-bottom: 16px; }
    .pd-title { font-size: 1.5rem; line-height: 2rem; }
    .pd-head-actions { width: 100%; }
    .pd-head-actions > * { flex: 1 1 0; }
    .pd-btn, .pd-head-actions .dash-refresh-btn { width: 100%; justify-content: center; }
    .pd-tile { padding: 14px; }
    .pd-tile-value { font-size: 1.5rem; line-height: 1.9rem; }
    .pd-panel { padding: 16px; }
    .pd .ev-card-head, .pd .ev-card-body { padding-left: 16px; padding-right: 16px; }
    .pd-people { grid-template-columns: minmax(0, 1fr); }
    .pd-select { width: 100%; }
}
