:root {
    --pd-accent: #d4af37;
    --pd-bg: #090a0c;
    --pd-surface: #14161a;
    --pd-surface-strong: #1b1e23;
    --pd-surface-soft: #101216;
    --pd-border: #2a2d33;
    --pd-text: #f5f6f7;
    --pd-muted: #92979f;
    --pd-faint: #5d626b;
    --pd-green: #42d27d;
    --pd-red: #ff6577;
    --pd-amber: #ffb84d;
}

[data-theme="light"] {
    --bg-primary: #f2f3f5;
    --bg-card: #ffffff;
    --bg-card-hover: #f7f8f9;
    --text-primary: #16181c;
    --text-secondary: #666b73;
    --text-muted: #8b9098;
    --border-color: #dfe2e6;
    --pd-bg: #f2f3f5;
    --pd-surface: #ffffff;
    --pd-surface-strong: #f6f7f8;
    --pd-surface-soft: #eceef1;
    --pd-border: #d9dde2;
    --pd-text: #17191d;
    --pd-muted: #686d75;
    --pd-faint: #92979f;
    --pd-green: #168c4b;
    --pd-red: #d83b52;
    --pd-amber: #b96e00;
}

body {
    background: var(--pd-bg);
    color: var(--pd-text);
}

[hidden] {
    display: none !important;
}

#profile-page {
    width: min(100%, 860px);
    max-width: none;
    padding: 0 18px 72px;
}

.profile-nav {
    display: flex;
    min-height: 64px;
    padding: 10px 0;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid color-mix(in srgb, var(--pd-border) 72%, transparent);
    background: color-mix(in srgb, var(--pd-bg) 92%, transparent);
    backdrop-filter: blur(18px);
}

.profile-theme-toggle,
.pd-icon-btn {
    display: inline-grid;
    width: 40px;
    height: 40px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--pd-border);
    border-radius: 8px;
    background: var(--pd-surface);
    color: var(--pd-text);
    cursor: pointer;
    font: inherit;
}

.profile-theme-toggle span {
    font-size: 20px;
    line-height: 1;
}

[data-theme="dark"] .profile-theme-light,
[data-theme="light"] .profile-theme-dark {
    display: none;
}

.profile-header {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr) auto;
    min-height: 136px;
    margin: 18px 0 26px;
    padding: 20px;
    align-items: center;
    gap: 2px 18px;
    border: 1px solid var(--pd-border);
    border-left: 4px solid var(--pd-accent);
    border-radius: 8px;
    background: var(--pd-surface);
    text-align: left;
}

.profile-photo-container {
    grid-column: 1;
    grid-row: 1 / 5;
    margin: 0;
}

.profile-photo-wrapper {
    width: 78px;
    height: 78px;
    border: 2px solid var(--pd-accent);
    background: var(--pd-surface-strong);
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--pd-accent) 12%, transparent);
}

.photo-placeholder {
    background: var(--pd-surface-strong);
    color: var(--pd-accent);
    font-size: 30px;
}

#profile-name,
.profile-title,
.profile-bio,
.btn-edit {
    grid-column: 2;
}

#profile-name {
    align-self: end;
    overflow-wrap: anywhere;
    color: var(--pd-text);
    font-size: 28px;
    letter-spacing: 0;
    line-height: 1.05;
}

.profile-title {
    min-height: 0;
    color: var(--pd-accent);
    font-size: 11px;
    letter-spacing: 0;
}

.profile-bio {
    min-height: 0;
    margin-top: 3px;
    color: var(--pd-muted);
    font-size: 12px;
    line-height: 1.35;
}

.btn-edit {
    grid-column: 3;
    grid-row: 1 / 5;
    width: 40px;
    height: 40px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--pd-border);
    border-radius: 8px;
    color: transparent;
    font-size: 0;
}

.btn-edit::before {
    color: var(--pd-text);
    content: "✎";
    font-size: 20px;
}

.btn-edit:hover {
    border-color: var(--pd-accent);
    color: transparent;
}

.pd-dashboard {
    display: block;
}

.pd-state {
    display: flex;
    min-height: 240px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    color: var(--pd-muted);
}

