/* Personal Renewals Dashboard */
.plp-shell-header .header-top {
    align-items: center;
}

.plp-header-actions {
    align-items: center;
    display: flex;
    gap: 8px;
}

.plp-header-btn {
    font-size: 13px;
    min-height: 36px;
    padding: 0 14px;
}

.plp-container {
    max-width: 1440px;
    padding-top: 20px;
    padding-bottom: 120px;
}

.plp-hero {
    align-items: stretch;
    background: linear-gradient(135deg, color-mix(in srgb, var(--bg-card) 94%, var(--apple-blue)), var(--bg-card));
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 2px 12px var(--shadow);
    display: grid;
    gap: 20px;
    grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
    margin-bottom: 18px;
    padding: 20px;
}

.plp-title {
    color: var(--text);
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1.1;
    margin: 0 0 8px;
}

.plp-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.45;
    margin: 0;
    max-width: 680px;
}

.plp-sync-row {
    align-items: center;
    color: var(--text-tertiary);
    display: flex;
    flex-wrap: wrap;
    font-size: 12px;
    font-weight: 650;
    gap: 8px;
    margin-top: 14px;
}

.plp-sync-row::before {
    background: var(--success);
    border-radius: 50%;
    content: "";
    height: 8px;
    width: 8px;
}

.plp-hero-panel {
    align-content: center;
    background: color-mix(in srgb, var(--bg-card) 86%, var(--success));
    border: 1px solid color-mix(in srgb, var(--success) 22%, var(--border));
    border-radius: 8px;
    display: grid;
    gap: 4px;
    justify-items: start;
    padding: 16px;
}

.plp-hero-panel span,
.plp-hero-panel small {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
}

.plp-hero-panel strong {
    color: var(--text);
    font-size: 36px;
    font-weight: 850;
    letter-spacing: 0;
    line-height: 1;
}

.plp-stats-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.plp-stat-card {
    appearance: none;
    border-radius: 8px;
    cursor: pointer;
    min-height: 104px;
    text-align: left;
}

.plp-stat-card:hover,
.plp-stat-card:focus-visible {
    border-color: color-mix(in srgb, var(--apple-blue) 42%, var(--border));
    outline: none;
}

.plp-stat-card[aria-pressed="true"] {
    background: color-mix(in srgb, var(--apple-blue) 7%, var(--bg-card));
    border-color: color-mix(in srgb, var(--apple-blue) 42%, var(--border));
}

.plp-stat-card[aria-pressed="true"] .cgl-stat-label {
    color: var(--text);
}

.plp-stat-card .cgl-stat-icon {
    font-size: 13px;
    font-weight: 800;
}

.plp-stat-card .cgl-stat-value {
    font-size: 28px;
    letter-spacing: 0;
}

.plp-controls {
    border-radius: 8px;
    margin-bottom: 14px;
    padding: 14px;
}

.plp-controls-main {
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(260px, 1fr) minmax(220px, 280px);
}

.plp-controls-main .cgl-search,
.plp-controls-main .cgl-filter-select,
.plp-advanced-filters .cgl-filter-select {
    margin-bottom: 0;
    min-height: 40px;
}

.plp-advanced-filters {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    margin-top: 10px;
}

.plp-advanced-filters label {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.plp-advanced-filters label span {
    color: var(--text-tertiary);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.plp-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.plp-filter-chips button {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
    min-height: 32px;
    padding: 0 11px;
}

.plp-filter-chips button:hover,
.plp-filter-chips button:focus-visible,
.plp-filter-chips button[aria-pressed="true"] {
    background: color-mix(in srgb, var(--apple-blue) 8%, var(--bg-card));
    border-color: color-mix(in srgb, var(--apple-blue) 34%, var(--border));
    color: var(--apple-blue);
    outline: none;
}

.plp-counter-row {
    align-items: center;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    font-size: 13px;
    gap: 8px 14px;
    justify-content: space-between;
    margin-top: 12px;
}

.plp-counter-row > span:first-child {
    background: color-mix(in srgb, var(--text) 5%, transparent);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 12px;
    font-weight: 750;
    padding: 5px 9px;
}

#plpError,
#plpTableContainer {
    display: none;
}

.plp-table-container {
    border-radius: 8px;
    overflow-x: hidden;
}

.plp-table {
    min-width: 0;
    table-layout: fixed;
    width: 100%;
}

.plp-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
}

.plp-table td {
    min-width: 0;
    overflow-wrap: anywhere;
    vertical-align: middle;
    white-space: normal;
}

.plp-table th:nth-child(1),
.plp-table td:nth-child(1) {
    width: 12%;
}

