/* ==========================================================================
   TenProject bespoke calendar (grouped events)
   Ported from the "Calendario TenProject" design.
   Palette: teal #1f6f8b primary, soft greys, per-type accent colours.
   ========================================================================== */

.tc-calendar {
    --tc-primary: #1f6f8b;
    --tc-ink: #2b3a44;
    --tc-ink-soft: #4a5a64;
    --tc-muted: #6b7a86;
    --tc-line: #eef1f4;
    --tc-line-strong: #e4e9ee;
    --tc-sunday: #c0392b;
    font-family: system-ui, 'Segoe UI', Roboto, sans-serif;
    color: var(--tc-ink);
    -webkit-font-smoothing: antialiased;
}

.tc-calendar *,
.tc-calendar *::before,
.tc-calendar *::after {
    box-sizing: border-box;
}

.tc-calendar button {
    font-family: inherit;
}

/* ---------- Toolbar ---------- */
.tc-toolbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 4px 2px 12px;
    flex-wrap: wrap;
}

.tc-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tc-nav-btn {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--tc-primary);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 17px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, transform .1s ease;
}

.tc-nav-btn:hover {
    background: #1a5e77;
}

.tc-nav-btn:active {
    transform: scale(.94);
}

.tc-today-btn {
    height: 34px;
    padding: 0 16px;
    border-radius: 9px;
    background: #eaf1f4;
    color: var(--tc-primary);
    border: none;
    cursor: pointer;
    font: 600 13px system-ui;
    transition: background .15s ease;
}

.tc-today-btn:hover {
    background: #dbe8ed;
}

.tc-title {
    flex: 1 1 200px;
    text-align: center;
    font: 700 18px system-ui;
    color: var(--tc-ink);
    text-transform: capitalize;
}

/* Segmented switchers (views + layout) */
.tc-seg {
    display: inline-flex;
    background: var(--tc-line);
    border-radius: 10px;
    padding: 3px;
}

.tc-seg-btn {
    border: none;
    padding: 7px 15px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: #5a6b76;
    transition: background .15s ease, color .15s ease;
}

.tc-seg-btn:hover {
    color: var(--tc-primary);
}

.tc-seg-btn.is-active {
    background: var(--tc-primary);
    color: #fff;
}

.tc-seg-btn.is-active:hover {
    color: #fff;
}

/* ---------- Legend ---------- */
.tc-subbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 2px 2px 14px;
    flex-wrap: wrap;
    border-bottom: 1px solid var(--tc-line);
}

