:root {
    --pc-orange: #e99138;
    --pc-orange-dark: #d87d26;
    --pc-gray-950: #111827;
    --pc-gray-900: #2b2f38;
    --pc-gray-800: #374151;
    --pc-gray-700: #5e5e5e;
    --pc-gray-500: #9ca3af;
    --pc-gray-300: #d8dde6;
    --pc-gray-200: #e6e8ec;
    --pc-gray-100: #f5f6f8;
    --pc-white: #ffffff;
    --pc-radius-lg: 24px;
    --pc-radius-md: 16px;
    --pc-shadow: 0 18px 45px rgba(18, 25, 38, 0.08);
    --pc-shadow-soft: 0 14px 34px rgba(15, 23, 42, 0.07);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--pc-white);
    color: var(--pc-gray-900);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 78px 320px 1fr;
    padding: 18px;
    gap: 0;
}

.app-sidebar {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
    border: 1px solid var(--pc-gray-200);
    border-left: 0;
    border-radius: 0 24px 24px 0;
    padding: 18px;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 36px);
    overflow: hidden;
}

.app-rail {
    background: white;
    border-radius: 24px 0 0 24px;
    border: 1px solid var(--pc-gray-200);
    border-right: 1px solid var(--pc-gray-200);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 18px 12px;
    gap: 24px;
    z-index: 2;
}

.rail-logo img {
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.rail-nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.rail-link {
    width: 100%;
    height: 54px;
    border: 0;
    border-radius: 18px;
    background: transparent;
    font-size: 22px;
    transition: all .18s ease;
}

.rail-link:hover,
.rail-link.active {
    background: rgba(233,145,56,.12);
}

.rail-bottom {
    margin-top: auto;
    width: 100%;
    padding-top: 12px;
    border-top: 1px solid var(--pc-gray-200);
}

.rail-logout {
    color: #ef4444;
}

.rail-logout:hover {
    background: rgba(239, 68, 68, .10);
    color: #dc2626;
}

.context-panel {
    display: none;
    flex-direction: column;
    height: 100%;
}

.context-panel.active {
    display: flex;
}

#contextCalendar {
    min-height: 100%;
}

.sidebar-context-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 24px;
}

.context-placeholder {
    padding: 18px;
    border-radius: 18px;
    background: #f8fafc;
    border: 1px solid var(--pc-gray-200);
}

.sidebar-brand {
    margin-bottom: 0;
}

.sidebar-brand img {
    width: 170px;
    height: auto;
    display: block;
}

.sidebar-brand-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.sidebar-close,
.mobile-menu-btn {
    display: none;
}

.sidebar-nav {
    display: grid;
    gap: 8px;
}

.sidebar-link {
    height: 42px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border-radius: 14px;
    color: var(--pc-gray-700);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(233, 145, 56, 0.12);
    color: var(--pc-orange-dark);
}

.sidebar-section {
    margin-top: 30px;
    padding-top: 22px;
    border-top: 1px solid var(--pc-gray-200);
}

.calendar-list-section {
    margin-top: 0;
}

.sidebar-title {
    color: var(--pc-gray-500);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .08em;
    font-weight: 800;
    margin-bottom: 14px;
}

#calendarList {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.calendar-group {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
}


.calendar-group-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 2px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    transition: background .18s ease;
}

.calendar-group-header:hover {
    background: rgba(17, 24, 39, 0.035);
}

.calendar-group-main {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.calendar-group-chevron {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--pc-gray-500);
    font-size: 16px;
    font-weight: 900;
    line-height: 1;
    transform: rotate(90deg);
    transition:
        transform .18s ease,
        background .18s ease,
        color .18s ease;
}

.calendar-group-header:hover .calendar-group-chevron {
    background: rgba(233, 145, 56, 0.12);
    color: var(--pc-orange-dark);
}

.calendar-group.is-collapsed .calendar-group-chevron {
    transform: rotate(0deg);
}

.calendar-group-title {
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: var(--pc-gray-500);
}

.calendar-group-count {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 24, 39, 0.05);
    color: var(--pc-gray-500);
    font-size: 11px;
    font-weight: 800;
}

.calendar-group-items {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 9px;
    animation: calendarGroupReveal .16s ease both;
}
.calendar-group-items[hidden] {
    display: none;
}

