@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;600;700&display=swap');

:root {
    --pm-bg: #f1f5f9;
    --pm-card: #ffffff;
    --pm-text: #0f172a;
    --pm-muted: #64748b;
    --pm-primary: #3c50e0;
    --pm-primary-soft: #eef2ff;
    --pm-border: #e2e8f0;
}

.ypg-pm-frontend h1,
.ypg-pm-frontend h2,
.ypg-pm-frontend h3,
.ypg-pm-frontend h4,
.ypg-pm-frontend h5,
.ypg-pm-frontend h6 {
    font-weight: 500;
}

.ypg-pm-frontend {
    font-family: "Plus Jakarta Sans", "Trebuchet MS", sans-serif;
    color: var(--pm-text);
    background: var(--pm-bg);
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 85vh;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 22px 50px rgba(15, 23, 42, 0.08);
}

.ypg-pm-frontend a {
    text-decoration: none;
    color: inherit;
}

.ypg-pm-frontend a:visited {
    color: inherit;
}

.ypg-pm-sidebar {
    background: #0f172a;
    color: #ffffff;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.ypg-pm-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    font-size: 18px;
}

.ypg-pm-collapse {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
}

.ypg-pm-collapse-bar {
    width: 16px;
    height: 2px;
    background: #ffffff;
    display: block;
}

.ypg-pm-brand-mark {
    background: var(--pm-primary);
    color: #fff;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 14px;
}

.ypg-pm-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ypg-pm-nav a {
    padding: 10px 12px;
    border-radius: 10px;
    color: #cbd5f5;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ypg-pm-icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
}

.ypg-pm-icon svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.ypg-pm-nav a.active,
.ypg-pm-nav a:hover {
    background: rgba(60, 80, 224, 0.15);
    color: #fff;
}

.ypg-pm-sidebar-footer a {
    color: #94a3b8;
    font-size: 14px;
}

.ypg-pm-logout {
    color: #cbd5f5;
}

.ypg-pm-sidebar-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    position: sticky;
    bottom: 12px;
}

.ypg-pm-frontend.is-collapsed {
    grid-template-columns: 90px 1fr;
}

.ypg-pm-frontend.is-collapsed .ypg-pm-brand-text,
.ypg-pm-frontend.is-collapsed .ypg-pm-nav-text {
    display: none;
}

.ypg-pm-frontend.is-collapsed .ypg-pm-nav a {
    justify-content: center;
}

.ypg-pm-frontend.is-collapsed .ypg-pm-sidebar-footer {
    justify-content: center;
}

.ypg-pm-frontend.is-collapsed .ypg-pm-collapse {
    transform: rotate(180deg);
}


.ypg-pm-main {
    padding: 24px;
}

.ypg-pm-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ypg-pm-topbar h1 {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 500;
}

.ypg-pm-topbar p {
    margin: 0 0 18px;
    color: var(--pm-muted);
}

.ypg-pm-cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.ypg-pm-card,
.ypg-pm-panel {
    background: var(--pm-card);
    border-radius: 16px;
    padding: 18px;
    border: 1px solid var(--pm-border);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
    margin-bottom: 16px;
}

.ypg-pm-kpi {
    font-size: 30px;
    margin: 6px 0 0;
}

.ypg-pm-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.ypg-pm-panel h2 {
    margin-top: 0;
    margin-bottom: 12px;
    font-weight: 500;
}

.ypg-pm-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}


.ypg-pm-panel label {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
    color: var(--pm-text);
}

.ypg-pm-panel input,
.ypg-pm-panel select,
.ypg-pm-panel textarea {
    width: 100%;
    margin-top: 6px;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--pm-border);
    background: #fff;
    box-sizing: border-box;
}

.ypg-pm-panel button {
    background: var(--pm-primary);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
}

.ypg-pm-action {
    background: var(--pm-primary);
    color: #fff !important;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
}

.ypg-pm-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ypg-pm-action-muted {
    background: #e2e8f0;
    color: #0f172a;
}

.ypg-pm-action:visited,
.ypg-pm-action:hover,
.ypg-pm-action:active,
.ypg-pm-action:focus {
    color: #fff !important;
}

.ypg-pm-action-muted:visited,
.ypg-pm-action-muted:hover,
.ypg-pm-action-muted:active,
.ypg-pm-action-muted:focus {
    color: #0f172a;
}

.ypg-pm-import {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 0 16px;
    flex-wrap: wrap;
}

