.esp-page {
    --esp-accent: #f47b2a;
    --esp-ink: #17233a;
    --esp-muted: #6b778c;
    --esp-border: #dfe5ee;
    --esp-soft: #f7f9fc;
    color: var(--esp-ink);
}

.esp-hero,
.esp-toolbar,
.esp-row,
.esp-panel,
.esp-empty,
.esp-form-card,
.esp-template-card,
.esp-stat {
    background: #fff;
    border: 1px solid var(--esp-border);
    border-radius: 14px;
}

.esp-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 24px;
    margin-bottom: 18px;
}

.esp-hero h1,
.esp-panel h2,
.esp-form-card h2 {
    margin: 0;
    font-weight: 700;
}

.esp-kicker {
    display: block;
    margin-bottom: 4px;
    color: var(--esp-muted);
    font-size: .76rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.esp-subtitle {
    margin: 6px 0 0;
    color: var(--esp-muted);
}

.esp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.esp-btn-primary,
.esp-btn-secondary,
.esp-btn-ghost,
.esp-btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    border-radius: 10px;
    padding: 8px 13px;
    text-decoration: none;
    font-weight: 600;
}

.esp-btn-primary {
    border: 1px solid var(--esp-accent);
    background: var(--esp-accent);
    color: #fff;
}

.esp-btn-secondary {
    border: 1px solid var(--esp-border);
    background: #fff;
    color: var(--esp-ink);
}

.esp-btn-ghost {
    border: 0;
    background: transparent;
    color: #315a91;
}

.esp-btn-danger {
    border: 1px solid #efb4b4;
    background: #fff7f7;
    color: #b42318;
}

.esp-btn-primary:hover,
.esp-btn-secondary:hover,
.esp-btn-ghost:hover,
.esp-btn-danger:hover {
    filter: brightness(.97);
}

.esp-btn-primary:disabled,
.esp-btn-secondary:disabled,
.esp-btn-danger:disabled {
    opacity: .55;
}

.esp-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.esp-stat {
    padding: 16px 18px;
}

.esp-stat span,
.esp-stat strong {
    display: block;
}

.esp-stat span {
    color: var(--esp-muted);
    font-size: .82rem;
}

.esp-stat strong {
    margin-top: 6px;
    font-size: 1.7rem;
}

.esp-list,
.esp-template-grid {
    display: grid;
    gap: 11px;
}

.esp-row {
    display: grid;
    grid-template-columns: 48px minmax(220px, 1fr) minmax(180px, 260px) auto;
    align-items: center;
    gap: 14px;
    padding: 15px 17px;
}

.esp-row-icon {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #edf3fb;
    color: #2f69a8;
    font-size: 1.2rem;
}

.esp-row-title {
    color: var(--esp-ink);
    text-decoration: none;
    font-weight: 700;
}

.esp-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    margin-top: 5px;
    color: var(--esp-muted);
    font-size: .82rem;
}

.esp-progress-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
    font-size: .82rem;
}

.esp-progress {
    height: 7px;
    overflow: hidden;
    border-radius: 999px;
    background: #e9edf3;
}

.esp-progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--esp-accent);
}

.esp-empty {
    padding: 38px 24px;
    text-align: center;
    color: var(--esp-muted);
}

.esp-alert {
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid #f1c0c0;
    border-radius: 10px;
    background: #fff3f3;
    color: #842029;
}

.esp-notice {
    margin-bottom: 14px;
    padding: 12px 14px;
    border: 1px solid #b9dfc5;
    border-radius: 10px;
    background: #edf9f1;
    color: #1f6b3a;
}

.esp-form-card,
.esp-panel {
    padding: 20px;
}

.esp-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

.esp-span-2 {
    grid-column: 1 / -1;
}