@keyframes calendarGroupReveal {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calendar-check.calendar-card {
    position: relative;
    width: 100%;
    min-height: 68px;

    display: flex;
    align-items: center;
    gap: 12px;
	align-items: center;
    gap: 10px;
    margin: 0;
    padding: 12px;
    border: 1px solid rgba(230, 232, 236, 0.92);
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 252, 0.9));
    color: var(--pc-gray-700);
    cursor: pointer;
    user-select: none;
    box-shadow: 0 1px 1px rgba(15, 23, 42, 0.03);
    transition:
        transform .18s ease,
        box-shadow .18s ease,
        border-color .18s ease,
        background .18s ease,
        opacity .18s ease;
}

.calendar-check.calendar-card:hover {
    transform: translateY(-1px);
    border-color: rgba(233, 145, 56, 0.28);
    box-shadow: var(--pc-shadow-soft);
    background: #ffffff;
}

.calendar-check.calendar-card input {
    position: absolute;
    inset: 0;
    opacity: 0;
    pointer-events: none;
}

.calendar-card.is-hidden {
    opacity: .56;
}

.calendar-card.is-hidden .calendar-name,
.calendar-card.is-hidden .calendar-meta,
.calendar-card.is-hidden .calendar-badge,
.calendar-card.is-hidden .calendar-dot {
    filter: grayscale(1);
}