.ypg-pm-calendar-year {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.ypg-pm-calendar-month {
    border: 1px solid var(--pm-border);
    border-radius: 14px;
    padding: 12px 14px;
    background: #fff;
}

.ypg-pm-calendar-month h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.ypg-pm-calendar-month ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 6px;
    font-size: 13px;
}

.ypg-pm-calendar-day ul,
.ypg-pm-calendar-month-grid ul {
    list-style: none;
    padding: 0;
    margin: 6px 0 0;
    display: grid;
    gap: 6px;
    font-size: 12px;
}

.ypg-pm-calendar-month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.ypg-pm-calendar-header {
    font-weight: 500;
    color: var(--pm-muted);
    text-align: center;
    padding: 4px 0;
}

.ypg-pm-calendar-cell {
    border: 1px solid var(--pm-border);
    border-radius: 10px;
    min-height: 90px;
    padding: 8px;
    background: #fff;
}

.ypg-pm-calendar-date {
    font-weight: 500;
    font-size: 13px;
    color: var(--pm-text);
}

.ypg-pm-calendar-day {
    border: 1px solid var(--pm-border);
    border-radius: 12px;
    padding: 14px;
    background: #fff;
}

.ypg-pm-calendar-day h3 {
    margin: 0 0 8px;
    font-size: 16px;
}

.ypg-pm-help {
    margin: 6px 0 0;
    color: var(--pm-muted);
    font-size: 12px;
    width: 100%;
}

.ypg-pm-alert {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 500;
}