.esp-template-picker {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.esp-template-option {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 13px;
    border: 1px solid var(--esp-border);
    border-radius: 11px;
    background: var(--esp-soft);
}

.esp-template-option input {
    margin-top: 3px;
}

.esp-template-option strong,
.esp-template-option small {
    display: block;
}

.esp-template-option small {
    margin-top: 3px;
    color: var(--esp-muted);
}

.esp-feature-option {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 14px 15px;
    border: 1px solid #cbd8e8;
    border-radius: 11px;
    background: linear-gradient(135deg, #f3f7fc, #fff);
    cursor: pointer;
}

.esp-feature-option:hover {
    border-color: #f0ad7f;
    background: #fff8f2;
}

.esp-feature-option .form-check-input {
    flex: 0 0 auto;
    margin-top: 3px;
}

.esp-feature-option strong,
.esp-feature-option small {
    display: block;
}

.esp-feature-option small {
    margin-top: 4px;
    color: var(--esp-muted);
    line-height: 1.4;
}

.esp-template-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.esp-template-card {
    padding: 17px;
}

.esp-template-card h3 {
    margin: 8px 0 4px;
    font-size: 1rem;
}

.esp-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 8px;
    background: #edf3fb;
    color: #315a91;
    font-size: .72rem;
    font-weight: 700;
}

.esp-badge.is-success {
    background: #e8f6ed;
    color: #247242;
}

.esp-badge.is-draft {
    background: #fff2df;
    color: #8a571b;
}

.esp-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 3px 0 12px;
}

.esp-tab {
    flex: 0 0 auto;
    border: 1px solid var(--esp-border);
    border-radius: 10px;
    background: #fff;
    color: var(--esp-ink);
    padding: 9px 12px;
}

.esp-tab.active {
    border-color: var(--esp-accent);
    background: #fff4ec;
    color: #9a4a13;
}

.esp-section {
    margin-top: 13px;
    border: 1px solid var(--esp-border);
    border-radius: 12px;
    overflow: hidden;
}

.esp-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--esp-soft);
    border-bottom: 1px solid var(--esp-border);
}

.esp-section-title h3 {
    margin: 0;
    font-size: .95rem;
}

.esp-task-table {
    width: 100%;
    border-collapse: collapse;
}

.esp-task-table th,
.esp-task-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #edf0f4;
    vertical-align: middle;
}

.esp-task-table th {
    color: var(--esp-muted);
    background: #fff;
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.esp-task-table tr:last-child td {
    border-bottom: 0;
}

.esp-personal-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 16px;
}

.esp-personal-panel {
    border-color: #ccd8e8;
    background: linear-gradient(180deg, #eef3f9 0, #f7f9fc 190px, #f3f6fa 100%);
}

.esp-personal-panel > .d-flex:first-child {
    padding: 4px 2px 2px;
}

.esp-personal-panel .esp-personal-stats .esp-stat:nth-child(1) {
    border-color: #c8daf2;
    background: #eaf3ff;
}

.esp-personal-panel .esp-personal-stats .esp-stat:nth-child(2) {
    border-color: #bcd7ec;
    background: #edf7ff;
}

.esp-personal-panel .esp-personal-stats .esp-stat:nth-child(3) {
    border-color: #efc79f;
    background: #fff2e5;
}

.esp-personal-panel .esp-personal-stats .esp-stat:nth-child(4) {
    border-color: #bfe0c9;
    background: #eaf7ee;
}

.esp-personal-table-shell {
    max-height: 65vh;
    border: 1px solid #d4deeb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 8px 22px rgba(23, 35, 58, .06);
}

.esp-personal-table {
    min-width: 1280px;
}

.esp-personal-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    border-bottom-color: #cbd7e5;
    background: #e7eef7;
    color: #43546b;
}

.esp-personal-table tbody tr:nth-child(even) td {
    background: #f5f8fc;
}

.esp-personal-table tbody tr:hover td {
    background: #fff3e9;
}

.esp-personal-table tbody td:first-child {
    border-left: 4px solid transparent;
}

.esp-personal-table tbody tr:hover td:first-child {
    border-left-color: var(--esp-accent);
}

.esp-personal-table .form-control,
.esp-personal-table .form-select {
    border-color: #c7d3e1;
    background-color: #fff;
}

.esp-personal-table .form-control:focus,
.esp-personal-table .form-select:focus {
    border-color: #f47b2a;
    box-shadow: 0 0 0 .18rem rgba(244, 123, 42, .14);
}

.esp-personal-table th:first-child,
.esp-personal-table td:first-child {
    min-width: 210px;
}

.esp-personal-table textarea {
    min-width: 210px;
    resize: vertical;
}

.esp-centro-capacitacion {
    min-width: 250px;
}