.calendar-visual {
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-dot {
    width: 12px;
    height: 12px;
    border-radius: 999px;
    flex: 0 0 auto;
}

.calendar-content {
    min-width: 0;
    display: grid;
    gap: 4px;
}

.calendar-content-top {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-name {
    min-width: 0;
    color: var(--pc-gray-900);
    font-size: 14px;
    font-weight: 850;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-meta {
    color: var(--pc-gray-500);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-badge {
    flex: 0 0 auto;
    height: 20px;
    padding: 0 7px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(233, 145, 56, 0.11);
    color: var(--pc-orange-dark);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.calendar-switch {
    width: 34px;
    height: 20px;
    padding: 2px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    background: #d7dce5;
    transition: all .18s ease;
}

.calendar-switch-knob {
    width: 16px;
    height: 16px;
    border-radius: 999px;
    background: white;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.20);
    transition: transform .18s ease;
}

.calendar-card.is-visible .calendar-switch {
    background: var(--pc-orange);
}

.calendar-card.is-visible .calendar-switch-knob {
    transform: translateX(14px);
}

.calendar-empty-modern {
    padding: 18px;
    border-radius: 20px;
    background: #f8fafc;
    border: 1px dashed var(--pc-gray-300);
    text-align: center;
}

.calendar-empty-icon {
    width: 42px;
    height: 42px;
    margin: 0 auto 10px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: rgba(233, 145, 56, 0.12);
    font-size: 20px;
}

.calendar-empty-title {
    color: var(--pc-gray-900);
    font-size: 14px;
    font-weight: 900;
}

.calendar-empty-text {
    margin-top: 4px;
    color: var(--pc-gray-500);
    font-size: 12px;
    line-height: 1.4;
}

.dot {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    flex: 0 0 auto;
}

.dot-orange {
    background: #f2a65a;
}

.dot-blue {
    background: #75a7ff;
}

.dot-green {
    background: #72d49a;
}

.sidebar-spacer {
    flex: 1 1 auto;
}

.sidebar-footer {
    margin-top: 16px;
    margin-bottom: 16px;
}

.sidebar-footer .btn {
    height: 44px;
}

.app-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-left: 18px;
}

.app-header {
    height: 76px;
    background: var(--pc-white);
    border: 1px solid var(--pc-gray-200);
    border-radius: var(--pc-radius-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-header h1 {
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 0 8px;
}

.btn {
    border-radius: 13px;
    font-weight: 700;
    font-size: 14px;
}

.btn-light {
    background: #f7f8fa;
    border-color: #edf0f3;
    color: var(--pc-gray-700);
}

.btn-light:hover,
.btn-light.active {
    background: rgba(233, 145, 56, 0.12);
    border-color: rgba(233, 145, 56, 0.2);
    color: var(--pc-orange-dark);
}

.pietro-btn,
.btn-primary {
    background: var(--pc-orange);
    border-color: var(--pc-orange);
}

.pietro-btn:hover,
.btn-primary:hover {
    background: var(--pc-orange-dark);
    border-color: var(--pc-orange-dark);
}

.calendar-panel {
    background: var(--pc-white);
    border: 1px solid var(--pc-gray-200);
    border-radius: var(--pc-radius-lg);
    padding: 18px;
    min-height: calc(100vh - 130px);
    overflow: hidden;
}

#calendar {
    height: calc(100vh - 170px);
}

.toastui-calendar-layout {
    border: 0 !important;
}

.toastui-calendar-panel {
    border-color: var(--pc-gray-200) !important;
}

.toastui-calendar-day-name-item,
.toastui-calendar-weekday-grid-date {
    color: var(--pc-gray-700) !important;
}

.toastui-calendar-template-monthDayName {
    font-weight: 800;
    color: var(--pc-gray-500);
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    z-index: 80;
    transition: all .2s ease;
}

.mobile-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.account-card {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    margin-bottom: 22px;
    border-radius: 18px;
    background:
        linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,252,.96));
    border: 1px solid var(--pc-gray-200);
    text-align: left;
    transition: all .18s ease;
}

.account-card:hover {
    border-color: rgba(233, 145, 56, 0.24);
    box-shadow: var(--pc-shadow-soft);
}

.account-avatar {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: rgba(233, 145, 56, 0.14);
    color: var(--pc-orange-dark);
    font-weight: 900;
    flex: 0 0 auto;
}

.account-meta {
    min-width: 0;
    flex: 1;
}

.account-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--pc-gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-email {
    font-size: 12px;
    color: var(--pc-gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-chevron {
    color: var(--pc-gray-500);
    font-size: 12px;
}

body.sidebar-open {
    overflow: hidden;
}

.mini-calendar-card {
    width: 100%;
    max-width: 100%;
    margin-top: auto;
    margin-bottom: 0;
    padding: 14px;
    border-radius: 22px;
    background: #f8fafc;
    border: 1px solid var(--pc-gray-200);
    overflow: hidden;
}

.mini-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
}

.mini-calendar-title {
    min-width: 0;
    flex: 1;
    text-align: center;
    font-size: 13px;
    font-weight: 800;
    color: var(--pc-gray-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mini-calendar-nav {
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--pc-gray-700);
    font-size: 18px;
    line-height: 1;
    transition: all .18s ease;
}

.mini-calendar-nav:hover {
    background: rgba(233, 145, 56, 0.12);
    color: var(--pc-orange-dark);
}

.mini-calendar-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
}

.mini-calendar-weekday {
    min-width: 0;
    text-align: center;
    font-size: 10px;
    font-weight: 800;
    color: var(--pc-gray-500);
    padding-bottom: 4px;
}

.mini-calendar-day {
    width: 100%;
    min-width: 0;
    height: 26px;
    padding: 0;
    border-radius: 999px;
    border: 0;
    background: transparent;
    font-size: 11px;
    font-weight: 700;
    color: var(--pc-gray-700);
    transition: all .18s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mini-calendar-day:hover {
    background: rgba(233, 145, 56, 0.12);
    color: var(--pc-orange-dark);
}

.mini-calendar-day.is-today {
    background: var(--pc-orange);
    color: white;
}

.mini-calendar-day.is-active {
    box-shadow: inset 0 0 0 2px rgba(233, 145, 56, 0.35);
}

.mini-calendar-day.is-muted {
    opacity: .32;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-shell {
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: white;
    border-radius: 28px;
    border: 1px solid var(--pc-gray-200);
    padding: 42px;
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
}

.login-logo img {
    width: 190px;
    height: auto;
}

.login-title {
    margin: 0;
    font-size: 30px;
    font-weight: 900;
    text-align: center;
}

.login-subtitle {
    margin-top: 10px;
    margin-bottom: 30px;
    text-align: center;
    color: var(--pc-gray-500);
}

.login-form {
    display: grid;
    gap: 18px;
}

.login-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--pc-gray-700);
}

.login-field .form-control {
    height: 50px;
    border-radius: 14px;
    border: 1px solid var(--pc-gray-200);
    padding: 0 16px;
    font-size: 14px;
}

.login-field .form-control:focus {
    border-color: rgba(233, 145, 56, 0.45);
    box-shadow: 0 0 0 4px rgba(233, 145, 56, 0.12);
}

.login-error {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
    border-radius: 14px;
    padding: 14px;
    font-size: 14px;
    font-weight: 600;
}

@media (max-width: 992px) {
    .mobile-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 38px;
        height: 38px;
        padding: 0;
        font-size: 22px;
        line-height: 1;
    }

    .app-shell {
        display: block;
        padding: 12px;
    }

    .app-rail {
        display: none;
    }

    .app-sidebar {
        position: fixed;
        top: 12px;
        left: 12px;
        bottom: 12px;
        width: min(320px, calc(100vw - 24px));
        z-index: 100;
        transform: translateX(calc(-100% - 24px));
        transition: transform .22s ease;
        min-height: auto;
        overflow-y: auto;
        border-radius: 24px;
        border-left: 1px solid var(--pc-gray-200);
    }

    .app-sidebar.is-open {
        transform: translateX(0);
    }

    .app-main {
        gap: 12px;
        margin-left: 0;
    }

    .app-header {
        height: auto;
        padding: 16px;
        align-items: flex-start;
        gap: 14px;
        flex-direction: column;
    }

    .header-left,
    .header-right {
        flex-wrap: wrap;
    }

    .calendar-panel {
        min-height: calc(100vh - 120px);
        padding: 12px;
    }

    #calendar {
        height: calc(100vh - 150px);
    }
}



.calendar-group-header {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
}

.calendar-group-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-group-chevron {
    font-size: 12px;
    color: var(--pc-gray-500);
    transition: transform .18s ease;
}

.calendar-group.is-collapsed .calendar-group-chevron {
    transform: rotate(-90deg);
}

.calendar-group-items {
    overflow: hidden;
    transition:
        opacity .18s ease,
        transform .18s ease,
        max-height .25s ease;
    max-height: 1000px;
    opacity: 1;
}

.calendar-group.is-collapsed .calendar-group-items {
    max-height: 0;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
}


/* ------------------------------------------------------------
   Sticky calendar workspace
   ------------------------------------------------------------ */

@media (min-width: 993px) {
    .app-shell {
        align-items: start;
    }

    .app-rail,
    .app-sidebar {
        position: sticky;
        top: 18px;
        height: calc(100vh - 36px);
        max-height: calc(100vh - 36px);
    }

    .app-sidebar {
        overflow: hidden;
    }

    #calendarList {
        max-height: calc(100vh - 430px);
        overflow-y: auto;
        padding-right: 4px;
        scrollbar-width: thin;
        scrollbar-color: rgba(17, 24, 39, 0.18) transparent;
    }

    #calendarList::-webkit-scrollbar {
        width: 6px;
    }

    #calendarList::-webkit-scrollbar-thumb {
        background: rgba(17, 24, 39, 0.16);
        border-radius: 999px;
    }

    .app-main {
        align-self: start;
        min-height: calc(100vh - 36px);
    }

    .app-header {
        position: sticky;
        top: 18px;
        z-index: 40;
        backdrop-filter: blur(18px);
        box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
    }

    .calendar-panel {
        position: sticky;
        top: 112px;
        height: calc(100vh - 130px);
        min-height: 560px;
    }

    #calendar {
        height: 100%;
        min-height: 520px;
    }
}