.ypg-pm-alert-success {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.ypg-pm-alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.ypg-pm-action {
    background: var(--pm-primary);
    color: #fff;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.ypg-pm-panel table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.ypg-pm-panel table th,
.ypg-pm-panel table td {
    text-align: left;
    padding: 10px 6px;
    border-bottom: 1px solid var(--pm-border);
    vertical-align: middle;
}

.ypg-pm-panel table td form {
    margin: 0;
    display: flex;
    align-items: center;
}

.ypg-pm-panel table td form .ypg-pm-toggle {
    margin: 0;
}

.ypg-pm-table-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.ypg-pm-panel table th a {
    color: inherit;
}

.ypg-pm-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}

.ypg-pm-badge-success {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.ypg-pm-badge-warning {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

.ypg-pm-badge-purple {
    background: #f5f3ff;
    color: #6d28d9;
    border: 1px solid #ddd6fe;
}

.ypg-pm-badge-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.ypg-pm-badge-muted {
    background: #f1f5f9;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.ypg-pm-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--pm-text);
    cursor: pointer;
    white-space: nowrap;
    min-width: 120px;
    margin-bottom: -10px;
}

.ypg-pm-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.ypg-pm-toggle-track {
    width: 38px;
    height: 20px;
    border-radius: 999px;
    background: #e2e8f0;
    position: relative !important;
    transition: background 0.2s ease;
    flex: 0 0 auto;
    display: inline-block;
}

.ypg-pm-toggle-track::after {
    content: '';
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    position: absolute;
    top: 2px;
    left: 2px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
    transition: transform 0.2s ease;
}

.ypg-pm-toggle input:checked + .ypg-pm-toggle-track {
    background: var(--pm-primary);
}

.ypg-pm-toggle input:checked + .ypg-pm-toggle-track::after {
    transform: translateX(18px);
}

.ypg-pm-toggle-label {
    font-weight: 500;
    display: inline-block !important;
    position: static !important;
    margin-left: 4px;
}

.ypg-pm-toggle-compact .ypg-pm-toggle-label {
    margin-left: 6px;
    font-size: 12px;
}

.pm-amount {
    display: inline-block;
    transition: filter 0.2s ease, color 0.2s ease;
}

.ypg-pm-frontend.is-amounts-hidden .pm-amount {
    color: transparent !important;
    text-shadow: 0 0 10px rgba(15, 23, 42, 0.35);
    filter: blur(6px);
}

.ypg-pm-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 9999;
}

.ypg-pm-modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.ypg-pm-modal-card {
    width: min(420px, 90vw);
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.2);
    border: 1px solid var(--pm-border);
}

.ypg-pm-modal-card h3 {
    margin: 0 0 8px;
    font-weight: 500;
}

.ypg-pm-modal-card p {
    margin: 0 0 16px;
    color: var(--pm-muted);
}

.ypg-pm-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.ypg-pm-muted {
    background: #e2e8f0;
    color: #0f172a;
}

.ypg-pm-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.ypg-pm-row-compact {
    grid-template-columns: 0.25fr 0.6fr 0.15fr;
}

.ypg-pm-row-email {
    grid-template-columns: 40% 40% 20%;
}

.ypg-pm-row-email .ypg-pm-toggle {
    justify-self: end;
}

.ypg-pm-login {
    max-width: 420px;
    margin: 0 auto;
    background: #ffffff;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid var(--pm-border);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
    font-family: "Plus Jakarta Sans", "Trebuchet MS", sans-serif;
}

.ypg-pm-login label {
    font-weight: 500;
}

.ypg-pm-login input[type="text"],
.ypg-pm-login input[type="password"] {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    border: 1px solid var(--pm-border);
    margin-top: 6px;
    box-sizing: border-box;
    line-height: 1.4;
}

.ypg-pm-login input[type="submit"] {
    background: var(--pm-primary);
    color: #fff;
    border: none;
    padding: 10px 16px;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
}

@media (max-width: 1100px) {
    .ypg-pm-frontend {
        grid-template-columns: 1fr;
    }
    .ypg-pm-sidebar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    .ypg-pm-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

@media (max-width: 900px) {
    .ypg-pm-frontend {
        border-radius: 0;
        box-shadow: none;
    }
    .ypg-pm-main {
        padding: 16px;
    }
    .ypg-pm-grid {
        grid-template-columns: 1fr;
    }
    .ypg-pm-cards {
        grid-template-columns: 1fr;
    }
    .ypg-pm-row,
    .ypg-pm-row-email,
    .ypg-pm-row-compact {
        grid-template-columns: 1fr;
    }
    .ypg-pm-row-email .ypg-pm-toggle {
        justify-self: start;
    }
    .ypg-pm-topbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .ypg-pm-topbar-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    .ypg-pm-sidebar {
        padding: 16px;
        gap: 12px;
    }
    .ypg-pm-nav a {
        padding: 8px 10px;
        font-size: 14px;
    }
    .ypg-pm-panel {
        overflow-x: visible;
    }
    .ypg-pm-table-cards {
        width: 100%;
        max-width: 100%;
        border-collapse: separate;
        border-spacing: 0 12px;
    }
    .ypg-pm-table-cards thead {
        display: none;
    }
    .ypg-pm-table-cards tbody,
    .ypg-pm-table-cards tr,
    .ypg-pm-table-cards td {
        display: block;
        width: 100%;
    }
    .ypg-pm-table-cards tr {
        background: #fff;
        border: 1px solid var(--pm-border);
        border-radius: 14px;
        padding: 12px;
        box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
        box-sizing: border-box;
        overflow: hidden;
        margin-bottom: 12px;
    }
    .ypg-pm-table-cards tbody tr:last-child {
        margin-bottom: 0;
    }
    .ypg-pm-table-cards td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        padding: 8px 0;
        border-bottom: 1px dashed var(--pm-border);
        min-width: 0;
        flex-wrap: wrap;
    }
    .ypg-pm-table-cards td:last-child {
        border-bottom: none;
    }
    .ypg-pm-table-cards td::before {
        content: attr(data-label);
        font-weight: 500;
        color: var(--pm-muted);
        flex: 0 0 44%;
    }
    .ypg-pm-table-cards td form {
        margin: 0;
        display: flex;
        justify-content: flex-end;
        width: 100%;
    }
    .ypg-pm-table-cards td a,
    .ypg-pm-table-cards td span {
        text-align: right;
        overflow-wrap: anywhere;
        max-width: 55%;
    }
    .ypg-pm-table-cards .ypg-pm-toggle {
        margin: 0;
    }
    .ypg-pm-calendar-year {
        grid-template-columns: 1fr;
    }
    .ypg-pm-calendar-month-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .ypg-pm-frontend.is-collapsed {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .ypg-pm-panel,
    .ypg-pm-card {
        padding: 14px;
    }
    .ypg-pm-brand {
        font-size: 16px;
    }
    .ypg-pm-topbar h1 {
        font-size: 20px;
    }
    .ypg-pm-action,
    .ypg-pm-panel button {
        width: 100%;
        justify-content: center;
    }
    .ypg-pm-topbar-actions form,
    .ypg-pm-topbar-actions a {
        width: 100%;
    }
}