.pd-state-error button,
.pd-rotate-hint button {
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--pd-border);
    border-radius: 6px;
    background: var(--pd-surface-strong);
    color: var(--pd-text);
    font-weight: 750;
}

.pd-loader {
    width: 34px;
    height: 34px;
    border: 3px solid var(--pd-border);
    border-top-color: var(--pd-accent);
    border-radius: 50%;
    animation: pd-spin 0.8s linear infinite;
}

@keyframes pd-spin {
    to { transform: rotate(360deg); }
}

.pd-today-band,
.pd-performance-band,
.pd-repeat-band,
.pd-best-band {
    position: relative;
    margin-bottom: 16px;
    padding: 20px;
    overflow: hidden;
    border: 1px solid var(--pd-border);
    border-radius: 8px;
    background: var(--pd-surface);
}

.pd-today-band {
    border-top: 4px solid var(--pd-accent);
}

.pd-today-band::after {
    position: absolute;
    top: 0;
    right: 0;
    width: 28%;
    height: 1px;
    background: var(--pd-green);
    content: "";
}

.pd-section-heading,
.pd-performance-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.pd-section-heading h2,
.pd-performance-header h2 {
    margin-top: 3px;
    color: var(--pd-text);
    font-size: 21px;
    line-height: 1.1;
    letter-spacing: 0;
}

.pd-eyebrow {
    color: var(--pd-accent);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 0;
}

#pd-today-date {
    color: var(--pd-muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
}

.pd-today-layout {
    display: grid;
    grid-template-columns: minmax(180px, 0.82fr) minmax(0, 1.7fr);
    gap: 18px;
    margin-top: 20px;
}

.pd-score {
    display: flex;
    min-height: 136px;
    padding: 16px;
    justify-content: center;
    flex-direction: column;
    border-left: 2px solid var(--pd-accent);
    background: var(--pd-surface-soft);
}

.pd-score strong {
    color: var(--pd-text);
    font-size: 64px;
    font-variant-numeric: tabular-nums;
    line-height: 0.9;
}

.pd-score > span {
    margin-top: 10px;
    color: var(--pd-accent);
    font-size: 9px;
    font-weight: 850;
    letter-spacing: 0;
}

.pd-score small {
    margin-top: 7px;
    color: var(--pd-muted);
    font-size: 10px;
}

.pd-comparisons {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.pd-comparison {
    display: flex;
    min-width: 0;
    min-height: 136px;
    padding: 13px 11px;
    justify-content: center;
    flex-direction: column;
    border: 1px solid var(--pd-border);
    border-radius: 6px;
    background: var(--pd-surface-strong);
}

.pd-comparison > span {
    min-height: 24px;
    color: var(--pd-muted);
    font-size: 8px;
    font-weight: 850;
    letter-spacing: 0;
    line-height: 1.25;
}

.pd-comparison strong {
    display: flex;
    margin: 8px 0 5px;
    align-items: center;
    gap: 4px;
    color: var(--pd-text);
    font-size: 24px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.pd-comparison strong i {
    font-size: 15px;
    font-style: normal;
}

.pd-comparison small {
    color: var(--pd-faint);
    font-size: 8px;
}

.pd-comparison.pd-up strong,
.pd-period-change.pd-up strong {
    color: var(--pd-green);
}

.pd-comparison.pd-down strong,
.pd-period-change.pd-down strong {
    color: var(--pd-red);
}

.pd-comparison.pd-new strong,
.pd-period-change.pd-new strong {
    color: var(--pd-amber);
    font-size: 15px;
}

.pd-kpi-strip,
.pd-period-summary,
.pd-week-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 14px;
    border: 1px solid var(--pd-border);
    border-radius: 6px;
    background: var(--pd-surface-soft);
}

.pd-kpi {
    display: flex;
    min-width: 0;
    min-height: 68px;
    padding: 12px 8px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border-right: 1px solid var(--pd-border);
}

.pd-kpi:last-child {
    border-right: 0;
}

.pd-kpi strong {
    color: var(--pd-text);
    font-size: 22px;
    font-variant-numeric: tabular-nums;
}

.pd-kpi span {
    margin-top: 3px;
    overflow-wrap: anywhere;
    color: var(--pd-muted);
    font-size: 8px;
    font-weight: 750;
    line-height: 1.15;
    text-align: center;
    text-transform: uppercase;
}

.pd-performance-header {
    align-items: center;
}

.pd-period-change {
    display: flex;
    min-width: 104px;
    align-items: flex-end;
    flex-direction: column;
}

.pd-period-change strong {
    color: var(--pd-text);
    font-size: 22px;
    line-height: 1;
}

.pd-period-change span {
    margin-top: 4px;
    color: var(--pd-muted);
    font-size: 8px;
    text-align: right;
    text-transform: uppercase;
}

.pd-period-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    height: 42px;
    margin-top: 18px;
    padding: 3px;
    border-radius: 7px;
    background: var(--pd-surface-soft);
}