@media (max-width: 992px) {
    .app-header {
        position: sticky;
        top: 12px;
        z-index: 40;
        backdrop-filter: blur(18px);
        box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
    }

    .calendar-panel {
        position: relative;
        top: auto;
    }
}



/* ------------------------------------------------------------
   Sidebar scroll polish: fixed footer + mini calendar visible
   ------------------------------------------------------------ */

#contextCalendar {
    min-height: 0;
    overflow: hidden;
}

.calendar-list-section {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.calendar-list-section .sidebar-title {
    flex: 0 0 auto;
}

#calendarList {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0;
    margin-right: 0;
    scrollbar-width: none;
    -ms-overflow-style: none;
    mask-image: linear-gradient(
        180deg,
        transparent 0,
        #000 14px,
        #000 calc(100% - 14px),
        transparent 100%
    );
}

#calendarList::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.sidebar-spacer {
    display: none;
}

.sidebar-footer {
    flex: 0 0 auto;
    margin-top: 14px;
    margin-bottom: 14px;
}

.mini-calendar-card {
    flex: 0 0 auto;
    margin-top: 0;
}

/* ------------------------------------------------------------
   Sticky calendar workspace refined
   ------------------------------------------------------------ */

@media (min-width: 993px) {
    .app-shell {
        align-items: start;
    }

    .app-rail,
    .app-sidebar {
        position: sticky;
        top: 18px;
        height: calc(100vh - 36px);
        max-height: calc(100vh - 36px);
    }

    .app-sidebar {
        overflow: hidden;
    }

    .app-main {
        align-self: start;
        min-height: calc(100vh - 36px);
    }

    .app-header {
        position: sticky;
        top: 18px;
        z-index: 40;
        backdrop-filter: blur(18px);
        box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
    }

    .calendar-panel {
        position: sticky;
        top: 112px;
        height: calc(100vh - 130px);
        min-height: 560px;
    }

    #calendar {
        height: 100%;
        min-height: 520px;
    }
}