.esp-personal-table .esp-vacancy-row td {
    background: #fff7ed !important;
}

.esp-personal-table .esp-vacancy-row td:first-child {
    border-left-color: #f47b2a;
}

.esp-vacancy-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border: 1px solid #efbd8c;
    border-radius: 999px;
    background: #ffe8d2;
    color: #9b4c10;
    font-size: .76rem;
    font-weight: 750;
}

.esp-vacancy-message {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 12px;
    border: 1px dashed #e6ae77;
    border-radius: 9px;
    background: rgba(255, 255, 255, .65);
    color: #8d4b16;
    font-weight: 650;
}

.esp-responsables {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.esp-person {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 7px;
    border-radius: 999px;
    background: #eef2f7;
    font-size: .75rem;
}

.esp-person-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(23, 56, 101, .10);
    color: #405a7c;
}

.esp-person-remove:hover {
    background: #fbe2e0;
    color: #b42318;
}

.esp-quick-cell {
    min-width: 210px;
    vertical-align: top !important;
}

.esp-responsible-cell {
    width: 280px;
}

.esp-date-cell {
    width: 290px;
}

.esp-inline-edit-toggle,
.esp-inline-value {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 3px 0;
    border: 0;
    border-bottom: 1px dashed #91a4bc;
    background: transparent;
    color: #315a91;
    font-size: .78rem;
    font-weight: 650;
    text-align: left;
}

.esp-inline-value {
    margin-top: 0;
    color: #263c59;
    font-size: .82rem;
}

.esp-inline-edit-toggle:hover,
.esp-inline-value:hover {
    border-bottom-color: #f47b2a;
    color: #c65b16;
}

.esp-inline-pencil {
    opacity: .65;
}

.esp-inline-static {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #5f6f83;
    font-size: .82rem;
}

.esp-quick-editor {
    min-width: 230px;
    margin-top: 9px;
    padding: 11px;
    border: 1px solid #ccd8e7;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 7px 18px rgba(23, 35, 58, .10);
}

.esp-quick-editor .form-label,
.esp-quick-date-grid label > span {
    display: block;
    margin-bottom: 4px;
    color: #53657c;
    font-size: .72rem;
    font-weight: 700;
}

.esp-quick-date-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.esp-quick-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 9px;
}

.esp-btn-compact {
    min-height: 32px;
    padding: 5px 10px;
    border-radius: 8px;
    font-size: .78rem;
}

.esp-quick-error {
    display: block;
    margin-top: 7px;
    color: #b42318;
    font-size: .72rem;
    line-height: 1.3;
}

.esp-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
    gap: 16px;
}

.esp-detail-side {
    display: grid;
    align-content: start;
    gap: 14px;
}

.esp-comment,
.esp-file {
    padding: 10px 0;
    border-bottom: 1px solid #edf0f4;
}

.esp-comment:last-child,
.esp-file:last-child {
    border-bottom: 0;
}

.esp-comment small,
.esp-file small {
    display: block;
    color: var(--esp-muted);
}

.esp-inline-form {
    display: flex;
    gap: 8px;
    align-items: end;
}

.esp-inline-form > :first-child {
    flex: 1;
}

.esp-row-actions {
    flex-wrap: nowrap;
}