.pd-period-tabs button {
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--pd-muted);
    font: inherit;
    font-size: 11px;
    font-weight: 850;
    cursor: pointer;
}

.pd-period-tabs button.active {
    background: var(--pd-surface-strong);
    color: var(--pd-accent);
    box-shadow: inset 0 0 0 1px var(--pd-border);
}

.pd-period-summary {
    margin-top: 12px;
}

.pd-chart {
    display: grid;
    grid-template-columns: repeat(var(--pd-columns, 7), minmax(24px, 1fr));
    height: 218px;
    margin-top: 18px;
    padding: 10px 4px 0;
    align-items: stretch;
    gap: 5px;
    border-bottom: 1px solid var(--pd-border);
    background-image: linear-gradient(to bottom, transparent 49%, color-mix(in srgb, var(--pd-border) 65%, transparent) 50%, transparent 51%);
}

.pd-chart-column {
    display: grid;
    grid-template-rows: 18px minmax(0, 1fr) 28px;
    min-width: 0;
    text-align: center;
}

.pd-chart-value {
    color: var(--pd-muted);
    font-size: 9px;
    font-variant-numeric: tabular-nums;
}

.pd-bars {
    position: relative;
    display: flex;
    min-width: 0;
    align-items: flex-end;
    justify-content: center;
}

.pd-bars i {
    position: absolute;
    bottom: 0;
    min-height: 0;
    border-radius: 3px 3px 0 0;
}

.pd-bar-taken {
    width: min(78%, 34px);
    border: 1px solid color-mix(in srgb, var(--pd-muted) 48%, transparent);
    background: color-mix(in srgb, var(--pd-muted) 15%, transparent);
}

.pd-bar-produced {
    width: min(46%, 20px);
    background: var(--pd-accent);
}