@media (max-width: 992px) {
    #contextCalendar {
        overflow: visible;
    }

    .calendar-list-section {
        flex: initial;
        min-height: initial;
        overflow: visible;
    }

    #calendarList {
        max-height: none;
        overflow: visible;
        mask-image: none;
    }

    .sidebar-footer {
        margin-top: 16px;
        margin-bottom: 16px;
    }

    .mini-calendar-card {
        margin-top: 0;
    }

    .app-header {
        position: sticky;
        top: 12px;
        z-index: 40;
        backdrop-filter: blur(18px);
        box-shadow: 0 14px 32px rgba(15, 23, 42, 0.06);
    }

    .calendar-panel {
        position: relative;
        top: auto;
    }
}



/* ------------------------------------------------------------
   Calendar groups compact flow when collapsed
   ------------------------------------------------------------ */

.calendar-list-section {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden;
}

#calendarList {
    flex: 0 1 auto;
    align-content: start;
    justify-content: start;
    gap: 16px;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#calendarList::-webkit-scrollbar {
    display: none;
}

.calendar-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.calendar-group.is-collapsed {
    gap: 0;
}

.calendar-group.is-collapsed .calendar-group-items {
    max-height: 0;
    margin-top: 0;
    padding-top: 0;
    opacity: 0;
    transform: translateY(-4px);
    pointer-events: none;
}

.calendar-group-header {
    min-height: 28px;
}



/* ------------------------------------------------------------
   TOAST UI popup viewport safety
   ------------------------------------------------------------ */

.toastui-calendar-popup-container,
.toastui-calendar-popup,
.toastui-calendar-detail-container,
.toastui-calendar-form-container {
    max-width: min(360px, calc(100vw - 32px)) !important;
}

.toastui-calendar-popup-container {
    z-index: 9999 !important;
    position: fixed !important;
    will-change: top, left;
}
.toastui-calendar-detail-container,
.toastui-calendar-form-container {
    overflow: hidden !important;
    border-radius: 18px !important;
}

.toastui-calendar-popup-section {
    max-width: 100%;
}

.toastui-calendar-popup-detail .toastui-calendar-content,
.toastui-calendar-popup-detail-item,
.toastui-calendar-popup-detail-location {
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

@media (max-width: 1400px) {
    .toastui-calendar-popup-container {
        left: auto !important;
        right: 24px !important;
    }
}

@media (max-width: 992px) {
    .toastui-calendar-popup-container {
        left: 16px !important;
        right: 16px !important;
        width: auto !important;
    }
}

.toastui-calendar-detail-container,
.toastui-calendar-form-container {
    max-height: min(680px, calc(100vh - 36px)) !important;
    overflow-y: auto !important;
}

.toastui-calendar-popup-container * {
    box-sizing: border-box;
}

/* ------------------------------------------------------------
   Calendar groups drag & drop
   ------------------------------------------------------------ */

.calendar-check.calendar-card {
    grid-template-columns: 18px 26px minmax(0, 1fr) 38px;
}

.calendar-drag-handle {
    width: 18px;
    height: 32px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--pc-gray-500);
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -4px;
    cursor: grab;
    opacity: .42;
    transition:
        opacity .18s ease,
        color .18s ease,
        background .18s ease,
        transform .18s ease;
}

.calendar-drag-handle:hover {
    opacity: 1;
    color: var(--pc-orange-dark);
    background: rgba(233, 145, 56, 0.12);
}

.calendar-drag-handle:active {
    cursor: grabbing;
    transform: scale(.96);
}

.calendar-card.is-dragging {
    opacity: .42;
    transform: scale(.985);
    border-color: rgba(233, 145, 56, 0.44);
    box-shadow: none;
}

.calendar-group-items {
    min-height: 8px;
    border-radius: 18px;
}

.calendar-group-items.is-drop-target {
    min-height: 52px;
    outline: 2px dashed rgba(233, 145, 56, 0.52);
    outline-offset: 4px;
    background: rgba(233, 145, 56, 0.06);
}