.plp-table th:nth-child(2),
.plp-table td:nth-child(2) {
    width: 19%;
}

.plp-table th:nth-child(3),
.plp-table td:nth-child(3) {
    width: 18%;
}

.plp-table th:nth-child(4),
.plp-table td:nth-child(4) {
    width: 12%;
}

.plp-table th:nth-child(5),
.plp-table td:nth-child(5) {
    width: 14%;
}

.plp-table th:nth-child(6),
.plp-table td:nth-child(6) {
    width: 12%;
}

.plp-table th:nth-child(7),
.plp-table td:nth-child(7) {
    width: 13%;
}

.plp-row {
    border-left: 4px solid transparent;
}

.plp-row[data-status="critical"] {
    border-left-color: #ef4444;
}

.plp-row[data-status="upcoming"] {
    border-left-color: #f59e0b;
}

.plp-row[data-status="watch"] {
    border-left-color: #3b82f6;
}

.plp-row[data-status="recently-expired"] {
    border-left-color: #991b1b;
}

.plp-client-link {
    color: var(--apple-blue, #007aff);
    cursor: pointer;
    font-weight: 750;
    text-decoration: none;
}

.plp-client-link:hover,
.plp-client-link:focus-visible {
    text-decoration: underline;
}

.plp-client-name {
    min-width: 0;
}

.plp-client-meta {
    color: var(--text-tertiary);
    font-size: 12px;
    line-height: 1.35;
    margin-top: 3px;
    word-break: break-word;
}

.plp-policy-number {
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 13px;
    font-weight: 750;
    overflow-wrap: anywhere;
    white-space: normal;
}

.plp-exp-date {
    font-weight: 700;
    white-space: nowrap;
}

.plp-staff-line {
    color: var(--text);
    font-size: 12px;
    line-height: 1.35;
}

.plp-staff-line span {
    color: var(--text-tertiary);
    font-weight: 800;
}

.plp-workflow-cell {
    min-width: 0;
}

.plp-workflow-select {
    background: var(--bg-input, var(--bg-card));
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 13px;
    font-weight: 650;
    line-height: 1;
    min-height: 36px;
    min-width: 0;
    padding: 0 10px;
    width: 100%;
}

.plp-hidden-badge {
    background: color-mix(in srgb, var(--text-tertiary) 12%, transparent);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-secondary);
    display: inline-block;
    font-size: 11px;
    font-weight: 750;
    margin-top: 6px;
    padding: 3px 8px;
    text-transform: uppercase;
}

.plp-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 7px;
    min-width: 0;
}

.plp-actions.compact .plp-action-btn {
    flex: 1 1 100%;
}

.plp-action-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    cursor: pointer;
    font-size: 11px;
    font-weight: 750;
    line-height: 1;
    min-height: 28px;
    padding: 0 8px;
    transition: background 0.16s var(--transition-smooth), border-color 0.16s var(--transition-smooth), color 0.16s var(--transition-smooth);
}

.plp-actions .plp-action-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
}

.plp-actions .plp-action-btn.subtle,
.plp-actions .plp-action-btn.danger {
    color: var(--text-tertiary);
}

.plp-action-btn:hover,
.plp-action-btn:focus-visible {
    background: color-mix(in srgb, var(--apple-blue) 9%, var(--bg-card));
    border-color: color-mix(in srgb, var(--apple-blue) 46%, var(--border));
    color: var(--apple-blue);
    outline: none;
}

.plp-action-btn.primary {
    background: color-mix(in srgb, var(--success) 10%, var(--bg-card));
    border-color: color-mix(in srgb, var(--success) 36%, var(--border));
    color: var(--success);
}

.plp-action-btn.subtle {
    color: var(--text-secondary);
}

.plp-action-btn.danger:hover,
.plp-action-btn.danger:focus-visible {
    background: color-mix(in srgb, var(--danger) 8%, var(--bg-card));
    border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
    color: var(--danger);
}

.plp-missing-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 7px;
}

.plp-missing-chips span {
    background: color-mix(in srgb, var(--danger) 7%, var(--bg-card));
    border: 1px solid color-mix(in srgb, var(--danger) 20%, var(--border));
    border-radius: 999px;
    color: color-mix(in srgb, var(--danger) 82%, var(--text));
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    padding: 4px 7px;
    text-transform: uppercase;
}

.plp-detail-row td {
    background: color-mix(in srgb, var(--apple-blue) 4%, var(--bg-card));
    padding: 0 12px 16px;
}

.plp-detail-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    padding: 12px;
}