/* Portada de proyectos especiales */
.esp-project-index {
    min-height: calc(100vh - 90px);
    padding: 18px;
    border: 1px solid #dbe3ee;
    border-radius: 18px;
    background:
        radial-gradient(circle at 92% 4%, rgba(244, 123, 42, .11), transparent 25%),
        linear-gradient(180deg, #eaf0f7 0, #f4f7fb 310px, #edf2f7 100%);
}

.esp-project-index .esp-hero {
    position: relative;
    overflow: hidden;
    border: 0;
    background: linear-gradient(125deg, #17243b 0%, #233a5e 60%, #31537d 100%);
    color: #fff;
    box-shadow: 0 16px 38px rgba(23, 35, 58, .18);
}

.esp-project-index .esp-hero::after {
    content: "";
    position: absolute;
    right: -42px;
    bottom: -105px;
    width: 250px;
    height: 250px;
    border: 46px solid rgba(255, 255, 255, .05);
    border-radius: 50%;
    pointer-events: none;
}

.esp-project-index .esp-hero > * {
    position: relative;
    z-index: 1;
}

.esp-project-index .esp-hero h1 {
    color: #fff;
    letter-spacing: -.025em;
}

.esp-project-index .esp-hero .esp-kicker,
.esp-project-index .esp-hero .esp-subtitle {
    color: #c9d7e9;
}

.esp-project-index .esp-hero .esp-btn-secondary {
    border-color: rgba(255, 255, 255, .27);
    background: rgba(255, 255, 255, .10);
    color: #fff;
}

.esp-project-index .esp-stats .esp-stat {
    box-shadow: 0 8px 20px rgba(23, 35, 58, .06);
}

.esp-project-index .esp-stats .esp-stat:nth-child(1) {
    border-color: #bfd6ee;
    background: linear-gradient(135deg, #e8f3ff, #f7fbff);
}

.esp-project-index .esp-stats .esp-stat:nth-child(2) {
    border-color: #efcfaa;
    background: linear-gradient(135deg, #fff1e3, #fffbf6);
}

.esp-project-index .esp-stats .esp-stat:nth-child(3) {
    border-color: #c9cbe9;
    background: linear-gradient(135deg, #f0efff, #fafaff);
}

.esp-project-index .esp-row {
    border-color: #cdd8e6;
    background: linear-gradient(90deg, #fff 0, #f8fafc 100%);
    box-shadow: 0 9px 23px rgba(23, 35, 58, .07);
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.esp-project-index .esp-row:hover {
    transform: translateY(-2px);
    border-color: #f0a16b;
    box-shadow: 0 13px 28px rgba(23, 35, 58, .12);
}

.esp-project-index .esp-row-icon {
    background: linear-gradient(135deg, #e8f2ff, #d9e9fb);
    color: #245f9d;
    box-shadow: inset 0 0 0 1px #c8ddf3;
}

.esp-project-index .esp-row-title {
    color: #172f50;
}

.esp-project-index .esp-progress {
    height: 8px;
    background: #dfe6ef;
}

.esp-project-index .esp-progress > span {
    background: linear-gradient(90deg, #ff9a56, #f47b2a);
}

/* Vista integral del proyecto especial */
.esp-project-detail {
    min-height: calc(100vh - 90px);
    padding: 18px;
    border: 1px solid #dbe3ee;
    border-radius: 18px;
    background:
        radial-gradient(circle at 96% 2%, rgba(244, 123, 42, .10), transparent 24%),
        linear-gradient(180deg, #edf2f8 0, #f6f8fb 260px, #eef2f7 100%);
}

.esp-project-detail .esp-hero {
    position: relative;
    overflow: hidden;
    border: 0;
    background: linear-gradient(125deg, #17243b 0%, #233a5e 58%, #31537d 100%);
    color: #fff;
    box-shadow: 0 16px 38px rgba(23, 35, 58, .20);
}

.esp-project-detail .esp-hero::after {
    content: "";
    position: absolute;
    right: -45px;
    bottom: -90px;
    width: 230px;
    height: 230px;
    border: 42px solid rgba(255, 255, 255, .055);
    border-radius: 50%;
    pointer-events: none;
}

.esp-project-detail .esp-hero > * {
    position: relative;
    z-index: 1;
}

.esp-project-detail .esp-hero h1 {
    color: #fff;
    letter-spacing: -.025em;
}

.esp-project-detail .esp-hero .esp-kicker,
.esp-project-detail .esp-hero .esp-subtitle {
    color: #c9d7e9;
}

.esp-project-detail .esp-hero .esp-meta span {
    padding: 5px 9px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    color: #eaf1fa;
}

.esp-project-detail .esp-hero .esp-progress-head {
    color: #eaf1fa;
}

.esp-project-detail .esp-hero .esp-progress {
    height: 9px;
    background: rgba(255, 255, 255, .18);
}

.esp-project-detail .esp-hero .esp-progress > span {
    background: linear-gradient(90deg, #ff9b58, #f47b2a);
    box-shadow: 0 0 12px rgba(244, 123, 42, .55);
}

.esp-project-detail .esp-hero .esp-btn-secondary {
    border-color: rgba(255, 255, 255, .25);
    background: rgba(255, 255, 255, .10);
    color: #fff;
}

.esp-project-detail .esp-hero .esp-btn-secondary:hover {
    background: rgba(255, 255, 255, .18);
}

.esp-project-detail .esp-tabs {
    position: sticky;
    top: 8px;
    z-index: 20;
    align-items: center;
    margin-bottom: 14px;
    padding: 9px;
    border: 1px solid #ccd8e7;
    border-radius: 14px;
    background: rgba(226, 233, 243, .94);
    box-shadow: 0 8px 22px rgba(23, 35, 58, .10);
    backdrop-filter: blur(10px);
}

.esp-project-detail .esp-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 42px;
    border-color: #d2dce9;
    background: #fff;
    color: #243853;
    font-weight: 650;
    box-shadow: 0 2px 5px rgba(23, 35, 58, .04);
    transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.esp-project-detail .esp-tab:hover {
    transform: translateY(-1px);
    border-color: #9fb2c9;
    box-shadow: 0 5px 12px rgba(23, 35, 58, .10);
}

.esp-project-detail .esp-tab.active {
    border-color: #f47b2a;
    background: linear-gradient(135deg, #f68a40, #ef6d17);
    color: #fff;
    box-shadow: 0 7px 16px rgba(244, 123, 42, .28);
}

.esp-project-detail > .esp-panel {
    border-color: #d1dbe8;
    background: #f6f8fb;
    box-shadow: 0 12px 30px rgba(23, 35, 58, .08);
}

.esp-project-detail > .esp-personal-panel {
    background: linear-gradient(180deg, #e9f0f8 0, #f5f8fb 190px, #edf2f7 100%);
}

.esp-add-document-panel {
    background: linear-gradient(135deg, #fff7ee, #f5f8fc) !important;
}

.esp-document-panel > .d-flex:first-child {
    padding: 16px 18px;
    border: 1px solid #d7e0eb;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 5px 14px rgba(23, 35, 58, .05);
}

.esp-document-panel .esp-section {
    border-color: #cfd9e6;
    background: #fff;
    box-shadow: 0 7px 18px rgba(23, 35, 58, .06);
}

.esp-document-panel .esp-section-title {
    min-height: 52px;
    padding: 13px 16px;
    border-bottom-color: #ccd7e4;
    background: linear-gradient(90deg, #e7eef7, #f3f6fa);
}

.esp-document-panel .esp-section-title h3 {
    color: #203754;
    font-size: 1rem;
}

.esp-document-panel .esp-section-title h3::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 18px;
    margin-right: 9px;
    border-radius: 999px;
    background: #f47b2a;
    vertical-align: -3px;
}

.esp-document-panel .esp-task-table th {
    border-bottom: 1px solid #cbd7e4;
    background: #f0f4f9;
    color: #53657c;
}

.esp-document-panel .esp-task-table tbody tr:nth-child(even) td {
    background: #f8fafc;
}

.esp-document-panel .esp-task-table tbody tr:hover td {
    background: #fff4eb;
}

.esp-document-panel .esp-task-table tbody td:first-child {
    border-left: 4px solid transparent;
}

.esp-document-panel .esp-task-table tbody tr:hover td:first-child {
    border-left-color: #f47b2a;
}

.esp-project-detail .esp-btn-primary {
    box-shadow: 0 6px 14px rgba(244, 123, 42, .20);
}

.esp-project-detail .esp-btn-secondary {
    box-shadow: 0 3px 9px rgba(23, 35, 58, .06);
}

.esp-project-detail .form-control,
.esp-project-detail .form-select {
    border-color: #c7d3e1;
}

.esp-project-detail .form-control:focus,
.esp-project-detail .form-select:focus {
    border-color: #f47b2a;
    box-shadow: 0 0 0 .18rem rgba(244, 123, 42, .14);
}

.esp-status-select {
    min-width: 128px;
    border-width: 1px;
    font-weight: 650;
}

.esp-status-select.is-pending {
    border-color: #e8c77d;
    background-color: #fff8e7;
    color: #785615;
}

.esp-status-select.is-progress {
    border-color: #9cc2ed;
    background-color: #edf6ff;
    color: #1f5f9e;
}

.esp-status-select.is-complete {
    border-color: #9fd0ae;
    background-color: #edf9f1;
    color: #216b3b;
}

.esp-status-select.is-blocked {
    border-color: #e4a6a6;
    background-color: #fff0f0;
    color: #962f2f;
}

.esp-status-select.is-muted {
    border-color: #cbd3dd;
    background-color: #f1f3f6;
    color: #687384;
}

.esp-document-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 2px 2px 18px;
}

.esp-document-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

.esp-view-switch {
    display: inline-flex;
    flex: 0 0 auto;
    gap: 4px;
    padding: 4px;
    border: 1px solid #dce3ed;
    border-radius: 12px;
    background: #f2f5f9;
}

.esp-view-switch button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 13px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #66748a;
    font-size: .84rem;
    font-weight: 700;
}

.esp-view-switch button:hover {
    color: #173865;
}

.esp-view-switch button.active {
    background: #fff;
    color: #173865;
    box-shadow: 0 2px 8px rgba(31, 55, 88, .12);
}

.esp-gantt-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 12px 14px;
    margin-bottom: 12px;
    border: 1px solid #e1e7ef;
    border-radius: 12px;
    background: linear-gradient(135deg, #f7f9fc, #fff);
}

.esp-gantt-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 9px 15px;
}

.esp-gantt-legend span,
.esp-gantt-no-date {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #647187;
    font-size: .76rem;
    font-weight: 650;
    white-space: nowrap;
}

.esp-gantt-legend i {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    box-shadow: inset 0 0 0 1px rgba(20, 35, 55, .08);
}

.esp-gantt-legend i.is-planned,
.esp-gantt-bar.is-planned {
    background: #66a7ea;
}

.esp-gantt-legend i.is-progress,
.esp-gantt-bar.is-progress {
    background: #f4cf32;
}

.esp-gantt-legend i.is-complete,
.esp-gantt-bar.is-complete {
    background: #82c947;
}

.esp-gantt-legend i.is-late,
.esp-gantt-bar.is-late {
    background: #ea4d4d;
}

.esp-gantt-legend i.is-muted,
.esp-gantt-bar.is-muted {
    background: #aeb6c2;
}

.esp-gantt-no-date {
    padding: 7px 10px;
    border-radius: 999px;
    background: #fff3df;
    color: #8a5b16;
}

.esp-gantt-shell {
    max-width: 100%;
    max-height: 68vh;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid #d8e0ea;
    border-radius: 13px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(31, 51, 78, .08);
}

.esp-gantt-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    color: #1c2b43;
    font-size: .76rem;
}

.esp-gantt-table th,
.esp-gantt-table td {
    height: 44px;
    padding: 0;
    border-right: 1px solid #dfe5ed;
    border-bottom: 1px solid #dfe5ed;
    background: #fff;
}

.esp-gantt-table thead th {
    position: sticky;
    z-index: 5;
    text-align: center;
    text-transform: none;
    letter-spacing: 0;
}

.esp-gantt-months th {
    top: 0;
    height: 38px;
    background: #1f3656;
    color: #fff;
    font-size: .82rem;
    font-weight: 750;
}

.esp-gantt-weeks th {
    top: 38px;
    width: 72px;
    min-width: 72px;
    height: 58px;
    background: #eaf2f7;
    color: #33445c;
    line-height: 1.05;
}

.esp-gantt-weeks th strong,
.esp-gantt-weeks th span,
.esp-gantt-weeks th small {
    display: block;
}

.esp-gantt-weeks th strong {
    margin-bottom: 3px;
    font-size: .82rem;
}

.esp-gantt-weeks th span,
.esp-gantt-weeks th small {
    font-size: .64rem;
    font-weight: 650;
}

.esp-gantt-number {
    left: 0;
    width: 48px;
    min-width: 48px;
    text-align: center;
    font-weight: 750;
}

.esp-gantt-task {
    left: 48px;
    width: 360px;
    min-width: 360px;
}

.esp-gantt-table thead .esp-gantt-number,
.esp-gantt-table thead .esp-gantt-task {
    z-index: 8;
    background: #182a44;
    color: #fff;
}

.esp-gantt-table tbody .esp-gantt-number,
.esp-gantt-table tbody .esp-gantt-task {
    position: sticky;
    z-index: 3;
    background: #fff;
}

.esp-gantt-table tbody tr:hover td,
.esp-gantt-table tbody tr:hover .esp-gantt-number,
.esp-gantt-table tbody tr:hover .esp-gantt-task {
    background-color: #f7faff;
}

.esp-gantt-table tbody tr.is-late-row .esp-gantt-number {
    box-shadow: inset 3px 0 #ea4d4d;
}

.esp-gantt-task > button {
    width: 100%;
    height: 100%;
    padding: 7px 11px;
    border: 0;
    background: transparent;
    color: inherit;
    text-align: left;
    line-height: 1.15;
}

.esp-gantt-task > button:hover strong {
    color: #1763aa;
    text-decoration: underline;
}

.esp-gantt-task strong,
.esp-gantt-task small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.esp-gantt-task strong {
    font-size: .74rem;
}

.esp-gantt-task small {
    margin-top: 3px;
    color: #7b8798;
    font-size: .64rem;
}

.esp-gantt-cell {
    position: relative;
    width: 72px;
    min-width: 72px;
}

.esp-gantt-cell.is-current,
.esp-gantt-weeks th.is-current {
    box-shadow: inset 2px 0 #f47b2a, inset -2px 0 #f47b2a;
}

.esp-gantt-weeks th.is-current::after {
    content: "Actual";
    display: block;
    margin-top: 3px;
    color: #d75c12;
    font-size: .57rem;
    font-weight: 800;
}

.esp-gantt-bar {
    position: absolute;
    inset: 6px 2px;
    width: calc(100% - 4px);
    border: 0;
    border-radius: 5px;
    box-shadow: inset 0 0 0 1px rgba(22, 35, 50, .12), 0 2px 5px rgba(28, 43, 67, .13);
    transition: filter .15s ease, transform .15s ease;
}

.esp-gantt-bar:hover {
    filter: brightness(.93) saturate(1.08);
    transform: translateY(-1px);
}

.esp-gantt-bar:focus-visible {
    outline: 3px solid rgba(23, 99, 170, .3);
    outline-offset: 1px;
}

.esp-canvas-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1080;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(15, 23, 42, .42);
    animation: esp-backdrop-in .16s ease-out;
}

.esp-detail-canvas {
    --esp-accent: #f47b2a;
    --esp-ink: #17233a;
    --esp-muted: #6b778c;
    --esp-border: #dfe5ee;
    --esp-soft: #f7f9fc;
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1081;
    width: min(640px, 100vw);
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    color: var(--esp-ink);
    box-shadow: -18px 0 46px rgba(15, 23, 42, .24);
    animation: esp-canvas-in .2s ease-out;
}

.esp-canvas-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    flex: 0 0 auto;
    padding: 20px 22px 17px;
    border-bottom: 1px solid var(--esp-border);
    background: #fff;
}

.esp-canvas-header h2 {
    margin: 0;
    font-size: 1.18rem;
    font-weight: 700;
}

.esp-canvas-close {
    width: 40px;
    height: 40px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border: 1px solid var(--esp-border);
    border-radius: 10px;
    background: #fff;
    color: var(--esp-ink);
}

.esp-canvas-close:hover {
    background: var(--esp-soft);
}

.esp-canvas-body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 22px 28px;
}

.esp-canvas-form {
    min-height: 0;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
}

.esp-canvas-form .esp-canvas-body {
    min-height: 0;
}

.esp-canvas-footer {
    display: flex;
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 9px;
    padding: 14px 22px;
    border-top: 1px solid var(--esp-border);
    background: #fff;
}

.esp-canvas-section {
    padding: 0 0 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--esp-border);
}

.esp-canvas-section:last-child {
    padding-bottom: 0;
    margin-bottom: 0;
    border-bottom: 0;
}

.esp-canvas-section > h3 {
    margin: 0 0 13px;
    font-size: .92rem;
    font-weight: 700;
}

.esp-canvas-empty {
    margin: 12px 0 0;
    color: var(--esp-muted);
    font-size: .84rem;
}

.esp-share-canvas {
    width: min(580px, 100vw);
}

.esp-share-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 5px;
    padding: 5px;
    margin-bottom: 18px;
    border: 1px solid #dfe6ef;
    border-radius: 11px;
    background: #f3f6fa;
}

.esp-share-tabs button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #68768a;
    font-size: .8rem;
    font-weight: 750;
}

.esp-share-tabs button:hover {
    color: #234b7b;
}

.esp-share-tabs button.active {
    background: #fff;
    color: #1e4f85;
    box-shadow: 0 2px 9px rgba(35, 59, 91, .12);
}

.esp-share-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 12px;
    align-items: end;
}

.esp-share-form .esp-btn-primary {
    grid-column: 1 / -1;
    justify-content: center;
}

.esp-share-auto-note {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 12px;
    margin-top: 14px;
    border: 1px solid #cfe1f5;
    border-radius: 10px;
    background: #f0f7ff;
    color: #315d8f;
    font-size: .78rem;
    line-height: 1.4;
}

.esp-share-auto-note i {
    margin-top: 1px;
    color: #2072bd;
    font-size: 1rem;
}

.esp-share-list {
    display: grid;
    gap: 8px;
}

.esp-share-person {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid #e2e7ee;
    border-radius: 11px;
    background: #fff;
}

.esp-share-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(145deg, #234b7b, #3779bb);
    color: #fff;
    font-size: .76rem;
    font-weight: 800;
}

.esp-share-team .esp-share-avatar {
    border-radius: 11px;
    background: linear-gradient(145deg, #5b43a6, #7b65c7);
    font-size: .95rem;
}

.esp-share-identity {
    min-width: 0;
}

.esp-share-identity strong,
.esp-share-identity small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.esp-share-identity strong {
    color: #23344d;
    font-size: .84rem;
}

.esp-share-identity small {
    margin-top: 2px;
    color: #778397;
    font-size: .72rem;
}

.esp-share-role {
    width: 112px;
}

.esp-share-owner {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    border-radius: 999px;
    background: #fff0dc;
    color: #a65312;
    font-size: .7rem;
    font-weight: 750;
}

.esp-share-remove {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid #ebd6d6;
    border-radius: 8px;
    background: #fff;
    color: #b34a4a;
}

.esp-share-remove:hover {
    background: #fff0f0;
}

@keyframes esp-canvas-in {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

@keyframes esp-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 950px) {
    .esp-personal-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .esp-row {
        grid-template-columns: 44px minmax(0, 1fr) auto;
    }

    .esp-row-progress {
        grid-column: 2 / -1;
    }

    .esp-template-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .esp-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .esp-project-detail,
    .esp-project-index {
        padding: 10px;
        border-radius: 12px;
    }

    .esp-project-detail .esp-tabs {
        top: 4px;
        padding: 7px;
    }

    .esp-project-detail .esp-hero .text-end {
        width: 100%;
        min-width: 100% !important;
        text-align: left !important;
    }

    .esp-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .esp-stats,
    .esp-form-grid,
    .esp-template-picker,
    .esp-template-grid {
        grid-template-columns: 1fr;
    }

    .esp-span-2 {
        grid-column: auto;
    }

    .esp-row {
        grid-template-columns: 40px 1fr;
    }

    .esp-row > .esp-btn-secondary {
        grid-column: 1 / -1;
    }

    .esp-row-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }

    .esp-row-progress {
        grid-column: 1 / -1;
    }

    .esp-task-table {
        min-width: 760px;
    }

    .esp-table-scroll {
        overflow-x: auto;
    }

    .esp-detail-canvas {
        width: 100vw;
    }

    .esp-document-heading,
    .esp-gantt-summary {
        align-items: stretch;
        flex-direction: column;
    }

    .esp-document-actions {
        align-items: stretch;
        justify-content: flex-start;
    }

    .esp-view-switch {
        align-self: flex-start;
    }

    .esp-share-form {
        grid-template-columns: 1fr;
    }

    .esp-share-form .esp-btn-primary {
        grid-column: auto;
    }

    .esp-share-person {
        grid-template-columns: 38px minmax(0, 1fr) auto;
    }

    .esp-share-role,
    .esp-share-owner {
        grid-column: 2;
        justify-self: start;
    }

    .esp-share-remove {
        grid-column: 3;
        grid-row: 1 / span 2;
    }

    .esp-gantt-task {
        width: 260px;
        min-width: 260px;
    }

    .esp-canvas-header,
    .esp-canvas-body,
    .esp-canvas-footer {
        padding-left: 16px;
        padding-right: 16px;
    }
}