body.is-calendar-dragging .calendar-check.calendar-card {
    cursor: default;
}

body.is-calendar-dragging .calendar-group-items {
    transition:
        background .18s ease,
        outline-color .18s ease,
        min-height .18s ease;
}

body.is-calendar-dragging .calendar-group.is-collapsed .calendar-group-items {
    max-height: 120px;
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

@media (max-width: 720px) {
    .calendar-check.calendar-card {
        grid-template-columns: 16px 22px minmax(0, 1fr) 34px;
    }

    .calendar-drag-handle {
        width: 16px;
        font-size: 13px;
    }
}

.calendar-group,
.calendar-group-items,
.calendar-check.calendar-card {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.calendar-group {
    align-items: stretch;
}

.calendar-group-items {
    align-items: stretch;
}

.calendar-check.calendar-card {
    display: flex;
    align-items: center;
}
.calendar-visual {
    flex-shrink: 0;
}

.calendar-content {
    width: 100%;
    min-width: 0;
}

.calendar-content-top {
    width: 100%;
    min-width: 0;
}

.calendar-name {
    min-width: 0;
    max-width: none;
}

.calendar-content {
    flex: 1 1 auto;
    min-width: 0;
}

.calendar-switch {
    flex-shrink: 0;
    margin-left: auto;
}

.mini-calendar-card.is-collapsed .mini-calendar-body {
    display: none;
}

.mini-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.mini-calendar-card.is-collapsed .mini-calendar-header {
    margin-bottom: 0;
}

/* Flechas unificadas */
.mini-calendar-toggle,
.calendar-list-section::before,
.calendar-list-section::after {
    width: 22px;
    height: 22px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 999px;
    border: 0;

    background: transparent;
    color: var(--pc-gray-500);

    font-size: 13px;
    font-weight: 900;
    line-height: 1;

    pointer-events: none;

    transition:
        opacity .18s ease,
        color .18s ease,
        background .18s ease,
        transform .18s ease;
}

.mini-calendar-toggle {
    cursor: pointer;
    pointer-events: auto;
}

.mini-calendar-toggle:hover {
    background: rgba(233, 145, 56, 0.12);
    color: var(--pc-orange-dark);
}

.calendar-list-section {
    position: relative;
}

.calendar-list-section::before,
.calendar-list-section::after {
    position: absolute;
    left: 50%;
    z-index: 6;
    opacity: 0;
    transform: translateX(-50%);
}

.calendar-list-section::before {
    content: "︿";
    top: 34px;
}

.calendar-list-section::after {
    content: "﹀";
    bottom: 4px;
}
.calendar-list-section:has(#calendarList.has-scroll-top)::before {
    opacity: 1;
}

.calendar-list-section:has(#calendarList.has-scroll-bottom)::after {
    opacity: 1;
}

.calendar-list-section::before,
.calendar-list-section::after {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4;

    width: 22px;
    height: 22px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 999px;

    background: rgba(255,255,255,.82);
    backdrop-filter: blur(8px);

    color: rgba(100,116,139,.9);

    font-size: 11px;
    font-weight: 800;

    pointer-events: none;

    transition:
        opacity .18s ease,
        transform .18s ease;
}

.calendar-list-section::before {
    content: "⌄";
    top: 35px;
}

.calendar-list-section::after {
    content: "⌃";
    bottom: 0px;
}

.calendar-list-section::before {
    background:
        linear-gradient(
            180deg,
            rgba(255,255,255,.96),
            rgba(255,255,255,.72)
        );
}

.calendar-list-section::after {
    background:
        linear-gradient(
            0deg,
            rgba(255,255,255,.96),
            rgba(255,255,255,.72)
        );
}	



.calendar-list-section {
    position: relative;
}

.calendar-list-section::before,
.calendar-list-section::after {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 6;

    width: 22px;
    height: 22px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 999px;

    color: rgba(100,116,139,.82);

    font-size: 12px;
    font-weight: 900;

    pointer-events: none;

    opacity: 0;

    transition:
        opacity .18s ease,
        transform .18s ease;
}

.calendar-list-section::before {
    content: "﹀";
    top: 34px;
}

.calendar-list-section::after {
    content: "︿";
    bottom: 4px;
}

#calendarList.has-scroll-top + * {}

.calendar-list-section:has(#calendarList.has-scroll-top)::before {
    opacity: 1;
}

.calendar-list-section:has(#calendarList.has-scroll-bottom)::after {
    opacity: 1;
}

.calendar-group.is-collapsed .calendar-group-items {
    display: none;
}

.calendar-group.is-collapsed {
    gap: 0;
}

.calendar-group.is-collapsed .calendar-group-header {
    margin-bottom: 0;
}


/* PietroCal list view
   ------------------------------------------------------------
   Vista propia de PietroCal para agenda/listado.
   Usa una estética compatible con Toast UI sin depender de
   internals frágiles del componente.
*/

.pietro-calendar-list-view {
    width: 100%;
    min-height: 100%;
    color: var(--pc-gray-900);
    background: var(--pc-white);
}

.pietro-calendar-list-view.d-none {
    display: none !important;
}

body.is-list-view .calendar-panel {
    position: relative;
    top: auto;
    height: auto;
    min-height: calc(100vh - 130px);
    overflow: visible;
}

body.is-list-view #calendar {
    display: none !important;
    height: auto;
    min-height: 0;
}

.pietro-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 0 18px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--pc-gray-200);
}