.pd-chart-column > span {
    display: flex;
    min-width: 0;
    padding-top: 7px;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
    color: var(--pd-muted);
    font-size: 8px;
    line-height: 1.1;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pd-chart-legend {
    display: flex;
    margin-top: 10px;
    justify-content: flex-end;
    gap: 14px;
    color: var(--pd-muted);
    font-size: 9px;
}

.pd-chart-legend span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pd-chart-legend i {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 2px;
}

.pd-legend-produced {
    background: var(--pd-accent);
}

.pd-legend-taken {
    border: 1px solid var(--pd-muted);
}

.pd-week-open {
    min-height: 38px;
    padding: 0 12px;
    border: 1px solid var(--pd-accent);
    border-radius: 6px;
    background: color-mix(in srgb, var(--pd-accent) 10%, transparent);
    color: var(--pd-accent);
    font: inherit;
    font-size: 10px;
    font-weight: 850;
    cursor: pointer;
}

.pd-week-open span {
    margin-left: 4px;
    font-size: 15px;
}

.pd-repeated-items {
    margin-top: 14px;
}

.pd-repeat-row {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 62px;
    min-height: 70px;
    align-items: center;
    gap: 10px;
    border-top: 1px solid var(--pd-border);
}

.pd-repeat-rank {
    color: var(--pd-faint);
    font-size: 10px;
    font-weight: 800;
}

.pd-repeat-name {
    position: relative;
    display: flex;
    min-width: 0;
    padding: 12px 0 16px;
    flex-direction: column;
}

.pd-repeat-name strong {
    overflow: hidden;
    color: var(--pd-text);
    font-size: 13px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pd-repeat-name span {
    margin-top: 4px;
    color: var(--pd-muted);
    font-size: 9px;
}

.pd-repeat-name i {
    position: absolute;
    bottom: 8px;
    left: 0;
    height: 2px;
    max-width: 100%;
    border-radius: 1px;
    background: var(--pd-accent);
}

.pd-repeat-total {
    display: flex;
    align-items: flex-end;
    flex-direction: column;
}

.pd-repeat-total strong {
    color: var(--pd-text);
    font-size: 20px;
    font-variant-numeric: tabular-nums;
}

.pd-repeat-total span {
    color: var(--pd-muted);
    font-size: 7px;
    letter-spacing: 0;
}

.pd-empty,
.pd-week-empty {
    display: flex;
    min-height: 92px;
    align-items: center;
    justify-content: center;
    color: var(--pd-muted);
    font-size: 12px;
    text-align: center;
}

.pd-chart .pd-empty {
    grid-column: 1 / -1;
    align-self: center;
}

.pd-best-band {
    display: flex;
    min-height: 108px;
    align-items: center;
    justify-content: space-between;
    border-left: 4px solid var(--pd-amber);
}

.pd-best-band > div:first-child {
    display: flex;
    flex-direction: column;
}

.pd-best-band strong {
    margin-top: 5px;
    color: var(--pd-text);
    font-size: 25px;
}

.pd-best-band small {
    margin-top: 3px;
    color: var(--pd-muted);
    font-size: 10px;
    text-transform: capitalize;
}

.pd-record-mark {
    display: grid;
    width: 58px;
    height: 58px;
    place-items: center;
    border: 1px solid var(--pd-amber);
    border-radius: 50%;
    color: var(--pd-amber);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0;
}

.pd-week-view {
    position: fixed;
    z-index: 1000;
    inset: 0;
    overflow: auto;
    padding: 14px;
    background: var(--pd-bg);
    color: var(--pd-text);
}

body.pd-week-opened {
    overflow: hidden;
}

.pd-week-header {
    display: grid;
    grid-template-columns: 42px 42px minmax(160px, 1fr) 42px;
    max-width: 1180px;
    margin: 0 auto;
    align-items: center;
    gap: 7px;
}

.pd-icon-btn {
    width: 42px;
    height: 42px;
    font-size: 25px;
    line-height: 1;
}

.pd-icon-btn:disabled {
    opacity: 0.3;
}

.pd-week-title {
    min-width: 0;
    padding: 0 8px;
    text-align: center;
}

.pd-week-title span {
    display: block;
    color: var(--pd-accent);
    font-size: 8px;
    font-weight: 900;
    letter-spacing: 0;
}

.pd-week-title strong {
    display: block;
    margin-top: 2px;
    overflow: hidden;
    color: var(--pd-text);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pd-week-stats {
    max-width: 760px;
    margin: 12px auto 14px;
}

.pd-week-stats .pd-kpi {
    min-height: 54px;
}

.pd-week-stats .pd-kpi strong {
    font-size: 18px;
}

.pd-week-matrix {
    display: grid;
    grid-template-columns: minmax(150px, 1.8fr) repeat(7, minmax(58px, 1fr)) minmax(64px, 0.8fr);
    min-width: 760px;
    max-width: 1180px;
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid var(--pd-border);
    border-radius: 8px;
    background: var(--pd-surface);
}

.pd-matrix-head,
.pd-matrix-label,
.pd-matrix-cell,
.pd-matrix-total {
    min-width: 0;
    min-height: 62px;
    padding: 8px;
    border-right: 1px solid var(--pd-border);
    border-bottom: 1px solid var(--pd-border);
}

.pd-matrix-head {
    display: flex;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background: var(--pd-surface-soft);
    color: var(--pd-muted);
    font-size: 8px;
    text-align: center;
}

.pd-matrix-head strong {
    color: var(--pd-text);
    font-size: 9px;
}

.pd-matrix-head span {
    margin-top: 2px;
}

.pd-matrix-item-head {
    align-items: flex-start;
    padding-left: 14px;
    color: var(--pd-accent);
    font-weight: 900;
    letter-spacing: 0;
}

.pd-matrix-label {
    display: flex;
    padding-left: 14px;
    justify-content: center;
    flex-direction: column;
}

.pd-matrix-label strong {
    overflow: hidden;
    color: var(--pd-text);
    font-size: 11px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pd-matrix-label span {
    margin-top: 4px;
    color: var(--pd-accent);
    font-size: 9px;
    font-weight: 850;
}

.pd-matrix-cell,
.pd-matrix-total {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.pd-matrix-filled {
    background: color-mix(in srgb, var(--pd-accent) 12%, var(--pd-surface));
}

.pd-matrix-filled strong,
.pd-matrix-total strong {
    color: var(--pd-text);
    font-size: 16px;
    font-variant-numeric: tabular-nums;
}

.pd-matrix-filled span,
.pd-matrix-total span {
    margin-top: 3px;
    color: var(--pd-muted);
    font-size: 7px;
    text-transform: uppercase;
}

.pd-matrix-empty {
    color: var(--pd-faint);
}

.pd-matrix-total {
    border-right: 0;
    background: var(--pd-surface-strong);
}

.pd-week-empty {
    grid-column: 1 / -1;
}

.pd-rotate-hint {
    display: none;
}

.pd-phone-rotate {
    position: relative;
    width: 52px;
    height: 78px;
    border: 3px solid var(--pd-accent);
    border-radius: 9px;
    animation: pd-rotate 1.8s ease-in-out infinite;
}

.pd-phone-rotate span {
    position: absolute;
    bottom: 5px;
    left: 50%;
    width: 7px;
    height: 7px;
    border: 1px solid var(--pd-accent);
    border-radius: 50%;
    transform: translateX(-50%);
}

@keyframes pd-rotate {
    0%, 25% { transform: rotate(0); }
    70%, 100% { transform: rotate(90deg); }
}

.pd-domain-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: 48px;
    margin-bottom: 8px;
    padding: 4px;
    gap: 3px;
    border: 1px solid var(--pd-border);
    border-radius: 8px;
    background: var(--pd-surface);
}

.pd-domain-tabs button {
    min-width: 0;
    padding: 0 7px;
    overflow: hidden;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--pd-muted);
    font: inherit;
    font-size: 10px;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.pd-domain-tabs button.active {
    background: var(--pd-accent);
    color: #101114;
    box-shadow: 0 2px 10px color-mix(in srgb, var(--pd-accent) 25%, transparent);
}

.pd-global-toolbar {
    display: flex;
    min-height: 52px;
    margin-bottom: 12px;
    padding: 6px 7px 6px 14px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid var(--pd-border);
}

#pd-range-label {
    overflow: hidden;
    color: var(--pd-muted);
    font-size: 11px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pd-global-toolbar .pd-period-tabs {
    width: 204px;
    height: 38px;
    margin: 0;
}

.pd-domain-panel {
    animation: pd-panel-in 180ms ease-out;
}

@keyframes pd-panel-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.pd-domain-hero,
.pd-domain-chart-band,
.pd-domain-feature,
.pd-domain-recent-band {
    margin-bottom: 12px;
    padding: 20px;
    border: 1px solid var(--pd-border);
    border-radius: 8px;
    background: var(--pd-surface);
}

.pd-domain-hero {
    border-top: 4px solid var(--pd-accent);
}

.pd-domain-hero > header,
.pd-domain-section-title {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.pd-domain-hero h2 {
    margin: 4px 0 6px;
    color: var(--pd-text);
    font-size: 26px;
    letter-spacing: 0;
    line-height: 1.05;
}

.pd-domain-hero p {
    max-width: 560px;
    margin: 0;
    color: var(--pd-muted);
    font-size: 12px;
    line-height: 1.45;
}

.pd-domain-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 20px;
    gap: 8px;
}

.pd-domain-kpi {
    display: flex;
    min-width: 0;
    min-height: 105px;
    padding: 14px;
    justify-content: flex-end;
    flex-direction: column;
    border: 1px solid var(--pd-border);
    border-top: 3px solid var(--pd-faint);
    border-radius: 6px;
    background: var(--pd-surface-strong);
}

.pd-domain-kpi strong {
    overflow-wrap: anywhere;
    color: var(--pd-text);
    font-size: 30px;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.pd-domain-kpi span {
    margin-top: 8px;
    color: var(--pd-muted);
    font-size: 9px;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
}

.pd-domain-kpi small {
    margin-top: 5px;
    color: var(--pd-faint);
    font-size: 9px;
}

.pd-domain-kpi.pd-tone-green { border-top-color: var(--pd-green); }
.pd-domain-kpi.pd-tone-green strong { color: var(--pd-green); }
.pd-domain-kpi.pd-tone-red { border-top-color: var(--pd-red); }
.pd-domain-kpi.pd-tone-red strong { color: var(--pd-red); }
.pd-domain-kpi.pd-tone-orange { border-top-color: var(--pd-amber); }
.pd-domain-kpi.pd-tone-orange strong { color: var(--pd-amber); }
.pd-domain-kpi.pd-tone-blue { border-top-color: #54a9ff; }
.pd-domain-kpi.pd-tone-blue strong { color: #54a9ff; }

.pd-domain-section-title {
    align-items: center;
}

.pd-domain-section-title h3 {
    margin-top: 3px;
    color: var(--pd-text);
    font-size: 18px;
    letter-spacing: 0;
    line-height: 1.15;
}

.pd-domain-section-title > strong {
    color: var(--pd-accent);
    font-size: 24px;
    font-variant-numeric: tabular-nums;
}

.pd-domain-section-title > small {
    color: var(--pd-muted);
    font-size: 9px;
}

.pd-domain-chart {
    display: grid;
    grid-template-columns: repeat(var(--pd-columns, 7), minmax(24px, 1fr));
    height: 206px;
    margin-top: 18px;
    padding: 8px 4px 0;
    gap: 5px;
    border-bottom: 1px solid var(--pd-border);
    background-image: linear-gradient(to bottom, transparent 49%, color-mix(in srgb, var(--pd-border) 65%, transparent) 50%, transparent 51%);
}

.pd-domain-chart-column {
    display: grid;
    grid-template-rows: 18px minmax(0, 1fr) 28px;
    min-width: 0;
    text-align: center;
}

.pd-domain-chart-column > strong {
    color: var(--pd-muted);
    font-size: 9px;
    font-variant-numeric: tabular-nums;
}

.pd-domain-chart-column > span {
    align-self: center;
    overflow: hidden;
    color: var(--pd-faint);
    font-size: 8px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pd-domain-bars {
    position: relative;
    display: flex;
    min-width: 0;
    align-items: flex-end;
    justify-content: center;
}

.pd-domain-bars i {
    position: absolute;
    bottom: 0;
    display: block;
    transition: height 220ms ease;
}

.pd-domain-bar-primary {
    width: 44%;
    max-width: 30px;
    border-radius: 3px 3px 0 0;
    background: var(--pd-accent);
}

.pd-domain-bar-secondary {
    width: 66%;
    max-width: 42px;
    opacity: 0.32;
    border-radius: 3px 3px 0 0;
    background: #54a9ff;
}

.pd-ranking-list {
    display: grid;
    margin-top: 18px;
    gap: 5px;
}

.pd-ranking-row {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) 34px;
    min-height: 48px;
    padding: 8px 10px;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid color-mix(in srgb, var(--pd-border) 75%, transparent);
}

.pd-ranking-row > span {
    color: var(--pd-faint);
    font-size: 10px;
    font-weight: 850;
}

.pd-ranking-row > div {
    min-width: 0;
}

.pd-ranking-row strong {
    display: block;
    overflow: hidden;
    color: var(--pd-text);
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pd-ranking-row i {
    display: block;
    height: 3px;
    margin-top: 7px;
    border-radius: 2px;
    background: var(--pd-accent);
}

.pd-ranking-row > b {
    color: var(--pd-accent);
    font-size: 16px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.pd-outcome-track {
    display: flex;
    height: 14px;
    margin-top: 20px;
    overflow: hidden;
    border-radius: 4px;
    background: var(--pd-surface-soft);
}

.pd-outcome-track i {
    display: block;
    min-width: 0;
}

.pd-outcome-good { background: var(--pd-green); }
.pd-outcome-warn { background: var(--pd-amber); }
.pd-outcome-bad { background: var(--pd-red); }

.pd-outcome-legend {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 14px;
    gap: 8px;
}

.pd-outcome-legend span {
    display: flex;
    min-height: 44px;
    padding: 8px;
    align-items: center;
    gap: 6px;
    color: var(--pd-muted);
    font-size: 9px;
    border: 1px solid var(--pd-border);
    border-radius: 5px;
}

.pd-outcome-legend strong {
    color: var(--pd-text);
    font-size: 15px;
}

.pd-outcome-legend i {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
}

.pd-dot-good { background: var(--pd-green); }
.pd-dot-warn { background: var(--pd-amber); }
.pd-dot-bad { background: var(--pd-red); }
.pd-dot-neutral { background: #54a9ff; }

.pd-hygiene-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-top: 18px;
    gap: 8px;
}

.pd-hygiene-grid .pd-domain-kpi {
    min-height: 92px;
}

.pd-cleaning-ledger {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 10px;
    padding: 14px;
    gap: 8px;
    border-left: 3px solid var(--pd-accent);
    background: var(--pd-surface-strong);
}

.pd-cleaning-ledger > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.pd-cleaning-ledger span {
    color: var(--pd-muted);
    font-size: 9px;
    font-weight: 800;
}

.pd-cleaning-ledger strong {
    color: var(--pd-text);
    font-size: 22px;
}

.pd-cleaning-ledger small {
    grid-column: 1 / -1;
    color: var(--pd-faint);
    font-size: 9px;
}

.pd-domain-recent {
    display: grid;
    margin-top: 14px;
}

.pd-domain-recent-row {
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    min-height: 54px;
    padding: 9px 0;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid color-mix(in srgb, var(--pd-border) 75%, transparent);
}

.pd-domain-recent-row:last-child {
    border-bottom: 0;
}

.pd-domain-recent-row time {
    color: var(--pd-accent);
    font-size: 10px;
    font-weight: 800;
}

.pd-domain-recent-row > div {
    min-width: 0;
}

.pd-domain-recent-row strong,
.pd-domain-recent-row span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pd-domain-recent-row strong {
    color: var(--pd-text);
    font-size: 12px;
}

.pd-domain-recent-row span {
    margin-top: 4px;
    color: var(--pd-muted);
    font-size: 9px;
}

@media (max-width: 640px) {
    #profile-page {
        padding: 0 10px 48px;
    }

    .profile-nav {
        min-height: 56px;
    }

    .profile-header {
        grid-template-columns: 70px minmax(0, 1fr) 38px;
        min-height: 112px;
        margin: 12px 0 14px;
        padding: 14px 12px;
        gap: 2px 11px;
    }

    .profile-photo-wrapper {
        width: 64px;
        height: 64px;
    }

    #profile-name {
        font-size: 20px;
    }

    .profile-bio {
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .btn-edit {
        width: 36px;
        height: 36px;
    }

    .pd-today-band,
    .pd-performance-band,
    .pd-repeat-band,
    .pd-best-band {
        margin-bottom: 10px;
        padding: 15px 12px;
    }

    .pd-section-heading h2,
    .pd-performance-header h2 {
        font-size: 18px;
    }

    .pd-today-layout {
        grid-template-columns: 1fr;
        gap: 8px;
        margin-top: 14px;
    }

    .pd-score {
        min-height: 112px;
        padding: 14px;
    }

    .pd-score strong {
        font-size: 54px;
    }

    .pd-comparison {
        min-height: 92px;
        padding: 10px 8px;
    }

    .pd-comparison > span {
        min-height: 20px;
    }

    .pd-comparison strong {
        margin: 5px 0 3px;
        font-size: 18px;
    }

    .pd-comparison.pd-new strong {
        font-size: 12px;
    }

    .pd-kpi {
        min-height: 60px;
        padding: 9px 4px;
    }

    .pd-kpi strong {
        font-size: 19px;
    }

    .pd-chart {
        height: 176px;
        gap: 2px;
    }

    .pd-chart-column > span {
        font-size: 7px;
    }

    .pd-chart-legend {
        justify-content: flex-start;
    }

    .pd-week-open {
        padding: 0 9px;
        font-size: 9px;
    }

    .pd-domain-tabs {
        min-height: 44px;
        margin-bottom: 5px;
        padding: 3px;
        gap: 2px;
    }

    .pd-domain-tabs button {
        padding: 0 3px;
        font-size: 8px;
    }

    .pd-global-toolbar {
        min-height: 48px;
        margin-bottom: 8px;
        padding-left: 8px;
    }

    #pd-range-label {
        font-size: 9px;
    }

    .pd-global-toolbar .pd-period-tabs {
        width: 164px;
        height: 36px;
    }

    .pd-domain-hero,
    .pd-domain-chart-band,
    .pd-domain-feature,
    .pd-domain-recent-band {
        margin-bottom: 10px;
        padding: 15px 12px;
    }

    .pd-domain-hero h2 {
        font-size: 22px;
    }

    .pd-domain-hero p {
        font-size: 11px;
    }

    .pd-domain-kpis,
    .pd-hygiene-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: 14px;
        gap: 6px;
    }

    .pd-domain-kpi,
    .pd-hygiene-grid .pd-domain-kpi {
        min-height: 88px;
        padding: 11px;
    }

    .pd-domain-kpi strong {
        font-size: 26px;
    }

    .pd-domain-chart {
        height: 176px;
        gap: 2px;
    }

    .pd-domain-chart-column > span {
        font-size: 7px;
    }

    .pd-outcome-legend {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 5px;
    }

    .pd-ranking-row {
        grid-template-columns: 25px minmax(0, 1fr) 28px;
        padding-right: 5px;
        padding-left: 5px;
        gap: 7px;
    }

    .pd-cleaning-ledger {
        padding: 11px;
    }

    .pd-domain-recent-row {
        grid-template-columns: 62px minmax(0, 1fr);
        gap: 9px;
    }
}

@media (max-width: 380px) {
    .profile-header {
        grid-template-columns: 62px minmax(0, 1fr) 34px;
        gap: 2px 8px;
    }

    .profile-photo-wrapper {
        width: 56px;
        height: 56px;
    }

    #profile-name {
        font-size: 18px;
    }

    .profile-title,
    .profile-bio {
        font-size: 10px;
    }

    .pd-comparisons {
        gap: 4px;
    }

    .pd-comparison {
        padding: 8px 5px;
    }

    .pd-comparison small {
        font-size: 7px;
    }

    .pd-kpi span {
        font-size: 7px;
    }

    .pd-domain-tabs button {
        font-size: 7px;
    }

    #pd-range-label {
        display: none;
    }

    .pd-global-toolbar {
        justify-content: flex-end;
    }

    .pd-global-toolbar .pd-period-tabs {
        width: 100%;
    }
}

@media (max-width: 760px) and (orientation: portrait) {
    .pd-week-view:not(.pd-force-portrait) .pd-week-matrix {
        display: none;
    }

    .pd-week-view:not(.pd-force-portrait) .pd-rotate-hint {
        display: flex;
        min-height: calc(100vh - 150px);
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 16px;
    }

    .pd-week-view.pd-force-portrait .pd-week-matrix {
        display: grid;
    }

    .pd-week-view.pd-force-portrait {
        overflow-x: auto;
    }
}

@media (orientation: landscape) and (max-height: 560px) {
    .pd-week-view {
        padding: 8px;
    }

    .pd-week-header {
        grid-template-columns: 38px 38px minmax(160px, 1fr) 38px;
        width: calc(58vw - 16px);
        margin-right: auto;
        margin-left: 0;
    }

    .pd-icon-btn {
        width: 38px;
        height: 38px;
    }

    .pd-week-stats {
        position: fixed;
        z-index: 2;
        top: 7px;
        right: 8px;
        width: min(42vw, 360px);
        margin: 0;
    }

    .pd-week-stats .pd-kpi {
        min-height: 40px;
        padding: 4px;
    }

    .pd-week-stats .pd-kpi strong {
        font-size: 14px;
    }

    .pd-week-matrix {
        margin-top: 10px;
    }

    .pd-matrix-head,
    .pd-matrix-label,
    .pd-matrix-cell,
    .pd-matrix-total {
        min-height: 49px;
        padding: 5px;
    }

    .pd-matrix-head {
        min-height: 42px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pd-loader,
    .pd-phone-rotate {
        animation: none;
    }
}