.plp-detail-section {
    background: color-mix(in srgb, var(--text) 3%, transparent);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 12px;
}

.plp-detail-section h3 {
    color: var(--text);
    font-size: 13px;
    font-weight: 850;
    letter-spacing: 0;
    line-height: 1.2;
    margin: 0 0 10px;
}

.plp-detail-grid {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.plp-detail-item {
    min-width: 0;
}

.plp-detail-item span {
    color: var(--text-tertiary);
    display: block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0;
    margin-bottom: 3px;
    text-transform: uppercase;
}

.plp-detail-item strong {
    color: var(--text);
    display: block;
    font-size: 13px;
    font-weight: 720;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.plp-renewal-workspace {
    grid-column: 1 / -1;
}

.plp-detail-toolbar {
    align-items: flex-start;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(190px, 240px) minmax(0, 1fr);
    margin-bottom: 12px;
}

.plp-note-log {
    display: grid;
    gap: 8px;
    margin-bottom: 10px;
}

.plp-note-empty {
    color: var(--text-tertiary);
    font-size: 13px;
}

.plp-note-entry {
    border-left: 3px solid color-mix(in srgb, var(--apple-blue) 40%, var(--border));
    padding-left: 9px;
}

.plp-note-entry span {
    color: var(--text-tertiary);
    display: block;
    font-size: 11px;
    font-weight: 750;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.plp-note-entry p {
    color: var(--text);
    font-size: 13px;
    line-height: 1.45;
    margin: 0;
    white-space: pre-wrap;
}

.plp-note-compose {
    align-items: flex-end;
    display: flex;
    gap: 8px;
}

.plp-note-compose textarea {
    flex: 1;
    min-height: 48px;
    resize: vertical;
}

.cgl-status-badge.recently-expired {
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.cgl-status-badge.upcoming {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #a16207;
}

.cgl-status-badge.watch {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
}

.cgl-status-badge.future,
.cgl-status-badge.no-expiration,
.cgl-status-badge.old-expired {
    background: #f4f4f5;
    border: 1px solid #e4e4e7;
    color: #52525b;
}

.plp-table .cgl-type-badge {
    align-items: center;
    background: color-mix(in srgb, var(--bg-card) 92%, var(--text));
    border: 1px solid color-mix(in srgb, var(--text) 10%, var(--border));
    border-radius: 6px;
    color: var(--text-secondary);
    display: inline-flex;
    font-size: 11px;
    font-weight: 750;
    gap: 6px;
    justify-self: start;
    letter-spacing: 0;
    line-height: 1;
    max-width: 100%;
    padding: 5px 8px;
    white-space: nowrap;
    width: max-content;
}

.plp-table .cgl-type-badge::before {
    background: currentColor;
    border-radius: 50%;
    content: "";
    height: 6px;
    opacity: 0.78;
    width: 6px;
}

.plp-table .cgl-type-badge.homeowner,
.plp-table .cgl-type-badge.dwelling,
.plp-table .cgl-type-badge.condo {
    background: #ecfdf5;
    border-color: #bbf7d0;
    color: #047857;
}

.plp-table .cgl-type-badge.personal-auto,
.plp-table .cgl-type-badge.motorcycle,
.plp-table .cgl-type-badge.rv {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.plp-table .cgl-type-badge.renters,
.plp-table .cgl-type-badge.flood,
.plp-table .cgl-type-badge.earthquake {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.plp-table .cgl-type-badge.boat,
.plp-table .cgl-type-badge.personal-umbrella,
.plp-table .cgl-type-badge.personal {
    background: #e0f2fe;
    border-color: #bae6fd;
    color: #0369a1;
}

body.dark-mode .plp-hero,
body.dark-mode .plp-stat-card,
body.dark-mode .plp-filter-chips button,
body.dark-mode .plp-workflow-select,
body.dark-mode .plp-action-btn,
body.dark-mode .plp-detail-panel {
    background: var(--bg-card);
}

body.dark-mode .plp-detail-section {
    background: rgba(255, 255, 255, 0.035);
}

body.dark-mode .plp-missing-chips span {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(248, 113, 113, 0.25);
    color: #fca5a5;
}

body.dark-mode .cgl-status-badge.recently-expired {
    background: rgba(239, 68, 68, 0.14);
    border-color: rgba(248, 113, 113, 0.32);
    color: #fca5a5;
}

body.dark-mode .cgl-status-badge.upcoming {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(251, 191, 36, 0.32);
    color: #fcd34d;
}

body.dark-mode .cgl-status-badge.watch {
    background: rgba(59, 130, 246, 0.14);
    border-color: rgba(96, 165, 250, 0.32);
    color: #93c5fd;
}

body.dark-mode .cgl-status-badge.future,
body.dark-mode .cgl-status-badge.no-expiration,
body.dark-mode .cgl-status-badge.old-expired {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-secondary);
}

body.dark-mode .plp-table .cgl-type-badge {
    --plp-type-accent: #94a3b8;
    background: rgba(255, 255, 255, 0.035);
    border-color: rgba(255, 255, 255, 0.11);
    color: #d1d5db;
}

body.dark-mode .plp-table .cgl-type-badge::before {
    background: var(--plp-type-accent);
    opacity: 1;
}

body.dark-mode .plp-table .cgl-type-badge.homeowner,
body.dark-mode .plp-table .cgl-type-badge.dwelling,
body.dark-mode .plp-table .cgl-type-badge.condo {
    --plp-type-accent: #4ade80;
}

body.dark-mode .plp-table .cgl-type-badge.personal-auto,
body.dark-mode .plp-table .cgl-type-badge.motorcycle,
body.dark-mode .plp-table .cgl-type-badge.rv {
    --plp-type-accent: #60a5fa;
}

body.dark-mode .plp-table .cgl-type-badge.renters,
body.dark-mode .plp-table .cgl-type-badge.flood,
body.dark-mode .plp-table .cgl-type-badge.earthquake {
    --plp-type-accent: #f59e0b;
}

body.dark-mode .plp-table .cgl-type-badge.boat,
body.dark-mode .plp-table .cgl-type-badge.personal-umbrella,
body.dark-mode .plp-table .cgl-type-badge.personal {
    --plp-type-accent: #38bdf8;
}

@media (max-width: 1180px) {
    .plp-stats-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .plp-advanced-filters {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .plp-container {
        padding: 14px;
        padding-bottom: 96px;
    }

    .plp-header-actions {
        align-items: stretch;
        flex-direction: column;
        width: 100%;
    }

    .plp-header-btn {
        width: 100%;
    }

    .plp-hero,
    .plp-controls-main,
    .plp-detail-toolbar {
        grid-template-columns: 1fr;
    }

    .plp-advanced-filters,
    .plp-detail-panel {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .plp-stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .plp-counter-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .plp-note-compose {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 720px) {
    .plp-table-container {
        background: transparent;
        border: 0;
        box-shadow: none;
        overflow: visible;
    }

    .plp-table {
        border-collapse: separate;
        border-spacing: 0 12px;
        min-width: 0;
    }

    .plp-table thead {
        display: none;
    }

    .plp-table,
    .plp-table tbody,
    .plp-table tr,
    .plp-table td {
        display: block;
        width: 100%;
    }

    .plp-table th:nth-child(1),
    .plp-table td:nth-child(1),
    .plp-table th:nth-child(2),
    .plp-table td:nth-child(2),
    .plp-table th:nth-child(3),
    .plp-table td:nth-child(3),
    .plp-table th:nth-child(4),
    .plp-table td:nth-child(4),
    .plp-table th:nth-child(5),
    .plp-table td:nth-child(5),
    .plp-table th:nth-child(6),
    .plp-table td:nth-child(6),
    .plp-table th:nth-child(7),
    .plp-table td:nth-child(7) {
        width: 100%;
    }

    .plp-row {
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-left-width: 4px;
        border-radius: 8px;
        box-shadow: 0 2px 12px var(--shadow);
        overflow: hidden;
    }

    .plp-table td {
        border-bottom: 0;
        display: grid;
        gap: 8px;
        grid-template-columns: 92px minmax(0, 1fr);
        padding: 10px 12px;
    }

    .plp-table td::before {
        color: var(--text-tertiary);
        content: attr(data-label);
        font-size: 11px;
        font-weight: 800;
        letter-spacing: 0;
        text-transform: uppercase;
    }

    .plp-table td[data-label="Client"] {
        padding-top: 14px;
    }

    .plp-workflow-select,
    .plp-actions,
    .plp-actions .plp-action-btn {
        width: 100%;
    }

    .plp-actions {
        min-width: 0;
    }

    .plp-detail-row {
        display: block;
        margin-top: -8px;
    }

    .plp-detail-row td {
        display: block;
        padding: 0 0 12px;
    }

    .plp-detail-row td::before {
        content: none;
    }

    .plp-detail-panel,
    .plp-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .plp-stats-grid {
        grid-template-columns: 1fr;
    }

    .plp-advanced-filters {
        grid-template-columns: 1fr;
    }

    .plp-hero-panel strong {
        font-size: 32px;
    }
}