.pietro-list-title {
    font-size: 18px;
    line-height: 1.2;
    font-weight: 800;
    color: var(--pc-gray-900);
}

.pietro-list-counter {
    flex: 0 0 auto;
    color: var(--pc-gray-500);
    font-size: 13px;
    font-weight: 700;
}

.pietro-list-empty {
    margin-top: 18px;
    padding: 28px;
    border: 1px dashed var(--pc-gray-300);
    border-radius: var(--pc-radius-md);
    color: var(--pc-gray-500);
    background: #f8fafc;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}

.pietro-list-day {
    display: grid;
    grid-template-columns: 156px minmax(0, 1fr);
    gap: 18px;
    padding: 18px 0;
    border-bottom: 1px solid var(--pc-gray-200);
}

.pietro-list-day:last-child {
    border-bottom: 0;
}

.pietro-list-day-header {
    position: sticky;
    top: 112px;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pietro-list-day-name {
    color: var(--pc-gray-900);
    font-size: 14px;
    font-weight: 800;
    text-transform: capitalize;
}

.pietro-list-day-date {
    color: var(--pc-gray-500);
    font-size: 12px;
    font-weight: 700;
    text-transform: capitalize;
}

.pietro-list-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.pietro-list-event {
    display: grid;
    grid-template-columns: 8px 116px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: var(--pc-white);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition:
        border-color .16s ease,
        box-shadow .16s ease,
        transform .16s ease;
}

.pietro-list-event:hover {
    border-color: var(--pc-gray-300);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    transform: translateY(-1px);
}

.pietro-list-event-marker {
    display: block;
    width: 8px;
    height: 100%;
    min-height: 38px;
    border-radius: 999px;
}

.pietro-list-event-time {
    color: var(--pc-gray-700);
    font-size: 12px;
    line-height: 1.35;
    font-weight: 800;
    white-space: nowrap;
}

.pietro-list-event-content {
    min-width: 0;
}

.pietro-list-event-title {
    color: var(--pc-gray-900);
    font-size: 14px;
    line-height: 1.35;
    font-weight: 800;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pietro-list-event-meta {
    margin-top: 3px;
    color: var(--pc-gray-500);
    font-size: 12px;
    line-height: 1.35;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pietro-list-event-description {
    margin-top: 6px;
    color: var(--pc-gray-700);
    font-size: 12px;
    line-height: 1.45;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.pietro-list-event.toastui-calendar-template-allday .pietro-list-event-time {
    color: var(--pc-orange-dark);
}

@media (max-width: 992px) {
    .pietro-list-day {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .pietro-list-day-header {
        position: static;
        flex-direction: row;
        align-items: baseline;
        justify-content: space-between;
        gap: 10px;
    }

    .pietro-list-event {
        grid-template-columns: 7px 92px minmax(0, 1fr);
        gap: 10px;
    }
}

@media (max-width: 640px) {
    .pietro-list-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .pietro-list-event {
        grid-template-columns: 7px minmax(0, 1fr);
    }

    .pietro-list-event-time {
        grid-column: 2;
        white-space: normal;
    }

    .pietro-list-event-content {
        grid-column: 2;
    }
}

.toastui-calendar-weekday-event-dot {
	color: red !important;
}

