.tf-date {
    width: 100%;
    min-width: 0;
}

.tf-date__field {
    display: flex;
    height: 2.25rem;
    border: 1px solid var(--border-color);
    border-radius: .375rem;
    background: var(--surface-color);
}

.tf-date__field:focus-within,
.tf-date.is-open .tf-date__field {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--primary-color) 14%, transparent);
}

.tf-date__input {
    flex: 1;
    min-width: 0;
    width: 100%;
    padding: .375rem .625rem;
    border: 0;
    border-radius: inherit;
    background: transparent;
    color: var(--text-primary);
    font-size: .8125rem;
    font-variant-numeric: tabular-nums;
    outline: none;
}

.tf-date__input::placeholder {
    color: var(--text-secondary);
}

.tf-date__trigger {
    display: grid;
    place-items: center;
    flex: 0 0 2.125rem;
    padding: 0;
    border: 0;
    border-left: 1px solid var(--border-color);
    border-radius: 0 .32rem .32rem 0;
    background: color-mix(in srgb, var(--primary-color) 6%, transparent);
    color: var(--primary-color);
    font-size: 1rem;
}

.tf-date__trigger:hover:not(:disabled) {
    background: color-mix(in srgb, var(--primary-color) 12%, transparent);
}

.tf-date__input:disabled,
.tf-date__trigger:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.tf-date.is-invalid .tf-date__field {
    border-color: var(--danger-color);
}

.tf-date__error {
    display: block;
    margin-top: .375rem;
    font-size: .75rem;
    color: var(--danger-color);
}

.tf-date__panel[popover] {
    position: fixed;
    inset: auto;
    z-index: 1081;
    width: 18rem;
    margin: 0;
    padding: .625rem;
    overflow: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--border-color);
    border-radius: .5rem;
    background: var(--surface-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    font-size: .8125rem;
}

.tf-date__header {
    display: grid;
    grid-template-columns: 2rem 1fr 2rem;
    align-items: center;
    gap: .25rem;
    margin-bottom: .5rem;
}

.tf-date__panel button {
    display: grid;
    place-items: center;
    min-width: 0;
    min-height: 2rem;
    padding: .25rem;
    border: 1px solid transparent;
    border-radius: .375rem;
    background: transparent;
    color: inherit;
    font-size: inherit;
}

.tf-date__panel .tf-date__title {
    font-weight: 600;
}

.tf-date__weekdays,
.tf-date__days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .125rem;
    text-align: center;
}

.tf-date__weekdays {
    margin-bottom: .25rem;
    color: var(--text-secondary);
    font-size: .6875rem;
    line-height: 1.75rem;
}

.tf-date__months {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .375rem;
}

.tf-date__months button {
    min-height: 2.75rem;
    text-transform: capitalize;
}

.tf-date__panel button.is-outside {
    color: var(--text-secondary);
}

.tf-date__panel button.is-today {
    border-color: color-mix(in srgb, var(--primary-color) 50%, transparent);
    color: var(--primary-color);
}

.tf-date__panel button:hover:not(:disabled) {
    background: color-mix(in srgb, var(--primary-color) 9%, transparent);
    color: var(--primary-color);
}

.tf-date__panel button.is-selected,
.tf-date__panel button.is-selected:hover {
    background: var(--primary-color);
    color: #fff;
}

.tf-date__panel button:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.tf-date__panel button:focus-visible,
.tf-date__trigger:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 1px;
}
