:root {
    --tscrm-pd-primary: #4a12cd;
    --tscrm-pd-accent: #f39200;
    --tscrm-pd-text: #1a2c3d;
    --tscrm-pd-surface: #ffffff;
    --tscrm-pd-border: #d5e2ed;
}

.tscrm-pd-wrap {
    max-width: 1450px;
    margin: 20px auto;
    padding: 0 16px 20px;
    font-family: "OpenSans-Regular", Tahoma, sans-serif;
    color: var(--tscrm-pd-text);
}

.tscrm-pd-login-wrap {
    max-width: 560px;
}

.tscrm-pd-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding: 20px;
    border-radius: 18px;
    border: 1px solid var(--tscrm-pd-border);
    background: linear-gradient(140deg, color-mix(in srgb, var(--tscrm-pd-primary) 18%, #ffffff), #ffffff 54%);
    box-shadow: 0 12px 26px rgba(7, 37, 63, 0.09);
}

.tscrm-pd-eyebrow {
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 11px;
    color: color-mix(in srgb, var(--tscrm-pd-primary) 74%, #4f6d86);
    font-weight: 700;
}

.tscrm-pd-login-card,
.tscrm-pd-card,
.tscrm-pd-section {
    border-radius: 16px;
    border: 1px solid var(--tscrm-pd-border);
    background: var(--tscrm-pd-surface);
    box-shadow: 0 10px 22px rgba(10, 33, 55, 0.07);
}

.tscrm-pd-card {
    background: linear-gradient(165deg, color-mix(in srgb, var(--tscrm-pd-primary) 8%, #ffffff), #ffffff 65%);
}

.tscrm-pd-login-card {
    padding: 24px;
}

.tscrm-pd-login-card h2 {
    margin: 6px 0 10px;
}

.tscrm-pd-grid {
    display: grid;
    gap: 14px;
}

.tscrm-pd-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

.tscrm-pd-card {
    padding: 16px;
}

.tscrm-pd-card h3,
.tscrm-pd-card h4 {
    margin: 0 0 8px;
}

.tscrm-pd-sub {
    margin: 0;
    color: #557086;
}

.tscrm-pd-section {
    margin-top: 16px;
    padding: 18px;
}

.tscrm-pd-login-card input,
.tscrm-pd-send-form input,
.tscrm-pd-switcher-search,
.tscrm-pd-switcher-select {
    width: 100%;
    border: 1px solid #bed1e0;
    border-radius: 10px;
    padding: 10px 12px;
    box-sizing: border-box;
    background: #ffffff;
}

.tscrm-pd-login-card input:focus,
.tscrm-pd-send-form input:focus,
.tscrm-pd-switcher-search:focus,
.tscrm-pd-switcher-select:focus {
    outline: none;
    border-color: var(--tscrm-pd-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tscrm-pd-primary) 18%, #ffffff);
}

.tscrm-pd-btn,
.tscrm-pd-send-form button,
.tscrm-pd-login-card button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, var(--tscrm-pd-primary), color-mix(in srgb, var(--tscrm-pd-primary) 72%, #ffffff));
    color: #ffffff;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 8px 16px color-mix(in srgb, var(--tscrm-pd-primary) 28%, transparent);
}

.tscrm-pd-btn:hover,
.tscrm-pd-send-form button:hover,
.tscrm-pd-login-card button:hover {
    transform: translateY(-1px);
}

.tscrm-pd-btn-ghost {
    background: #f1f5f9;
    color: var(--tscrm-pd-text);
    box-shadow: none;
    border: 1px solid var(--tscrm-pd-border);
}

.tscrm-pd-logout,
.tscrm-pd-link {
    color: var(--tscrm-pd-primary);
    text-decoration: none;
    font-weight: 600;
}

.tscrm-pd-link {
    margin-right: 10px;
}

.tscrm-pd-detail-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--tscrm-pd-border);
    background: #ffffff;
}

.tscrm-pd-btn-back {
    background: color-mix(in srgb, var(--tscrm-pd-primary) 12%, #ffffff);
    color: var(--tscrm-pd-primary);
    border: 1px solid color-mix(in srgb, var(--tscrm-pd-primary) 30%, #ffffff);
    box-shadow: none;
}

.tscrm-pd-switcher-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    width: min(100%, 520px);
}

.tscrm-pd-switcher-search {
    max-width: 180px;
}

.tscrm-pd-table {
    border-spacing: 1px;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 10px;
    overflow: hidden;
    width: 100%;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.tscrm-pd-table * {
    position: relative;
}

.tscrm-pd-table thead tr {
    height: 45px;
    background: #36304a;
}

.tscrm-pd-table th {
    font-size: 16px;
    color: #ffffff;
    font-weight: 500;
    line-height: 1.2;
    text-align: left;
    padding: 0 16px;
    vertical-align: middle;
}

.tscrm-pd-table th:first-child {
    padding-left: 40px;
}

.tscrm-pd-table tbody tr {
    height: 50px;
    font-size: 15px;
    color: #808080;
    line-height: 1.2;
    font-weight: 400;
}

.tscrm-pd-table tbody tr:last-child {
    border: 0;
}

.tscrm-pd-table td {
    text-align: left;
    padding: 0 16px;
    vertical-align: middle;
    color: #141414;
    background: transparent;
}

.tscrm-pd-table td:first-child {
    padding-left: 40px;
}

.tscrm-pd-table tbody tr:nth-child(even) {
    background-color: #f5f5f5;
}

.tscrm-pd-table tbody tr:hover {
    color: #555555;
    background-color: #f5f5f5;
    cursor: default;
}

.tscrm-pd-section > h4 {
    margin: 24px 0 12px;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

.tscrm-pd-event-list,
.tscrm-pd-doc-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
}

.tscrm-pd-event-card,
.tscrm-pd-doc-card {
    border: 1px solid var(--tscrm-pd-border);
    border-radius: 14px;
    padding: 14px;
    background: linear-gradient(165deg, color-mix(in srgb, var(--tscrm-pd-primary) 8%, #ffffff), #ffffff 70%);
    box-shadow: 0 6px 16px rgba(9, 34, 57, 0.08);
    display: flex;
    flex-direction: column;
}

.tscrm-pd-doc-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.tscrm-pd-doc-top h4 {
    margin: 0;
    font-size: 15px;
    line-height: 1.35;
}

.tscrm-pd-doc-meta p {
    margin: 0 0 6px;
    font-size: 13px;
    color: #42596c;
}

.tscrm-pd-doc-card .tscrm-pd-event-actions {
    margin-top: auto;
    padding-top: 10px;
}

.tscrm-pd-event-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.tscrm-pd-event-top h4 {
    margin: 0;
    font-size: 15px;
    line-height: 1.35;
}

.tscrm-pd-event-meta p {
    margin: 0 0 6px;
    font-size: 13px;
    color: #42596c;
}

.tscrm-pd-event-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.tscrm-pd-status {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 700;
}

.tscrm-pd-status.is-preliminar {
    background: #fff1cb;
    color: #654a00;
}

.tscrm-pd-status.is-liquidado {
    background: #dcf6e2;
    color: #14592a;
}

.tscrm-pd-error,
.tscrm-pd-warning,
.tscrm-pd-notice {
    border-radius: 10px;
    padding: 10px 12px;
    margin: 12px 0;
}

.tscrm-pd-error {
    background: #ffe7e7;
    color: #7f1111;
}

.tscrm-pd-warning {
    background: #fff4d5;
    color: #6b4e00;
}

.tscrm-pd-notice {
    background: color-mix(in srgb, var(--tscrm-pd-accent) 16%, #ffffff);
    color: #5f4300;
}

.tscrm-pd-inline-actions,
.tscrm-pd-actions-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin: 14px 0;
}

.tscrm-pd-send-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.tscrm-pd-send-form input {
    width: 260px;
}

.tscrm-pd-overlay,
.tscrm-pd-modal {
    position: fixed;
    inset: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 99999;
}

.tscrm-pd-overlay.is-visible,
.tscrm-pd-modal.is-visible {
    opacity: 1;
    pointer-events: auto;
}

.tscrm-pd-overlay {
    display: grid;
    place-items: center;
    background: rgba(10, 25, 40, 0.38);
}

.tscrm-pd-overlay-card {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    border-radius: 12px;
    padding: 14px 16px;
    border: 1px solid var(--tscrm-pd-border);
}

.tscrm-pd-spinner {
    width: 18px;
    height: 18px;
    border: 3px solid #d5e2ed;
    border-top-color: var(--tscrm-pd-primary);
    border-radius: 50%;
    animation: tscrm-spin 0.8s linear infinite;
}

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

.tscrm-pd-modal {
    display: grid;
    place-items: center;
}

.tscrm-pd-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 23, 36, 0.48);
}

.tscrm-pd-modal-card {
    position: relative;
    z-index: 1;
    width: min(92vw, 520px);
    border-radius: 16px;
    background: #fff;
    border: 1px solid var(--tscrm-pd-border);
    box-shadow: 0 24px 60px rgba(9, 34, 57, 0.28);
    overflow: hidden;
}

.tscrm-pd-modal-header {
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--tscrm-pd-border);
    background: linear-gradient(140deg, color-mix(in srgb, var(--tscrm-pd-primary) 10%, #ffffff), #ffffff 60%);
}

.tscrm-pd-modal-header h4 {
    margin: 0 0 4px;
    font-size: 17px;
    color: var(--tscrm-pd-text);
}

.tscrm-pd-modal-header p {
    margin: 0;
    font-size: 13px;
    color: #5a7287;
}

.tscrm-pd-modal-body {
    padding: 16px 20px;
}

.tscrm-pd-modal-choice {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--tscrm-pd-border);
    cursor: pointer;
    font-size: 14px;
    transition: border-color 0.15s, background 0.15s;
}

.tscrm-pd-modal-choice:has(input:checked) {
    border-color: var(--tscrm-pd-primary);
    background: color-mix(in srgb, var(--tscrm-pd-primary) 7%, #ffffff);
}

.tscrm-pd-modal-choice input[type="radio"] {
    accent-color: var(--tscrm-pd-primary);
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    margin: 0;
}

#tscrm-send-modal-other-email {
    margin-top: 10px;
    border-radius: 10px;
    border: 1px solid var(--tscrm-pd-border);
    padding: 10px 12px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

#tscrm-send-modal-other-email:focus {
    outline: none;
    border-color: var(--tscrm-pd-primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--tscrm-pd-primary) 18%, #ffffff);
}

.tscrm-pd-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
    padding: 14px 20px;
    border-top: 1px solid var(--tscrm-pd-border);
    background: #f8fafc;
}

@media (max-width: 860px) {
    .tscrm-pd-grid-3,
    .tscrm-pd-grid-2 {
        grid-template-columns: 1fr;
    }

    .tscrm-pd-header {
        flex-direction: column;
    }

    .tscrm-pd-detail-topbar,
    .tscrm-pd-switcher-wrap,
    .tscrm-pd-send-form {
        flex-direction: column;
        align-items: stretch;
    }

    .tscrm-pd-send-form input,
    .tscrm-pd-switcher-search {
        width: 100%;
        max-width: none;
    }
}