.tc-legend {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.tc-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tc-legend-sq {
    width: 21px;
    height: 21px;
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

.tc-legend-label {
    font: 500 12.5px system-ui;
    color: var(--tc-ink-soft);
}

/* ---------- Grid ---------- */
.tc-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f7f9fa;
    border-bottom: 1px solid var(--tc-line-strong);
}

.tc-weekday {
    padding: 9px 0;
    text-align: center;
    font: 600 12px system-ui;
    color: var(--tc-muted);
    border-right: 1px solid var(--tc-line);
}

.tc-weekday:last-child {
    border-right: none;
}

.tc-weekday.is-sunday {
    color: var(--tc-sunday);
}

.tc-week {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.tc-cell {
    padding: 8px 8px 10px;
    border-right: 1px solid var(--tc-line);
    border-bottom: 1px solid var(--tc-line);
    background: #ffffff;
    min-height: var(--tc-cell-h, 118px);
    display: flex;
    flex-direction: column;
}

.tc-cell:nth-child(7n) {
    border-right: none;
}

/* cell shading states */
.tc-cell.is-outside {
    background: #fbfbfc;
}

.tc--weekend .tc-cell.is-sat {
    background: #f6f8f4;
}

.tc--weekend .tc-cell.is-sun {
    background: #fdf5f6;
}

.tc-cell.is-holiday,
.tc-cell.is-closure {
    background: #fbf1f2;
}

.tc-cell.is-today {
    background: #eef6f0;
}

/* clickable (editing) cells */
.tc-calendar.is-editable .tc-cell {
    cursor: pointer;
}

.tc-calendar.is-editable .tc-cell:hover {
    box-shadow: inset 0 0 0 2px rgba(31, 111, 139, .25);
}

.tc-cell-head {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 5px;
}

.tc-daynum {
    font: 600 13px system-ui;
    color: #3a4a55;
}

.tc-daynum.is-sunday {
    color: var(--tc-sunday);
}

.tc-cell.is-outside .tc-daynum {
    color: #c3ccd2;
}

.tc-daynum.is-today {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border-radius: 12px;
    background: var(--tc-primary);
    color: #fff;
    font: 700 13px system-ui;
}

.tc-groups {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ---------- Chips ---------- */
.tc-icon {
    display: inline-flex;
    align-items: center;
    flex: none;
}

.tc-chip {
    cursor: pointer;
    line-height: 1.15;
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    transition: filter .12s ease;
}

.tc-chip:hover {
    filter: brightness(.97);
}

.tc-chip b {
    font-weight: 700;
}

/* bar */
.tc-chip--bar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border-radius: 7px;
}

.tc-chip--bar .tc-chip-label {
    opacity: .9;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* pill */
.tc-chip--pill {
    align-self: flex-start;
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 11px;
    border-radius: 999px;
}

/* count */
.tc-chip--count {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 1px 2px;
    background: none;
}

.tc-chip--count .tc-count-sq {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex: none;
}

.tc-chip--count .tc-count-label {
    font-size: 12px;
    color: #33475a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- Day view ---------- */
.tc-dayview {
    padding: 18px 2px 8px;
}

.tc-dayview-empty {
    padding: 48px;
    text-align: center;
    color: #9aa7b0;
    font: 500 14px system-ui;
}

.tc-dayview-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 780px;
}

.tc-daycard {
    border: 1px solid var(--tc-line-strong);
    border-radius: 10px;
    overflow: hidden;
}

.tc-daycard-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 13px;
    font-size: 13px;
    font-weight: 600;
}

.tc-person-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 9px 14px;
    border-top: 1px solid #f3f5f6;
}

.tc-person-row.is-link {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}

.tc-person-row.is-link:hover {
    background: #f7fafb;
}

.tc-person-name {
    font: 600 13px system-ui;
    color: var(--tc-ink);
    min-width: 200px;
}

.tc-person-sub {
    font: 400 12.5px system-ui;
    color: var(--tc-muted);
    flex: 1;
}

.tc-person-meta {
    font: 400 11.5px system-ui;
    color: #9aa7b0;
}

/* ---------- Popover ---------- */
.tc-pop-overlay {
    position: fixed;
    inset: 0;
    z-index: 1060;
}

.tc-pop {
    position: fixed;
    width: 268px;
    background: #fff;
    border: 1px solid #e0e6ea;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(20, 40, 55, .20);
    z-index: 1061;
    overflow: hidden;
}

.tc-pop-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 14px;
    color: #28353e;
    font-size: 13px;
}

.tc-pop-head b {
    font-weight: 700;
}

.tc-pop-body {
    max-height: 300px;
    overflow: auto;
}

.tc-pop-row {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 8px 14px;
    border-top: 1px solid #f3f5f6;
    text-decoration: none;
}

.tc-pop-row.is-link {
    cursor: pointer;
}

.tc-pop-row.is-link:hover {
    background: #f7fafb;
}

.tc-pop-row .tc-person-name {
    min-width: 0;
}

.tc-pop-row .tc-person-sub {
    flex: none;
}

/* Popover is appended to <body>, outside the .tc-calendar variable scope,
   so these use literal colours rather than var(--tc-*). */
.tc-pop-name {
    font: 600 13px system-ui;
    color: #2b3a44;
}

.tc-pop-sub {
    font: 400 12px system-ui;
    color: #6b7a86;
}

.tc-pop-meta {
    font: 400 11px system-ui;
    color: #9aa7b0;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
    .tc-title {
        order: 5;
        flex-basis: 100%;
    }

    .tc-person-name {
        min-width: 130px;
    }

    .tc-cell {
        padding: 6px 5px 8px;
    }
}
